uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit abd0be0fba55607ec6363d2a97b712676598ff7d
parent a2053d9654eb7e225596bda4f797e1216b0b4d90
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Wed,  6 Jul 2022 19:25:54 -0700

A bit of housekeeping on the example files

Diffstat:
Mprojects/examples/demos/bifurcan.tal | 2+-
Mprojects/examples/demos/mandelbrot.tal | 20+++++++++-----------
Mprojects/examples/demos/polycat.tal | 3+--
Mprojects/examples/devices/audio.channels.tal | 2+-
Mprojects/examples/devices/audio.tal | 37+++++++++++++++----------------------
Mprojects/examples/exercises/fib.tal | 2+-
Mprojects/examples/gui/shapes.tal | 38+++++++++++++++++---------------------
Mprojects/software/clock.tal | 2+-
Dprojects/software/dos.tal | 705-------------------------------------------------------------------------------
Mprojects/software/launcher.tal | 4++--
Mprojects/software/neralie.tal | 72+++++++++++++++++++++++-------------------------------------------------
11 files changed, 71 insertions(+), 816 deletions(-)

diff --git a/projects/examples/demos/bifurcan.tal b/projects/examples/demos/bifurcan.tal @@ -146,7 +146,7 @@ JMP2r JMP2r -@mod DUP2 DIV MUL SUB JMP2r +@mod DIVk MUL SUB JMP2r @cursor 80c0 e0f0 f8e0 1000 diff --git a/projects/examples/demos/mandelbrot.tal b/projects/examples/demos/mandelbrot.tal @@ -2,10 +2,8 @@ %+ { ADD } %- { SUB } %* { MUL } %/ { DIV } %< { LTH } %> { GTH } %= { EQU } %! { NEQ } -%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 } -%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } -%GTS2 { #8000 ++ SWP2 #8000 ++ << } +%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 } %AUTO-X { #01 .Screen/auto DEO } %NEXT-LINE { #0000 .Screen/x DEO2 .Screen/y DEI2k INC2 ROT DEO2 } @@ -17,8 +15,8 @@ %YMIN { #ecc7 } ( -4915 ) %YMAX { #1333 } ( 4915 ) %MAXI { #20 } ( 32 ) -%DX { XMAX XMIN -- WIDTH // } ( (XMAX-XMIN)/W ) -%DY { YMAX YMIN -- HEIGHT // } ( (YMAX-YMIN)/H ) +%DX { XMAX XMIN SUB2 WIDTH DIV2 } ( (XMAX-XMIN)/W ) +%DY { YMAX YMIN SUB2 HEIGHT DIV2 } ( (YMAX-YMIN)/H ) %X { .x LDZ2 } %Y { .y LDZ2 } %X2 { .x2 LDZ2 } %Y2 { .y2 LDZ2 } @@ -54,21 +52,21 @@ BRK XMAX XMIN &hor DUP2 ,&x STR2 - #0000 DUP2 DUP2 DUP2 .x STZ2 .y STZ2 .x2 STZ2 .y2 STZ2 + #0000 DUP2k DUP2 .x STZ2 .y STZ2 .x2 STZ2 .y2 STZ2 MAXI #00 &loop - X Y ;smul2 JSR2 DUP2 ADD2 [ LIT2 &y $2 ] ++ .y STZ2 - X2 Y2 -- [ LIT2 &x $2 ] ++ .x STZ2 + X Y ;smul2 JSR2 DUP2 ADD2 [ LIT2 &y $2 ] ADD2 .y STZ2 + X2 Y2 SUB2 [ LIT2 &x $2 ] ADD2 .x STZ2 X DUP2 ;smul2 JSR2 .x2 STZ2 Y DUP2 ;smul2 JSR2 .y2 STZ2 - X2 Y2 ++ #4000 >> ,&end JCN + X2 Y2 ADD2 #4000 GTH2 ,&end JCN INC GTHk ,&loop JCN &end NIP .Screen/pixel DEO - DX ++ OVR2 OVR2 GTS2 ;&hor JCN2 + DX ADD2 OVR2 OVR2 GTS2 ;&hor JCN2 POP2 POP2 NEXT-LINE - DY ++ OVR2 OVR2 GTS2 ;&ver JCN2 + DY ADD2 OVR2 OVR2 GTS2 ;&ver JCN2 POP2 POP2 JMP2r diff --git a/projects/examples/demos/polycat.tal b/projects/examples/demos/polycat.tal @@ -74,8 +74,7 @@ BRK DUP ,&last LDR NEQ ,&changed JCN POP JMP2r &changed ( only redraw on change ) - DUP - #00 SWP ;eye ADD2 .Screen/addr DEO2 + #00 OVR ;eye ADD2 .Screen/addr DEO2 .cat/y LDZ2 #0008 ADD2 .Screen/y DEO2 .cat/x LDZ2 #0008 SUB2 .Screen/x DEO2 #81 .Screen/sprite DEOk DEO diff --git a/projects/examples/devices/audio.channels.tal b/projects/examples/devices/audio.channels.tal @@ -1,6 +1,6 @@ ( dev/audio ) -%MOD { DUP2 DIV MUL SUB } +%MOD { DIVk MUL SUB } ( devices ) diff --git a/projects/examples/devices/audio.tal b/projects/examples/devices/audio.tal @@ -1,13 +1,7 @@ ( dev/audio ) -%2// { #01 SFT2 } -%4** { #20 SFT2 } -%8** { #30 SFT2 } -%20MOD { #1f AND } -%RTN { JMP2r } - %GET-NOTE { #00 SWP ;melody ADD2 LDA } -%GET-HEXCHAR { #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2 } +%GET-HEXCHAR { #00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2 } ( devices ) @@ -44,8 +38,8 @@ #dd .Audio0/volume DEO ( TODO: turn ON ) ( center ) - .Screen/width DEI2 2// #0080 SUB2 .offset/x STZ2 - .Screen/height DEI2 2// #0040 SUB2 .offset/y STZ2 + .Screen/width DEI2 #01 SFT2 #0080 SUB2 .offset/x STZ2 + .Screen/height DEI2 #01 SFT2 #0040 SUB2 .offset/y STZ2 ;draw JSR2 #02 ;draw-selector JSR2 @@ -71,12 +65,12 @@ BRK &no-down [ #04 ] NEQk NIP ,&no-left JCN #00 ;draw-selector JSR2 - .selection LDZ #01 SUB 20MOD .selection STZ + .selection LDZ #01 SUB #1f AND .selection STZ #02 ;draw-selector JSR2 &no-left [ #08 ] NEQk NIP ,&no-right JCN #00 ;draw-selector JSR2 - .selection LDZ INC 20MOD .selection STZ + .selection LDZ INC #1f AND .selection STZ #02 ;draw-selector JSR2 &no-right POP @@ -89,9 +83,9 @@ BRK ( skip ) .timer LDZ #10 EQU #01 JCN [ BRK ] .progress LDZ ( play note ) DUP GET-NOTE .Audio0/pitch DEO - ( erase last ) DUP #01 SUB 20MOD #01 ,draw-note JSR + ( erase last ) DUP #01 SUB #1f AND #01 ,draw-note JSR ( draw current ) #01 ,draw-note JSR - ( incr ) .progress LDZ INC 20MOD .progress STZ + ( incr ) .progress LDZ INC #1f AND .progress STZ #00 .timer STZ BRK @@ -104,22 +98,22 @@ BRK INC GTHk ,&loop JCN POP2 -RTN +JMP2r @draw-note ( id color -- ) STH STH - ( set x ) [ #00 STHkr ] 8** .offset/x LDZ2 ADD2 .Screen/x DEO2 - ( set y ) [ #00 #00 STHkr ;melody ADD2 LDA ] 4** #0100 SWP2 SUB2 .offset/y LDZ2 ADD2 #0080 ADD2 .Screen/y DEO2 + ( set x ) [ #00 STHkr ] #30 SFT2 .offset/x LDZ2 ADD2 .Screen/x DEO2 + ( set y ) [ #00 #00 STHkr ;melody ADD2 LDA ] #20 SFT2 #0100 SWP2 SUB2 .offset/y LDZ2 ADD2 #0080 ADD2 .Screen/y DEO2 ( set addr ) ;marker-icn [ #00 .progress LDZ STHr EQU #08 MUL ADD2 ] .Screen/addr DEO2 ( draw ) STHr .Screen/sprite DEO -RTN +JMP2r @draw-selector ( color -- ) STH - [ #00 .selection LDZ ] 8** .offset/x LDZ2 ADD2 .Screen/x DEO2 + [ #00 .selection LDZ ] #30 SFT2 .offset/x LDZ2 ADD2 .Screen/x DEO2 #0070 .offset/y LDZ2 ADD2 .Screen/y DEO2 ;selector-icn .Screen/addr DEO2 STHkr .Screen/sprite DEO @@ -127,7 +121,7 @@ RTN .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2 .selection LDZ GET-NOTE STHr ,draw-byte JSR -RTN +JMP2r @draw-byte ( byte color -- ) @@ -139,7 +133,7 @@ RTN #0f AND GET-HEXCHAR ( draw ) STHr .Screen/sprite DEO -RTN +JMP2r @melody 54 52 54 4f 4b 4f 48 ff @@ -180,4 +174,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 -\ No newline at end of file + 007c 8280 f080 827c 007c 8280 f080 8080 diff --git a/projects/examples/exercises/fib.tal b/projects/examples/exercises/fib.tal @@ -15,7 +15,7 @@ BRK @print ( short* -- ) - &short ( short* -- ) SWP ,&byte JSR + SWP ,&byte JSR &byte ( byte -- ) DUP #04 SFT ,&char JSR &char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO diff --git a/projects/examples/gui/shapes.tal b/projects/examples/gui/shapes.tal @@ -1,13 +1,8 @@ ( GUI Shapes ) -%2** { #10 SFT2 } -%4** { #20 SFT2 } -%2// { #01 SFT2 } -%4// { #02 SFT2 } %ABS2 { DUP2 #0f SFT2 EQU #05 JCN #0000 SWP2 SUB2 } %LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 } %GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 } - %WIDTH { #0100 } %HEIGHT { #00a0 } ( devices ) @@ -35,24 +30,24 @@ #f03c .System/g DEO2 #f03f .System/b DEO2 - ( background ) ;checker_icn #03 ;cover-pattern JSR2 + ( background ) ;checker-icn #03 ;cover-pattern JSR2 - .Screen/width DEI2 2// WIDTH 2// SUB2 #0008 ADD2 - .Screen/height DEI2 2// HEIGHT 2// SUB2 #0008 ADD2 + .Screen/width DEI2 #01 SFT2 WIDTH #01 SFT2 SUB2 #0008 ADD2 + .Screen/height DEI2 #01 SFT2 HEIGHT #01 SFT2 SUB2 #0008 ADD2 WIDTH HEIGHT STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2 #02 ;fill-rect JSR2 - .Screen/width DEI2 2// WIDTH 2// SUB2 - .Screen/height DEI2 2// HEIGHT 2// SUB2 + .Screen/width DEI2 #01 SFT2 WIDTH #01 SFT2 SUB2 + .Screen/height DEI2 #01 SFT2 HEIGHT #01 SFT2 SUB2 WIDTH HEIGHT STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2 #01 ;fill-rect JSR2 - .Screen/width DEI2 2// WIDTH 2// SUB2 #0008 ADD2 - .Screen/height DEI2 2// HEIGHT 2// SUB2 #0008 ADD2 + .Screen/width DEI2 #01 SFT2 WIDTH #01 SFT2 SUB2 #0008 ADD2 + .Screen/height DEI2 #01 SFT2 HEIGHT #01 SFT2 SUB2 #0008 ADD2 WIDTH #0010 SUB2 HEIGHT #0010 SUB2 STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2 #03 ;line-rect JSR2 - .Screen/width DEI2 2// .Screen/height DEI2 2// WIDTH 4// #02 ;draw-circle JSR2 + .Screen/width DEI2 #01 SFT2 .Screen/height DEI2 #01 SFT2 WIDTH #02 SFT2 #02 ;draw-circle JSR2 #0010 #0030 #0068 #02 ;line-hor JSR2 #0020 #0058 #0078 #02 ;line-ver JSR2 @@ -64,13 +59,13 @@ BRK ( load ) .color STZ #0001 SUB2 .line/y0 STZ2 #0001 SUB2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2 .line/x0 LDZ2 .line/x LDZ2 SUB2 ABS2 .line/dx STZ2 .line/y0 LDZ2 .line/y LDZ2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy STZ2 - #ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 2** ADD2 .line/sx STZ2 - #ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 2** ADD2 .line/sy STZ2 + #ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 #10 SFT2 ADD2 .line/sx STZ2 + #ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 #10 SFT2 ADD2 .line/sy STZ2 .line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2 &loop .line/x LDZ2 .Screen/x DEO2 .line/y LDZ2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO - .line/x LDZ2 .line/x0 LDZ2 EQU2 .line/y LDZ2 .line/y0 LDZ2 EQU2 #0101 EQU2 ,&end JCN - .line/e1 LDZ2 2** .line/e2 STZ2 + .line/x LDZ2 .line/x0 LDZ2 EQU2 .line/y LDZ2 .line/y0 LDZ2 EQU2 AND ,&end JCN + .line/e1 LDZ2 #10 SFT2 .line/e2 STZ2 .line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN .line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2 .line/x LDZ2 .line/sx LDZ2 ADD2 .line/x STZ2 @@ -136,16 +131,16 @@ JMP2r ( load ) .color STZ .circle/r STZ2 .circle/yc STZ2 .circle/xc STZ2 #0000 .circle/x STZ2 .circle/r LDZ2 .circle/y STZ2 - .circle/r LDZ2 2** .circle/d STZ2 + .circle/r LDZ2 #10 SFT2 .circle/d STZ2 ( draw ) ;&seg JSR2 &loop ( incr ) .circle/x LDZ2 INC2 .circle/x STZ2 .circle/d LDZ2 #0001 LTS2 ,&else JCN ( decr ) .circle/y LDZ2 #0001 SUB2 .circle/y STZ2 - .circle/x LDZ2 .circle/y LDZ2 SUB2 4** .circle/d LDZ2 ADD2 .circle/d STZ2 + .circle/x LDZ2 .circle/y LDZ2 SUB2 #20 SFT2 .circle/d LDZ2 ADD2 .circle/d STZ2 ;&end JMP2 &else - .circle/x LDZ2 4** .circle/d LDZ2 ADD2 .circle/d STZ2 + .circle/x LDZ2 #20 SFT2 .circle/d LDZ2 ADD2 .circle/d STZ2 &end ( draw ) ;&seg JSR2 .circle/y LDZ2 .circle/x LDZ2 #0001 SUB2 GTS2 ,&loop JCN @@ -204,4 +199,5 @@ JMP2r JMP2r -@checker_icn [ f0f0 f0f0 0f0f 0f0f ] +@checker-icn + f0f0 f0f0 0f0f 0f0f diff --git a/projects/software/clock.tal b/projects/software/clock.tal @@ -219,7 +219,7 @@ JMP2r JMP2r -@mod DUP2 DIV MUL SUB JMP2r +@mod DIVk MUL SUB JMP2r @abs2 DUP2 #0f SFT2 EQU #05 JCN #0000 SWP2 SUB2 JMP2r @lts2 #8000 STH2k ADD2 SWP2 STH2r ADD2 GTH2 JMP2r @gts2 #8000 STH2k ADD2 SWP2 STH2r ADD2 LTH2 JMP2r diff --git a/projects/software/dos.tal b/projects/software/dos.tal @@ -1,705 +0,0 @@ -( UXN-DOS ) - -%+ { ADD } %- { SUB } %* { MUL } %/ { DIV } -%< { LTH } %> { GTH } %= { EQU } %! { NEQ } -%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 } -%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } - -%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 } - -%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 } - -%2MOD { #01 AND } %2MOD2 { #0001 AND2 } -%4MOD { #03 AND } %4MOD2 { #0003 AND2 } -%8MOD { #07 AND } %8MOD2 { #0007 AND2 } -%10MOD { #0f AND } %10MOD2 { #000f AND2 } - -%MOD { DIVk MUL SUB } -%MOD2 { DIV2k MUL2 SUB2 } - -%AUTO-X { #01 .Screen/auto DEO } -%AUTO-Y { #02 .Screen/auto DEO } -%AUTO-XY { #03 .Screen/auto DEO } -%AUTO-ADDR { #04 .Screen/auto DEO } -%AUTO-XADDR { #05 .Screen/auto DEO } -%AUTO-YADDR { #06 .Screen/auto DEO } -%AUTO-XYADDR { #07 .Screen/auto DEO } -%RELEASE-MOUSE { #0096 DEO } - -%RTN { JMP2r } - -%WIDTH { #38 } -%HEIGHT { #20 } -%PAD { #0018 } - -( 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 -|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 -|c0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ] - -( variables ) - -|0000 - -@buffer $3 - &input $80 -@path $40 -@frame $1 - -( init ) - -|0100 ( -> ) - - ( theme ) - #50f8 .System/r DEO2 - #c0f8 .System/g DEO2 - #a0f8 .System/b DEO2 - - ( vectors ) - ;on-button .Controller/vector DEO2 - - ( resize ) - #00 WIDTH 8** PAD 2** ++ .Screen/width DEO2 - #00 HEIGHT 8** PAD 2** ++ .Screen/height DEO2 - - #04 ;draw-input JSR2 - - LIT '. .path STZ - - ;clear JSR2 - -BRK - -@on-button ( -> ) - - .Controller/key DEI - DUP #00 ! ,&no-null JCN - POP BRK - &no-null - DUP #0d ! ,&no-enter JCN - #00 ;draw-input JSR2 - ;validate JSR2 - #01 ;draw-input JSR2 - .frame LDZk INC SWP STZ - &no-enter - DUP #08 ! ,&no-backspace JCN - #00 ;draw-input JSR2 - ;buffer ;spop JSR2 - #04 ;draw-input JSR2 - .frame LDZk INC SWP STZ - &no-backspace - DUP STHk #1f > STHr #7b < #0101 !! ,&no-valid JCN - ;buffer ;slen JSR2 #007f >> ,&no-valid JCN - STHk ;buffer STHr ;sput JSR2 - #04 ;draw-input JSR2 - .frame LDZk INC SWP STZ - &no-valid - POP - -BRK - -@clear ( -- ) - - PAD .Screen/x DEO2 - PAD .Screen/y DEO2 - ;&blank-icn .Screen/addr DEO2 - AUTO-X - HEIGHT #00 - &ver - WIDTH #00 - &hor - #02 .Screen/sprite DEO - INC GTHk ,&hor JCN - POP2 - PAD .Screen/x DEO2 - .Screen/y DEI2k #0008 ++ ROT DEO2 - INC GTHk ,&ver JCN - POP2 - #00 .Screen/auto DEO - -RTN - &blank-icn 8000 0000 0000 0000 - -( DOS ) - -@validate ( -- ) - - ;clear JSR2 - - PAD .Screen/x DEO2 - PAD .Screen/y DEO2 - - ;get-cmd JSR2 ;commands-func ++ LDA2 JSR2 - ;buffer #0080 ;mclr JSR2 - -JMP2r - -@get-cmd ( -- cmd* ) - - ;commands/end ;commands - &loop - LDA2k ;buffer ;scmp-seg JSR2 #00 = ,&continue JCN - NIP2 ;commands -- RTN - &continue - INC2 INC2 GTH2k ,&loop JCN - POP2 ;commands -- - -RTN - -@cmd-ls "ls $1 &docs "list 20 "folder 20 "content $1 &func - - ( load ) - ;path .File/name DEO2 - #8000 .File/length DEO2 - ;view .File/read DEO2 - - ;view #01 ;draw-tx JSR2 - -RTN - -@cmd-mk "mk $1 &docs "make 20 "file $1 &func - - ;buffer/input ;file-exists JSR2 #01 ! ,&no-exists JCN - ;error-exists-txt ;buffer/input ;draw-message JSR2 RTN - &no-exists - ( save ) - ;buffer/input .File/name DEO2 - #0001 .File/length DEO2 - ;&buf .File/write DEO2 - ( message ) - ;make-success-txt ;buffer/input ;draw-message JSR2 - -RTN - &buf 0a - -@cmd-cp "cp $1 &docs "copy 20 "file 20 "to 20 "name $1 &func - - ( b ) ;buffer/input #20 ;next-char JSR2 STH2k INC2 - #00 STH2r STA - ( a ) ;buffer/input - ( a exists ) - ;buffer/input ;file-exists JSR2 ,&valid JCN - ;error-unexists-txt ;buffer/input ;draw-message JSR2 POP2 POP2 RTN - &valid - ( b unexists ) - OVR2 ;file-exists JSR2 #00 = ,&available JCN - OVR2 ;error-exists-txt SWP2 ;draw-message JSR2 POP2 POP2 RTN - &available - ( load ) - .File/name DEO2 - #8000 .File/length DEO2 - ;view .File/read DEO2 - ( save ) - DUP2 .File/name DEO2 - #8000 .File/length DEO2 - ;view .File/write DEO2 - ( message ) - ;copy-success-txt SWP2 ;draw-message JSR2 - -RTN - -@cmd-mv "mv $1 &docs "move 20 "file 20 "to 20 "name $1 - &func - - ( todo ) - -RTN - -@cmd-rm "rm $1 &docs "remove 20 "file $1 - &func - - ( exists ) - ;buffer/input ;file-exists JSR2 ,&valid JCN - ;error-unexists-txt ;buffer/input ;draw-message JSR2 RTN - &valid - ( delete ) - ;buffer/input .File/name DEO2 - #01 .File/delete DEO - ( message ) - ;remove-success-txt ;buffer/input ;draw-message JSR2 - -RTN - -@cmd-tx "tx $1 &docs "display 20 "file 20 "as 20 "text $1 - &func - - ( exists ) - ;buffer/input ;file-exists JSR2 ,&valid JCN - ;error-unexists-txt ;buffer/input ;draw-message JSR2 RTN - &valid - ( load ) - ;buffer/input .File/name DEO2 - #8000 .File/length DEO2 - ;view .File/read DEO2 - ( message ) - ;view #01 ;draw-tx JSR2 - -RTN - -@cmd-hx "hx $1 &docs "display 20 "file 20 "as 20 "hex $1 - &func - - ( exists ) - ;buffer/input ;file-exists JSR2 ,&valid JCN - ;error-unexists-txt ;buffer/input ;draw-message JSR2 RTN - &valid - ( load ) - ;buffer/input .File/name DEO2 - #8000 .File/length DEO2 - ;view .File/read DEO2 - ( message ) - AUTO-YADDR - .File/success DEI2 #0000 - &loop - DUP2 ;view ++ LDA #01 ;draw-hex JSR2 - ( make shorts ) - DUP2 #0001 AND2 #0000 == ,&no-short JCN - .Screen/x DEI2k #0008 ++ ROT DEO2 - &no-short - ( make lines ) - DUP2 #000f AND2 #000f !! ,&no-lines JCN - .Screen/y DEI2k #0010 ++ ROT DEO2 - PAD .Screen/x DEO2 - .Screen/y DEI2 .Screen/height DEI2 PAD -- #0010 -- >> ,&end JCN - &no-lines - INC2 GTH2k ,&loop JCN - &end - POP2 POP2 - -RTN - -@cmd-do "do $1 &docs "run 20 "file 20 "as 20 "rom $1 - &func - - ( release inputs ) - #0000 .Controller/button DEO2 - - ;buffer/input - DUP2 ;check-rom JSR2 ,&valid JCN - PAD .Screen/x DEO2 - PAD .Screen/y DEO2 - ;&invalid-txt #02 ;draw-str JSR2 - #01 ;draw-str JSR2 - RTN - &valid - ;load-rom JSR2 - -RTN - &invalid-txt "invalid 20 "rom: $1 - -@cmd-tm "tm $1 &docs "display 20 "time $1 - &func - - #00 .DateTime/month DEI 4* ;month-txt ++ #01 ;draw-str JSR2 - #20 #01 ;draw-char JSR2 - .DateTime/day DEI #01 ;draw-dec JSR2 - #20 #01 ;draw-char JSR2 - #00 .DateTime/dotw DEI 4* ;week-txt ++ #01 ;draw-str JSR2 - #20 #01 ;draw-char JSR2 - .DateTime/hour DEI #01 ;draw-dec JSR2 - LIT ': #01 ;draw-char JSR2 - .DateTime/minute DEI #01 ;draw-dec JSR2 - LIT ': #01 ;draw-char JSR2 - .DateTime/second DEI #01 ;draw-dec JSR2 - -RTN - -@cmd-1b "1b $1 &docs "display 20 "1bit 20 "file $1 - &func - - ( todo ) - -RTN - -@cmd-2b "2b $1 &docs "display 20 "2bit 20 "file $1 - &func - - ( todo ) - -RTN - -@cmd-sn "sn $1 &docs "play 20 "sound 20 "file $1 - &func - - ( todo ) - -RTN - -@cmd-?? "-- $1 &docs "display 20 "commands $1 - &func - - ;&help-txt #01 ;draw-tx JSR2 - PAD #0010 ++ .Screen/y DEO2 - - ;commands/end ;commands - &loop - PAD .Screen/x DEO2 - ( name ) LDA2k #04 ;draw-str JSR2 - PAD #0020 ++ .Screen/x DEO2 - ( docs ) DUP2 ;commands -- ;commands-docs ++ LDA2 #01 ;draw-str JSR2 - .Screen/y DEI2k #0010 ++ ROT DEO2 - INC2 INC2 GTH2k ,&loop JCN - POP2 POP2 - -RTN - &help-txt "Commands: $1 - -@commands - :cmd-ls :cmd-mk :cmd-cp :cmd-mv :cmd-rm - :cmd-hx :cmd-tx :cmd-do :cmd-tm - :cmd-1b :cmd-2b :cmd-sn - &end :cmd-?? -@commands-docs - :cmd-ls/docs :cmd-mk/docs :cmd-cp/docs :cmd-mv/docs :cmd-rm/docs - :cmd-hx/docs :cmd-tx/docs :cmd-do/docs :cmd-tm/docs - :cmd-1b/docs :cmd-2b/docs :cmd-sn/docs - &end :cmd-??/docs -@commands-func - :cmd-ls/func :cmd-mk/func :cmd-cp/func :cmd-mv/func :cmd-rm/func - :cmd-hx/func :cmd-tx/func :cmd-do/func :cmd-tm/func - :cmd-1b/func :cmd-2b/func :cmd-sn/func - &end :cmd-??/func - -@file-exists ( name* -- bool ) - - .File/name DEO2 - #0040 .File/length DEO2 - ;&buf .File/stat DEO2 - .File/success DEI2 #0000 >> - -RTN - &buf $40 - -( gui ) - -@draw-input ( color -- ) - - AUTO-YADDR - STH - PAD .Screen/x DEO2 - .Screen/height DEI2 PAD -- .Screen/y DEO2 - - ( flower ) - ;flowers-icn #00 .frame LDZ #06 MOD 20** ++ .Screen/addr DEO2 - #81 .Screen/sprite DEOk DEO - .Screen/y DEI2 #0010 -- .Screen/y DEO2 - .Screen/x DEI2 #0008 ++ .Screen/x DEO2 - - #20 #00 ;draw-char JSR2 - - ;buffer STHkr ;draw-str JSR2 - - ;cursor-icn .Screen/addr DEO2 - STHr .Screen/sprite DEOk DEO - .Screen/y DEI2 #0010 -- .Screen/y DEO2 - .Screen/x DEI2 #0008 ++ .Screen/x DEO2 - -JMP2r - -@draw-message ( a* b* -- ) - - SWP2 #02 ;draw-str JSR2 - #01 ;draw-str JSR2 - -RTN - -@draw-tx ( str* color -- ) - - AUTO-YADDR - .Screen/x DEI2 ,&anchor STR2 - STH - &while - ( outside view ) - .Screen/x DEI2 .Screen/width DEI2 PAD -- #0010 -- >> ,&lb JCN - ( linebreak ) - LDAk #0a ! ,&no-lb JCN - &lb - LIT2 &anchor $2 .Screen/x DEO2 - .Screen/y DEI2k #0010 ++ STH2k ROT DEO2 - STH2r .Screen/height DEI2 PAD -- #0010 -- >> ,&end JCN - ,&skip JMP - &no-lb - LDAk STHkr ,draw-char JSR - &skip - INC2 LDAk ,&while JCN - &end - POP2 - POPr - -RTN - -@draw-dec ( byte color -- ) - - STH - DUP #0a DIV LIT '0 + STHkr ,draw-char JSR - #0a MOD LIT '0 + STHr ,draw-char JSR - -RTN - -@draw-hex ( byte color -- ) - - STH - DUP #04 SFT ,&parse JSR STHkr ,draw-char JSR - #0f AND ,&parse JSR STHr ,draw-char JSR - RTN - &parse ( value -- char ) - DUP #09 > ,&above JCN - #30 + RTN - &above - #09 - #60 + RTN - -RTN - -@draw-str ( str* color -- ) - - AUTO-YADDR - STH - &while - LDAk STHkr ,draw-char JSR - INC2 LDAk ,&while JCN - POP2 - POPr - -RTN - -@draw-char ( char color -- ) - - SWP - [ #20 - #00 SWP #40 SFT2 ;font ++ ] .Screen/addr DEO2 - .Screen/sprite DEOk DEO - .Screen/y DEI2 #0010 -- .Screen/y DEO2 - .Screen/x DEI2 #0008 ++ .Screen/x DEO2 - -RTN - -( utils ) - -@next-char ( addr* char -- addr* ) - - STH - &while - LDAk STHkr = ,&end JCN - LDAk #00 = ,&end JCN - INC2 LDAk ,&while JCN - &end - POPr - -RTN - -@slen ( str* -- len* ) - - DUP2 ,scap JSR SWP2 -- - -RTN - -@scap ( str* -- str-end* ) - - ( clamp ) LDAk #00 ! JMP RTN - &while INC2 LDAk ,&while JCN - -RTN - -@sput ( str* char -- ) - - ROT ROT ,scap JSR STA - -RTN - -@spop ( str* -- ) - - ( clamp ) LDAk #00 ! JMP RTN - #00 ROT ROT ,scap JSR #0001 -- STA - -RTN - -@scmp-seg ( a* b* -- flag ) - - STH2 - &loop - LDAk LDAkr STHr = ,&not-diff JCN - POP2 POP2r #00 RTN - &not-diff - INC2k LDA #00 ! ,&continue JCN - POP2 POP2r #01 RTN - &continue - INC2 INC2r - ,&loop JMP - POP2 POP2r #00 - -RTN - -@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-exists-txt "file_exists: 20 $1 -@error-unexists-txt "file_does_not_exists: 20 $1 - -@make-success-txt "made: 20 $1 -@copy-success-txt "copied: 20 $1 -@remove-success-txt "removed: 20 $1 - -@week-txt - "Sun $1 "Mon $1 "Tue $1 "Wed $1 "Thu $1 "Fri $1 - "Sat $1 - -@month-txt - "Jan $1 "Feb $1 "Mar $1 "Apr $1 "May $1 "Jun $1 - "Jul $1 "Aug $1 "Sep $1 "Oct $1 "Nov $1 "Dec $1 - -@cursor-icn - aa55 aa55 aa55 aa55 aa55 aa55 aa55 aa55 - aa55 aa55 aa55 aa55 aa55 aa55 aa55 aa55 - -@flowers-icn ( by elioat ) - 0000 0020 1408 0810 40a0 4205 0200 40a0 - 0810 103c 7e7e 3c18 4205 0234 7e7e 3c18 - 0000 0020 100c 0818 0040 a042 0522 5024 - 0008 083c 7e7e 3c18 0a04 002c 7e7e 3c18 - 0000 0000 0000 000c 0000 0000 0000 0000 - 1c10 083c 7e7e 3c18 0000 002c 7e7e 3c18 - 0000 0000 0000 0004 0000 0000 0002 0502 - 0810 103c 7e7e 3c18 0000 0034 7e7e 3c18 - 0000 0000 0000 0010 0000 0000 0020 5225 - 080c 083c 7e7e 3c18 0200 002c 7e7e 3c18 - 0000 0000 0800 1800 0000 040a 2450 240a - 1010 103c 7e7e 3c18 0400 0034 7e7e 3c18 - -@font ( terminus01x02 ) - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 183c 3c3c 1818 1800 1818 0000 0000 - 0066 6666 2400 0000 0000 0000 0000 0000 - 0000 006c 6cfe 6c6c 6cfe 6c6c 0000 0000 - 1818 7cc6 c2c0 7c06 0686 c67c 1818 0000 - 0000 0000 c2c6 0c18 3060 c686 0000 0000 - 0000 386c 6c38 76dc cccc cc76 0000 0000 - 0030 3030 6000 0000 0000 0000 0000 0000 - 0000 0c18 3030 3030 3030 180c 0000 0000 - 0000 3018 0c0c 0c0c 0c0c 1830 0000 0000 - 0000 0000 0066 3cff 3c66 0000 0000 0000 - 0000 0000 0018 187e 1818 0000 0000 0000 - 0000 0000 0000 0000 0018 1818 3000 0000 - 0000 0000 0000 00fe 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 1818 0000 0000 - 0000 0000 0206 0c18 3060 c080 0000 0000 - 0000 386c c6c6 d6d6 c6c6 6c38 0000 0000 - 0000 1838 7818 1818 1818 187e 0000 0000 - 0000 7cc6 060c 1830 60c0 c6fe 0000 0000 - 0000 7cc6 0606 3c06 0606 c67c 0000 0000 - 0000 0c1c 3c6c ccfe 0c0c 0c1e 0000 0000 - 0000 fec0 c0c0 fc06 0606 c67c 0000 0000 - 0000 3860 c0c0 fcc6 c6c6 c67c 0000 0000 - 0000 fec6 0606 0c18 3030 3030 0000 0000 - 0000 7cc6 c6c6 7cc6 c6c6 c67c 0000 0000 - 0000 7cc6 c6c6 7e06 0606 0c78 0000 0000 - 0000 0000 1818 0000 0018 1800 0000 0000 - 0000 0000 1818 0000 0018 1830 0000 0000 - 0000 0006 0c18 3060 3018 0c06 0000 0000 - 0000 0000 007e 0000 7e00 0000 0000 0000 - 0000 0060 3018 0c06 0c18 3060 0000 0000 - 0000 7cc6 c60c 1818 1800 1818 0000 0000 - 0000 007c c6c6 dede dedc c07c 0000 0000 - 0000 1038 6cc6 c6fe c6c6 c6c6 0000 0000 - 0000 fc66 6666 7c66 6666 66fc 0000 0000 - 0000 3c66 c2c0 c0c0 c0c2 663c 0000 0000 - 0000 f86c 6666 6666 6666 6cf8 0000 0000 - 0000 fe66 6268 7868 6062 66fe 0000 0000 - 0000 fe66 6268 7868 6060 60f0 0000 0000 - 0000 3c66 c2c0 c0de c6c6 663a 0000 0000 - 0000 c6c6 c6c6 fec6 c6c6 c6c6 0000 0000 - 0000 3c18 1818 1818 1818 183c 0000 0000 - 0000 1e0c 0c0c 0c0c cccc cc78 0000 0000 - 0000 e666 666c 7878 6c66 66e6 0000 0000 - 0000 f060 6060 6060 6062 66fe 0000 0000 - 0000 c6ee fefe d6c6 c6c6 c6c6 0000 0000 - 0000 c6e6 f6fe dece c6c6 c6c6 0000 0000 - 0000 7cc6 c6c6 c6c6 c6c6 c67c 0000 0000 - 0000 fc66 6666 7c60 6060 60f0 0000 0000 - 0000 7cc6 c6c6 c6c6 c6d6 de7c 0c0e 0000 - 0000 fc66 6666 7c6c 6666 66e6 0000 0000 - 0000 7cc6 c660 380c 06c6 c67c 0000 0000 - 0000 7e7e 5a18 1818 1818 183c 0000 0000 - 0000 c6c6 c6c6 c6c6 c6c6 c67c 0000 0000 - 0000 c6c6 c6c6 c6c6 c66c 3810 0000 0000 - 0000 c6c6 c6c6 d6d6 d6fe ee6c 0000 0000 - 0000 c6c6 6c7c 3838 7c6c c6c6 0000 0000 - 0000 6666 6666 3c18 1818 183c 0000 0000 - 0000 fec6 860c 1830 60c2 c6fe 0000 0000 - 0000 3c30 3030 3030 3030 303c 0000 0000 - 0000 0080 c0e0 7038 1c0e 0602 0000 0000 - 0000 3c0c 0c0c 0c0c 0c0c 0c3c 0000 0000 - 1038 6cc6 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 00ff 0000 - 3030 1800 0000 0000 0000 0000 0000 0000 - 0000 0000 0078 0c7c cccc cc76 0000 0000 - 0000 e060 6078 6c66 6666 667c 0000 0000 - 0000 0000 007c c6c0 c0c0 c67c 0000 0000 - 0000 1c0c 0c3c 6ccc cccc cc76 0000 0000 - 0000 0000 007c c6fe c0c0 c67c 0000 0000 - 0000 386c 6460 f060 6060 60f0 0000 0000 - 0000 0000 0076 cccc cccc cc7c 0ccc 7800 - 0000 e060 606c 7666 6666 66e6 0000 0000 - 0000 1818 0038 1818 1818 183c 0000 0000 - 0000 0606 000e 0606 0606 0606 6666 3c00 - 0000 e060 6066 6c78 786c 66e6 0000 0000 - 0000 3818 1818 1818 1818 183c 0000 0000 - 0000 0000 00ec fed6 d6d6 d6c6 0000 0000 - 0000 0000 00dc 6666 6666 6666 0000 0000 - 0000 0000 007c c6c6 c6c6 c67c 0000 0000 - 0000 0000 00dc 6666 6666 667c 6060 f000 - 0000 0000 0076 cccc cccc cc7c 0c0c 1e00 - 0000 0000 00dc 7666 6060 60f0 0000 0000 - 0000 0000 007c c660 380c c67c 0000 0000 - 0000 1030 30fc 3030 3030 361c 0000 0000 - 0000 0000 00cc cccc cccc cc76 0000 0000 - 0000 0000 0066 6666 6666 3c18 0000 0000 - 0000 0000 00c6 c6d6 d6d6 fe6c 0000 0000 - 0000 0000 00c6 6c38 3838 6cc6 0000 0000 - 0000 0000 00c6 c6c6 c6c6 c67e 060c f800 - 0000 0000 00fe cc18 3060 c6fe 0000 0000 - 0000 0e18 1818 7018 1818 180e 0000 0000 - 0000 1818 1818 0018 1818 1818 0000 0000 - 0000 7018 1818 0e18 1818 1870 0000 0000 - -~projects/library/check-rom.tal -~projects/library/load-rom.tal - -@view diff --git a/projects/software/launcher.tal b/projects/software/launcher.tal @@ -200,7 +200,7 @@ JMP2r @follow-selection ( -- ) .browser/y2 LDZ2 .browser/y LDZ2 SUB2 #04 SFT2 NIP .browser/sel LDZ .browser/scroll LDZ SUB - DUP2 GTH ,&no-down JCN + GTHk ,&no-down JCN .browser/scroll LDZ INC ,scroll-to JSR &no-down DUP2 SWP LTH ,&no-up JCN @@ -215,7 +215,7 @@ JMP2r STH ( more lines than visible ) .browser/lines LDZ .browser/y2 LDZ2 .browser/y LDZ2 SUB2 #04 SFT2 NIP - DUP2 GTH ,&can-scroll JCN + GTHk ,&can-scroll JCN POPr POP2 JMP2r &can-scroll ( less than max scroll ) diff --git a/projects/software/neralie.tal b/projects/software/neralie.tal @@ -1,40 +1,14 @@ -( - app/neralie : clock with arvelie date - - TODO - - use splash screen when FPS calculation is unstable -) - -%+ { ADD } %- { SUB } %/ { DIV } -%< { LTH } %> { GTH } %= { EQU } %! { NEQ } -%++ { ADD2 } %-- { SUB2 } %// { DIV2 } -%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } - -%2* { #10 SFT } %2/ { #01 SFT } -%4* { #20 SFT } %4/ { #02 SFT } -%8* { #30 SFT } %8/ { #03 SFT } -%10* { #40 SFT } %10/ { #04 SFT } -%20* { #50 SFT } %20/ { #05 SFT } - -%2** { #10 SFT2 } %2// { #01 SFT2 } -%4** { #20 SFT2 } %4// { #02 SFT2 } -%8** { #30 SFT2 } %8// { #03 SFT2 } -%10** { #40 SFT2 } %10// { #04 SFT2 } -%20** { #50 SFT2 } %20// { #05 SFT2 } - -%MOD { DUP2 DIV MUL SUB } +( app/neralie : clock with arvelie date ) + +%PAD { #0018 } + +%MOD { DIVk MUL SUB } %MOD2 { DIV2k MUL2 SUB2 } -%TOS { #00 SWP } %h { .DateTime/hour DEI } %m { .DateTime/minute DEI } %s { .DateTime/second DEI } -%1-- { #0001 -- } - -%PAD { #0018 } -%RTN { JMP2r } - ( devices ) |00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] @@ -76,15 +50,15 @@ PAD DUP2 .frame/x1 STZ2 DUP2 .frame/y1 STZ2 - DUP2 .Screen/width DEI2 SWP2 -- #0001 -- .frame/x2 STZ2 - .Screen/height DEI2 SWP2 -- .frame/y2 STZ2 + DUP2 .Screen/width DEI2 SWP2 SUB2 #0001 SUB2 .frame/x2 STZ2 + .Screen/height DEI2 SWP2 SUB2 .frame/y2 STZ2 #01 .neralie/color STZ .frame/x1 LDZ2 .frame/x2 LDZ2 OVR2 OVR2 .frame/y1 LDZ2 ;h JSR2 .frame/y2 LDZ2 ;h JSR2 - .frame/y1 LDZ2 #0001 -- .frame/y2 LDZ2 INC2 + .frame/y1 LDZ2 #0001 SUB2 .frame/y2 LDZ2 INC2 OVR2 OVR2 .frame/x1 LDZ2 ;v JSR2 .frame/x2 LDZ2 ;v JSR2 @@ -108,7 +82,7 @@ BRK #0120 #00 h MUL2 #00c0 #00 m MUL2 ADD2 #00f8 #00 s MUL2 ADD2 - #0271 #00 .fps/next LDZ MUL2 #00 .fps/current LDZ DIV2 8** ADD2 + #0271 #00 .fps/next LDZ MUL2 #00 .fps/current LDZ DIV2 #30 SFT2 ADD2 #01b0 ;modf JSR2 SWP2 #0017 MUL2 #03e8 DIV2 .neralie/n6 STZ POP ( add up units and tens of pulses, store in n5 and n4 ) @@ -122,29 +96,29 @@ BRK #01a0 #00 h MUL2 ADD2 #0006 #00 m MUL2 ADD2 .neralie/n0123 STZ2 -RTN +JMP2r @draw-date ( -- ) ( auto x ) #01 .Screen/auto DEO - .Screen/width DEI2 2// #0034 -- .Screen/x DEO2 - .Screen/height DEI2 #0010 -- .Screen/y DEO2 + .Screen/width DEI2 #01 SFT2 #0034 SUB2 .Screen/x DEO2 + .Screen/height DEI2 #0010 SUB2 .Screen/y DEO2 ( arvelie ) - .DateTime/year DEI2 #07d6 -- NIP - DUP #0a DIV TOS 8** ;font-numbers ++ .Screen/addr DEO2 + .DateTime/year DEI2 #07d6 SUB2 NIP + DUP #0a DIV #00 SWP #30 SFT2 ;font-numbers ADD2 .Screen/addr DEO2 #01 .Screen/sprite DEO - #0a MOD TOS 8** ;font-numbers ++ .Screen/addr DEO2 + #0a MOD #00 SWP #30 SFT2 ;font-numbers ADD2 .Screen/addr DEO2 #01 .Screen/sprite DEO .DateTime/doty DEI2 - DUP2 #000e DIV2 8** ;font-letters ++ .Screen/addr DEO2 + DUP2 #000e DIV2 #30 SFT2 ;font-letters ADD2 .Screen/addr DEO2 #01 .Screen/sprite DEO #000e MOD2 DUP2 #000a DIV2 ,digit JSR #000a MOD2 ,digit JSR - .Screen/x DEI2 #0008 ++ .Screen/x DEO2 + .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( neralie ) .neralie/n0123 LDZ2 @@ -158,14 +132,14 @@ RTN ( auto none ) #00 .Screen/auto DEO -RTN +JMP2r @digit ( index* -- ) - 8** ;font-numbers ++ .Screen/addr DEO2 + #30 SFT2 ;font-numbers ADD2 .Screen/addr DEO2 .neralie/color LDZ .Screen/sprite DEO -RTN +JMP2r @draw-clock ( -- ) @@ -197,7 +171,7 @@ RTN &next ( digit-addr number* -- next-digit-addr next-number* prev-digit* ) #03e8 ;modf JSR2 STH2 #000a MUL2 - ROT DUP STH INC ROT ROT + ROT STHk INC ROT ROT #00 STHr LDZ ADD2 STH2r JMP2r @@ -256,8 +230,8 @@ RTN #00 .fps/next STZ JMP2r -@modf ( dividend* divisor* -- remainder* quotient* ) - OVR2 OVR2 DIV2 DUP2 STH2 MUL2 SUB2 STH2r JMP2r +@modf ( dividend* divisor* SUB2 remainder* quotient* ) + OVR2 OVR2 DIV2 STH2k MUL2 SUB2 STH2r JMP2r @mul2hi ( a* b* -- product-top-16-bits* ) (