AppleIIAsm-Collection/source/disk1_stdio/T.SUB.TFILLA
nathanriggs c8cac53c5e Rev 0.4 updates
Massive updates that changes the way most subroutines are handled. Major bugfixes, various utilities added, started higher-level libraries.
2019-04-26 18:49:10 -04:00

175 lines
3.7 KiB
Plaintext

*
*``````````````````````````````*
* TFILLA :: TEXT FILL AREA *
*- -*
* FILLS A RECTANGULAR AREA OF *
* THE SCREEN WITH THE DESIRED *
* CHARACTER. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ???----- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* LDA (LEFT BOUND) *
* PHA *
* LDA (UPPER BOUND) *
* PHA *
* LDA (RIGHT BOUND) *
* PHA *
* LDA (BOTTOM BOUND) *
* PHA *
* LDA (FILL CHAR) *
* PHA *
* JSR TFILLA *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* FILL CHAR (:FILL) *
* BOTTOM BOUND (:BOTTOM) *
* RIGHT BOUND (:RIGHT) *
* TOP BOUND (:TOP) *
* LEFT BOUND (:LEFT) *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* A = LOW BYTE OF ADDRESS *
* X = COUNTER DATA; TRASH *
* Y = COUNTER DATA; TRASH *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
TFILLA
*
** SAVE RETURN ADDRESS
*
PLA
STA RETADR
PLA
STA RETADR+1
*
** LOAD PARAMETERS
*
PLA
STA :F
PLA
STA :Y2
PLA
STA :X2
PLA
STA :YC
STA :Y1
PLA
STA :XC
STA :X1
*
********************************
*
** ERROR CONTROL
*
********************************
*
LDA ERRCTRL
CMP #1
BEQ :CHKERR
JMP :ERREND
:CHKERR
LDA :X1
CMP :X2 ; X1 => X2?
BCS :X1HI
LDA :Y1
CMP :Y2
BCS :Y1HI ; Y1 => Y2?
LDA :X1
CMP #40
BCS :XOVF
LDA :X2
CMP #40
BCS :XOVF
LDA :Y1
CMP #24
BCS :YOVF
LDA :Y2
CMP #24
BCS :YOVF
JMP :ERREND
:X1HI
_ERR #:E_SID;#:E_X1H;#:E_DMP1;#:X1;#7
JMP :ERREND
:Y1HI
_ERR #:E_SID;#:E_Y1H;#:E_DMP1;#:X1;#7
JMP :ERREND
:XOVF
_ERR #:E_SID;#:E_XOF;#:E_DMP1;#:X1;#7
JMP :ERREND
:YOVF
_ERR #:E_SID;#:E_YOF;#:E_DMP1;#:X1;#7
*
********************************
*
:ERREND
*
********************************
*
*
:LP1
LDA :YC
LDY :XC
JSR $F847 ; GBASCALC
LDA :F
STA ($26),Y
LDA :YC
INY
STY :XC
CPY :X2
BNE :LP1
*
LDA :X1
STA :XC
INC :YC
LDA :YC
CMP :Y2
BNE :LP1
*
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA RETADR+1
PHA
LDA RETADR
PHA
*
RTS
*
** DATA
*
:X1 DS 1
:X2 DS 1
:Y1 DS 1
:Y2 DS 1
:XC DS 1
:YC DS 1
:F DS 1
*
:E_SID ASC "TFILLA (TFILL MACRO)",00
:E_DMP1 ASC "DUMPING X1(1) X2(1) Y1(1) Y2(1)"
ASC "XC(1) YC(1) F(1)",00
:E_X1H ASC "X1 MUST BE LOWER THAN X2.",00
:E_Y1H ASC "Y1 MUST BE LOWER THAN Y2.",00
:E_XOF ASC "X <> MIN/MAX COLUMNS.",00
:E_YOF ASC "Y <> MIN/MAX ROWS",00
*