From 7ef37be67f969b61d77ebc0c4cdfbeec84be932c Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 5 Apr 2023 13:21:09 -0700 Subject: [PATCH] (romviz) Added grid --- gui/romviz/romviz.tal | 114 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 105 insertions(+), 9 deletions(-) diff --git a/gui/romviz/romviz.tal b/gui/romviz/romviz.tal index e56cbe2..c338e8b 100644 --- a/gui/romviz/romviz.tal +++ b/gui/romviz/romviz.tal @@ -10,6 +10,7 @@ |0000 ( -> ) @src $40 + @page $1 |0100 ( -> ) @@ -49,10 +50,22 @@ BRK &on-mouse-down ( -> ) - .Mouse/x DEI2 phex #0a18 DEO + .Mouse/state DEI #01 NEQ ?&no-next + .page LDZk INC SWP STZ + #00 .Mouse/state DEO + redraw + BRK + &no-next + ( prev ) + .page LDZk #01 SUB SWP STZ + #00 .Mouse/state DEO + redraw BRK +( +@|core ) + @load-symbols ( -- ) ;src @@ -89,33 +102,52 @@ JMP2r JMP2r +@set-page ( id -- ) + + ;src .File/name DEO2 + #8000 .File/length DEO2 + #00 EQUk ?&e + &l + #8000 + DUP2 .File/read DEO2 + .File/read DEO2 + INC GTHk ?&l + &e + POP2 + #0001 .File/length DEO2 + +JMP2r + ( @|drawing ) @redraw ( -- ) - ( bytes ) + .page LDZ set-page + draw-clear #00 .Screen/auto DEO - ;src .File/name DEO2 - #0001 .File/length DEO2 ;pixel-icn .Screen/addr DEO2 LIT2r 0000 &stream ;&buf .File/read DEO2 .File/success DEI2 #0000 EQU2 ?&eof - [ LIT &buf $1 ] STH2kr draw-cell INC2r + [ LIT &buf $1 ] STH2kr + draw-cell INC2r STH2kr #0000 EQU2 ?&eof !&stream &eof - ( size ) - #0200 .Screen/x DEO2 + ( page ) + #01 ;draw-chr/color STA + #01e0 .Screen/x DEO2 #0010 .Screen/y DEO2 #01 .Screen/auto DEO + .page LDZ draw-byte + ( size ) + #0200 .Screen/x DEO2 STH2r draw-short ( filename ) #0020 .Screen/x DEO2 - #0010 .Screen/y DEO2 #01 ;draw-chr/color STA - ;src + ;src !draw-str @@ -135,6 +167,66 @@ JMP2r JMP2r +@draw-clear ( -- ) + + #f1 .Screen/auto DEO + #0400 + &v + #0020 .Screen/x DEO2 + #00 OVR #70 SFT2 #0020 ADD2 .Screen/y DEO2 + #c0 &h #00 .Screen/sprite DEO INC DUP ?&h POP + INC GTHk ?&v + POP2 + +@draw-grid ( -- ) + + #0020 + DUP2 .Screen/x DEO2 + .Screen/y DEO2 + #0801 + &v + #00 OVR #60 SFT2 #0020 ADD2 .Screen/x DEO2 + #0020 .Screen/y DEO2 + draw-linev + INC GTHk ?&v POP2 + #0801 + &h + #0020 .Screen/x DEO2 + #00 OVR #60 SFT2 #0020 ADD2 .Screen/y DEO2 + draw-lineh + INC GTHk ?&h POP2 + ( draw labels ) + #0020 .Screen/x DEO2 + #0120 .Screen/y DEO2 + #04 ;draw-chr/color STA + #8000 draw-short + +JMP2r + +@draw-linev ( -- ) + + #02 .Screen/auto DEO + ;linev-icn .Screen/addr DEO2 + #4000 + &v + #05 .Screen/sprite DEO + INC GTHk ?&v + POP2 + +JMP2r + +@draw-lineh ( -- ) + + #01 .Screen/auto DEO + ;lineh-icn .Screen/addr DEO2 + #4000 + &v + #05 .Screen/sprite DEO + INC GTHk ?&v + POP2 + +JMP2r + @draw-short ( short* -- ) SWP draw-byte @@ -199,6 +291,10 @@ JMP2r c0c0 0000 0000 0000 ] @cursor-icn [ 80c0 e0f0 f8e0 1000 ] +@linev-icn [ + 8000 8000 8000 8000 ] +@lineh-icn [ + aa00 0000 0000 0000 ] @font ( atari8 ) [ 0000 0000 0000 0000 6060 6060 6000 6000 6666 6600 0000 0000 006c fe6c 6cfe 6c00