1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 16:08:06 +11:00

zasm: clarify strlen's API

This commit is contained in:
Virgil Dupras 2019-07-23 09:28:39 -04:00
parent cc7a4bae58
commit 02c7eb0161
3 changed files with 21 additions and 4 deletions

View File

@ -25,6 +25,7 @@ subDEFromHL:
ret
; Returns length of string at (HL) in A.
; Doesn't include null termination.
strlen:
push bc
push hl

View File

@ -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!"

View File

@ -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