Skip to content

Commit

Permalink
Merge pull request #135 from davidgiven/z80
Browse files Browse the repository at this point in the history
Split the ncpm and ncpmz platforms, so they use different linkers.
  • Loading branch information
davidgiven authored Jan 16, 2024
2 parents ec33ae1 + 1df6b83 commit 596072f
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/cpm/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"bin/dist/cpm/cowgol.coo": "rt/cpm+cowgolcoo",
"bin/dist/cpm/cowfe.com": "src/cowfe+cowfe-for-16bit-with-ncpm",
"bin/dist/cpm/cowbe.com": "src/cowbe+cowbe-for-8080-with-ncpm",
"bin/dist/cpm/cowlink.com": "src/cowlink+cowlink-for-8080-with-ncpm",
"bin/dist/cpm/cowlink.com": "src/cowlink+cowlink-for-ncpm-with-ncpm",
},
)
2 changes: 1 addition & 1 deletion dist/cpmz/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"bin/dist/cpmz/cowgol.coo": "rt/cpmz+cowgolcoo",
"bin/dist/cpmz/cowfe.com": "src/cowfe+cowfe-for-16bit-with-ncpmz",
"bin/dist/cpmz/cowbe.com": "src/cowbe+cowbe-for-z80-with-ncpmz",
"bin/dist/cpmz/cowlink.com": "src/cowlink+cowlink-for-8080-with-ncpmz",
"bin/dist/cpmz/cowlink.com": "src/cowlink+cowlink-for-ncpmz-with-ncpmz",
},
)
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.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from src.toolchains import TOOLCHAINS

ARCHS = [
"8080",
"ataritos",
"basic",
"bbct",
Expand All @@ -15,6 +14,8 @@
"lxppc",
"lxthumb2",
"msdos",
"ncpm",
"ncpmz",
"rt11",
"v7unix",
]
Expand Down
4 changes: 2 additions & 2 deletions src/toolchains.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def toolchain(
name="ncpm",
cowfe="src/cowfe+cowfe-for-16bit-with-nncgen",
cowbe="src/cowbe+cowbe-for-8080-with-ncgen",
cowlink="src/cowlink+cowlink-for-8080-with-ncgen",
cowlink="src/cowlink+cowlink-for-ncpm-with-ncgen",
cowwrap="src/cowwrap+cowwrap-with-ncgen",
runtime="rt/cpm",
asmext=".asm",
Expand All @@ -243,7 +243,7 @@ def toolchain(
name="ncpmz",
cowfe="src/cowfe+cowfe-for-16bit-with-nncgen",
cowbe="src/cowbe+cowbe-for-z80-with-ncgen",
cowlink="src/cowlink+cowlink-for-8080-with-ncgen",
cowlink="src/cowlink+cowlink-for-ncpmz-with-ncgen",
cowwrap="src/cowwrap+cowwrap-with-ncgen",
runtime="rt/cpmz",
asmext=".z80",
Expand Down

0 comments on commit 596072f

Please sign in to comment.