@@ 0,0 1,1442 @@
+( app/cccc : graphical calculator 52428 )
+
+|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
+|10 @Console &vector $2 &read $1 &pad $5 &write $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 &chord $1
+|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
+
+|0000
+
+ @mode
+ &dec $1
+ &dot $1
+ @cursor
+ &x $2 &y $2
+ &d &dx $1 &dy $1
+ @input
+ &num $2 &den $2
+ @length $2
+
+|0100
+
+ ( theme )
+ #50f2 .System/r DEO2
+ #b0f9 .System/g DEO2
+ #a0f8 .System/b DEO2
+ ;load-theme JSR2
+
+ ( playdate size 0190 x 00f0 )
+ #00e0 .Screen/width DEO2
+ #00f0 .Screen/height DEO2
+
+ ( setup synth )
+ #0003 .Audio0/adsr DEO2
+ ;tone .Audio0/addr DEO2
+ #0100 .Audio0/length DEO2
+ #ff .Audio0/volume DEO ( TODO: turn ON )
+
+ #0001 .input/den STZ2
+
+ ( initial draw )
+ ;redraw JSR2
+
+ ( vectors )
+ ;on-console .Console/vector DEO2
+ ;on-button .Controller/vector DEO2
+ ;on-mouse .Mouse/vector DEO2
+ ;on-frame .Screen/vector DEO2
+
+BRK
+
+(
+@|vectors )
+
+@on-console ( -> )
+
+ .Console/read DEI ;listen JSR2
+
+BRK
+
+@on-button ( -> )
+
+ .Controller/button DEI2 #01 LIT "v NEQ2 ,&no-paste JCN
+ ;snarf-paste JSR2
+ &no-paste
+
+ .Controller/button DEI
+ DUP #10 NEQ ,&no-u JCN
+ .cursor/dx LDZ .cursor/dy LDZ #01 SUB ;set-sel JSR2
+ &no-u
+ DUP #20 NEQ ,&no-d JCN
+ .cursor/dx LDZ .cursor/dy LDZ INC ;set-sel JSR2
+ &no-d
+ DUP #40 NEQ ,&no-l JCN
+ .cursor/dx LDZ #01 SUB .cursor/dy LDZ ;set-sel JSR2
+ &no-l
+ DUP #80 NEQ ,&no-r JCN
+ .cursor/dx LDZ INC .cursor/dy LDZ ;set-sel JSR2
+ &no-r
+ DUP #01 NEQ ,&no-a JCN
+ ;press-sel JSR2
+ &no-a
+ DUP #02 NEQ ,&no-b JCN
+ ;erase JSR2
+ &no-b
+ POP
+
+ .Controller/key DEI ;listen JSR2
+
+BRK
+
+@on-frame ( -> )
+
+ ( delay )
+ [ LIT &f 00 ] INCk ,&f STR #03 AND #00 EQU [ JMP BRK ]
+
+ ( find buttons )
+ ;buttons/end ;buttons
+ &loop
+ #0008 ADD2 LDAk #00 EQU ,&continue JCN
+ ( decr time )
+ DUP2 LDAk #01 SUB ROT ROT STA
+ ( release button )
+ LDAk ,&continue JCN
+ DUP2 #0008 SUB2 #00 ;press-button/release JSR2
+ &continue
+ INC2 GTH2k ,&loop JCN
+ POP2 POP2
+
+BRK
+
+@on-mouse ( -> )
+
+ ( clear last cursor )
+ #40 ;draw-cursor JSR2
+
+ ( draw new cursor )
+ .Mouse/x DEI2 .cursor/x STZ2
+ .Mouse/y DEI2 .cursor/y STZ2
+ ;cursor-icn .Screen/addr DEO2
+ #43 .Mouse/state DEI #00 NEQ DUP ADD SUB ;draw-cursor JSR2
+
+ .Mouse/state DEI ,&on-mouse-touch JCN
+
+BRK
+ &on-mouse-touch ( -> )
+
+ .Mouse/x DEI2 #0010 SUB2 #03 SFT2 NIP #03 DIV
+ .Mouse/y DEI2 #0078 SUB2 #03 SFT2 NIP
+
+ #00 .Mouse/state DEO
+
+ OVR #07 GTH ,&skip JCN
+ DUP #fd GTH ,on-touch-bitpad JCN
+ DUP #0b GTH ,&skip JCN
+ OVR #02 LTH ,on-touch-fncpad JCN
+ OVR #06 LTH ,on-touch-numpad JCN
+ OVR #08 LTH ,on-touch-modpad JCN
+ &skip
+ POP2
+
+BRK
+
+@on-touch-bitpad ( x y -- )
+
+ POP2
+
+ .Mouse/x DEI2 #0033 GTH2 ,&continue JCN
+ BRK
+ &continue
+
+ #0001
+ ( shift )
+ #000f
+ .Mouse/x DEI2 #0038 SUB2 #03 SFT2
+ DUP2 #0005 DIV2 SUB2 SUB2
+ #40 SFT NIP
+ ( mask )
+ SFT2 .input LDZ2 EOR2
+ .input STZ2
+ ;update-input JSR2
+
+BRK
+
+@on-touch-fncpad ( x/3 y -> )
+
+ #01 SFT SWP #06 MUL ADD
+ #00 SWP DUP ADD ;fncpad ADD2
+ LDA2 JSR2
+
+BRK
+
+@on-touch-numpad ( x/3 y -> )
+
+ SWP #02 SUB SWP
+ #03 DIV #20 SFT ADD
+ #00 SWP DUP ADD ;numpad ADD2
+ LDA2 JSR2
+
+BRK
+
+@on-touch-modpad ( x/3 y -> )
+
+ #03 DIV SWP #06 SUB #20 SFT ADD
+ #00 SWP DUP ADD ;modpad ADD2
+ LDA2 JSR2
+
+BRK
+
+(
+@|main )
+
+@listen ( c -- )
+
+ STHk
+ #00 EQU ,&skip JCN
+
+ ;keys/end ;keys
+ &loop
+ LDAk STHkr NEQ ,&continue JCN
+ INC2k LDA2 JSR2 ,&end JMP
+ &continue
+ INC2 INC2 INC2 GTH2k ,&loop JCN
+ &end
+ POP2 POP2
+ &skip
+ POPr
+
+JMP2r
+
+@eval ( -- )
+
+ ;buttons/push ;press-button JSR2
+ .input LDZ2 #0001 ;push JSR2
+ #0000 .input STZ2
+ ;update-input JSR2
+ ;draw-display ( .. )
+
+JMP2
+
+@append ( val -- )
+
+ #00 SWP
+ .input LDZ2
+ #00 #0a10 .mode/dec LDZ [ JMP SWP POP ] MUL2 ADD2
+ .input STZ2
+ ;draw-input ( .. )
+
+JMP2
+
+@erase ( -- )
+
+ ( clamp )
+ .input LDZ2 ORA ,&has-input JCN
+ ;buttons/pop ;press-button JSR2
+ .length LDZ2 ORA #01 JCN JMP2r
+ ;pop JSR2 POP2 POP2
+ ;draw-display JMP2
+ &has-input
+
+ .input LDZ2
+ #00 #0a10 .mode/dec LDZ [ JMP SWP POP ] DIV2
+ .input STZ2
+ ;update-input ( .. )
+
+JMP2
+
+@clear ( -- )
+
+ ;buttons/clr ;press-button JSR2
+ #0000 .length STZ2
+ #0000 .input STZ2
+ ;draw-display JSR2
+ ;update-input ( .. )
+
+JMP2
+
+@tog-mode ( -- )
+
+ ;buttons/mode ;press-button JSR2
+ .mode/dec LDZk INC #01 AND SWP STZ
+ .mode/dot LDZk .mode/dec LDZ #00 EQU ADD #01 AND SWP STZ
+ ;draw-display JSR2
+ ;draw-mode ( .. )
+
+JMP2
+
+@set-dec ( -- )
+
+ #01 .mode/dec STZ
+ ;draw-display JSR2
+ ;draw-mode ( .. )
+
+JMP2
+
+@set-hex ( -- )
+
+ #00 .mode/dec STZ
+ ;draw-display JSR2
+ ;draw-mode ( .. )
+
+JMP2
+
+@set-sel ( x y -- )
+
+ ( erase last sel )
+ #00 ;draw-sel JSR2
+ #40 ;draw-cursor JSR2
+
+ ( store new sel )
+ #03 AND .cursor/dy STZ
+ #07 AND .cursor/dx STZ
+
+ ( draw new sel )
+ #81 ;draw-sel ( .. )
+
+JMP2
+
+@press-sel ( -- )
+
+ #00 .cursor/d LDZ2 #30 SFT ADD #20 SFT2
+ ;layout ADD2 INC2 INC2 LDA2 ( .. )
+
+JMP2
+
+@gcd ( num* den* -- d* ) ORAk ,&ok JCN POP2 JMP2r &ok SWP2 OVR2 ( MOD2 ) [ DIV2k MUL2 SUB2 ] ,gcd JMP
+
+@push ( num* den* -- )
+
+ OVR2 #0000 EQU2 ,&invalid JCN
+ ORAk #00 EQU ,&invalid JCN
+ ( reduce )
+ OVR2 OVR2 ,gcd JSR STH2k DIV2 SWP2 STH2r DIV2
+ ( store )
+ .length LDZ2 #20 SFT2 ;memory ADD2 STH2k STA2
+ STH2r INC2 INC2 STA2
+ .length LDZ2k INC2 ROT STZ2
+
+JMP2r
+ &invalid POP2 POP2 JMP2r
+
+@pop ( -- num* den* )
+
+ .length LDZ2 #01 SUB #20 SFT2 ;memory ADD2
+ LDA2k SWP2 INC2 INC2 LDA2
+ .length LDZ2k #0001 SUB2 ROT STZ2
+
+JMP2r
+
+(
+@|operations )
+
+@dup ( -- )
+
+ ;buttons/dup ;press-button JSR2
+ ;eval JSR2
+ .length LDZ2 ORA #01 JCN JMP2r
+
+ ;pop JSR2 OVR2 OVR2 ;push JSR2 ;push JSR2
+ ;draw-display ( .. )
+
+JMP2
+
+@swp ( -- )
+
+ ;buttons/swp ;press-button JSR2
+ ;eval JSR2
+ .length LDZ2 #0002 LTH2 ,&skip JCN
+
+ ;pop JSR2 ;pop JSR2 ROT2 STH2 ROT2 STH2r ;push JSR2 ;push JSR2
+ ;draw-display JSR2
+ &skip
+
+JMP2r
+
+@vid ( -- )
+
+ ;buttons/vid ;press-button JSR2
+ ;eval JSR2
+ .length LDZ2 ORA #01 JCN JMP2r
+ .length LDZ2 #20 SFT2 #0002 SUB2 ;memory ADD2 LDA2 #0001 EQU2 ,&skip JCN
+
+ ;pop JSR2 SWP2 #0001 ;push JSR2
+ #0001 ;push JSR2
+ ;draw-display JSR2
+ &skip
+
+JMP2r
+
+@inv ( -- )
+
+ ;buttons/inv ;press-button JSR2
+ ;eval JSR2
+ .length LDZ2 ORA #01 JCN JMP2r
+
+ ;pop JSR2 SWP2 ;push JSR2
+ ;draw-display ( .. )
+
+JMP2
+
+@add ( -- )
+
+ ;buttons/add ;press-button JSR2
+ ;eval JSR2
+ .length LDZ2 #0002 LTH2 ,&skip JCN
+
+ ;pop JSR2 ,&bd STR2 ,&bn STR2
+ ;pop JSR2 ,&ad STR2 ,&an STR2
+ [ LIT2 &an $2 ] [ LIT2 &bd $2 ] MUL2
+ [ LIT2 &ad $2 ] [ LIT2 &bn $2 ] MUL2 ADD2
+ ,&ad LDR2 ,&bd LDR2 MUL2 ;push JSR2
+ ;draw-display JSR2
+ &skip
+
+JMP2r
+
+@sub ( -- )
+
+ ;buttons/sub ;press-button JSR2
+ ;eval JSR2
+ .length LDZ2 #0002 LTH2 ,&skip JCN
+
+ ;pop JSR2 ,&bd STR2 ,&bn STR2
+ ;pop JSR2 ,&ad STR2 ,&an STR2
+ [ LIT2 &an $2 ] [ LIT2 &bd $2 ] MUL2
+ [ LIT2 &ad $2 ] [ LIT2 &bn $2 ] MUL2 SUB2
+ ,&ad LDR2 ,&bd LDR2 MUL2 ;push JSR2
+ ;draw-display JSR2
+ &skip
+
+JMP2r
+
+@mul ( -- )
+
+ ;buttons/mul ;press-button JSR2
+ ;eval JSR2
+ .length LDZ2 #0002 LTH2 ,&skip JCN
+
+ ;pop JSR2 ,&bd STR2 ,&bn STR2
+ ;pop JSR2 ,&ad STR2 ,&an STR2
+ [ LIT2 &an $2 ] [ LIT2 &bn $2 ] MUL2
+ [ LIT2 &ad $2 ] [ LIT2 &bd $2 ] MUL2
+ ;push JSR2
+ ;draw-display JSR2
+ &skip
+
+JMP2r
+
+@div ( -- )
+
+ ;buttons/div ;press-button JSR2
+ ;eval JSR2
+ .length LDZ2 #0002 LTH2 ,&skip JCN
+
+ ;pop JSR2 ,&bd STR2 ,&bn STR2
+ ;pop JSR2 ,&ad STR2 ,&an STR2
+ [ LIT2 &an $2 ] [ LIT2 &bd $2 ] MUL2
+ [ LIT2 &ad $2 ] [ LIT2 &bn $2 ] MUL2
+ ;push JSR2
+ ;draw-display JSR2
+ &skip
+
+JMP2r
+
+@and ( -- )
+
+ ;buttons/and ;press-button JSR2
+ ;eval JSR2
+ .length LDZ2 #0002 LTH2 ,&skip JCN
+
+ ;pop JSR2 ,&bd STR2 ,&bn STR2
+ ;pop JSR2 ,&ad STR2 ,&an STR2
+ [ LIT2 &an $2 ] [ LIT2 &bd $2 ] MUL2
+ [ LIT2 &ad $2 ] [ LIT2 &bn $2 ] MUL2 AND2
+ ,&ad LDR2 ,&bd LDR2 MUL2 ;push JSR2
+ ;draw-display JSR2
+ &skip
+
+JMP2r
+
+@ora ( -- )
+
+ ;buttons/ora ;press-button JSR2
+ ;eval JSR2
+ .length LDZ2 #0002 LTH2 ,&skip JCN
+
+ ;pop JSR2 ,&bd STR2 ,&bn STR2
+ ;pop JSR2 ,&ad STR2 ,&an STR2
+ [ LIT2 &an $2 ] [ LIT2 &bd $2 ] MUL2
+ [ LIT2 &ad $2 ] [ LIT2 &bn $2 ] MUL2 ORA2
+ ,&ad LDR2 ,&bd LDR2 MUL2 ;push JSR2
+ ;draw-display JSR2
+ &skip
+
+JMP2r
+
+@sfl ( -- )
+
+ ;buttons/sfl ;press-button JSR2
+ ;eval JSR2
+ .length LDZ2 ORA #01 JCN JMP2r
+
+ ;pop JSR2 SWP2 DUP2 ADD2 SWP2 ;push JSR2
+ ;draw-display ( .. )
+
+JMP2
+
+@sfr ( -- )
+
+ ;buttons/sfr ;press-button JSR2
+ ;eval JSR2
+ .length LDZ2 ORA #01 JCN JMP2r
+
+ ;pop JSR2 SWP2 #01 SFT2 SWP2 ;push JSR2
+ ;draw-display ( .. )
+
+JMP2
+
+@put0 ( -- )
+ ;buttons/0 ;press-button JSR2
+ #0b ;play-note JSR2
+ #00 ;append JMP2
+@put1 ( -- )
+ ;buttons/1 ;press-button JSR2
+ #0c ;play-note JSR2
+ #01 ;append JMP2
+@put2 ( -- )
+ ;buttons/2 ;press-button JSR2
+ #0e ;play-note JSR2
+ #02 ;append JMP2
+@put3 ( -- )
+ ;buttons/3 ;press-button JSR2
+ #10 ;play-note JSR2
+ #03 ;append JMP2
+@put4 ( -- )
+ ;buttons/4 ;press-button JSR2
+ #11 ;play-note JSR2
+ #04 ;append JMP2
+@put5 ( -- )
+ ;buttons/5 ;press-button JSR2
+ #13 ;play-note JSR2
+ #05 ;append JMP2
+@put6 ( -- )
+ ;buttons/6 ;press-button JSR2
+ #15 ;play-note JSR2
+ #06 ;append JMP2
+@put7 ( -- )
+ ;buttons/7 ;press-button JSR2
+ #17 ;play-note JSR2
+ #07 ;append JMP2
+@put8 ( -- )
+ ;buttons/8 ;press-button JSR2
+ #18 ;play-note JSR2
+ #08 ;append JMP2
+@put9 ( -- )
+ ;buttons/9 ;press-button JSR2
+ #1a ;play-note JSR2
+ #09 ;append JMP2
+@puta ( -- )
+ ;buttons/a ;press-button JSR2
+ #09 ;play-note JSR2
+ #0a ;append JMP2
+@putb ( -- )
+ ;buttons/b ;press-button JSR2
+ #07 ;play-note JSR2
+ #0b ;append JMP2
+@putc ( -- )
+ ;buttons/c ;press-button JSR2
+ #21 ;play-note JSR2
+ #0c ;append JMP2
+@putd ( -- )
+ ;buttons/d ;press-button JSR2
+ #1f ;play-note JSR2
+ #0d ;append JMP2
+@pute ( -- )
+ ;buttons/e ;press-button JSR2
+ #1d ;play-note JSR2
+ #0e ;append JMP2
+@putf ( -- )
+ ;buttons/f ;press-button JSR2
+ #1c ;play-note JSR2
+ #0f ;append JMP2
+
+@press-button ( button* -- )
+
+ ( set timer )
+ DUP2 #0008 ADD2 #04 ROT ROT STA
+ #01
+ &release ( button* state -- )
+ STH
+ LDA2k .Screen/x DEO2
+ INC2 INC2 LDA2k .Screen/y DEO2
+ INC2 INC2 LDA2k ( icon )
+ SWP2 INC2 INC2 LDA2 STHr ROT ROT ( .. )
+
+JMP2
+
+@play-note ( pitch -- )
+
+ #24 ADD .Audio0/pitch DEO
+
+JMP2r
+
+(
+@|drawing )
+
+@redraw ( -- )
+
+ #04 ;buttons/ctl ;draw-pad JSR2
+ #08 ;buttons/mod ;draw-pad JSR2
+ #04 ;buttons/wst ;draw-pad JSR2
+ #10 ;buttons/num ;draw-pad JSR2
+ ;draw-mode JSR2
+ ;draw-display JSR2
+ ;update-input JSR2
+
+ ( frame )
+ #0000 DUP2
+ #1a
+ .Screen/height DEI2 #03 SFT2 NIP #02 SUB
+ ;outline-frame
+ ;draw-frame JSR2
+
+ ( decal )
+ #16 .Screen/auto DEO
+ #0018 .Screen/x DEO2
+ #0003 .Screen/y DEO2
+ ;decal-icn .Screen/addr DEO2
+ #01 .Screen/sprite DEO
+
+ ( logo )
+ #01 .Screen/auto DEO
+ #00b0 .Screen/x DEO2
+ .Screen/height DEI2 #000a SUB2 .Screen/y DEO2
+ ;logo-icn .Screen/addr DEO2
+ #01 .Screen/sprite DEOk DEOk DEOk DEO
+
+JMP2r
+
+@update-input ( -- )
+
+ #11 .Screen/auto DEO
+ #0018 .Screen/x DEO2
+ #0050 .Screen/y DEO2
+ ;fill-icn .Screen/addr DEO2
+
+ #1600
+ &loop
+ #01 .Screen/sprite DEO
+ INC GTHk ,&loop JCN
+ POP2
+
+@draw-input ( -- )
+
+ &res
+ #0018 .Screen/x DEO2
+ #0050 .Screen/y DEO2
+ #04 ;draw-num/color STA
+ ;input ;draw-fraction JSR2
+
+ ( draw binary )
+
+ #05 .Screen/auto DEO
+ #0038 .Screen/x DEO2
+ #006c .Screen/y DEO2
+
+ #1000
+ &loop
+ #0f OVR SUB .input LDZ2 ROT SFT2
+ #0001 AND2 #30 SFT2 ;binary-icns ADD2 .Screen/addr DEO2
+ #01 .Screen/sprite DEO
+ INCk #03 AND ,&no-space JCN
+ .Screen/x DEI2k #0008 ADD2 ROT DEO2
+ &no-space
+ INC GTHk ,&loop JCN
+ POP2
+
+JMP2r
+
+@draw-display ( -- )
+
+ #0010 DUP2 #1609 ;display-frame ;draw-frame JSR2
+ #0018 .Screen/x DEO2
+ #0018 .Screen/y DEO2
+ #1606 ;fill-icn #01 ;draw-patt JSR2
+
+ #0018 .Screen/x DEO2
+ #16 ;draw-dotted JSR2
+
+ #06 ;draw-num/color STA
+ ( memory )
+ #0300
+ &loop
+ #00 OVR INC .length LDZ2 GTH2 ,&end JCN
+ #0018 .Screen/x DEO2
+ #00 OVR #40 SFT2 #0038 SWP2 SUB2 .Screen/y DEO2
+ #00 OVR INC .length LDZ2 SWP2 SUB2 #20 SFT2 ;memory ADD2 ;draw-fraction JSR2
+ INC GTHk ,&loop JCN
+ &end
+ POP2
+
+JMP2r
+
+@draw-mode ( -- )
+
+ #05 .Screen/auto DEO
+ #0010 .Screen/x DEO2
+ #006c .Screen/y DEO2
+ #00 .mode/dec LDZ #40 SFT2 ;mode-icns ADD2 .Screen/addr DEO2
+ #01 .Screen/sprite DEOk DEO
+ #00 .mode/dot LDZ #30 SFT2 ;mode-icns/dot ADD2 .Screen/addr DEO2
+ #01 .Screen/sprite DEO
+
+JMP2r
+
+@draw-patt ( w h patt* color -- )
+
+ ,&color STR
+ .Screen/addr DEO2
+ .Screen/x DEI2 ,&x STR2
+ #01 .Screen/auto DEO
+ SWP STH
+ #00
+ &hloop
+ [ LIT2 &x $2 ] .Screen/x DEO2
+ STHkr #00
+ &wloop
+ [ LIT &color 0f ] .Screen/sprite DEO
+ INC GTHk ,&wloop JCN
+ POP2
+ .Screen/y DEI2k #0008 ADD2 ROT DEO2
+ INC GTHk ,&hloop JCN
+ POP2
+ POPr
+ ,&x LDR2 .Screen/x DEO2
+ #00 .Screen/auto DEO
+
+JMP2r
+
+@draw-pad ( length sprites* -- )
+
+ STH2
+ #00
+ &loop
+ #00 OVR #0009 MUL2 STH2kr ADD2 #00 ;press-button/release JSR2
+ INC GTHk ,&loop JCN
+ POP2
+ POP2r
+
+JMP2r
+
+@draw-button-clr ( icon* state -- )
+
+ #09 ,draw-button-small/color STR
+ ,draw-button-small JSR
+ #0b ,draw-button-small/color STR
+
+JMP2r
+
+@draw-button-small ( icon* state -- )
+
+ #00 NEQ STH
+ #26 .Screen/auto DEO
+ ;button-icns/alt ;button-icns/def
+ STHkr [ JMP SWP2 POP2 ] STH2k .Screen/addr DEO2
+ #81 .Screen/sprite DEO
+ STH2r #0060 ADD2 .Screen/addr DEO2
+ #81 .Screen/sprite DEO
+ ( icon )
+ .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
+ .Screen/y DEI2 #000c SUB2 #00 STHkr ADD2 .Screen/y DEO2
+ #00 .Screen/auto DEO
+ .Screen/addr DEO2
+ #09 [ LIT &color 0b ] STHr [ JMP SWP POP ] .Screen/sprite DEOk DEO
+
+JMP2r
+
+@draw-button-tall ( icon* state -- )
+
+ #00 NEQ STH
+ #26 .Screen/auto DEO
+ ;button-icns/alt ;button-icns/def
+ STHkr [ JMP SWP2 POP2 ] STH2k .Screen/addr DEO2
+ #81 .Screen/sprite DEO
+ ( body )
+ #0400
+ &loop
+ STH2kr #0030 ADD2 .Screen/addr DEO2
+ #81 .Screen/sprite DEO
+ INC GTHk ,&loop JCN
+ POP2
+ STH2r #0060 ADD2 .Screen/addr DEO2
+ #81 .Screen/sprite DEO
+ ( icon )
+ .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
+ .Screen/y DEI2 #0010 SUB2 #00 STHkr ADD2 .Screen/y DEO2
+ #00 .Screen/auto DEO
+ .Screen/addr DEO2
+ #090b STHr [ JMP SWP POP ] .Screen/sprite DEOk DEO
+
+JMP2r
+
+@draw-button-hex ( icon* state -- )
+
+ #09 ,draw-button/color STR
+ ,draw-button JSR
+ #0b ,draw-button/color STR
+
+JMP2r
+
+@draw-button ( icon* state -- )
+
+ #00 NEQ STH
+ #26 .Screen/auto DEO
+ ;button-icns/alt ;button-icns/def
+ STHkr [ JMP SWP2 POP2 ] .Screen/addr DEO2
+ #81 .Screen/sprite DEOk DEOk DEO
+ ( icon )
+ .Screen/x DEI2 #0004 ADD2 .Screen/x DEO2
+ .Screen/y DEI2 #0014 SUB2 #00 STHkr ADD2 .Screen/y DEO2
+ #16 .Screen/auto DEO
+ .Screen/addr DEO2
+ #09 [ LIT &color 0b ] STHr [ JMP SWP POP ] .Screen/sprite DEOk DEO
+
+JMP2r
+
+@draw-fraction ( addr* -- )
+
+ #01 .Screen/auto DEO
+ LDA2k SWP2 INC2 INC2 LDA2
+ DUP2 #0001 EQU2 ,&whole JCN
+ GTH2k ,&mixed JCN
+
+&proper ( num* den* -- )
+
+ .mode/dot LDZ ,&proper-dot JCN
+ SWP2 ,draw-value JSR
+ ;draw-slash JSR2
+ ,draw-value ( .. )
+
+JMP
+
+&proper-dot ( num* den* -- )
+
+ #00 ;draw-num JSR2
+ ;draw-dot JSR2
+ SWP2 #03e8 #1000 .mode/dec LDZ [ JMP SWP2 POP2 ] MUL2 SWP2 DIV2
+ ,draw-value ( .. )
+
+JMP
+
+&mixed ( num* den* -- )
+
+ .mode/dot LDZ ,&mixed-dot JCN
+ DIV2k ,draw-value JSR
+ ;draw-quote JSR2
+ STH2k ( MOD2 ) [ DIV2k MUL2 SUB2 ] STH2r
+ ,&proper ( .. )
+
+JMP
+
+&mixed-dot ( num* den* -- )
+
+ DIV2k ,draw-value JSR
+ ;draw-dot JSR2
+ STH2k ( MOD2 ) [ DIV2k MUL2 SUB2 ] STH2r
+ SWP2 #03e8 #1000 .mode/dec LDZ [ JMP SWP2 POP2 ] MUL2 SWP2 DIV2
+ ,draw-value ( .. )
+
+JMP
+
+&whole ( num* den* -- )
+
+ POP2
+
+@draw-value ( short* -- )
+
+ ORAk ,&no-null JCN
+ POP2 #00 ;draw-num JMP2
+ &no-null
+
+ .mode/dec LDZ ,draw-dec JCN
+
+@draw-hex ( short* -- )
+
+ #00 ,&z STR
+ ,&parse JSR
+ ,&parse JSR
+ ,&parse JSR
+ ,&parse JSR POP2
+
+JMP2r
+ &parse
+ OVR #04 SFT DUP [ LIT &z $1 ] EQU ,&skip JCN
+ #ff ,&z STR DUP ;draw-num JSR2
+ &skip
+ POP #40 SFT2
+ JMP2r
+
+@draw-dec ( short* -- )
+
+ #00 ,&z STR
+ #2710 ,&parse JSR
+ #03e8 ,&parse JSR
+ #0064 ,&parse JSR
+ #000a ,&parse JSR
+ NIP
+ &emit
+ DUP [ LIT &z $1 ] EQU ,&skip JCN
+ #ff ,&z STR DUP ;draw-num JSR2
+ &skip
+ POP
+
+JMP2r
+ &parse
+ DIV2k DUP ,&emit JSR MUL2 SUB2
+ JMP2r
+
+@hex-char ( hex -- char )
+
+ #0f AND DUP #09 GTH #27 MUL ADD #30 ADD
+
+JMP2r
+
+@draw-num ( num -- )
+
+ #00 SWP #50 SFT2 ;num-icns ADD2 .Screen/addr DEO2
+ #16 .Screen/auto DEOk DEO
+ [ LIT &color 01 ] .Screen/sprite DEOk DEO
+ .Screen/y DEI2k #0010 SUB2 ROT DEO2
+ .Screen/x DEI2k #000d ADD2 ROT DEO2
+
+JMP2r
+
+@draw-dot ( -- )
+
+ ;dot-icns ,draw-type JMP
+
+@draw-quote ( -- )
+
+ ;quote-icns ,draw-type JMP
+
+@draw-slash ( -- )
+
+ ;slash-icns
+
+@draw-type ( addr* -- )
+
+ .Screen/addr DEO2
+ .Screen/x DEI2k INC2 INC2 INC2 ROT DEO2
+ #15 .Screen/auto DEOk DEO
+ #04 .Screen/sprite DEO
+
+JMP2r
+
+@draw-dotted ( w -- )
+
+ #01 .Screen/auto DEO
+ ;&icn .Screen/addr DEO2
+ #00
+ &loop
+ #04 .Screen/sprite DEO
+ INC GTHk ,&loop JCN
+ POP2
+
+JMP2r
+ &icn 0000 0055 0000 0000
+
+@draw-frame ( x* y* w h sprite* -- )
+
+ .Screen/addr DEO2
+ ,&h STR ,&w STR
+ DUP2 .Screen/y DEO2 ,&y STR2
+ DUP2 .Screen/x DEO2 ,&x STR2
+ #01 .Screen/auto DEO
+ #81 .Screen/sprite DEO
+ ,&next JSR [ LIT &w $1 ] ,&repeat JSR
+ #02 .Screen/auto DEO
+ ,&next JSR #81 .Screen/sprite DEO
+ ,&next JSR [ LIT &h $1 ] ,&repeat JSR
+ ( left )
+ [ LIT2 &y $2 ] #0008 ADD2 .Screen/y DEO2
+ [ LIT2 &x $2 ] .Screen/x DEO2
+ ,&next JSR ,&h LDR ,&repeat JSR
+ #01 .Screen/auto DEO
+ ,&next JSR #81 .Screen/sprite DEO
+ ,&next JSR ,&w LDR ,&repeat JSR
+ ,&next JSR #81 .Screen/sprite DEO
+ ( fill )
+ ,&next JSR
+ ,&x LDR2 #0008 ADD2 .Screen/x DEO2
+ ,&y LDR2 #0008 ADD2 .Screen/y DEO2
+
+JMP2r
+ &next
+ .Screen/addr DEI2k #0010 ADD2 ROT DEO2
+ JMP2r
+ &repeat
+ #00
+ &repeat-loop
+ #81 .Screen/sprite DEO
+ INC GTHk ,&repeat-loop JCN
+ POP2
+ JMP2r
+
+@draw-sel ( color -- )
+
+ #00 .Screen/auto DEO
+ ;dpad-chr .Screen/addr DEO2
+ #00 .cursor/d LDZ2 #30 SFT ADD #20 SFT2
+ ;layout ADD2 LDA2 LDA2k #0008 ADD2 .Screen/x DEO2
+ INC2 INC2 LDA2 #0002 SUB2 .Screen/y DEO2
+ #40 ADD .Screen/sprite DEO
+
+JMP2r
+
+@draw-cursor ( color -- )
+
+ #00 .Screen/auto DEO
+ .cursor/x LDZ2 .Screen/x DEO2
+ .cursor/y LDZ2 .Screen/y DEO2
+ .Screen/sprite DEO
+
+JMP2r
+
+( print )
+
+@print ( -- )
+
+ .length LDZ2 ORA ,&no-empty JCN
+ ;empty-txt ;print-str JSR2 #0a18 DEO
+ JMP2r
+ &no-empty
+
+ .length LDZ2 #0001 SUB2 #20 SFT2 ;memory ADD2
+
+@print-fraction ( addr* -- )
+
+ LDA2k SWP2 INC2 INC2 LDA2
+ DUP2 #0001 EQU2 ,&whole JCN
+ GTH2k ,&mixed JCN
+
+&proper ( num* den* -- )
+
+ SWP2 ,print-value JSR
+ LIT "/ #18 DEO
+ ,print-value JSR #0a18 DEO
+
+JMP2r
+
+&mixed ( num* den* -- )
+
+ DIV2k ,print-value JSR STH2k ( MOD2 ) [ DIV2k MUL2 SUB2 ] STH2r
+ LIT "' #18 DEO ,&proper ( .. )
+
+JMP
+
+&whole ( num* den* -- )
+
+ POP2 ,print-value JSR #0a18 DEO
+
+JMP2r
+
+@print-value ( short* -- )
+
+ ORAk ,&no-null JCN
+ LIT "0 #18 DEO JMP2r
+ &no-null
+
+ .mode/dec LDZ ,print-dec JCN
+
+@print-hex ( short* -- )
+
+ #00 ,&z STR
+ ,&parse JSR
+ ,&parse JSR
+ ,&parse JSR
+ ,&parse JSR POP2
+
+JMP2r
+ &parse
+ OVR #04 SFT DUP [ LIT &z $1 ] EQU ,&skip JCN
+ #ff ,&z STR DUP ;hex-char JSR2 #18 DEO
+ &skip
+ POP #40 SFT2
+ JMP2r
+
+@print-dec ( short* -- )
+
+ #00 ,&z STR
+ #2710 ,&parse JSR
+ #03e8 ,&parse JSR
+ #0064 ,&parse JSR
+ #000a ,&parse JSR
+ NIP
+ &emit
+ DUP [ LIT &z $1 ] EQU ,&skip JCN
+ #ff ,&z STR DUP #30 ADD #18 DEO
+ &skip
+ POP
+
+JMP2r
+ &parse
+ DIV2k DUP ,&emit JSR MUL2 SUB2
+ JMP2r
+
+@print-str ( str* -- )
+
+ &while
+ LDAk #18 DEO
+ INC2 LDAk ,&while JCN
+ POP2
+
+JMP2r
+
+(
+@|ecosystem )
+
+@snarf-paste ( -- )
+
+ ;&snarf-txt .File/name DEO2
+ #0001 .File/length DEO2
+ &stream
+ ;&buf .File/read DEO2
+ .File/success DEI2 #0000 EQU2 ,&end JCN
+ [ LIT &buf 20 ] ;listen JSR2
+ ,&stream JMP
+ &end
+
+JMP2r
+ &snarf-txt ".snarf $1
+
+( theme )
+
+@load-theme ( -- )
+
+ ;&path .File/name DEO2
+ #0002 .File/length DEO2
+ ;&r .File/read DEO2
+ ;&g .File/read DEO2
+ ;&b .File/read DEO2
+ .File/success DEI2 ORA #01 JCN JMP2r
+ LIT2 &r $2 .System/r DEO2
+ LIT2 &g $2 .System/g DEO2
+ LIT2 &b $2 .System/b DEO2
+
+JMP2r
+ &path ".theme $1
+
+(
+@|stdlib )
+
+@empty-txt "Empty 20 "Stack $1
+
+(
+@|tables )
+
+@fncpad
+ :clear :swp :dup :erase :erase :erase
+ :tog-mode :inv :vid :eval :eval :eval
+
+@numpad
+ :put7 :put8 :put9 :putf
+ :put4 :put5 :put6 :pute
+ :put1 :put2 :put3 :putd
+ :put0 :puta :putb :putc
+
+@modpad
+ :div :mul :sub :add
+ :and :ora :sfl :sfr
+
+@keys
+ "~ :clear 09 :tog-mode "? :inv "@ :vid
+ "+ :add "- :sub "* :mul "/ :div
+ "& :and "| :ora "< :sfl "> :sfr
+ 20 :eval 08 :erase "% :swp "" :dup
+ "7 :put7 "8 :put8 "9 :put9 "f :putf
+ "4 :put4 "5 :put5 "6 :put6 "e :pute
+ "1 :put1 "2 :put2 "3 :put3 "d :putd
+ "0 :put0 "a :puta "b :putb "c :putc
+ 0d :eval
+ "! :erase
+ ". :print
+ 1b :clear
+ "# :set-hex
+ "$ :set-dec
+ &end
+
+@layout
+ :buttons/clr :clear
+ :buttons/mode :tog-mode
+ :buttons/7 :put7
+ :buttons/8 :put8
+ :buttons/9 :put9
+ :buttons/f :putf
+ :buttons/div :div
+ :buttons/and :and
+ :buttons/swp :swp
+ :buttons/inv :inv
+ :buttons/4 :put4
+ :buttons/5 :put5
+ :buttons/6 :put6
+ :buttons/e :pute
+ :buttons/mul :mul
+ :buttons/ora :ora
+ :buttons/dup :dup
+ :buttons/vid :vid
+ :buttons/1 :put1
+ :buttons/2 :put2
+ :buttons/3 :put3
+ :buttons/d :putd
+ :buttons/sub :sub
+ :buttons/sfl :sfl
+ :buttons/pop :erase
+ :buttons/push :eval
+ :buttons/0 :put0
+ :buttons/a :puta
+ :buttons/b :putb
+ :buttons/c :putb
+ :buttons/add :add
+ :buttons/sfr :sfr
+
+@buttons ( x* y* icon* size* state )
+ &ctl
+ &clr 0010 0078 :ctl-icns/clr :draw-button-clr 00
+ &swp 0010 0088 :wst-icns/swp :draw-button-small 00
+ &dup 0010 0098 :wst-icns/dup :draw-button-small 00
+ &pop 0010 00a8 :wst-icns/pop :draw-button-tall 00
+ &wst
+ &mode 0028 0078 :ctl-icns/mode :draw-button-small 00
+ &inv 0028 0088 :ctl-icns/inv :draw-button-small 00
+ &vid 0028 0098 :ctl-icns/vid :draw-button-small 00
+ &push 0028 00a8 :wst-icns/push :draw-button-tall 00
+ &num
+ &7 0040 0078 :num-icns/7 :draw-button 00
+ &8 0058 0078 :num-icns/8 :draw-button 00
+ &9 0070 0078 :num-icns/9 :draw-button 00
+ &f 0088 0078 :num-icns/f :draw-button-hex 00
+ &4 0040 0090 :num-icns/4 :draw-button 00
+ &5 0058 0090 :num-icns/5 :draw-button 00
+ &6 0070 0090 :num-icns/6 :draw-button 00
+ &e 0088 0090 :num-icns/e :draw-button-hex 00
+ &1 0040 00a8 :num-icns/1 :draw-button 00
+ &2 0058 00a8 :num-icns/2 :draw-button 00
+ &3 0070 00a8 :num-icns/3 :draw-button 00
+ &d 0088 00a8 :num-icns/d :draw-button-hex 00
+ &0 0040 00c0 :num-icns/0 :draw-button 00
+ &a 0058 00c0 :num-icns/a :draw-button-hex 00
+ &b 0070 00c0 :num-icns/b :draw-button-hex 00
+ &c 0088 00c0 :num-icns/c :draw-button-hex 00
+ &mod
+ &div 00a0 0078 :mod-icns/div :draw-button 00
+ &mul 00a0 0090 :mod-icns/mul :draw-button 00
+ &sub 00a0 00a8 :mod-icns/sub :draw-button 00
+ &add 00a0 00c0 :mod-icns/add :draw-button 00
+ &and 00b8 0078 :mod-icns/and :draw-button 00
+ &ora 00b8 0090 :mod-icns/ora :draw-button 00
+ &sfl 00b8 00a8 :mod-icns/sfl :draw-button 00
+ &sfr 00b8 00c0 :mod-icns/sfr :draw-button 00
+ &end
+
+(
+@|assets )
+
+@cursor-icn
+ 80c0 e0f0 f8e0 1000
+@dpad-chr
+ 0000 ff81 8142 2418 0000 007e 7e3c 1800
+@fill-icn
+ ffff ffff ffff ffff
+@logo-icn
+ 1824 40df 4024 1800
+@patt-icn
+ 8800 2200 8800 2200
+ aa55 aa55 aa55 aa55
+@decal-icn
+ 001c 22c1 0000 0000
+ 0000 0007 8870 0000
+
+@mode-icns
+ ( hex/dec )
+ 0018 7818 1818 7e00
+ 003c 607c 6666 3c00
+ 0018 7818 1818 7e00
+ 003c 6666 6666 3c00
+ &dot
+ ( f )
+ 007e 6060 7c60 6000
+ ( d )
+ 007c 6666 6666 7c00
+
+@binary-icns
+ 003c 6666 6666 3c00
+ 0018 7818 1818 7e00
+
+@button-icns
+ &def
+ 001f 2040 4040 4040 0000 1f3f 3f3f 3f3f
+00ff 0000 0000 0000 0000 ffff ffff ffff
+00f8 0402 0202 0202 0000 f8fc fcfc fcfc
+4040 4040 4040 4040 3f3f 3f3f 3f3f 3f3f
+0000 0000 0000 0000 ffff ffff ffff ffff
+0202 0202 0202 0202 fcfc fcfc fcfc fcfc
+4040 4040 4020 1f00 3f3f 3f3f 1f00 0000
+0000 0000 0000 ff00 ffff ffff ff00 0000
+0202 0202 0204 f800 fcfc fcfc f800 0000
+
+ &alt
+ 001f 2040 4040 4040 0000 001f 3f3f 3f3f
+00ff 0000 0000 0000 0000 00ff ffff ffff
+00f8 0402 0202 0202 0000 00f8 fcfc fcfc
+4040 4040 4040 4040 3f3f 3f3f 3f3f 3f3f
+0000 0000 0000 0000 ffff ffff ffff ffff
+0202 0202 0202 0202 fcfc fcfc fcfc fcfc
+4040 4040 4020 1f00 3f3f 3f3f 3f1f 0000
+0000 0000 0000 ff00 ffff ffff ffff 0000
+0202 0202 0204 f800 fcfc fcfc fcf8 0000
+
+@display-frame
+001f 205f 5f5f 5f5f 0000 1f20 2020 2020
+00ff 00ff ffff ffff 0000 ff00 0000 0000
+00f8 04fa fafa fafa 0000 f804 0404 0404
+fafa fafa fafa fafa 0404 0404 0404 0404
+5f5f 5f5f 5f5f 5f5f 2020 2020 2020 2020
+5f5f 5f5f 5f20 1f00 2020 2020 201f 0000
+ffff ffff ff00 ff00 0000 0000 00ff 0000
+fafa fafa fa04 f800 0404 0404 04f8 0000
+
+
+@outline-frame
+0000 0000 0000 0001 0000 0000 0000 0000
+0000 0000 0000 ff00 0000 0000 0000 0000
+0000 0000 0000 0080 0000 0000 0000 0000
+4040 4040 4040 4040 0000 0000 0000 0000
+0202 0202 0202 0202 0000 0000 0000 0000
+0100 0000 0000 0000 0000 0000 0000 0000
+00ff 0000 0000 0000 0000 0000 0000 0000
+8000 0000 0000 0000 0000 0000 0000 0000
+
+@mod-icns
+ &and
+ 0000 000f 1f18 180f 0000 00e0 e000 00f8
+ 0f18 181f 0f00 0000 f860 60e0 e000 0000
+ &ora
+ 0000 0001 0101 0101 0000 0080 8080 8080
+ 0101 0101 0100 0000 8080 8080 8000 0000
+ &sfl
+ 0000 0006 060c 0c19 0000 0060 60c0 c080
+ 190c 0c06 0600 0000 80c0 c060 6000 0000
+ &sfr
+ 0000 0006 0603 0301 0000 0060 6030 3098
+ 0103 0306 0600 0000 9830 3060 6000 0000
+ &add
+ 0000 0001 0101 011f 0000 0080 8080 80f8
+ 1f01 0101 0100 0000 f880 8080 8000 0000
+ &sub
+ 0000 0000 0000 001f 0000 0000 0000 00f8
+ 1f00 0000 0000 0000 f800 0000 0000 0000
+ &mul
+ 0000 0018 1806 0601 0000 0018 1860 6080
+ 0106 0618 1800 0000 8060 6018 1800 0000
+ &div
+ 0000 0001 0100 001f 0000 0080 8000 00f8
+ 1f00 0001 0100 0000 f800 0080 8000 0000
+
+@ctl-icns
+ &clr 0000 183c 3c18 0000
+ &mode 0000 007f fe00 0000
+ &inv 006c 6666 6666 3600
+ &vid 0033 6666 6666 cc00
+
+@wst-icns
+ &push 0018 3c7e 1818 1800
+ &pop 0018 1818 7e3c 1800
+ &swp 007c 7e02 407e 3e00
+ &dup 003c 6666 6666 6c00
+
+@num-icns
+ &0
+ 0000 000f 1f18 1818 0000 00f0 f818 1818
+ 1818 181f 0f00 0000 1818 18f8 f000 0000
+ &1
+ 0000 0003 0307 0701 0000 0080 8080 8080
+ 0101 0101 0100 0000 8080 8080 8000 0000
+ &2
+ 0000 001f 1f00 000f 0000 00f0 f818 18f8
+ 1f18 181f 1f00 0000 f000 00f8 f800 0000
+ &3
+ 0000 001f 1f00 001f 0000 00f0 f818 18f0
+ 1f00 001f 1f00 0000 f018 18f8 f000 0000
+ &4
+ 0000 0018 1818 181f 0000 0018 1818 18f8
+ 0f00 0000 0000 0000 f818 1818 1800 0000
+ &5
+ 0000 001f 1f18 181f 0000 00f8 f800 00f0
+ 0f00 001f 1f00 0000 f818 18f8 f000 0000
+ &6
+ 0000 0018 1818 181f 0000 0000 0000 00f0
+ 1f18 181f 0f00 0000 f818 18f8 f000 0000
+ &7
+ 0000 001f 1f00 0000 0000 00f8 f818 1830
+ 0000 0000 0000 0000 3060 60c0 c000 0000
+ &8
+ 0000 000f 1f18 180f 0000 00f0 f818 18f0
+ 0f18 181f 0f00 0000 f018 18f8 f000 0000
+ &9
+ 0000 000f 1f18 181f 0000 00f0 f818 18f8
+ 0f00 0000 0000 0000 f818 1818 1800 0000
+ &a
+ 0000 000f 1f18 181f 0000 00f0 f818 18f8
+ 1f18 1818 1800 0000 f818 1818 1800 0000
+ &b
+ 0000 001f 1f18 181f 0000 00f0 f818 18f0
+ 1f18 181f 1f00 0000 f018 18f8 f000 0000
+ &c
+ 0000 000f 1f18 1818 0000 00f8 f800 0000
+ 1818 181f 0f00 0000 0000 00f8 f800 0000
+ &d
+ 0000 001f 1f18 1818 0000 00f0 f818 1818
+ 1818 181f 1f00 0000 1818 18f8 f000 0000
+ &e
+ 0000 001f 1f18 181f 0000 00f8 f800 00f8
+ 1f18 181f 1f00 0000 f800 00f8 f800 0000
+ &f
+ 0000 000f 1f18 181f 0000 00f8 f800 0080
+ 1f18 1818 1800 0000 8000 0000 0000 0000
+
+@slash-icns
+0000 0006 060c 0c18
+1830 3060 6000 0000
+@dot-icns
+0000 0000 0000 0000
+0000 0018 1800 0000
+@quote-icns
+0000 0018 1818 0800
+0000 0000 0000 0000
+
+@tone
+8eae b5b9 c0ce dbdc cdb6 a295 8b80 7364
+5953 5256 585a 5d62 686f 7579 7d7e 8183
+8585 8483 8587 8b96 9d9e 9282 7876 7674
+706b 696c 7479 7d81 8385 898d 8d8d 8c8a
+8a88 8684 8180 7f7e 7d7c 7c7c 7c7c 7a74
+6445 221d 4179 a2b4 b7bc c7d6 ddd5 c0aa
+9b8f 867a 6b5e 5553 5456 585c 6065 6c73
+787c 7e80 8284 8484 8484 8589 919a a098
+897c 7676 7572 6e6a 6b6f 777d 7f81 8587
+8c8e 8e8d 8c8a 8988 8584 817f 7e7d 7e7d
+7c7d 7c7c 786d 5530 1a2d 5e91 aeb7 b9c1
+cfdc dacb b4a0 948b 8072 6458 5354 5558
+5a5e 636a 7076 7a7d 7f82 8484 8584 8485
+878d 969e 9d91 8177 7575 7470 6b69 6c74
+7a7e 8182 8589 8d8e 8e8d 8a8a 8887 8582
+807e 7e7d 7c7c 7c7c 7d7b 7463 4121 1e46
+
+(
+@|memory )
+
+@memory ( den*, num*, den*, num*, .. )
+