diff --git a/dist/cpm/build.lua b/dist/cpm/build.lua index e8cc8c79..94025430 100644 --- a/dist/cpm/build.lua +++ b/dist/cpm/build.lua @@ -43,22 +43,22 @@ copy { } copy { - ins = { "bin/cowfe-16bit.ncpm.8080.com" }, + ins = { "bin/cowfe-16bit.ncpm.ncpm.com" }, outs = { "$OBJ/dist/cpm/cowfe.com" } } copy { - ins = { "bin/cowbe-8080.ncpm.8080.com" }, + ins = { "bin/cowbe-8080.ncpm.ncpm.com" }, outs = { "$OBJ/dist/cpm/cowbe.com" } } copy { - ins = { "bin/cowlink-8080.ncpm.8080.com" }, + ins = { "bin/cowlink-ncpm.ncpm.ncpm.com" }, outs = { "$OBJ/dist/cpm/cowlink.com" } } copy { - ins = { "bin/cowasm-8080.ncpm.8080.com" }, + ins = { "bin/cowasm-8080.ncpm.ncpm.com" }, outs = { "$OBJ/dist/cpm/cowasm.com" } } diff --git a/dist/cpmbasic/build.lua b/dist/cpmbasic/build.lua index 301b8d21..e37f1ac3 100644 --- a/dist/cpmbasic/build.lua +++ b/dist/cpmbasic/build.lua @@ -33,22 +33,22 @@ cpmify { } copy { - ins = { "bin/cowfe-basic.ncpmz.z80.com" }, + ins = { "bin/cowfe-basic.ncpmz.ncpmz.com" }, outs = { "$OBJ/dist/cpmbasic/cowfe.com" } } copy { - ins = { "bin/cowbe-basic.ncpmz.z80.com" }, + ins = { "bin/cowbe-basic.ncpmz.ncpmz.com" }, outs = { "$OBJ/dist/cpmbasic/cowbe.com" } } copy { - ins = { "bin/cowlink-basic.ncpmz.z80.com" }, + ins = { "bin/cowlink-basic.ncpmz.ncpmz.com" }, outs = { "$OBJ/dist/cpmbasic/cowlink.com" } } copy { - ins = { "bin/basicify.ncpmz.z80.com" }, + ins = { "bin/basicify.ncpmz.ncpmz.com" }, outs = { "$OBJ/dist/cpmbasic/basicify.com" } } diff --git a/dist/cpmz/build.lua b/dist/cpmz/build.lua index 48bdf0e8..8eae153e 100644 --- a/dist/cpmz/build.lua +++ b/dist/cpmz/build.lua @@ -43,17 +43,17 @@ copy { } copy { - ins = { "bin/cowfe-16bit.ncpmz.z80.com" }, + ins = { "bin/cowfe-16bit.ncpmz.ncpmz.com" }, outs = { "$OBJ/dist/cpmz/cowfe.com" } } copy { - ins = { "bin/cowbe-z80.ncpmz.z80.com" }, + ins = { "bin/cowbe-z80.ncpmz.ncpmz.com" }, outs = { "$OBJ/dist/cpmz/cowbe.com" } } copy { - ins = { "bin/cowlink-8080.ncpmz.z80.com" }, + ins = { "bin/cowlink-ncpmz.ncpmz.ncpmz.com" }, outs = { "$OBJ/dist/cpmz/cowlink.com" } } diff --git a/src/cowlink/arch8080.coh b/src/cowlink/archncpm.coh similarity index 100% rename from src/cowlink/arch8080.coh rename to src/cowlink/archncpm.coh diff --git a/src/cowlink/archncpmz.coh b/src/cowlink/archncpmz.coh new file mode 100644 index 00000000..e9faaf60 --- /dev/null +++ b/src/cowlink/archncpmz.coh @@ -0,0 +1,59 @@ +const STACK_SIZE := 128; + +var workspaceSize: Size[NUM_WORKSPACES]; + +sub E_nl() is + E_b8('\n'); +end sub; + +sub ArchAlignUp(value: Size, alignment: uint8): (newvalue: Size) is + newvalue := value; +end sub; + +sub ArchEmitSubRef(subr: [Subroutine]) is + E_b8('f'); + E_u16(subr.id); + E_b8('_'); + E(subr.name); +end sub; + +sub ArchEmitWSRef(wid: uint8, address: Size) is + E("ws+"); + E_u16(address); +end sub; + +sub ArchEmitHeader(coo: [Coo]) is + E("\torg 100h\n"); + + E("\tld sp, TOP+"); + E_u16(STACK_SIZE); + E_nl(); + + while coo != (0 as [Coo]) loop + var main := coo.index.subroutines[0]; + if main != (0 as [Subroutine]) then + E("\tcall "); + ArchEmitSubRef(main); + E_nl(); + end if; + coo := coo.next; + end loop; + + E("\trst 0\n"); +end sub; + +sub ArchEmitFooter(coo: [Coo]) is + E("TOP:\n"); + + E("ws equ TOP+"); + E_u16(STACK_SIZE); + E_nl(); + + E("LOMEM equ ws+"); + E_u16(workspaceSize[0]); + E_nl(); + + E("\tend\n"); + E_b8(26); +end sub; + diff --git a/src/cowlink/build.lua b/src/cowlink/build.lua index 567d7fea..b15e521d 100644 --- a/src/cowlink/build.lua +++ b/src/cowlink/build.lua @@ -1,10 +1,11 @@ local ARCHS = { - "8080", "ataritos", "basic", "bbct", "bbctn", "cgen", + "ncpm", + "ncpmz", "fuzix6303", "lx386", "lx68k", diff --git a/toolchains.lua b/toolchains.lua index 7ea33425..5047017f 100644 --- a/toolchains.lua +++ b/toolchains.lua @@ -38,11 +38,11 @@ toolchain_ncpm = { name = "ncpm", cowfe = "bin/cowfe-16bit.nncgen.exe", cowbe = "bin/cowbe-8080.nncgen.exe", - linker = "bin/cowlink-8080.nncgen.exe", + linker = "bin/cowlink-ncpm.nncgen.exe", assembler = buildcowasm8080, runtime = "rt/cpm", asmext = ".asm", - binext = ".8080.com", + binext = ".ncpm.com", tester = cpmtest, } @@ -50,11 +50,11 @@ toolchain_ncpmz = { name = "ncpmz", cowfe = "bin/cowfe-16bit.nncgen.exe", cowbe = "bin/cowbe-z80.nncgen.exe", - linker = "bin/cowlink-8080.nncgen.exe", + linker = "bin/cowlink-ncpmz.nncgen.exe", assembler = buildzmac, runtime = "rt/cpmz", asmext = ".z80", - binext = ".z80.com", + binext = ".ncpmz.com", tester = cpmtest, } @@ -116,7 +116,7 @@ toolchain_bbct = { asmext = ".asm", binext = ".bbct", tester = tubeemutest, - archs = { "8080" } + archs = { "cpm" } } toolchain_bbctiny = { @@ -141,7 +141,7 @@ toolchain_bbct6502 = { asmext = ".asm", binext = ".bbct6502", tester = tubeemutest, - archs = { "8080" }, + archs = { "cpm" }, } toolchain_unixv7 = {