diff --git a/plat/cpm/libsys/_trap.s b/plat/cpm/libsys/_trap.s index 678b9cc7f..ec6208a72 100644 --- a/plat/cpm/libsys/_trap.s +++ b/plat/cpm/libsys/_trap.s @@ -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 diff --git a/plat/cpm/libsys/build.lua b/plat/cpm/libsys/build.lua index 780dea626..f9cd9a96e 100644 --- a/plat/cpm/libsys/build.lua +++ b/plat/cpm/libsys/build.lua @@ -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", diff --git a/plat/cpm/libsys/make_trap.sh b/plat/cpm/libsys/make_trap.sh new file mode 100755 index 000000000..25562fa2a --- /dev/null +++ b/plat/cpm/libsys/make_trap.sh @@ -0,0 +1,12 @@ +#!/bin/sh +cat <