Optimized some example files
This commit is contained in:
parent
9cd5bf7d0a
commit
481a318732
|
@ -75,6 +75,7 @@ RTN
|
|||
- Don't brk when return stack is not zeroed
|
||||
- LDRS should load from the zeropage?
|
||||
- Keep ref counts in macros
|
||||
- A fast way(2 bytes) to read from the zero page #aa LDR.
|
||||
|
||||
### Macros
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
;center { x 2 y 2 }
|
||||
;timer { byte 1 }
|
||||
;i { byte 1 }
|
||||
|
||||
|0100 @RESET
|
||||
|
||||
|
@ -12,26 +11,31 @@
|
|||
|
||||
( draw hor line )
|
||||
#0000 =Screen.x ~center.y =Screen.y
|
||||
$draw-hor
|
||||
#0000 ~Screen.width ( from/to )
|
||||
$draw-hor NOP
|
||||
( draw ) #01 =Screen.color
|
||||
( incr ) ~Screen.x #0002 ADD2 =Screen.x
|
||||
,$draw-hor ~Screen.x ~Screen.width LTH2 JMP2? POP2
|
||||
( incr ) SWP2 #0002 ADD2 DUP2 =Screen.x SWP2
|
||||
OVR2 OVR2 LTH2 ^$draw-hor SWP JMPS? POP
|
||||
POP2 POP2
|
||||
|
||||
( draw ver line )
|
||||
~center.x =Screen.x #0000 =Screen.y
|
||||
$draw-ver
|
||||
#0000 ~Screen.height ( from/to )
|
||||
$draw-ver NOP
|
||||
( draw ) #02 =Screen.color
|
||||
( incr ) ~Screen.y #0002 ADD2 =Screen.y
|
||||
,$draw-ver ~Screen.y ~Screen.height LTH2 JMP2? POP2
|
||||
( incr ) SWP2 #0002 ADD2 DUP2 =Screen.y SWP2
|
||||
OVR2 OVR2 LTH2 ^$draw-ver SWP JMPS? POP
|
||||
POP2 POP2
|
||||
|
||||
( draw blending modes )
|
||||
#00 =i
|
||||
#0020 =Sprite.x #0020 =Sprite.y ,icon =Sprite.addr
|
||||
$draw-blends
|
||||
( draw ) #00 ~i ADD =Sprite.color
|
||||
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
|
||||
( incr ) ~i #01 ADD =i
|
||||
,$draw-blends ~i #10 LTH JMP2? POP2
|
||||
#00 #10
|
||||
$draw-blends NOP
|
||||
( move ) OVR #00 SWP #0008 MUL2 #0020 ADD2 =Sprite.x
|
||||
( draw ) OVR =Sprite.color
|
||||
( incr ) SWP #01 ADD SWP
|
||||
DUP2 LTH ^$draw-blends SWP JMPS? POP
|
||||
POP POP
|
||||
|
||||
BRK
|
||||
|
||||
|
|
|
@ -4,38 +4,60 @@
|
|||
|
||||
|0100 @RESET
|
||||
|
||||
,type1 JSR2
|
||||
,type2 JSR2
|
||||
,type3 JSR2
|
||||
,slow-muljmp JSR2
|
||||
,slow-jmppop JSR2
|
||||
,slow-jmppop-rel JSR2
|
||||
,fast-byte JSR2
|
||||
,fast-short JSR2
|
||||
|
||||
BRK
|
||||
|
||||
@type1 ( type: padded muljmp )
|
||||
|0200 @slow-muljmp ( type: padded muljmp )
|
||||
|
||||
$loop NOP
|
||||
~a #01 ADD =a
|
||||
~a #d0 LTH ^$loop MUL JMPS
|
||||
~a =Console.byte
|
||||
|
||||
RTS
|
||||
RTN
|
||||
|
||||
@type2 ( type: jmppop )
|
||||
|0300 @slow-jmppop ( type: jmppop )
|
||||
|
||||
$loop
|
||||
~b #01 ADD =b
|
||||
,$loop ~b #d0 LTH JMP2? POP2
|
||||
~b =Console.byte
|
||||
|
||||
RTS
|
||||
RTN
|
||||
|
||||
@type3 ( type: padded jmppop )
|
||||
|0400 @slow-jmppop-rel ( type: padded jmppop )
|
||||
|
||||
$loop NOP
|
||||
~c #01 ADD =c
|
||||
~c #d0 LTH ^$loop SWP JMPS? POP
|
||||
~c =Console.byte
|
||||
|
||||
RTS
|
||||
RTN
|
||||
|
||||
|0500 @fast-byte ( fast byte )
|
||||
|
||||
#00 #d0
|
||||
$loop NOP
|
||||
( incr ) SWP #01 ADD SWP
|
||||
DUP2 LTH ^$loop SWP JMPS? POP
|
||||
POP =Console.byte
|
||||
|
||||
RTN
|
||||
|
||||
|0600 @fast-short ( fast short )
|
||||
|
||||
#0000 #0d00
|
||||
$loop NOP
|
||||
( incr ) SWP2 #0001 ADD2 SWP2
|
||||
OVR2 OVR2 LTH2 ^$loop SWP JMPS? POP
|
||||
POP2 =Console.short
|
||||
|
||||
RTN
|
||||
|
||||
|c000 @FRAME
|
||||
|d000 @ERROR
|
||||
|
|
Loading…
Reference in New Issue