clean up code
This commit is contained in:
parent
a2c7738a77
commit
50c4230f07
|
@ -4,10 +4,10 @@
|
|||
|
||||
%RTN { JMP2r }
|
||||
|
||||
%inc-ptr-reg-nib { .ptr-register-nibbles LDZ #01 ADD #7f AND .ptr-register-nibbles STZ }
|
||||
%inc-ptr-reg-byt { .ptr-register-nibbles LDZ #02 ADD #7f AND .ptr-register-nibbles STZ }
|
||||
%dec-ptr-reg-nib { .ptr-register-nibbles LDZ #01 SUB #7f AND .ptr-register-nibbles STZ }
|
||||
%dec-ptr-reg-byt { .ptr-register-nibbles LDZ #02 SUB #7f AND .ptr-register-nibbles STZ }
|
||||
%inc-ptr-reg-nib { .ptr-register-nibbles STHk LDZ #01 ADD #7f AND STHr STZ }
|
||||
%inc-ptr-reg-byt { .ptr-register-nibbles STHk LDZ #02 ADD #7f AND STHr STZ }
|
||||
%dec-ptr-reg-nib { .ptr-register-nibbles STHk LDZ #01 SUB #7f AND STHr STZ }
|
||||
%dec-ptr-reg-byt { .ptr-register-nibbles STHk LDZ #02 SUB #7f AND STHr STZ }
|
||||
%PRINT-DIGIT { DUP #30 ADD .Console/write DEO }
|
||||
%PRINT-NL { #0a .Console/write DEO }
|
||||
%MOD { DIVk MUL SUB }
|
||||
|
@ -136,9 +136,19 @@
|
|||
|
||||
;on-frame .Screen/vector DEO2
|
||||
;on-controller .Controller/vector DEO2
|
||||
|
||||
,draw-columns JSR
|
||||
BRK
|
||||
|
||||
@draw-columns ( -- )
|
||||
#00
|
||||
&loop
|
||||
STHk
|
||||
;draw-column JSR2
|
||||
STHr #01 ADD DUP
|
||||
#06 LTH ,&loop JCN
|
||||
POP
|
||||
RTN
|
||||
|
||||
@initial-values
|
||||
( period pattern beatcount adsr volume sample melody )
|
||||
&dev0 10 77 08 1ff1 77 0100 2d29 2629 2d29 262d
|
||||
|
@ -153,37 +163,19 @@ BRK
|
|||
:main ( 1 )
|
||||
:piano ( 2 )
|
||||
:tri ( 3 )
|
||||
:sin ( 4 )
|
||||
|
||||
@on-frame ( -> )
|
||||
#00 ;update-dev JSR2
|
||||
#01 ;update-dev JSR2
|
||||
#02 ;update-dev JSR2
|
||||
|
||||
,draw-columns JSR
|
||||
( ,draw-columns JSR )
|
||||
|
||||
( inc framecount )
|
||||
.framecount LDZ2 #0001 ADD2 .framecount STZ2
|
||||
BRK
|
||||
|
||||
@draw-columns ( -- )
|
||||
#00
|
||||
&loop
|
||||
STHk
|
||||
,draw-column JSR
|
||||
STHr #01 ADD DUP
|
||||
#06 LTH ,&loop JCN
|
||||
POP
|
||||
RTN
|
||||
|
||||
@draw-column ( num -- )
|
||||
STHk
|
||||
#02 MUL ( create offset for x position )
|
||||
.pos-x-dev ADD LDZ2
|
||||
.pos-y-dev LDZ2
|
||||
STHr #08 MUL ( calculate pointer offset )
|
||||
;draw-bytes JSR2
|
||||
RTN
|
||||
|
||||
@update-dev ( devnum -- )
|
||||
( transform devnum to offsets )
|
||||
|
@ -307,24 +299,51 @@ RTN
|
|||
( registers )
|
||||
&down
|
||||
inc-ptr-reg-byt
|
||||
POP BRK
|
||||
,&close JMP
|
||||
&up
|
||||
dec-ptr-reg-byt
|
||||
POP BRK
|
||||
,&close JMP
|
||||
&left
|
||||
inc-ptr-reg-nib
|
||||
POP BRK
|
||||
,&close JMP
|
||||
&right
|
||||
dec-ptr-reg-nib
|
||||
POP BRK
|
||||
,&close JMP
|
||||
&inc-nibble ( increment nibble )
|
||||
#01 ,add-to-nibble JSR
|
||||
POP BRK
|
||||
,&close JMP
|
||||
&dec-nibble ( dec nibble )
|
||||
#ff ,add-to-nibble JSR
|
||||
POP BRK
|
||||
|
||||
&close
|
||||
( only draw updated columns )
|
||||
.ptr-register-nibbles LDZ DUP
|
||||
#10 MOD DUP #01 GTH ,&check-mod-is-0f JCN
|
||||
&mod-is-0-or-1
|
||||
POP
|
||||
DUP #02 SUB #10 DIV ,draw-column JSR
|
||||
,&draw-current-column JMP
|
||||
|
||||
&check-mod-is-0f
|
||||
#0e LTH ,&draw-current-column JCN
|
||||
DUP #02 ADD #10 DIV ,draw-column JSR
|
||||
,&draw-current-column JMP
|
||||
|
||||
&draw-current-column
|
||||
#10 DIV
|
||||
,draw-column JSR
|
||||
POP BRK
|
||||
BRK
|
||||
|
||||
@draw-column ( num -- )
|
||||
STHk
|
||||
#02 MUL ( create offset for x position )
|
||||
.pos-x-dev ADD LDZ2
|
||||
.pos-y-dev LDZ2
|
||||
STHr #08 MUL ( calculate pointer offset )
|
||||
;draw-bytes JSR2
|
||||
RTN
|
||||
|
||||
@add-to-nibble ( a -- ) ( add a to nibble pointed by ptr-register-nibbles )
|
||||
,&num STR
|
||||
,&start JMP
|
||||
|
@ -428,7 +447,7 @@ RTN
|
|||
STH
|
||||
.Screen/y DEO2
|
||||
.Screen/x DEO2
|
||||
STHr DUP STH
|
||||
STHkr
|
||||
#03 SFT #01 AND ,&bit-3-on JCN
|
||||
&bit-3-off
|
||||
;nibble-dice-empty/tl .Screen/addr DEO2
|
||||
|
@ -439,7 +458,7 @@ RTN
|
|||
.die-color LDZ .Screen/color DEO
|
||||
|
||||
( bit 2 )
|
||||
STHr DUP STH
|
||||
STHkr
|
||||
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( increment x )
|
||||
#02 SFT #01 AND ,&bit-2-on JCN
|
||||
&bit-2-off
|
||||
|
@ -451,7 +470,7 @@ RTN
|
|||
.die-color LDZ .Screen/color DEO
|
||||
|
||||
( bit 0 )
|
||||
STHr DUP STH
|
||||
STHkr
|
||||
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2 ( increment y )
|
||||
#01 AND ,&bit-0-on JCN
|
||||
&bit-0-off
|
||||
|
@ -530,23 +549,6 @@ ffff ffff ffff ffff
|
|||
2123 2527 292b 2d2f 3133 3537 393b 3d3f
|
||||
4143 4547 494b 4d4f 5153 5557 595b 5d5f
|
||||
6163 6567 696b 6d6f 7173 7577 797b 7d7f
|
||||
@sin
|
||||
8083 8689 8c8f 9295 989b 9ea1 a4a7 aaad
|
||||
b0b3 b6b9 bbbe c1c3 c6c9 cbce d0d2 d5d7
|
||||
d9db dee0 e2e4 e6e7 e9eb ecee f0f1 f2f4
|
||||
f5f6 f7f8 f9fa fbfb fcfd fdfe fefe fefe
|
||||
fffe fefe fefe fdfd fcfb fbfa f9f8 f7f6
|
||||
f5f4 f2f1 f0ee eceb e9e7 e6e4 e2e0 dedb
|
||||
d9d7 d5d2 d0ce cbc9 c6c3 c1be bbb9 b6b3
|
||||
b0ad aaa7 a4a1 9e9b 9895 928f 8c89 8683
|
||||
807d 7a77 7471 6e6b 6865 625f 5c59 5653
|
||||
504d 4a47 4542 3f3d 3a37 3532 302e 2b29
|
||||
2725 2220 1e1c 1a19 1715 1412 100f 0e0c
|
||||
0b0a 0908 0706 0505 0403 0302 0202 0202
|
||||
0102 0202 0202 0303 0405 0506 0708 090a
|
||||
0b0c 0e0f 1012 1415 1719 1a1c 1e20 2225
|
||||
2729 2b2e 3032 3537 3a3d 3f42 4547 4a4d
|
||||
5053 5659 5c5f 6265 686b 6e71 7477 7a7d
|
||||
@piano
|
||||
8182 8588 8d91 959b a1a6 aaad b2b5 b8bd
|
||||
c1c7 cbd0 d5d9 dde1 e5e5 e4e4 e1dc d7d1
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue