Emulating the new (8085) CP/M
I had some problem getting CP/M to emulate with the new version of "cbios". Funny it was working before and "myEcho" is working. A day later I worked out that I had not initialised SOD during the boot process, so printing messages during the boot process did not work properly. Also, "conout" enables interrupts on return which could cause problems. Now fixed.
For Disk B I have not installed the "boot system" so 31k of capacity is available for storage (versus 23k).
Warm Boot after Disk Select Error
I seem to have upset this so I will have to find out what I have done to upset it.
I am pretty sure this code should still work with the updated hex files.
my CP/M 2.2 (32k) A>DIR A: STAT COM A>STAT A: R/W, Space: 17k A>STAT B: Bytes Remaining On B: 9k A>DIR B: B: ED COM : ASM COM : DDT COM : LOAD COM A>SAVE 3 TEMP.DAT A>DIR A: STAT COM : TEMP DAT A>STAT A: R/W, Space: 16k B: R/W, Space: 9k A>ERA TEMP.DAT A>DIR A: STAT COM A>STAT A: R/W, Space: 17k B: R/W, Space: 9k A>^C A>E: Bdos Err On E: Select A>B: B>DIR B: ED COM : ASM COM : DDT COM : LOAD COM B>ED DDT DDT VERS 2.2 -L 0100 LXI B,0FBC 0103 JMP 013D 0106 MOV B,E 0107 MOV C,A 0108 MOV D,B 0109 MOV E,C 010A MOV D,D 010B MOV C,C 010C MOV B,A 010D MOV C,B 010E MOV D,H -
So it appears to be working! And here it is in person:
CP/M Input Problem
I have been having problems getting programs to work. They display okay but he input is fails. Here is a typical problem:
my CP/M EMU Console - Written by Alan Cooper my CP/M 2.2 (32k) A>DIR A: STAT COM A>STAT A: R/W, Space: 17k A>B: B>DIR B: MICRO80 COM B>A:STAT A: R/W, Space: 17k B: R/W, Space: 26k B>MICRO80 MICROCHESS (C) 1977. WRITTEN BY: P. JENNINGS & T. O'BRIEN. ------------------------------------- DO YOU WANT WHITE ? (Y,N) DO YOU WANT WHITE ? (Y,N) DO YOU WANT WHITE ? (Y,N)
It does not recognise the character. Some programs show the character as a 'W'. This output is the actual CP/M machine but the emulator output is identical. It seems to be getting the wrong character ('W'?). I am not ready to blame ccp.asm/bdos.asm/cbios.asm just yet. I am thinking a memory clash (the stack?). For my machine I put the system very close to the top of memory, I assumed that the space was not used, perhaps I am wrong. It is where I put the ring buffer and pointers.
The program (micro80) overwrite RST6.5 thus I lose "getchar". This seems to be a common strategy (as it happen most of the time) to use the RST instruction to speed up the code.
That would suggest using SIM/RIM and RST6.5 for serial IO is not going to be an effective general strategy. Fine if I write my own assembler language programs.
But really I now have to use a UART and a timer. Time for the next version.
Actually after looking in the micro80.hex file I cannot find a RST instruction. Looking at the Zero Page, I can see the RST0 vector points to the program entry point and bdos vector has been overwritten. I suspect that the bdos vector has been copied.
Another problem is that code will expect a CR (0x0d) or CR/LF for CP/M and not a LF (0x0a) as for Linux. When using a terminal the line termination is configurable. But the emulator gets the LF. So really I need to insert a CR before a LF or swap the LF for a CR (in the emulator).
After swapping LF for CR in the emulator, I loaded a very small basic like language called MINOL22:
my CP/M EMU Console - Written by Alan Cooper my CP/M 2.2 (32k) A>b:minol22 ]10 A=0 ]20 A=A+1 ]30 PR "COUNT ";A ]40 IF A<10 GOTO 10 ]50 END ]RUN ]LIST 10 A=0 20 A=A+1 30 PR"COUNT ";A 40 IFA<10;GOTO10 50 END ]40 IF A<10; GOTO 20 ]LIST 10 A=0 20 A=A+1 30 PR"COUNT ";A 40 IFA<10;GOTO20 50 END ]RUN COUNT 1 COUNT 2 COUNT 3 COUNT 4 COUNT 5 COUNT 6 COUNT 7 COUNT 8 COUNT 9 COUNT 10 ]
Final Update For This CP/M Machine Version
Found a version of basic that runs on my machine (a modified version of Basic/5 for CP/M from Processor Tech):
my CP/M 2.2 (32k) A>dir A: STAT COM A>b: B>STAT STAT? B>A:STAT A: R/W, Space: 17k B: R/W, Space: 22k B>DIR B: BASIC5 COM : TEST BSC B>BASIC5 BASIC/5 INTERACTIVE INTERPRETER V Z1.0 10/16/77 NEW OR OLD? OLD OLD PROGRAM NAME: TEST READY LIST 10 PRINT "HELLO" 20 FOR I=0 TO 10 30 PRINT I*1.6 40 NEXT I 50 END RUN HELLO 0 1.6 3.2 4.8 6.4 8 9.6 11.2 12.8 14.4 16 READY SYSTEM B>
I think I have achieved what I have set out to do for this CP/M machine.
Next project will be a CP/M machine with a UART, a Timer, some GPIOs and bigger Flash disks (chips).
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.