mirror of https://git.sr.ht/~rabbits/uxn
29 changed files with 2072 additions and 1622 deletions
@ -1,194 +0,0 @@ |
|||||||
( uxnasm projects/examples/demos/font.tal bin/font.rom && uxnemu bin/font.rom ) |
|
||||||
|
|
||||||
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV } |
|
||||||
%< { LTH } %> { GTH } %= { EQU } %! { NEQ } |
|
||||||
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 } |
|
||||||
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } |
|
||||||
|
|
||||||
%RTN { JMP2r } |
|
||||||
%TOS { #00 SWP } |
|
||||||
|
|
||||||
%GET-WIDTH { TOS ;font-data ++ LDA } |
|
||||||
%GET-GLYPH { TOS #50 SFT2 ;font-data/glyphs ++ } |
|
||||||
|
|
||||||
%AUTO-NONE { #00 .Screen/auto DEO } |
|
||||||
%AUTO-X { #01 .Screen/auto DEO } |
|
||||||
%AUTO-Y { #02 .Screen/auto DEO } |
|
||||||
%AUTO-ADDR { #04 .Screen/auto DEO } |
|
||||||
%AUTO-X-ADDR { #05 .Screen/auto DEO } |
|
||||||
%AUTO-Y-ADDR { #06 .Screen/auto DEO } |
|
||||||
|
|
||||||
( devices ) |
|
||||||
|
|
||||||
|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2 |
|
||||||
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
||||||
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |
|
||||||
|
|
||||||
( variables ) |
|
||||||
|
|
||||||
|0000 |
|
||||||
|
|
||||||
( init ) |
|
||||||
|
|
||||||
|0100 ( -> ) |
|
||||||
|
|
||||||
( theme ) |
|
||||||
#0fa7 .System/r DEO2 |
|
||||||
#0fa7 .System/g DEO2 |
|
||||||
#0fa7 .System/b DEO2 |
|
||||||
|
|
||||||
( load font ) |
|
||||||
#4900 .File/length DEO2 |
|
||||||
;font-path-large .File/name DEO2 |
|
||||||
;font-data .File/read DEO2 |
|
||||||
( draw label ) |
|
||||||
#0020 #0020 ;title #01 ;draw-uf3 JSR2 |
|
||||||
|
|
||||||
( load font ) |
|
||||||
#2100 .File/length DEO2 |
|
||||||
;font-path-medium .File/name DEO2 |
|
||||||
;font-data .File/read DEO2 |
|
||||||
( draw label ) |
|
||||||
#0020 #0048 ;body #02 ;draw-uf2 JSR2 |
|
||||||
|
|
||||||
( load font ) |
|
||||||
#0900 .File/length DEO2 |
|
||||||
;font-path-small .File/name DEO2 |
|
||||||
;font-data .File/read DEO2 |
|
||||||
( draw label ) |
|
||||||
#0030 #00b8 ;footer #03 ;draw-uf1 JSR2 |
|
||||||
|
|
||||||
BRK |
|
||||||
|
|
||||||
@draw-uf1 ( x* y* text* color -- ) |
|
||||||
|
|
||||||
STH |
|
||||||
SWP2 .Screen/y DEO2 |
|
||||||
SWP2 DUP2 .Screen/x DEO2 SWP2 |
|
||||||
&loop |
|
||||||
LDAk |
|
||||||
DUP #0a ! ,&no-linebreak JCN |
|
||||||
( move down ) STH OVR2 .Screen/x DEO2 STHr |
|
||||||
( incr y ) .Screen/y DEI2 #0010 ++ .Screen/y DEO2 |
|
||||||
POP ,&continue JMP &no-linebreak |
|
||||||
( get addr ) STHk TOS #30 SFT2 ;font-data #0100 ++ ++ .Screen/addr DEO2 |
|
||||||
( get width ) STHr TOS ;font-data ++ LDA TOS |
|
||||||
( draw ) STHkr .Screen/sprite DEO |
|
||||||
( use width ) .Screen/x DEI2 ++ .Screen/x DEO2 |
|
||||||
&continue |
|
||||||
( incr addr ) INC2 |
|
||||||
LDAk ,&loop JCN |
|
||||||
POP2 POP2 POPr |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
@draw-uf2 ( x* y* text* color -- ) |
|
||||||
|
|
||||||
STH |
|
||||||
SWP2 .Screen/y DEO2 |
|
||||||
SWP2 .Screen/x DEO2 |
|
||||||
AUTO-Y-ADDR |
|
||||||
&while |
|
||||||
LDAk #0a ! ,&no-linebreak JCN |
|
||||||
( reset ) #0020 .Screen/x DEO2 |
|
||||||
( down ) .Screen/y DEI2k #0010 ++ ROT DEO2 |
|
||||||
,&continue JMP &no-linebreak |
|
||||||
LDAk STHkr ,&sprite JSR |
|
||||||
&continue |
|
||||||
INC2 LDAk ,&while JCN |
|
||||||
POP2 POPr |
|
||||||
AUTO-NONE |
|
||||||
RTN |
|
||||||
|
|
||||||
&sprite ( char color -- ) |
|
||||||
.Screen/x DEI2 STH2 |
|
||||||
.Screen/y DEI2 STH2 |
|
||||||
( glyph ) OVR GET-GLYPH .Screen/addr DEO2 |
|
||||||
DUP .Screen/sprite DEOk DEO |
|
||||||
STH2kr .Screen/y DEO2 |
|
||||||
SWP GET-WIDTH |
|
||||||
DUP #09 < ,&narrow JCN |
|
||||||
.Screen/x DEI2k #0008 ++ ROT DEO2 |
|
||||||
OVR .Screen/sprite DEOk DEO |
|
||||||
STH2kr .Screen/y DEO2 |
|
||||||
&narrow |
|
||||||
POP2r |
|
||||||
( width ) TOS STH2r ++ .Screen/x DEO2 |
|
||||||
POP |
|
||||||
RTN |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
@draw-uf3 ( x* y* text* color -- ) |
|
||||||
|
|
||||||
STH |
|
||||||
SWP2 .Screen/y DEO2 |
|
||||||
SWP2 DUP2 .Screen/x DEO2 SWP2 |
|
||||||
&loop |
|
||||||
LDAk |
|
||||||
DUP #0a ! ,&no-linebreak JCN |
|
||||||
( move down ) OVR2 .Screen/x DEO2 |
|
||||||
( incr y ) .Screen/y DEI2 #0010 ++ .Screen/y DEO2 |
|
||||||
POP ,&continue JMP &no-linebreak |
|
||||||
STHkr ,&sprite JSR |
|
||||||
&continue |
|
||||||
( incr addr ) INC2 |
|
||||||
LDAk ,&loop JCN |
|
||||||
POP2 POP2 POPr |
|
||||||
RTN |
|
||||||
|
|
||||||
&sprite ( char color -- ) |
|
||||||
STH |
|
||||||
( get addr ) DUP TOS #30 SFT2 #30 SFT2k ROT POP ADD2 ;font-data #0100 ++ ++ .Screen/addr DEO2 |
|
||||||
( get width ) TOS ;font-data ++ LDA TOS |
|
||||||
#0300 |
|
||||||
&ver |
|
||||||
#0300 |
|
||||||
&hor |
|
||||||
STHkr .Screen/sprite DEO |
|
||||||
.Screen/x DEI2 #0008 ++ .Screen/x DEO2 |
|
||||||
.Screen/addr DEI2 #0008 ++ .Screen/addr DEO2 |
|
||||||
INC GTHk ,&hor JCN |
|
||||||
POP2 |
|
||||||
.Screen/y DEI2 #0008 ++ .Screen/y DEO2 |
|
||||||
.Screen/x DEI2 #0018 -- .Screen/x DEO2 |
|
||||||
INC GTHk ,&ver JCN |
|
||||||
POP2 |
|
||||||
.Screen/y DEI2 #0018 -- .Screen/y DEO2 |
|
||||||
( use width ) .Screen/x DEI2 ++ .Screen/x DEO2 |
|
||||||
POPr |
|
||||||
RTN |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
@title |
|
||||||
5468 6520 466f 6720 486f 726e $1 |
|
||||||
|
|
||||||
@body |
|
||||||
4927 6c6c 206d 616b 6520 6120 736f 756e |
|
||||||
6420 7468 6174 2773 2073 6f20 616c 6f6e |
|
||||||
6520 0a74 6861 7420 6e6f 206f 6e65 2063 |
|
||||||
616e 206d 6973 7320 6974 2c20 7468 6174 |
|
||||||
2077 686f 6576 6572 200a 6865 6172 7320 |
|
||||||
6974 2077 696c 6c20 7765 6570 2069 6e20 |
|
||||||
7468 6569 7220 736f 756c 732c 200a 616e |
|
||||||
6420 6865 6172 7468 7320 7769 6c6c 2073 |
|
||||||
6565 6d20 7761 726d 6572 2c20 0a61 6e64 |
|
||||||
2062 6569 6e67 2069 6e73 6964 6520 7769 |
|
||||||
6c6c 2073 6565 6d20 6265 7474 6572 200a |
|
||||||
746f 2061 6c6c 2077 686f 2068 6561 7220 |
|
||||||
6974 2069 6e20 7468 6520 6469 7374 616e |
|
||||||
7420 746f 776e 732e 20 $1 |
|
||||||
|
|
||||||
@footer |
|
||||||
2d20 4279 2052 6179 2042 7261 6462 7572 |
|
||||||
79 $1 |
|
||||||
|
|
||||||
@font-path-large |
|
||||||
"projects/fonts/geneva24.uf3 $1 |
|
||||||
@font-path-medium |
|
||||||
"projects/fonts/venice14.uf2 $1 |
|
||||||
@font-path-small |
|
||||||
"projects/fonts/atari8.uf1 $1 |
|
||||||
|
|
||||||
@font-data $100 &glyphs |
|
||||||
@ -0,0 +1,155 @@ |
|||||||
|
( Draw a 8x8 font ) |
||||||
|
|
||||||
|
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV } |
||||||
|
%< { LTH } %> { GTH } %= { EQU } %! { NEQ } |
||||||
|
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 } |
||||||
|
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } |
||||||
|
|
||||||
|
%AUTO-X { #01 .Screen/auto DEO } |
||||||
|
|
||||||
|
( devices ) |
||||||
|
|
||||||
|
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
||||||
|
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
||||||
|
|
||||||
|
( variables ) |
||||||
|
|
||||||
|
|0000 |
||||||
|
|
||||||
|
( program ) |
||||||
|
|
||||||
|
|0100 |
||||||
|
|
||||||
|
( theme ) |
||||||
|
#f05d .System/r DEO2 |
||||||
|
#f0cd .System/g DEO2 |
||||||
|
#f0ad .System/b DEO2 |
||||||
|
|
||||||
|
( draw hello world ) |
||||||
|
#0010 .Screen/x DEO2 |
||||||
|
#0010 .Screen/y DEO2 |
||||||
|
;hello-txt #01 ;draw-uf1 JSR2 |
||||||
|
|
||||||
|
( draw long text ) |
||||||
|
#0010 .Screen/x DEO2 |
||||||
|
#0030 .Screen/y DEO2 |
||||||
|
;long-txt #02 ;draw-uf1-linebreaks JSR2 |
||||||
|
|
||||||
|
BRK |
||||||
|
|
||||||
|
@draw-uf1 ( string* color -- ) |
||||||
|
|
||||||
|
AUTO-X |
||||||
|
STH |
||||||
|
&while |
||||||
|
( get sprite ) LDAk #20 - #00 SWP #30 SFT2 ;font ++ .Screen/addr DEO2 |
||||||
|
( draw ) STHkr .Screen/sprite DEO |
||||||
|
INC2 LDAk ,&while JCN |
||||||
|
POPr |
||||||
|
|
||||||
|
JMP2r |
||||||
|
|
||||||
|
@draw-uf1-linebreaks ( string* color -- ) |
||||||
|
|
||||||
|
.Screen/x DEI2 ,&anchor STR2 |
||||||
|
AUTO-X |
||||||
|
STH |
||||||
|
&while |
||||||
|
LDAk #0a ! ,&no-lb JCN |
||||||
|
( rewind ) LIT2 &anchor $2 .Screen/x DEO2 |
||||||
|
( skip line ) .Screen/y DEI2k #0008 ++ ROT DEO2 |
||||||
|
,&end JMP |
||||||
|
&no-lb |
||||||
|
( get sprite ) LDAk #20 - #00 SWP #30 SFT2 ;font ++ .Screen/addr DEO2 |
||||||
|
( draw ) STHkr .Screen/sprite DEO |
||||||
|
&end |
||||||
|
INC2 LDAk ,&while JCN |
||||||
|
POPr |
||||||
|
|
||||||
|
JMP2r |
||||||
|
|
||||||
|
@hello-txt "Hello 20 "Uxn! $1 |
||||||
|
|
||||||
|
@long-txt |
||||||
|
5275 7374 6963 2043 6f6d 7075 7469 6e67 |
||||||
|
2072 6566 6572 7320 746f 2074 6865 2063 |
||||||
|
6f6e 7374 7275 6374 696f 6e20 0a6f 6620 |
||||||
|
6361 6c63 756c 6174 696f 6e20 6d61 6368 |
||||||
|
696e 6573 2075 7369 6e67 2070 7265 2d69 |
||||||
|
6e64 7573 7472 6961 6c20 0a6f 7220 6576 |
||||||
|
656e 2070 7265 2d68 6973 746f 7269 6320 |
||||||
|
7465 6368 6e6f 6c6f 6779 2e20 0a0a 4974 |
||||||
|
2072 6576 6561 6c73 2061 2068 6973 746f |
||||||
|
7279 206f 6620 636f 6d70 7574 696e 6720 |
||||||
|
6173 2074 6865 200a 7061 7374 696d 6520 |
||||||
|
6f66 2064 696c 6574 7461 6e74 6573 2c20 |
||||||
|
616d 6174 6575 7220 7363 6965 6e74 6973 |
||||||
|
7473 0a61 6e64 2074 6162 756c 6174 6f72 |
||||||
|
7320 7768 6f20 636f 6e73 7472 7563 7420 |
||||||
|
6d61 6368 696e 6573 2074 6f20 0a6d 616e |
||||||
|
6970 756c 6174 6520 6162 7374 7261 6374 |
||||||
|
2073 796d 626f 6c73 2077 6974 6820 6e6f |
||||||
|
2070 7261 6374 6963 616c 200a 6170 706c |
||||||
|
6963 6174 696f 6e2e 2041 7320 7468 6573 |
||||||
|
6520 6d61 6368 696e 6573 2061 7265 2067 |
||||||
|
656e 6572 616c 6c79 200a 6c65 7373 2065 |
||||||
|
6666 6963 6965 6e74 2074 6861 6e20 636f |
||||||
|
6e76 656e 7469 6f6e 616c 2070 656e 6369 |
||||||
|
6c20 616e 6420 0a70 6170 6572 2063 6f6d |
||||||
|
7075 7461 7469 6f6e 2c20 7468 6579 2061 |
||||||
|
6c6c 7564 6520 746f 2061 206d 6f72 6520 |
||||||
|
0a65 7069 6375 7265 616e 2070 7261 6374 |
||||||
|
6963 6520 6f66 2063 6f6d 7075 7469 6e67 |
||||||
|
2066 6f72 2070 6c65 6173 7572 6520 0a72 |
||||||
|
6174 6865 7220 7468 616e 2070 726f 6475 |
||||||
|
6374 696f 6e2e |
||||||
|
|
||||||
|
@font ( bbcmicro ) |
||||||
|
0000 0000 0000 0000 1818 1818 1800 1800 |
||||||
|
6c6c 6c00 0000 0000 3636 7f36 7f36 3600 |
||||||
|
0c3f 683e 0b7e 1800 6066 0c18 3066 0600 |
||||||
|
386c 6c38 6d66 3b00 0c18 3000 0000 0000 |
||||||
|
0c18 3030 3018 0c00 3018 0c0c 0c18 3000 |
||||||
|
0018 7e3c 7e18 0000 0018 187e 1818 0000 |
||||||
|
0000 0000 0018 1830 0000 007e 0000 0000 |
||||||
|
0000 0000 0018 1800 0006 0c18 3060 0000 |
||||||
|
3c66 6e7e 7666 3c00 1838 1818 1818 7e00 |
||||||
|
3c66 060c 1830 7e00 3c66 061c 0666 3c00 |
||||||
|
0c1c 3c6c 7e0c 0c00 7e60 7c06 0666 3c00 |
||||||
|
1c30 607c 6666 3c00 7e06 0c18 3030 3000 |
||||||
|
3c66 663c 6666 3c00 3c66 663e 060c 3800 |
||||||
|
0000 1818 0018 1800 0000 1818 0018 1830 |
||||||
|
0c18 3060 3018 0c00 0000 7e00 7e00 0000 |
||||||
|
3018 0c06 0c18 3000 3c66 0c18 1800 1800 |
||||||
|
3c66 6e6a 6e60 3c00 3c66 667e 6666 6600 |
||||||
|
7c66 667c 6666 7c00 3c66 6060 6066 3c00 |
||||||
|
786c 6666 666c 7800 7e60 607c 6060 7e00 |
||||||
|
7e60 607c 6060 6000 3c66 606e 6666 3c00 |
||||||
|
6666 667e 6666 6600 7e18 1818 1818 7e00 |
||||||
|
3e0c 0c0c 0c6c 3800 666c 7870 786c 6600 |
||||||
|
6060 6060 6060 7e00 6377 7f6b 6b63 6300 |
||||||
|
6666 767e 6e66 6600 3c66 6666 6666 3c00 |
||||||
|
7c66 667c 6060 6000 3c66 6666 6a6c 3600 |
||||||
|
7c66 667c 6c66 6600 3c66 603c 0666 3c00 |
||||||
|
7e18 1818 1818 1800 6666 6666 6666 3c00 |
||||||
|
6666 6666 663c 1800 6363 6b6b 7f77 6300 |
||||||
|
6666 3c18 3c66 6600 6666 663c 1818 1800 |
||||||
|
7e06 0c18 3060 7e00 7c60 6060 6060 7c00 |
||||||
|
0060 3018 0c06 0000 3e06 0606 0606 3e00 |
||||||
|
183c 6642 0000 0000 0000 0000 0000 00ff |
||||||
|
1c36 307c 3030 7e00 0000 3c06 3e66 3e00 |
||||||
|
6060 7c66 6666 7c00 0000 3c66 6066 3c00 |
||||||
|
0606 3e66 6666 3e00 0000 3c66 7e60 3c00 |
||||||
|
1c30 307c 3030 3000 0000 3e66 663e 063c |
||||||
|
6060 7c66 6666 6600 1800 3818 1818 3c00 |
||||||
|
1800 3818 1818 1870 6060 666c 786c 6600 |
||||||
|
3818 1818 1818 3c00 0000 367f 6b6b 6300 |
||||||
|
0000 7c66 6666 6600 0000 3c66 6666 3c00 |
||||||
|
0000 7c66 667c 6060 0000 3e66 663e 0607 |
||||||
|
0000 6c76 6060 6000 0000 3e60 3c06 7c00 |
||||||
|
3030 7c30 3030 1c00 0000 6666 6666 3e00 |
||||||
|
0000 6666 663c 1800 0000 636b 6b7f 3600 |
||||||
|
0000 663c 183c 6600 0000 6666 663e 063c |
||||||
|
0000 7e0c 1830 7e00 0c18 1870 1818 0c00 |
||||||
|
1818 1800 1818 1800 3018 180e 1818 3000 |
||||||
|
316b 4600 0000 0000 ffff ffff ffff ffff |
||||||
@ -0,0 +1,313 @@ |
|||||||
|
( GUI Picture ) |
||||||
|
|
||||||
|
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV } |
||||||
|
%< { LTH } %> { GTH } %= { EQU } %! { NEQ } |
||||||
|
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 } |
||||||
|
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } |
||||||
|
|
||||||
|
%AUTO-NONE { #00 .Screen/auto DEO } |
||||||
|
%AUTO-XADDR { #05 .Screen/auto DEO } |
||||||
|
|
||||||
|
( devices ) |
||||||
|
|
||||||
|
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
||||||
|
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
||||||
|
|
||||||
|
( variables ) |
||||||
|
|
||||||
|
|0000 |
||||||
|
|
||||||
|
( program ) |
||||||
|
|
||||||
|
|0100 |
||||||
|
|
||||||
|
( theme ) |
||||||
|
#f0d7 .System/r DEO2 |
||||||
|
#f0de .System/g DEO2 |
||||||
|
#f0dc .System/b DEO2 |
||||||
|
|
||||||
|
#0030 .Screen/x DEO2 |
||||||
|
#0030 .Screen/y DEO2 |
||||||
|
;picture-icn #20 #10 #01 ;draw-icn JSR2 |
||||||
|
|
||||||
|
BRK |
||||||
|
|
||||||
|
@draw-icn ( addr* width height color -- ) |
||||||
|
|
||||||
|
AUTO-XADDR |
||||||
|
STH |
||||||
|
( set bounds ) ,&height STR ,&width STR .Screen/addr DEO2 |
||||||
|
( set origin ) .Screen/x DEI2 ,&x STR2 |
||||||
|
LIT &height $1 #00 |
||||||
|
&ver |
||||||
|
LIT2 &x $2 .Screen/x DEO2 |
||||||
|
LIT &width $1 #00 |
||||||
|
&hor |
||||||
|
STHkr .Screen/sprite DEO |
||||||
|
INC GTHk ,&hor JCN |
||||||
|
POP2 |
||||||
|
.Screen/y DEI2k #0008 ++ ROT DEO2 |
||||||
|
INC GTHk ,&ver JCN |
||||||
|
POP2 |
||||||
|
POPr |
||||||
|
AUTO-NONE |
||||||
|
|
||||||
|
JMP2r |
||||||
|
|
||||||
|
@picture-icn ( akane2010.bit 20 x 10 ) |
||||||
|
0000 0000 0000 0000 2b41 2341 2b41 2341 |
||||||
|
8881 8081 8880 8080 0a00 2000 8800 2000 |
||||||
|
8004 2004 8804 2a04 0000 0000 8000 0000 |
||||||
|
0307 0f0f 0f1f 1f5f 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 ffff ffff fff7 ffff efdf |
||||||
|
fbf7 efd7 efdf af5f fffd fbfd fbf5 ebd7 |
||||||
|
eaf5 ead5 ead5 aa55 ab55 ab55 ab57 ab57 |
||||||
|
fbf7 ebd7 ebd7 ab57 ffff ffff ffff fbf7 |
||||||
|
ffff ffff ffff ffff ffff ffff ffff ffff |
||||||
|
ffff ffff ffff ffff ffff ffff ffff fefc |
||||||
|
80c0 8000 0000 0000 0000 0000 0000 0000 |
||||||
|
0000 0000 0000 0000 2a54 2a54 2a54 2a54 |
||||||
|
8800 2200 8800 2200 8800 2200 8800 2200 |
||||||
|
0000 0000 0000 0000 2b41 2341 2b41 2341 |
||||||
|
8880 8080 8880 a080 8800 2000 8800 2000 |
||||||
|
8a05 2a05 8f0f 2a15 aa55 aafd ffff aa45 |
||||||
|
bf7f ff7f 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 fefd ffff ffff ffff be7c |
||||||
|
ffff ffff 8a00 0200 befd fafd fe1f 2307 |
||||||
|
bf5f bf7d bad5 eaf5 ead5 aa55 aa55 aa55 |
||||||
|
aa55 aa55 aa55 aa55 aa55 aa55 aa55 ab57 |
||||||
|
af57 af7f ffc5 a307 fbf7 ff9f 1f1f 8f9f |
||||||
|
ffff ffff ffff ffff ffff ffff ffff ffff |
||||||
|
ffff ffff ffff ffff fefd faf5 eaff ff5f |
||||||
|
0055 aa55 aaff ffff 0055 aa55 aaff ffff |
||||||
|
0055 aadf aaff ffff aa55 aad5 aaff ffff |
||||||
|
8840 aa77 aaff ffff 8800 aaff aaff ffff |
||||||
|
0000 0000 0000 0000 2b41 2341 2b41 2241 |
||||||
|
8800 a000 8800 a004 8804 2004 8000 2240 |
||||||
|
8810 0810 a010 2010 0200 0000 0000 0000 |
||||||
|
bf3f 3f1f 0f07 0303 ffff ffff ffff ffff |
||||||
|
ffff ffff ffff ffff ffff ffff ffff ffff |
||||||
|
ffff ffff ffff ffff ffff ffff ffd7 ab55 |
||||||
|
faf5 faf5 eaf5 eaf5 f870 e240 8840 8240 |
||||||
|
8800 2200 8841 233f 8f1f 3f7f ffff ffff |
||||||
|
fadd eac1 e2c1 c2c1 aa55 aa55 aa55 aa55 |
||||||
|
aa55 aa55 aa54 a040 ae54 a854 a855 2f07 |
||||||
|
8f1f 1f3f bfff ffff 8f87 8f85 8205 2a05 |
||||||
|
ffdf af5f bf7f bf77 ffff ffff ffff ffff |
||||||
|
fefd f8c0 80c0 80c0 aa55 2a15 0a15 0a15 |
||||||
|
ab55 8000 8000 8000 fe55 0200 0800 2200 |
||||||
|
aa55 2200 8800 2200 eb77 2a54 2a54 2a54 |
||||||
|
ff55 2000 8800 2000 ff55 0000 0000 2000 |
||||||
|
0000 0000 0000 0000 2a41 2241 2b41 2341 |
||||||
|
8804 a004 8004 a004 0840 aa40 8850 8210 |
||||||
|
a010 2040 a040 2040 0000 0000 0000 0000 |
||||||
|
0301 0000 0000 0000 ffff ff7f 7f3f 3b07 |
||||||
|
ffff ffff ffff ffff ffff ffff ffff ffff |
||||||
|
feff fefd fefd fefd aa55 aa55 aa55 aa55 |
||||||
|
eaf5 fafd fafd fefd 8840 a250 a854 aa54 |
||||||
|
bf1f 2f07 8800 8055 ffff fefc e800 0a54 |
||||||
|
8201 2000 8000 8010 aa54 2800 0000 0000 |
||||||
|
0000 0000 0000 0000 0301 0000 0000 0200 |
||||||
|
fefc fa70 8801 aa50 8a05 0a05 0201 0303 |
||||||
|
ef57 af5f af5f bf7f ffff ffff ffff ffff |
||||||
|
c0c0 a2c0 8880 a280 0a15 0a15 8a15 0a15 |
||||||
|
0000 0000 8000 2000 0800 0200 0800 2000 |
||||||
|
0800 2200 8800 0000 2a54 2a55 2a55 2a57 |
||||||
|
8800 2000 a0ff ffff 8000 2000 a8ff ffff |
||||||
|
0000 0000 0000 0001 ab41 a341 ab5f ffff |
||||||
|
8004 a804 8eff ffff 8010 a200 a0c0 e2c1 |
||||||
|
8040 80c0 80c0 8000 0000 0000 0000 0000 |
||||||
|
0000 0000 0000 0000 0301 0101 0000 0000 |
||||||
|
ffff ffff ff7f 1f0f ffff ffff ffff ffff |
||||||
|
fefd feff feff ffff aa55 aa55 aa55 aad5 |
||||||
|
feff feff fe7f fe7f aa54 aa55 aa55 aa54 |
||||||
|
0000 0000 0000 0000 0000 0000 0000 0000 |
||||||
|
0800 0000 0000 0000 0000 0000 0000 0000 |
||||||
|
0000 0001 0205 0a05 8040 2040 e070 e040 |
||||||
|
0000 0000 0000 0000 0307 0307 0707 0f07 |
||||||
|
ffff ffff ffff ffff ffff fefc fefc fcfc |
||||||
|
8207 3f7f 7f7f 7f7f 8aff ffff ffff ffff |
||||||
|
08c0 faf8 fcfc feff 8800 2000 8800 2000 |
||||||
|
0000 2000 0000 0000 2b57 2f57 2b55 2a54 |
||||||
|
ffff ffff ffff ffff ffff ffff ffff ffff |
||||||
|
0b03 0307 0707 0f1f ffff ffff ffff ffff |
||||||
|
ffff ffff ffff ffff e0f1 f9f1 faf3 faf7 |
||||||
|
8000 0000 0000 0000 0000 0000 0000 0000 |
||||||
|
0000 0000 0000 0000 0000 0000 0000 0000 |
||||||
|
0707 0301 0000 0000 ffff ffff ff7f 3f1f |
||||||
|
ffff ffff ffff ffff eaf5 fafd feff ffff |
||||||
|
fe7d be7f be7d ffff aa54 aa54 aa54 aad5 |
||||||
|
0000 0000 0000 0000 0000 0000 0000 0000 |
||||||
|
0000 0000 0000 0000 0000 0000 0000 0000 |
||||||
|
0201 0000 0000 0001 e040 0000 0000 0040 |
||||||
|
0000 0000 0000 0000 0f07 0f07 0f0f 0f1f |
||||||
|
ffff ffff fffe fcfc f8f0 c280 0800 2200 |
||||||
|
be7f 3e15 8a01 2205 ff5f af55 ab55 ab55 |
||||||
|
feff ffff ffff bf7f 8000 2000 8800 a201 |
||||||
|
8800 2000 0000 00f7 2854 2854 2854 28f4 |
||||||
|
ff7f bf57 af5f 2f57 ffff ffff ffff ffff |
||||||
|
0f1f 0f07 0707 0707 ffff ffff ffff ffff |
||||||
|
ffff ffff fefd faf5 e2c4 8604 8844 a854 |
||||||
|
0000 0000 0000 0000 0000 0000 0000 0000 |
||||||
|
0000 0000 0000 0000 0000 0000 0000 0000 |
||||||
|
0000 0000 0000 0000 0f03 0100 0000 0000 |
||||||
|
ffff ff7f 0f07 0a05 ffff ffff ffff ff7f |
||||||
|
ffff ffff ffff ffff eaf5 fafd feff ffff |
||||||
|
8000 8040 a0d0 e8d4 0000 0000 0000 0000 |
||||||
|
0000 0000 0000 0000 0000 0000 0000 0000 |
||||||
|
0200 0000 0000 0000 8000 0000 0000 0000 |
||||||
|
0000 0000 0001 0305 0f1f 3f7c f8f0 8201 |
||||||
|
e8c4 2a11 a840 a200 8800 2200 2005 2000 |
||||||
|
8215 2e57 2a55 aa55 aa55 aa55 aa55 3a15 |
||||||
|
fe7c f8f0 e840 a250 0307 2f1f 8f1f 2f0f |
||||||
|
ffff ffff ffff ffff f8fc fefc feff fef0 |
||||||
|
ab57 2b15 0a55 0a01 ffff feff ea55 8040 |
||||||
|
0301 0005 aa10 0805 ffff ff5f aa05 2000 |
||||||
|
eaf5 ead5 aa55 aa41 8810 b810 2070 2040 |
||||||
|
0000 0000 0000 0000 0000 0000 0000 0000 |
||||||
|
0000 0000 0000 0000 0000 0000 0204 0a10 |
||||||
|
0000 0000 a805 2200 0000 0000 0040 2805 |
||||||
|
0a05 0a10 2a41 a200 af57 a840 8844 0a10 |
||||||
|
ffff ff7f 8f01 2004 ffff ffff ffff ff7f |
||||||
|
aed5 aad5 aad5 aad5 80c0 a85d ab55 aa55 |
||||||
|
0000 0000 a054 aa55 0000 0000 0000 a055 |
||||||
|
0000 0000 0000 0045 0000 0071 fa7c faf0 |
||||||
|
0810 a240 0800 2001 0a04 0254 a850 8200 |
||||||
|
0800 2200 8800 2200 8800 2200 8804 2a00 |
||||||
|
8a05 2201 8a01 2001 a8d0 a0c4 8a54 a040 |
||||||
|
2801 2000 8800 0250 8f01 8240 a011 2211 |
||||||
|
af55 a040 8051 a815 e0c0 c240 8800 a200 |
||||||
|
0840 2200 aa10 2214 2a05 2000 8800 2200 |
||||||
|
8a00 2000 8000 2200 2a00 2200 8800 2200 |
||||||
|
a214 2301 8000 2210 e040 80c0 6070 2010 |
||||||
|
0000 0000 0000 0000 0000 0000 0000 0000 |
||||||
|
0000 0001 0204 0814 2840 a200 8800 2200 |
||||||
|
8800 2200 8800 2200 8b10 2240 0800 a200 |
||||||
|
a855 2200 8800 2200 2040 a240 a810 2a04 |
||||||
|
8810 2200 0845 a800 bf7f 3a11 3805 2301 |
||||||
|
aa55 aa55 aa55 aa55 aa55 aa55 aa55 aa55 |
||||||
|
aa55 aa55 aa55 aa55 aa55 aa55 aa75 fa7f |
||||||
|
ef75 bb5d bb5f bb5f f8f8 fafc f8fc fcfc |
||||||
|
8800 2201 8801 2201 0800 2200 0801 2204 |
||||||
|
8800 2200 0850 2800 8010 0240 a810 2210 |
||||||
|
8a01 2000 8800 2200 0800 a200 8800 2240 |
||||||
|
a840 2200 a800 2200 8801 2a04 8805 2204 |
||||||
|
8add aa45 8a14 2015 8800 a200 8800 a280 |
||||||
|
8804 2804 8004 2204 8800 2200 8800 2200 |
||||||
|
8800 0200 8840 0240 8800 2200 8800 2001 |
||||||
|
8800 0240 8800 2200 b010 1810 b810 1810 |
||||||
|
0000 0000 0000 0000 0000 0000 0000 0001 |
||||||
|
0810 2240 8800 a200 8800 2200 8800 2201 |
||||||
|
8801 2241 8a00 a204 8800 2200 8800 2200 |
||||||
|
8800 2200 8800 2200 8a00 2201 8800 2200 |
||||||
|
8a01 2200 0800 a200 0a05 aa75 aa05 2201 |
||||||
|
aa55 aa55 aa55 aa55 aa55 aa55 aa55 aa55 |
||||||
|
aa55 aa55 aa55 aa55 bf7f bf5f af47 8301 |
||||||
|
bbd7 fbf1 f8fd feff fefc fefc fefe fefe |
||||||
|
8801 2241 2a05 2200 0040 8200 8800 0200 |
||||||
|
0000 a204 a840 2200 0a50 8200 8800 2200 |
||||||
|
a010 2200 8801 2200 8800 2200 2800 a240 |
||||||
|
a800 2205 8205 2205 8a04 2254 a855 ab55 |
||||||
|
3e15 2a75 ead5 aa55 82d5 ea75 aa75 aa75 |
||||||
|
a85c aa50 a850 aa50 8800 2200 8800 2200 |
||||||
|
0800 a200 8800 a200 8a01 2000 8801 2001 |
||||||
|
0800 2200 8800 2200 8810 2810 8814 2804 |
||||||
|
0000 0000 0000 0000 0204 0004 0810 0210 |
||||||
|
8800 2200 8800 2200 8801 2001 8801 2200 |
||||||
|
0804 2a00 0810 a200 8800 2200 8800 2200 |
||||||
|
8800 2200 8800 2200 8800 2200 8801 2200 |
||||||
|
0840 0240 a800 a210 8800 2200 8800 2200 |
||||||
|
2a14 2200 8800 2200 aa00 8040 a804 2200 |
||||||
|
a800 0000 0000 8050 0000 0000 0000 0001 |
||||||
|
ff7f 3f1f 3f71 8200 feff feff ffff ff7f |
||||||
|
8800 2200 88f0 fafc a804 2200 aa11 0210 |
||||||
|
8800 2200 0800 a200 8800 2200 8800 2200 |
||||||
|
8800 2200 8800 2200 0840 2240 a800 221f |
||||||
|
8a01 2205 8205 befd a850 a854 a855 a955 |
||||||
|
ff7f ffdd badd ba5d eaf5 ea75 ea75 ead5 |
||||||
|
a850 aa50 a850 a250 8800 2a04 8a00 2200 |
||||||
|
0800 0250 0800 0254 8011 2200 8800 2201 |
||||||
|
0800 2055 aa55 aad5 8810 2040 a040 a040 |
||||||
|
0000 0000 0000 0200 2800 2240 0840 0240 |
||||||
|
8800 2200 8800 2200 8800 2200 8800 2200 |
||||||
|
8800 2200 8800 2200 8800 2200 8800 2200 |
||||||
|
8800 2200 8800 2200 8800 2200 8800 2200 |
||||||
|
0850 2210 881c 2804 8800 2200 8800 2200 |
||||||
|
8800 2200 8800 2200 8800 2200 8800 2200 |
||||||
|
8a05 2200 8004 0f1f 0244 a818 9810 b2f0 |
||||||
|
8800 2200 8800 2200 bf1f 2f1f 8f0f 2f07 |
||||||
|
feff ffff ffff ffff 0090 e2f0 e0f0 f8fc |
||||||
|
8840 2200 a800 2210 8800 2200 8800 2200 |
||||||
|
8800 2200 8800 2200 9f1f 2f0f 8f07 2305 |
||||||
|
fefd fefd fefd fefd ab51 aa57 aa57 ae55 |
||||||
|
ba5d ba55 aa55 aa55 ead5 ead5 aad5 aad5 |
||||||
|
a857 bf7f ff7f ffff afff ffff ffff ffff |
||||||
|
80f5 ffff ffff ffff 8855 faf0 f8f8 f8fd |
||||||
|
aad5 aa55 2a55 2a55 a075 aa40 a040 a055 |
||||||
|
0850 aa01 0201 0055 0840 8240 2800 2270 |
||||||
|
8800 2200 8800 2200 8800 2200 8800 2200 |
||||||
|
8800 2200 8800 2200 8800 2200 8800 2200 |
||||||
|
8800 2200 8800 2200 8800 2200 8800 2200 |
||||||
|
8a01 2001 8800 2200 8800 a2c0 a850 2834 |
||||||
|
8800 2200 8800 2200 8800 2200 8800 2200 |
||||||
|
bf7f ff7f ff7f 7f7f e8f0 e2f0 f0f0 fafc |
||||||
|
8800 2200 8800 2200 8f0f 2f1f 9f1f 3f7f |
||||||
|
ffff ffff fffd fefd fcfd fef5 aa55 ab57 |
||||||
|
0050 e0f1 fafd eed5 0874 ae57 af5f be5d |
||||||
|
8800 22c0 b85c aa5c 8a04 2200 8800 2200 |
||||||
|
fe7d 3e3d be1d 2e05 ae55 ae55 ae7d ee5d |
||||||
|
ab55 ab55 ab57 aa57 aa55 ab55 ab57 ab57 |
||||||
|
ffff ffff ffff ffff ffff ffff ffff ffff |
||||||
|
ffff ffff ffff ffff ffff ffff ffff fefc |
||||||
|
ead5 eaf5 eaf5 aa15 bf5f bf5f bf5d aa51 |
||||||
|
feff ffff ff75 aa40 e8f0 eae4 e064 a210 |
||||||
|
8800 2200 8800 2200 8800 2200 8800 2200 |
||||||
|
8800 2200 8800 2200 8800 2200 8800 2201 |
||||||
|
8800 2005 8810 2200 8800 8200 8800 2200 |
||||||
|
8800 2200 8800 2200 ba14 2a05 8607 2301 |
||||||
|
0800 2210 0804 a200 8800 2201 8a04 2850 |
||||||
|
7f7f ff7f 3f1f 3f1f fcfe ffff ffff f8fc |
||||||
|
8801 8fff ffff fe7d ffff ffff ebd7 af57 |
||||||
|
feff ead7 abd5 aa55 ab55 aa55 ab75 faf5 |
||||||
|
aed7 aa57 fa50 a0c1 be5f fa50 0000 0255 |
||||||
|
b878 f87c 2f17 aa40 8800 2200 8840 2010 |
||||||
|
8a05 2a05 0a1d 0a1d ae5d ae5d ae5d ee5d |
||||||
|
aa55 ae55 aa5d ba55 af5f ab5f bb77 ab77 |
||||||
|
ffff ffff ffff ffff ffff ffff ffff ffff |
||||||
|
ffff ffff ffff ffff fefc fefc fefc feff |
||||||
|
0a15 0a05 0a05 0255 a850 a850 a850 a854 |
||||||
|
8040 0000 0800 0814 2211 2010 2010 2210 |
||||||
|
8800 2200 0800 2200 8800 2200 8800 2200 |
||||||
|
8800 2200 8800 2200 8a04 2a10 a840 0200 |
||||||
|
0800 2200 8800 2015 8800 2200 8800 a800 |
||||||
|
8800 2200 8800 2240 8801 2201 8801 2001 |
||||||
|
88c0 aad5 aad5 aa55 2000 ba55 aa55 aa57 |
||||||
|
8f1f af5f afff bf7f fafd fcfc faf5 faff |
||||||
|
3a55 0e07 0301 80c0 aa55 eaf5 fbff ff7f |
||||||
|
aa55 ab7f ffff ffff fb75 f8f0 e0c0 80c0 |
||||||
|
8a14 0800 0000 0000 aa00 0000 0000 0000 |
||||||
|
0004 0201 0001 0001 2010 2040 8880 a001 |
||||||
|
3e15 2040 e0f4 feff ef55 0000 0000 80d0 |
||||||
|
fa55 0a15 0a15 0a15 bf77 a347 a347 83c7 |
||||||
|
ffff ffff ffff ffff ffff ffff ffff ffff |
||||||
|
ffff ffff ffff ffff ffff ffff ffff ffff |
||||||
|
feff feff ffff aad5 af57 af57 ab57 ab55 |
||||||
|
ffff ffff ffff aa55 e8f0 e2e0 e8e0 a240 |
||||||
|
8800 2200 8800 2200 8800 2200 8800 2200 |
||||||
|
8801 2204 8000 2810 0800 2204 8810 2240 |
||||||
|
2040 2200 8800 2200 8800 2200 8800 2200 |
||||||
|
8000 2a04 8a00 2211 8a07 2e0d 8a1d 3a7d |
||||||
|
aa55 aa55 aa55 aa55 ae55 af57 ab55 abff |
||||||
|
ffff ffff ffff ffff ffff ffff ffff ffff |
||||||
|
e0c0 e0f0 f8f0 f8f0 3f1f 0f07 0301 0001 |
||||||
|
ffff ffff fefe fefc 8000 8000 0000 0000 |
||||||
|
0000 0000 0000 0000 0000 0000 0000 0000 |
||||||
|
0001 0001 0000 0000 8303 8343 8343 8343 |
||||||
|
ffff ffff ffff ffff faff ffff ffff fbf7 |
||||||
|
bafd ffff bfdf ff5f ef7f ffff af5f af5f |
||||||
|
ffff ffff ffff ffff ffff ffff ffff ffff |
||||||
@ -1,121 +0,0 @@ |
|||||||
( GUI Proportional font ) |
|
||||||
|
|
||||||
( devices ) |
|
||||||
|
|
||||||
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |
|
||||||
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |
|
||||||
|
|
||||||
( variables ) |
|
||||||
|
|
||||||
|0000 |
|
||||||
|
|
||||||
( program ) |
|
||||||
|
|
||||||
|0100 |
|
||||||
|
|
||||||
( theme ) #0f9f .System/r DEO2 #0f3f .System/g DEO2 #0f30 .System/b DEO2 |
|
||||||
|
|
||||||
#0000 ;draw JSR2 |
|
||||||
#0001 ;draw JSR2 |
|
||||||
#0002 ;draw JSR2 |
|
||||||
|
|
||||||
BRK |
|
||||||
|
|
||||||
@draw ( extra-spacing* -- ) |
|
||||||
STH2 |
|
||||||
;text |
|
||||||
&loop |
|
||||||
LDAk |
|
||||||
DUP #00 EQU ,&end JCN |
|
||||||
DUP #0a EQU ,&linefeed JCN |
|
||||||
#0005 SFT2 ;font ADD2 |
|
||||||
DUP2 .Screen/addr DEO2 |
|
||||||
#09 .Screen/sprite DEO |
|
||||||
,get-x-advance JSR .Screen/x DEI2 ADD2 STH2kr ADD2 .Screen/x DEO2 |
|
||||||
&next |
|
||||||
INC2 |
|
||||||
,&loop JMP |
|
||||||
|
|
||||||
&linefeed |
|
||||||
POP |
|
||||||
#0000 .Screen/x DEO2 |
|
||||||
#0008 .Screen/y DEI2 ADD2 STH2kr ADD2 .Screen/y DEO2 |
|
||||||
,&next JMP |
|
||||||
|
|
||||||
&end |
|
||||||
POP POP2 POP2r |
|
||||||
JMP2r |
|
||||||
|
|
||||||
@get-x-advance ( font-char-addr* -- advance* ) |
|
||||||
( Save two 00 bytes for later use ) |
|
||||||
#0000 SWP2 |
|
||||||
( First, load the eight bytes that make up the character ) |
|
||||||
LDA2k SWP2 #0002 ADD2 |
|
||||||
LDA2k SWP2 #0002 ADD2 |
|
||||||
LDA2k SWP2 #0002 ADD2 |
|
||||||
LDA2 |
|
||||||
( OR all the bytes together, so we know which columns contain filled pixels ) |
|
||||||
ORA2 ORA2 ORA2 ORA |
|
||||||
( Find the lowest set bit (using one of the 00 bytes at the top, but not consuming it) ) |
|
||||||
SUBk AND |
|
||||||
( Convert the nine possible values (00-80) into an offset into the magic table (00-08). ) |
|
||||||
( They get jumbled up with these two operations, but each possible value remains unique ) |
|
||||||
#a3 MUL #16 DIV |
|
||||||
( Load the byte from the magic table, return a short (consuming/returning the 00 bytes at the top) ) |
|
||||||
;&magic ADD2 LDA |
|
||||||
JMP2r |
|
||||||
( The magic table performs the last bit of arithmetic we want: |
|
||||||
* the advance in x should be one more than the number of columns with filled pixels, |
|
||||||
* with a maximum of 8, and |
|
||||||
* a minimum of 3. ) |
|
||||||
&magic |
|
||||||
03 ( lowest set bit is 00, 0 columns wide ) |
|
||||||
06 ( lowest set bit is 08, 5 columns wide ) |
|
||||||
05 ( lowest set bit is 10, 4 columns wide ) |
|
||||||
08 ( lowest set bit is 02, 7 columns wide ) |
|
||||||
04 ( lowest set bit is 20, 3 columns wide ) |
|
||||||
03 ( lowest set bit is 80, 1 column wide ) |
|
||||||
07 ( lowest set bit is 04, 6 columns wide ) |
|
||||||
08 ( lowest set bit is 01, 8 columns wide ) |
|
||||||
03 ( lowest set bit is 40, 2 columns wide ) |
|
||||||
|
|
||||||
@font ( spectrum-zx font, with each character moved to be flush left in its cell ) |
|
||||||
[ |
|
||||||
0000 0000 0000 0000 0000 4800 fc78 0000 0000 4800 7884 0000 0000 d8f8 f870 2000 |
|
||||||
0020 70f8 f870 2000 0070 70f8 d820 7000 0020 70f8 f820 7000 0000 00c0 c000 0000 |
|
||||||
00fc 8484 8484 fc00 0000 6090 9060 0000 0030 4884 8448 3000 003c 0c74 9490 6000 |
|
||||||
0070 88d8 20f8 2000 0030 2020 20e0 e000 007c 4444 44cc cc00 0000 2088 0088 2000 |
|
||||||
0000 80c0 e0c0 8000 0000 2060 e060 2000 0040 e000 00e0 4000 00a0 a0a0 a000 a000 |
|
||||||
007c 9494 7414 1400 0018 608c c418 6000 0000 0000 0000 ffff 0040 e000 e040 00e0 |
|
||||||
0020 70a8 2020 2000 0020 2020 a870 2000 0000 1008 fc08 1000 0000 2040 fc40 2000 |
|
||||||
0000 8080 fc00 0000 0000 0048 cc48 0000 0000 2070 f800 0000 0000 00f8 7020 0000 |
|
||||||
0000 0000 0000 0000 0080 8080 8000 8000 00a0 a000 0000 0000 0048 fc48 48fc 4800 |
|
||||||
0020 78a0 7028 f020 0084 0810 2040 8400 0060 9064 9888 7400 0040 8000 0000 0000 |
|
||||||
0040 8080 8080 4000 0080 4040 4040 8000 0000 5020 f820 5000 0000 2020 f820 2000 |
|
||||||
0000 0000 0040 4080 0000 0000 f000 0000 0000 0000 0000 8000 0000 0810 2040 8000 |
|
||||||
0078 8c94 a4c4 7800 0060 a020 2020 f800 0078 8404 7880 fc00 0078 8438 0484 7800 |
|
||||||
0010 3050 90fc 1000 00fc 80f8 0484 7800 0078 80f8 8484 7800 00fc 0408 1020 2000 |
|
||||||
0078 8478 8484 7800 0078 8484 7c04 7800 0000 0080 0000 8000 0000 4000 0040 4080 |
|
||||||
0000 2040 8040 2000 0000 00f8 00f8 0000 0000 8040 2040 8000 0078 8404 1800 1000 |
|
||||||
0078 84b4 a884 7800 0030 4884 fc84 8400 00f8 84f8 8484 f800 0078 8480 8084 7800 |
|
||||||
00f0 8884 8488 f000 00fc 80f8 8080 fc00 007c 8080 f880 8000 0078 8480 9c84 7800 |
|
||||||
0084 84fc 8484 8400 00f8 2020 2020 f800 0004 0404 8484 7800 0088 90e0 9088 8400 |
|
||||||
0080 8080 8080 fc00 0084 ccb4 8484 8400 0084 c4a4 948c 8400 0078 8484 8484 7800 |
|
||||||
00f8 8484 f880 8000 0078 8484 a494 7800 00f8 8484 f888 8400 0078 8078 0484 7800 |
|
||||||
00fe 1010 1010 1000 0084 8484 8484 7800 0084 8484 8448 3000 0084 8484 b4cc 8400 |
|
||||||
0084 4830 3048 8400 0082 4428 1010 1000 00fc 0810 2040 fc00 00c0 8080 8080 c000 |
|
||||||
0080 4020 1008 0400 00c0 4040 4040 c000 0020 5088 0000 0000 0000 0000 0000 fc00 |
|
||||||
0080 4000 0000 0000 0000 7008 7888 7800 0080 80f0 8888 f000 0000 7880 8080 7800 |
|
||||||
0008 0878 8888 7800 0000 7088 f080 7800 0060 80e0 8080 8000 0000 7088 8878 0870 |
|
||||||
0080 80b0 c888 8800 0040 00c0 4040 2000 0010 0010 1010 9060 0080 90a0 c0a0 9000 |
|
||||||
0080 8080 8080 6000 0000 d0a8 a8a8 a800 0000 b0c8 8888 8800 0000 7088 8888 7000 |
|
||||||
0000 f088 88f0 8080 0000 7888 8878 080c 0000 b0c0 8080 8000 0000 7080 7008 f000 |
|
||||||
0040 40f0 4040 3000 0000 8888 8888 7000 0000 8888 5050 2000 0000 88a8 a8a8 5000 |
|
||||||
0000 8850 2050 8800 0000 8888 8878 0870 0000 f810 2040 f800 0060 4080 8040 6000 |
|
||||||
0080 8080 8080 8000 00c0 4020 2040 c000 0000 0064 9800 0000 3c42 99a1 a199 423c |
|
||||||
] |
|
||||||
|
|
||||||
@text "Are 20 "proportional 20 "fonts 20 "a 20 "good 20 "idea? 0a 0a |
|
||||||
"The 20 "jury 20 "is 20 "still 20 "out, 20 "but 20 "one 20 "thing 20 "is 20 "certain: 0a |
|
||||||
"it 20 "is 20 "possible 20 "to 20 "print 20 "with 20 "these 20 "fonts 20 "in 20 "Uxn. 0a 0a 0a 00 |
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,464 +0,0 @@ |
|||||||
( launcher ) |
|
||||||
|
|
||||||
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV } |
|
||||||
%< { LTH } %> { GTH } %= { EQU } %! { NEQ } |
|
||||||
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 } |
|
||||||
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } |
|
||||||
|
|
||||||
%8// { #03 SFT2 } |
|
||||||
%10** { #40 SFT2 } %10// { #04 SFT2 } |
|
||||||
|
|
||||||
%MIN2 { LTH2k JMP SWP2 POP2 } |
|
||||||
%MOD { DIVk MUL SUB } |
|
||||||
%DEC { #01 - } |
|
||||||
%RTN { JMP2r } |
|
||||||
%TOS { #00 SWP } |
|
||||||
%SWP? { #01 JCN SWP } %SWP2? { #01 JCN SWP2 } |
|
||||||
%BRK? { #01 JCN BRK } |
|
||||||
%RTN? { #01 JCN RTN } |
|
||||||
|
|
||||||
%DEBUG { ;print-hex/byte JSR2 #0a .Console/write DEO } |
|
||||||
%DEBUG2 { ;print-hex/short JSR2 #0a .Console/write DEO } |
|
||||||
|
|
||||||
%SEL-ENTRY { ;dir/entries #00 .browser/sel LDZ DUP2 ADD2 ADD2 } |
|
||||||
|
|
||||||
( devices ) |
|
||||||
|
|
||||||
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
|
||||||
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 |
|
||||||
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
||||||
|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
||||||
|80 @Controller &vector $2 &button $1 &key $1 |
|
||||||
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &wheel $1 |
|
||||||
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |
|
||||||
|b0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 |
|
||||||
|
|
||||||
( variables ) |
|
||||||
|
|
||||||
|0000 |
|
||||||
|
|
||||||
@pointer |
|
||||||
&x $2 &y $2 |
|
||||||
@browser |
|
||||||
&x $2 &y $2 |
|
||||||
&sel $1 &last $1 |
|
||||||
|
|
||||||
( init ) |
|
||||||
|
|
||||||
|0100 ( -> ) |
|
||||||
|
|
||||||
( theme ) |
|
||||||
#f077 .System/r DEO2 |
|
||||||
#f00c .System/g DEO2 |
|
||||||
#f02a .System/b DEO2 |
|
||||||
|
|
||||||
( vectors ) |
|
||||||
;on-frame .Screen/vector DEO2 |
|
||||||
;on-button .Controller/vector DEO2 |
|
||||||
;on-mouse .Mouse/vector DEO2 |
|
||||||
|
|
||||||
( setup synth ) |
|
||||||
#0102 .Audio0/adsr DEO2 |
|
||||||
;sin-pcm .Audio0/addr DEO2 |
|
||||||
#0100 .Audio0/length DEO2 |
|
||||||
#dd .Audio0/volume DEO ( TODO: turn ON ) |
|
||||||
|
|
||||||
( determine max visible file length ) |
|
||||||
.Screen/width DEI2 8// #00ff MIN2 NIP |
|
||||||
;draw-browser/clear-length STA |
|
||||||
|
|
||||||
( place ) |
|
||||||
#0088 .browser/x STZ2 |
|
||||||
#0010 .browser/y STZ2 |
|
||||||
|
|
||||||
( draw mascot ) |
|
||||||
#0010 #0010 #0060 #0060 ;mascot-icn #01 ;draw-icn JSR2 |
|
||||||
|
|
||||||
;read-dir JSR2 |
|
||||||
|
|
||||||
( theme support ) |
|
||||||
;load-theme JSR2 |
|
||||||
|
|
||||||
( force selection ) |
|
||||||
#ff .browser/last STZ |
|
||||||
#00 ;select-file JSR2 |
|
||||||
|
|
||||||
BRK |
|
||||||
|
|
||||||
@on-frame ( -> ) |
|
||||||
|
|
||||||
( unused ) |
|
||||||
|
|
||||||
BRK |
|
||||||
|
|
||||||
@on-mouse ( -> ) |
|
||||||
|
|
||||||
;pointer-icn .Screen/addr DEO2 |
|
||||||
( clear last cursor ) |
|
||||||
.pointer/x LDZ2 .Screen/x DEO2 |
|
||||||
.pointer/y LDZ2 .Screen/y DEO2 |
|
||||||
#40 .Screen/sprite DEO |
|
||||||
|
|
||||||
( draw new cursor ) |
|
||||||
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 |
|
||||||
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 |
|
||||||
#41 .Mouse/state DEI #01 = + .Screen/sprite DEO |
|
||||||
|
|
||||||
( select choice ) |
|
||||||
.Mouse/y DEI2 .browser/y LDZ2 -- |
|
||||||
10// NIP ;select-file JSR2 |
|
||||||
|
|
||||||
.Mouse/state DEI #00 = ,&no-click JCN |
|
||||||
.browser/sel LDZ ;run-file JSR2 |
|
||||||
&no-click |
|
||||||
|
|
||||||
BRK |
|
||||||
|
|
||||||
@on-button ( -> ) |
|
||||||
|
|
||||||
.Controller/button DEI |
|
||||||
DUP #10 ! ,&no-up JCN |
|
||||||
.browser/sel LDZ DEC ;select-file JSR2 |
|
||||||
POP BRK |
|
||||||
&no-up |
|
||||||
DUP #20 ! ,&no-down JCN |
|
||||||
.browser/sel LDZ INC ;select-file JSR2 |
|
||||||
POP BRK |
|
||||||
&no-down |
|
||||||
DUP #01 ! ,&no-a JCN |
|
||||||
.browser/sel LDZ ;run-file JSR2 |
|
||||||
POP BRK |
|
||||||
&no-a |
|
||||||
POP |
|
||||||
.Controller/key DEI |
|
||||||
DUP #0d ! ,&no-enter JCN |
|
||||||
.browser/sel LDZ ;run-file JSR2 |
|
||||||
POP |
|
||||||
&no-enter |
|
||||||
POP |
|
||||||
|
|
||||||
BRK |
|
||||||
|
|
||||||
@read-dir ( -- ) |
|
||||||
|
|
||||||
;dir/path .File/name DEO2 |
|
||||||
#1000 .File/length DEO2 |
|
||||||
;dir/data .File/read DEO2 |
|
||||||
|
|
||||||
( separate into lines ) |
|
||||||
#00 ;dir/data STH2k |
|
||||||
&while |
|
||||||
LDAk #0a ! ,&no-lb JCN |
|
||||||
STAk |
|
||||||
STH2r ;add-entry JSR2 |
|
||||||
INC2 STH2k ,&while JMP |
|
||||||
&no-lb INC2 LDAk ,&while JCN |
|
||||||
POP2r POP2 POP |
|
||||||
RTN |
|
||||||
|
|
||||||
@add-entry ( line* -- ) |
|
||||||
DUP2 ;filter-entry JSR2 ,&ignored JCN |
|
||||||
|
|
||||||
( just add entry to end for now, FIXME sort entries ) |
|
||||||
;dir/entries |
|
||||||
#00 ;dir/lines LDA DUP2 ADD2 |
|
||||||
ADD2 |
|
||||||
STA2 |
|
||||||
;dir/lines LDAk INC ROT ROT STA |
|
||||||
#0000 |
|
||||||
|
|
||||||
&ignored |
|
||||||
POP2 |
|
||||||
RTN |
|
||||||
|
|
||||||
@filter-entry ( line* -- ignore-flag ) |
|
||||||
POP2 #00 |
|
||||||
RTN |
|
||||||
|
|
||||||
@select-file ( id -- ) |
|
||||||
( clamp id to useful values ) |
|
||||||
DUP #fc LTH ,¬-negative JCN |
|
||||||
DUP EOR |
|
||||||
¬-negative |
|
||||||
;dir/lines LDA DEC LTHk SWP? POP |
|
||||||
|
|
||||||
DUP .browser/last LDZ ! ,&has-changed JCN |
|
||||||
POP RTN |
|
||||||
&has-changed |
|
||||||
|
|
||||||
DUP ;scroll-browser JSR2 |
|
||||||
|
|
||||||
.browser/x LDZ2 #0018 -- .browser/y LDZ2 [ .browser/sel LDZ TOS 10** ++ ] |
|
||||||
#0010 #0010 |
|
||||||
;hand-icn #00 ;draw-icn JSR2 |
|
||||||
|
|
||||||
DUP |
|
||||||
.browser/sel STZ |
|
||||||
DUP |
|
||||||
.browser/last STZ |
|
||||||
#30 + .Audio0/pitch DEO |
|
||||||
;draw-browser JSR2 |
|
||||||
|
|
||||||
.browser/x LDZ2 #0018 -- .browser/y LDZ2 [ .browser/sel LDZ TOS 10** ++ ] |
|
||||||
#0010 #0010 |
|
||||||
;hand-icn #02 ;draw-icn JSR2 |
|
||||||
|
|
||||||
#0010 #0010 #0060 #0060 |
|
||||||
;mascot-icn [ .browser/sel LDZ #03 AND TOS #0480 ** ++ ] #01 |
|
||||||
;draw-icn JSR2 |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
( Scroll the browser to accomodate off-screen line items ) |
|
||||||
@scroll-browser ( id -- ) |
|
||||||
( Check whether the selection moved up or down ) |
|
||||||
.browser/last LDZ OVR SWP SUB #80 AND ,&negative JCN |
|
||||||
|
|
||||||
&positive ( The selection moved down ) |
|
||||||
( Calculate the id currently at the bottom of the screen ) |
|
||||||
.Screen/height DEI2 .browser/y LDZ2 #0010 ++ -- 10// NIP |
|
||||||
GTH ,&scroll-up JCN [ RTN ] |
|
||||||
&scroll-up |
|
||||||
.browser/y LDZ2k #0010 -- ROT STZ2 |
|
||||||
RTN |
|
||||||
|
|
||||||
&negative ( The selection moved up ) |
|
||||||
( Calculate the id currently at the top of the screen ) |
|
||||||
( TODO make a macro constant for y initial pos ) |
|
||||||
#0010 .browser/y LDZ2 -- 10// NIP |
|
||||||
|
|
||||||
LTH ,&scroll-down JCN [ RTN ] |
|
||||||
&scroll-down |
|
||||||
.browser/y LDZ2k #0010 ++ ROT STZ2 ( Decrement y by 0x10 ) |
|
||||||
RTN |
|
||||||
|
|
||||||
@run-file ( id -- ) |
|
||||||
|
|
||||||
SEL-ENTRY LDA2 |
|
||||||
#0005 ++ DUP2 ;print-string JSR2 |
|
||||||
#0a .Console/write DEO |
|
||||||
|
|
||||||
DUP2 ;check-rom JSR2 ,&valid JCN |
|
||||||
POP2 RTN |
|
||||||
|
|
||||||
&valid |
|
||||||
;load-rom JSR2 |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
@print-string ( addr* -- ) |
|
||||||
|
|
||||||
&loop |
|
||||||
LDAk .Console/write DEO |
|
||||||
INC2 LDAk ,&loop JCN |
|
||||||
POP2 |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
@redraw ( -- ) |
|
||||||
|
|
||||||
( unused ) |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
@draw-browser ( -- ) |
|
||||||
|
|
||||||
.browser/x LDZ2 .Screen/x DEO2 |
|
||||||
.browser/y LDZ2 .Screen/y DEO2 |
|
||||||
SEL-ENTRY ;dir/entries |
|
||||||
&outer ( selected-entry* this-entry* ) |
|
||||||
.Screen/y DEI2 #0010 LTH2 ,&inc JCN ( Don't draw anything in the first row ) |
|
||||||
EQU2k #0c * #01 + STH |
|
||||||
LDA2k ORAk #00 = ,&end JCN |
|
||||||
,&clear JSR |
|
||||||
STHr ,&draw-one JSR |
|
||||||
.browser/x LDZ2 .Screen/x DEO2 |
|
||||||
&inc .Screen/y DEI2 #0010 ++ .Screen/y DEO2 |
|
||||||
INC2 INC2 ,&outer JMP |
|
||||||
&end |
|
||||||
POP2 POP2 POP2 POPr |
|
||||||
RTN |
|
||||||
|
|
||||||
&draw-one ( line* color -- ) |
|
||||||
STH |
|
||||||
&loop |
|
||||||
( top-addr ) LDAk #20 - TOS #0010 MUL2 ;font ++ .Screen/addr DEO2 |
|
||||||
( top-draw ) STHkr .Screen/sprite DEO |
|
||||||
( bottom-addr ) .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2 |
|
||||||
( next-y ) .Screen/y DEI2 #0008 ++ .Screen/y DEO2 |
|
||||||
( bottom-draw ) STHkr .Screen/sprite DEO |
|
||||||
( prev-y ) .Screen/y DEI2 #0008 -- .Screen/y DEO2 |
|
||||||
( move ) .Screen/x DEI2 #0008 ++ .Screen/x DEO2 |
|
||||||
&skip |
|
||||||
INC2 LDAk ,&loop JCN |
|
||||||
POP2 POPr |
|
||||||
RTN |
|
||||||
|
|
||||||
&clear ( -- ) |
|
||||||
.Screen/x DEI2k ( Stash the current x pos ) |
|
||||||
|
|
||||||
( Clear the screen ) |
|
||||||
( Clear length gets set in init ) |
|
||||||
LIT2 &clear-length 00 00 |
|
||||||
&clear-loop |
|
||||||
#00 .Screen/sprite DEO |
|
||||||
.Screen/y DEI2k #0008 ++ ROT DEO2 |
|
||||||
#00 .Screen/sprite DEO |
|
||||||
.Screen/y DEI2k #0008 -- ROT DEO2 |
|
||||||
.Screen/x DEI2k #0008 ++ ROT DEO2 |
|
||||||
INC NEQk ,&clear-loop JCN |
|
||||||
POP2 |
|
||||||
ROT DEO2 |
|
||||||
RTN |
|
||||||
|
|
||||||
@draw-time ( -- ) |
|
||||||
|
|
||||||
.DateTime/day DEI |
|
||||||
DUP #0f AND ;hex-char JSR2 ;&date-str #0009 ++ STA |
|
||||||
#04 SFT ;hex-char JSR2 ;&date-str #0008 ++ STA |
|
||||||
.DateTime/month DEI |
|
||||||
DUP #0f AND ;hex-char JSR2 ;&date-str #0006 ++ STA |
|
||||||
#04 SFT ;hex-char JSR2 ;&date-str #0005 ++ STA |
|
||||||
.DateTime/year DEI2 |
|
||||||
DUP #0f AND ;hex-char JSR2 ;&date-str #0003 ++ STA |
|
||||||
#04 SFT ;hex-char JSR2 ;&date-str #0002 ++ STA |
|
||||||
DUP #0f AND ;hex-char JSR2 ;&date-str INC2 STA |
|
||||||
#04 SFT ;hex-char JSR2 ;&date-str STA |
|
||||||
|
|
||||||
.DateTime/second DEI |
|
||||||
DUP #0f AND ;hex-char JSR2 ;&time-str #0007 ++ STA |
|
||||||
#04 SFT ;hex-char JSR2 ;&time-str #0006 ++ STA |
|
||||||
.DateTime/minute DEI |
|
||||||
DUP #0f AND ;hex-char JSR2 ;&time-str #0004 ++ STA |
|
||||||
#04 SFT ;hex-char JSR2 ;&time-str #0003 ++ STA |
|
||||||
.DateTime/hour DEI |
|
||||||
DUP #0f AND ;hex-char JSR2 ;&time-str INC2 STA |
|
||||||
#04 SFT ;hex-char JSR2 ;&time-str STA |
|
||||||
|
|
||||||
#0020 #0080 ;&date-str #01 ;draw-label JSR2 |
|
||||||
#0080 #0080 ;&time-str #02 ;draw-label JSR2 |
|
||||||
|
|
||||||
RTN |
|
||||||
&date-str "0000-00-00 $1 |
|
||||||
&time-str "00:00:00 $1 |
|
||||||
|
|
||||||
@hex-char ( hex -- char ) |
|
||||||
|
|
||||||
DUP #09 GTH #04 JCN #30 + RTN #57 + |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
@draw-icn ( x* y* width* height* addr* color -- ) |
|
||||||
|
|
||||||
( load ) STH .Screen/addr DEO2 ,&height STR2 ,&width STR2 ,&y STR2 ,&x STR2 |
|
||||||
,&height LDR2 #0000 |
|
||||||
&ver |
|
||||||
( save ) DUP2 ,&y LDR2 ADD2 .Screen/y DEO2 |
|
||||||
,&width LDR2 #0000 |
|
||||||
&hor |
|
||||||
( save ) DUP2 ,&x LDR2 ADD2 .Screen/x DEO2 |
|
||||||
( draw ) STHkr .Screen/sprite DEO |
|
||||||
( incr ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2 |
|
||||||
#0008 ADD2 GTH2k ,&hor JCN |
|
||||||
POP2 POP2 |
|
||||||
#0008 ADD2 GTH2k ,&ver JCN |
|
||||||
POP2 POP2 |
|
||||||
POPr |
|
||||||
|
|
||||||
RTN |
|
||||||
&x $2 &y $2 &width $2 &height $2 |
|
||||||
|
|
||||||
@draw-label ( x* y* addr* color -- ) |
|
||||||
|
|
||||||
STH STH2 |
|
||||||
.Screen/y DEO2 |
|
||||||
.Screen/x DEO2 |
|
||||||
STH2r |
|
||||||
&loop |
|
||||||
( top-addr ) LDAk #20 - TOS #0010 MUL2 ;font ++ .Screen/addr DEO2 |
|
||||||
( top-draw ) STHkr .Screen/sprite DEO |
|
||||||
( bottom-addr ) .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2 |
|
||||||
( next-y ) .Screen/y DEI2 #0008 ++ .Screen/y DEO2 |
|
||||||
( bottom-draw ) STHkr .Screen/sprite DEO |
|
||||||
( prev-y ) .Screen/y DEI2 #0008 -- .Screen/y DEO2 |
|
||||||
( move ) .Screen/x DEI2 #0008 ++ .Screen/x DEO2 |
|
||||||
INC2 LDAk ,&loop JCN |
|
||||||
POP2 POPr |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
( theme ) |
|
||||||
|
|
||||||
@theme-txt ".theme $1 |
|
||||||
|
|
||||||
@load-theme ( -- ) |
|
||||||
|
|
||||||
;theme-txt .File/name DEO2 |
|
||||||
#0006 .File/length DEO2 |
|
||||||
#fffa .File/read DEO2 |
|
||||||
|
|
||||||
.File/success DEI2 #0006 !! ,&ignore JCN |
|
||||||
#fffa LDA2 .System/r DEO2 |
|
||||||
#fffc LDA2 .System/g DEO2 |
|
||||||
#fffe LDA2 .System/b DEO2 |
|
||||||
&ignore |
|
||||||
;redraw JSR2 |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
( helpers ) |
|
||||||
|
|
||||||
@print-hex ( value* -- ) |
|
||||||
|
|
||||||
&short ( value* -- ) |
|
||||||
SWP ,&echo JSR |
|
||||||
&byte ( value -- ) |
|
||||||
,&echo JSR |
|
||||||
RTN |
|
||||||
|
|
||||||
&echo ( value -- ) |
|
||||||
STHk #04 SFT ,&parse JSR .Console/write DEO |
|
||||||
STHr #0f AND ,&parse JSR .Console/write DEO |
|
||||||
RTN |
|
||||||
&parse ( value -- char ) |
|
||||||
DUP #09 GTH ,&above JCN #30 + RTN &above #09 - #60 + RTN |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
@pointer-icn |
|
||||||
80c0 e0f0 f8e0 1000 |
|
||||||
@hand-icn |
|
||||||
000c 0a0a 1224 4780 |
|
||||||
0000 0000 0000 fc02 |
|
||||||
8180 8080 8040 3f00 |
|
||||||
fc20 c020 c020 c000 |
|
||||||
|
|
||||||
@sin-pcm |
|
||||||
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 |
|
||||||
|
|
||||||
~projects/library/check-rom.tal |
|
||||||
~projects/library/load-rom.tal |
|
||||||
|
|
||||||
~projects/assets/mascot0cx0c.tal |
|
||||||
~projects/assets/msx01x02.tal |
|
||||||
|
|
||||||
@dir |
|
||||||
&path ". $1 |
|
||||||
&lines $1 |
|
||||||
&entries $100 |
|
||||||
&data |
|
||||||
@ -0,0 +1,575 @@ |
|||||||
|
( launcher ) |
||||||
|
|
||||||
|
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV } |
||||||
|
%< { LTH } %> { GTH } %= { EQU } %! { NEQ } |
||||||
|
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 } |
||||||
|
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } |
||||||
|
|
||||||
|
%2* { #10 SFT } %2/ { #01 SFT } %2** { #10 SFT2 } %2// { #01 SFT2 } |
||||||
|
%4* { #20 SFT } %4/ { #02 SFT } %4** { #20 SFT2 } %4// { #02 SFT2 } |
||||||
|
%8* { #30 SFT } %8/ { #03 SFT } %8** { #30 SFT2 } %8// { #03 SFT2 } |
||||||
|
%10* { #40 SFT } %10/ { #04 SFT } %10** { #40 SFT2 } %10// { #04 SFT2 } |
||||||
|
%20* { #50 SFT } %20/ { #05 SFT } %20** { #50 SFT2 } %20// { #05 SFT2 } |
||||||
|
|
||||||
|
%40** { #60 SFT2 } |
||||||
|
|
||||||
|
%RTN { JMP2r } |
||||||
|
%TOS { #00 SWP } |
||||||
|
|
||||||
|
%AUTO-NONE { #00 .Screen/auto DEO } |
||||||
|
%AUTO-XADDR { #05 .Screen/auto DEO } |
||||||
|
%AUTO-YADDR { #06 .Screen/auto DEO } |
||||||
|
|
||||||
|
%HALT { #010f DEO } |
||||||
|
%EMIT { #18 DEO } |
||||||
|
%PRINT { ;print-str JSR2 #0a EMIT } |
||||||
|
%DEBUG { ;print-hex/byte JSR2 #0a EMIT } |
||||||
|
%DEBUG2 { ;print-hex JSR2 #0a EMIT } |
||||||
|
|
||||||
|
%LINES-COUNT { .browser/y2 LDZ2 .browser/y LDZ2 -- 10// NIP } |
||||||
|
|
||||||
|
( devices ) |
||||||
|
|
||||||
|
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
||||||
|
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 |
||||||
|
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
||||||
|
|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
||||||
|
|80 @Controller &vector $2 &button $1 &key $1 |
||||||
|
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2 |
||||||
|
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |
||||||
|
|b0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 |
||||||
|
|
||||||
|
( variables ) |
||||||
|
|
||||||
|
|0000 |
||||||
|
|
||||||
|
@pointer |
||||||
|
&x $2 &y $2 |
||||||
|
@browser |
||||||
|
&x $2 &y $2 &x2 $2 &y2 $2 |
||||||
|
&sel $1 &last $1 &scroll $1 |
||||||
|
|
||||||
|
( init ) |
||||||
|
|
||||||
|
|0100 ( -> ) |
||||||
|
|
||||||
|
( theme ) |
||||||
|
#f079 .System/r DEO2 |
||||||
|
#f0c2 .System/g DEO2 |
||||||
|
#f0a4 .System/b DEO2 |
||||||
|
|
||||||
|
( vectors ) |
||||||
|
;on-frame .Screen/vector DEO2 |
||||||
|
;on-button .Controller/vector DEO2 |
||||||
|
;on-mouse .Mouse/vector DEO2 |
||||||
|
|
||||||
|
( asma debugger ) |
||||||
|
#0d ;asma/log-level STA |
||||||
|
|
||||||
|
;asma-heap ;heap STA2 |
||||||
|
|
||||||
|
( setup synth ) |
||||||
|
#0102 .Audio0/adsr DEO2 |
||||||
|
;sin-pcm .Audio0/addr DEO2 |
||||||
|
#0100 .Audio0/length DEO2 |
||||||
|
#dd .Audio0/volume DEO ( TODO: turn ON ) |
||||||
|
|
||||||
|
( place ) |
||||||
|
#0088 .browser/x STZ2 |
||||||
|
#0010 .browser/y STZ2 |
||||||
|
.Screen/height DEI2 #33 SFT2 #0011 -- .browser/y2 STZ2 |
||||||
|
|
||||||
|
( draw mascot ) |
||||||
|
#0010 #0010 #0060 #0060 ;mascot-icn #01 ;draw-icn JSR2 |
||||||
|
|
||||||
|
;load-dir JSR2 |
||||||
|
|
||||||
|
( theme support ) |
||||||
|
;load-theme JSR2 |
||||||
|
|
||||||
|
( force selection ) |
||||||
|
#ff .browser/last STZ |
||||||
|
#00 ;select-file JSR2 |
||||||
|
|
||||||
|
BRK |
||||||
|
|
||||||
|
@on-frame ( -> ) |
||||||
|
|
||||||
|
( unused ) |
||||||
|
|
||||||
|
BRK |
||||||
|
|
||||||
|
@on-mouse ( -> ) |
||||||
|
|
||||||
|
;pointer-icn .Screen/addr DEO2 |
||||||
|
( clear last cursor ) |
||||||
|
.pointer/x LDZ2 .Screen/x DEO2 |
||||||
|
.pointer/y LDZ2 .Screen/y DEO2 |
||||||
|
#40 .Screen/sprite DEO |
||||||
|
|
||||||
|
( draw new cursor ) |
||||||
|
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 |
||||||
|
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 |
||||||
|
#41 .Mouse/state DEI #01 = + .Screen/sprite DEO |
||||||
|
|
||||||
|
( wheel ) |
||||||
|
.Mouse/scrolly INC DEI |
||||||
|
DUP #ff ! ,&no-up JCN |
||||||
|
.browser/scroll LDZ #00 = ,&no-up JCN |
||||||
|
DUP .browser/scroll LDZ + ;scroll-to JSR2 |
||||||
|
&no-up |
||||||
|
DUP #01 ! ,&no-down JCN |
||||||
|
.browser/scroll LDZ ;dir/lines LDA = ,&no-down JCN |
||||||
|
DUP .browser/scroll LDZ + ;scroll-to JSR2 |
||||||
|
&no-down |
||||||
|
POP |
||||||
|
|
||||||
|
( within browser ) |
||||||
|
.Mouse/y DEI2 .browser/y LDZ2 << ,&outside JCN |
||||||
|
.Mouse/y DEI2 .browser/y2 LDZ2 #0010 -- >> ,&outside JCN |
||||||
|
( select choice ) |
||||||
|
.Mouse/y DEI2 .browser/y LDZ2 -- |
||||||
|
10// NIP .browser/scroll LDZ + ;select-file JSR2 |
||||||
|
( run choice ) |
||||||
|
.Mouse/state DEI #00 = ,&no-click JCN |
||||||
|
.browser/sel LDZ ;run-file JSR2 |
||||||
|
&no-click |
||||||
|
&outside |
||||||
|
|
||||||
|
BRK |
||||||
|
|
||||||
|
@on-button ( -> ) |
||||||
|
|
||||||
|
( controller ) |
||||||
|
.Controller/button DEI |
||||||
|
DUP #10 ! ,&no-up JCN |
||||||
|
.browser/sel LDZ #00 = ,&no-up JCN |
||||||
|
.browser/sel LDZ #01 - ;select-file JSR2 |
||||||
|
;follow-selection JSR2 |
||||||
|
POP BRK |
||||||
|
&no-up |
||||||
|
DUP #20 ! ,&no-down JCN |
||||||
|
.browser/sel LDZ INC ;dir/lines LDA = ,&no-down JCN |
||||||
|
.browser/sel LDZ INC ;select-file JSR2 |
||||||
|
;follow-selection JSR2 |
||||||
|
POP BRK |
||||||
|
&no-down |
||||||
|
DUP #01 ! ,&no-a JCN |
||||||
|
.browser/sel LDZ ;run-file JSR2 |
||||||
|
POP BRK |
||||||
|
&no-a |
||||||
|
POP |
||||||
|
( keyboard ) |
||||||
|
.Controller/key DEI |
||||||
|
DUP #0d ! ,&no-enter JCN |
||||||
|
.browser/sel LDZ ;run-file JSR2 |
||||||
|
POP BRK |
||||||
|
&no-enter |
||||||
|
POP |
||||||
|
|
||||||
|
BRK |
||||||
|
|
||||||
|
@load-dir ( -- ) |
||||||
|
|
||||||
|
;dir/path .File/name DEO2 |
||||||
|
#1000 .File/length DEO2 |
||||||
|
;dir/data .File/read DEO2 |
||||||
|
.File/success DEI2 ;dir/length STA2 |
||||||
|
|
||||||
|
( split with null-char ) |
||||||
|
;dir/data |
||||||
|
&while |
||||||
|
LDAk #1f > ,&no-lb JCN |
||||||
|
( split ) STH2k #00 STH2r STA |
||||||
|
( count lines ) ;dir/lines LDA INC ;dir/lines STA |
||||||
|
&no-lb |
||||||
|
INC2 LDAk ,&while JCN |
||||||
|
POP2 |
||||||
|
|
||||||
|
RTN |
||||||
|
|
||||||
|
@select-file ( id -- ) |
||||||
|
|
||||||
|
( has changed ) |
||||||
|
DUP .browser/last LDZ ! ,&has-changed JCN |
||||||
|
POP RTN |
||||||
|
&has-changed |
||||||
|
( beyond ) |
||||||
|
DUP ;dir/lines LDA < ,&valid JCN |
||||||
|
POP RTN |
||||||
|
&valid |
||||||
|
|
||||||
|
#00 ;draw-browser JSR2 |
||||||
|
DUP .browser/sel STZ |
||||||
|
DUP .browser/last STZ |
||||||
|
#30 + .Audio0/pitch DEO |
||||||
|
#01 ;draw-browser JSR2 |
||||||
|
|
||||||
|
( draw mascot ) |
||||||
|
#0010 #0010 #0060 #0060 |
||||||
|
;mascot-icn [ .browser/sel LDZ #03 AND TOS #0480 ** ++ ] #01 |
||||||
|
;draw-icn JSR2 |
||||||
|
|
||||||
|
( draw position ) |
||||||
|
AUTO-YADDR |
||||||
|
#0010 .Screen/x DEO2 |
||||||
|
#0080 .Screen/y DEO2 |
||||||
|
.browser/sel LDZ #02 ;draw-byte JSR2 |
||||||
|
LIT '/ #02 ;draw-char JSR2 |
||||||
|
;dir/lines LDA #01 - #02 ;draw-byte JSR2 |
||||||
|
AUTO-NONE |
||||||
|
|
||||||
|
RTN |
||||||
|
|
||||||
|
@follow-selection ( -- ) |
||||||
|
|
||||||
|
LINES-COUNT .browser/sel LDZ .browser/scroll LDZ - |
||||||
|
DUP2 > ,&no-down JCN |
||||||
|
.browser/scroll LDZ INC ,scroll-to JSR |
||||||
|
&no-down |
||||||
|
DUP2 SWP < ,&no-up JCN |
||||||
|
.browser/sel LDZ ,scroll-to JSR |
||||||
|
&no-up |
||||||
|
POP2 |
||||||
|
|
||||||
|
RTN |
||||||
|
|
||||||
|
@scroll-to ( line -- ) |
||||||
|
|
||||||
|
STH |
||||||
|
( more lines than visible ) |
||||||
|
;dir/lines LDA LINES-COUNT |
||||||
|
DUP2 > ,&can-scroll JCN |
||||||
|
POPr POP2 RTN |
||||||
|
&can-scroll |
||||||
|
( less than max scroll ) |
||||||
|
- INC STHkr > ,&valid-scroll JCN |
||||||
|
POPr RTN |
||||||
|
&valid-scroll |
||||||
|
#00 ;draw-browser JSR2 |
||||||
|
STHr .browser/scroll STZ |
||||||
|
#01 ;draw-browser JSR2 |
||||||
|
|
||||||
|
RTN |
||||||
|
|
||||||
|
@run-file ( id -- ) |
||||||
|
|
||||||
|
;get-entry JSR2 #0005 ++ |
||||||
|
|
||||||
|
DUP2 ;check-rom JSR2 ,&valid JCN |
||||||
|
|
||||||
|
( check if tal file ) |
||||||
|
|
||||||
|
DUP2 ;scap JSR2 #0004 -- ;&tal-ext ;scmp JSR2 #01 ! ,&no-tal JCN |
||||||
|
DUP2 ;&output-path ;scpy JSR2 |
||||||
|
;&rom-ext ;&output-path ;scat JSR2 |
||||||
|
;&output-path ;asma-assemble-file JSR2 |
||||||
|
;load-dir JSR2 |
||||||
|
;redraw JSR2 |
||||||
|
RTN |
||||||
|
&no-tal |
||||||
|
|
||||||
|
POP2 RTN |
||||||
|
&valid |
||||||
|
|
||||||
|
;load-rom JSR2 |
||||||
|
|
||||||
|
RTN |
||||||
|
&tal-ext ".tal $1 |
||||||
|
&rom-ext ".rom $1 |
||||||
|
&output-path $20 |
||||||
|
|
||||||
|
@redraw ( -- ) |
||||||
|
|
||||||
|
( force selection ) |
||||||
|
#ff .browser/last STZ |
||||||
|
#00 ;select-file JSR2 |
||||||
|
|
||||||
|
RTN |
||||||
|
|
||||||
|
@draw-browser ( mask -- ) |
||||||
|
|
||||||
|
( when empty ) |
||||||
|
;dir/lines LDA #01 = ;draw-browser-empty JCN2 |
||||||
|
|
||||||
|
STH |
||||||
|
|
||||||
|
( draw hand ) |
||||||
|
.browser/x LDZ2 #0018 -- .browser/y LDZ2 |
||||||
|
.browser/sel LDZ .browser/scroll LDZ - TOS 10** ++ |
||||||
|
#0010 #0010 |
||||||
|
;hand-icn STHkr #02 * ;draw-icn JSR2 |
||||||
|
( draw files ) |
||||||
|
LINES-COUNT #00 |
||||||
|
&loop |
||||||
|
( reached end ) |
||||||
|
DUP INC ;dir/lines LDA > ,&end JCN |
||||||
|
( has file ) |
||||||
|
.browser/x LDZ2 .Screen/x DEO2 |
||||||
|
DUP TOS 10** .browser/y LDZ2 ++ .Screen/y DEO2 |
||||||
|
DUP .browser/scroll LDZ + ;get-entry JSR2 |
||||||
|
DUP2 ;get-type JSR2 ;draw-type JSR2 |
||||||
|
#01 STHkr * ;draw-str JSR2 |
||||||
|
INC GTHk ,&loop JCN |
||||||
|
&end |
||||||
|
POP2 |
||||||
|
|
||||||
|
POPr |
||||||
|
|
||||||
|
RTN |
||||||
|
|
||||||
|
@draw-browser-empty ( mask -- ) |
||||||
|
|
||||||
|
POP |
||||||
|
.browser/x LDZ2 .Screen/x DEO2 |
||||||
|
.browser/y LDZ2 .Screen/y DEO2 |
||||||
|
;&empty-txt #01 ;draw-str JSR2 |
||||||
|
|
||||||
|
RTN |
||||||
|
&empty-txt "Empty 20 "Folder $1 |
||||||
|
|
||||||
|
@get-type ( line* -- type ) |
||||||
|
|
||||||
|
;scap JSR2 #0004 -- ;&rom-ext ;scmp JSR2 |
||||||
|
|
||||||
|
RTN |
||||||
|
&rom-ext ".rom $1 |
||||||
|
|
||||||
|
@get-entry ( id -- addr* ) |
||||||
|
|
||||||
|
( limit ) STH |
||||||
|
( counter ) LITr 00 |
||||||
|
;dir/length LDA2 #0000 |
||||||
|
&loop |
||||||
|
EQUkr STHr #00 = ,&no-reached JCN |
||||||
|
POP2r NIP2 ;dir/data ++ RTN |
||||||
|
&no-reached |
||||||
|
DUP2 ;dir/data ++ LDA #00 ! ,&no-lb JCN |
||||||
|
INCr |
||||||
|
&no-lb |
||||||
|
INC2 GTH2k ,&loop JCN |
||||||
|
POP2 POP2 |
||||||
|
POP2r |
||||||
|
;dir/data |
||||||
|
|
||||||
|
RTN |
||||||
|
|
||||||
|
@draw-type ( type -- ) |
||||||
|
|
||||||
|
STHk TOS 20** ;file-icns ++ .Screen/addr DEO2 |
||||||
|
AUTO-XADDR |
||||||
|
#02 STHkr - .Screen/sprite DEOk DEO |
||||||
|
|
||||||
|
.Screen/x DEI2k #0010 -- ROT DEO2 |
||||||
|
.Screen/y DEI2k #0008 ++ ROT DEO2 |
||||||
|
|
||||||
|
#02 STHr - .Screen/sprite DEOk DEO |
||||||
|
|
||||||
|
.Screen/x DEI2k #0008 ++ ROT DEO2 |
||||||
|
.Screen/y DEI2k #0008 -- ROT DEO2 |
||||||
|
AUTO-NONE |
||||||
|
|
||||||
|
RTN |
||||||
|
|
||||||
|
@draw-icn ( x* y* width* height* addr* color -- ) |
||||||
|
|
||||||
|
AUTO-XADDR |
||||||
|
( load ) STH .Screen/addr DEO2 ,&height STR2 ,&width STR2 ,&y STR2 ,&x STR2 |
||||||
|
,&height LDR2 #0000 |
||||||
|
&ver |
||||||
|
( save ) DUP2 ,&y LDR2 ADD2 .Screen/y DEO2 |
||||||
|
,&x LDR2 .Screen/x DEO2 |
||||||
|
,&width LDR2 #0000 |
||||||
|
&hor |
||||||
|
( draw ) STHkr .Screen/sprite DEO |
||||||
|
#0008 ADD2 GTH2k ,&hor JCN |
||||||
|
POP2 POP2 |
||||||
|
#0008 ADD2 GTH2k ,&ver JCN |
||||||
|
POP2 POP2 |
||||||
|
POPr |
||||||
|
AUTO-NONE |
||||||
|
|
||||||
|
RTN |
||||||
|
&x $2 &y $2 &width $2 &height $2 |
||||||
|
|
||||||
|
@draw-str ( text* color -- ) |
||||||
|
|
||||||
|
AUTO-YADDR |
||||||
|
STH |
||||||
|
&while |
||||||
|
LDAk STHkr ,draw-char JSR |
||||||
|
INC2 LDAk ,&while JCN |
||||||
|
POP2 |
||||||
|
POPr |
||||||
|
|
||||||
|
RTN |
||||||
|
|
||||||
|
@draw-short ( short* color -- ) |
||||||
|
|
||||||
|
STH SWP STHkr ,draw-byte JSR |
||||||
|
STHr ,draw-byte JSR |
||||||
|
|
||||||
|
RTN |
||||||
|
|
||||||
|
@draw-byte ( byte color -- ) |
||||||
|
|
||||||
|
STH |
||||||
|
DUP #04 SFT ,&parse JSR STHkr ,draw-char JSR |
||||||
|
#0f AND ,&parse JSR STHr ,draw-char JSR |
||||||
|
|
||||||
|
RTN |
||||||
|
&parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r |
||||||
|
&above #57 ADD JMP2r |
||||||
|
|
||||||
|
@draw-char ( char color -- ) |
||||||
|
|
||||||
|
SWP |
||||||
|
[ #20 - #00 SWP #40 SFT2 ;font ++ ] .Screen/addr DEO2 |
||||||
|
.Screen/sprite DEOk DEO |
||||||
|
.Screen/x DEI2k #0008 ++ ROT DEO2 |
||||||
|
.Screen/y DEI2k #0010 -- ROT DEO2 |
||||||
|
|
||||||
|
JMP2r |
||||||
|
|
||||||
|
( theme ) |
||||||
|
|
||||||
|
@theme-txt ".theme $1 |
||||||
|
|
||||||
|
@load-theme ( -- ) |
||||||
|
|
||||||
|
;theme-txt .File/name DEO2 |
||||||
|
#0006 .File/length DEO2 |
||||||
|
#fffa .File/read DEO2 |
||||||
|
|
||||||
|
.File/success DEI2 #0006 !! ,&ignore JCN |
||||||
|
#fffa LDA2 .System/r DEO2 |
||||||
|
#fffc LDA2 .System/g DEO2 |
||||||
|
#fffe LDA2 .System/b DEO2 |
||||||
|
&ignore |
||||||
|
;redraw JSR2 |
||||||
|
|
||||||
|
RTN |
||||||
|
|
||||||
|
( helpers ) |
||||||
|
|
||||||
|
@print-str ( string* -- ) |
||||||
|
|
||||||
|
#0001 SUB2 |
||||||
|
&while |
||||||
|
INC2 LDAk DUP #18 DEO ,&while JCN |
||||||
|
POP2 |
||||||
|
|
||||||
|
JMP2r |
||||||
|
|
||||||
|
@print-hex ( value* -- ) |
||||||
|
|
||||||
|
SWP ,&byte JSR |
||||||
|
&byte ( byte -- ) |
||||||
|
STHk #04 SFT ,&parse JSR #18 DEO |
||||||
|
STHr #0f AND ,&parse JSR #18 DEO |
||||||
|
JMP2r |
||||||
|
&parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r |
||||||
|
&above #57 ADD JMP2r |
||||||
|
|
||||||
|
JMP2r |
||||||
|
|
||||||
|
@scat ( src* dst* -- ) |
||||||
|
|
||||||
|
DUP2 ,slen JSR ++ ,scpy JSR |
||||||
|
|
||||||
|
JMP2r |
||||||
|
|
||||||
|
@scmp ( a* b* -- flag ) |
||||||
|
|
||||||
|
STH2 |
||||||
|
&loop |
||||||
|
LDAk LDAkr STHr = ,¬-diff JCN |
||||||
|
POP2 POP2r #00 RTN |
||||||
|
¬-diff |
||||||
|
LDAk LDAkr STHr #0000 !! ,¬-end JCN |
||||||
|
POP2 POP2r #01 RTN |
||||||
|
¬-end |
||||||
|
INC2 INC2r |
||||||
|
,&loop JMP |
||||||
|
POP2 POP2r #00 |
||||||
|
|
||||||
|
RTN |
||||||
|
|
||||||
|
@scpy ( src* dst* -- ) |
||||||
|
|
||||||
|
STH2 |
||||||
|
&while |
||||||
|
LDAk STH2kr STA INC2r |
||||||
|
INC2 LDAk ,&while JCN |
||||||
|
POP2 |
||||||
|
#00 STH2r STA |
||||||
|
|
||||||
|
JMP2r |
||||||
|
|
||||||
|
@scap ( str* -- str-end* ) |
||||||
|
|
||||||
|
( clamp ) LDAk #00 ! JMP RTN |
||||||
|
&while INC2 LDAk ,&while JCN |
||||||
|
|
||||||
|
RTN |
||||||
|
|
||||||
|
@slen ( str* -- len* ) |
||||||
|
|
||||||
|
DUP2 ,scap JSR SWP2 -- |
||||||
|
|
||||||
|
JMP2r |
||||||
|
|
||||||
|
@pointer-icn |
||||||
|
80c0 e0f0 f8e0 1000 |
||||||
|
@hand-icn |
||||||
|
000c 0a0a 1224 4780 |
||||||
|
0000 0000 0000 fc02 |
||||||
|
8180 8080 8040 3f00 |
||||||
|
fc20 c020 c020 c000 |
||||||
|
@file-icns |
||||||
|
003f 3f30 3f30 3f30 |
||||||
|
00fc fc0c fc0c fc0c |
||||||
|
3f33 3f3f 3f3f 3f00 |
||||||
|
fcfc fcc4 c8d0 e000 |
||||||
|
003f 3f30 3132 3231 |
||||||
|
00fc fc0c 8c4c 4c8c |
||||||
|
303f 3f3f 3f3f 3f00 |
||||||
|
0cfc fcc4 c8d0 e000 |
||||||
|
@sin-pcm |
||||||
|
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 |
||||||
|
|
||||||
|
~projects/library/check-rom.tal |
||||||
|
~projects/library/load-rom.tal |
||||||
|
|
||||||
|
~projects/assets/mascot0cx0c.tal |
||||||
|
~projects/assets/msx01x02.tal |
||||||
|
|
||||||
|
@dir |
||||||
|
&path ". $1 |
||||||
|
&lines $1 |
||||||
|
&length $2 |
||||||
|
&data $1000 |
||||||
|
|
||||||
|
( assembler memory ) |
||||||
|
|
||||||
|
~projects/library/asma.tal |
||||||
|
|
||||||
|
@asma-heap |
||||||
|
|e000 &end @asma-read-buffer |
||||||
|
|f800 &end @asma-write-buffer |
||||||
|
|ffff &end |
||||||
@ -1,270 +0,0 @@ |
|||||||
( launcher ) |
|
||||||
|
|
||||||
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV } |
|
||||||
%< { LTH } %> { GTH } %= { EQU } %! { NEQ } |
|
||||||
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 } |
|
||||||
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } |
|
||||||
|
|
||||||
%AUTO-X { #01 .Screen/auto DEO } |
|
||||||
%AUTO-Y { #02 .Screen/auto DEO } |
|
||||||
%AUTO-YADDR { #06 .Screen/auto DEO } |
|
||||||
|
|
||||||
%HALT { #010f DEO } |
|
||||||
%EMIT { #18 DEO } |
|
||||||
%PRINT { ;print-str JSR2 #0a EMIT } |
|
||||||
%DEBUG { ;print-hex/byte JSR2 #0a EMIT } |
|
||||||
%DEBUG2 { ;print-hex JSR2 #0a EMIT } |
|
||||||
|
|
||||||
%MODALW { #0024 } |
|
||||||
%MODALH { #0009 } |
|
||||||
|
|
||||||
%RTN { JMP2r } |
|
||||||
%2// { #01 SFT2 } |
|
||||||
%8** { #30 SFT2 } |
|
||||||
|
|
||||||
%EADDR { #fd04 } |
|
||||||
%ECODE { #fd06 } |
|
||||||
|
|
||||||
( devices ) |
|
||||||
|
|
||||||
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
|
||||||
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
||||||
|80 @Controller &vector $2 &button $1 &key $1 &func $1 |
|
||||||
|
|
||||||
( variables ) |
|
||||||
|
|
||||||
|0000 |
|
||||||
|
|
||||||
@center |
|
||||||
&x $2 &y $2 |
|
||||||
@modal |
|
||||||
&x $2 &y $2 |
|
||||||
|
|
||||||
( init ) |
|
||||||
|
|
||||||
|0100 ( -> ) |
|
||||||
|
|
||||||
.Screen/width DEI2 2// |
|
||||||
DUP2 .center/x STZ2 |
|
||||||
MODALW #31 SFT2 -- .modal/x STZ2 |
|
||||||
.Screen/height DEI2 2// |
|
||||||
DUP2 .center/y STZ2 |
|
||||||
MODALH #31 SFT2 -- .modal/y STZ2 |
|
||||||
|
|
||||||
( vectors ) |
|
||||||
;on-error .System/vector DEO2 |
|
||||||
;on-frame .Screen/vector DEO2 |
|
||||||
;on-button .Controller/vector DEO2 |
|
||||||
|
|
||||||
BRK |
|
||||||
|
|
||||||
@on-frame ( -> ) |
|
||||||
|
|
||||||
;draw-cross JSR2 |
|
||||||
;draw-stacks JSR2 |
|
||||||
|
|
||||||
BRK |
|
||||||
|
|
||||||
@on-button ( -> ) |
|
||||||
|
|
||||||
.Controller/func DEI |
|
||||||
DUP #02 ! ,&no-f2 JCN |
|
||||||
;toggle-debugger JSR2 |
|
||||||
&no-f2 |
|
||||||
DUP #08 ! ,&no-f4 JCN |
|
||||||
;reboot JSR2 |
|
||||||
&no-f4 |
|
||||||
POP |
|
||||||
|
|
||||||
BRK |
|
||||||
|
|
||||||
@on-error ( -> ) |
|
||||||
|
|
||||||
( background ) |
|
||||||
#00 .Screen/auto DEO |
|
||||||
;bg-icn .Screen/addr DEO2 |
|
||||||
MODALH #0000 |
|
||||||
&ver |
|
||||||
DUP2 8** .modal/y LDZ2 ++ .Screen/y DEO2 |
|
||||||
MODALW #0000 |
|
||||||
&hor |
|
||||||
DUP2 8** .modal/x LDZ2 ++ .Screen/x DEO2 |
|
||||||
#42 .Screen/sprite DEO |
|
||||||
INC2 GTH2k ,&hor JCN |
|
||||||
POP2 POP2 |
|
||||||
INC2 GTH2k ,&ver JCN |
|
||||||
POP2 POP2 |
|
||||||
|
|
||||||
( corners ) |
|
||||||
;corner-icn .Screen/addr DEO2 |
|
||||||
.modal/x LDZ2 .Screen/x DEO2 |
|
||||||
.modal/y LDZ2 .Screen/y DEO2 |
|
||||||
#42 .Screen/sprite DEO |
|
||||||
.modal/x LDZ2 MODALW #0001 -- 8** ++ .Screen/x DEO2 |
|
||||||
#52 .Screen/sprite DEO |
|
||||||
|
|
||||||
.modal/y LDZ2 MODALH #0001 -- 8** ++ .Screen/y DEO2 |
|
||||||
#72 .Screen/sprite DEO |
|
||||||
|
|
||||||
.modal/x LDZ2 .Screen/x DEO2 |
|
||||||
#62 .Screen/sprite DEO |
|
||||||
|
|
||||||
( text ) |
|
||||||
.modal/x LDZ2 #0010 ++ .Screen/x DEO2 |
|
||||||
.modal/y LDZ2 #0010 ++ .Screen/y DEO2 |
|
||||||
;error-txts/0 #4f ;draw-str JSR2 |
|
||||||
|
|
||||||
;at-txt #4f ;draw-str JSR2 |
|
||||||
|
|
||||||
EADDR LDA2 #47 ;draw-short JSR2 |
|
||||||
|
|
||||||
#0000 EADDR STA2 |
|
||||||
|
|
||||||
BRK |
|
||||||
|
|
||||||
@toggle-debugger ( -- ) |
|
||||||
|
|
||||||
( toggle debug ) #fd0e STH2k LDA #00 = STH2r STA |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
@reboot ( -- ) |
|
||||||
|
|
||||||
( clear devices/stacks ) |
|
||||||
#fd00 #0300 ;mclr JSR2 |
|
||||||
|
|
||||||
RTN |
|
||||||
&boot-path "boot.rom $1 |
|
||||||
|
|
||||||
@draw-stacks ( -- ) |
|
||||||
|
|
||||||
AUTO-YADDR |
|
||||||
#0010 #0000 |
|
||||||
&wst |
|
||||||
( working stack ) |
|
||||||
#0010 .Screen/y DEO2 |
|
||||||
DUP2 #0018 ** #0010 ++ .Screen/x DEO2 |
|
||||||
DUP #fe00 LDA ( ptr ) EQU #41 + STH |
|
||||||
DUP2 #fe01 ++ LDA STHr ;draw-byte JSR2 |
|
||||||
( return stack ) |
|
||||||
#0028 .Screen/y DEO2 |
|
||||||
DUP2 #0018 ** #0010 ++ .Screen/x DEO2 |
|
||||||
DUP #ff00 LDA ( ptr ) EQU #41 + STH |
|
||||||
DUP2 #ff01 ++ LDA STHr ;draw-byte JSR2 |
|
||||||
INC2 GTH2k ,&wst JCN |
|
||||||
POP2 POP2 |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
@draw-cross ( -- ) |
|
||||||
|
|
||||||
( ver ) |
|
||||||
AUTO-Y |
|
||||||
#0000 .Screen/y DEO2 |
|
||||||
.center/x LDZ2 .Screen/x DEO2 |
|
||||||
.Screen/height DEI2 #0000 |
|
||||||
&ver |
|
||||||
#43 .Screen/pixel DEO |
|
||||||
.Screen/y DEI2k INC2 ROT DEO2 |
|
||||||
INC2 GTH2k ,&ver JCN |
|
||||||
POP2 POP2 |
|
||||||
|
|
||||||
( hor ) |
|
||||||
AUTO-X |
|
||||||
#0000 .Screen/x DEO2 |
|
||||||
.center/y LDZ2 .Screen/y DEO2 |
|
||||||
.Screen/width DEI2 #0000 |
|
||||||
&hor |
|
||||||
#43 .Screen/pixel DEO |
|
||||||
.Screen/x DEI2k INC2 ROT DEO2 |
|
||||||
INC2 GTH2k ,&hor JCN |
|
||||||
POP2 POP2 |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
@draw-str ( text* color -- ) |
|
||||||
|
|
||||||
AUTO-YADDR |
|
||||||
STH |
|
||||||
&while |
|
||||||
LDAk STHkr ,draw-char JSR |
|
||||||
INC2 LDAk ,&while JCN |
|
||||||
POP2 |
|
||||||
POPr |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
@draw-short ( short* color -- ) |
|
||||||
|
|
||||||
STH SWP STHkr ,draw-byte JSR |
|
||||||
STHr ,draw-byte JSR |
|
||||||
|
|
||||||
RTN |
|
||||||
|
|
||||||
@draw-byte ( byte color -- ) |
|
||||||
|
|
||||||
STH |
|
||||||
DUP #04 SFT ,&parse JSR STHkr ,draw-char JSR |
|
||||||
#0f AND ,&parse JSR STHr ,draw-char JSR |
|
||||||
|
|
||||||
RTN |
|
||||||
&parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r |
|
||||||
&above #57 ADD JMP2r |
|
||||||
|
|
||||||
@draw-char ( char color -- ) |
|
||||||
|
|
||||||
SWP |
|
||||||
[ #20 - #00 SWP #40 SFT2 ;font ++ ] .Screen/addr DEO2 |
|
||||||
.Screen/sprite DEOk DEO |
|
||||||
.Screen/x DEI2k #0008 ++ ROT DEO2 |
|
||||||
.Screen/y DEI2k #0010 -- ROT DEO2 |
|
||||||
|
|
||||||
JMP2r |
|
||||||
|
|
||||||
@mclr ( addr* len* -- ) |
|
||||||
|
|
||||||
OVR2 ++ SWP2 |
|
||||||
&loop |
|
||||||
STH2k #00 STH2r STA |
|
||||||
INC2 GTH2k ,&loop JCN |
|
||||||
POP2 POP2 |
|
||||||
|
|
||||||
JMP2r |
|
||||||
|
|
||||||
@print-hex ( value* -- ) |
|
||||||
|
|
||||||
SWP ,&byte JSR |
|
||||||
&byte ( byte -- ) |
|
||||||
STHk #04 SFT ,&parse JSR #18 DEO |
|
||||||
STHr #0f AND ,&parse JSR #18 DEO |
|
||||||
JMP2r |
|
||||||
&parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r |
|
||||||
&above #57 ADD JMP2r |
|
||||||
|
|
||||||
JMP2r |
|
||||||
|
|
||||||
@print-str ( string* -- ) |
|
||||||
|
|
||||||
#0001 SUB2 |
|
||||||
&while |
|
||||||
INC2 LDAk DUP #18 DEO ,&while JCN |
|
||||||
POP2 |
|
||||||
|
|
||||||
JMP2r |
|
||||||
|
|
||||||
@error-txts |
|
||||||
&0 "Working-stack 20 "underflow $1 |
|
||||||
&1 "Return-stack 20 "underflow $1 |
|
||||||
&2 "Working-stack 20 "overflow $1 |
|
||||||
&3 "Return-stack 20 "overflow $1 |
|
||||||
&4 "Working-stack 20 "division 20 "by 20 "zero $1 |
|
||||||
&5 "Return-stack 20 "division 20 "by 20 "zero $1 |
|
||||||
@at-txt |
|
||||||
', 20 "at 20 $1 |
|
||||||
|
|
||||||
@bg-icn |
|
||||||
ffff ffff ffff ffff |
|
||||||
@corner-icn |
|
||||||
1f7f 7fff ffff ffff |
|
||||||
|
|
||||||
~projects/assets/msx01x02.tal |
|
||||||
Loading…
Reference in new issue