(romviz) Added grid

This commit is contained in:
Devine Lu Linvega 2023-04-05 13:21:09 -07:00
parent 07cc62a712
commit 7ef37be67f
1 changed files with 105 additions and 9 deletions

View File

@ -10,6 +10,7 @@
|0000 ( -> ) |0000 ( -> )
@src $40 @src $40
@page $1
|0100 ( -> ) |0100 ( -> )
@ -49,10 +50,22 @@ BRK
&on-mouse-down ( -> ) &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 BRK
(
@|core )
@load-symbols ( -- ) @load-symbols ( -- )
;src ;src
@ -89,31 +102,50 @@ JMP2r
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 ) @|drawing )
@redraw ( -- ) @redraw ( -- )
( bytes ) .page LDZ set-page
draw-clear
#00 .Screen/auto DEO #00 .Screen/auto DEO
;src .File/name DEO2
#0001 .File/length DEO2
;pixel-icn .Screen/addr DEO2 ;pixel-icn .Screen/addr DEO2
LIT2r 0000 LIT2r 0000
&stream &stream
;&buf .File/read DEO2 ;&buf .File/read DEO2
.File/success DEI2 #0000 EQU2 ?&eof .File/success DEI2 #0000 EQU2 ?&eof
[ LIT &buf $1 ] STH2kr draw-cell INC2r [ LIT &buf $1 ] STH2kr
draw-cell INC2r
STH2kr #0000 EQU2 ?&eof STH2kr #0000 EQU2 ?&eof
!&stream &eof !&stream &eof
( size ) ( page )
#0200 .Screen/x DEO2 #01 ;draw-chr/color STA
#01e0 .Screen/x DEO2
#0010 .Screen/y DEO2 #0010 .Screen/y DEO2
#01 .Screen/auto DEO #01 .Screen/auto DEO
.page LDZ draw-byte
( size )
#0200 .Screen/x DEO2
STH2r draw-short STH2r draw-short
( filename ) ( filename )
#0020 .Screen/x DEO2 #0020 .Screen/x DEO2
#0010 .Screen/y DEO2
#01 ;draw-chr/color STA #01 ;draw-chr/color STA
;src ;src
@ -135,6 +167,66 @@ JMP2r
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* -- ) @draw-short ( short* -- )
SWP draw-byte SWP draw-byte
@ -199,6 +291,10 @@ JMP2r
c0c0 0000 0000 0000 ] c0c0 0000 0000 0000 ]
@cursor-icn [ @cursor-icn [
80c0 e0f0 f8e0 1000 ] 80c0 e0f0 f8e0 1000 ]
@linev-icn [
8000 8000 8000 8000 ]
@lineh-icn [
aa00 0000 0000 0000 ]
@font ( atari8 ) [ @font ( atari8 ) [
0000 0000 0000 0000 6060 6060 6000 6000 0000 0000 0000 0000 6060 6060 6000 6000
6666 6600 0000 0000 006c fe6c 6cfe 6c00 6666 6600 0000 0000 006c fe6c 6cfe 6c00