2018-11-03 18:59:24 +00:00
|
|
|
*
|
|
|
|
********************************
|
|
|
|
* *
|
|
|
|
* -< COMMON DEMO )- *
|
|
|
|
* *
|
2019-01-10 04:12:28 +00:00
|
|
|
* VERSION 0.3.0 *
|
2018-11-03 18:59:24 +00:00
|
|
|
* *
|
2019-01-10 04:12:28 +00:00
|
|
|
* 10-JAN-2019 *
|
2018-11-03 18:59:24 +00:00
|
|
|
* *
|
|
|
|
********************************
|
|
|
|
* *
|
|
|
|
* NATHAN D. RIGGS *
|
|
|
|
* NATHAN.RIGGS@OUTLOOK.COM *
|
|
|
|
* *
|
|
|
|
********************************
|
|
|
|
*
|
|
|
|
** ASSEMBLER DIRECTIVES
|
|
|
|
*
|
|
|
|
CYC AVE
|
|
|
|
EXP ONLY
|
2019-01-14 15:57:05 +00:00
|
|
|
TR ON
|
2018-11-03 18:59:24 +00:00
|
|
|
DSK COMMON.DEMO
|
2018-12-15 02:23:32 +00:00
|
|
|
OBJ $BFE0
|
|
|
|
ORG $6000
|
2018-11-03 18:59:24 +00:00
|
|
|
*
|
|
|
|
*``````````````````````````````*
|
2018-12-15 02:23:32 +00:00
|
|
|
* TOP INCLUDES (HOOKS,MACROS) *
|
2018-11-03 18:59:24 +00:00
|
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
|
|
*
|
2019-04-26 22:49:10 +00:00
|
|
|
PUT MIN.VARS.REQUIRED
|
|
|
|
USE MIN.MAC.REQUIRED
|
|
|
|
PUT MIN.HOOKS.REQUIRED
|
|
|
|
USE MIN.MAC.COMMON
|
|
|
|
PUT MIN.HOOKS.COMMON
|
2018-11-03 18:59:24 +00:00
|
|
|
*
|
|
|
|
*``````````````````````````````*
|
|
|
|
* PROGRAM MAIN BODY *
|
|
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
|
|
*
|
2019-01-10 04:12:28 +00:00
|
|
|
** MFILL DOES ABOUT WHAT ITS NAME
|
2018-11-03 18:59:24 +00:00
|
|
|
** IMPLIES: IT FILLS A BLOCK OF MEMORY
|
2018-12-15 02:23:32 +00:00
|
|
|
** WITH A PARTICULAR CHARACTER.
|
2018-11-03 18:59:24 +00:00
|
|
|
*
|
2019-01-14 15:57:05 +00:00
|
|
|
_PRNT " ",8D8D
|
2019-01-10 04:12:28 +00:00
|
|
|
MFILL #$300;#10;#0
|
|
|
|
_PRNT "MFILL FILLS A PORTION OF MEMORY WITH",8D
|
2018-12-15 02:23:32 +00:00
|
|
|
_PRNT "A SPECIFIED VALUE. ",8D8D
|
2019-04-26 22:49:10 +00:00
|
|
|
DUMP #$300;#10
|
2018-12-15 02:23:32 +00:00
|
|
|
_WAIT
|
2018-11-03 18:59:24 +00:00
|
|
|
*
|
2019-01-10 04:12:28 +00:00
|
|
|
** MMOVE ALSO DOES WHAT IT SAYS: IT MOVES
|
2018-11-03 18:59:24 +00:00
|
|
|
** A BLOCK OF MEMORY FROM A SOURCE LOCATION
|
|
|
|
** TO A DESTINATION LOCATION. WE'LL NOW MOVE
|
|
|
|
** THOSE ZEROES PLACED BY MEMFILL TO ANOTHER
|
2018-12-15 02:23:32 +00:00
|
|
|
** LOCATION.
|
|
|
|
*
|
|
|
|
_PRNT " ",8D8D
|
2019-01-10 04:12:28 +00:00
|
|
|
_PRNT "MMOVE COPIES A SPAN OF MEMORY",8D
|
2018-12-15 02:23:32 +00:00
|
|
|
_PRNT "FROM A SOURCE TO A DESTINATION ADDRESS.",8D8D
|
|
|
|
_PRNT "SO MOVING $300 TO $320 RESULTS IN:",8D8D
|
2019-04-26 22:49:10 +00:00
|
|
|
MMOVE #$300;#$320;#10
|
|
|
|
DUMP #$320;#10
|
2018-12-15 02:23:32 +00:00
|
|
|
_WAIT
|
2018-11-03 18:59:24 +00:00
|
|
|
*
|
2019-01-10 04:12:28 +00:00
|
|
|
** DELAY RUNS THROUGH CYCLES OF THE
|
2018-11-03 18:59:24 +00:00
|
|
|
** 6502 UNTIL A CERTAIN AMOUNT OF TIME
|
|
|
|
** HAS PASSED.
|
|
|
|
*
|
2018-12-15 02:23:32 +00:00
|
|
|
_PRNT " ",8D8D
|
2019-01-10 04:12:28 +00:00
|
|
|
_PRNT "DELAY DELAYS A SPECIFIED NUMBER OF",8D
|
2018-12-15 02:23:32 +00:00
|
|
|
_PRNT "MILLISECONDS. 250 MILLISECONDS = 1/4 SECOND.",8D8D
|
2018-11-03 18:59:24 +00:00
|
|
|
*
|
2019-01-10 04:12:28 +00:00
|
|
|
DELAY #250 ; TIME IN MILLISECONDS
|
2018-11-03 18:59:24 +00:00
|
|
|
; IS PASSED VIA Y
|
|
|
|
; 250 = 1/4 SECOND
|
2018-12-15 02:23:32 +00:00
|
|
|
BEEP 1
|
|
|
|
_PRNT "1/4 SECOND",8D
|
2019-01-10 04:12:28 +00:00
|
|
|
DELAY #250
|
2018-12-15 02:23:32 +00:00
|
|
|
BEEP 2
|
|
|
|
_PRNT "1/4 SECOND",8D
|
2019-01-10 04:12:28 +00:00
|
|
|
DELAY #250
|
2018-12-15 02:23:32 +00:00
|
|
|
BEEP 3
|
|
|
|
_PRNT "1/4 SECOND",8D
|
2019-01-10 04:12:28 +00:00
|
|
|
DELAY #250
|
2018-12-15 02:23:32 +00:00
|
|
|
BEEP 4
|
|
|
|
_PRNT "1/4 SECOND",8D
|
2018-11-03 18:59:24 +00:00
|
|
|
*
|
2018-12-15 02:23:32 +00:00
|
|
|
_PRNT " ",8D8D
|
|
|
|
_WAIT
|
|
|
|
*
|
2019-01-10 04:12:28 +00:00
|
|
|
** ZSAVE BACKS UP THE "FREE" AREAS OF
|
2018-11-03 18:59:24 +00:00
|
|
|
** 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.
|
|
|
|
*
|
2018-12-15 02:23:32 +00:00
|
|
|
** 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.
|
2018-11-03 18:59:24 +00:00
|
|
|
*
|
|
|
|
LDA #01
|
|
|
|
STA $06
|
|
|
|
LDA #02
|
|
|
|
STA $07
|
|
|
|
LDA #03
|
|
|
|
STA $08
|
|
|
|
LDA #04
|
|
|
|
STA $09
|
2019-04-26 22:49:10 +00:00
|
|
|
ZSAVE #$300
|
2018-12-15 02:23:32 +00:00
|
|
|
*
|
|
|
|
_PRNT " ",8D8D
|
2019-01-10 04:12:28 +00:00
|
|
|
_PRNT "ZSAVE SAVES THE STATE OF THE ZERO PAGE ",8D
|
2018-12-15 02:23:32 +00:00
|
|
|
_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
|
2019-04-26 22:49:10 +00:00
|
|
|
DUMP #$300;#18
|
2018-12-15 02:23:32 +00:00
|
|
|
_PRNT " ",8D8D
|
|
|
|
_PRNT "18 BYTES ARE USED.",8D8D
|
|
|
|
_WAIT
|
2018-11-03 18:59:24 +00:00
|
|
|
*
|
|
|
|
** YOU CAN RESTORE THE ZERO PAGE TO ITS
|
2019-01-10 04:12:28 +00:00
|
|
|
** PRIOR STATE BY THEN CALLING ZLOAD.
|
2018-11-03 18:59:24 +00:00
|
|
|
*
|
2019-04-26 22:49:10 +00:00
|
|
|
ZLOAD #$300
|
2018-11-03 18:59:24 +00:00
|
|
|
*
|
2018-12-15 02:23:32 +00:00
|
|
|
_PRNT " ",8D8D
|
|
|
|
_PRNT "YOU CAN THEN RESTORE THE FREE ZERO PAGE",8D
|
2019-01-10 04:12:28 +00:00
|
|
|
_PRNT "LOCATIONS WITH ZLOAD. THERE ISN'T ANY",8D
|
2018-12-15 02:23:32 +00:00
|
|
|
_PRNT "MEANINGFUL OUTPUT TO PUT HERE TO ",8D
|
|
|
|
_PRNT "ILLUSTRATE THAT, SO USE YOUR IMAGINATION!",8D8D
|
|
|
|
_WAIT
|
2019-01-10 04:12:28 +00:00
|
|
|
*
|
|
|
|
** 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
|
2019-04-26 22:49:10 +00:00
|
|
|
DUMP #$300;#10
|
|
|
|
DUMP #$320;#10
|
|
|
|
MSWAP #$300;#$320;#10
|
2019-01-10 04:12:28 +00:00
|
|
|
_PRNT " ",8D
|
|
|
|
_PRNT "AND AFTER SWAP: ",8D8D
|
2019-04-26 22:49:10 +00:00
|
|
|
DUMP #$300;#10
|
|
|
|
DUMP #$320;#10
|
2019-01-10 04:12:28 +00:00
|
|
|
_WAIT
|
2018-11-03 18:59:24 +00:00
|
|
|
*
|
|
|
|
JMP REENTRY
|
|
|
|
*
|
|
|
|
*``````````````````````````````*
|
|
|
|
* BOTTOM INCLUDES *
|
|
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
|
|
*
|
|
|
|
** BOTTOM INCLUDES
|
|
|
|
*
|
2019-04-26 22:49:10 +00:00
|
|
|
PUT MIN.LIB.REQUIRED
|
2018-11-03 18:59:24 +00:00
|
|
|
*
|
2019-01-14 15:57:05 +00:00
|
|
|
** INDIVIDUAL SUBROUTINE INCLUDES
|
|
|
|
*
|
|
|
|
* COMMON LIBRARY SUBROUTINES
|
|
|
|
*
|
2019-04-26 22:49:10 +00:00
|
|
|
PUT MIN.SUB.MEMFILL
|
|
|
|
PUT MIN.SUB.MEMMOVE
|
|
|
|
PUT MIN.SUB.DELAYMS
|
|
|
|
PUT MIN.SUB.ZMSAVE
|
|
|
|
PUT MIN.SUB.ZMLOAD
|
|
|
|
PUT MIN.SUB.MEMSWAP
|