Minor optimizations

This commit is contained in:
Devine Lu Linvega 2024-02-06 11:18:41 -08:00
parent 2e99a7604c
commit b9cd9bedf5
3 changed files with 13 additions and 13 deletions

View File

@ -622,3 +622,4 @@ HDR yew
000000
000000
000000
HDR ---

View File

@ -622,3 +622,4 @@ HDR yew
0000000
0000000
0000000
HDR ---

View File

@ -15,8 +15,11 @@
#f0b2 .System/b DEO2
#0000 DUP2 .Screen/x DEO2
.Screen/y DEO2
#0040 .Screen/width DEO2
#0060 .Screen/height DEO2
;on-console .Console/vector DEO2
#15 .Screen/auto DEO
[ LIT2 15 -Screen/auto ] DEO
#ffff .id STZ2
BRK
@on-console ( -> )
@ -26,22 +29,18 @@
( #010e DEO ) BRK
@parse-line ( -- )
;buf is-pixels ?new-pixels
;buf LDA DUP [ LIT "0 ] EQU SWP [ LIT "1 ] EQU ORA ?new-pixels
( >> )
@new-glyph ( -- )
.id LDZ2 #0001 SUB2 <draw-glyph>
.id LDZ2 <phex>
#2018 DEO
;buf <pstr>
#0a18 DEO
( clean ) #0000 ;buf STA2
.id LDZ2 <draw-glyph>
.id LDZ2 INC2 .id STZ2
#0000 ;new-pixels/row STA2
#0002 ;new-pixels/row STA2
JMP2r
@new-pixels ( -- )
;buf parse-pixels .id LDZ2 #40 SFT2 ;glyphs ADD2 [ LIT2 &row $2 ] INC2k ,&row STR2
;buf parse-pixels .id LDZ2 #40 SFT2 ;glyphs ADD2 [ LIT2 &row 0002 ] INC2k ,&row STR2
ADD2 STA
( clean ) #0000 ;buf STA2
JMP2r
@ -54,13 +53,12 @@
[ LITr 10 ] SFTr INC2 LDAk ?&w
POP2 STHr JMP2r
@is-pixels ( buf* -- f )
LDA DUP [ LIT "0 ] EQU SWP [ LIT "1 ] EQU ORA JMP2r
@<draw-glyph> ( id* -- )
DUP2 #ffff NEQ2 ?{ POP2 JMP2r }
DUP2 #0007 AND2 #30 SFT2 .Screen/x DEO2
DUP2 #43 SFT2 .Screen/y DEO2
#40 SFT2 ;glyphs ADD2 .Screen/addr DEO2
#07 .Screen/sprite DEO
[ LIT2 01 -Screen/sprite ] DEO
JMP2r
(