*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
*                              *
* COMMON.MAC                   *
*                              *
* AUTHOR:  NATHAN RIGGS        *
* CONTACT: NATHAN.RIGGS@       *
*          OUTLOOK.COM         *
*                              *
* VERSION:   0.3.0             *
* DATE:      10-JAN-2018       *
* ASSEMBLER: MERLIN 8 PRO      *
* LICENSE:   APACHE 2.0        *
* OS:        DOS 3.3           *
*                              *
*------------------------------*
*                              *
* 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               *
*                              *
* MFILL :: FILL MEMORY BLOCK   *
* MMOVE :: MOVE MEMORY BLOCK   *
* BEEP  :: RING MY BELL        *
* DELAY :: DELAY IN MILLISECS  *
* ZSAVE :: SAVE FREE ZERO PAGE *
* ZLOAD :: LOAD SAVE ZERO PAGE *
* MSWAP :: SWAP MEM RANGES     *
*                              *
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
*
*``````````````````````````````*
* MFILL ::   FILL MEMORY BLOCK *
*-                            -*
* FILL BLOCK OF MEMORY WITH    *
* SPECIFIED VALUE.             *
*-                            -*
* PARAMETERS:                  *
*                              *
* ]1 = STARTING ADDRESS        *
* ]2 = LENGTH IN BYTES         *
* ]3 = FILL VALUE              *
*-                            -*
* SAMPLE USAGE:                *
*   MFILL $300;#256;#0         *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
MFILL    MAC
         _ISLIT ]1
         _ISLIT ]2
         LDA   ]3         ; FILL VALUE
         PHA
         JSR   MEMFILL
         <<<
*
*``````````````````````````````*
* BEEP ::  RING BELL X TIMES   *
*-                            -*
* RING THE STANDARD BELL.      *
*-                            -*
* PARAMETERS:                  *
*                              *
* ]1 = NUMBER OF RINGS         *
*-                            -*
* SAMPLE USAGE: BEEP 10        *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
BEEP     MAC
         LUP   ]1
         JSR   BELL
         --^
         <<<
*
*``````````````````````````````*
* MMOVE :: MOVE MEMORY BLOCK   *
*-                            -*
* MOVE A BLOCK OF MEMORY FROM  *
* A SOURCE TO DESTINATION.     *
*-                            -*
* PARAMETERS:                  *
* ]1 = SOURCE ADDRESS          *
* ]2 = DESTINATION ADDRESS     *
* ]3 = NUMBER OF BYTES         *
*-                            -*
* SAMPLE USAGE:                *
*                              *
*   MMOVE $6A00;$7B00;#1024    *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
MMOVE    MAC
         _ISLIT ]1
         _ISLIT ]2
         _ISLIT ]3
         JSR   MEMMOVE
         <<<
*
*``````````````````````````````*
* DELAY :: DELAY X MILLISECS   *
*-                            -*
* DELAY FOR PASSED MILLISECS   *
*-                            -*
* PARAMETERS:                  *
*                              *
* ]1 = NUM OF MILLISECONDS     *
*-                            -*
* SAMPLE USAGE: DELAY #250     *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
DELAY    MAC
         LDY   ]1
         JSR   DELAYMS
         <<<
*
*``````````````````````````````*
* ZSAVE :: SAVE ZERO PAGE      *
*-                            -*
* SAVE ZERO PAGE FREE AREAS    *
* FOR LATER RESTORE.           *
*-                            -*
* PARAMETERS:                  *
*                              *
* ]1 = ADDRESS TO STORE AT     *
*-                            -*
* SAMPLE USAGE: ZSAVE $300     *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
ZSAVE    MAC
         _ISLIT ]1
         JSR   ZMSAVE
         <<<
*
*``````````````````````````````*
* ZLOAD :: LOAD ZERO PAGE      *
*-                            -*
* RESTORE PREVIOUSLY SAVED     *
* FREE ZERO PAGE VALUES.       *
*-                            -*
* PARAMETERS:                  *
*                              *
* ]1 = ADDR TO LOAD FROM       *
*-                            -*
* SAMPLE USAGE: ZLOAD $300     *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
ZLOAD    MAC
         _ISLIT ]1
         JSR   ZMLOAD
         <<<
*
*``````````````````````````````*
* MSWAP :: SWAP MEMORY BLOCKS  *
*-                            -*
* SWAPS THE VALUES STORE IN    *
* ONE LOCATION WITH ANOTHER    *
*-                            -*
* PARAMETERS:                  *
*                              *
* ]1 = FIRST ADDRESS           *
* ]2 = SECOND ADDRESS          *
* ]3 = LENGTH IN BYTES (BYTE)  *
*-                            -*
* SAMPLE USAGE:                *
*  MSWAP $300;$400;#$90        *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
MSWAP    MAC
         _ISLIT ]2
         _ISLIT ]1
         LDA   ]3
         PHA
         JSR   MEMSWAP
         <<<
