cscg22-gearboy

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

mode.s (408B)


      1	.include	"global.s"
      2
      3	.title	"screen modes"
      4	.module	Modes
      5
      6	;; BANKED:	checked
      7	.area	_HOME
      8
      9_mode::
     10	LDA	HL,2(SP)	; Skip return address
     11	LD	L,(HL)
     12	LD	H,#0x00
     13
     14.set_mode::
     15	LD	A,L
     16	LD	(.mode),A
     17
     18	;; AND to get rid of the extra flags
     19	AND	#0x03
     20	LD	L,A
     21	LD	BC,#.MODE_TABLE
     22	SLA	L		; Multiply mode by 4
     23	SLA	L
     24	ADD	HL,BC
     25	JP	(HL)		; Jump to initialization routine
     26
     27_get_mode::
     28	LD	HL,#.mode
     29	LD	E,(HL)
     30	RET