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

@@ -6,21 +6,21 @@
; 1998-05-29, Ullrich von Bassewitz
; 2015-11-06, Greg King
;
; void* __fastcall__ _bzero (void* ptr, size_t n);
; void* __fastcall__ __bzero (void* ptr, size_t n);
; void __fastcall__ bzero (void* ptr, size_t n);
; void* __fastcall__ memset (void* ptr, int c, size_t n);
;
; NOTE: bzero() will return its first argument, as memset() does. It is no
; problem to declare the return value as void, because it can be ignored.
; _bzero() (note the leading underscore) is declared with the proper
; return type because the compiler will replace memset() by _bzero() if
; __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 .XA is of any use.
;
; NOTE: This function uses entry points from "pce/memcpy.s"!
;
.export __bzero, _bzero, _memset
.export ___bzero, _bzero, _memset
.import memcpy_getparams, memcpy_increment
.import pushax, popax
@@ -30,7 +30,7 @@
; ----------------------------------------------------------------------
__bzero:
___bzero:
_bzero: pha
cla ; fill with zeros
jsr pushax ; (high byte isn't important)