Generate traps procedurally. For some reason they always keep getting pulled
in, though...
This commit is contained in:
parent
ec2ea1feff
commit
48a9c48f56
|
@ -11,6 +11,10 @@
|
|||
.define efdivz, eiund, efund, econv, estack, eheap, eillins, eoddz
|
||||
.define ecase, ememflt, ebadptr, ebadpc, ebadlae, ebadmon, ebadlin, ebadgto
|
||||
.define eunimpl
|
||||
.define EARRAY, ERANGE, ESET, EIOVFL, EFOVFL, EFUNFL, EIDIVZ, EIDIVZ
|
||||
.define EFDIVZ, EIUND, EFUND, ECONV, ESTACK, EHEAP, EILLINS, EODDZ
|
||||
.define ECASE, EMEMFLT, EBADPTR, EBADPC, EBADLAE, EBADMON, EBADLIN, EBADGTO
|
||||
.define EUNIMPL
|
||||
|
||||
! Trap routine
|
||||
! Expects trap number on stack.
|
||||
|
@ -45,126 +49,6 @@
|
|||
EBADGTO = 27
|
||||
EUNIMPL = 63 ! unimplemented em-instruction called
|
||||
|
||||
earray: lxi h,EARRAY
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
erange: lxi h,ERANGE
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
eset: lxi h,ESET
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
eiovfl: lxi h,EIOVFL
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
efovfl: lxi h,EFOVFL
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
efunfl: lxi h,EFUNFL
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
eidivz: lxi h,EIDIVZ
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
efdivz: lxi h,EFDIVZ
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
eiund: lxi h,EIUND
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
efund: lxi h,EFUND
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
econv: lxi h,ECONV
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
estack: lxi h,ESTACK
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
eheap: lxi h,EHEAP
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
eillins:lxi h,EILLINS
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
eoddz: lxi h,EODDZ
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
ecase: lxi h,ECASE
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
ememflt:lxi h,EMEMFLT
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
ebadptr:lxi h,EBADPTR
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
ebadpc: lxi h,EBADPC
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
ebadlae:lxi h,EBADLAE
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
ebadmon:lxi h,EBADMON
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
ebadlin:lxi h,EBADLIN
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
ebadgto:lxi h,EBADGTO
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
eunimpl:lxi h,EUNIMPL
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
|
||||
.trp:
|
||||
pop h
|
||||
xthl
|
||||
|
|
|
@ -45,6 +45,33 @@ local bdos_calls = {
|
|||
[40] = "cpm_write_random_filled",
|
||||
}
|
||||
|
||||
local trap_calls = {
|
||||
"EARRAY",
|
||||
"ERANGE",
|
||||
"ESET",
|
||||
"EIOVFL",
|
||||
"EFOVFL",
|
||||
"EFUNFL",
|
||||
"EIDIVZ",
|
||||
"EFDIVZ",
|
||||
"EIUND",
|
||||
"EFUND",
|
||||
"ECONV",
|
||||
"ESTACK",
|
||||
"EHEAP",
|
||||
"EILLINS",
|
||||
"EODDZ",
|
||||
"ECASE",
|
||||
"EMEMFLT",
|
||||
"EBADPTR",
|
||||
"EBADPC",
|
||||
"EBADLAE",
|
||||
"EBADMON",
|
||||
"EBADLIN",
|
||||
"EBADGTO",
|
||||
"EUNIMPL",
|
||||
}
|
||||
|
||||
local generated = {}
|
||||
for n, name in pairs(bdos_calls) do
|
||||
generated[#generated+1] = normalrule {
|
||||
|
@ -56,6 +83,16 @@ for n, name in pairs(bdos_calls) do
|
|||
}
|
||||
}
|
||||
end
|
||||
for _, name in pairs(trap_calls) do
|
||||
generated[#generated+1] = normalrule {
|
||||
name = name,
|
||||
ins = { "./make_trap.sh" },
|
||||
outleaves = { name..".s" },
|
||||
commands = {
|
||||
"%{ins[1]} "..name:lower().." "..name.." > %{outs}"
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
acklibrary {
|
||||
name = "lib",
|
||||
|
|
12
plat/cpm/libsys/make_trap.sh
Executable file
12
plat/cpm/libsys/make_trap.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
cat <<EOF
|
||||
#
|
||||
#include "asm.h"
|
||||
.define $1
|
||||
$1:
|
||||
lxi h, $2
|
||||
push h
|
||||
call .trp
|
||||
ret
|
||||
EOF
|
||||
|
Loading…
Reference in a new issue