Run "all" tests under the 8086 emulator

This commit is contained in:
Virgil Dupras 2020-10-24 23:33:12 -04:00
parent 885e7db054
commit c912158744
5 changed files with 28 additions and 3 deletions

View File

@ -1,4 +1,4 @@
CODE BYE BEGIN, JMPs, AGAIN, ;CODE
CODE BYE HLT, BEGIN, JMPs, AGAIN, ;CODE
CODE S= 2 chkPS,
SI POPx, DI POPx, CH CH XORrr, CL [SI] MOVr[],
CL [DI] CMPr[],

View File

@ -28,6 +28,7 @@ INT 2: KEY. AL = char read
INT 3: AT-XY. AL = x, BL = y
INT 4: BLKREAD. AX = blkid, BX = dest addr
INT 5: BLKWRITE. AX = blkid, BX = src addr
INT 6: RETCODE. AX = retcode.
*/
void int1() {
@ -45,7 +46,17 @@ void int1() {
}
void int2() {
regs.byteregs[regal] = getchar();
int c;
if (fp != NULL) {
c = getc(fp);
} else {
// debug_panel();
c = wgetch(w);
}
if (c == EOF) {
c = 4; // ASCII EOT
}
regs.byteregs[regal] = c;
}
void int3() {
@ -70,6 +81,10 @@ void int5() {
}
}
void int6() {
retcode = getreg16(regax);
}
int main(int argc, char *argv[])
{
INTHOOKS[1] = int1;
@ -77,6 +92,7 @@ int main(int argc, char *argv[])
INTHOOKS[3] = int3;
INTHOOKS[4] = int4;
INTHOOKS[5] = int5;
INTHOOKS[6] = int6;
reset86();
fprintf(stderr, "Using blkfs %s\n", BLKFS_PATH);
blkfp = fopen(BLKFS_PATH, "r+");
@ -131,5 +147,5 @@ int main(int argc, char *argv[])
//emul_printdebug();
}
return 0;
return retcode;
}

View File

@ -13,6 +13,9 @@ CODE _ BX POPx, AX POPx, 4 INT, ;CODE
: EFS@ BLK( _ ;
CODE _ BX POPx, AX POPx, 5 INT, ;CODE
: EFS! BLK( _ ;
( 8086 port doesn't define PC@ and PC!, but test harness uses
it. Our forth binary uses INT 6 for retcode. )
CODE PC! AX POPx, ( discard ) AX POPx, 6 INT, ;CODE
380 LOAD ( xcomp core high )
(entry) _ ( Update LATEST ) PC ORG @ 8 + !
," BLK$ "

View File

@ -2,5 +2,6 @@
run:
$(MAKE) -C ../cvm all
$(MAKE) -C ../emul/z80 all
$(MAKE) -C ../emul/8086 all
cd all && ./runtests.sh
cd z80 && ./runtests.sh

View File

@ -3,6 +3,7 @@
BASE=../..
CVM="${BASE}/cvm/forth"
Z80="${BASE}/emul/z80/forth"
I8086="${BASE}/emul/8086/forth"
TMP=$(mktemp)
chk() {
@ -15,6 +16,10 @@ chk() {
if ! ${Z80} ${TMP}; then
exit 1
fi
echo "Running test $1 under 8086"
if ! ${I8086} ${TMP}; then
exit 1
fi
}
if [ ! -z $1 ]; then