mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2025-01-05 03:32:38 +00:00
v1 of stdio.lib finished
This commit is contained in:
parent
b35e9197eb
commit
9c00e86cb2
1930
source/STDIO/STDIO.DEMO.S
Normal file
1930
source/STDIO/STDIO.DEMO.S
Normal file
File diff suppressed because it is too large
Load Diff
53
source/STDIO/T.STDIO.HOOKS
Normal file
53
source/STDIO/T.STDIO.HOOKS
Normal file
@ -0,0 +1,53 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* STDIO.HOOKS.PUT *
|
||||
*- -*
|
||||
* HOOKS TO INPUT/OUTPUT *
|
||||
* ROUTINES IN MONITOR *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
* OUTPUT HOOKS
|
||||
*
|
||||
COUT1 EQU $FDF0 ; FASTER SCREEN OUTPUT
|
||||
COUT EQU $FDED ; MONITOR STD OUTPUT
|
||||
HOME EQU $FC58 ; CLEAR SCREEN, HOME CURSOR
|
||||
VTAB EQU $FC22 ; MONITOR CURSOR POS ROUTINE
|
||||
CURSH EQU $24 ; HPOS OF COUT CURSOR
|
||||
CURSV EQU $25 ; VPOS OF COUT CURSOR
|
||||
WNDLEFT EQU $20 ; SCROLL WINDOW LEFT
|
||||
WNDWIDTH EQU $21 ; SCROLL WINDOW WIDTH
|
||||
WNDTOP EQU $22 ; SCROLL WINDOW TOP
|
||||
WNDBOT EQU $23 ; SCROLL WINDOW BOTTOM
|
||||
TEXTP1 EQU $0400 ; START OF TEXT PAGE 1
|
||||
TEXTP2 EQU $0800 ; START OF TEXT PAGE 2
|
||||
PAGE1 EQU $C054 ; SOFT SWITCH USE PAGE 1
|
||||
PAGE2 EQU $C055 ; SOFT SWITCH USE PAGE 2
|
||||
S80COL EQU $C01F ; READ ONLY; CHECK IF 80C
|
||||
KEYBUFF EQU $0200 ; KEYBUFFER START
|
||||
GSTROBE EQU $C040 ; GAME CONNECTOR STROBE
|
||||
TXTSET EQU $C051 ; TEXT ON SOFT SWITCH
|
||||
SETWND EQU $FB4B ; SET NORMAL WINDOW MODE
|
||||
CURADV EQU $FBF4 ; ADVANCE CURSOR RIGHT
|
||||
CURBS EQU $FC10 ; CURSOR LEFT
|
||||
CURUP EQU $FC1A ; CURSOR UP
|
||||
CR EQU $FC62 ; CARRIAGE RETURN TO SCREEN
|
||||
LF EQU $FC66 ; LINE FEED ONLY TO SCREEN
|
||||
CLEOL EQU $FC9C ; CLEAR TEXT TO END OF LINE
|
||||
*
|
||||
* INPUT HOOKS
|
||||
*
|
||||
KYBD EQU $C000 ; LDA SINGLE KEYPRESS
|
||||
STROBE EQU $C010 ; CLEAR KYBD BUFFER
|
||||
GETLN EQU $FD6F ; MONITOR GET LINE OF KB INPUT
|
||||
GETKEY EQU $FD0C ; MONITOR GET SINGLE KEY INPUT
|
||||
OPAPP EQU $C061
|
||||
CLAPP EQU $C062
|
||||
*
|
||||
* PADDLE HOOKS
|
||||
*
|
||||
PREAD EQU $FB1E ; READ STATE OF PADDLE
|
||||
PB0 EQU $C061 ; PADDLE BUTTON 0
|
||||
PB1 EQU $C062
|
||||
PB2 EQU $C063
|
||||
PB3 EQU $C060
|
||||
*
|
788
source/STDIO/T.STDIO.LIB
Normal file
788
source/STDIO/T.STDIO.LIB
Normal file
@ -0,0 +1,788 @@
|
||||
*
|
||||
JMP STDIOX
|
||||
*
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
* *
|
||||
* STDIO.PUT *
|
||||
* *
|
||||
* AUTHOR: NATHAN RIGGS *
|
||||
* CONTACT: NATHAN.RIGGS@ *
|
||||
* OUTLOOK.COM *
|
||||
* *
|
||||
* VERSION: 0.1.2 *
|
||||
* DATE: 30-OCT-2018 *
|
||||
* ASSEMBLER: MERLIN 8 PRO *
|
||||
* *
|
||||
**** SEE CHANGELOG FOR ****
|
||||
**** HISTORY OF CHANGES ****
|
||||
* *
|
||||
* LICENSE: MIT LICENSE, WHERE *
|
||||
* APPLICABLE. CODE INSPIRED *
|
||||
* BY THE WORKS OF OTHERS MAY *
|
||||
* FALL UNDER A DIFFERENT *
|
||||
* LICENSE (NOTED IN ROUTINE). *
|
||||
* *
|
||||
* STANDARD INPUT / OUTPUT *
|
||||
* LIBRARY. PRIMARILY FOR THE *
|
||||
* APPLE II FAMILY, BUT COULD *
|
||||
* BE PORTED TO OTHER 6502- *
|
||||
* BASED SYSTEMS FAIRLY *
|
||||
* EASILY. *
|
||||
* *
|
||||
*------------------------------*
|
||||
* *
|
||||
* LIST OF ROUTINES *
|
||||
* *
|
||||
* XPRINT : SPECIAL PRINT *
|
||||
* DPRINT : PRINT FROM MEMORY *
|
||||
* THLIN : TEXT LINE HORIZONTAL *
|
||||
* TVLIN : TEXT LINE VERTICAL *
|
||||
* CURSFOR : CURSOR FORWARD *
|
||||
* CURSBAK : CURSOR BACKWARD *
|
||||
* CURSDN : CURSOR DOWN *
|
||||
* CURSUP : CURSOR UP *
|
||||
* TFILLA : TEXT FILL AREA *
|
||||
* SINPUT : STRING INPUT *
|
||||
* GPBX : GET PADDLE BUTTON X *
|
||||
* *
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* XPRINT :: SPECIAL PRINT *
|
||||
*- -*
|
||||
* PRINTS DATA IMMEDIATELY *
|
||||
* FOLLOWING THE JSR TO SPRINT *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: NZC----- REG: AYM- *
|
||||
*- -*
|
||||
* CYCLES: 53+ *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* JSR SPRINT *
|
||||
* ASC "HELLO, WORLD!" *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* A,Y = LOW BYTE OF ADDRESS *
|
||||
* X = UNCHANGED *
|
||||
*- -*
|
||||
* NOTE: PARTIALLY ADOPTED FROM *
|
||||
* ROGER WAGNER'S AND CHRIS *
|
||||
* TORRENCE'S /ASSEMBLY LINES/ *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
XPRINT
|
||||
*
|
||||
** GET CURRENT EXEC ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
LDY #$01 ; POINT TO NEXT
|
||||
; INSTRUCTION
|
||||
:LOOP
|
||||
LDA (ADDR1),Y
|
||||
BEQ :DONE
|
||||
JSR COUT1
|
||||
INY
|
||||
BNE :LOOP
|
||||
:DONE ; RESTORE STACK
|
||||
CLC ; EXEC POINTER
|
||||
TYA ; TO RESUME
|
||||
ADC ADDR1
|
||||
STA ADDR1
|
||||
LDA ADDR1+1
|
||||
ADC #$00
|
||||
PHA
|
||||
LDA ADDR1
|
||||
PHA
|
||||
RTS
|
||||
:EXIT
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* DPRINT :: PRINT FROM MEMORY *
|
||||
*- -*
|
||||
* PRINTS DATA FROM SPECIFIED *
|
||||
* MEMORY LOCATION UNTIL *
|
||||
* REACHING 00 (STRING TERM). *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: -------- REG: A-YM *
|
||||
*- -*
|
||||
* CYCLES: 25+ *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* LDA #>(ADDRESS) *
|
||||
* PHA *
|
||||
* LDA #<(ADDRESS) *
|
||||
* PHA *
|
||||
* JSR DPRINT *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* LOW BYTE OF PRINT ADDRESS *
|
||||
* HI BYTE OF PRINT ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* A = LOW BYTE OF ADDRESS *
|
||||
* X = UNCHANGED *
|
||||
* Y = LENGTH OF PRINTED *
|
||||
* STRING *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
DPRINT
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA :RETADR
|
||||
PLA
|
||||
STA :RETADR+1
|
||||
*
|
||||
** GET ADDRESS, STORE IN ZERO PAGE
|
||||
*
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
LDY #$00
|
||||
:LOOP
|
||||
LDA (ADDR1),Y
|
||||
BEQ :EXIT
|
||||
JSR COUT1
|
||||
INY
|
||||
BNE :LOOP
|
||||
:EXIT
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA :RETADR+1
|
||||
PHA
|
||||
LDA :RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:RETADR DS 2
|
||||
*
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* THLIN :: TEXT HORIZ LINE *
|
||||
*- -*
|
||||
* CREATES A HORIZONTAL LINE OF *
|
||||
* TEXT COMPOSED OF THE FILL *
|
||||
* CHARACTER SPECIFIED AT Y. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* LDA (X-START) *
|
||||
* PHA *
|
||||
* LDA (X-END) *
|
||||
* PHA *
|
||||
* LDA (Y-POS) *
|
||||
* PHA *
|
||||
* LDA (FILL CHAR) *
|
||||
* PHA *
|
||||
* JSR THLIN *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* XPOS START OF LINE (:X1) *
|
||||
* XPOS END OF LINE (:X2) *
|
||||
* YPOS OF LINE (:Y) *
|
||||
* FILL CHARACTER (:F) *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* X,Y = START,END OF LINE *
|
||||
* A = LOW BYTE OF RET ADDR *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
THLIN
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA :RETADR
|
||||
PLA
|
||||
STA :RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA :F
|
||||
PLA
|
||||
STA :Y
|
||||
PLA
|
||||
STA :X2
|
||||
PLA
|
||||
STA :X1
|
||||
*
|
||||
*
|
||||
LDX :X1 ; LOAD X START POS
|
||||
STX CURSH ; STORE IN CURSH
|
||||
LDY :Y ; LDY Y POS
|
||||
STY CURSV ; STORE IN CURSV
|
||||
JSR VTAB ; MOVE CURSOR
|
||||
LDA :F ; LOAD FILL CHAR
|
||||
LDY :X1 ; LOAD X START POS
|
||||
:LOOP
|
||||
JSR COUT1 ; PRINT FILL CHAR
|
||||
INY ; INCREASE X POS
|
||||
CPY :X2 ; IF LESS THAN X END POS
|
||||
BNE :LOOP ; REPEAT UNTIL DONE
|
||||
:EXIT
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA :RETADR+1
|
||||
PHA
|
||||
LDA :RETADR
|
||||
PHA
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:X1 DS 1
|
||||
:X2 DS 1
|
||||
:Y DS 1
|
||||
:F DS 1 ; FILL CHAR
|
||||
:RETADR DS 2
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* TVLIN :: 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 TVLIN *
|
||||
*- -*
|
||||
* 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 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
TVLIN
|
||||
*
|
||||
** 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
|
||||
*
|
||||
LDX :X
|
||||
LDY :Y1
|
||||
STY CURSV
|
||||
STX CURSH
|
||||
JSR VTAB ; SET CURSOR POS
|
||||
:LOOP
|
||||
JSR COUT1 ; PRINT CHAR
|
||||
LDX :X
|
||||
STX CURSH
|
||||
STY CURSV
|
||||
JSR VTAB ; SET NEW CURSOR POS
|
||||
LDA :F ; RELOAD FILL CHAR
|
||||
INY ; INCREASE COUNTER
|
||||
CPY :Y2 ; IF Y1 < Y2
|
||||
BNE :LOOP ; LOOP; ELSE, CONTINUE
|
||||
:EXIT
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA :RETADR+1
|
||||
PHA
|
||||
LDA :RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:RETADR DS 2
|
||||
:X DS 1
|
||||
:Y1 DS 1
|
||||
:Y2 DS 1
|
||||
:F DS 1
|
||||
*
|
||||
*
|
||||
*``````````````````````````````*
|
||||
*CURSFOR :: MOVE CURSOR FORWD *
|
||||
* *
|
||||
*- -*
|
||||
* FLAGS: NZC----- REG: AYM- *
|
||||
* CYCLES: 20 *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* LDA (AMT TO MOVE) *
|
||||
* JSR CURSFOR *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
CURSFOR
|
||||
CLC
|
||||
ADC CURSH
|
||||
STA CURSH
|
||||
JSR VTAB
|
||||
RTS
|
||||
*
|
||||
*``````````````````````````````*
|
||||
*CURSBAK :: MOVE CURSOR BACKWD *
|
||||
* *
|
||||
*- -*
|
||||
* FLAGS: NZC----- REG: AYM- *
|
||||
* CYCLES: 26 *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* LDA (AMT TO MOVE) *
|
||||
* JSR CURSBAK *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
CURSBAK
|
||||
SEC
|
||||
STA :SCRATCH
|
||||
LDA CURSH
|
||||
SBC :SCRATCH
|
||||
STA CURSH
|
||||
JSR VTAB
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:SCRATCH DS 1
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* CURSDN :: MOVE CURSOR DOWN *
|
||||
* *
|
||||
*- -*
|
||||
* FLAGS: NZC----- REG: AYM- *
|
||||
* CYCLES: 20 *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* LDA (AMT TO MOVE) *
|
||||
* JSR CURSDN *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
CURSDN
|
||||
CLC
|
||||
ADC CURSV
|
||||
STA CURSV
|
||||
JSR VTAB
|
||||
RTS
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* CURSUP :: MOVE CURSOR UP *
|
||||
* *
|
||||
*- -*
|
||||
* FLAGS: NZC----- REG: AYM- *
|
||||
* CYCLES: 26 *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* LDA (AMT TO MOVE) *
|
||||
* JSR CURSUP *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
CURSUP
|
||||
SEC
|
||||
STA :SCRATCH
|
||||
LDA CURSV
|
||||
SBC :SCRATCH
|
||||
STA CURSV
|
||||
JSR VTAB
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:SCRATCH DS 1
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* 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 (RIGHT BOUND) *
|
||||
* PHA *
|
||||
* LDA (TOP 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) *
|
||||
* TOP BOUND (:TOP) *
|
||||
* RIGHT BOUND (:RIGHT) *
|
||||
* 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 *
|
||||
* STRING *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
TFILLA
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA :RETADR
|
||||
PLA
|
||||
STA :RETADR+1
|
||||
*
|
||||
** LOAD PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA :FILL
|
||||
PLA
|
||||
STA :BOTTOM
|
||||
PLA
|
||||
STA :TOP
|
||||
PLA
|
||||
STA :RIGHT
|
||||
PLA
|
||||
STA :LEFT
|
||||
*
|
||||
|
||||
LDY :TOP ; LOAD STARTING Y
|
||||
:LOOPY
|
||||
STY CURSV
|
||||
JSR VTAB ; SET VERTICAL
|
||||
LDX :LEFT ; CURSOR POSITION
|
||||
DEX
|
||||
:LOOPX
|
||||
INX
|
||||
STX CURSH
|
||||
JSR VTAB ; SET HORIZONTAL
|
||||
LDA :FILL
|
||||
JSR COUT1 ; PRINT FILL CHAR
|
||||
CPX :RIGHT ; IF X < RIGHT MAX
|
||||
BNE :LOOPX ; LOOP; ELSE, CONTINUE
|
||||
* ; END X LOOP
|
||||
INY
|
||||
CPY :BOTTOM ; IF Y < BOTTOM MAX
|
||||
BNE :LOOPY ; LOOP; ELSE, CONTINUE
|
||||
*
|
||||
:EXIT
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA :RETADR+1
|
||||
PHA
|
||||
LDA :RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:LEFT DS 1
|
||||
:RIGHT DS 1
|
||||
:BOTTOM DS 1
|
||||
:TOP DS 1
|
||||
:FILL DS 1
|
||||
:RETADR DS 2
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* SINPUT :: SPECIAL INPUT *
|
||||
* *
|
||||
* INPUTS A STRING OF TEXT VIA *
|
||||
* MONITOR HOOKS. MAC 255 CHARS *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ???----- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* LDA #>(ADDRESS) *
|
||||
* PHA *
|
||||
* LDA #<(ADDRESS) *
|
||||
* PHA *
|
||||
* JSR SINPUT *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* LOW BYTE OF INPUT ADDRESS *
|
||||
* HI BYTE OF INPUT ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* A = LOW BYTE OF ADDRESS *
|
||||
* X = LENGTH OF STRING *
|
||||
* Y = LENGTH OF STRING *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
SINPUT
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA :RETADR
|
||||
PLA
|
||||
STA :RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA ADDR1 ; STORE IN ZERO
|
||||
PLA ; PAGE
|
||||
STA ADDR1+1
|
||||
*
|
||||
LDX #$00
|
||||
JSR GETLN
|
||||
STX :STRLEN ; STORE STR LENGTH
|
||||
CPX #0
|
||||
BEQ :EXIT
|
||||
*
|
||||
:INP_CLR
|
||||
LDY #0
|
||||
LDA :STRLEN ; LENGTH OF STRING
|
||||
STA (ADDR1),Y ; PUT LENGTH AT START OF LOC
|
||||
:LOOP
|
||||
LDA KEYBUFF,Y ; PUT STR INTO NEW LOC
|
||||
INY
|
||||
STA (ADDR1),Y
|
||||
CPY :STRLEN ; IF Y < STR LENGTH
|
||||
BNE :LOOP ; LOOP; ELSE, CONTINUE
|
||||
*
|
||||
:EXIT
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA :RETADR+1
|
||||
PHA
|
||||
LDA :RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:STRLEN DS 1
|
||||
:RETADR DS 2
|
||||
*
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* GPBX :: GET PADDLE BUTTON X *
|
||||
* *
|
||||
* GETS STATE OF PADDLE BUTTON *
|
||||
* SPECIFIED AND RET 0, 1 IN A *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ???----- REG: A-YM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* LDA #>(ADDRESS) *
|
||||
* PHA *
|
||||
* LDA #<(ADDRESS) *
|
||||
* PHA *
|
||||
* JSR GPBX *
|
||||
* *
|
||||
* --- WHERE: *
|
||||
* *
|
||||
* BUTTON 0 = $C061 (PB0) *
|
||||
* BUTTON 1 = $CO62 (PB1) *
|
||||
* BUTTON 2 - $C063 (PB2) *
|
||||
* BUTTON 3 = $C060 (PB3) *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* LOW BYTE OF PDL BTN ADDRESS *
|
||||
* HI BYTE OF PDL BTN ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* A = 1 IF PRESSED, 0 IF NOT *
|
||||
* X = UNCHANGED *
|
||||
* Y = GARBAGE *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
* CHANGE THIS LATER TO ACCEPT ALL BUTTONS, 0-4
|
||||
*
|
||||
GBPX
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA :RETADR
|
||||
PLA
|
||||
STA :RETADR+1
|
||||
*
|
||||
** GET PARAMETER
|
||||
*
|
||||
PLA
|
||||
STA ADDR1 ; ZERO PAGE
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
*
|
||||
LDY #$00
|
||||
LDA (ADDR1),Y ; IF BTN = PUSHED
|
||||
BMI :1
|
||||
JMP :0
|
||||
:1
|
||||
LDY #$01 ; BTN PUSHED;A=1
|
||||
JMP :EXIT
|
||||
:0
|
||||
LDY #$00 ; BTN NOT PUSHED;A=0
|
||||
*
|
||||
:EXIT
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA :RETADR+1
|
||||
PHA
|
||||
LDA :RETADR
|
||||
PHA
|
||||
*
|
||||
TYA ; BTN FLAG MOVE TO A
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:RETADR DS 2
|
||||
*
|
||||
STDIOX RTS
|
583
source/STDIO/T.STDIO.MAC
Normal file
583
source/STDIO/T.STDIO.MAC
Normal file
@ -0,0 +1,583 @@
|
||||
*
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
* *
|
||||
* STDIO.MAC *
|
||||
* *
|
||||
* AUTHOR: NATHAN RIGGS *
|
||||
* CONTACT: NATHAN.RIGGS@ *
|
||||
* OUTLOOK.COM *
|
||||
* *
|
||||
* VERSION: 0.1.2 *
|
||||
* DATE: 30-OCT-2018 *
|
||||
* ASSEMBLER: MERLIN 8 PRO *
|
||||
* *
|
||||
**** SEE CHANGELOG FOR ****
|
||||
**** HISTORY OF CHANGES ****
|
||||
* *
|
||||
* LICENSE: MIT LICENSE, WHERE *
|
||||
* APPLICABLE. CODE INSPIRED *
|
||||
* BY THE WORKS OF OTHERS MAY *
|
||||
* FALL UNDER A DIFFERENT *
|
||||
* LICENSE (NOTED IN ROUTINE). *
|
||||
* *
|
||||
*------------------------------*
|
||||
* *
|
||||
* THIS IS A MACRO LIBRARY FOR *
|
||||
* STDIO.LIB, AND CAN BE USED *
|
||||
* REGARDLESS OF WHETHER A *
|
||||
* SPECIFIC FUNCTION IS *
|
||||
* INCLUDED AS A PUT IN THE *
|
||||
* MAIN SOURCE. IT IS INTENDED *
|
||||
* TO SERVE AS A USEFUL SHORT- *
|
||||
* CUT FOR CALLING THE VARIOUS *
|
||||
* ROUTINES. SO, YOU KNOW. LIKE *
|
||||
* A MACRO LIBRARY. *
|
||||
* *
|
||||
*------------------------------*
|
||||
* *
|
||||
* LIST OF MACROS *
|
||||
* *
|
||||
* _TPG1 : SET TEXT PAGE 1 *
|
||||
* _TPG2 : SET TEXT PAGE 2 *
|
||||
* _PRN : FLEXIBLE PRINT *
|
||||
* _PCR : PRINT CARRIAGE RET *
|
||||
* _PLN : PRINT LINE *
|
||||
* _INP : SPECIAL INPUT *
|
||||
* _GKEY : GET SINGLE KEY *
|
||||
* _WKEY : WAIT FOR KEY *
|
||||
* _CXY : SET CURS POS AT X,Y *
|
||||
* _CX : SET CURSOR X *
|
||||
* _CY : SET CURSOR Y *
|
||||
* _CURF : CURSOR FORWARD *
|
||||
* _CURB : CURSOR BACKWARD *
|
||||
* _CURU : CURSOR UP *
|
||||
* _CURD : CURSOR DOWN *
|
||||
* _RCXY : READ CURSOR POSITION *
|
||||
* _PDL : READ PADDLE STATE *
|
||||
* _PBX : READ PDL BTN X *
|
||||
* _TVLN : TEXT VERTICAL LINE *
|
||||
* _THLN : TEXT HORIZ LINE *
|
||||
* _TFIL : TEXT FILL AREA *
|
||||
* *
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _TPG1 : SET TEXT PAGE 1 *
|
||||
* *
|
||||
* SIMPLY SETS TEXT PAGE 1. *
|
||||
* BARELY WORTH BEING A MACRO, *
|
||||
* BUT KEEPING FOR NOW. *
|
||||
*- -*
|
||||
* PARAMETERS: NONE *
|
||||
*- -*
|
||||
* SAMPLE USAGE: _TPG1 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_TPG1 MAC ;SET P1
|
||||
LDA PAGE1
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _TPG2 : SET TEXT PAGE 2 *
|
||||
* *
|
||||
* SIMPLY SETS TEXT PAGE 2. *
|
||||
* BARELY WORTH BEING A MACRO, *
|
||||
* BUT KEEPING FOR NOW. *
|
||||
*- -*
|
||||
* PARAMETERS: NONE *
|
||||
*- -*
|
||||
* SAMPLE USAGE: _TPG2 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_TPG2 MAC ;SET P2
|
||||
LDA PAGE2
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _PRN :: PRINT (NO <CR> ) *
|
||||
*- -*
|
||||
* EITHER PRINTS A STRING OF *
|
||||
* TEXT PROVIDED, OR PRINTS THE *
|
||||
* DATA FOUND AT THE SPECIFIED *
|
||||
* MEMORY LOCATION. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* IF FIRST LETTER OF VAR1 IS *
|
||||
* A QUOTATION MARK, THEN PASS *
|
||||
* CONTROL TO XPRINT. *
|
||||
* *
|
||||
* IF FIRST LETTER OF VAR1 IS *
|
||||
* A DOLLAR SIGN, THEN IT IS A *
|
||||
* MEMORY LOCATION, SO PASS TO *
|
||||
* DPRINT. *
|
||||
* *
|
||||
* IF FIRST LETTER OF VAR1 IS *
|
||||
* AN 'S', THEN A STRING PRINT *
|
||||
* IS BEING INDICATED. VAR2 *
|
||||
* (]2) HOLDS THE ADDRESS TO *
|
||||
* THE STRING; TRANSFER CONTROL *
|
||||
* TO SPRINT. *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* *
|
||||
* _PRN "HELLO!" *
|
||||
* _PRN $300 *
|
||||
* _PRN S;$310 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_PRN MAC
|
||||
*
|
||||
IF ",]1 ; --- IF PARAM=STRING
|
||||
*
|
||||
JSR XPRINT ; SPECIAL PRINT
|
||||
ASC ]1 ; PUT STRING HERE
|
||||
HEX 00 ; STRING TERMINATE
|
||||
*
|
||||
ELSE ; ELSE, PARAM IS
|
||||
; MEMORY LOCATION
|
||||
*
|
||||
LDA #>]1 ; PUSH HIGH BYTE
|
||||
PHA ; TO STACK
|
||||
LDA #<]1 ; PUSH LOW BYTE
|
||||
PHA
|
||||
JSR DPRINT
|
||||
*
|
||||
FIN
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _PCR: PRINT CARRAIGE RETURN *
|
||||
* *
|
||||
* SIMPLY SENDS A CR AND LINE *
|
||||
* FEED TO COUT (OR THE *
|
||||
* EQUIVALENT, ANYHOW). *
|
||||
*- -*
|
||||
* PARAMETERS: NONE *
|
||||
*- -*
|
||||
* SAMPLE USAGE: _PCR *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_PCR MAC
|
||||
LDA #$8D
|
||||
JSR COUT1
|
||||
LDA #$00
|
||||
JSR COUT1
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _PLN: PRINT LINE *
|
||||
* *
|
||||
* PRINTS A STRING OF TEXT FROM *
|
||||
* PARAMETER, PRINTS IT AND *
|
||||
* THEN PRINTS A NEWLINE. *
|
||||
* CURRENTLY, THIS WILL ONLY *
|
||||
* SUPPORT DIRECT PRINTS, NOT *
|
||||
* MEMORY CALLS OR STRINGS. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* VAR1 SHOULD CONTAIN THE *
|
||||
* STRING OF CHARACTERS TO BE *
|
||||
* PRINTED (]1). *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* *
|
||||
* _PLN "HELLO!" *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_PLN MAC
|
||||
JSR XPRINT
|
||||
ASC ]1
|
||||
HEX 8D00
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _INP: INPUT MACRO *
|
||||
* *
|
||||
* INPUTS A STRING FROM KEYBRD *
|
||||
* AND STORES IT AT SPECIFIED *
|
||||
* LOCATION. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* VAR1 (]1) SHOULD CONTAIN THE *
|
||||
* ADDRESS WHERE THE INPUTTED *
|
||||
* STRING WILL BE STORED. *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* *
|
||||
* _INP $6A00 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_INP MAC
|
||||
LDA #>]1 ; HIGH ORDER
|
||||
PHA
|
||||
LDA #<]1 ; LOW ORDER
|
||||
PHA
|
||||
JSR SINPUT
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _GKEY [LOC] : GETKEY *
|
||||
* *
|
||||
* WAITS FOR USER TO PRESS A *
|
||||
* KEY, THEN STORES THAT IN *
|
||||
* THE SPECIFIED LOCATION. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* THE FIRST PARAMETER SHOULD *
|
||||
* HOLD THE ADDRESS WHERE THE *
|
||||
* CHARACTER IS TO BE STORED. *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* *
|
||||
* _GKEY $6A00 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_GKEY MAC
|
||||
LDA #<]1
|
||||
LDX #>]1
|
||||
STX ADDR1+1
|
||||
STA ADDR1
|
||||
JSR GETKEY
|
||||
LDY #$00
|
||||
STA (ADDR1),Y
|
||||
LDA #$00
|
||||
STA STROBE
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* WKEY : WAIT FOR KEYPRESS *
|
||||
* *
|
||||
* SIMPLY LOOPS UNTIL A KEY IS *
|
||||
* PRESSED. KEY VALUE STORED *
|
||||
* IN ACCUMULATOR. *
|
||||
*- -*
|
||||
* PARAMETERS: NONE *
|
||||
*- -*
|
||||
* SAMPLE USAGE: _WKEY *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_WKEY MAC
|
||||
_LOOP LDA KYBD
|
||||
CMP #$80
|
||||
BCC _LOOP
|
||||
STA STROBE
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _CXY: POSITION CURSOR X,Y *
|
||||
*- -*
|
||||
* SETS THE CURSOR POSITION. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* THE FIRST PARAMETER SHOULD *
|
||||
* HOLD THE X POSITION; THE *
|
||||
* SECOND SHOULD HOLD Y. *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* *
|
||||
* _CXY #10;#10 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_CXY MAC
|
||||
LDX ]1
|
||||
LDY ]2
|
||||
STX CURSH
|
||||
STY CURSV
|
||||
JSR VTAB
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
*- _CX: POSITION CURSOR HORIZ -*
|
||||
*- -*
|
||||
* SETS THE HORIZONTAL POSITION *
|
||||
* OF THE TEXT CURSOR. *
|
||||
* NUMBER Y TO MOVE UPWARD. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* FIRST PARAMETER HOLDS X. *
|
||||
*- -*
|
||||
* SAMPLE USAGE: _CX #10 *
|
||||
* *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_CX MAC
|
||||
LDX ]1
|
||||
STX CURSH
|
||||
JSR VTAB
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _CY: POSITION CURSOR VERT *
|
||||
*- -*
|
||||
* SET CURSOR VERTICAL POSITION *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* FIRST PARAMETER HOLDS Y. *
|
||||
*- -*
|
||||
* SAMPLE USAGE: _CY #10 *
|
||||
* *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_CY MAC
|
||||
LDY ]1
|
||||
STY CURSV
|
||||
JSR VTAB
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _CURF : TEXT CURSOR FORWRD *
|
||||
*- -*
|
||||
* MOVES THE CURSOR FORWARD BY *
|
||||
* SPECIFIED AMOUNT. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* FIRST PARAMETER SHOULD HOLD *
|
||||
* NUMBER X TO MOVE FORWARD. *
|
||||
*- -*
|
||||
* SAMPLE USAGE: _CURF #10 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_CURF MAC
|
||||
LDA ]1
|
||||
JSR CURSFOR
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _CURB : TEXT CURSOR BACKWD *
|
||||
*- -*
|
||||
* MOVES THE CURSOR BACKWARD BY *
|
||||
* SPECIFIED AMOUNT. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* FIRST PARAMETER SHOULD HOLD *
|
||||
* NUMBER X TO MOVE BACKWARD. *
|
||||
*- -*
|
||||
* SAMPLE USAGE: _CURB #10 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_CURB MAC
|
||||
LDA ]1
|
||||
JSR CURSBAK
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _CURU : TEXT CURSOR UP *
|
||||
*- -*
|
||||
* MOVES THE CURSOR UP BY *
|
||||
* SPECIFIED AMOUNT. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* FIRST PARAMETER SHOULD HOLD *
|
||||
* NUMBER Y TO MOVE UPWARD. *
|
||||
*- -*
|
||||
* SAMPLE USAGE: _CURU #10 *
|
||||
* *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_CURU MAC
|
||||
LDA ]1
|
||||
JSR CURSUP
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _CURD : TEXT CURSOR DOWN *
|
||||
*- -*
|
||||
* MOVES THE CURSOR DOWN BY *
|
||||
* SPECIFIED AMOUNT. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* FIRST PARAMETER SHOULD HOLD *
|
||||
* THE AMOUNT TO MOVE DOWN IN Y *
|
||||
*- -*
|
||||
* SAMPLE USAGE: #10 *
|
||||
* *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_CURD MAC
|
||||
LDA ]1
|
||||
JSR CURSDN
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _RCXY : READ SCREEN AT XY *
|
||||
*- -*
|
||||
* READ THE CHARACTER AT POS *
|
||||
* X,Y AND LOADS INTO ACCUM *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* PARAMETER 1 SHOULD HOLD THE *
|
||||
* X POSITION ON SCREEN TO BE *
|
||||
* READ, PARAMETER 2 HOLDS Y. *
|
||||
*- -*
|
||||
* SAMPLE USAGE: _RCXY #3;#9 *
|
||||
* *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_RCXY MAC
|
||||
LDA ]1 ; ROW
|
||||
LDY ]2 ; COLUMN
|
||||
JSR $F847 ; NOT SURE ABOUT THIS MAGIC NUM
|
||||
LDA ($26),Y ; LOAD CHAR INTO ACCUM
|
||||
*
|
||||
* THANKS GO TO ERIC JACOBS
|
||||
* IN THE APPLE II ENTHUSIASTS
|
||||
* FACEBOOK GROUP FOR THIS
|
||||
*
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* PADDLE / MOUSE INPUT *
|
||||
*- -*
|
||||
* SIMPLY READS STATE OF PADDLE *
|
||||
* NUMBER [NUM] AND STORES IT *
|
||||
* IN THE Y REGISTER. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* PARAMETER 1 SHOULD HOLD THE *
|
||||
* NUMBER THAT CORRESPONDS TO *
|
||||
* THE PADDLE TO READ. *
|
||||
*- -*
|
||||
* SAMPLE USAGE: _PDL #0 *
|
||||
* *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_PDL MAC ; GET PADDLE VALUE
|
||||
LDX #]1 ; READ PADDLE # ]1 (USUALLY 0)
|
||||
JSR PREAD ; PADDLE READING STORED IN Y
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _PBX : PADDLE BUTTON X *
|
||||
* *
|
||||
* STORE 1 IN ACCUMULATOR IF *
|
||||
* PADDLE BUTTON X IS PRESSED, *
|
||||
* OTHERWISE STORE 0 IN ACCUM. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* PARAMETER1 SHOULD HOLD THE *
|
||||
* ADDRESS OF THE PADDLE BUTTON *
|
||||
* READ. THEY ARE AS FOLLOWS: *
|
||||
* *
|
||||
* PB0: $C061 PB1: $C062 *
|
||||
* PB2: $C063 PB4: $C060 *
|
||||
*- -*
|
||||
* SAMPLE USAGE: _PBX $C061 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_PBX MAC
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
JSR GPBX
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _TVLN : TEXT VERTICAL LINE *
|
||||
*- -*
|
||||
* CREATES A VERTICAL LINE OF *
|
||||
* TEXT AT THE CURRENT CURSOR *
|
||||
* COLUMN CONSISTING OF THE *
|
||||
* SPECIFIED CHARACTER. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* PARAM1 = START OF VLINE, *
|
||||
* PARAM2 = END POS OF VLINE, *
|
||||
* PARAM3 = X POSITION OF LINE, *
|
||||
* PARAM4 = FILL CHARACTER. *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* *
|
||||
* _TVLN #0;#10;#3;#$18 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_TVLN MAC
|
||||
LDA ]1 ; Y START
|
||||
PHA
|
||||
LDA ]2 ; Y END
|
||||
PHA
|
||||
LDA ]3 ; X POSITION
|
||||
PHA
|
||||
LDA ]4 ; CHARACTER
|
||||
PHA
|
||||
JSR TVLIN
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _THLN : TEXT HORIZONTAL LINE *
|
||||
* *
|
||||
* CREATES A HORIZONTAL LINE OF *
|
||||
* TEXT FROM X1,Y TO X2,Y WITH *
|
||||
* THE SPECIFIED CHARACTER. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* PARAM1 = START OF HLINE, *
|
||||
* PARAM2 = END POS OF HLINE, *
|
||||
* PARAM3 = Y POSITION OF LINE, *
|
||||
* PARAM4 = FILL CHARACTER. *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* *
|
||||
* _THLN #0;#10;#12;#$18 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_THLN MAC
|
||||
LDA ]1 ; X START
|
||||
PHA
|
||||
LDA ]2 ; X END
|
||||
PHA
|
||||
LDA ]3 ; Y POS
|
||||
PHA
|
||||
LDA ]4 ; FILL CHAR
|
||||
PHA
|
||||
JSR THLIN
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _TFIL : TEXT FILL (A) -*
|
||||
*- -*
|
||||
* FILL X1,Y1 TO X2,Y2 WITH *
|
||||
* SPECIFIED CHARACTER. *
|
||||
*- -*
|
||||
* PARAMETERS *
|
||||
* *
|
||||
* PARAM1 = LEFT BOUNDARY *
|
||||
* PARAM2 = RIGHT BOUNDARY *
|
||||
* PARAM3 = TOP BOUNDARY *
|
||||
* PARAM4 = BOTTOM BOUNDARY *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* *
|
||||
* _TFIL #0;#10;#0;#10 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_TFIL MAC
|
||||
LDA ]1 ; LEFT BOUNDARY
|
||||
PHA
|
||||
LDA ]2 ; RIGHT BOUNDARY
|
||||
PHA
|
||||
LDA ]3 ; TOP BOUNDARY
|
||||
PHA
|
||||
LDA ]4 ; BOTTOM BOUNDARY
|
||||
PHA
|
||||
LDA ]5 ; FILL CHAR
|
||||
PHA
|
||||
JSR TFILLA
|
||||
<<<
|
||||
*
|
Loading…
Reference in New Issue
Block a user