mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-11-28 18:50:09 +00:00
1cca2ca580
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.
167 lines
4.4 KiB
Plaintext
167 lines
4.4 KiB
Plaintext
*
|
|
********************************
|
|
* *
|
|
* -< COMMON DEMO )- *
|
|
* *
|
|
* VERSION 0.3.0 *
|
|
* *
|
|
* 10-JAN-2019 *
|
|
* *
|
|
********************************
|
|
* *
|
|
* NATHAN D. RIGGS *
|
|
* NATHAN.RIGGS@OUTLOOK.COM *
|
|
* *
|
|
********************************
|
|
*
|
|
** ASSEMBLER DIRECTIVES
|
|
*
|
|
CYC AVE
|
|
EXP ONLY
|
|
DSK COMMON.DEMO
|
|
OBJ $BFE0
|
|
ORG $6000
|
|
*
|
|
*``````````````````````````````*
|
|
* TOP INCLUDES (HOOKS,MACROS) *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
USE REQUIRED.MAC.MIN
|
|
PUT REQUIRED.HOOKS.MIN
|
|
USE COMMON.MAC.MIN
|
|
PUT COMMON.HOOKS.MIN
|
|
*
|
|
*``````````````````````````````*
|
|
* PROGRAM MAIN BODY *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
** MFILL DOES ABOUT WHAT ITS NAME
|
|
** IMPLIES: IT FILLS A BLOCK OF MEMORY
|
|
** WITH A PARTICULAR CHARACTER.
|
|
*
|
|
MFILL #$300;#10;#0
|
|
_PRNT "MFILL FILLS A PORTION OF MEMORY WITH",8D
|
|
_PRNT "A SPECIFIED VALUE. ",8D8D
|
|
_DUMP $300;#10
|
|
_WAIT
|
|
*
|
|
** 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.
|
|
*
|
|
_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
|
|
*
|
|
** DELAY RUNS THROUGH CYCLES OF THE
|
|
** 6502 UNTIL A CERTAIN AMOUNT OF TIME
|
|
** HAS PASSED.
|
|
*
|
|
_PRNT " ",8D8D
|
|
_PRNT "DELAY DELAYS A SPECIFIED NUMBER OF",8D
|
|
_PRNT "MILLISECONDS. 250 MILLISECONDS = 1/4 SECOND.",8D8D
|
|
*
|
|
DELAY #250 ; TIME IN MILLISECONDS
|
|
; IS PASSED VIA Y
|
|
; 250 = 1/4 SECOND
|
|
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
|
|
*
|
|
** 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.
|
|
*
|
|
** NOTE THAT SINCE THE LIBRARY MAKES HEAVY USE
|
|
** 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.
|
|
*
|
|
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
|
|
*
|
|
** YOU CAN RESTORE THE ZERO PAGE TO ITS
|
|
** PRIOR STATE BY THEN CALLING ZLOAD.
|
|
*
|
|
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
|
|
*
|
|
** 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
|
|
*
|
|
*``````````````````````````````*
|
|
* BOTTOM INCLUDES *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
** BOTTOM INCLUDES
|
|
*
|
|
PUT COMMON.LIB.MIN
|
|
PUT REQUIRED.LIB.MIN
|
|
*
|