diff --git a/uxn-client/xrxs.tal b/uxn-client/xrxs.tal index 9afd56d..55b8d16 100644 --- a/uxn-client/xrxs.tal +++ b/uxn-client/xrxs.tal @@ -13,8 +13,8 @@ %8** { #30 SFT2 } %8// { #03 SFT2 } %TOS { #00 SWP } %TOB { SWP POP } - %NEXT-TILE { DUP2 #0010 ADD2 } +%GET-USABLE-HEIGHT { .Screen/height DEI2 #0050 #03 SFT2 SWP POP } %RTN { JMP2r } @@ -49,7 +49,8 @@ @list-offset $1 @list-elem-offset $1 @list-elem $32 - +@list-top $1 +@list-height $1 @cart $32 @realm $32 @@ -84,6 +85,7 @@ #00 .ticker STZ #00 .state STZ #20 .anim-speed STZ + GET-USABLE-HEIGHT .list-height STZ CENTER-X .logo-coords/x STZ2 CENTER-Y .logo-coords/y STZ2 @@ -384,22 +386,27 @@ 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 ) DUP2 &loop INC2 LDAk ,&loop JCN 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 @@ -408,7 +415,7 @@ RTN #0040 .Screen/x DEO2 #0028 .Screen/y DEO2 - #01 .list-offset STZ + #00 .list-offset STZ .list-len LDZ2 #0000 &while EQU2k ,&end JCN ( get a character from the list ) DUP2 ;listbuf ADD2 LDA @@ -418,19 +425,22 @@ RTN ( if not newline, store the character and increment the offsets ) DUP #0a EQU ,&inc-line JCN - #00 .list-elem-offset LDZ ;word ADD2 STA - .list-elem-offset LDZ INC .list-elem-offset STZ + ;store-char JSR2 ,&continue JMP ( continue looping ) ( if newline, print the word, increment x, reset y ) ( clear the word and word offsets, increment the buffer offset ) &inc-line #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 .Screen/x DEI2 .Screen/y DEI2 #02 ] ;draw-string JSR2 #0040 .Screen/x DEO2 + &no-draw + .list-offset LDZ INC .list-offset STZ INC-Y #20 #00 &word_clr EQUk ,&end-clr JCN