Closed SEGStriker closed 1 year ago
Hi Stan,
glad you joined. Your results are ok. I should have added a more detailed status to avoid such disappointment, but family took precedence over easter. In short: I successfully manipulated the bootloader to display the cryptic message BL V0.1 you saw. The bootloader then fails to enter DOS due to my code changes. That is ok, because we never will enter DOS with CPM-65… So thats the status of the .DSK file I also have a memory map prepared for CPM-65 and rewrote the bootloader to load the required code to the right places. This is A2-CPM-65 BOOT01.ASM. It assembles successfully, but is not tested yet. I also wrote a BIOS translation layer to execute the most important CPM-65 BIOS calls in RWTS and Apple_ROM calls. Also succesfully assembled and not yet tested. Furthermore I changed the BDOS code and the CCP code to its new memory locations. In the next step, I will transfer these 4 programs into the boot sectors on track 0 and 1 and then we will see, whether we get a A:> prompt. Where I‘m very much in the dark is how to transfer CPM-65 software into the DSK image. Ciderpress will not recognize the CPM-65 data format. I hope one of my other CPM disk image tools will be - any ideas? So far the actual status. I will push all progress to the repo as soon as possible. You could greatly support me in the bug hunt, which is certain to come.
Dietrich
Hi Dietrich,
What do you mean by "never will enter DOS with CPM-65"? It should continue to boot BIOS and then BDOS, CCP. I know it is a long way ahead... About the file system and putting files there - I am successful using cpmtools with manually created def file - it was really hard work and I tried more than 20 times to get it working. Also, I got some ideas from other people's work, until I was able to get it working with ordinary (Z80) CP/M filesystem and Apple II implementation. But, as seen in my screenshot, your .DSK image isn't fully compatible with the CP/M filesystem, as "no files" is displayed when trying to see it with DIR command. After you have the valid .def file, it is easy to transfer files. Well, not very easy, as there is no good GUI (I found one Japanese GUI, but I didn't test it yet for obvious reasons). So what I did so far - prepared something like set of command (or a script) like that:
cpmcp C:\Apple2\DSK\CPM\CPM60k_Microshell.dsk sh.com 0:sh.com
This is cp command from cpmtools, which basically copies local file sh.com (already CP/M) to user 0:sh.com on CPM60k_Microshell.dsk volume. In same way cpmls is displaying the files in the volume (like DIR):
cpmls C:\Apple2\DSK\CPM\CPM60k_Microshell.dsk
0: autocpm.com d.com erase.sub fullprmp.sub normprmp.sub sh.com sh.ovr shbak.com shsave.com
But when used on your image, I see this:
cpmls "C:\Apple2\DSK\CPM\CPM65 Master01.dsk" 0: ☺ "/8hi .0{i ♠☻8♣¶i(p.♥l▲
2:
◄←%nhe∟◄.←%►
3:
lph" .+k%
8: )☺►♦&↔)⌂.♣"
Regards, Stan
Hi Stan, My dsk-file has currently no dir entries and I also did not reset the dir area with $E5, as it should be. So you see the data in track 3, which is probably some program code as dir entries -> garbage. My current plan is to use 2 system tracks only. Apple II cp/m uses 3. For compatibility, 3 would be better. Maybe Ciderpress could then be used? What do you think?
Dietrich
So far I am not aware of any CP/M compatible imaging tool... Ciderpress is read only for CP/M format (unfortunately) and they have no plans to do it (so far). I guess for now the only option is to use one empty CP/M-80 .DSK image and modify it directly, using the sector order that I sent you via e-mail (from cpmtools).
BTW, could you try to erase the directory area and place some file on the dsk? I wonder, if that works.
Dietrich
Cpmtools should be able to handle data on the dsk. It should not care about the content of the system tracks. My directory format is cpm-compatible.
Dietrich
Well I do not plan to use Apple-DOS. What I try to use instead is RWTS, which is one layer beneath Apple-DOS.
Dietrich
cpmtools is able to erase files with cpmrm command. But it can't wipe directly the first tracks or rewrite them. Technically, it is able to erase all files and put others on their place. Same can be achieved by booting CP/M-80 and use format command or era . (doesn't display asterisk character; which only erases the files). Then with cpmcp we can put some files, but again, no sectors...
Of course, you shouldn't use Apple-DOS at all. I don't ever consider that as a good option. There are some ill implementations that are using ProDOS to start other OSes (even CP/M) or shells, but it is not needed and wrong way for lazy programmers :)
Here is your .DSK file, but formatted with CP/M-80 format.com - I am sure your boot sector is rewritten. Simply erasing doesn't work, as the directory structure is bad, but I'll try again soon. Then I got all files from C64 disk image of David Given's CP/M-65 implementation, copied them locally and then to the formatted .DSK file, here is the result. I have to zip it, to be able to attach it here.
Yes, as I thought, it doesn't work, probably because you are using 2 tracks for directory:
So basically it copied the first file and failed. Also, the disk is recognized as 57K total, not 138K free (140K total) as ordinary CP/M-80. It copies one file and starts displaying "directory full". It is even worse with cpmtools.
Here is your .DSK file, but formatted with CP/M-80 format.com - I am sure your boot sector is rewritten. Simply erasing doesn't work, as the directory structure is bad, but I'll try again soon. Then I got all files from C64 disk image of David Given's CP/M-65 implementation, copied them locally and then to the formatted .DSK file, here is the result. I have to zip it, to be able to attach it here.
Ok. That is helpful. Your image has the first 3 tracks empty filled with $E5. Then the directory starts as it should be. I will push my boot code onto it, adapted for 2 system tracks and then put some files on it with CPMtoolsGUI.
BTW i could read files from your image using CPMtoolsGUI with the parameters, your sent me: diskdef A2-CPM-80 seclen 256 tracks 35 sectrk 16 blocksize 1024 maxdir 64 skewtab 0,6,12,3,9,15,14,5,11,2,8,7,13,4,10,1 boottrk 3 os 2.2 end
My format is slightly different: maxdir 64 ... boottrk 2
I hope, this works.
Dietrich
First results - negative. I prepared a boot disk with 2 system tracks and max 128 dir entries. However Applewin rejected the disk with 'format unknown'. So obviously Applewin checks something here, which is not there. I must try some things, but since I will be traveling for the next 2 weeks, this needs time.
Dietrich
Ok, the dsk is now accepted - I inadvertadly changed the file size. But only the boot sector is loaded in Applewin and the crash. So bug hunting is needed. Since i am unfamiliar with the debugger of Applewin, this may take some time. Do you have a tutorial for Applewin?
Dietrich
I uploaded the actual state of the CPM-65 file and the dsk in the repo.
I think you have to use the same disk format as CP/M-80. About Applewin - there is a help, the first button on the right-up. And I have another idea - how to write sectors. The simplest way is to start Copy Plus (any version after 4.1) and there is track/sector editor in hex. It could be cumbersome, but will do the job. It is also possible to read a specific sector from file and write it elsewhere (in boot area for example).
Yeah, I found that help. It is a bit convoluted and will need a longer learning curve. Writing sectors is no problem. The issue is somewhere after loading the Boot sector. The boot sector is loaded to $0800 and then started with a jump to $0801. This works. After that the code loads the CPM-65 system. I don‘t know yet, whether this happens. Then the BIOS is startet and gives a boot message. This does not happen. So somewhere befor lies a problem.
Dietrich
Correction: the Boot message in the bootsector code is not displayed. So the error is there somewhere.
Currently, as I see in Applewin debugger, the boot is looping on these addresses:
C65E: BD 8C C0 LDA LCRAMINI_, XC0EC:00 @ C661: 10 FB BPL $C65E C663: 49 D5 EOR #$D5 C665: D0 F7 BNE $C65E ...
It is infinite loop between these addresses, as BNE always return to $C65E
That is weird because that is in the Controller ROMGrußDietrich Am 12.04.2023 um 17:03 schrieb Stanislav Georgiev @.***>: Currently, as I see in Applewin debugger, the boot is looping on these addresses: C65E: BD 8C C0 LDA LCRAMINI_, XC0EC:00 @ C661: 10 FB BPL $C65E C663: 49 D5 EOR #$D5 C665: D0 F7 BNE $C65E ... It is infinite loop between these addresses, as BNE always return to $C65E
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
Yes, it is, because of the values.
$C08C is the Data Latch of the Disc controller. Its abs,x indexed, X should be 60 and is loaded from $2B. Could you check, whether this is true?
$C08C: 00 LCRAMIN1_
$CC08C contains 0. Register X contains 60 in the whole loop.
Here is how the accumulator (A) changes:
C65E - 78 C661 - EB C663 - EB C665 - 3E
On the next loops it changed totally: .....
6F EE EE 3B
3B F3 F3 26
Every time different values, only the last value repeats as first in the next loop.
Ok. So the call with X=$60 works and something is wrong with the code in my boot sector. I will rewrite it after my vacation and also rearrange the content of the sectors in track 0 & 1.
Dietrich
Meanwhile David Given surprised us, he ported his CP/M-65 to Apple //e. Some time ago I asked him to post releases (ready disk images and he did it). Today I found that he was ready from some time...
https://www.callapple.org/software/digital-researchs-cp-m-now-on-the-6502
So you can check his boot code here: https://github.com/davidgiven/cpm65/releases/tag/dev
Great news. Then we can study and most probably use his boot code and bios code. Did you test the disk image?
Dietrich
Yes, I just booted it up. Doesn't work in Applewin, if the emulator is set to Apple //e Enhanced, but it works when set to Apple //e (plain).
The file system is not CP/M-80 compatible, I'll check it later. Stat is trying to put everything in one line, looks like the author don't know how Apple II handles LF and CR. The editor is strange, some kind of trying to mimic edlin.com, but not really usable to me. Sorta works, but not so many tools to try them.
Had a quick look into the bios source. Pretty much bare metal for the Apple IIe. We would have to rewrite it for the Apple II+. I don‘t know, how much work that will be. But the approach is certainly better, than using Apple II ROM code and RWTS.
Yeah, for example I noticed that it "requires" 80 column card, but in fact it doesn't check for such, so if you don't have one, only odd symbols are displayed, others are sent to the non-existing bank. I already said that RWTS is just for example how disk access can be done, otherwise you need just to rewrite the BIOS and BDOS from DR using 6502 assembly language instead of 8080 and use some Apple II specific machine code, that is already there, instead of writing your one, just because they are already there, in the machine ROM. I know how to do some of these tasks, but you are 30 years ahead of me in this process :) So I wouldn't advise you how exactly to do it.
Hi, any progress?
Here is the disk definition for cpmtools that David Given uses:
diskdef appleiie seclen 256 tracks 35 sectrk 16 blocksize 1024 maxdir 64 boottrk 2 os 2.2 end
What should be yours to correctly read the image?
Hi Stan,unfortunately not due to lack of spare time. Wheather is too good to stay inside ;-)Regards Dietrich Von meinem iPad gesendetAm 06.05.2023 um 17:00 schrieb Stanislav Georgiev @.***>: Hi, any progress?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
Some small progress. I discovered, due to David's source code, that the boot loader can load multiple sectors to RAM starting at $800. I successfully tested 16 sectors, i.e. the complete track 0. That's something to work with. Now I'm mulling how to proceed. David's code is bare metal (good) in his macro assembler toolchain (bad, because I don't have it and its macro assembler code, which distributs the info needed to understand the code over multiple files). I think, my next step will be to load the original RWTS plus as much of my code with the bootloader, then relocate this code from $800 to upper memory, load the rest of the system from track 1 (this is still an open issue for me) and call cold boot. Be patient, I currently don't have much spare time at the Computer and I'm not really in a hurry. However, I will do it - promised.
Dietrich
Sure, no rush :) BTW, I think all David's source code should be on his Github project page.
Hi Stan, unfortunately I ran into a roadblock with my planned approach. It is not feasible to use RWTS because its so intermingled with Apple-DOS and therefor distributed all over the RAM, that using it would require to have the complete Apple-DOS in RAM, but not use it. Thats obviously the reason, why David used a bare metal approach. Apple-DOS is a big mess of spaghetti code although exellently documented, but impractical to disentangle. I will now rethink and replan. It will be necessary to somehow use and adapt Davids BIOS code. That will take some time.
Dietrich
I told you that RWTS is a good example how to use Apple ][ disk, but it wouldn't be useful for your project. What's need to be done - just to use same approach, that you already used for your implementation, but adapted for Apple ][. Or, to use David's code with some changes. And third one: to write your own/convert to 6502 the original Apple II CP/M-80 BIOS code. Unfortunately, Teodor (the guy that wrote USDOS) didn't respond, who knows what happened to him and if he still uses that e-mail address. He already did something similar that works for his own OS that boots on Apple ][.
P.S. Let's remind you that Disk II is not the only disk controller and device that could be used. Apple ][ supports various controllers and disk formats, especially under ProDOS & CP/M-80, but also with UCSD-p. There are also 3.5" 80 tracks implementations of DOS 3.3 (third party or patched). And finally, there are HDD controllers, which (unfortunately) aren't supported in CP/M-80, just because no one wrote a driver, that could be used with Z-80 Softcard (MS one). But there are some implementations for PCPI and Applicard, which require ProDOS partitions and some tools. So, you don't have to use RWTS, otherwise you will be closely tied to Disk II only, which is 140K, as you know.
Hi Stan,
more progress. I stripped Davids BIOS code down to the needs of my toolchain. Went surprisingly well. The BIOS assembles and can be loaded in place. Of course there are stilll errors, so bug hunting will start …. We will see, how long it takes. As soon as I have something bootable, I will upload it to the repo for more testing.
Update: I have currently very little time due to family obligations, but today I managed to do something. I can now load BIOS, BDOS and CCP in the correct memory locations and start the CCP. At this point the system crashes, probably due to some bugs in the character i/o routines of the BIOS. Basic disc access is working though. All errors found up to now were in the BIOS or the BOOT code, which is good. I think I‘m getting close now
Dietrich
Great news. I am waiting to see the final result :)
I just pushed the 1. bootable system - hurray. Of course its utterly unusable because there is no software yet and my system has no buildt in commands except d: (drives select) and filename (invokes program filename, but there is none yet) There are many bugs left for sure, but at least the prompt reacts. You can select any drive A to D, however only A and C are supported right now, because I have yet to learn how to access Drive 1 on a Disc II controller. Next step will be to push some programs on the Disc image and test BDOS functionality Also the 80 coloumn card is not supported yet. I have to learn, how to do that too.
If you have time, just play with the system and let me know about any bugs or misbehaviors. You could also try the image on a real Apple II
Dietrich
Found more bugs and added some utilities to the disc image for testing Known errors (please open new issues for any errors found)
The 40 col mode is a bit annoying. So maybe I will have to address this next.
Dietrich
One JSR #C300 should do the trick with the 80 column mode activation :)
Of course, you have to calculate correctly the cursor position then.
For now I can't boot in an emulator. It displays the loader msg only. Also, it seems that ordinary CP/M-80 can't find any files. If the file system is fully CP/M compatible, they should be displayed.