Lots of INC optimisations
This commit is contained in:
parent
c6c31aa815
commit
93a4802782
|
@ -41,18 +41,18 @@
|
||||||
#0fc5 .System/g DEO2
|
#0fc5 .System/g DEO2
|
||||||
#0f25 .System/b DEO2
|
#0f25 .System/b DEO2
|
||||||
|
|
||||||
#01 .lista #00 + STZ
|
#01 .lista STZ
|
||||||
#02 .lista #01 + STZ
|
#02 .lista INC STZ
|
||||||
#03 .lista #02 + STZ
|
#03 .lista #02 + STZ
|
||||||
|
|
||||||
#10 .listb #00 + STZ
|
#10 .listb STZ
|
||||||
#20 .listb #01 + STZ
|
#20 .listb INC STZ
|
||||||
#30 .listb #02 + STZ
|
#30 .listb #02 + STZ
|
||||||
|
|
||||||
.lista .listb .listc ;add-lists-loop JSR2
|
.lista .listb .listc ;add-lists-loop JSR2
|
||||||
|
|
||||||
.listc LDZ DEBUG
|
.listc LDZ DEBUG
|
||||||
.listc #01 + LDZ DEBUG
|
.listc INC LDZ DEBUG
|
||||||
.listc #02 + LDZ DEBUG
|
.listc #02 + LDZ DEBUG
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
@ -64,8 +64,8 @@ vectors (a.k.a. arrays) of three elements each. )
|
||||||
|
|
||||||
STH
|
STH
|
||||||
( a[0] b[0] + ) LDZk STH SWP LDZk STHr + STHkr STZ
|
( a[0] b[0] + ) LDZk STH SWP LDZk STHr + STHkr STZ
|
||||||
( a[1] b[1] + ) #01 + LDZk STH SWP #01 + LDZk STHr + STHkr #01 + STZ
|
( a[1] b[1] + ) INC LDZk STH SWP INC LDZk STHr + STHkr INC STZ
|
||||||
( a[2] b[2] + ) #01 + LDZ SWP #01 + LDZ + STHr #02 + STZ
|
( a[2] b[2] + ) INC LDZ SWP INC LDZ + STHr #02 + STZ
|
||||||
|
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ RTN
|
||||||
( get a[x] ) OVR2 STHkr ADD LDZ
|
( get a[x] ) OVR2 STHkr ADD LDZ
|
||||||
( get b[x] ) SWP STHkr ADD LDZ
|
( get b[x] ) SWP STHkr ADD LDZ
|
||||||
( set c[x] ) ADD STHr STHkr ADD STZ
|
( set c[x] ) ADD STHr STHkr ADD STZ
|
||||||
( incr ) SWP #01 ADD SWP
|
( incr ) SWP INC SWP
|
||||||
LTHk ,&loop JCN
|
LTHk ,&loop JCN
|
||||||
POP2 POP2 POPr
|
POP2 POP2 POPr
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
( Project by Alex Schroeder - https://alexschroeder.ch )
|
( Project by Alex Schroeder - https://alexschroeder.ch )
|
||||||
|
|
||||||
%RTN { JMP2r }
|
%RTN { JMP2r }
|
||||||
%INCR { SWP #01 ADD SWP }
|
%INCR { SWP INC SWP }
|
||||||
%CELL { #1000 }
|
%CELL { #1000 }
|
||||||
%NEXT { #2000 }
|
%NEXT { #2000 }
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ RTN
|
||||||
OVR DUP DUP ( three copies of the counter )
|
OVR DUP DUP ( three copies of the counter )
|
||||||
#01 SUB #00 SWP CELL ADD2 LDA
|
#01 SUB #00 SWP CELL ADD2 LDA
|
||||||
SWP
|
SWP
|
||||||
#01 ADD #00 SWP CELL ADD2 LDA
|
INC #00 SWP CELL ADD2 LDA
|
||||||
( the cell dies if the neighbors are either both dead or both alive, i.e. Rule 90 )
|
( the cell dies if the neighbors are either both dead or both alive, i.e. Rule 90 )
|
||||||
NEQ
|
NEQ
|
||||||
( one copy of the counter and the life value )
|
( one copy of the counter and the life value )
|
||||||
|
|
|
@ -66,7 +66,7 @@ BRK
|
||||||
;draw-cursor JSR2
|
;draw-cursor JSR2
|
||||||
|
|
||||||
.Mouse/state DEI #00 EQU ,&no-touch JCN
|
.Mouse/state DEI #00 EQU ,&no-touch JCN
|
||||||
( incr ) .style LDZ #01 ADD #03 MOD .style STZ
|
( incr ) .style LDZ INC #03 MOD .style STZ
|
||||||
( bg ) ;tiles .style LDZ #40 SFT TOS ADD2 ;cover-pattern JSR2
|
( bg ) ;tiles .style LDZ #40 SFT TOS ADD2 ;cover-pattern JSR2
|
||||||
( fg ) ;redraw JSR2
|
( fg ) ;redraw JSR2
|
||||||
( release ) #00 .Mouse/state DEO
|
( release ) #00 .Mouse/state DEO
|
||||||
|
@ -77,7 +77,7 @@ BRK
|
||||||
@on-button ( -> )
|
@on-button ( -> )
|
||||||
|
|
||||||
.Controller/button DEI #00 EQU ,&no-touch JCN
|
.Controller/button DEI #00 EQU ,&no-touch JCN
|
||||||
( incr ) .style LDZ #01 ADD #03 MOD .style STZ
|
( incr ) .style LDZ INC #03 MOD .style STZ
|
||||||
( bg ) ;tiles .style LDZ #40 SFT TOS ADD2 ;cover-pattern JSR2
|
( bg ) ;tiles .style LDZ #40 SFT TOS ADD2 ;cover-pattern JSR2
|
||||||
( fg ) ;redraw JSR2
|
( fg ) ;redraw JSR2
|
||||||
( release ) #00 .Mouse/state DEO
|
( release ) #00 .Mouse/state DEO
|
||||||
|
@ -127,7 +127,7 @@ RTN
|
||||||
( set style ) .style LDZ #40 SFT TOS ADD2
|
( set style ) .style LDZ #40 SFT TOS ADD2
|
||||||
.Screen/addr DEO2
|
.Screen/addr DEO2
|
||||||
( draw ) #01 .Screen/sprite DEO
|
( draw ) #01 .Screen/sprite DEO
|
||||||
( incr ) SWP #01 ADD SWP
|
( incr ) SWP INC SWP
|
||||||
LTHk ,&loop JCN
|
LTHk ,&loop JCN
|
||||||
POP2
|
POP2
|
||||||
POPr
|
POPr
|
||||||
|
|
|
@ -87,7 +87,7 @@ BRK
|
||||||
|
|
||||||
|
|
||||||
@on_frame ( -> )
|
@on_frame ( -> )
|
||||||
;f_count LDA #01 ADD DUP ;f_count STA ( increase frame counter )
|
;f_count LDA INC DUP ;f_count STA ( increase frame counter )
|
||||||
;ani_speedmask LDA ( mask with animation speed mask )
|
;ani_speedmask LDA ( mask with animation speed mask )
|
||||||
AND #00 EQU ,update_frame JCN ( jump to update if it's time )
|
AND #00 EQU ,update_frame JCN ( jump to update if it's time )
|
||||||
BRK
|
BRK
|
||||||
|
@ -127,7 +127,7 @@ BRK
|
||||||
|
|
||||||
#40 .Screen/sprite DEO
|
#40 .Screen/sprite DEO
|
||||||
|
|
||||||
#01 ADD
|
INC
|
||||||
DUP2
|
DUP2
|
||||||
NEQ ,&rocks_loop JCN
|
NEQ ,&rocks_loop JCN
|
||||||
POP2
|
POP2
|
||||||
|
@ -162,7 +162,7 @@ JMP2r
|
||||||
DUP
|
DUP
|
||||||
;r_color ROT #00 SWP ADD2 LDA #41 ADD .Screen/sprite DEO
|
;r_color ROT #00 SWP ADD2 LDA #41 ADD .Screen/sprite DEO
|
||||||
|
|
||||||
#01 ADD
|
INC
|
||||||
|
|
||||||
DUP2
|
DUP2
|
||||||
NEQ ,&rocks_loop JCN
|
NEQ ,&rocks_loop JCN
|
||||||
|
@ -239,7 +239,7 @@ JMP2r
|
||||||
|
|
||||||
( check collision with rocks )
|
( check collision with rocks )
|
||||||
( nrocks #00 )
|
( nrocks #00 )
|
||||||
,&src_i LDR nrocks_mask AND DUP #01 ADD nrocks_mask AND
|
,&src_i LDR nrocks_mask AND DUP INC nrocks_mask AND
|
||||||
|
|
||||||
&rocks_loop
|
&rocks_loop
|
||||||
DUP ( get rocks_x[i] )
|
DUP ( get rocks_x[i] )
|
||||||
|
@ -254,7 +254,7 @@ JMP2r
|
||||||
,&src_y LDR ,&rock_y LDR ,&range_y LDR ADD LTH ( if sy < ry + 8 )
|
,&src_y LDR ,&rock_y LDR ,&range_y LDR ADD LTH ( if sy < ry + 8 )
|
||||||
ADD ADD ADD #04 EQU ,&found JCN
|
ADD ADD ADD #04 EQU ,&found JCN
|
||||||
|
|
||||||
#01 ADD nrocks_mask AND
|
INC nrocks_mask AND
|
||||||
DUP2
|
DUP2
|
||||||
NEQ ,&rocks_loop JCN
|
NEQ ,&rocks_loop JCN
|
||||||
POP2
|
POP2
|
||||||
|
@ -426,7 +426,7 @@ JMP2r
|
||||||
( increment and save animation pointer )
|
( increment and save animation pointer )
|
||||||
&s_animate
|
&s_animate
|
||||||
DUP
|
DUP
|
||||||
get_nibble_h #01 ADD #03 AND #40 SFT
|
get_nibble_h INC #03 AND #40 SFT
|
||||||
SWP get_nibble_l ORA
|
SWP get_nibble_l ORA
|
||||||
;c_state STA
|
;c_state STA
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
%RTN { JMP2r }
|
%RTN { JMP2r }
|
||||||
%TOS { #00 SWP }
|
%TOS { #00 SWP }
|
||||||
%INCR { SWP #01 ADD SWP }
|
%INCR { SWP INC SWP }
|
||||||
|
|
||||||
( devices )
|
( devices )
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ BRK
|
||||||
( draw ) STHkr .Screen/sprite DEO
|
( draw ) STHkr .Screen/sprite DEO
|
||||||
( use width ) .Screen/x DEI2 ++ .Screen/x DEO2
|
( use width ) .Screen/x DEI2 ++ .Screen/x DEO2
|
||||||
&continue
|
&continue
|
||||||
( incr addr ) #0001 ++
|
( incr addr ) INC2
|
||||||
LDAk ,&loop JCN
|
LDAk ,&loop JCN
|
||||||
POP2 POP2 POPr
|
POP2 POP2 POPr
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ RTN
|
||||||
POP ,&continue JMP &no-linebreak
|
POP ,&continue JMP &no-linebreak
|
||||||
STHkr ,&sprite JSR
|
STHkr ,&sprite JSR
|
||||||
&continue
|
&continue
|
||||||
( incr addr ) #0001 ++
|
( incr addr ) INC2
|
||||||
LDAk ,&loop JCN
|
LDAk ,&loop JCN
|
||||||
POP2 POP2 POPr
|
POP2 POP2 POPr
|
||||||
RTN
|
RTN
|
||||||
|
@ -129,7 +129,7 @@ RTN
|
||||||
POP ,&continue JMP &no-linebreak
|
POP ,&continue JMP &no-linebreak
|
||||||
STHkr ,&sprite JSR
|
STHkr ,&sprite JSR
|
||||||
&continue
|
&continue
|
||||||
( incr addr ) #0001 ++
|
( incr addr ) INC2
|
||||||
LDAk ,&loop JCN
|
LDAk ,&loop JCN
|
||||||
POP2 POP2 POPr
|
POP2 POP2 POPr
|
||||||
RTN
|
RTN
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
( dev/controller/buttons )
|
( dev/controller/buttons )
|
||||||
|
|
||||||
%++ { #0001 ADD2 }
|
%++ { INC2 }
|
||||||
%-- { #0001 SUB2 }
|
%-- { #0001 SUB2 }
|
||||||
%2// { #01 SFT2 }
|
%2// { #01 SFT2 }
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
.lines/x1 LDZ2 .lines/x2 LDZ2
|
.lines/x1 LDZ2 .lines/x2 LDZ2
|
||||||
OVR2 OVR2 .lines/y1 LDZ2 ;h JSR2
|
OVR2 OVR2 .lines/y1 LDZ2 ;h JSR2
|
||||||
.lines/y2 LDZ2 ;h JSR2
|
.lines/y2 LDZ2 ;h JSR2
|
||||||
.lines/y1 LDZ2 #0001 SUB2 .lines/y2 LDZ2 #0001 ADD2
|
.lines/y1 LDZ2 #0001 SUB2 .lines/y2 LDZ2 INC2
|
||||||
OVR2 OVR2 .lines/x1 LDZ2 ;v JSR2
|
OVR2 OVR2 .lines/x1 LDZ2 ;v JSR2
|
||||||
.lines/x2 LDZ2 ;v JSR2
|
.lines/x2 LDZ2 ;v JSR2
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
|
|
||||||
#01 .Screen/sprite DEO
|
#01 .Screen/sprite DEO
|
||||||
#0000 #00 .number/count LDZ DUP2 ;h JSR2
|
#0000 #00 .number/count LDZ DUP2 ;h JSR2
|
||||||
.number/count LDZ #01 ADD .number/count STZ
|
.number/count LDZ INC .number/count STZ
|
||||||
|
|
||||||
@neralie-calc ( -- )
|
@neralie-calc ( -- )
|
||||||
( add up fractions of a pulse, store tenths in n6 )
|
( add up fractions of a pulse, store tenths in n6 )
|
||||||
|
@ -143,7 +143,7 @@
|
||||||
|
|
||||||
&next ( digit-addr number* -- next-digit-addr next-number* prev-digit* )
|
&next ( digit-addr number* -- next-digit-addr next-number* prev-digit* )
|
||||||
#03e8 ;modf JSR2 STH2 #000a MUL2
|
#03e8 ;modf JSR2 STH2 #000a MUL2
|
||||||
ROT DUP STH #01 ADD ROT ROT
|
ROT DUP STH INC ROT ROT
|
||||||
#00 STHr LDZ ADD2
|
#00 STHr LDZ ADD2
|
||||||
STH2r
|
STH2r
|
||||||
JMP2r
|
JMP2r
|
||||||
|
@ -194,7 +194,7 @@
|
||||||
,&loop JMP
|
,&loop JMP
|
||||||
|
|
||||||
@update-fps ( -- )
|
@update-fps ( -- )
|
||||||
.fps/next LDZ #01 ADD .fps/next STZ
|
.fps/next LDZ INC .fps/next STZ
|
||||||
s .fps/second LDZ NEQ JMP JMP2r
|
s .fps/second LDZ NEQ JMP JMP2r
|
||||||
s .fps/second STZ
|
s .fps/second STZ
|
||||||
.fps/next LDZ .fps/current STZ
|
.fps/next LDZ .fps/current STZ
|
||||||
|
@ -242,7 +242,7 @@
|
||||||
GTH2 ,&carry JCN
|
GTH2 ,&carry JCN
|
||||||
JMP2r
|
JMP2r
|
||||||
&carry
|
&carry
|
||||||
ROT #01 ADD ROT ROT
|
ROT INC ROT ROT
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
@font-numbers
|
@font-numbers
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
( Dev/Screen )
|
( Dev/Screen )
|
||||||
|
|
||||||
%RTN { JMP2r }
|
%RTN { JMP2r }
|
||||||
%++ { #0001 ADD2 }
|
%++ { INC2 }
|
||||||
%2// { #01 SFT2 }
|
%2// { #01 SFT2 }
|
||||||
%4// { #02 SFT2 }
|
%4// { #02 SFT2 }
|
||||||
%4** { #20 SFT2 }
|
%4** { #20 SFT2 }
|
||||||
|
@ -149,7 +149,7 @@ RTN
|
||||||
&draw-pixel1
|
&draw-pixel1
|
||||||
( move ) OVR #30 SFT #00 SWP #0010 ADD2 .Screen/x DEO2
|
( move ) OVR #30 SFT #00 SWP #0010 ADD2 .Screen/x DEO2
|
||||||
( draw ) OVR .Screen/pixel DEO
|
( draw ) OVR .Screen/pixel DEO
|
||||||
( incr ) SWP #01 ADD SWP
|
( incr ) SWP INC SWP
|
||||||
LTHk ,&draw-pixel1 JCN
|
LTHk ,&draw-pixel1 JCN
|
||||||
POP POP
|
POP POP
|
||||||
#0018 .Screen/y DEO2
|
#0018 .Screen/y DEO2
|
||||||
|
@ -157,7 +157,7 @@ RTN
|
||||||
&draw-pixel2
|
&draw-pixel2
|
||||||
( move ) OVR #30 SFT #00 SWP #0010 ADD2 .Screen/x DEO2
|
( move ) OVR #30 SFT #00 SWP #0010 ADD2 .Screen/x DEO2
|
||||||
( draw ) OVR #08 ADD .Screen/pixel DEO
|
( draw ) OVR #08 ADD .Screen/pixel DEO
|
||||||
( incr ) SWP #01 ADD SWP
|
( incr ) SWP INC SWP
|
||||||
LTHk ,&draw-pixel2 JCN
|
LTHk ,&draw-pixel2 JCN
|
||||||
POP POP
|
POP POP
|
||||||
#0020 .Screen/y DEO2
|
#0020 .Screen/y DEO2
|
||||||
|
@ -165,7 +165,7 @@ RTN
|
||||||
&draw-icn1
|
&draw-icn1
|
||||||
( move ) OVR #30 SFT #00 SWP #0010 ADD2 .Screen/x DEO2
|
( move ) OVR #30 SFT #00 SWP #0010 ADD2 .Screen/x DEO2
|
||||||
( draw ) OVR #00 ADD .Screen/sprite DEO
|
( draw ) OVR #00 ADD .Screen/sprite DEO
|
||||||
( incr ) SWP #01 ADD SWP
|
( incr ) SWP INC SWP
|
||||||
LTHk ,&draw-icn1 JCN
|
LTHk ,&draw-icn1 JCN
|
||||||
POP POP
|
POP POP
|
||||||
#0028 .Screen/y DEO2
|
#0028 .Screen/y DEO2
|
||||||
|
@ -173,7 +173,7 @@ RTN
|
||||||
&draw-icn2
|
&draw-icn2
|
||||||
( move ) OVR #30 SFT #00 SWP #0010 ADD2 .Screen/x DEO2
|
( move ) OVR #30 SFT #00 SWP #0010 ADD2 .Screen/x DEO2
|
||||||
( draw ) OVR #08 ADD .Screen/sprite DEO
|
( draw ) OVR #08 ADD .Screen/sprite DEO
|
||||||
( incr ) SWP #01 ADD SWP
|
( incr ) SWP INC SWP
|
||||||
LTHk ,&draw-icn2 JCN
|
LTHk ,&draw-icn2 JCN
|
||||||
POP POP
|
POP POP
|
||||||
#0030 .Screen/y DEO2
|
#0030 .Screen/y DEO2
|
||||||
|
@ -181,7 +181,7 @@ RTN
|
||||||
&draw-chr1
|
&draw-chr1
|
||||||
( move ) OVR #30 SFT #00 SWP #0010 ADD2 .Screen/x DEO2
|
( move ) OVR #30 SFT #00 SWP #0010 ADD2 .Screen/x DEO2
|
||||||
( draw ) OVR #80 ADD .Screen/sprite DEO
|
( draw ) OVR #80 ADD .Screen/sprite DEO
|
||||||
( incr ) SWP #01 ADD SWP
|
( incr ) SWP INC SWP
|
||||||
LTHk ,&draw-chr1 JCN
|
LTHk ,&draw-chr1 JCN
|
||||||
POP POP
|
POP POP
|
||||||
#0038 .Screen/y DEO2
|
#0038 .Screen/y DEO2
|
||||||
|
@ -189,7 +189,7 @@ RTN
|
||||||
&draw-chr2
|
&draw-chr2
|
||||||
( move ) OVR #30 SFT #00 SWP #0010 ADD2 .Screen/x DEO2
|
( move ) OVR #30 SFT #00 SWP #0010 ADD2 .Screen/x DEO2
|
||||||
( draw ) OVR #88 ADD .Screen/sprite DEO
|
( draw ) OVR #88 ADD .Screen/sprite DEO
|
||||||
( incr ) SWP #01 ADD SWP
|
( incr ) SWP INC SWP
|
||||||
LTHk ,&draw-chr2 JCN
|
LTHk ,&draw-chr2 JCN
|
||||||
POP POP
|
POP POP
|
||||||
|
|
||||||
|
@ -294,10 +294,10 @@ RTN
|
||||||
&hor
|
&hor
|
||||||
( save ) OVR2 .Screen/x DEO2
|
( save ) OVR2 .Screen/x DEO2
|
||||||
( draw ) .color LDZ .Screen/pixel DEO
|
( draw ) .color LDZ .Screen/pixel DEO
|
||||||
( incr ) SWP2 #0001 ADD2 SWP2
|
( incr ) SWP2 INC2 SWP2
|
||||||
LTH2k ,&hor JCN
|
LTH2k ,&hor JCN
|
||||||
POP2 POP2 STH2r STH2r
|
POP2 POP2 STH2r STH2r
|
||||||
( incr ) SWP2 #0001 ADD2 SWP2
|
( incr ) SWP2 INC2 SWP2
|
||||||
LTH2k ,&ver JCN
|
LTH2k ,&ver JCN
|
||||||
POP2 POP2 POP2 POP2
|
POP2 POP2 POP2 POP2
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ BRK
|
||||||
|
|
||||||
&loop
|
&loop
|
||||||
( send ) LDAk .Console/write DEO
|
( send ) LDAk .Console/write DEO
|
||||||
( incr ) #0001 ADD2
|
( incr ) INC2
|
||||||
( loop ) LDAk ,&loop JCN
|
( loop ) LDAk ,&loop JCN
|
||||||
POP2
|
POP2
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#09 .Screen/sprite DEO
|
#09 .Screen/sprite DEO
|
||||||
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
|
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
|
||||||
&next
|
&next
|
||||||
#0001 ADD2
|
INC2
|
||||||
,draw JMP
|
,draw JMP
|
||||||
|
|
||||||
&linefeed
|
&linefeed
|
||||||
|
|
|
@ -68,7 +68,7 @@ BRK
|
||||||
|
|
||||||
&keep-going
|
&keep-going
|
||||||
.Console/write DEO
|
.Console/write DEO
|
||||||
#0001 ADD2
|
INC2
|
||||||
,print-string JMP
|
,print-string JMP
|
||||||
|
|
||||||
@successtxt "Success! 09 $1
|
@successtxt "Success! 09 $1
|
||||||
|
|
|
@ -33,7 +33,7 @@ BRK
|
||||||
#09 .Screen/sprite DEO
|
#09 .Screen/sprite DEO
|
||||||
,get-x-advance JSR .Screen/x DEI2 ADD2 STH2kr ADD2 .Screen/x DEO2
|
,get-x-advance JSR .Screen/x DEI2 ADD2 STH2kr ADD2 .Screen/x DEO2
|
||||||
&next
|
&next
|
||||||
#0001 ADD2
|
INC2
|
||||||
,&loop JMP
|
,&loop JMP
|
||||||
|
|
||||||
&linefeed
|
&linefeed
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
#ffff
|
#ffff
|
||||||
&loop
|
&loop
|
||||||
DUP2 ,row JSR
|
DUP2 ,row JSR
|
||||||
#0001 ADD2
|
INC2
|
||||||
DUP2 .Screen/height DEI2 LTH2 ,&loop JCN
|
DUP2 .Screen/height DEI2 LTH2 ,&loop JCN
|
||||||
POP2
|
POP2
|
||||||
.scroll/wait LDZ ,&noscroll JCN
|
.scroll/wait LDZ ,&noscroll JCN
|
||||||
.scroll/y LDZ2 #0001 ADD2 .scroll/y STZ2
|
.scroll/y LDZ2 INC2 .scroll/y STZ2
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
&noscroll
|
&noscroll
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
OVR2 .Screen/x DEO2
|
OVR2 .Screen/x DEO2
|
||||||
#05 ADD .Screen/pixel DEO
|
#05 ADD .Screen/pixel DEO
|
||||||
.Screen/y DEI2
|
.Screen/y DEI2
|
||||||
DUP2 #0001 ADD2 .Screen/y DEO2
|
DUP2 INC2 .Screen/y DEO2
|
||||||
#00 .Screen/pixel DEO
|
#00 .Screen/pixel DEO
|
||||||
.Screen/y DEO2
|
.Screen/y DEO2
|
||||||
POP
|
POP
|
||||||
|
|
|
@ -162,7 +162,7 @@
|
||||||
#09 .Console/write DEO
|
#09 .Console/write DEO
|
||||||
DUP2 #0004 ADD2
|
DUP2 #0004 ADD2
|
||||||
&loop
|
&loop
|
||||||
DUP2 #0001 ADD2 SWP2 LDA
|
DUP2 INC2 SWP2 LDA
|
||||||
DUP #00 EQU ,&end JCN
|
DUP #00 EQU ,&end JCN
|
||||||
.Console/write DEO
|
.Console/write DEO
|
||||||
,&loop JMP
|
,&loop JMP
|
||||||
|
@ -189,7 +189,7 @@
|
||||||
( here )
|
( here )
|
||||||
DUP2 #0004 ADD2
|
DUP2 #0004 ADD2
|
||||||
&loop
|
&loop
|
||||||
DUP2 #0001 ADD2 SWP2 LDA
|
DUP2 INC2 SWP2 LDA
|
||||||
DUP #00 EQU ,&end JCN
|
DUP #00 EQU ,&end JCN
|
||||||
.Console/write DEO
|
.Console/write DEO
|
||||||
,&loop JMP
|
,&loop JMP
|
||||||
|
@ -211,7 +211,7 @@
|
||||||
|
|
||||||
&keep-going
|
&keep-going
|
||||||
.Console/write DEO
|
.Console/write DEO
|
||||||
#0001 ADD2
|
INC2
|
||||||
,asma-print-string JMP
|
,asma-print-string JMP
|
||||||
|
|
||||||
@asma-print-short ( short* -- )
|
@asma-print-short ( short* -- )
|
||||||
|
@ -244,7 +244,7 @@
|
||||||
( fall through )
|
( fall through )
|
||||||
|
|
||||||
@asma-init-next-pass ( -- )
|
@asma-init-next-pass ( -- )
|
||||||
;asma/pass LDA #01 ADD ;asma/pass STA
|
;asma/pass LDA INC ;asma/pass STA
|
||||||
;asma-write-buffer ;asma-output/ptr STA2
|
;asma-write-buffer ;asma-output/ptr STA2
|
||||||
#0000 DUP2k
|
#0000 DUP2k
|
||||||
;asma-output/offset STA2
|
;asma-output/offset STA2
|
||||||
|
@ -280,7 +280,7 @@
|
||||||
|
|
||||||
&last-one
|
&last-one
|
||||||
ADD2k #00 ROT ROT STA
|
ADD2k #00 ROT ROT STA
|
||||||
#0001 ADD2
|
INC2
|
||||||
,asma-assemble-chunk JSR asma-IF-ERROR ,&error JCN
|
,asma-assemble-chunk JSR asma-IF-ERROR ,&error JCN
|
||||||
|
|
||||||
( flush output buffer )
|
( flush output buffer )
|
||||||
|
@ -307,7 +307,7 @@
|
||||||
&next-char-pop
|
&next-char-pop
|
||||||
POP
|
POP
|
||||||
&next-char
|
&next-char
|
||||||
#0001 ADD2
|
INC2
|
||||||
&loop ( last-ptr* ptr* / start-of-token* )
|
&loop ( last-ptr* ptr* / start-of-token* )
|
||||||
OVR2 OVR2 LTH2 ,&end JCN
|
OVR2 OVR2 LTH2 ,&end JCN
|
||||||
LDAk ( last-ptr* ptr* char / start-of-token* )
|
LDAk ( last-ptr* ptr* char / start-of-token* )
|
||||||
|
@ -318,10 +318,10 @@
|
||||||
STH2r ,asma-assemble-token JSR asma-IF-ERROR ,&error JCN
|
STH2r ,asma-assemble-token JSR asma-IF-ERROR ,&error JCN
|
||||||
|
|
||||||
#0a NEQ ,¬-newline JCN
|
#0a NEQ ,¬-newline JCN
|
||||||
;asma/line LDA2 #0001 ADD2 ;asma/line STA2
|
;asma/line LDA2 INC2 ;asma/line STA2
|
||||||
¬-newline
|
¬-newline
|
||||||
|
|
||||||
DUP2 #0001 ADD2 STH2 ,&next-char JMP
|
DUP2 INC2 STH2 ,&next-char JMP
|
||||||
|
|
||||||
&end
|
&end
|
||||||
POP2 POP2 STH2r
|
POP2 POP2 STH2r
|
||||||
|
@ -361,7 +361,7 @@
|
||||||
|
|
||||||
¬-empty ( token* / )
|
¬-empty ( token* / )
|
||||||
( truncate to one char long )
|
( truncate to one char long )
|
||||||
#0001 ADD2 ( end* / )
|
INC2 ( end* / )
|
||||||
STH2k LDAkr ( end* / end* char )
|
STH2k LDAkr ( end* / end* char )
|
||||||
STH2k ( end* / end* char end* )
|
STH2k ( end* / end* char end* )
|
||||||
LITr 00 STH2 ( / end* char end* 00 end* )
|
LITr 00 STH2 ( / end* char end* 00 end* )
|
||||||
|
@ -420,7 +420,7 @@
|
||||||
LDAk
|
LDAk
|
||||||
DUP ,¬-end JCN
|
DUP ,¬-end JCN
|
||||||
POP POP2
|
POP POP2
|
||||||
STH2r ROT #01 ADD DUPk ADD ADD
|
STH2r ROT INC DUPk ADD ADD
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
¬-end
|
¬-end
|
||||||
|
@ -428,7 +428,7 @@
|
||||||
DUP #f0 AND ,&fail JCN
|
DUP #f0 AND ,&fail JCN
|
||||||
LITr 40 SFT2r
|
LITr 40 SFT2r
|
||||||
#00 STH STH ADD2r
|
#00 STH STH ADD2r
|
||||||
#0001 ADD2
|
INC2
|
||||||
,&loop JMP
|
,&loop JMP
|
||||||
|
|
||||||
&fail
|
&fail
|
||||||
|
@ -447,7 +447,7 @@
|
||||||
|
|
||||||
¬-end
|
¬-end
|
||||||
LITr 01 ADDr
|
LITr 01 ADDr
|
||||||
#0001 ADD2
|
INC2
|
||||||
,&loop JMP
|
,&loop JMP
|
||||||
|
|
||||||
%asma-SHORT-FLAG { #20 }
|
%asma-SHORT-FLAG { #20 }
|
||||||
|
@ -510,7 +510,7 @@
|
||||||
&loop
|
&loop
|
||||||
EQU2k ,&ready JCN
|
EQU2k ,&ready JCN
|
||||||
#00 ,&write JSR
|
#00 ,&write JSR
|
||||||
#0001 ADD2
|
INC2
|
||||||
,&loop JMP
|
,&loop JMP
|
||||||
|
|
||||||
&rewound
|
&rewound
|
||||||
|
@ -518,7 +518,7 @@
|
||||||
POP2 POP2 POP JMP2r
|
POP2 POP2 POP JMP2r
|
||||||
|
|
||||||
&ready
|
&ready
|
||||||
POP2 #0001 ADD2
|
POP2 INC2
|
||||||
DUP2 ;asma/addr STA2
|
DUP2 ;asma/addr STA2
|
||||||
;asma/written-addr STA2
|
;asma/written-addr STA2
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@
|
||||||
DUP2 ;asma-write-buffer/end EQU2 ,&flush JCN
|
DUP2 ;asma-write-buffer/end EQU2 ,&flush JCN
|
||||||
&after-flush
|
&after-flush
|
||||||
STH2k STA
|
STH2k STA
|
||||||
STH2r #0001 ADD2 ,asma-output/ptr STR2
|
STH2r INC2 ,asma-output/ptr STR2
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
&flush ( ptr* -- start-of-buffer* )
|
&flush ( ptr* -- start-of-buffer* )
|
||||||
|
@ -552,7 +552,7 @@
|
||||||
@asma-append-heap-byte ( dummy byte -- dummy )
|
@asma-append-heap-byte ( dummy byte -- dummy )
|
||||||
;asma/heap LDA2
|
;asma/heap LDA2
|
||||||
OVR2 OVR2 STA POP
|
OVR2 OVR2 STA POP
|
||||||
#0001 ADD2 ;asma/heap STA2
|
INC2 ;asma/heap STA2
|
||||||
POP
|
POP
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
|
@ -568,7 +568,7 @@
|
||||||
POP2 JMP2r
|
POP2 JMP2r
|
||||||
|
|
||||||
&keep-going
|
&keep-going
|
||||||
#0001 ADD2
|
INC2
|
||||||
,asma-append-heap-string JMP
|
,asma-append-heap-string JMP
|
||||||
|
|
||||||
@asma-traverse-tree ( incoming-ptr* -- binary-ptr* 00 if key found
|
@asma-traverse-tree ( incoming-ptr* -- binary-ptr* 00 if key found
|
||||||
|
@ -595,7 +595,7 @@
|
||||||
;asma/token LDA2 STH2
|
;asma/token LDA2 STH2
|
||||||
|
|
||||||
&loop ( node-key* / token* )
|
&loop ( node-key* / token* )
|
||||||
DUP2 #0001 ADD2 SWP2 LDA LDAkr STHr
|
DUP2 INC2 SWP2 LDA LDAkr STHr
|
||||||
ORAk ,¬-end JCN
|
ORAk ,¬-end JCN
|
||||||
|
|
||||||
( end of C strings, match found )
|
( end of C strings, match found )
|
||||||
|
@ -734,7 +734,7 @@
|
||||||
|
|
||||||
¬-end
|
¬-end
|
||||||
;asma-write-byte JSR2
|
;asma-write-byte JSR2
|
||||||
#0001 ADD2
|
INC2
|
||||||
,&loop JMP
|
,&loop JMP
|
||||||
|
|
||||||
@asma-literal-abs-addr
|
@asma-literal-abs-addr
|
||||||
|
@ -775,7 +775,7 @@
|
||||||
|
|
||||||
@asma-addr-helper ( -- addr* )
|
@asma-addr-helper ( -- addr* )
|
||||||
;asma/token LDA2 LDAk #26 NEQ ,¬-local JCN
|
;asma/token LDA2 LDAk #26 NEQ ,¬-local JCN
|
||||||
#0001 ADD2 ;asma/token STA2
|
INC2 ;asma/token STA2
|
||||||
;asma-trees/scope LDA2
|
;asma-trees/scope LDA2
|
||||||
,&final-lookup JMP
|
,&final-lookup JMP
|
||||||
|
|
||||||
|
@ -788,7 +788,7 @@
|
||||||
|
|
||||||
¬-end ( token* char )
|
¬-end ( token* char )
|
||||||
#2f EQU ,&found-slash JCN
|
#2f EQU ,&found-slash JCN
|
||||||
#0001 ADD2
|
INC2
|
||||||
,¬-local JMP
|
,¬-local JMP
|
||||||
|
|
||||||
&found-slash ( token* )
|
&found-slash ( token* )
|
||||||
|
@ -797,7 +797,7 @@
|
||||||
SWP2 DUP2 #2f ROT ROT STA
|
SWP2 DUP2 #2f ROT ROT STA
|
||||||
STHr ,¬-found2 JCN
|
STHr ,¬-found2 JCN
|
||||||
( token* binary-ptr* )
|
( token* binary-ptr* )
|
||||||
#0001 ADD2 ;asma/token STA2
|
INC2 ;asma/token STA2
|
||||||
#0002 ADD2
|
#0002 ADD2
|
||||||
|
|
||||||
&final-lookup ( addr-offset* incoming-ptr* )
|
&final-lookup ( addr-offset* incoming-ptr* )
|
||||||
|
@ -861,7 +861,7 @@
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
&keep-going
|
&keep-going
|
||||||
DUP2k ;asma-strlen JSR2 #00 SWP #0001 ADD2 ADD2
|
DUP2k ;asma-strlen JSR2 #00 SWP INC2 ADD2
|
||||||
SWP2 ;asma-assemble-token JSR2 asma-IF-ERROR ,&error JCN
|
SWP2 ;asma-assemble-token JSR2 asma-IF-ERROR ,&error JCN
|
||||||
,¯o-loop JMP
|
,¯o-loop JMP
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
&append
|
&append
|
||||||
;buffer/cursor LDA2
|
;buffer/cursor LDA2
|
||||||
STH2k STA
|
STH2k STA
|
||||||
STH2r #0001 ADD2 ;ring-buffer ORA2 ;buffer/cursor STA2
|
STH2r INC2 ;ring-buffer ORA2 ;buffer/cursor STA2
|
||||||
,&draw JMP
|
,&draw JMP
|
||||||
|
|
||||||
&backspace
|
&backspace
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
DUP2 .File/name DEO2
|
DUP2 .File/name DEO2
|
||||||
( find end of string for suffix )
|
( find end of string for suffix )
|
||||||
&loop
|
&loop
|
||||||
#0001 ADD2
|
INC2
|
||||||
LDAk ,&loop JCN
|
LDAk ,&loop JCN
|
||||||
( suffix is cell size )
|
( suffix is cell size )
|
||||||
#0001 SUB2 LDAk #0f AND ;repl/font-cells STA
|
#0001 SUB2 LDAk #0f AND ;repl/font-cells STA
|
||||||
|
@ -112,7 +112,7 @@
|
||||||
POP
|
POP
|
||||||
POP2
|
POP2
|
||||||
|
|
||||||
;repl/font-cells LDA DUP MUL #08 MUL #01 ADD #00 .File/length DEO2
|
;repl/font-cells LDA DUP MUL #08 MUL INC #00 .File/length DEO2
|
||||||
;font-data .File/load DEO2
|
;font-data .File/load DEO2
|
||||||
|
|
||||||
JMP2r
|
JMP2r
|
||||||
|
@ -128,7 +128,7 @@
|
||||||
¬-end
|
¬-end
|
||||||
#00 SWP ;font-data ADD2 LDA
|
#00 SWP ;font-data ADD2 LDA
|
||||||
LITr 00 STH ADD2r
|
LITr 00 STH ADD2r
|
||||||
#0001 ADD2
|
INC2
|
||||||
,&loop JMP
|
,&loop JMP
|
||||||
|
|
||||||
@wrapped-write ( string* -- )
|
@wrapped-write ( string* -- )
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
#00 ;repl/font-cells LDA #fff8 MUL2 .Screen/y DEI2 ADD2 .Screen/y DEO2
|
#00 ;repl/font-cells LDA #fff8 MUL2 .Screen/y DEI2 ADD2 .Screen/y DEO2
|
||||||
;font-data ADD2 LDA #00 SWP .Screen/x DEI2 ADD2 .Screen/x DEO2
|
;font-data ADD2 LDA #00 SWP .Screen/x DEI2 ADD2 .Screen/x DEO2
|
||||||
LDAk STH
|
LDAk STH
|
||||||
#0001 ADD2
|
INC2
|
||||||
STHr #20 GTH ;write JCN2
|
STHr #20 GTH ;write JCN2
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue