I seem to be losing the battle against my stupidity.
This site explains system calls in different versions of CP / M.
However, when I try to use call 2 (C_WRITE, console output), nothing happens.
I have the following code.
ORG 100h LD E,'a' LD C,2 CALL 5 CALL 0
I read it here from memory. If there are typos, be sure that they were not in the original, since the file was compiled and I got a COM file.
I think the lines mean the following:
- Make sure it loads at 100h (0h - FFh, which is the zero page).
- Load ASCII 'a' into register E for system call 2.
- Load integer 2 into register C for system call 2.
- Make a system call (JMP for the system call is located at address 5 on the zero page).
- The final program (the exit command is located at address 0 on the zero page).
The program starts and exits without problems. If I delete the last command, it hangs on the computer (which, it seems to me, is also expected, and shows that CALL 0 is working).
However, it does not print the ASCII character. (But he prints an extra new line, but the system could do that.)
How can I get CP / M to do what a system call should do? What am I doing wrong?
UPDATE: The problem was that all the assemblers I tried were expecting a specific source file format. This file worked with Microsoft macro assembler:
.Z80 START: LD E,'a' LD C,2 CALL 5 JP 0
I think (I guess) that asm.com (DR assembler) and m80.com (Microsoft macro assembler) are expecting the Intel 8080 Mnemon, and I need to say that they should expect me to need the z80 nominees, which apparently , different.
Anyway, I agree with the answer, because it is also correct, because it offers just to write the image itself, without worrying about asm.com.