2000-05-28 13:40:48 +00:00
|
|
|
;
|
2005-02-26 09:06:46 +00:00
|
|
|
; Ullrich von Bassewitz, 1998-09-17, 2005-02-26.
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; Zero the bss segment.
|
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export zerobss
|
|
|
|
.import __BSS_RUN__, __BSS_SIZE__
|
|
|
|
.importzp ptr1
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
2015-10-14 20:52:09 +00:00
|
|
|
.code
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
zerobss:
|
2013-05-09 11:56:54 +00:00
|
|
|
lda #<__BSS_RUN__
|
|
|
|
sta ptr1
|
|
|
|
lda #>__BSS_RUN__
|
|
|
|
sta ptr1+1
|
|
|
|
lda #0
|
|
|
|
tay
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; Clear full pages
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
L1: ldx #>__BSS_SIZE__
|
|
|
|
beq L3
|
|
|
|
L2: sta (ptr1),y
|
|
|
|
iny
|
|
|
|
bne L2
|
|
|
|
inc ptr1+1
|
|
|
|
dex
|
|
|
|
bne L2
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; Clear remaining page (y is zero on entry)
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
L3: cpy #<__BSS_SIZE__
|
|
|
|
beq L4
|
|
|
|
sta (ptr1),y
|
|
|
|
iny
|
|
|
|
bne L3
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; Done
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
L4: rts
|