mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-24 14:28:06 +11:00
zasm: clarify strlen's API
This commit is contained in:
parent
cc7a4bae58
commit
02c7eb0161
@ -25,6 +25,7 @@ subDEFromHL:
|
||||
ret
|
||||
|
||||
; Returns length of string at (HL) in A.
|
||||
; Doesn't include null termination.
|
||||
strlen:
|
||||
push bc
|
||||
push hl
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
@ -9,12 +9,21 @@ RUNBIN="${TOOLS}/emul/runbin/runbin"
|
||||
KERNEL="${BASE}/kernel"
|
||||
APPS="${BASE}/apps"
|
||||
|
||||
for fn in *.asm; do
|
||||
echo "Running test ${fn}"
|
||||
if ! ${ZASM} "${KERNEL}" "${APPS}" < ${fn} | ${RUNBIN}; then
|
||||
chk() {
|
||||
echo "Running test $1"
|
||||
if ! ${ZASM} "${KERNEL}" "${APPS}" < $1 | ${RUNBIN}; then
|
||||
echo "failed with code ${PIPESTATUS[1]}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ ! -z $1 ]]; then
|
||||
chk $1
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for fn in *.asm; do
|
||||
chk "${fn}"
|
||||
done
|
||||
|
||||
echo "All tests passed!"
|
||||
|
@ -5,6 +5,7 @@ jp test
|
||||
#include "zasm/util.asm"
|
||||
|
||||
testNum: .db 1
|
||||
sFoo: .db "foo", 0
|
||||
|
||||
test:
|
||||
ld hl, 0xffff
|
||||
@ -18,6 +19,12 @@ test:
|
||||
jp nz, fail
|
||||
call nexttest
|
||||
|
||||
ld hl, sFoo
|
||||
call strlen
|
||||
cp 3
|
||||
jp nz, fail
|
||||
call nexttest
|
||||
|
||||
; success
|
||||
xor a
|
||||
halt
|
||||
|
Loading…
Reference in New Issue
Block a user