* ******************************** * * * -< COMMON DEMO )- * * * * VERSION 0.3.0 * * * * 10-JAN-2019 * * * ******************************** * * * NATHAN D. RIGGS * * NATHAN.RIGGS@OUTLOOK.COM * * * ******************************** * ** ASSEMBLER DIRECTIVES * CYC AVE EXP ONLY TR ON DSK COMMON.DEMO OBJ $BFE0 ORG $6000 * *``````````````````````````````* * TOP INCLUDES (HOOKS,MACROS) * *,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,* * PUT MIN.VARS.REQUIRED USE MIN.MAC.REQUIRED PUT MIN.HOOKS.REQUIRED USE MIN.MAC.COMMON PUT MIN.HOOKS.COMMON * *``````````````````````````````* * PROGRAM MAIN BODY * *,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,* * ** MFILL DOES ABOUT WHAT ITS NAME ** IMPLIES: IT FILLS A BLOCK OF MEMORY ** WITH A PARTICULAR CHARACTER. * _PRNT " ",8D8D 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 * JMP REENTRY * *``````````````````````````````* * BOTTOM INCLUDES * *,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,* * ** BOTTOM INCLUDES * PUT MIN.LIB.REQUIRED * ** INDIVIDUAL SUBROUTINE INCLUDES * * COMMON LIBRARY SUBROUTINES * PUT MIN.SUB.MEMFILL PUT MIN.SUB.MEMMOVE PUT MIN.SUB.DELAYMS PUT MIN.SUB.ZMSAVE PUT MIN.SUB.ZMLOAD PUT MIN.SUB.MEMSWAP