Standard Library
Helper macros from asm/std.asm. Include them after cpu.asm/ext.asm to get simple data routines.
MEMCPY
- Syntax:
MEMCPY i len srchi srclo dsthi dstlo - Inputs:
iloop counter (start at 0),lenstop value,srchi:srclosource pointer,dsthi:dstlodestination pointer. - Behavior: Copies bytes from source to destination until
i == len. Both pointers are incremented withINC16. Restoresieach iteration via push/pop. - Scratch: uses stack to save
i; flags fromCMP,INC,INC16.
STRCMP
- Syntax:
STRCMP i j srchi srclo dsthi dstlo - Inputs:
srchi:srclofirst string pointer,dsthi:dstlosecond string pointer. - Outputs:
ireceives0when strings match,1otherwise. - Behavior: Walks both zero-terminated strings byte-by-byte. Returns early on mismatch, or when a
0x00terminator is reached on both sides. - Scratch: uses
i,j, flags fromCMP,CMPI,JZR/JNZR, and increments addresses withINC16.