1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-27 04:28:06 +11:00
collapseos/blk/127
Virgil Dupras 6a7c8ae1c8 VE: allow usage on screens narrower than 67 columns
Previously, display would be completely broken. We have yet to add
a way to display the "right" part of a buffer on such smaller
displays.
2020-11-13 15:52:12 -05:00

17 lines
648 B
Plaintext

: contents 16 0 DO large? IF 3 ELSE 0 THEN I 3 + AT-XY
64 I * BLK( + DUP 3 col- + SWAP DO
I C@ 0x20 MAX EMIT LOOP LOOP
large? IF 3 16 gutter THEN ;
: selblk BLK> @ PREVBLK ! BLK@ contents ;
: pos! ( newpos -- ) EDPOS @ PREVPOS !
DUP 0< IF DROP 0 THEN 1023 MIN EDPOS ! ;
: setpos ( -- ) EDPOS @ 64 /MOD
3 + ( header ) SWAP large? IF 3 + ( gutter ) THEN
SWAP AT-XY ;
: cmv ( n -- , char movement ) acc@ * EDPOS @ + pos! ;
: buftype ( buf ln -- )
3 OVER AT-XY KEY DUP EMIT
DUP 0x20 < IF 2DROP DROP EXIT THEN
( buf ln c ) 4 col- nspcs SWAP 4 SWAP AT-XY ( buf c )
SWAP C!+ IN( _zbuf (rdln) IN( SWAP 63 MOVE ;