AppleIIAsm-Collection/source/disk1_stdio/T.SUB.TVLINE
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

144 lines
3.4 KiB
Plaintext

*
*``````````````````````````````*
* TVLINE : TEXT VERTICAL LINE *
*- -*
* CREATES A VERTICAL LINE OF *
* TEXT COMPOSED OF THE FILL *
* CHARACTER SPECIFIED AT X. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* LDA (Y-START) *
* PHA *
* LDA (Y-END) *
* PHA *
* LDA (X-POS) *
* PHA *
* LDA (FILL CHAR) *
* PHA *
* JSR TVLINE *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* XPOS START OF LINE (:Y1) *
* XPOS END OF LINE (:Y2) *
* YPOS OF LINE (:X) *
* FILL CHARACTER (:F) *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = END OF LINE *
* X = HORIZONTAL POSITION *
* A = LOW BYTE OF RET ADDR *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
TVLINE
*
** SAVE RETURN ADDRESS
*
PLA
STA RETADR
PLA
STA RETADR+1
*
** GET PARAMETERS
*
PLA
STA :F ; FILL CHAR
PLA
STA :X ; X POS
PLA
STA :Y2 ; END
PLA
STA :Y1 ; START
*
********************************
*
** ERROR CONTROL
*
********************************
*
LDA ERRCTRL
CMP #1
BEQ :CHKERR
JMP :ERREND
:CHKERR
LDA :Y1
CMP :Y2
BCS :ERRTOOHI ; Y1 => Y2
LDA :Y2
CMP #24
BCS :ERRYOVF ; Y VALUE OVERFLOW
LDA :X
CMP #40 ; MAX COLS + 1
BCS :ERRXOVF
LDA :Y1
CMP #24 ; MAX ROWS + 1
BCS :ERRYOVF
JMP :ERREND
:ERRTOOHI
_ERR #:E_SID;#:E_YHI;#:E_DMP1;#:X;#4
JMP :ERREND
:ERRXOVF
_ERR #:E_SID;#:E_XOF;#:E_DMP1;#:X;#4
JMP :ERREND
:ERRYOVF
_ERR #:E_SID;#:E_YOF;#:E_DMP1;#:X;#4
JMP :ERREND
*
********************************
*
:ERREND
*
********************************
*
LDA :Y1
LDY :X
:LOOP
JSR $F847 ; GBASCALC ROUTINE
LDA :F
STA ($26),Y ; PLOT TO SCREEN MEMORY
INC :Y1
LDA :Y1
CMP :Y2 ; IF Y1 < Y2
BNE :LOOP ; LOOP; ELSE, CONTINUE
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA RETADR+1
PHA
LDA RETADR
PHA
*
RTS
*
** DATA
*
:X DS 1
:Y1 DS 1
:Y2 DS 1
:F DS 1
*
:E_SID ASC "TVLINE (TVLIN MACRO)",00
:E_DMP1 ASC "DUMPING X(1) Y1(1) Y2(1) F(1)",00
:E_YHI ASC "Y1 MUST BE LOWER THAN Y2.",00
:E_XOF ASC "X > # OF AVAILABLE COLUMNS.",00
:E_YOF ASC "Y > # OF AVAILABLE ROWS",00
*