mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-11-26 21:51:26 +00:00
various additions
mostly updated the required and common libraries, as well as created a minify program in applesoft basic that automatically creates a .min file from fully-commented source.
This commit is contained in:
parent
65d1e6ab05
commit
1cca2ca580
@ -13,6 +13,9 @@ A general purpose ASM libriary for the Apple II. Assembled in Merlin 8 Pro.
|
||||
* [Introduction](#introduction)
|
||||
* [FAQ](#faq)
|
||||
* ~~How to use this Documentation~~
|
||||
* ~~Some included Utilities~~
|
||||
* ~~MINIFY.BAS~~
|
||||
* ~~MAKEEXEC.BAS~~
|
||||
* [Disk Overviews](#disk-overviews)
|
||||
* [Disk 1: STDIO](#disk-1-stdio)
|
||||
* [Disk 2: COMMON](#disk-2-common-required)
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
30
disks/disk2_common/MINIFY
Normal file
30
disks/disk2_common/MINIFY
Normal file
@ -0,0 +1,30 @@
|
||||
5 HOME
|
||||
8 ONERR GOTO 1000
|
||||
10 PRINT "ASSEMBLY CODE MINIFIER"
|
||||
20 PRINT "-=-=-=-=-=-=-=-=-=-=-="
|
||||
30 PRINT
|
||||
35 DIM FC$(1000):C = 0
|
||||
40 INPUT "ENTER THE SOURCE FILE NAME: ";FF$
|
||||
50 INPUT "ENTER THE DESTINATION FILE NAME: ";DD$
|
||||
55 PRINT "WORKING.."
|
||||
60 PRINT CHR$ (4);"OPEN ";FF$
|
||||
70 PRINT CHR$ (4);"READ ";FF$
|
||||
80 GET AA$
|
||||
85 REM ? CHR$ (34);".";
|
||||
90 IF AA$ = CHR$ (13) THEN GOTO 200
|
||||
95 S$ = S$ + AA$
|
||||
110 GOTO 80
|
||||
200 IF LEFT$ (S$,1) = "*" OR LEFT$ (S$,1) = ";" THEN S$ = ""
|
||||
500 FC$(C) = S$
|
||||
510 S$ = ""
|
||||
520 C = C + 1
|
||||
990 GOTO 80
|
||||
1000 PRINT : PRINT CHR$ (4);"CLOSE ";FF$
|
||||
1010 PRINT CHR$ (4);"OPEN ";DD$
|
||||
1020 PRINT CHR$ (4);"WRITE ";DD$
|
||||
1030 FOR Z = 0 TO C
|
||||
1040 IF FC$(Z) < > "" THEN PRINT FC$(Z)
|
||||
1050 NEXT Z
|
||||
1060 PRINT CHR$ (4);"CLOSE ";DD$
|
||||
1070 PRINT "DONE!": PRINT : PRINT : PRINT
|
||||
1080 PRINT CHR$ (7): PRINT CHR$ (7): PRINT CHR$ (7)
|
@ -3,9 +3,9 @@
|
||||
* *
|
||||
* -< COMMON DEMO )- *
|
||||
* *
|
||||
* VERSION 00.02.00 *
|
||||
* VERSION 0.3.0 *
|
||||
* *
|
||||
* 12-DEC-2018 *
|
||||
* 10-JAN-2019 *
|
||||
* *
|
||||
********************************
|
||||
* *
|
||||
@ -26,100 +26,66 @@
|
||||
* TOP INCLUDES (HOOKS,MACROS) *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
USE REQUIRED.MAC
|
||||
PUT REQUIRED.HOOKS
|
||||
USE COMMON.MAC
|
||||
PUT COMMON.HOOKS
|
||||
USE REQUIRED.MAC.MIN
|
||||
PUT REQUIRED.HOOKS.MIN
|
||||
USE COMMON.MAC.MIN
|
||||
PUT COMMON.HOOKS.MIN
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* PROGRAM MAIN BODY *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
** MEMFILL DOES ABOUT WHAT ITS NAME
|
||||
** MFILL DOES ABOUT WHAT ITS NAME
|
||||
** IMPLIES: IT FILLS A BLOCK OF MEMORY
|
||||
** WITH A PARTICULAR CHARACTER.
|
||||
*
|
||||
** MACRO: MFILL ADDRESS_START;BYTE_LENGTH;FILL_VALUE
|
||||
*
|
||||
LDA #>$300 ; AREA TO FILL; HIGH
|
||||
PHA
|
||||
LDA #<$300 ; LOW
|
||||
PHA
|
||||
LDA #>10
|
||||
PHA
|
||||
LDA #<10
|
||||
PHA
|
||||
LDA #0 ; FILL CHARACTER
|
||||
PHA
|
||||
JSR MEMFILL
|
||||
*
|
||||
_PRNT "MEMFILL FILLS A PORTION OF MEMORY WITH",8D
|
||||
MFILL #$300;#10;#0
|
||||
_PRNT "MFILL FILLS A PORTION OF MEMORY WITH",8D
|
||||
_PRNT "A SPECIFIED VALUE. ",8D8D
|
||||
_DUMP $300;#10
|
||||
_WAIT
|
||||
*
|
||||
** MEMMOVE ALSO DOES WHAT IT SAYS: IT MOVES
|
||||
** MMOVE 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.
|
||||
*
|
||||
** MACRO: MMOVE SRC_ADDR;DEST_ADDR;BYTE_LENGTH
|
||||
*
|
||||
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
|
||||
*
|
||||
_PRNT " ",8D8D
|
||||
_PRNT "MEMMOVE MOVES COPIES A SPAN OF MEMORY",8D
|
||||
_PRNT "MMOVE COPIES A SPAN OF MEMORY",8D
|
||||
_PRNT "FROM A SOURCE TO A DESTINATION ADDRESS.",8D8D
|
||||
_PRNT "SO MOVING $300 TO $320 RESULTS IN:",8D8D
|
||||
MMOVE $300;$320;#10
|
||||
_DUMP $320;#10
|
||||
_WAIT
|
||||
*
|
||||
** DELAYMS RUNS THROUGH CYCLES OF THE
|
||||
** DELAY RUNS THROUGH CYCLES OF THE
|
||||
** 6502 UNTIL A CERTAIN AMOUNT OF TIME
|
||||
** HAS PASSED.
|
||||
*
|
||||
** MACRO: DELAY #250
|
||||
*
|
||||
_PRNT " ",8D8D
|
||||
_PRNT "DELAYMS DELAYS A SPECIFIED NUMBER OF",8D
|
||||
_PRNT "DELAY DELAYS A SPECIFIED NUMBER OF",8D
|
||||
_PRNT "MILLISECONDS. 250 MILLISECONDS = 1/4 SECOND.",8D8D
|
||||
*
|
||||
LDY #250 ; TIME IN MILLISECONDS
|
||||
DELAY #250 ; TIME IN MILLISECONDS
|
||||
; IS PASSED VIA Y
|
||||
; 250 = 1/4 SECOND
|
||||
JSR DELAYMS
|
||||
BEEP 1
|
||||
_PRNT "1/4 SECOND",8D
|
||||
LDY #250
|
||||
JSR DELAYMS
|
||||
DELAY #250
|
||||
BEEP 2
|
||||
_PRNT "1/4 SECOND",8D
|
||||
LDY #250
|
||||
JSR DELAYMS
|
||||
DELAY #250
|
||||
BEEP 3
|
||||
_PRNT "1/4 SECOND",8D
|
||||
LDY #250
|
||||
JSR DELAYMS ; = 1 SECOND DELAY
|
||||
DELAY #250
|
||||
BEEP 4
|
||||
_PRNT "1/4 SECOND",8D
|
||||
*
|
||||
_PRNT " ",8D8D
|
||||
_WAIT
|
||||
*
|
||||
** ZMSAVE BACKS UP THE "FREE" AREAS OF
|
||||
** 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,
|
||||
@ -130,8 +96,6 @@
|
||||
** OF THESE MEMORY ADDRESSES, ANY TIME YOUR CODE
|
||||
** MAKES USE OF THE ZERO PAGE, IT IS ADVISED TO
|
||||
** SAVE THE STATE BEFORE CALLING ANY OTHER ROUTINES.
|
||||
*
|
||||
** MACRO: ZSAVE BACKUP_ADDR
|
||||
*
|
||||
LDA #01
|
||||
STA $06
|
||||
@ -141,14 +105,10 @@
|
||||
STA $08
|
||||
LDA #04
|
||||
STA $09
|
||||
LDA #>$300
|
||||
PHA
|
||||
LDA #<$300 ; LOW DEST
|
||||
PHA
|
||||
JSR ZMSAVE
|
||||
ZSAVE $300
|
||||
*
|
||||
_PRNT " ",8D8D
|
||||
_PRNT "ZMSAVE SAVES THE STATE OF THE ZERO PAGE ",8D
|
||||
_PRNT "ZSAVE SAVES THE STATE OF THE ZERO PAGE ",8D
|
||||
_PRNT "ADDRESSES THAT ARE NOT USED BY DOS,",8D
|
||||
_PRNT "APPLESOFT,PRODOS OR INTEGER BASIC.",8D8D
|
||||
_PRNT "SO THE BACKED UP ZERO PAGE AT $300 IS:",8D8D
|
||||
@ -158,22 +118,40 @@
|
||||
_WAIT
|
||||
*
|
||||
** YOU CAN RESTORE THE ZERO PAGE TO ITS
|
||||
** PRIOR STATE BY THEN CALLING ZMLOAD.
|
||||
** PRIOR STATE BY THEN CALLING ZLOAD.
|
||||
*
|
||||
** MACRO: ZLOAD BACKUP_ADDRESS
|
||||
*
|
||||
LDA #>$300 ; HIGH; SOURCE
|
||||
PHA
|
||||
LDA #<$300 ; LOW
|
||||
PHA
|
||||
JSR ZMLOAD
|
||||
ZLOAD $300
|
||||
*
|
||||
_PRNT " ",8D8D
|
||||
_PRNT "YOU CAN THEN RESTORE THE FREE ZERO PAGE",8D
|
||||
_PRNT "LOCATIONS WITH ZMLOAD. THERE ISN'T ANY",8D
|
||||
_PRNT "LOCATIONS WITH ZLOAD. THERE ISN'T ANY",8D
|
||||
_PRNT "MEANINGFUL OUTPUT TO PUT HERE TO ",8D
|
||||
_PRNT "ILLUSTRATE THAT, SO USE YOUR IMAGINATION!",8D8D
|
||||
_WAIT
|
||||
*
|
||||
** THE MSWAP MACRO SWAPS THE MEMORY BLOCK AT ONE
|
||||
** ADDRESS WITH THE SAME LENGTH AT ANOTHER.
|
||||
*
|
||||
_PRNT "THE MSWAP MACRO SWAPS A LENGTH",8D
|
||||
_PRNT "OF MEMORY FROM ONE LOCATION",8D
|
||||
_PRNT "TO ANOTHER. SO, BEFORE SWAP:",8D8D
|
||||
_DUMP $300;#10
|
||||
_DUMP $320;#10
|
||||
MSWAP $300;$320;#10
|
||||
_PRNT " ",8D
|
||||
_PRNT "AND AFTER SWAP: ",8D8D
|
||||
_DUMP $300;#10
|
||||
_DUMP $320;#10
|
||||
_WAIT
|
||||
*
|
||||
** THE FOLLOWING ILLUSTRATES THE _RDUMP MACRO IN
|
||||
** THE REQUIRED LIBRARY.
|
||||
*
|
||||
LDA #$11
|
||||
LDX #$12
|
||||
LDY #$13
|
||||
CLC
|
||||
_RDUMP
|
||||
*
|
||||
JMP REENTRY
|
||||
*
|
||||
@ -183,6 +161,6 @@
|
||||
*
|
||||
** BOTTOM INCLUDES
|
||||
*
|
||||
PUT COMMON.LIB
|
||||
PUT REQUIRED.LIB
|
||||
PUT COMMON.LIB.MIN
|
||||
PUT REQUIRED.LIB.MIN
|
||||
*
|
||||
|
82
disks/disk2_common/T.COMMON.DEMO.MIN
Normal file
82
disks/disk2_common/T.COMMON.DEMO.MIN
Normal file
@ -0,0 +1,82 @@
|
||||
CYC AVE
|
||||
EXP ONLY
|
||||
DSK COMMON.DEMO
|
||||
OBJ $BFE0
|
||||
ORG $6000
|
||||
USE REQUIRED.MAC.MIN
|
||||
PUT REQUIRED.HOOKS.MIN
|
||||
USE COMMON.MAC.MIN
|
||||
PUT COMMON.HOOKS.MIN
|
||||
MFILL #$300;#10;#0
|
||||
_PRNT "MFILL FILLS A PORTION OF MEMORY WITH",8D
|
||||
_PRNT "A SPECIFIED VALUE. ",8D8D
|
||||
_DUMP $300;#10
|
||||
_WAIT
|
||||
_PRNT " ",8D8D
|
||||
_PRNT "MMOVE COPIES A SPAN OF MEMORY",8D
|
||||
_PRNT "FROM A SOURCE TO A DESTINATION ADDRESS.",8D8D
|
||||
_PRNT "SO MOVING $300 TO $320 RESULTS IN:",8D8D
|
||||
MMOVE $300;$320;#10
|
||||
_DUMP $320;#10
|
||||
_WAIT
|
||||
_PRNT " ",8D8D
|
||||
_PRNT "DELAY DELAYS A SPECIFIED NUMBER OF",8D
|
||||
_PRNT "MILLISECONDS. 250 MILLISECONDS = 1/4 SECOND.",8D8D
|
||||
DELAY #250 ; TIME IN MILLISECONDS
|
||||
BEEP 1
|
||||
_PRNT "1/4 SECOND",8D
|
||||
DELAY #250
|
||||
BEEP 2
|
||||
_PRNT "1/4 SECOND",8D
|
||||
DELAY #250
|
||||
BEEP 3
|
||||
_PRNT "1/4 SECOND",8D
|
||||
DELAY #250
|
||||
BEEP 4
|
||||
_PRNT "1/4 SECOND",8D
|
||||
_PRNT " ",8D8D
|
||||
_WAIT
|
||||
LDA #01
|
||||
STA $06
|
||||
LDA #02
|
||||
STA $07
|
||||
LDA #03
|
||||
STA $08
|
||||
LDA #04
|
||||
STA $09
|
||||
ZSAVE $300
|
||||
_PRNT " ",8D8D
|
||||
_PRNT "ZSAVE SAVES THE STATE OF THE ZERO PAGE ",8D
|
||||
_PRNT "ADDRESSES THAT ARE NOT USED BY DOS,",8D
|
||||
_PRNT "APPLESOFT,PRODOS OR INTEGER BASIC.",8D8D
|
||||
_PRNT "SO THE BACKED UP ZERO PAGE AT $300 IS:",8D8D
|
||||
_DUMP $300;#18
|
||||
_PRNT " ",8D8D
|
||||
_PRNT "18 BYTES ARE USED.",8D8D
|
||||
_WAIT
|
||||
ZLOAD $300
|
||||
_PRNT " ",8D8D
|
||||
_PRNT "YOU CAN THEN RESTORE THE FREE ZERO PAGE",8D
|
||||
_PRNT "LOCATIONS WITH ZLOAD. THERE ISN'T ANY",8D
|
||||
_PRNT "MEANINGFUL OUTPUT TO PUT HERE TO ",8D
|
||||
_PRNT "ILLUSTRATE THAT, SO USE YOUR IMAGINATION!",8D8D
|
||||
_WAIT
|
||||
_PRNT "THE MSWAP MACRO SWAPS A LENGTH",8D
|
||||
_PRNT "OF MEMORY FROM ONE LOCATION",8D
|
||||
_PRNT "TO ANOTHER. SO, BEFORE SWAP:",8D8D
|
||||
_DUMP $300;#10
|
||||
_DUMP $320;#10
|
||||
MSWAP $300;$320;#10
|
||||
_PRNT " ",8D
|
||||
_PRNT "AND AFTER SWAP: ",8D8D
|
||||
_DUMP $300;#10
|
||||
_DUMP $320;#10
|
||||
_WAIT
|
||||
LDA #$11
|
||||
LDX #$12
|
||||
LDY #$13
|
||||
CLC
|
||||
_RDUMP
|
||||
JMP REENTRY
|
||||
PUT COMMON.LIB.MIN
|
||||
PUT REQUIRED.LIB.MIN
|
7
disks/disk2_common/T.COMMON.HOOKS.MIN
Normal file
7
disks/disk2_common/T.COMMON.HOOKS.MIN
Normal file
@ -0,0 +1,7 @@
|
||||
PROMPT EQU $33
|
||||
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
|
@ -1,4 +1,3 @@
|
||||
JMP COMMONX
|
||||
*
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
* *
|
||||
@ -8,8 +7,8 @@
|
||||
* CONTACT: NATHAN.RIGGS@ *
|
||||
* OUTLOOK.COM *
|
||||
* *
|
||||
* VERSION: 0.2.0 *
|
||||
* DATE: 12-DEC-2018 *
|
||||
* VERSION: 0.3.0 *
|
||||
* DATE: 10-JAN-2019 *
|
||||
* ASSEMBLER: MERLIN 8 PRO *
|
||||
* LICENSE: APACHE 2.0 *
|
||||
* OS: DOS 3.3 *
|
||||
@ -42,6 +41,8 @@
|
||||
* ZERO PAGE VALUES *
|
||||
* BACK INTO PROPER *
|
||||
* LOCATION. *
|
||||
* MEMSWAP: SWAP RANGE OF MEM *
|
||||
* WITH ANOTHER RANGE. *
|
||||
* *
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
*
|
||||
@ -824,4 +825,3 @@ MEMSWAP
|
||||
*
|
||||
:LENGTH DS 1
|
||||
*
|
||||
COMMONX RTS
|
||||
|
346
disks/disk2_common/T.COMMON.LIB.MIN
Normal file
346
disks/disk2_common/T.COMMON.LIB.MIN
Normal file
@ -0,0 +1,346 @@
|
||||
MEMFILL
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
PLA
|
||||
STA :VALUE
|
||||
PLA
|
||||
STA :ARYSZ
|
||||
PLA
|
||||
STA :ARYSZ+1
|
||||
PLA
|
||||
STA ADDR1 ; ZERO PAGE POINTER
|
||||
PLA ; DEFINED IN
|
||||
STA ADDR1+1 ; DECS
|
||||
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
|
||||
: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
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
RTS
|
||||
:VALUE DS 1 ; FILL VALUE
|
||||
:ARYSZ DS 2 ; ARRAY SIZE
|
||||
MEMMOVE
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
PLA
|
||||
STA :MVELEN
|
||||
PLA
|
||||
STA :MVELEN+1
|
||||
PLA
|
||||
STA ADDR2 ; ZERO PAGE POINTER
|
||||
PLA
|
||||
STA ADDR2+1
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
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
|
||||
JSR :MVERHT
|
||||
JMP :EXIT
|
||||
:DOLEFT
|
||||
JSR :MVELEFT
|
||||
:EXIT
|
||||
JMP :MREXIT
|
||||
: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
|
||||
:MVERHT
|
||||
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
|
||||
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
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
RTS
|
||||
:MVELEN DS 2
|
||||
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)
|
||||
CPY #1 ; 2 CYCLES
|
||||
BNE :DELAYA ; 3C IF TAKEN, ELSE 2C
|
||||
JMP :LAST1 ; 3C
|
||||
: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
|
||||
LDX #MSCNT-3 ; 2C
|
||||
:DELAY2
|
||||
DEX ; 2C
|
||||
BNE :DELAY2 ; 3C
|
||||
:EXIT
|
||||
RTS ; 6C
|
||||
ZMSAVE
|
||||
LDX ADDR1
|
||||
LDY ADDR1+1
|
||||
PLA
|
||||
STA :RETADR ; LOCAL BECAUSE RETADDR
|
||||
PLA ; IS STORED ON ZERO PAGE
|
||||
STA :RETADR+1
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
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
|
||||
LDA :RETADR+1
|
||||
PHA
|
||||
LDA :RETADR
|
||||
PHA
|
||||
RTS
|
||||
:RETADR DS 2
|
||||
ZMLOAD
|
||||
PLA
|
||||
STA :RETADR
|
||||
PLA
|
||||
STA :RETADR+1
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
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
|
||||
LDY #0
|
||||
LDA (ADDR1),Y
|
||||
TAX
|
||||
LDA (ADDR1+1),Y
|
||||
TAY
|
||||
STX ADDR1
|
||||
STY ADDR1+1
|
||||
LDA :RETADR+1
|
||||
PHA
|
||||
LDA :RETADR
|
||||
PHA
|
||||
RTS
|
||||
:RETADR DS 2
|
||||
MEMSWAP
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
PLA
|
||||
STA :LENGTH
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
PLA
|
||||
STA ADDR2
|
||||
PLA
|
||||
STA ADDR2+1
|
||||
LDY #255 ; COUNTER
|
||||
:LP
|
||||
INY
|
||||
LDA (ADDR1),Y
|
||||
TAX ; X CONTAINS ADDR1 VAL
|
||||
LDA (ADDR2),Y ; A CONTAINS ADDR2 VAL
|
||||
STA (ADDR1),Y
|
||||
TXA
|
||||
STA (ADDR2),Y
|
||||
CPY :LENGTH
|
||||
BNE :LP
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
RTS
|
||||
:LENGTH DS 1
|
@ -6,8 +6,8 @@
|
||||
* CONTACT: NATHAN.RIGGS@ *
|
||||
* OUTLOOK.COM *
|
||||
* *
|
||||
* VERSION: 0.2.0 *
|
||||
* DATE: 12-DEC-2018 *
|
||||
* VERSION: 0.3.0 *
|
||||
* DATE: 10-JAN-2018 *
|
||||
* ASSEMBLER: MERLIN 8 PRO *
|
||||
* LICENSE: APACHE 2.0 *
|
||||
* OS: DOS 3.3 *
|
||||
@ -31,6 +31,7 @@
|
||||
* DELAY :: DELAY IN MILLISECS *
|
||||
* ZSAVE :: SAVE FREE ZERO PAGE *
|
||||
* ZLOAD :: LOAD SAVE ZERO PAGE *
|
||||
* MSWAP :: SWAP MEM RANGES *
|
||||
* *
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
*
|
||||
@ -51,14 +52,8 @@
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
MFILL MAC
|
||||
LDA #>]1 ; STARTING POINT
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
LDA #>]2 ; # OF BYTES
|
||||
PHA
|
||||
LDA #<]2
|
||||
PHA
|
||||
_ISLIT ]1
|
||||
_ISLIT ]2
|
||||
LDA ]3 ; FILL VALUE
|
||||
PHA
|
||||
JSR MEMFILL
|
||||
@ -73,7 +68,7 @@ MFILL MAC
|
||||
* *
|
||||
* ]1 = NUMBER OF RINGS *
|
||||
*- -*
|
||||
* SAMPLE USAGE: BELL *
|
||||
* SAMPLE USAGE: BEEP 10 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
BEEP MAC
|
||||
@ -99,18 +94,15 @@ BEEP MAC
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
MMOVE MAC
|
||||
LDA #>]1 ; SRC ADDR
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
LDA #>]2 ; DEST ADDR
|
||||
LDA #>]2
|
||||
PHA
|
||||
LDA #<]2
|
||||
PHA
|
||||
LDA #>]3 ; # OF BYTES
|
||||
PHA
|
||||
LDA #<]3
|
||||
PHA
|
||||
_ISLIT ]3
|
||||
JSR MEMMOVE
|
||||
<<<
|
||||
*
|
||||
|
55
disks/disk2_common/T.COMMON.MAC.MIN
Normal file
55
disks/disk2_common/T.COMMON.MAC.MIN
Normal file
@ -0,0 +1,55 @@
|
||||
MFILL MAC
|
||||
_ISLIT ]1
|
||||
_ISLIT ]2
|
||||
LDA ]3 ; FILL VALUE
|
||||
PHA
|
||||
JSR MEMFILL
|
||||
<<<
|
||||
BEEP MAC
|
||||
LUP ]1
|
||||
JSR BELL
|
||||
--^
|
||||
<<<
|
||||
MMOVE MAC
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
LDA #>]2
|
||||
PHA
|
||||
LDA #<]2
|
||||
PHA
|
||||
_ISLIT ]3
|
||||
JSR MEMMOVE
|
||||
<<<
|
||||
DELAY MAC
|
||||
LDY ]1
|
||||
JSR DELAYMS
|
||||
<<<
|
||||
ZSAVE MAC
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
JSR ZMSAVE
|
||||
<<<
|
||||
ZLOAD MAC
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
JSR ZMLOAD
|
||||
<<<
|
||||
MSWAP MAC
|
||||
LDA #>]2
|
||||
PHA
|
||||
LDA #<]2
|
||||
PHA
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
LDA ]3
|
||||
PHA
|
||||
JSR MEMSWAP
|
||||
<<<
|
@ -54,9 +54,18 @@ REENTRY EQU $3D0
|
||||
*
|
||||
LDA #1
|
||||
STA ERRMESG
|
||||
*
|
||||
** SET ERRCTRL TO 1 IF YOU WANT ERROR CATCHING ON
|
||||
** IN THE FIRST PLACE. HAVING THIS TURNED OFF WILL
|
||||
** SAVE A FEW CYCLES, BUT POSSIBLY AT THE EXPENSE
|
||||
** OF YOUR FRUSTRATION. CAN BE TURNED ON LATER THOUGH.
|
||||
*
|
||||
LDA #1
|
||||
STA ERRCTRL
|
||||
*
|
||||
JMP VARSKIP
|
||||
ERRSTOP DS 1
|
||||
ERRMESG DS 1
|
||||
ERRCTRL DS 1
|
||||
VARSKIP
|
||||
*
|
||||
|
@ -9,9 +9,15 @@ RESULT EQU $FA
|
||||
RESULT2 EQU $FC
|
||||
REENTRY EQU $3D0
|
||||
LDA #1
|
||||
STA ERRMESG
|
||||
STA ERRSTOP
|
||||
LDA #1
|
||||
STA ERRMESG
|
||||
LDA #1
|
||||
STA ERRCTRL
|
||||
JMP VARSKIP
|
||||
ERRSTOP DS 1
|
||||
ERRMESG DS 1
|
||||
ERRCTRL DS 1
|
||||
VARSKIP
|
||||
RSKIP
|
||||
*
|
||||
|
@ -1,5 +1,3 @@
|
||||
*
|
||||
JMP ENDVARS
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* REQUIRED.LIB *
|
||||
@ -373,5 +371,3 @@ RETURN DS 256
|
||||
PARLEN DS 1
|
||||
PARAM DS 256
|
||||
*
|
||||
ENDVARS
|
||||
*
|
||||
|
@ -1,11 +1,9 @@
|
||||
__GETRET
|
||||
*
|
||||
LDY #255
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
:LP
|
||||
INY
|
||||
LDA RETURN,Y
|
||||
@ -18,13 +16,11 @@ __GETRET
|
||||
PHA
|
||||
RTS
|
||||
__SETPARM
|
||||
*
|
||||
LDY #255
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
:LP
|
||||
INY
|
||||
LDA (ADDR1),Y
|
||||
@ -37,7 +33,6 @@ __SETPARM
|
||||
PHA
|
||||
RTS
|
||||
__DUMP
|
||||
*
|
||||
PLA
|
||||
STA :RET
|
||||
PLA
|
||||
@ -48,7 +43,6 @@ __DUMP
|
||||
STA ADDR3
|
||||
PLA
|
||||
STA ADDR3+1
|
||||
*
|
||||
LDA #$8D
|
||||
JSR $FDF0
|
||||
LDA ADDR3+1
|
||||
@ -83,7 +77,6 @@ __DUMP
|
||||
JSR $FDF0
|
||||
LDA #160 ; SPC
|
||||
JSR $FDF0
|
||||
*
|
||||
LDY #0
|
||||
:LP
|
||||
LDA (ADDR3),Y
|
||||
@ -111,9 +104,7 @@ __DUMP
|
||||
PHA
|
||||
LDA :RET
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
:RET DS 2
|
||||
:RIGHT DS 1
|
||||
:LEFT DS 1
|
||||
@ -178,7 +169,6 @@ __RDMP
|
||||
JMP :RDUMP
|
||||
:O1 LDA #1
|
||||
STA :OVERFLOW
|
||||
*
|
||||
:RDUMP
|
||||
_PRNT " ",8D8D
|
||||
_PRNT "REGISTRY DUMP",8D
|
||||
@ -266,9 +256,6 @@ __RDMP
|
||||
:OCLR _PRNT "OVERFLOW: CLEAR",8D8D8D
|
||||
:FIN
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:A DS 1
|
||||
:X DS 1
|
||||
:Y DS 1
|
||||
|
@ -26,7 +26,6 @@ STRCONT
|
||||
STA PARAM,Y
|
||||
CPY PARLEN
|
||||
BNE ]STRLP1
|
||||
*
|
||||
LDA #>PARAM ; GET HI
|
||||
PHA
|
||||
LDA #<PARAM ; GET LO
|
||||
@ -72,4 +71,3 @@ _WAIT MAC
|
||||
_RDUMP MAC
|
||||
JSR __RDMP
|
||||
<<<
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user