• Please review our updated Terms and Rules here

Booting CPM for the First Time

Marty

Veteran Member
Joined
Jul 26, 2009
Messages
3,141
Location
Boulder , Colorado USA
Hi all;
I have the files I needed for each of the CPM sub-systems, CCP, BDOS and BIOS, Since I am loading in these files Serially, I have them compiled in the right region for my system . But, It still won't come up with the prompt... It does the signon message and then it jumps to CCP and from there to BDOS and gets lost in there.. I have put in some terminal signs such as jumped to ccp and jumped to bdos, to see whether it got to anything... it would get to ccp and then to bdos and then back to ccp and then to bdos... I even tried to get it to do the '0A>' prompt, by jumping to that section, from the code listing that I have , but no 0A> prompt.... just the jumping back and forth... I got my files from the DRI PACK, and had to change the Mem size to my system .... Any Ideas on what to do next, or where I or what I need to change, to get it to come up. I have also changed the BIOS to skip over the reading of the Bios Tracks, since there isn't anything there...
THANK YOU Marty
 
You should get "The Programmer's CP/m Handbook" by Andy Johnson-Laird (1983). It usually goes for $15 lately on ebay or amazon. It has a lot of good info on building and bringing up a cp/m build for the first time, including a lot of debugging tips. I have a copy somewhere, will see if I can find it and see if the book has any hints on your problem.
 
Marty, is your cold boot routine loading CCP BDOS and BIOS at cold boot? Has CCP and BDOS been sized correctly for the system (via MOVCPM)? Does your CBIOS use IOBYTE and did you initialize it on cold boot so console messages don't go off into the ether?

Are you reading your disk correctly? I don't know what format or interleave you're using. Boot tracks are sometimes read at a 1:1 interleave.

It's really pretty simple; I'd be happy to look at your files and let you know what I see.

BTW, CP/M generally prompts with just an A> prompt; 0A> is pretty much an MP/M prompt.
 
Cpm

Cpm

Hi All;
I already have the Book by Andy Johnson-laird. So THANK YOU on that..Chuck, I have CPM Loaded at the Top of Memory with CCP at D400H, BDOS at DC00H and my BIOS at EA00H, and I have initialized it by using my monitor to 'g' GO at EA00H , So yes it initializes the system, it has the Sign-on message ' Tarbell 60K CPM' , but it won't put on the 'A>' ... I have put labels into my CPM System, so I can follow if there is a problem, I got them from a Tarbell CPM 1.4 bios, and copied them into the corresponding place for my CPM 2.2 Bios. THANK YOU Marty
 
I'd love to help. It may be simple or complex. It took the N8VEM group about 6 months with at least 15 people working to get an A>, though two people managed to do it in 3 months over at the Propeller forum in an emulation. The Altair simh shows an example of rebuilding an image and I understand some of this but not all of it:
Code:
; Create a bootable image on disk A: of CP/M with CCP
; Based on original Digital Research sources for CCP and BDOS
; Required sources are CFGCCP.LIB, MOVER.MAC, CCP.MAC, BDOS.MAC, CBIOSX.MAC
; Required programs: M80.COM, L80.COM, DDT.COM, BOOT.COM, BOOTGEN.COM
XSUB
; get correct configuration
PIP MEMCFG.LIB=CFGCCP.LIB
; create MOVER.COM
M80 =MOVER/M
L80 MOVER,MOVER/N/E
ERA MOVER.REL
; create CCP.COM
M80 =CCP/M
L80 CCP,CCP/N/E
ERA CCP.REL
; create BDOS.COM
M80 =BDOS/M
L80 BDOS,BDOS/N/E
ERA BDOS.REL
; create CBIOSX.COM
M80 =CBIOSX/M
L80 CBIOSX,CBIOSX/N/E
ERA CBIOSX.REL
; put pieces together
DDT
F100 5C00 0
IMOVER.COM
R0000
ICCP.COM
R0900
IBDOS.COM
R1100
ICBIOSX.COM
R1F00
G0
; create boot file
SAVE 44 CPMBOOT.COM
ERA MOVER.COM
ERA CCP.COM
ERA BDOS.COM
ERA CBIOSX.COM
ERA MEMCFG.LIB
; now perform a cold boot to get rid of XSUB
; this restores the original BIOS jump vector which is required by BOOTGEN
BOOT
; write boot file to reserved tracks, must be last command
BOOTGEN CPMBOOT.COM A:

But your problem may be more fundamental than that. Can you output a single byte to the terminal? Eg what port are you using, and does a machine code OUT to that port with,say, 65, print an 'A'? And if that works, has the BIOS been modified in the CONIN and CONOUT sections to reflect this port? Do you have source code or compiled code or both? And how are you compiling them if you can't get to an A> - on another system using a cross compiler? If so, we can work through some simple tests and build it up. The first bit of code is to output a byte, which is a few lines of assembly.
 
Hi All;
I already have the Book by Andy Johnson-laird. So THANK YOU on that..Chuck, I have CPM Loaded at the Top of Memory with CCP at D400H, BDOS at DC00H and my BIOS at EA00H, and I have initialized it by using my monitor to 'g' GO at EA00H , So yes it initializes the system, it has the Sign-on message ' Tarbell 60K CPM' , but it won't put on the 'A>' ... I have put labels into my CPM System, so I can follow if there is a problem, I got them from a Tarbell CPM 1.4 bios, and copied them into the corresponding place for my CPM 2.2 Bios. THANK YOU Marty

Hi
The fact that you get the signon, leads me to think your conout is OK. It is more
likely that it is not seeing the disk drive. As I recall, when coming up it expects
to read something from the A drive before giving the A prompt. I could be wrong
here because I have a DMA boot from disk system but it seems that each time
I select the A or B drive, it reads something from the disk.
I don't have my machine here so I can't test that.
Do you have a machine with a front panel? if so, you can place the halt instruction
at various places in the code. Follow the code and each time it does a subroutine
call, place the halt after. If it doesn't return, it won't stop at the return. If
you don't have the blinking lights, a logic probe, voltmeter or scope can read the
address lines. When debugging the halt instruction can be handy
Dwight
 
cpm

cpm

Hi All;
Dr. Acula, yes it talks to the ports thru CONIN and CONOT (CONOUT) I Don't have another CPM system to do the different programs (M80, PIP, etc) I assemble the Source Code (CCP.ASM, DBOS.ASM) using Spasm, and tell it where I am putting the Code (eg., D400 for CCP). Dwight, The Disk light comes on and the Head moves, and when I have gone to the 'READ' part of the Bios Code, it has an Error routine that if the Drive Controller is issuing ANy Bad Bits it will tell me so. I am running An Altair with a Front Panel , with a Tarbell Double Density Controller, I am using the Altair Regular Ports, and it seems to be working fine.. It seems to get lost in CCP and/or BDOS. I have Modified the BIOS so that it skips over the Loading from the drive the first 2 Tracks , as right now there is NOTHING there for it to Load... I have instead put there for it to look at Track 2 , Sector 00, and I have also tried sector 7, as that is about where the Directory might be located according to the Johnson-Laird Book. Since I don't know What and Where the Program has in what registers, after it would normally load in the first two tracks, So that I can Fake it out and Pre-Load them , with certain Values before Jumping to CCP. Once I have that up and running I can serially load in 'Sysgen ' and use that to copy the 'System ' to the Disk... I think ????? THANK YOU Marty
 
Hi Marty
It sounds like walking the halt through your code is the best
method. This can easily be done through the front panel.
Place a halt and see if it stops there. If it does, it most likely
got there correctly ( small chance it didn't ). Each time, manually
restore the data and restart from the beginning and a new halt
location.
Use care on conditional jumps. Try to determine if it is a loop
or a real forward branch. Placing two halts on each path can
help from getting lost. On a loop, you'd normally only place
the halt after the exit of the loop.
If it doesn't hit the your halt, you have to assume that the code
may have been corrupted and you need to reload through the
serial. It is a pain but your options are limited.
I brought mine up the same basic way but I also had a
routine to read and write sectors to the disk. Anything I loaded
serially, I'd write to someplace on the disk. I'd be able to restore
things quickly with just a small serial load to restore the disk
loader.
Dwight
 
cpm

cpm

Hi All;
Thank You Dwight, I am going to try one more thing beforte I go to Your halt Method. I will try to Load DDT and See if I can get it to do its thing, If I can look at the registers and/or trace the code with breakpoints, that would help alot... I have had in the Past Ran the 'Format' program, only on exit, it goes haywire.. So I will try DDT, before trying to use Your Halt Method ...
THANK You ALL for Your Great Help and Suggestions and Questions... Marty
 
In terms of 'getting lost' inside the code before it gets to the A>, I was recently debugging the Altair SIMH simulation on a Propeller chip and had a trace on reading 128 byte sectors on the bootup, and it reads about 20 of these before getting to A>. So it would be quite tedious to debug that with trace.

I'm still not 100% sure what you have working - do you have source files as in things you can read with a text editor, and if so, can you add in little bits of code, eg something that does a CONOUT and prints a letter, so you can see where it is getting to? Eg, a trace on SELDSK would be handy.

It ought to be possible to at least work out whether it is the drive access that is the problem (and bypass this if you can edit the source files and recompile).]

From memory, DDT could trace everything except CP/M itself. Or at least, I never got it to work.

I'm scrolling through the CP/M source files now seeing where you could put some traces...
 
Cpm

Cpm

Hi All;
Dr. Acula, yes, as I said above I have the source code, and am using Spasm assembler, and I have put in extra code to check for errors in the BIOS, and it can tell me what they are... like if reading it says 'READING' and then if there is an error it tells me what it is -- like 'NOT READY', 'RECORD NOT FOUND', 'CRC ERROR', 'LOST DATA', and 'BUSY'. So I know what my controller is doing... The light on the Disk Drive does go on... and I can Talk to the ports -- conin and conot, so that is not the problem... and I have the Source Code for CCP and BDOS which I used to generate the code for my system. Once it gets to CCP and to BDOS I am not sure what is happening.. Which is what I am working on now, THANKS to DWIGHT.... It is slow going... I have stopped for the night.... THANK YOU Marty
 
Code is slightly different for the N8VEM, but looking at the things it does on bootup on a cold boot:
Select disk 0
Reset the IDE disk
Print a startup message
Poke some C3 and addresses to 0000 and 0038 in case were overwritten
Jump to CCP (at a location 3400H+(60-20)*1024

and then I'm pretty sure it jumps to the CCP

Code:
;**************************************************************
;*
;*
;* C C P  -   C O N S O L E   C O M M A N D   P R O C E S S O R
;*
;**************************************************************
;*
COMMAND:LD	SP,CCPSTACK	; SETUP STACK AREA.
	PUSH	BC		; NOTE THAT (C) SHOULD BE EQUAL TO:
	LD	A,C		; (UUUUDDDD) WHERE 'UUUU' IS THE USER NUMBER
	RRA			; AND 'DDDD' IS THE DRIVE NUMBER.
	RRA
	RRA
	RRA
	AND	0FH		; ISOLATE THE USER NUMBER.
	LD	E,A
	CALL	GETSETUC	; AND SET IT.
	CALL	RESDSK		; RESET THE DISK SYSTEM.
	LD	(BATCH),A	; CLEAR BATCH MODE FLAG.
	POP	BC
	LD	A,C
	AND	0FH		; ISOLATE THE DRIVE NUMBER.
	LD	(CDRIVE),A	; AND SAVE.
	CALL	DSKSEL		; ...AND SELECT.
	LD	A,(INBUFF+1)
	OR	A		; ANYTHING IN INPUT BUFFER ALREADY?
	JP	NZ,CMMND2	; YES, WE JUST PROCESS IT.
;
;   ENTRY POINT TO GET A COMMAND LINE FROM THE CONSOLE.
;
CMMND1:	LD	SP,CCPSTACK	; SET STACK STRAIGHT.
	CALL	CRLF		; START A NEW LINE ON THE SCREEN.
	CALL	GETDSK		; GET CURRENT DRIVE.
	ADD	A,'A'
	CALL	PRINT		; PRINT CURRENT DRIVE.
	.IF 	CONDUSRPATCH
				; original code does not call this
	.ELSE	
	CALL	USRPAT		; call patch to print USER number
	.ENDIF
	LD	A,'>'
	CALL	PRINT		; AND ADD PROMPT.

which finishes up printing the A>

But in amongst the code above are a few calls and any of these could hang the system. Are you flags showing you get to the beginning of the CCP?
 
cpm

cpm

Hi All;
Dr. Acula, as I also had stated before I had put some jumps to show that it got to CCP and to BDOS, it did seem to corrupt the code some even though I saved some of the registers at the beginning of the jumps, but yes it got to CCP and then jumped to BDOS and then would jump back to CCP and then to BDOS etc. I took out the jumps since it would get into an infinate loop, and then reloaded the programs. I left in the jumps at boot and warm boot to show it being sent to CCP... My CCP code is slightly different but in essence it is the same as yours.. You did mention that boot puts code at 0000h and at 0038h, while mine just puts it at 0000h, not at 0038h.... for a warm boot jump.... One thing I haven't done is look at the Bootstrap loader, since I wasn't using it , since I have been loading serially, and see what it does.... I don't know if it is different than the BIOS I am now using, which on a normal systen would be on track 0, and be the first thing loaded. Here is what I normally do when loading up.... I first clear ALL memory setting everything to 00h then I load up CCP at D400H, then I load BDOS at DC00H, then I load BIOS at EA00H, then I make sure everything is there. Then I 'go' (start running) at the beginning of BIOS (EA00H). It gives me the Sign-on message 'Tarbell disk controller CPM 60K ' it then asks me how many drives it has ? I respond with 2 , it echos it back to me saves the response (and before it gives me the sign-on message it initializes the system and writes the proper code at 0000H and 0005H for the jumps to warm boot and to BDOS. ) After the sign-on message it jumps to CCP... then to BDOS... :bomb:
THANK YOU Marty
 
cpm

cpm

Hi All;
I looked at the loader code and I found (and remembered) that it puts a jump (C30000) at 007DH, which I haven't done, and I can also put it at 0038H. Could it be that Simple ?!?! :idea: :idea:
THANK YOU Marty
 
Unless you're using interrupts, the jump at 0038H (RST 7) shouldn't be needed (DDT uses this for breakpoints), nor the jump at 007D (location 007F is used by CCP).

ISTR that one of the first things that CCP does is to check to see if a batch file script is in progress. So you need full file functionality right from the get-go.
 
Cpm

Cpm

Hi All;
Thank You Chuck.. I put in the above mentioned code jumps, and the one at 7DH gets written over, after boot.. I also changed the IOBYTE to 055H for my console information, I did this at the boot initialization... Chuck you mentioned it looks for a batch file and needs to be fully functioning .. Is there any way to get around this temporary ???? I just thought maybe I could try putting a boot loader at 0000H and get one of my CPM disks for my other system which not only doesn't work right now, and it is a Z-80 machine and see if I can load it in.. stop the machine and go to the monitor put in my new BIOS and do a warm boot. I'll see ???
THANK YOU Marty
 
Marty, what I said was that CCP checks for a batch file with the name $$$.SUB. If it doesn't find it, processing continues as normal. But out of the gate, ISTR that a directory access on the A: drive is one of the first things done.

If you want, attach an image of your boot record and I'll see if the parts look right. At least that will get you to the point where it's narrowed down to be your BIOS code.
 
Hi
A disk formatted with $E5s will look like an empty directory.
I'm relatively sure that was how I booted my machine.
Dwight
 
Cpm

Cpm

Hi All;
I sort of Got CPM UP !!!!!!
I serailly loaded all the files , changed my bios, more to an origional for the Tarbell controller, I loaded in DU, and it would go correctly to Track 02, which I couldn't get it to do on other Bios's I had before... I then found one of my other system disks for another Cpm setup. and did a cold boot (Jumped to Bios) and it came up with the right stuff... A> I can now access the drive and what is on it.... WHAT I need to do next is to get the appropiate files on the system tracks. So it can be loaded... otherwise it has to be serially loaded before it comes up... which is where I am right now...
THANK YOU Marty
 
Cpm

Cpm

Hi All;
I think I have done the correct thing... I serially loaded in my system, and then loaded in the system and the boot loader starting at 0900H. Booted it, doing a cold boot, and when it came up I did a sysgen and copied it to my diskette.
THANK YOU Marty
 
Back
Top