1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-30 01:29:37 +00:00
cc65/libsrc/common/zerobss.s
cuz 6ec87c5dd9 Move initialization code into the init segment
git-svn-id: svn://svn.cc65.org/cc65/trunk@3404 b7a2c559-68d2-44c3-8de9-860c34a00d81
2005-02-26 09:06:46 +00:00

47 lines
488 B
ArmAsm

;
; Ullrich von Bassewitz, 1998-09-17, 2005-02-26.
;
; Zero the bss segment.
;
.export zerobss
.import __BSS_RUN__, __BSS_SIZE__
.importzp ptr1
.segment "INIT"
zerobss:
lda #<__BSS_RUN__
sta ptr1
lda #>__BSS_RUN__
sta ptr1+1
lda #0
tay
; Clear full pages
L1: ldx #>__BSS_SIZE__
beq L3
L2: sta (ptr1),y
iny
bne L2
inc ptr1+1
dex
bne L2
; Clear remaining page (y is zero on entry)
L3: cpy #<__BSS_SIZE__
beq L4
sta (ptr1),y
iny
bne L3
; Done
L4: rts