add extra underscore to _bzero, add a test for bzero/memset

This commit is contained in:
mrdudz
2022-08-29 23:20:48 +02:00
parent 3b03a96375
commit 5bda57de87
12 changed files with 86 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
;
; void* __fastcall__ memset (void* ptr, int c, size_t n);
; void* __fastcall__ _bzero (void* ptr, size_t n);
; void* __fastcall__ __bzero (void* ptr, size_t n);
; void __fastcall__ bzero (void* ptr, size_t n);
;
; Ullrich von Bassewitz, 29.05.1998
@@ -8,19 +8,19 @@
; Christian Krueger, 12.09.2009, slightly improved 12.01.2011
;
; 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
; to declare the return value as void, since it may be ignored. __bzero
; (note the leading underscores) 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.
;
.export _memset, _bzero, __bzero
.export _memset, _bzero, ___bzero
.import popax
.importzp sp, ptr1, ptr2, ptr3
_bzero:
__bzero:
___bzero:
sta ptr3
stx ptr3+1 ; Save n
ldx #0 ; Fill with zeros