cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

lcd.s (1047B)


      1	.include	"global.s"
      2
      3
      4	.area	_HEADER_LCD (ABS)
      5
      6	.org	0x48		; LCD
      7.int_LCD:
      8	JP	.int_lcd_handler
      9
     10	.area	_HOME
     11
     12.int_lcd_handler:
     13	PUSH	AF
     14	PUSH	HL
     15	PUSH	BC
     16	PUSH	DE
     17	LD	HL, #.int_0x48 + 0
     18	PUSH    HL		; for stack compatibility with std handler only!
     19	LD	A,(HL+)
     20	LD      H,(HL)
     21	LD	L,A
     22	OR	H
     23	JR 	Z, 1$
     24	RST     0x20		; .call_hl
     25	LD	HL, #.int_0x48 + 2
     26	LD	A,(HL+)
     27	LD      H,(HL)
     28	LD	L,A
     29	OR      H
     30	JR      Z, 1$
     31	RST     0x20		; .call_hl
     32	LD	HL, #.int_0x48 + 4
     33	LD	A,(HL+)
     34	LD      H,(HL)
     35	LD	L,A
     36	OR      H
     37	CALL    NZ, .call_hl
     381$:	
     39	POP     HL
     40	POP	DE
     41	POP	BC
     42	POP	HL
     43
     44	;; we return at least at the beginning of mode 2
     45	WAIT_STAT
     46
     47	POP	AF
     48	RETI
     49
     50_add_LCD::
     51	PUSH	BC
     52	LDA	HL,4(SP)	; Skip return address and registers
     53	LD	C,(HL)
     54	INC	HL
     55	LD	B,(HL)
     56	CALL	.add_LCD
     57	POP	BC
     58	RET
     59
     60.add_LCD::
     61	LD	HL,#.int_0x48
     62	JP	.add_int
     63
     64_remove_LCD::
     65	PUSH	BC
     66	LDA	HL,4(SP)	; Skip return address and registers
     67	LD	C,(HL)
     68	INC	HL
     69	LD	B,(HL)
     70	CALL	.remove_LCD
     71	POP	BC
     72	RET
     73
     74.remove_LCD::
     75	LD	HL,#.int_0x48
     76	JP	.remove_int
     77
     78	.area	_DATA
     79
     80.int_0x48::
     81	.blkw	0x08