configurable border pad; either 0000 or 0010

This commit is contained in:
~d6 2023-03-12 18:41:31 -04:00
parent 72ca5d76d1
commit 95cb8da0a9
1 changed files with 19 additions and 13 deletions

View File

@ -121,6 +121,7 @@
( user configuration ) ( user configuration )
@visual-bell $1 @visual-bell $1
@border-pad $2 ( should be 0000 or 0010 )
|0100 |0100
( metadata ) ( metadata )
@ -131,9 +132,12 @@
#0018 .rows STZ2 #0018 .rows STZ2
#0050 .cols STZ2 #0050 .cols STZ2
( #0010 .border-pad STZ2 )
#0000 .border-pad STZ2
( start cursor at origin - including border ) ( start cursor at origin - including border )
#0010 ( border ) .Screen/x DEO2 .border-pad LDZ2 .Screen/x DEO2
#0010 ( border ) .Screen/y DEO2 .border-pad LDZ2 .Screen/y DEO2
( set colors ) ( set colors )
#07bf .System/r DEO2 #07bf .System/r DEO2
@ -194,7 +198,8 @@
#01 .visual-bell STZ #01 .visual-bell STZ
( draw border ) ( draw border )
!draw-border .border-pad LDZ2 ORA ?draw-border
JMP2r
@update-dimensions ( -> ) @update-dimensions ( -> )
( set col-bytes, frequently needed ) ( set col-bytes, frequently needed )
@ -204,9 +209,10 @@
.rows LDZ2 #0001 SUB2 .max-y STZ2 .rows LDZ2 #0001 SUB2 .max-y STZ2
.cols LDZ2 #0001 SUB2 .max-x STZ2 .cols LDZ2 #0001 SUB2 .max-x STZ2
( set screen height/width based on rows/cols ) ( set screen height/width based on rows/cols + border padding )
.cols LDZ2 #30 SFT2 ( width ) #0020 ( 2xborder ) ADD2 .Screen/w DEO2 .border-pad LDZ2 DUP2 ADD2 DUP2
.rows LDZ2 #000c MUL2 ( height ) #0020 ( 2xborder ) ADD2 .Screen/h DEO2 .cols LDZ2 #30 SFT2 ADD2 .Screen/w DEO2
.rows LDZ2 #000c MUL2 ADD2 .Screen/h DEO2
JMP2r JMP2r
@shell "bash 00 "-i 00 00 @shell "bash 00 "-i 00 00
@ -311,9 +317,9 @@
&pointer-ok &pointer-ok
.dirty LDZ #00 EQU ?&done .dirty LDZ #00 EQU ?&done
LIT2r =cells ( [addr*] ) LIT2r =cells ( [addr*] )
.rows LDZ2 #0000 DUP2 #0010 ( border ) ADD2 .Screen/y DEO2 .rows LDZ2 #0000 DUP2 .border-pad LDZ2 ADD2 .Screen/y DEO2
&yloop &yloop
.cols LDZ2 #0000 DUP2 #0010 ( border ) ADD2 .Screen/x DEO2 .cols LDZ2 #0000 DUP2 .border-pad LDZ2 ADD2 .Screen/x DEO2
&xloop &xloop
STH2kr LDA2 draw-cell erase-fg-cell STH2kr LDA2 draw-cell erase-fg-cell
.Screen/x DEI2k #0008 ( width ) ADD2 ROT DEO2 .Screen/x DEI2k #0008 ( width ) ADD2 ROT DEO2
@ -335,8 +341,8 @@
redraw-selection !clear-selection redraw-selection !clear-selection
@screen-to-cell ( row* col* -> ) @screen-to-cell ( row* col* -> )
#30 SFT2 ( width ) #0010 ( border ) ADD2 .Screen/x DEO2 #30 SFT2 ( width ) .border-pad LDZ2 ADD2 .Screen/x DEO2
#000c MUL2 ( height ) #0010 ( border ) ADD2 .Screen/y DEO2 #000c MUL2 ( height ) .border-pad LDZ2 ADD2 .Screen/y DEO2
JMP2r JMP2r
@screen-to-cursor ( -> ) @screen-to-cursor ( -> )
@ -426,16 +432,16 @@
GTH2k ?&xloop ( yn* y* xlim* x+1* [addr+2*] ) GTH2k ?&xloop ( yn* y* xlim* x+1* [addr+2*] )
POP2 POP2 ( yn* y* [addr+2*] ) POP2 POP2 ( yn* y* [addr+2*] )
.Screen/y DEI2k #000c ADD2 ROT DEO2 ( yn* y* [addr+2*] ) .Screen/y DEI2k #000c ADD2 ROT DEO2 ( yn* y* [addr+2*] )
#0010 ( border ) .Screen/x DEO2 ( yn* y* [addr+2*] ) .border-pad LDZ2 .Screen/x DEO2 ( yn* y* [addr+2*] )
LIT2r 0000 INC2 GTH2k ?&yloop ( yn* y+1* [addr+2* 0*] ) LIT2r 0000 INC2 GTH2k ?&yloop ( yn* y+1* [addr+2* 0*] )
POP2 POP2 POP2r POP2r ( ) POP2 POP2 POP2r POP2r ( )
JMP2r ( ) JMP2r ( )
@y-point-to-row ( y* -> row* ) @y-point-to-row ( y* -> row* )
#0010 LTH2k ?&y0 SUB2 #000c DIV2 .max-y LDZ2 !min &y0 POP2 POP2 #0000 JMP2r .border-pad LDZ2 LTH2k ?&y0 SUB2 #000c DIV2 .max-y LDZ2 !min &y0 POP2 POP2 #0000 JMP2r
@x-point-to-col ( x* -> col* ) @x-point-to-col ( x* -> col* )
#0010 LTH2k ?&x0 SUB2 #03 SFT2 .max-x LDZ2 !min &x0 POP2 POP2 #0000 JMP2r #0004 ADD2 .border-pad LDZ2 LTH2k ?&x0 SUB2 #03 SFT2 .max-x LDZ2 !min &x0 POP2 POP2 #0000 JMP2r
@point-to-coord ( x* y* -> row* col* ) @point-to-coord ( x* y* -> row* col* )
y-point-to-row SWP2 !x-point-to-col y-point-to-row SWP2 !x-point-to-col