fileManager.demos['G-Sensor'] = String.raw`

; I/O addresses (ff00h to ffffh)
LEDS			EQU		FFF8h
DISP7SEG_3      EQU     FFF3h
DISP7SEG_2      EQU     FFF2h
DISP7SEG_1      EQU     FFF1h
DISP7SEG_0      EQU     FFF0h
GSENSOR_X		EQU		FFEBh

				MVI		R1, GSENSOR_X
                MVI		R2, LEDS
                
                ; Read X-Axis acceleration
Loop: 			LOAD	R3, M[R1]

                ; Print to display
                MOV 	R5, R3
                MVI 	R4, DISP7SEG_0
                STOR 	M[R4], R5
                SHR 	R5
                SHR 	R5
                SHR 	R5
                SHR 	R5
                MVI 	R4, DISP7SEG_1
                STOR 	M[R4], R5
                SHR 	R5
                SHR 	R5
                SHR 	R5
                SHR 	R5
                MVI 	R4, DISP7SEG_2
                STOR 	M[R4], R5
                SHR 	R5
                SHR 	R5
                SHR 	R5
                SHR 	R5
                MVI 	R4, DISP7SEG_3
                STOR 	M[R4], R5

                ; Tilted Right
                CMP 	R3, R0
                BR.NP 	NA

                ; Tilted Left
A: 				MVI 	R4, 00C0h
                CMP 	R3, R4
                BR.N 	B
                MVI 	R4, 1100000000b
                STOR 	M[R2], R4
                BR 		Loop

B: 				MVI 	R4, 0060h
                CMP 	R3, R4
                BR.N 	C
                MVI 	R4, 0110000000b
                STOR 	M[R2], R4
                BR 		Loop

C: 				MVI 	R4, 0030h
                CMP 	R3, R4
                BR.N 	D
                MVI 	R4, 0011000000b
                STOR 	M[R2], R4
                BR 		Loop

D: 				MVI 	R4, 0018h
                CMP 	R3, R4
                BR.N 	E
                MVI 	R4, 0001100000b
                STOR 	M[R2], R4
                BR 		Loop

E: 				MVI 	R4, 0000110000b
                STOR 	M[R2], R4
                BR 		Loop

                ; Tilted Right
NA: 			COM 	R3
                MVI 	R4, 00C0h
                CMP 	R3, R4
                BR.N 	NB
                MVI 	R4, 0000000011b
                STOR 	M[R2], R4
                BR 		Loop

NB: 			MVI 	R4, 0060h
                CMP 	R3, R4
                BR.N 	NC
                NOP
                MVI 	R4, 0000000110b
                STOR 	M[R2], R4
                BR 		Loop

NC: 			MVI 	R4, 0030h
                CMP 	R3, R4
                BR.N 	ND
                MVI 	R4, 0000001100b
                STOR 	M[R2], R4
                BR 		Loop

ND: 			MVI 	R4, 0018h
                CMP 	R3, R4
                BR.N 	NE
                MVI 	R4, 0000011000b
                STOR 	M[R2], R4
                BR 		Loop

NE: 			MVI 	R4, 0000110000b
                STOR 	M[R2], R4
                BR 		Loop


`.trim();