2001-07-15 16:09:50 +00:00
|
|
|
;
|
|
|
|
; void* memset (void* ptr, int c, size_t n);
|
2002-12-21 00:05:51 +00:00
|
|
|
; void* _bzero (void* ptr, size_t n);
|
|
|
|
; void bzero (void* ptr, size_t n);
|
2001-07-15 16:09:50 +00:00
|
|
|
;
|
|
|
|
; Maciej 'YTM/Elysium' Witkowiak, 15.07.2001
|
|
|
|
;
|
2002-12-21 00:05:51 +00:00
|
|
|
; NOTE: bzero will return it's first argument as memset does. It is no problem
|
|
|
|
; to declare the return value as void, since it may be ignored. _bzero
|
|
|
|
; (note the leading underscore) is declared with the proper return type,
|
|
|
|
; because the compiler will replace memset by _bzero if the fill value
|
|
|
|
; is zero, and the optimizer looks at the return type to see if the value
|
|
|
|
; in a/x is of any use.
|
2001-07-15 16:09:50 +00:00
|
|
|
|
2002-12-21 00:05:51 +00:00
|
|
|
|
|
|
|
.export _memset, _bzero, __bzero
|
2001-08-15 16:09:35 +00:00
|
|
|
.import popa, popax
|
2001-07-15 16:09:50 +00:00
|
|
|
|
2001-08-15 16:09:35 +00:00
|
|
|
.include "../inc/jumptab.inc"
|
|
|
|
.include "../inc/geossym.inc"
|
|
|
|
|
2002-12-21 00:05:51 +00:00
|
|
|
_bzero:
|
|
|
|
__bzero:
|
|
|
|
sta r0L
|
|
|
|
stx r0H
|
|
|
|
lda #0
|
|
|
|
sta r2L ; fill with zeros
|
|
|
|
beq common
|
|
|
|
|
2001-08-15 16:09:35 +00:00
|
|
|
_memset:
|
|
|
|
sta r0L
|
|
|
|
stx r0H
|
|
|
|
jsr popax
|
|
|
|
sta r2L
|
2002-12-21 00:05:51 +00:00
|
|
|
common: jsr popax
|
2001-08-15 16:09:35 +00:00
|
|
|
sta r1L
|
2002-12-21 00:49:25 +00:00
|
|
|
pha
|
2001-08-15 16:09:35 +00:00
|
|
|
stx r1H
|
2002-12-21 00:49:25 +00:00
|
|
|
txa
|
|
|
|
pha
|
2002-12-21 00:05:51 +00:00
|
|
|
jsr FillRam
|
2002-12-21 00:49:25 +00:00
|
|
|
pla ; restore ptr and return it
|
|
|
|
tax
|
|
|
|
pla
|
2002-12-21 00:05:51 +00:00
|
|
|
rts
|