*``````````````````````````````*
* MAC.COMMON                   *
*                              *
* 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.                 *
*                              *
* AUTHOR:    NATHAN RIGGS      *
* CONTACT:   NATHAN.RIGGS@     *
*            OUTLOOK.COM       *
*                              *
* DATE:      30-JUN-2019       *
* ASSEMBLER: MERLIN 8 PRO      *
* OS:        DOS 3.3           *
*                              *
* SUBROUTINE FILES NEEDED      *
*                              *
*  SUB.MEMFILL                 *
*  SUB.MEMMOVE                 *
*  SUB.DELAYMS                 *
*  SUB.ZMSAVE                  *
*  SUB.ZMLOAD                  *
*  SUB.MEMSWAP                 *
*                              *
* 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 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
         _MLIT ]1;WPAR1
         _MLIT ]2;WPAR2
         LDA   ]3         ; FILL VALUE
         STA   BPAR1
         JSR   MEMFILL
         <<<
*
*``````````````````````````````*
* BEEP                         *
*                              *
* RING THE STANDARD BELL.      *
*                              *
* PARAMETERS                   *
*                              *
*  ]1 = NUMBER OF RINGS        *
*                              *
* SAMPLE USAGE                 *
*                              *
*  BEEP #10                    *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
BEEP     MAC
         LDX   ]1
]LP1
         JSR   BELL
         DEX
         CPX   #0
         BNE   ]LP1
         <<<
*
*``````````````````````````````*
* MMOVE                        *
*                              *
* 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
         _MLIT ]1;WPAR1
         _MLIT ]2;WPAR2
         _MLIT ]3;WPAR3
         JSR   MEMMOVE
         <<<
*
*``````````````````````````````*
* DELAY                        *
*                              *
* DELAY FOR PASSED MILLISECS   *
*                              *
* PARAMETERS                   *
*                              *
*  ]1 = NUM OF MILLISECONDS    *
*                              *
* SAMPLE USAGE                 *
*                              *
*  DELAY #250                  *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
DELAY    MAC
         LDY   ]1
         JSR   DELAYMS
         <<<
*
*``````````````````````````````*
* ZSAVE                        *
*                              *
* SAVE ZERO PAGE FREE AREAS    *
* FOR LATER RESTORE.           *
*                              *
* PARAMETERS                   *
*                              *
*  ]1 = ADDRESS TO STORE AT    *
*                              *
* SAMPLE USAGE                 *
*                              *
*  ZSAVE $300                  *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
ZSAVE    MAC
         _AXLIT ]1
         JSR   ZMSAVE
         <<<
*
*``````````````````````````````*
* ZLOAD                        *
*                              *
* RESTORE PREVIOUSLY SAVED     *
* FREE ZERO PAGE VALUES.       *
*                              *
* PARAMETERS                   *
*                              *
*  ]1 = ADDR TO LOAD FROM      *
*                              *
* SAMPLE USAGE                 *
*                              *
*  ZLOAD $300                  *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
ZLOAD    MAC
         _AXLIT ]1
         JSR   ZMLOAD
         <<<
*
*``````````````````````````````*
* MSWAP                        *
*                              *
* SWAPS THE VALUES STORED 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
         _MLIT ]2;WPAR2
         _MLIT ]1;WPAR1
         LDA   ]3
         STA   BPAR1
         JSR   MEMSWAP
         <<<
