deleted unnecessary directories

This commit is contained in:
nathanriggs 2018-12-14 21:24:27 -05:00
parent 875dd80998
commit 64a7923a78
28 changed files with 0 additions and 4237 deletions

View File

@ -1,92 +0,0 @@
*``````````````````````````````*
* DELAYMS :: DELAY X MILLISECS *
*- -*
* DELAYS FOR X NUMBER OF *
* MILLISECONDS BY LOOPING *
* THROUGH PRECISELY CALCULATED *
* NUMBER OF CYCLES. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: -XY- *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDY #250 ;1/4 SEC *
* JSR DELAYMS *
*- -*
* ENTRY *
* *
* Y = NUMBER OF MILLISECONDS *
*- -*
* EXIT *
* *
* Y = COUNTER; TRASH *
* X = COUNTER; TRASH *
* A = UNCHANGED *
*- -*
* ADAPTED FROM LEVANTHAL AND *
* WINTHROP'S /6502 ASSEMBLY *
* LANGUAGE ROUTINES/. *
* AS SUCH, THIS MAY NOT FALL *
* UNDER THE APACHE 2.0 LICENSE *
* AGREEMENT, SINCE THE BOOK *
* WAS WRITTEN BEFORE THE *
* LICENSE! *
* *
* THAT SAID, LEVENTHAL WROTE *
* THAT THE PURPOSE OF THE BOOK *
* WAS TO COPY THE SOURCE CODE, *
* AS REINVENTING THE WHEEL IS *
* TEDIOUS, AND HE PLACED NO *
* RESTRICTIONS ON ITS USE. *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
DELAYMS
*
MSCNT EQU $0CA ; 202 TIMES THROUGH DELAY1
; SPECIFIC TO 1.23 MHZ
; SPEED OF APPLE II
:DELAY
CPY #0 ; 2 CYCLES
BEQ :EXIT ; 2C (EXIT IF DEL=0)
NOP ; 2 CYCLES (MAKE OVERHEAD=25C)
*
** IF DELAY IS 1MS THEN GOTO LAST1
** THIS LOGIC IS DESIGNED TO BE
** 5 CYCLES THROUGH EITHER ATH
*
CPY #1 ; 2 CYCLES
BNE :DELAYA ; 3C IF TAKEN, ELSE 2C
JMP :LAST1 ; 3C
*
** DELAY 1 MILLISENCOND TIMES (Y-1)
*
:DELAYA
DEY ; 2C (PREDEC Y)
:DELAY0
LDX #MSCNT ; 2C
:DELAY1
DEX ; 2C
BNE :DELAY1 ; 3C
NOP ; 2C
NOP ; 2C
DEY ; 2C
BNE :DELAY0 ; 3C
:LAST1
*
** DELAY THE LAST TIME 25 CYCLES
** LESS TO TAKE THE CALL, RETURN,
** AND ROUTINE OVERHEAD INTO
** ACCOUNT.
*
LDX #MSCNT-3 ; 2C
:DELAY2
DEX ; 2C
BNE :DELAY2 ; 3C
:EXIT
RTS ; 6C
*

View File

@ -1,168 +0,0 @@
*
********************************
* *
* -< COMMON DEMO )- *
* *
* VERSION 00.00.01 *
* *
* 03/04/1980 *
* *
********************************
* *
* NATHAN D. RIGGS *
* NATHAN.RIGGS@OUTLOOK.COM *
* *
********************************
*
** ASSEMBLER DIRECTIVES
*
CYC AVE
EXP ONLY
DSK COMMON.DEMO
*
*``````````````````````````````*
* TOP INCLUDES (PUTS, MACROS) *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
PUT DECS
USE COMMON.MAC
*
PUT COMMON.HOOKS
*
ORG $6000
*
*``````````````````````````````*
* PROGRAM MAIN BODY *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
*
*
** BIG LUMPS -- HIGH LEVEL CODE
*
*
** MEMFILL DOES ABOUT WHAT ITS NAME
** IMPLIES: IT FILLS A BLOCK OF MEMORY
** WITH A PARTICULAR CHARACTER. TO SEE
** THIS IN ACTION, HEAD OVER TO THE
** MONITOR BEFORE AND AFTER THIS RUNS
** AND TYPE 300L.
*
** THE SAME AS BELOW CAN BE ACCOMPLISHED
** WITH THE FOLLOWING MACRO:
*
** _MFIL $300;#10;#0
*
LDA #>$300 ; AREA TO FILL; HIGH
PHA
LDA #<$300 ; LOW
PHA
LDA #>10
PHA
LDA #<10
PHA
LDA #0 ; FILL CHARACTER
PHA
JSR MEMFILL
*
** MEMMOVE ALSO DOES WHAT IT SAYS: IT MOVES
** A BLOCK OF MEMORY FROM A SOURCE LOCATION
** TO A DESTINATION LOCATION. WE'LL NOW MOVE
** THOSE ZEROES PLACED BY MEMFILL TO ANOTHER
** LOCATION. AGAIN, YOU'LL ONLY SEE THIS
** CHANGE VIA THE MONITOR (CALL-151).
*
*
** THIS CAN ALSO BE DONE WITH THE MACRO:
*
** _MMOV $300;$320;#10
*
LDA #>$300 ; SRC HIGH
PHA
LDA #<$300 ; SRC LOW
PHA
LDA #>$320 ; DEST HIGH
PHA
LDA #<$320 ; DEST LOW
PHA
LDA #>10 ; # OF BYTES TO MOVE
PHA
LDA #<10 ; LOW BYTE
PHA
JSR MEMMOVE
*
** DELAYMS RUNS THROUGH CYCLES OF THE
** 6502 UNTIL A CERTAIN AMOUNT OF TIME
** HAS PASSED.
*
** IN MACRO FORM:
*
** _DLAY #250
** _DLAY #250
** _DLAY #250
** _DLAY #250
*
LDY #250 ; TIME IN MILLISECONDS
; IS PASSED VIA Y
; 250 = 1/4 SECOND
JSR DELAYMS
LDY #250
JSR DELAYMS
LDY #250
JSR DELAYMS
LDY #250
JSR DELAYMS ; = 1 SECOND DELAY
*
** ZSAVE BACKS UP THE "FREE" AREAS OF
** THE ZERO PAGE TO AN ALTERNATE MEMORY
** LOCATION. THIS IS MOSTLY USEFUL WHEN
** YOU KNOW A ROUTINE USES THE ZERO PAGE,
** BUT YOU WANT TO KEEP THE VALUES CURRENTLY
** STORED THERE AFTER CALLING THE ROUTINE.
*
** IN MACRO FORM:
*
** _ZSV $6D00
*
LDA #01
STA $06
LDA #02
STA $07
LDA #03
STA $08
LDA #04
STA $09
LDA #>$6D00
PHA
LDA #<$6D00 ; LOW DEST
PHA
JSR ZSAVE
*
** YOU CAN RESTORE THE ZERO PAGE TO ITS
** PRIOR STATE BY THEN CALLING ZLOAD.
*
** MACRO:
*
** _ZLD $6D00
*
LDA #>$6D00 ; HIGH; SOURCE
PHA
LDA #<$6D00 ; LOW
PHA
JSR ZLOAD
*
*
** LITTLE LUMPS -- MID/LOW LEVEL
*
*
JMP REENTRY
*
*``````````````````````````````*
* BOTTOM INCLUDES *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
*
** BOTTOM INCLUDES
*
PUT COMMON.LIB
*
*

View File

@ -1,15 +0,0 @@
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
* *
* COMMON.LIB HOOKS *
* *
*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
*
PROMPT EQU $33
REENTRY EQU $03D0 ; WARM REENTRY TO DOS
COLDENT EQU $03D3 ; COLD ENTRY TO DOS
SRESET EQU $03F2 ; SOFT RESET
PRNTAX EQU $F941 ; PRINT HEX VALS OF A,X REGISTERS
BELL EQU $FBE4 ; RING MY BELL
IOSAVE EQU $FF4A ; SAVE CURRENT STATE OF REGISTERS
IOREST EQU $FF3F ; RESTORE OLD STATE OF REGISTERS
*

View File

@ -1,780 +0,0 @@
JMP COMMONX
*
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
* *
* COMMON.LIB *
* *
* AUTHOR: NATHAN RIGGS *
* CONTACT: NATHAN.RIGGS@ *
* OUTLOOK.COM *
* *
* VERSION: 0.1.2 *
* DATE: 30-OCT-2018 *
* ASSEMBLER: MERLIN 8 PRO *
* *
* LICENSE: APACHE 2.0 LICENSE *
* WHEN APPLICABLE. CODE *
* INSPIRED BY THE WORKS OF *
* OTHERS MAY FALL UNDER A *
* DIFFERENT LICENSE. *
* *
* COMMON ASM ROUTINES *
* LIBRARY FOR FUNCTIONS SUCH *
* AS MEMORY SWAPPING. *
* *
*------------------------------*
* *
* LIST OF ROUTINES *
* *
* MEMFILL : FILL LOCATION WITH *
* A SINGLE VALUE. *
* *
* MEMMOVE : MOVE A BLOCK OF *
* MEMORY FROM ONE *
* LOC TO ANOTHER. *
* *
* DELAYMS : DELAY FOR A NUMBER *
* OF MILLISECONDS. *
* THIS DEPENDS ON *
* THE ACTUAL SYSTEM *
* BEING USED, SO *
* ISN'T AS EASILY *
* PORTED TO OTHER *
* 6502 SIBLINGS. *
* *
* ZSAVE : SAVE STATE OF FREE *
* ZERO PAGE LOCATIONS *
* AT MEM LOC SPECIFIED *
* *
* ZLOAD : LOAD PREVIOUS SAVED *
* ZERO PAGE VALUES *
* BACK INTO PROPER *
* LOCATION. *
* *
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
*
*``````````````````````````````*
* MEMFILL :: FILL MEMORY LOC *
*- -*
* FILLS A BLOCK OF MEMORY WITH *
* THE SPECIFIED VALUE; USED *
* OFTEN TO CLEAR LARGE BLOCKS. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* LDA #>1024 *
* PHA *
* LDA #<1024 *
* PHA *
* LDA #0 *
* PHA *
* JSR MEMFILL *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* FILL VALUE FOR MEMORY *
* ARRAY SIZE *
* LOW BYTE OF STARTING POINT *
* HIGH BYTE OF STARTING POINT *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = COUNTER; TRASH *
* X = COUNTER; TRASH *
* A = LOW BYTE OF RET ADDR *
*- -*
* ADAPTED FROM LEVANTHAL AND *
* WINTHROP'S /6502 ASSEMBLY *
* LANGUAGE ROUTINES/. *
* AS SUCH, THIS MAY NOT FALL *
* UNDER THE APACHE 2.0 LICENSE *
* AGREEMENT, SINCE THE BOOK *
* WAS WRITTEN BEFORE THE *
* LICENSE! *
* *
* THAT SAID, LEVENTHAL WROTE *
* THAT THE PURPOSE OF THE BOOK *
* WAS TO COPY THE SOURCE CODE, *
* AS REINVENTING THE WHEEL IS *
* TEDIOUS, AND HE PLACED NO *
* RESTRICTIONS ON ITS USE. *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
MEMFILL
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA :VALUE
PLA
STA :ARYSZ
PLA
STA :ARYSZ+1
PLA
STA ADDR1 ; ZERO PAGE POINTER
PLA ; DEFINED IN
STA ADDR1+1 ; DECS
*
** FILL WHOLE PAGES FIRST
*
LDA :VALUE ; GET VAL FOR FILL
LDX :ARYSZ+1 ; X=# OF PAGES TO DO
BEQ :PARTPG ; BRANCH IF HIGHBYTE OF SZ = 0
LDY #0
:FULLPG
STA (ADDR1),Y
INY ; INC TO NEXT BYTE
BNE :FULLPG ; BRANCH IF NOT DONE W/ PAGE
INC ADDR1+1 ; ADVANCE TO NEXT PAGE
DEX
BNE :FULLPG ; BRANCH IF NOT DONE W/ PAGES
*
** DO THE REMAINING PARTIAL PAGE
** REGISTER A STILL CONTAINS VALUE
*
:PARTPG
LDX :ARYSZ ;GET # OF BYTES IN FINAL PAGE
BEQ :EXIT ; BRANCH IF LOW BYTE = 0
LDY #0
:PARTLP
STA (ADDR1),Y ; STORE VAL
INY ; INCREMENT INDEX
DEX ; DECREMENT COUNTER
BNE :PARTLP ; BRANCH IF NOT DONE
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
RTS
*
** DATA
*
:VALUE DS 1 ; FILL VALUE
:ARYSZ DS 2 ; ARRAY SIZE
:RETADR DS 2
*
*``````````````````````````````*
* MEMMOVE :: MOVE MEM BLOCK *
*- -*
* MOVES A SPECIFIED BLOCK OF *
* MEMORY FROM A SOURCE ADDRESS *
* TO A DESTINATION ADDRESS *
* RANGE. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* LDA #>$7000 ; DEST *
* PHA *
* LDA #<$7000 *
* PHA *
* LDA #>1024 *
* PHA *
* LDA #<1024 *
* PHA *
* JSR MEMMOVE *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* NUMBER OF BYTES TO MOVE *
* LOW BYTE OF DESTINATION *
* HIGH BYTE OF DESTINATION *
* LOW BYTE OF SOURCE ADDRESS *
* HIGH BYTE OF SOURCE ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = COUNTER; TRASH *
* X = COUNTER; TRASH *
* A = LOW BYTE OF RET ADDR *
*- -*
* ADAPTED FROM LEVANTHAL AND *
* WINTHROP'S /6502 ASSEMBLY *
* LANGUAGE ROUTINES/. *
* AS SUCH, THIS MAY NOT FALL *
* UNDER THE APACHE 2.0 LICENSE *
* AGREEMENT, SINCE THE BOOK *
* WAS WRITTEN BEFORE THE *
* LICENSE! *
* *
* THAT SAID, LEVENTHAL WROTE *
* THAT THE PURPOSE OF THE BOOK *
* WAS TO COPY THE SOURCE CODE, *
* AS REINVENTING THE WHEEL IS *
* TEDIOUS, AND HE PLACED NO *
* RESTRICTIONS ON ITS USE. *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
MEMMOVE
*
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA :MVELEN
PLA
STA :MVELEN+1
PLA
STA ADDR2 ; ZERO PAGE POINTER
PLA
STA ADDR2+1
PLA
STA ADDR1
PLA
STA ADDR1+1
*
** DETERMINE IF DEST AREA IS
** ABOVE SRC AREA BUT OVERLAPS
** IT. REMEMBER, OVERLAP CAN BE
** MOD 64K. OVERLAP OCCURS IF
** STARTING DEST ADDRESS MINUS
** STARTING SRC ADDRESS (MOD
** 64K) IS LESS THAN NUMBER
** OF BYTES TO MOVE.
*
LDA ADDR2 ;CALC DEST-SRC
SEC
SBC ADDR1
TAX
LDA ADDR2+1
SBC ADDR1+1 ; MOD 64K AUTOMATIC
; -- DISCARD CARRY
TAY
TXA ; CMP WITH # OF BYTES TO MOVE
CMP :MVELEN
TYA
SBC :MVELEN+1
BCS :DOLEFT ; BRANCH IF NO OVERLAP
*
** DEST AREA IS ABOVE SRC AREA
** BUT OVERLAPS IT.
** MOVE FROM HIGHEST ADDR TO
** AVOID DESTROYING DATA
*
JSR :MVERHT
JMP :EXIT
*
** NO PROB DOING ORDINARY MOVE
** STARTING AT LOWEST ADDR
*
:DOLEFT
JSR :MVELEFT
:EXIT
JMP :MREXIT
*
********************************
* SUBROUTINE: MVELEFT *
********************************
*
:MVELEFT
LDY #0 ; ZERO INDEX
LDX :MVELEN+1 ; X=# OF FULL PP TO MOVE
BEQ :MLPART ; IF X=0, DO PARTIAL PAGE
:MLPAGE
LDA (ADDR1),Y
STA (ADDR2),Y ;MOVE ONE BYTE
INY ; NEXT BYTE
BNE :MLPAGE ; CONT UNTIL 256B MOVED
INC ADDR1+1 ; ADV TO NEXT SRC PAGE
INC ADDR2+1 ; ADV NEXT DEST PAGE
DEX ; DEC PAGE COUNT
BNE :MLPAGE ; CONT UNTIL ALL FULL
; PAGES ARE MOVED
:MLPART
LDX :MVELEN ; GET LENGTH OF LAST PAGE
BEQ :MLEXIT ; BR IF LENGTH OF LAST
; PAGE = 0
; REG Y IS 0
:MLLAST
LDA (ADDR1),Y
STA (ADDR2),Y ; MOVE BYTE
INY ; NEXT BYTE
DEX ; DEC COUNTER
BNE :MLLAST ; CONT UNTIL LAST P DONE
:MLEXIT
JMP :MREXIT
*
********************************
* SUBROUTINE: MVERHT *
********************************
*
:MVERHT
*
** MOVE THE PARTIAL PAGE FIRST
*
LDA :MVELEN+1
CLC
ADC ADDR1+1
STA ADDR1+1 ;POINT TO LAST P OF SRC
LDA :MVELEN+1
CLC
ADC ADDR2+1
STA ADDR2+1 ; POINT TO LAST P OF DEST
*
** MOVE THE LAST PARTIAL PAGE FIRST
*
LDY :MVELEN ;GET LENGTH OF LAST PAGE
BEQ :MRPAGE ; IF Y=0 DO THE FULL PAGES
:MR0
DEY ; BACK UP Y TO NEXT BYTE
LDA (ADDR1),Y
STA (ADDR2),Y ; MOVE BYTE
CPY #0
BNE :MR0 ; BR IF NOT DONE W LAST P
:MRPAGE
LDX :MVELEN+1 ; GET BYTE OF COUNT AS P CT
BEQ :MREXIT ; BR IF HYBYTE = 0 (NO FULL P)
:MR1
DEC ADDR1+1 ; BACK UP TO PREV SRC PAGE
DEC ADDR2+1 ; AND DEST
:MR2
DEY ; BACK UP Y TO NEXT BYTE
LDA (ADDR1),Y
STA (ADDR2),Y ; MOVE BYTE
CPY #0
BNE :MR2 ; BR IF NOT DONE W THIS PAGE
DEX
BNE :MR1 BR IF NOT ALL PAGES MOVED
:MREXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
RTS
*
** DATA
*
:RETADR DS 2
:MVELEN DS 2
*
*``````````````````````````````*
* DELAYMS :: DELAY X MILLISECS *
*- -*
* DELAYS FOR X NUMBER OF *
* MILLISECONDS BY LOOPING *
* THROUGH PRECISELY CALCULATED *
* NUMBER OF CYCLES. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: -XY- *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDY #250 ;1/4 SEC *
* JSR DELAYMS *
*- -*
* ENTRY *
* *
* Y = NUMBER OF MILLISECONDS *
*- -*
* EXIT *
* *
* Y = COUNTER; TRASH *
* X = COUNTER; TRASH *
* A = UNCHANGED *
*- -*
* ADAPTED FROM LEVANTHAL AND *
* WINTHROP'S /6502 ASSEMBLY *
* LANGUAGE ROUTINES/. *
* AS SUCH, THIS MAY NOT FALL *
* UNDER THE APACHE 2.0 LICENSE *
* AGREEMENT, SINCE THE BOOK *
* WAS WRITTEN BEFORE THE *
* LICENSE! *
* *
* THAT SAID, LEVENTHAL WROTE *
* THAT THE PURPOSE OF THE BOOK *
* WAS TO COPY THE SOURCE CODE, *
* AS REINVENTING THE WHEEL IS *
* TEDIOUS, AND HE PLACED NO *
* RESTRICTIONS ON ITS USE. *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
DELAYMS
*
MSCNT EQU $0CA ; 202 TIMES THROUGH DELAY1
; SPECIFIC TO 1.23 MHZ
; SPEED OF APPLE II
:DELAY
CPY #0 ; 2 CYCLES
BEQ :EXIT ; 2C (EXIT IF DEL=0)
NOP ; 2 CYCLES (MAKE OVERHEAD=25C)
*
** IF DELAY IS 1MS THEN GOTO LAST1
** THIS LOGIC IS DESIGNED TO BE
** 5 CYCLES THROUGH EITHER ATH
*
CPY #1 ; 2 CYCLES
BNE :DELAYA ; 3C IF TAKEN, ELSE 2C
JMP :LAST1 ; 3C
*
** DELAY 1 MILLISENCOND TIMES (Y-1)
*
:DELAYA
DEY ; 2C (PREDEC Y)
:DELAY0
LDX #MSCNT ; 2C
:DELAY1
DEX ; 2C
BNE :DELAY1 ; 3C
NOP ; 2C
NOP ; 2C
DEY ; 2C
BNE :DELAY0 ; 3C
:LAST1
*
** DELAY THE LAST TIME 25 CYCLES
** LESS TO TAKE THE CALL, RETURN,
** AND ROUTINE OVERHEAD INTO
** ACCOUNT.
*
LDX #MSCNT-3 ; 2C
:DELAY2
DEX ; 2C
BNE :DELAY2 ; 3C
:EXIT
RTS ; 6C
*
*
*``````````````````````````````*
* ZSAVE :: SAVE 0-PAGE FREE *
*- -*
* STORES THE VALUES IN THE *
* LITTLE FREE SPACE ON THE *
* ZERO PAGE AT AN ALTERNATE *
* MEMORY LOCATION TO BE *
* RETRIEVED AND RESTORED AT A *
* LATER POINT. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* JSR ZSAVE *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF DESTINATION *
* HIGH BYTE OF DESTINATION *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = TRASH *
* X = TRASH *
* A = LOW BYTE OF RET ADDR *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
ZSAVE
*
** LOAD ADDR1 ZERO PAGE AREA FIRST,
** SINCE WE'LL BE USING THAT
*
** NOTE THAT THIS SHOULD ALWAYS BE
** $06 AND $07, OR ELSE CODE WILL
** HAVE TO CHANGE.
*
LDX ADDR1
LDY ADDR1+1
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA ADDR1
PLA
STA ADDR1+1
*
** COPY ZERO PAGE TO SPECIFIED
** NON-ZERO LOCATION (ONLY THE
** FREE ONES..)
*
TYA ; STORE ADDR1 VALS
LDY #1 ; FIRST
STA (ADDR1),Y
LDY #0
TXA
STA (ADDR1),Y
LDY #2
LDA $08
STA (ADDR1),Y
INY
LDA $09
STA (ADDR1),Y
INY
LDA $19
STA (ADDR1),Y
INY
LDA $1E
STA (ADDR1),Y
INY
LDA $E3
STA (ADDR1),Y
INY
LDA $EB
STA (ADDR1),Y
INY
LDA $EC
STA (ADDR1),Y
INY
LDA $ED
STA (ADDR1),Y
INY
LDA $EE
STA (ADDR1),Y
INY
LDA $EF
STA (ADDR1),Y
INY
LDA $FA
STA (ADDR1),Y
INY
LDA $FB
STA (ADDR1),Y
INY
LDA $FC
STA (ADDR1),Y
INY
LDA $FD
STA (ADDR1),Y
INY
LDA $FE
STA (ADDR1),Y
INY
LDA $FF
STA (ADDR1),Y
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:RETADR DS 2
*
*``````````````````````````````*
* ZLOAD :: RESTORE 0-PAGE FREE *
*- -*
* RESTORES PREVIOUSLY SAVED *
* ZERO PAGE VALUES FROM *
* HIGHER MEMORY LOCATION. *
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* JSR ZLOAD *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF SOURCE *
* HIGH BYTE OF SOURCE *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
ZLOAD
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA ADDR1
PLA
STA ADDR1+1
*
** COPY ZERO PAGE TO SPECIFIED
** NON-ZERO LOCATION (ONLY THE
** FREE ONES..)
*
LDY #2 ; START 2 AHEAD
LDA (ADDR1),Y ; AND PUT ADDR1
STA $08 ; AREA LAST
INY
LDA (ADDR1),Y
STA $09
INY
LDA (ADDR1),Y
STA $19
INY
LDA (ADDR1),Y
STA $1E
INY
LDA (ADDR1),Y
STA $E3
INY
LDA (ADDR1),Y
STA $EB
INY
LDA (ADDR1),Y
STA $EC
INY
LDA (ADDR1),Y
STA $ED
INY
LDA (ADDR1),Y
STA $EE
INY
LDA (ADDR1),Y
STA $EF
INY
LDA (ADDR1),Y
STA $FA
INY
LDA (ADDR1),Y
STA $FB
INY
LDA (ADDR1),Y
STA $FC
INY
LDA (ADDR1),Y
STA $FD
INY
LDA (ADDR1),Y
STA $FE
INY
LDA (ADDR1),Y
STA $FF
*
** NOW GET ZERO PAGE VALUES
** FOR SPACE OCCUPIED BY ADDR; RETURN IN X,Y
*
LDY #0
LDA (ADDR1),Y
TAX
LDA (ADDR1+1),Y
TAY
STX ADDR1
STY ADDR1+1
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:RETADR DS 2
*
*
COMMONX RTS

View File

@ -1,180 +0,0 @@
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
* *
* COMMON.MAC *
* *
* AUTHOR: NATHAN RIGGS *
* CONTACT: NATHAN.RIGGS@ *
* OUTLOOK.COM *
* *
* VERSION: 0.1.2 *
* DATE: 30-OCT-2018 *
* ASSEMBLER: MERLIN 8 PRO *
* *
* LICENSE: APACHE 2.0 LICENSE, *
* WHERE APPLICABLE. CODE *
* INSPIRED BY OR COPIED FROM *
* OTHERS MAY FALL UNDER A *
* DIFFERENT LICENSE. I WILL *
* DO MY BEST TO NOTIFY SUCH *
* CASES. *
* *
*------------------------------*
* *
* THIS IS A MACRO LIBRARY FOR *
* COMMON.LIB, AND CAN BE USED *
* REGARDLESS OF WHETHER A *
* SPECIFIC FUNCTION IS *
* INCLUDED AS A PUT IN THE *
* MAIN SOURCE. *
* *
*------------------------------*
* *
* LIST OF MACROS *
* *
* _MFIL :: FILL MEMORY BLOCK *
* _MMOV :: MOVE MEMORY BLOCK *
* _BELL :: RING MY BELL *
* _DLAY :: DELAY IN MILLISECS *
* _ZSV :: SAVE FREE ZERO PAGE *
* _ZLD :: LOAD SAVE ZERO PAGE *
* *
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
*
*``````````````````````````````*
* _MFIL :: FILL MEMORY BLOCK *
*- -*
* FILL BLOCK OF MEMORY WITH *
* SPECIFIED VALUE. *
*- -*
* PARAMETERS: *
* *
* PARAM1 = STARTING ADDRESS *
* PARAM2 = LENGTH IN BYTES *
* PARAM3 = FILL VALUE *
*- -*
* SAMPLE USAGE: *
* _MFIL $300;#256;#0 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_MFIL MAC
LDA #>]1 ; STARTING POINT
PHA
LDA #<]1
PHA
LDA #>]2 ; # OF BYTES
PHA
LDA #<]2
PHA
LDA ]3 ; FILL VALUE
PHA
JSR MEMFILL
<<<
*
*``````````````````````````````*
* _BELL :: RING BELL X TIMES -*
*- -*
* RING THE STANDARD BELL. *
*- -*
* PARAMETERS: *
* *
* PARAM1 = NUMBER OF RINGS *
*- -*
* SAMPLE USAGE: _BELL *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_BELL MAC
LUP ]1
JSR BELL
--^
<<<
*
*``````````````````````````````*
* _MMOV :: MOVE MEMORY BLOCK -*
*- -*
* MOVE A BLOCK OF MEMORY FROM *
* A SOURCE TO DESTINATION. *
*- -*
* PARAMETERS: *
* PARAM1 = SOURCE ADDRESS *
* PARAM2 = DESTINATION ADDRESS *
* PARAM3 = NUMBER OF BYTES *
*- -*
* SAMPLE USAGE: *
* *
* _MMOV $6A00;$7B00;#1024 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_MMOV MAC
LDA #>]1 ; SRC ADDR
PHA
LDA #<]1
PHA
LDA #>]2 ; DEST ADDR
PHA
LDA #<]2
PHA
LDA #>]3 ; # OF BYTES
PHA
LDA #<]3
PHA
JSR MEMMOVE
<<<
*
*``````````````````````````````*
* _DLAY :: DELAY X MILLISECS *
*- -*
* DELAY FOR PASSED MILLISECS *
*- -*
* PARAMETERS: *
* *
* PARAM1 = NUM OF MILLISECONDS *
*- -*
* SAMPLE USAGE: _DLAY #250 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_DLAY MAC
LDY ]1
JSR DELAYMS
<<<
*
*``````````````````````````````*
* _ZSV :: SAVE ZERO PAGE *
*- -*
* SAVE ZERO PAGE FREE AREAS *
* FOR LATER RESTORE. *
*- -*
* PARAMETERS: *
* *
* PARAM1 = ADDRESS TO STORE AT *
*- -*
* SAMPLE USAGE: _ZSV $300 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_ZSV MAC
LDA #>]1
PHA
LDA #<]1
PHA
JSR ZSAVE
<<<
*
*``````````````````````````````*
* _ZLD :: LOAD ZERO PAGE *
*- -*
* RESTORE PREVIOUSLY SAVED *
* FREE ZERO PAGE VALUES. *
*- -*
* PARAMETERS: *
* *
* PARAM1 = ADDR TO LOAD FROM *
*- -*
* SAMPLE USAGE: _ZLD $300 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_ZLD MAC
LDA #>]1
PHA
LDA #<]1
PHA
JSR ZLOAD
<<<

View File

@ -1,130 +0,0 @@
*``````````````````````````````*
* MEMFILL :: FILL MEMORY LOC *
*- -*
* FILLS A BLOCK OF MEMORY WITH *
* THE SPECIFIED VALUE; USED *
* OFTEN TO CLEAR LARGE BLOCKS. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* LDA #>1024 *
* PHA *
* LDA #<1024 *
* PHA *
* LDA #0 *
* PHA *
* JSR MEMFILL *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* FILL VALUE FOR MEMORY *
* ARRAY SIZE *
* LOW BYTE OF STARTING POINT *
* HIGH BYTE OF STARTING POINT *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = COUNTER; TRASH *
* X = COUNTER; TRASH *
* A = LOW BYTE OF RET ADDR *
*- -*
* ADAPTED FROM LEVANTHAL AND *
* WINTHROP'S /6502 ASSEMBLY *
* LANGUAGE ROUTINES/. *
* AS SUCH, THIS MAY NOT FALL *
* UNDER THE APACHE 2.0 LICENSE *
* AGREEMENT, SINCE THE BOOK *
* WAS WRITTEN BEFORE THE *
* LICENSE! *
* *
* THAT SAID, LEVENTHAL WROTE *
* THAT THE PURPOSE OF THE BOOK *
* WAS TO COPY THE SOURCE CODE, *
* AS REINVENTING THE WHEEL IS *
* TEDIOUS, AND HE PLACED NO *
* RESTRICTIONS ON ITS USE. *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
MEMFILL
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA :VALUE
PLA
STA :ARYSZ
PLA
STA :ARYSZ+1
PLA
STA ADDR1 ; ZERO PAGE POINTER
PLA ; DEFINED IN
STA ADDR1+1 ; DECS
*
** FILL WHOLE PAGES FIRST
*
LDA :VALUE ; GET VAL FOR FILL
LDX :ARYSZ+1 ; X=# OF PAGES TO DO
BEQ :PARTPG ; BRANCH IF HIGHBYTE OF SZ = 0
LDY #0
:FULLPG
STA (ADDR1),Y
INY ; INC TO NEXT BYTE
BNE :FULLPG ; BRANCH IF NOT DONE W/ PAGE
INC ADDR1+1 ; ADVANCE TO NEXT PAGE
DEX
BNE :FULLPG ; BRANCH IF NOT DONE W/ PAGES
*
** DO THE REMAINING PARTIAL PAGE
** REGISTER A STILL CONTAINS VALUE
*
:PARTPG
LDX :ARYSZ ;GET # OF BYTES IN FINAL PAGE
BEQ :EXIT ; BRANCH IF LOW BYTE = 0
LDY #0
:PARTLP
STA (ADDR1),Y ; STORE VAL
INY ; INCREMENT INDEX
DEX ; DECREMENT COUNTER
BNE :PARTLP ; BRANCH IF NOT DONE
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
RTS
*
** DATA
*
:VALUE DS 1 ; FILL VALUE
:ARYSZ DS 2 ; ARRAY SIZE
:RETADR DS 2

View File

@ -1,222 +0,0 @@
*``````````````````````````````*
* MEMMOVE :: MOVE MEM BLOCK *
*- -*
* MOVES A SPECIFIED BLOCK OF *
* MEMORY FROM A SOURCE ADDRESS *
* TO A DESTINATION ADDRESS *
* RANGE. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* LDA #>$7000 ; DEST *
* PHA *
* LDA #<$7000 *
* PHA *
* LDA #>1024 *
* PHA *
* LDA #<1024 *
* PHA *
* JSR MEMMOVE *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* NUMBER OF BYTES TO MOVE *
* LOW BYTE OF DESTINATION *
* HIGH BYTE OF DESTINATION *
* LOW BYTE OF SOURCE ADDRESS *
* HIGH BYTE OF SOURCE ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = COUNTER; TRASH *
* X = COUNTER; TRASH *
* A = LOW BYTE OF RET ADDR *
*- -*
* ADAPTED FROM LEVANTHAL AND *
* WINTHROP'S /6502 ASSEMBLY *
* LANGUAGE ROUTINES/. *
* AS SUCH, THIS MAY NOT FALL *
* UNDER THE APACHE 2.0 LICENSE *
* AGREEMENT, SINCE THE BOOK *
* WAS WRITTEN BEFORE THE *
* LICENSE! *
* *
* THAT SAID, LEVENTHAL WROTE *
* THAT THE PURPOSE OF THE BOOK *
* WAS TO COPY THE SOURCE CODE, *
* AS REINVENTING THE WHEEL IS *
* TEDIOUS, AND HE PLACED NO *
* RESTRICTIONS ON ITS USE. *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
MEMMOVE
*
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA :MVELEN
PLA
STA :MVELEN+1
PLA
STA ADDR2 ; ZERO PAGE POINTER
PLA
STA ADDR2+1
PLA
STA ADDR1
PLA
STA ADDR1+1
*
** DETERMINE IF DEST AREA IS
** ABOVE SRC AREA BUT OVERLAPS
** IT. REMEMBER, OVERLAP CAN BE
** MOD 64K. OVERLAP OCCURS IF
** STARTING DEST ADDRESS MINUS
** STARTING SRC ADDRESS (MOD
** 64K) IS LESS THAN NUMBER
** OF BYTES TO MOVE.
*
LDA ADDR2 ;CALC DEST-SRC
SEC
SBC ADDR1
TAX
LDA ADDR2+1
SBC ADDR1+1 ; MOD 64K AUTOMATIC
; -- DISCARD CARRY
TAY
TXA ; CMP WITH # OF BYTES TO MOVE
CMP :MVELEN
TYA
SBC :MVELEN+1
BCS :DOLEFT ; BRANCH IF NO OVERLAP
*
** DEST AREA IS ABOVE SRC AREA
** BUT OVERLAPS IT.
** MOVE FROM HIGHEST ADDR TO
** AVOID DESTROYING DATA
*
JSR :MVERHT
JMP :EXIT
*
** NO PROB DOING ORDINARY MOVE
** STARTING AT LOWEST ADDR
*
:DOLEFT
JSR :MVELEFT
:EXIT
JMP :MREXIT
*
********************************
* SUBROUTINE: MVELEFT *
********************************
*
:MVELEFT
LDY #0 ; ZERO INDEX
LDX :MVELEN+1 ; X=# OF FULL PP TO MOVE
BEQ :MLPART ; IF X=0, DO PARTIAL PAGE
:MLPAGE
LDA (ADDR1),Y
STA (ADDR2),Y ;MOVE ONE BYTE
INY ; NEXT BYTE
BNE :MLPAGE ; CONT UNTIL 256B MOVED
INC ADDR1+1 ; ADV TO NEXT SRC PAGE
INC ADDR2+1 ; ADV NEXT DEST PAGE
DEX ; DEC PAGE COUNT
BNE :MLPAGE ; CONT UNTIL ALL FULL
; PAGES ARE MOVED
:MLPART
LDX :MVELEN ; GET LENGTH OF LAST PAGE
BEQ :MLEXIT ; BR IF LENGTH OF LAST
; PAGE = 0
; REG Y IS 0
:MLLAST
LDA (ADDR1),Y
STA (ADDR2),Y ; MOVE BYTE
INY ; NEXT BYTE
DEX ; DEC COUNTER
BNE :MLLAST ; CONT UNTIL LAST P DONE
:MLEXIT
JMP :MREXIT
*
********************************
* SUBROUTINE: MVERHT *
********************************
*
:MVERHT
*
** MOVE THE PARTIAL PAGE FIRST
*
LDA :MVELEN+1
CLC
ADC ADDR1+1
STA ADDR1+1 ;POINT TO LAST P OF SRC
LDA :MVELEN+1
CLC
ADC ADDR2+1
STA ADDR2+1 ; POINT TO LAST P OF DEST
*
** MOVE THE LAST PARTIAL PAGE FIRST
*
LDY :MVELEN ;GET LENGTH OF LAST PAGE
BEQ :MRPAGE ; IF Y=0 DO THE FULL PAGES
:MR0
DEY ; BACK UP Y TO NEXT BYTE
LDA (ADDR1),Y
STA (ADDR2),Y ; MOVE BYTE
CPY #0
BNE :MR0 ; BR IF NOT DONE W LAST P
:MRPAGE
LDX :MVELEN+1 ; GET BYTE OF COUNT AS P CT
BEQ :MREXIT ; BR IF HYBYTE = 0 (NO FULL P)
:MR1
DEC ADDR1+1 ; BACK UP TO PREV SRC PAGE
DEC ADDR2+1 ; AND DEST
:MR2
DEY ; BACK UP Y TO NEXT BYTE
LDA (ADDR1),Y
STA (ADDR2),Y ; MOVE BYTE
CPY #0
BNE :MR2 ; BR IF NOT DONE W THIS PAGE
DEX
BNE :MR1 BR IF NOT ALL PAGES MOVED
:MREXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
RTS
*
** DATA
*
:RETADR DS 2
:MVELEN DS 2

View File

@ -1,278 +0,0 @@
*``````````````````````````````*
* ZSAVE :: SAVE 0-PAGE FREE *
*- -*
* STORES THE VALUES IN THE *
* LITTLE FREE SPACE ON THE *
* ZERO PAGE AT AN ALTERNATE *
* MEMORY LOCATION TO BE *
* RETRIEVED AND RESTORED AT A *
* LATER POINT. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* JSR ZSAVE *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF DESTINATION *
* HIGH BYTE OF DESTINATION *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = TRASH *
* X = TRASH *
* A = LOW BYTE OF RET ADDR *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
ZSAVE
*
** LOAD ADDR1 ZERO PAGE AREA FIRST,
** SINCE WE'LL BE USING THAT
*
** NOTE THAT THIS SHOULD ALWAYS BE
** $06 AND $07, OR ELSE CODE WILL
** HAVE TO CHANGE.
*
LDX ADDR1
LDY ADDR1+1
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA ADDR1
PLA
STA ADDR1+1
*
** COPY ZERO PAGE TO SPECIFIED
** NON-ZERO LOCATION (ONLY THE
** FREE ONES..)
*
TYA ; STORE ADDR1 VALS
LDY #1 ; FIRST
STA (ADDR1),Y
LDY #0
TXA
STA (ADDR1),Y
LDY #2
LDA $08
STA (ADDR1),Y
INY
LDA $09
STA (ADDR1),Y
INY
LDA $19
STA (ADDR1),Y
INY
LDA $1E
STA (ADDR1),Y
INY
LDA $E3
STA (ADDR1),Y
INY
LDA $EB
STA (ADDR1),Y
INY
LDA $EC
STA (ADDR1),Y
INY
LDA $ED
STA (ADDR1),Y
INY
LDA $EE
STA (ADDR1),Y
INY
LDA $EF
STA (ADDR1),Y
INY
LDA $FA
STA (ADDR1),Y
INY
LDA $FB
STA (ADDR1),Y
INY
LDA $FC
STA (ADDR1),Y
INY
LDA $FD
STA (ADDR1),Y
INY
LDA $FE
STA (ADDR1),Y
INY
LDA $FF
STA (ADDR1),Y
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:RETADR DS 2
*
*``````````````````````````````*
* ZLOAD :: RESTORE 0-PAGE FREE *
*- -*
* RESTORES PREVIOUSLY SAVED *
* ZERO PAGE VALUES FROM *
* HIGHER MEMORY LOCATION. *
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* JSR ZLOAD *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF SOURCE *
* HIGH BYTE OF SOURCE *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
ZLOAD
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA ADDR1
PLA
STA ADDR1+1
*
** COPY ZERO PAGE TO SPECIFIED
** NON-ZERO LOCATION (ONLY THE
** FREE ONES..)
*
LDY #2 ; START 2 AHEAD
LDA (ADDR1),Y ; AND PUT ADDR1
STA $08 ; AREA LAST
INY
LDA (ADDR1),Y
STA $09
INY
LDA (ADDR1),Y
STA $19
INY
LDA (ADDR1),Y
STA $1E
INY
LDA (ADDR1),Y
STA $E3
INY
LDA (ADDR1),Y
STA $EB
INY
LDA (ADDR1),Y
STA $EC
INY
LDA (ADDR1),Y
STA $ED
INY
LDA (ADDR1),Y
STA $EE
INY
LDA (ADDR1),Y
STA $EF
INY
LDA (ADDR1),Y
STA $FA
INY
LDA (ADDR1),Y
STA $FB
INY
LDA (ADDR1),Y
STA $FC
INY
LDA (ADDR1),Y
STA $FD
INY
LDA (ADDR1),Y
STA $FE
INY
LDA (ADDR1),Y
STA $FF
*
** NOW GET ZERO PAGE VALUES
** FOR SPACE OCCUPIED BY ADDR; RETURN IN X,Y
*
LDY #0
LDA (ADDR1),Y
TAX
LDA (ADDR1+1),Y
TAY
STX ADDR1
STY ADDR1+1
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:RETADR DS 2
*
*
COMMONX RTS

View File

@ -1,19 +0,0 @@
*``````````````````````````````*
* DECLARATIONS.PUT *
*- -*
* USED IN CONJUNCTION WITH *
* OTHER PUT FILES. DEFINES *
* BASIC DECLARATIONS USED *
* ACROSS DIFFERENT ROUTINES *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
SMALLASM EQU $300 ; STADDR FOR SMALL PROGRAMS
*
ADDR1 EQU $06
ADDR2 EQU $08
ADDR3 EQU $EB
ADDR4 EQU $ED
ADDR5 EQU $FA
ADDR6 EQU $FC
ADDR7 EQU $FE
*

View File

View File

@ -1,89 +0,0 @@
*
*``````````````````````````````*
*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
*

View File

@ -1,82 +0,0 @@
*
*``````````````````````````````*
* 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
*

View File

@ -1,94 +0,0 @@
*
*``````````````````````````````*
* 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
*

View File

@ -1,91 +0,0 @@
*
*``````````````````````````````*
* 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
*

View File

@ -1,114 +0,0 @@
*
*``````````````````````````````*
* 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

View File

@ -1,98 +0,0 @@
*
*``````````````````````````````*
* 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

View File

@ -1,103 +0,0 @@
*
*``````````````````````````````*
* 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

View File

@ -1,70 +0,0 @@
*
*``````````````````````````````*
* 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
*

View File

@ -1,188 +0,0 @@
*
********************************
* *
* -< STDIO DEMO >- *
* *
* VERSION 00.00.01 *
* *
* 03/04/1980 *
* *
********************************
* *
* NATHAN D. RIGGS *
* NATHAN.RIGGS@OUTLOOK.COM *
* *
********************************
*
** ASSEMBLER DIRECTIVES
*
CYC AVE
EXP ONLY
DSK STDIO.DEMO
*
*``````````````````````````````*
* TOP INCLUDES (PUTS, MACROS) *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
PUT DECS
USE STDIO.MAC
*
PUT STDIO.HOOKS
PUT COMMON.HOOKS
*
ORG $6000
*
*``````````````````````````````*
* PROGRAM MAIN BODY *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
*
*
** BIG LUMPS -- HIGH LEVEL CODE
*
*
JSR HOME ; CLEAR SCREEN
*
***
*** USE XPRINT TO PRINT A STRING OF CHARACTERS
*** TO THE SCREEN. THE STRING COMES AFTER
*** THE JSR STATEMENT IN AN ASC/HEX.
***
JSR XPRINT
ASC "WTF WORLD"
HEX 8D00 ; THIS TELLS THE
; ROUTINE TO STOP
; PRINTING THE STRING
*
*** USE DPRINT TO PRINT THE TEXT AT A SPECIFIC
*** MEMORY LOCATION. NOTE THAT THIS IS NOT
*** TYPICALLY USED TO PRINT STRINGS, AND LIKE
*** XPRINT USES THE NULL TERMINATOR TO ALERT
*** THE ROUTINE TO STOP PRINTING. TO PRINT
*** STRINGS, WHICH HAVE THE LENGTH OF THE STRING
*** AS THEIR FIRST BYTE VALUE, USE SPRINT.
*
*
LDA #$18 ; PUT 'XXX' INTO
STA $300 ; LOCATION $300
STA $301
STA $302
LDA #00
STA $303
LDA #>$300 ; PUSH HIBYTE
PHA
LDA #<$300 ; PUSH LOBYTE
PHA
JSR DPRINT ; NOW PRINT IT
*
* ^^^ NOTE ABOVE THAT THE HIGH BYTE
* IS PUSHED BEFORE THE LOW BYTE BECAUSE
* 6502 CONVENTION IS TO READ THE LOW BYTE
* FIRST, THEN THE HIGH BYTE. THIS IS THE
* ORDER IT WILL POP OFF THE STACK.
*
***
*** USE THLIN TO CREATE A LINE OF HORIZONTAL
*** TEXT CONSISTING OF A SINGLE CHARACTER.
*** LIKE MANY OTHER SUBROUTINES, THIS USES
*** THE STACK TO PASS VARIABLES.
***
*
LDA #0 ; START OF LINE
PHA
LDA #15 ; END OF LINE
PHA
LDA #10 ; Y POSITION
PHA
LDA #$18 ; "X" CHARACTER, INVERSE
PHA
JSR THLIN
*
*** TVLIN WORKS LIKE THLIN, BUT CREATES A VERTICAL
*** LINE INSTEAD OF A HORIZONTAL ONE.
*
LDA #0 ; STARTING Y POS OF LINE
PHA
LDA #15 ; END YPOS OF LINE
PHA
LDA #10 ; X POSITION
PHA
LDA #$18 ; "X" CHARACTER, INVERSE
PHA
JSR TVLIN
*
*
*** THE TFILLA ROUTINE ACTS LIKE A COMBINATION OF
*** THLIN AND TVLIN. IT FILLS A GIVEN RECTANGULAR
*** AREA OF THE SCREEN WITH THE DESIGNATED
*** CHARACTER AT X1,Y1:X2,Y2.
*
LDA #10 ; LEFT BOUNDARY
PHA
LDA #30 ; RIGHT BOUNDARY
PHA
LDA #5 ; TOP BOUNDARY
PHA
LDA #15 ; BOTTOM BOUNDARY
PHA
LDA #$1A ; "Z" CHARACTER
PHA
JSR TFILLA
*
*
*** THE SINPUT ROUTINE (SPECIAL INPUT) PROMPTS
*** THE USER FOR A STRING OF TEXT FOLLOWED BY
*** A <RETURN> PRESS, THEN STORES THE INPUTTED
*** STRING AT THE SPECIFIED LOCATION, WITH ITS
*** LENGTH AS THE FIRST BYTE (MAX: 255)
*
LDA #>$300 ; PUSH HIGH BYTE FIRST
PHA
LDA #<$300 ; THEN LOW BYTE, SO
; THAT THE ROUTINE
; READS LOW, HIGH
PHA
JSR SINPUT ; STORES IN $300
*
*
*** THE PADDLE BUTTON ROUTINE CHECKS
*** WHETHER THE DESIGNATED PADDLE BUTTON
*** IS CURRENTLY BEING PRESSED.
*
*
*
*
*
*
********************************
********************************
* NOW LET'S DO IT AGAIN! *
* (BUT WITH MACROS) *
********************************
********************************
*
JSR HOME
_PRN "WTF, WORLD?"
_CXY #10;#10
_TVLN #5;#20;#30;#$18
_THLN #5;#30;#20;#$1A
_INP $300
_TFIL #0;#39;#0;#21;#$19
*
*
*
** LITTLE LUMPS -- MID/LOW LEVEL
*
*
JMP REENTRY
*
*``````````````````````````````*
* BOTTOM INCLUDES *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
*
** BOTTOM INCLUDES
*
PUT STDIO.LIB
*
*

View File

@ -1,53 +0,0 @@
*
*``````````````````````````````*
* 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
*

View File

@ -1,788 +0,0 @@
*
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

View File

@ -1,583 +0,0 @@
*
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
* *
* 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
<<<
*