Cleaned example files

This commit is contained in:
neauoire 2021-05-12 18:28:45 -07:00
parent 76a38e3db9
commit a4c8066043
19 changed files with 159 additions and 173 deletions

View File

@ -42,7 +42,7 @@ then
fi
echo "Assembling.."
./bin/uxnasm projects/demos/bifurcan.usm bin/boot.rom
./bin/uxnasm projects/demos/polycat.usm bin/boot.rom
echo "Running.."
if [ "${2}" = '--cli' ];

View File

@ -53,7 +53,6 @@ BRK
.DateTime/second DEI .last LDZ NEQ #01 JCN [ BRK ]
.DateTime/second DEI .last STZ
;redraw JSR2
BRK
@ -107,7 +106,7 @@ RTN
&loop
( save-x ) OVR #03 MOD TOS #0008 MUL2 .anchor/x LDZ2 ADD2 .Screen/x DEO2
( save-y ) OVR #03 DIV TOS #0008 MUL2 .anchor/y LDZ2 ADD2 .Screen/y DEO2
( get digit* ) OVR DUPr STHr #02 MUL TOS ;digits ADD2 LDA2
( get digit* ) OVR STHkr #02 MUL TOS ;digits ADD2 LDA2
( get bit ) ROT #0e SWP SUB TOS SFT2 #0001 AND2
( set tile ) #0008 MUL2 ;tiles ADD2
( set style ) .style LDZ #10 MUL TOS ADD2

View File

@ -156,7 +156,7 @@ BRK
&loop
OVR STH
( x ) .mix-view/x1 LDZ2 #0074 ++
( y ) .mix-view/y1 LDZ2 PAD-HEIGHT DUPr STHr TOS ** ++ #0002 ++
( y ) .mix-view/y1 LDZ2 PAD-HEIGHT STHkr TOS ** ++ #0002 ++
( output ) .Audio0/output STHr #10 * + DEI
;draw-monitor JSR2
( incr ) SWP #01 + SWP
@ -246,40 +246,40 @@ BRK
( knob ) .Mouse/x DEI2 .mix-view/x1 LDZ2 -- #0010 // TOB
( adsr )
DUP #00 ! ,&no-a JCN
.Audio0/adsr [ DUPr STHr #10 * + ] DEI
.Audio0/adsr [ STHkr #10 * + ] DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/adsr [ DUPr STHr #10 * + ] DEO &no-a
.Audio0/adsr [ STHkr #10 * + ] DEO &no-a
DUP #01 ! ,&no-d JCN
.Audio0/adsr [ DUPr STHr #10 * + ] DEI
.Audio0/adsr [ STHkr #10 * + ] DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr [ DUPr STHr #10 * + ] DEO &no-d
.Audio0/adsr [ STHkr #10 * + ] DEO &no-d
DUP #02 ! ,&no-s JCN
.Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEI
.Audio0/adsr [ STHkr #10 * + ] #01 + DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEO &no-s
.Audio0/adsr [ STHkr #10 * + ] #01 + DEO &no-s
DUP #03 ! ,&no-r JCN
.Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEI
.Audio0/adsr [ STHkr #10 * + ] #01 + DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEO &no-r
.Audio0/adsr [ STHkr #10 * + ] #01 + DEO &no-r
( modes )
DUP #04 ! ,&no-repeat JCN
.modes [ DUPr STHr + ] LDZ
.modes [ STHkr + ] LDZ
#00 =
.modes [ DUPr STHr + ] STZ &no-repeat
.modes [ STHkr + ] STZ &no-repeat
( volume )
DUP #05 ! ,&no-left JCN
.Audio0/volume [ DUPr STHr #10 * + ] DEI
.Audio0/volume [ STHkr #10 * + ] DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/volume [ DUPr STHr #10 * + ] DEO &no-left
.Audio0/volume [ STHkr #10 * + ] DEO &no-left
DUP #06 ! ,&no-right JCN
.Audio0/volume [ DUPr STHr #10 * + ] DEI
.Audio0/volume [ STHkr #10 * + ] DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/volume [ DUPr STHr #10 * + ] DEO &no-right
.Audio0/volume [ STHkr #10 * + ] DEO &no-right
POP
( release ) #00 .Mouse/state DEO
DUPr STHr ;draw-mixer JSR2
STHkr ;draw-mixer JSR2
POPr
@ -371,21 +371,21 @@ RTN
( adsr )
DUP2 .mix-view/x1 LDZ2 SWP2
.Audio0/adsr [ DUPr STHr #10 * + ] DEI #04 SFT ;draw-knob JSR2
.Audio0/adsr [ STHkr #10 * + ] DEI #04 SFT ;draw-knob JSR2
DUP2 .mix-view/x1 LDZ2 #0010 ++ SWP2
.Audio0/adsr [ DUPr STHr #10 * + ] DEI #0f AND ;draw-knob JSR2
.Audio0/adsr [ STHkr #10 * + ] DEI #0f AND ;draw-knob JSR2
DUP2 .mix-view/x1 LDZ2 #0020 ++ SWP2
.Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEI #04 SFT ;draw-knob JSR2
.Audio0/adsr [ STHkr #10 * + ] #01 + DEI #04 SFT ;draw-knob JSR2
DUP2 .mix-view/x1 LDZ2 #0030 ++ SWP2
.Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEI #0f AND ;draw-knob JSR2
.Audio0/adsr [ STHkr #10 * + ] #01 + DEI #0f AND ;draw-knob JSR2
( once/repeat )
DUP2 .mix-view/x1 LDZ2 #0040 ++ SWP2
.modes [ DUPr STHr + ] LDZ ;draw-switch JSR2
.modes [ STHkr + ] LDZ ;draw-switch JSR2
( volume )
DUP2 .mix-view/x1 LDZ2 #0050 ++ SWP2
.Audio0/volume [ DUPr STHr #10 * + ] DEI #04 SFT ;draw-knob JSR2
.Audio0/volume [ STHkr #10 * + ] DEI #04 SFT ;draw-knob JSR2
DUP2 .mix-view/x1 LDZ2 #0060 ++ SWP2
.Audio0/volume [ DUPr STHr #10 * + ] DEI #0f AND ;draw-knob JSR2
.Audio0/volume [ STHkr #10 * + ] DEI #0f AND ;draw-knob JSR2
POP2
POPr
@ -395,7 +395,7 @@ RTN
STH STH
DUPr STHr
STHkr
DUP #04 / SWP #04 MOD TOS PAD-WIDTH ** ( center ) .pad-view/x1 LDZ2 ++
ROT TOS PAD-HEIGHT ** ( center ) .pad-view/y1 LDZ2 ++
@ -409,21 +409,21 @@ RTN
( draw name )
OVR2 #0002 ++
OVR2 #0002 ++
;pad-name DUPr STHr TOS #0005 ** ++
;pad-name STHkr TOS #0005 ** ++
#20 OVRr STHr +
;draw-label JSR2
( draw note )
OVR2 #0003 ++ .Screen/x DEO2
DUP2 #0014 ++ .Screen/y DEO2
( get pitch ) DUPr STHr TOS ;pad-pitch ++ LDA
( get pitch ) STHkr TOS ;pad-pitch ++ LDA
#0c / TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
#21 .Screen/color DEO
( draw octave )
OVR2 #000b ++ .Screen/x DEO2
DUP2 #0014 ++ .Screen/y DEO2
( get pitch ) DUPr STHr TOS ;pad-pitch ++ LDA
( get pitch ) STHkr TOS ;pad-pitch ++ LDA
#0c MOD TOS #0008 ** ;font-notes ++ .Screen/addr DEO2
#21 .Screen/color DEO
@ -470,9 +470,9 @@ RTN
#00 #0f
&loop
OVR #10 SWP - DUPr STHr #0f AND < #01 + .Screen/color DEO
OVR #10 SWP - STHkr #0f AND < #01 + .Screen/color DEO
.Screen/x DEI2 #0002 ++ .Screen/x DEO2
OVR #10 SWP - DUPr STHr #04 SFT < #01 + .Screen/color DEO
OVR #10 SWP - STHkr #04 SFT < #01 + .Screen/color DEO
.Screen/x DEI2 #0002 -- .Screen/x DEO2
.Screen/y DEI2 #0002 ++ .Screen/y DEO2
( incr ) SWP #01 + SWP
@ -491,7 +491,7 @@ RTN
DUP2 #0018 ++
&loop
( move ) OVR2 .Screen/y DEO2
( draw ) DUPr STHr .Screen/color DEO
( draw ) STHkr .Screen/color DEO
( incr ) .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2
( incr ) SWP2 #0008 ++ SWP2
LTH2k ,&loop JCN
@ -534,9 +534,9 @@ RTN
( draw ) #21 .Screen/color DEO
.Screen/x DEI2 #0004 ++ .Screen/x DEO2
.Screen/y DEI2 #0008 ++ .Screen/y DEO2
;font-hex #00 DUPr STHr #08 * ++ .Screen/addr DEO2
;font-hex #00 STHkr #08 * ++ .Screen/addr DEO2
( draw ) #21 .Screen/color DEO
.Screen/x DEI2 #0004 -- #00 #00 DUPr STHr ;knob-offsetx ++ LDA ++ .Screen/x DEO2
.Screen/x DEI2 #0004 -- #00 #00 STHkr ;knob-offsetx ++ LDA ++ .Screen/x DEO2
.Screen/y DEI2 #0010 -- #00 #00 STHr ;knob-offsety ++ LDA ++ .Screen/y DEO2
;knob-icns #0020 ++ .Screen/addr DEO2
( draw ) #25 .Screen/color DEO
@ -546,16 +546,16 @@ RTN
@draw-switch ( x* y* value -- )
STH .Screen/y DEO2 .Screen/x DEO2
DUPr STHr #20 * #00 SWP ;switch-icns ++
STHkr #20 * #00 SWP ;switch-icns ++
DUP2 .Screen/addr DEO2
( draw ) #21 DUPr STHr + .Screen/color DEO
( draw ) #21 STHkr + .Screen/color DEO
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
DUP2 #0008 ++ .Screen/addr DEO2
( draw ) #21 DUPr STHr + .Screen/color DEO
( draw ) #21 STHkr + .Screen/color DEO
.Screen/y DEI2 #0008 ++ .Screen/y DEO2
.Screen/x DEI2 #0008 -- .Screen/x DEO2
DUP2 #0010 ++ .Screen/addr DEO2
( draw ) #21 DUPr STHr + .Screen/color DEO
( draw ) #21 STHkr + .Screen/color DEO
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
#0018 ++ .Screen/addr DEO2
( draw ) #21 STHr + .Screen/color DEO
@ -590,7 +590,7 @@ RTN
STH2r
&loop
DUP2 LDA #00 SWP #0030 -- #0008 ** ;font-num-uc ++ .Screen/addr DEO2
( draw ) DUPr STHr .Screen/color DEO
( draw ) STHkr .Screen/color DEO
( incr ) #0001 ++
( incr ) .Screen/x DEI2 #0008 ++ .Screen/x DEO2
DUP2 LDA #00 ! ,&loop JCN

View File

@ -9,7 +9,8 @@
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%INCR { #01 + } %DECR { #01 - }
%INCR { SWP #01 + SWP }
%DECR { SWP #01 - SWP }
%TOS { #00 SWP } %TOB { SWP POP }
%RTN { JMP2r } %MOD { DUP2 / * - }
%SFL { #40 SFT SFT }
@ -18,6 +19,7 @@
%BANK1 { #8000 } %BANK2 { #a000 }
%GET-SIZE { WIDTH TOS #0008 // HEIGHT TOS ** }
%GET-ITERATORS { SWP2k POP SWP POP }
( devices )
@ -67,10 +69,10 @@ BRK
.Mouse/state DEI #00 = #01 JCN [ BRK ]
.world/paused LDZ #00 ! #01 JCN [ BRK ]
( incr frame ) .world/frame LDZ INCR [ DUP ] .world/frame STZ
( incr frame ) .world/frame LDZ #01 + [ DUP ] .world/frame STZ
( reset count ) #0000 .world/count STZ2
#10 MOD #00 ! #01 JCN [ BRK ]
#02 MOD #00 = #01 JCN [ BRK ]
( clear buffer )
BANK2 DUP2 GET-SIZE ++
@ -148,15 +150,14 @@ BRK
#00 HEIGHT
&ver
OVR TOS #0002 ** .anchor/y LDZ2 ++ .Screen/y DEO2
OVR STH
#00 WIDTH
&hor
OVR TOS #0002 ** .anchor/x LDZ2 ++ .Screen/x DEO2
OVR DUPr STHr ,get-cell JSR INCR .Screen/color DEO
SWP INCR SWP
GET-ITERATORS ,get-cell JSR #01 + .Screen/color DEO
INCR
NEQk ,&hor JCN
POP2 POPr
SWP INCR SWP
POP2
INCR
NEQk ,&ver JCN
POP2
@ -173,7 +174,7 @@ RTN
DUP2 ,get-index JSR STH2
POP #08 MOD #01 SWP SFL
DUP2r LDAr STHr SWP ORA
LDAkr STHr SWP ORA
STH2r STA
RTN
@ -189,14 +190,14 @@ RTN
@get-neighbours ( x y -- neighbours )
( -1,-1 ) DUP2 DECR SWP DECR SWP ,get-cell JSR STH
( 0,-1 ) DUP2 DECR ,get-cell JSR STH ADDr
( +1,-1 ) DUP2 DECR SWP INCR SWP ,get-cell JSR STH ADDr
( -1, 0 ) DUP2 SWP DECR SWP ,get-cell JSR STH ADDr
( +1, 0 ) DUP2 SWP INCR SWP ,get-cell JSR STH ADDr
( -1,+1 ) DUP2 INCR SWP DECR SWP ,get-cell JSR STH ADDr
( 0,+1 ) DUP2 INCR ,get-cell JSR STH ADDr
( +1,+1 ) INCR SWP INCR SWP ,get-cell JSR STH ADDr
( -1,-1 ) DUP2 #01 - DECR ,get-cell JSR STH
( 0,-1 ) DUP2 #01 - ,get-cell JSR STH ADDr
( +1,-1 ) DUP2 #01 - INCR ,get-cell JSR STH ADDr
( -1, 0 ) DUP2 DECR ,get-cell JSR STH ADDr
( +1, 0 ) DUP2 INCR ,get-cell JSR STH ADDr
( -1,+1 ) DUP2 #01 + DECR ,get-cell JSR STH ADDr
( 0,+1 ) DUP2 #01 + ,get-cell JSR STH ADDr
( +1,+1 ) #01 + INCR ,get-cell JSR STH ADDr
STHr
RTN
@ -205,18 +206,17 @@ RTN
#00 HEIGHT
&ver
OVR STH
#00 WIDTH
&hor
OVR DUPr STHr STH2
( x y ) DUP2r STH2r
( neighbours ) DUP2r STH2r ,get-neighbours JSR
( state ) STH2r ;get-cell JSR2
GET-ITERATORS
( x y ) DUP2
( neighbours ) DUP2 ,get-neighbours JSR
( state ) ROT ROT ;get-cell JSR2
,run-cell JSR
SWP INCR SWP
INCR
NEQk ,&hor JCN
POP2 POPr
SWP INCR SWP
POP2
INCR
NEQk ,&ver JCN
POP2
@ -246,7 +246,7 @@ RTN
( save in buffer )
STH2
DUP2 POP #08 MOD #01 SWP SFL
DUP2r LDAr STHr SWP ORA
LDAkr STHr SWP ORA
STH2r STA
RTN
@ -255,21 +255,23 @@ RTN
STH SWP
DUP #04 SFT TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
( draw ) DUPr STHr .Screen/color DEO
( draw ) STHkr .Screen/color DEO
#0f AND TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) DUPr STHr .Screen/color DEO
( draw ) STHkr .Screen/color DEO
DUP #04 SFT TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) DUPr STHr .Screen/color DEO
( draw ) STHkr .Screen/color DEO
#0f AND TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHr .Screen/color DEO
RTN
@font-hex ( 0-F )
[
@cursor
80c0 e0f0 f8e0 1000
@font-hex
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
@ -277,7 +279,4 @@ RTN
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080 ]
@cursor [
80c0 e0f0 f8e0 1000 ]
007c 8280 f080 827c 007c 8280 f080 8080

View File

@ -310,7 +310,7 @@ RTN
DUP2 #0018 ++
&loop
( move ) OVR2 .Screen/y DEO2
( draw ) STHrk .Screen/color DEO
( draw ) STHkr .Screen/color DEO
( incr ) .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2
( incr ) SWP2 #0008 ++ SWP2
LTH2k ,&loop JCN
@ -390,7 +390,7 @@ RTN
.wave-view/y1 LDZ2 DUP2 #0020 ++
&loop
OVR2 .Screen/y DEO2
( draw ) STHrk .Screen/color DEO
( draw ) STHkr .Screen/color DEO
( incr ) SWP2 #0001 ++ SWP2
LTH2k ,&loop JCN
POP2 POP2
@ -414,9 +414,9 @@ RTN
( draw ) #21 .Screen/color DEO
.Screen/x DEI2 #0004 ++ .Screen/x DEO2
.Screen/y DEI2 #0008 ++ .Screen/y DEO2
;font-hex #00 STHrk #08 * ++ .Screen/addr DEO2
;font-hex #00 STHkr #08 * ++ .Screen/addr DEO2
( draw ) #21 .Screen/color DEO
.Screen/x DEI2 #0004 -- #00 #00 STHrk ;knob-offsetx ++ LDA ++ .Screen/x DEO2
.Screen/x DEI2 #0004 -- #00 #00 STHkr ;knob-offsetx ++ LDA ++ .Screen/x DEO2
.Screen/y DEI2 #0010 -- #00 #00 STHr ;knob-offsety ++ LDA ++ .Screen/y DEO2
;knob-icns #0020 ++ .Screen/addr DEO2
( draw ) #25 .Screen/color DEO
@ -427,13 +427,13 @@ RTN
STH SWP
DUP #04 SFT TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
( draw ) STHrk .Screen/color DEO
( draw ) STHkr .Screen/color DEO
#0f AND TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHrk .Screen/color DEO
( draw ) STHkr .Screen/color DEO
DUP #04 SFT TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHrk .Screen/color DEO
( draw ) STHkr .Screen/color DEO
#0f AND TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHr .Screen/color DEO
@ -459,49 +459,48 @@ RTN
RTN
@cursor [
80c0 e0f0 f8e0 1000 ]
@cursor
80c0 e0f0 f8e0 1000
@arrow-icns [
@arrow-icns
0010 387c fe10 1000
0010 1010 fe7c 3810 ]
0010 1010 fe7c 3810
@notes [
@notes
3c 3e 40 41 43 45 47
48 4a 4c 4d 4f 51 53 ]
48 4a 4c 4d 4f 51 53
@keys-left-icns [
@keys-left-icns
7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7e7f
7f7f 7f7f 7f7f 3e00 ]
7f7f 7f7f 7f7f 3e00
@keys-middle-icns [
@keys-middle-icns
1c1c 1c1c 1c1c 1c1c
1c1c 1c1c 1c1c 3e7f
7f7f 7f7f 7f7f 3e00 ]
7f7f 7f7f 7f7f 3e00
@keys-right-icns [
@keys-right-icns
1f1f 1f1f 1f1f 1f1f
1f1f 1f1f 1f1f 3f7f
7f7f 7f7f 7f7f 3e00 ]
7f7f 7f7f 7f7f 3e00
@knob-icns [
@knob-icns
0003 0c10 2020 4040
00c0 3008 0404 0202
4040 2020 100c 0300
0202 0404 0830 c000
0000 183c 3c18 0000 ]
0000 183c 3c18 0000
@knob-offsetx [
@knob-offsetx
01 00 00 00 00 01 02 03
05 06 07 08 08 08 08 07 ]
05 06 07 08 08 08 08 07
@knob-offsety [
@knob-offsety
07 06 05 03 02 01 00 00
00 00 01 02 03 05 06 07 ]
00 00 01 02 03 05 06 07
@font-hex ( 0-F )
[
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
@ -509,7 +508,7 @@ RTN
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080 ]
007c 8280 f080 827c 007c 8280 f080 8080
@piano-path "projects/sounds/piano.pcm $1
@violin-path "projects/sounds/violin.pcm $1

View File

@ -64,7 +64,7 @@ BRK
( ears )
.cat/y LDZ2 .Screen/y DEO2
.cat/x LDZ2 DUP2 STH2 #0008 SUB2 .Screen/x DEO2
.cat/x LDZ2 STH2k #0008 SUB2 .Screen/x DEO2
;ears .Screen/addr DEO2
#41 .Screen/color DEO
STH2r .Screen/x DEO2
@ -79,7 +79,7 @@ RTN
@draw-eye ( quad* -- )
.cat/y LDZ2 #0008 ADD2 .Screen/y DEO2
.cat/x LDZ2 DUP2 STH2 #0008 SUB2 .Screen/x DEO2
.cat/x LDZ2 STH2k #0008 SUB2 .Screen/x DEO2
DUP2 ;eye ADD2 .Screen/addr DEO2
( draw ) #41 .Screen/color DEO
STH2r .Screen/x DEO2
@ -91,7 +91,7 @@ RTN
@draw-tail ( frame* -- )
.cat/y LDZ2 #0010 ADD2 .Screen/y DEO2
.cat/x LDZ2 DUP2 STH2 #0008 SUB2 .Screen/x DEO2
.cat/x LDZ2 STH2k #0008 SUB2 .Screen/x DEO2
;body .Screen/addr DEO2
( draw ) #41 .Screen/color DEO
STH2r .Screen/x DEO2
@ -138,14 +138,14 @@ RTN
RTN
@cursor [
80c0 e0f0 f8e0 1000 ]
@cursor
80c0 e0f0 f8e0 1000
@ears [
@ears
081c 3e3e 7f7f ffff 081c 3e3e 7f7f fffc
081c 3c3e 7e7e ffff 081c 3c3e 7e7e ff1f ]
081c 3c3e 7e7e ffff 081c 3c3e 7e7e ff1f
@eye [
@eye
ffff ffff ff7f 3f0f f7ef cfe7 f07c 3f0f
ffff ffff fffe fcf0 87c3 c183 071e fcf0
ffff ffff ff7f 3f0f f0e1 c1e0 f07c 3f0f
@ -154,17 +154,16 @@ RTN
ffff ffff fffe fcf0 0783 c1c3 871e fcf0
ffff ffff ff7f 3f0f f0e0 c1e1 f07c 3f0f
ffff ffff fffe fcf0 07f3 f9fb f71e fcf0
]
@body [
@body
0707 0707 0302 0200 0107 0707 0300 0000
e0f0 f0e0 e080 8000 c0f2 f9f9 fef8 b000
e0f0 f0e0 e080 8000 c0f2 f9f9 fef8 b000
e0f0 f0e0 e080 8000 c0f2 faf9 fef8 b000
e0f0 f0e0 e080 8000 c0f1 faf9 fef8 b000
0707 0707 0f08 1000 0307 0707 0f00 0000
e0e0 e0e0 e080 8000 f2f9 f9fe b884 8400 ]
e0e0 e0e0 e080 8000 f2f9 f9fe b884 8400
@ground [
@ground
bf00 5c02 0202 020c ef10 6f90 8080 8074
ff00 fe01 0100 0116 fd00 3c40 4040 4028 ]
ff00 fe01 0100 0116 fd00 3c40 4040 4028

View File

@ -327,7 +327,7 @@ RTN
&loop
DUP2 LDA #00 SWP #0008 MUL2
;font ADD2 .Screen/addr DEO2
( draw ) DUPr STHr .Screen/color DEO
( draw ) STHkr .Screen/color DEO
( incr ) ++
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
DUP2 LDA #00 NEQ ,&loop JCN
@ -339,13 +339,13 @@ RTN
STH SWP
DUP #04 SFT #00 SWP #0008 MUL2 ;font-hex ADD2 .Screen/addr DEO2
( draw ) DUPr STHr .Screen/color DEO
( draw ) STHkr .Screen/color DEO
#0f AND #00 SWP #0008 MUL2 ;font-hex ADD2 .Screen/addr DEO2
.Screen/x DEI2 8+ .Screen/x DEO2
( draw ) DUPr STHr .Screen/color DEO
( draw ) STHkr .Screen/color DEO
DUP #04 SFT #00 SWP #0008 MUL2 ;font-hex ADD2 .Screen/addr DEO2
.Screen/x DEI2 8+ .Screen/x DEO2
( draw ) DUPr STHr .Screen/color DEO
( draw ) STHkr .Screen/color DEO
#0f AND #00 SWP #0008 MUL2 ;font-hex ADD2 .Screen/addr DEO2
.Screen/x DEI2 8+ .Screen/x DEO2
( draw ) STHr .Screen/color DEO
@ -363,13 +363,14 @@ RTN
@sliderc_icn [ fcfe ffff ffff fefc ]
@sliderd_icn [ 003c 7e7e 7e7e 3c00 ]
@preview_icn [
@preview_icn
183c 66db db66 3c18
0000 183c 3c18 0000 ]
0000 183c 3c18 0000
@radio_icns
[ 3c42 8181 8181 423c ]
[ 3c42 99bd bd99 423c ]
@font-hex [
3c42 8181 8181 423c
3c42 99bd bd99 423c
@font-hex
003c 464a 5262 3c00 0018 0808 0808 1c00
003c 4202 3c40 7e00 003c 421c 0242 3c00
000c 1424 447e 0400 007e 407c 0242 3c00
@ -377,9 +378,9 @@ RTN
003c 423c 4242 3c00 003c 4242 3e02 3c00
003c 4242 7e42 4200 007c 427c 4242 7c00
003c 4240 4042 3c00 007c 4242 4242 7c00
007e 4078 4040 7e00 007e 4078 4040 4000 ]
007e 4078 4040 7e00 007e 4078 4040 4000
@font ( spectrum-zx font ) [
@font ( spectrum-zx font )
0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000
0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000
007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000
@ -411,4 +412,4 @@ RTN
0000 7844 4478 4040 0000 3c44 443c 0406 0000 2c30 2020 2000 0000 3840 3804 7800
0010 103c 1010 0c00 0000 4444 4444 3800 0000 4444 2828 1000 0000 4454 5454 2800
0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00
0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c ]
0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c

View File

@ -10,7 +10,7 @@
|0100 ( -> )
;hello-word ,print JSR
,hello-word ,print JSR
BRK

View File

@ -74,7 +74,7 @@ BRK
#00 SWP SCALEX .Screen/x DEO2
OVR #0f MOD #00 EQU #01 ADD .Screen/color DEO
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&loop JCN
LTHk ,&loop JCN
POP2
;draw-display JSR2
@ -86,22 +86,22 @@ BRK
.Screen/height DEI2 #0002 DIV2 #0048 ADD2 .Screen/y DEO2
.Screen/width DEI2 #0002 DIV2
DUP2 #0020 SUB2 .Screen/x DEO2
;font_hex #00 .DateTime/hour DEI #0a DIV #08 MUL ADD2 .Screen/addr DEO2
;font-hex #00 .DateTime/hour DEI #0a DIV #08 MUL ADD2 .Screen/addr DEO2
#22 .Screen/color DEO
DUP2 #0018 SUB2 .Screen/x DEO2
;font_hex #00 .DateTime/hour DEI #0a MOD #08 MUL ADD2 .Screen/addr DEO2
;font-hex #00 .DateTime/hour DEI #0a MOD #08 MUL ADD2 .Screen/addr DEO2
#22 .Screen/color DEO
DUP2 #0008 SUB2 .Screen/x DEO2
;font_hex #00 .DateTime/minute DEI #0a DIV #08 MUL ADD2 .Screen/addr DEO2
;font-hex #00 .DateTime/minute DEI #0a DIV #08 MUL ADD2 .Screen/addr DEO2
#22 .Screen/color DEO
DUP2 .Screen/x DEO2
;font_hex #00 .DateTime/minute DEI #0a MOD #08 MUL ADD2 .Screen/addr DEO2
;font-hex #00 .DateTime/minute DEI #0a MOD #08 MUL ADD2 .Screen/addr DEO2
#22 .Screen/color DEO
DUP2 #0010 ADD2 .Screen/x DEO2
;font_hex #00 .DateTime/second DEI #0a DIV #08 MUL ADD2 .Screen/addr DEO2
;font-hex #00 .DateTime/second DEI #0a DIV #08 MUL ADD2 .Screen/addr DEO2
#22 .Screen/color DEO
DUP2 #0018 ADD2 .Screen/x DEO2
;font_hex #00 .DateTime/second DEI #0a MOD #08 MUL ADD2 .Screen/addr DEO2
;font-hex #00 .DateTime/second DEI #0a MOD #08 MUL ADD2 .Screen/addr DEO2
#22 .Screen/color DEO
POP2
@ -136,7 +136,6 @@ RTN
RTN
@table ( 60 positions on a circle in bytes )
[
8000 8d00 9a02 a706 b40b c011 cb18 d520
df2a e734 ee40 f44b f958 fd65 ff72 ff80
ff8d fd9a f9a7 f4b4 eec0 e7cb dfd5 d5df
@ -145,10 +144,8 @@ RTN
11c0 0bb4 06a7 029a 008d 0080 0072 0265
0658 0b4b 113f 1834 202a 2a20 3418 3f11
4b0b 5806 6502 7200
]
@font_hex ( 0-F )
[
@font-hex ( 0-F )
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
@ -157,4 +154,3 @@ RTN
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080
]

View File

@ -72,6 +72,7 @@ BRK
@draw-cursor ( -- )
;pointer_icn .Screen/addr DEO2
( clear last cursor )
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
@ -82,7 +83,6 @@ BRK
.Mouse/y DEI2 .pointer/y STZ2
( draw new cursor )
;pointer_icn .Screen/addr DEO2
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
#33 .Mouse/state DEI #00 NEQ #02 MUL SUB .Screen/color DEO

View File

@ -54,20 +54,17 @@ RTN
#00 #10
&loop
OVR #08 MUL #00 SWP ;font_hex ADD2 .Screen/addr DEO2
OVR #08 MUL #00 SWP ;font-hex ADD2 .Screen/addr DEO2
( x-axis )
OVR #08 MUL #00 SWP
.center/x LDZ2 #0040 SUB2 ADD2 .Screen/x DEO2
.center/y LDZ2 #0050 SUB2 .Screen/y DEO2
( draw ) #21 .Screen/color DEO
( y-axis )
OVR #08 MUL #00 SWP
.center/y LDZ2 #0040 SUB2 ADD2 .Screen/y DEO2
.center/x LDZ2 #0050 SUB2 .Screen/x DEO2
( draw ) #21 .Screen/color DEO
( incr ) SWP #01 ADD SWP
LTHk ,&loop JCN
POP2
@ -77,7 +74,6 @@ RTN
@draw-circle ( -- )
;preview_icn .Screen/addr DEO2
.center/x LDZ2 #0048 ADD2 .Screen/x DEO2
.center/y LDZ2 #0030 ADD2 .Screen/y DEO2
#21 .Screen/color DEO
@ -91,10 +87,10 @@ RTN
RTN
@preview_icn [
0f38 675f dfbf bfbf 0007 1820 2344 4848 ]
@preview_icn [
0f38 675f dfbf bfbf 0007 1820 2344 4848
@font_hex [
@font-hex
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
@ -102,4 +98,4 @@ RTN
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080 ]
007c 8280 f080 827c 007c 8280 f080 8080

View File

@ -14,9 +14,9 @@
|0000
@color [ &byte $1 ]
@color [ &byte $1 ]
@position [ &x $2 &y $2 ]
@size [ &width $2 &height $2 ]
@size [ &width $2 &height $2 ]
( program )

View File

@ -1,4 +1,5 @@
#include <stdio.h>
#include "uxn.h"
/*
Copyright (c) 2021 Devine Lu Linvega
@ -11,8 +12,6 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE.
*/
#include "uxn.h"
#pragma mark - Core
int

View File

@ -1,3 +1,6 @@
#include "../uxn.h"
#include "apu.h"
/*
Copyright (c) 2021 Devine Lu Linvega
Copyright (c) 2021 Andrew Alderwick
@ -10,9 +13,6 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE.
*/
#include "../uxn.h"
#include "apu.h"
#define NOTE_PERIOD 0x10000
#define ADSR_STEP (SAMPLE_FREQUENCY / 0xf)

View File

@ -1,3 +1,5 @@
#include "mpu.h"
/*
Copyright (c) 2021 Devine Lu Linvega
Copyright (c) 2021 Andrew Alderwick
@ -10,8 +12,6 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE.
*/
#include "mpu.h"
int
initmpu(Mpu *m, Uint8 device)
{

View File

@ -1,3 +1,5 @@
#include "ppu.h"
/*
Copyright (c) 2021 Devine Lu Linvega
Copyright (c) 2021 Andrew Alderwick
@ -10,8 +12,6 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE.
*/
#include "ppu.h"
static Uint8 font[][8] = {
{0x00, 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c},
{0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10},

View File

@ -1,6 +1,10 @@
#include <SDL2/SDL.h>
#include <stdio.h>
#include <time.h>
#include "uxn.h"
#include "devices/ppu.h"
#include "devices/apu.h"
#include "devices/mpu.h"
/*
Copyright (c) 2021 Devine Lu Linvega
@ -13,11 +17,6 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE.
*/
#include "uxn.h"
#include "devices/ppu.h"
#include "devices/apu.h"
#include "devices/mpu.h"
static SDL_AudioDeviceID audio_id;
static SDL_Window *gWindow;
static SDL_Renderer *gRenderer;

View File

@ -1,4 +1,5 @@
#include <stdio.h>
#include "uxn.h"
/*
Copyright (u) 2021 Devine Lu Linvega
@ -11,8 +12,6 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE.
*/
#include "uxn.h"
#pragma mark - Operations
/* clang-format off */

View File

@ -28,8 +28,6 @@ typedef struct {
Uint8 dat[65536];
} Memory;
struct Uxn;
typedef struct Device {
struct Uxn *u;
Uint8 addr, dat[16], *mem;
@ -42,10 +40,12 @@ typedef struct Uxn {
Device dev[16];
} Uxn;
int loaduxn(Uxn *c, char *filepath);
int bootuxn(Uxn *c);
int evaluxn(Uxn *u, Uint16 vec);
struct Uxn;
void mempoke16(Uint8 *m, Uint16 a, Uint16 b);
Uint16 mempeek16(Uint8 *m, Uint16 a);
int loaduxn(Uxn *c, char *filepath);
int bootuxn(Uxn *c);
int evaluxn(Uxn *u, Uint16 vec);
Device *portuxn(Uxn *u, Uint8 id, char *name, void (*talkfn)(Device *, Uint8, Uint8));