Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow DDT.COM to run #113

Merged
merged 1 commit into from
Jun 1, 2024
Merged

Allow DDT.COM to run #113

merged 1 commit into from
Jun 1, 2024

Conversation

skx
Copy link
Owner

@skx skx commented Jun 1, 2024

This was an interesting case to track down, it seems that DDT is special - it loads and copies itself elsewhere in RAM, then it updates the jump tables at the zero-page.

The end result is that it can get re'execd when it needs to do things.

Because I had a breakpoint set on 0x0000 (i.e. coldboot) I was getting trapped when DDT should have been re-invoked. I think that changing the traps to the default address we pretend BIOS/BDOS are located is enough to make it run, and simple execution seems to work.

Compiling a simple binary:

A>
A>asm hello
CP/M ASSEMBLER - VER 2.0
011B
000H USE FACTOR
END OF ASSEMBLY

A>load hello

FIRST ADDRESS 0100
LAST  ADDRESS 011A
BYTES READ    001B
RECORDS WRITTEN 01

Loading a simple binary:

A>ddt hello.com
DDT VERS 2.2
NEXT  PC
0180 0100
-d0100
0100 0E 09 11 09 01 CD 05 00 C9 0D 0A 48 65 6C 6C 6F ...........Hello
0110 2C 20 57 6F 72 6C 64 21 0D 0A 24 00 00 00 00 00 , World!..$.....
0120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0180 1A 84 12 13 C3 69 01 D1 2E 00 E9 0E 10 CD 05 00 .....i..........
0190 32 5F 1E C9 21 66 1E 70 2B 71 2A 65 1E EB 0E 11 2_..!f.p+q*e....
01A0 CD 05 00 32 5F 1E C9 11 00 00 0E 12 CD 05 00 32 ...2_..........2
01B0 5F 1E C9 21 68 1E 70 2B 71 2A 67 1E EB 0E 13 CD _..!h.p+q*g.....
-L0100 0108
  0100  MVI  C,09
  0102  LXI  D,0109
  0105  CALL 0005
  0108  RET
-T2
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0100 MVI  C,09
C0Z0M0E0I0 A=00 B=0009 D=0000 H=0000 S=0100 P=0102 LXI  D,0109*0105
-t
C0Z0M0E0I0 A=00 B=0009 D=0109 H=0000 S=0100 P=0105 CALL 0005
Hello, World!

Seems like we get stuck here, but dump/assemble/list work. We'll pretend that's enough.

This was an interesting case to track down, it seems that DDT is
special - it loads and copies itself elsewhere in RAM, then it updates
the jump tables at the zero-page.

The end result is that it can get re'execd when it needs to do things.

Because I had a breakpoint set on 0x0000 (i.e. coldboot) I was getting
trapped when DDT should have been re-invoked.  I think that changing
the traps to the default address we pretend BIOS/BDOS are located
is enough to make it run, and simple execution seems to work.

Compiling a simple binary:

```
A>
A>asm hello
CP/M ASSEMBLER - VER 2.0
011B
000H USE FACTOR
END OF ASSEMBLY

A>load hello

FIRST ADDRESS 0100
LAST  ADDRESS 011A
BYTES READ    001B
RECORDS WRITTEN 01
```

Loading a simple binary:

```
A>ddt hello.com
DDT VERS 2.2
NEXT  PC
0180 0100
-d0100
0100 0E 09 11 09 01 CD 05 00 C9 0D 0A 48 65 6C 6C 6F ...........Hello
0110 2C 20 57 6F 72 6C 64 21 0D 0A 24 00 00 00 00 00 , World!..$.....
0120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0180 1A 84 12 13 C3 69 01 D1 2E 00 E9 0E 10 CD 05 00 .....i..........
0190 32 5F 1E C9 21 66 1E 70 2B 71 2A 65 1E EB 0E 11 2_..!f.p+q*e....
01A0 CD 05 00 32 5F 1E C9 11 00 00 0E 12 CD 05 00 32 ...2_..........2
01B0 5F 1E C9 21 68 1E 70 2B 71 2A 67 1E EB 0E 13 CD _..!h.p+q*g.....
-L0100 0108
  0100  MVI  C,09
  0102  LXI  D,0109
  0105  CALL 0005
  0108  RET
-T2
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0100 MVI  C,09
C0Z0M0E0I0 A=00 B=0009 D=0000 H=0000 S=0100 P=0102 LXI  D,0109*0105
-t
C0Z0M0E0I0 A=00 B=0009 D=0109 H=0000 S=0100 P=0105 CALL 0005
Hello, World!
```

Seems like we get stuck here, but dump/assemble/list work.  We'll
pretend that's enough.
@skx skx merged commit 4a94572 into master Jun 1, 2024
2 checks passed
@skx skx deleted the 112-ddt branch June 1, 2024 14:50
@skx skx mentioned this pull request Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant