JMP ,main include(std.orgaasm) @main #0000 #4007 /draw/hline #0001 #4007 /draw/hline #007e #4007 /draw/hline #007f #4007 /draw/hline #0000 #4007 /draw/vline #0001 #4007 /draw/vline #007e #4007 /draw/vline #007f #4007 /draw/vline @main/loop SLP /input/update /player/erase /player/update /player/draw /invert JMP ,main/loop @input.kleft 0000 @input.kright 0000 @input.kup 0000 @input.kdown 0000 @input/update ( -- ) -Input LDA DUP #0010 AND #0000 NEQ -input.kup STA DUP #0020 AND #0000 NEQ -input.kdown STA DUP #0040 AND #0000 NEQ -input.kleft STA #0080 AND #0000 NEQ -input.kright STA RET @player.x 003b @player.y 003b @player/update ( -- ) @player/update/movex #0003 #0075 -player.x LDA -input.kleft LDA SUB -input.kright LDA ADD /clamp -player.x STA @player/update/movey #0002 #0074 -player.y LDA -input.kup LDA SUB -input.kdown LDA ADD /clamp -player.y STA @player/update/break RET @player/erase ( -- ) -player.x LDA -player.y LDA -blacksquare /draw/sprite RET @player/draw ( -- ) -player.x LDA -player.y LDA -player.spr /draw/sprite RET @invert ( -- ) -Screen @invert/loop DUP LDA #0001 LSF OVR STA INC DUP JNZ ,invert/loop POP RET @draw/pixel ( x y col -- ) ROT #007f AND ROT #007f AND #0007 LSF ADD -Screen ADD STA RET @draw.col 0000 @draw/hline ( y col -- ) -draw.col STA ( y ) #0080 ( y x ) @draw/hline/loop DEC OVR OVR SWP ( y x x y ) -draw.col LDA ( y x x y col ) /draw/pixel ( y x ) DUP JNZ ,draw/hline/loop POP POP RET @draw/vline ( x col -- ) -draw.col STA ( x ) #0080 ( x y ) @draw/vline/loop DEC OVR OVR ( x y x y ) -draw.col LDA ( x y x y col ) /draw/pixel ( x y ) DUP JNZ ,draw/vline/loop POP POP RET @draw/sprite.oscr 0000 @draw/sprite ( x y addr -- ) ROT ROT #0007 LSF ADD -Screen ADD ( spr scr ) #0008 ( spr scr n ) @draw/sprite/loop DEC OVR OVR #0007 LSF ADD ( spr scr n oscr ) #0080 ADD ( spr scr n oscr ) -draw/sprite.oscr STA ( spr scr n ) ROT SWP OVR OVR #0003 LSF ADD ( scr spr n ospr ) -draw/sprite.oscr LDA ( scr spr n ospr oscr ) #0008 /memcpy ( scr spr n ) SWP ROT ROT ( spr scr n ) DUP JNZ ,draw/sprite/loop POP POP POP RET @blacksquare 0000 0000 000f 000f 000f 000f 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 000f 0000 000f 000f 000f 000f 0000 000f 000f 0000 000f 000f 000f 000f 0000 000f 000f 0000 000f 000f 000f 000f 0000 000f 000f 0000 000f 000f 000f 000f 0000 000f 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 000f 000f 000f 000f 0000 0000 @player.spr 0000 ffff ffff ffff ffff ffff ffff 0000 ffff 0000 ffff ffff ffff ffff 0000 ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff 0000 ffff ffff ffff 0000 0000 0000 0000 ffff ffff 0000 ffff ffff ffff ffff ffff ffff 0000