(romviz) Loading symbols

This commit is contained in:
Devine Lu Linvega 2023-04-05 11:23:41 -07:00
parent 3960d72b57
commit a2be85d2b1
1 changed files with 51 additions and 20 deletions

View File

@ -33,6 +33,7 @@ BRK
#0240
DUP2 .Screen/width DEO2
.Screen/height DEO2
load-symbols
redraw
;on-mouse .Mouse/vector DEO2
@ -48,15 +49,52 @@ BRK
&on-mouse-down ( -> )
( TODO: )
.Mouse/x DEI2 phex #0a18 DEO
BRK
@load-symbols ( -- )
;src
DUP2 scap STH2k ;&ext SWP2 scpy
.File/name DEO2
#8000 .File/length DEO2
;symbols .File/read DEO2
#00 STH2r STA
JMP2r
&ext ".sym $1
@find-symbol ( addr* -- sym* )
,&t STR2
;symbols
&l
LDA2k INC2 [ LIT2 &t $2 ] GTH2 ?&end
INC2k INC2 LDA #00 EQU ?&end
INC2 INC2 scap INC2 !&l
&end
JMP2r
@addr-pos ( addr* -- x* y* )
STH2k
( pixel x ) #000f AND2
( block x ) STH2kr #48 SFT2 ADD2 #00ff AND2
DUP2 ADD2 #0020 ADD2
( pixel y ) STHk2r #04 SFT2 #000f AND2
( block y ) STH2r #4c SFT2 ADD2
DUP2 ADD2 #0020 ADD2
JMP2r
(
@|drawing )
@redraw ( -- )
( bytes )
;src .File/name DEO2
#0001 .File/length DEO2
;pixel-icn .Screen/addr DEO2
@ -69,11 +107,11 @@ BRK
POP2r
( filename )
#0020 .Screen/x DEO2
#0018 .Screen/y DEO2
#08 ;draw-chr/color STA
;src draw-str
#0010 .Screen/y DEO2
#01 ;draw-chr/color STA
;src
JMP2r
!draw-str
@update-cursor ( color addr* -- )
@ -122,13 +160,10 @@ JMP2r
JMP2r
(
@|stdlib )
@draw-cell ( byte addr* -- )
addr-pos .Screen/y DEO2 .Screen/x DEO2
DUP #00 NEQ ?&no-null
DUP ?&no-null
.Screen/sprite DEO JMP2r
&no-null
DUP #20 GTH ?&no-low
@ -141,18 +176,10 @@ JMP2r
JMP2r
@addr-pos ( addr* -- x* y* )
STH2k
( pixel x ) #000f AND2
( block x ) STH2kr #48 SFT2 ADD2 #00ff AND2
#10 SFT2 #0020 ADD2
( pixel y ) STHk2r #04 SFT2 #000f AND2
( block y ) STH2r #4c SFT2 ADD2
#10 SFT2 #0020 ADD2
JMP2r
(
@|stdlib )
@scpy ( src* dst* -- ) OVR2 LDA ?&e POP2 POP2 JMP2r &e STH2 &w LDAk STH2kr STA INC2r INC2 LDAk ?&w POP2 #00 STH2r STA JMP2r
@skey ( key buf -- proc ) OVR #21 LTH ?&eval #00 SWP sput #00 JMP2r &eval POP2 #01 JMP2r
@scap ( str* -- end* ) LDAk #00 NEQ [ JMP JMP2r ] &w INC2 LDAk ?&w JMP2r
@sput ( chr str* -- ) scap INC2k #00 ROT ROT STA STA JMP2r
@ -216,4 +243,8 @@ c060 3018 0c06 0300 3c0c 0c0c 0c0c 3c00
1818 1818 1818 1818 380c 0c06 0c0c 3800
0000 60f2 9e0c 0000 3c42 9985 8599 423c ]
(
@|memory )
@symbols