*
*``````````````````````````````*
* ZMLOAD        (NATHAN RIGGS) *
*                              *
* INPUT:                       *
*                              *
*  .A = LOBYTE OF SRC ADDR     *
*  .X = HIBYTE OF SRC ADDR     *
*                              *
* OUTPUT:                      *
*                              *
*  RESTORES PREVIOUSLY SAVED   *
*  ZERO PAGE VALUES FROM       *
*  HIGHER MEMORY LOCATION.     *
*                              *
* DESTROYS: AXYNVBDIZCMS       *
*           ^^^^    ^^^        *
*                              *
* CYCLES: 123+                 *
* SIZE: 71 BYTES               *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
]ADR1    EQU   VARTAB     ; 2 BYTES
]ADR2    EQU   VARTAB+2   ; 2 BYTES
]Z       HEX   191EE3EBECED
         HEX   EEEFFAFBFCFDFEFF
         HEX   00
*
ZMLOAD
*
         STA   ADDR1      ; BACKUP SOURCE ADDR LOBYTE
         STX   ADDR1+1    ; BACKUP HIBYTE
         LDY   #255       ; RESET INDEX
         LDA   (ADDR1),Y
         STA   ]ADR1      ; BACKUP $06
         INY
         LDA   (ADDR1),Y  ; BACKUP $07
         STA   ]ADR1+1
         INY              ; INCREASE INDEX
         LDA   (ADDR1),Y  ; BACKUP $07
         STA   ]ADR2
         INY
         LDA   (ADDR1),Y  ; BACKUP $08
         STA   ]ADR2+1
:LP
         INY
         LDA   ]Z,Y
         BEQ   :EXIT      ; IF NULL, EXIT
         STA   ADDR2
         LDA   #0
         STA   ADDR2+1
         LDA   (ADDR1),Y
         STA   (ADDR2),Y
         JMP   :LP
:EXIT
         LDY   #0
         LDA   (ADDR1),Y+3 ; NOW RESTORE FIRST
         STA   $09        ; FOUR BYTES
         LDA   (ADDR1),Y+2
         STA   $08
         LDA   (ADDR1),Y+1
         TAX
         LDA   (ADDR1),Y
         TAY
         TXA
         STA   ADDR1+1
         TYA
         STA   ADDR1
         RTS
