2 Copyright (C) 2017 Ake Rehnman
3 ake.rehnman(at)gmail.com
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 ;; erase check memory code
23 start_addr: .byte 0x00
29 ; SP must point to start_addr on entry
30 ; first relocate start_addr to the location
35 ldw X,(start_addr+1,SP) ;start addr
36 ldw Y,(byte_cnt+1,SP) ;count
39 ; if count == 0 return
42 jrne .decrcnt ;continue if low word != 0
43 tnz (byte_cnt,SP) ;high byte
46 ; decrement count (byte_cnt)
48 tnzw Y ;low word count
50 dec (byte_cnt,SP) ;high byte
54 ; first check if [start_addr] is 0xff
58 jrne .exit ;exit if not 0xff
60 ; increment start_addr (addr)
63 inc (start_addr,SP) ;increment high byte
67 ldw (start_addr+1,SP),X ;start addr
68 ldw (byte_cnt+1,SP),Y ;count