start implementing scroll buffer logic for client

This commit is contained in:
Iris Lightshard 2021-09-28 00:11:28 -06:00
parent 308b03a4af
commit 1eb1aedf24
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398

View file

@ -13,8 +13,8 @@
%8** { #30 SFT2 } %8// { #03 SFT2 } %8** { #30 SFT2 } %8// { #03 SFT2 }
%TOS { #00 SWP } %TOB { SWP POP } %TOS { #00 SWP } %TOB { SWP POP }
%NEXT-TILE { DUP2 #0010 ADD2 } %NEXT-TILE { DUP2 #0010 ADD2 }
%GET-USABLE-HEIGHT { .Screen/height DEI2 #0050 #03 SFT2 SWP POP }
%RTN { JMP2r } %RTN { JMP2r }
@ -49,7 +49,8 @@
@list-offset $1 @list-offset $1
@list-elem-offset $1 @list-elem-offset $1
@list-elem $32 @list-elem $32
@list-top $1
@list-height $1
@cart $32 @cart $32
@realm $32 @realm $32
@ -84,6 +85,7 @@
#00 .ticker STZ #00 .ticker STZ
#00 .state STZ #00 .state STZ
#20 .anim-speed STZ #20 .anim-speed STZ
GET-USABLE-HEIGHT .list-height STZ
CENTER-X .logo-coords/x STZ2 CENTER-X .logo-coords/x STZ2
CENTER-Y .logo-coords/y STZ2 CENTER-Y .logo-coords/y STZ2
@ -384,22 +386,27 @@ RTN
RTN RTN
@draw-char ( char x y color -- )
STH ( save color )
.Screen/y DEO2 ( set y )
.Screen/x DEO2 ( set x )
#20 MUL SUB TOS 8** ;font ADD2 .Screen/addr DEO2
STHr .Screen/sprite DEO
RTN
@strlen ( addr -- len ) @strlen ( addr -- len )
DUP2 DUP2
&loop &loop
INC2 LDAk ,&loop JCN INC2 LDAk ,&loop JCN
SWP2 SUB2 SWP2 SUB2
RTN
@store-char ( char -- char )
#00 .list-elem-offset LDZ ;word ADD2 STA
.list-elem-offset LDZ INC .list-elem-offset STZ
RTN
@shouldnt-draw-word ( -- flag )
.list-offset LDZ .list-top LDZ LTH
#00 .list-offset LDZ #00 .list-top LDZ #00 .list-height LDZ ADD2 LTH2
ORA #01 NEQ
RTN RTN
@ -408,7 +415,7 @@ RTN
#0040 .Screen/x DEO2 #0040 .Screen/x DEO2
#0028 .Screen/y DEO2 #0028 .Screen/y DEO2
#01 .list-offset STZ #00 .list-offset STZ
.list-len LDZ2 #0000 &while EQU2k ,&end JCN .list-len LDZ2 #0000 &while EQU2k ,&end JCN
( get a character from the list ) ( get a character from the list )
DUP2 ;listbuf ADD2 LDA DUP2 ;listbuf ADD2 LDA
@ -418,19 +425,22 @@ RTN
( if not newline, store the character and increment the offsets ) ( if not newline, store the character and increment the offsets )
DUP #0a EQU ,&inc-line JCN DUP #0a EQU ,&inc-line JCN
#00 .list-elem-offset LDZ ;word ADD2 STA ;store-char JSR2
.list-elem-offset LDZ INC .list-elem-offset STZ
,&continue JMP ( continue looping ) ,&continue JMP ( continue looping )
( if newline, print the word, increment x, reset y ) ( if newline, print the word, increment x, reset y )
( clear the word and word offsets, increment the buffer offset ) ( clear the word and word offsets, increment the buffer offset )
&inc-line &inc-line
#00 .list-elem-offset LDZ ;word ADD2 STA #00 .list-elem-offset LDZ ;word ADD2 STA
( if the word isn't in the scroll window, don't draw it )
;shouldnt-draw-word JSR2 ,&no-draw JCN
[ ;word [ ;word
.Screen/x DEI2 .Screen/x DEI2
.Screen/y DEI2 .Screen/y DEI2
#02 ] ;draw-string JSR2 #02 ] ;draw-string JSR2
#0040 .Screen/x DEO2 #0040 .Screen/x DEO2
&no-draw
.list-offset LDZ INC .list-offset STZ
INC-Y INC-Y
#20 #00 &word_clr EQUk ,&end-clr JCN #20 #00 &word_clr EQUk ,&end-clr JCN