Skip to content

Commit

Permalink
Split the ncpm and ncpmz platforms, so they don't use the same linker…
Browse files Browse the repository at this point in the history
… (which

only worked because the z80 assembler I was using understood 8080
instructions...).

--HG--
branch : bazel
  • Loading branch information
davidgiven committed Jan 16, 2024
1 parent f31403c commit 8bd6277
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 18 deletions.
8 changes: 4 additions & 4 deletions dist/cpm/build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
}

8 changes: 4 additions & 4 deletions dist/cpmbasic/build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
}

6 changes: 3 additions & 3 deletions dist/cpmz/build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
}

File renamed without changes.
59 changes: 59 additions & 0 deletions src/cowlink/archncpmz.coh
Original file line number Diff line number Diff line change
@@ -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;

3 changes: 2 additions & 1 deletion src/cowlink/build.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
local ARCHS = {
"8080",
"ataritos",
"basic",
"bbct",
"bbctn",
"cgen",
"ncpm",
"ncpmz",
"fuzix6303",
"lx386",
"lx68k",
Expand Down
12 changes: 6 additions & 6 deletions toolchains.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ 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,
}

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,
}

Expand Down Expand Up @@ -116,7 +116,7 @@ toolchain_bbct = {
asmext = ".asm",
binext = ".bbct",
tester = tubeemutest,
archs = { "8080" }
archs = { "cpm" }
}

toolchain_bbctiny = {
Expand All @@ -141,7 +141,7 @@ toolchain_bbct6502 = {
asmext = ".asm",
binext = ".bbct6502",
tester = tubeemutest,
archs = { "8080" },
archs = { "cpm" },
}

toolchain_unixv7 = {
Expand Down

0 comments on commit 8bd6277

Please sign in to comment.