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