Proxy wrote:
As a long term project i had planned to try to port DOS/65 to ca65 and make it (mostly) hardware independent. mainly because ca65 is powerful, open source, and runs natively on both Windows and Linux (modern ones!).
and i'd rather have old (and new) Projects use it instead of some random ancient (sometimes proprietary) assembler that was last updated in 200x and you can barely find any documentation about, or even a download for it.
so having flooby already port it to WDC's tools is a pretty big step, as WDC's syntax is much easier to convert to ca65 than whatever assembler the original used.
but there are still some hardwired hardware depended pieces in there that i need to manually remove, so it'll still take some work. (but if you read this flooby, it would be nice knowing specifically which parts/routines are hardware dependent
)
anyways, back to the topic!
I'm very interested in how you would want to achieve Position Independent Code on the 6502/C02. it doesn't have the PER instruction of the 65816 so i'd imaging implementing relative versions of JMP and JSR are going to be the main problem (data access can be done exclusively through indirect addressing, using the X Register as an index into the ZP so the program doesn't overwrite any of the system's variables)
I had contacted Rich Leary via LinkedIn a couple years back I guess... we swapped some email and he sent me his V3 ROM code as well as his most recent 2.x and 3.x versions. As Rich worked to get the ROM code running on Daryl's SBC 2.5 and WDC's 65C02SXB (both using a SDcard interface) he did the initial code changes to get it over to WDC Tools.
There are basically 4 components of code for DOS/65:
- CCM (Concurrent Command Module) which is your basic command processor, i.e., the module the user interacts with to use the system. It has a total of 8 commands.
- PEM (Primitive Execution Module) which is the core of DOS/65 that manages disk allocation and file management, other resources like the console, reader/punch, etc.
- SIM (System Interface Module) which interfaces to the specific hardware at an abstraction level for Disk I/O and other hardware resources.
- MONITOR - This is generally an interface layer between SIM and whatever BIOS type functions the specific hardware provides.
My initial port (not a really accurate description) was writing a Monitor module using one that Richard provided. I simply linked the BIOS on my C02 Pocket SBC (with the CF Card/RTC adapter) to the SIM module and managed to get it working.
My later approach eliminated the Monitor module and I rewrote parts of SIM and included the access code to directly access the BIOS on my system. I also increased the number of supported drives to the maximum of 8, each a maximum of 8MB size.
Once this was completed, I went through the CCM and PEM modules and re-wrote some sections and modified many others to reduce the overall code size and use CMOS instructions and addressing modes. Note however, that these are separate modules which do NOT need any changes to move to another system. I also did the same with SIM, which did have some CMOS code in there. I also streamlined the ROM usage and initialization code so it fits into 6.5KB of ROM. It does however, require about 4KB of RAM at the top of the address space for variables and disk allocation maps. Each drive letter requires 512 bytes of RAM space. While my SIM code allocates and supports up to 8 drives, I'm only configured for 7, as the CCM, PEM and SIM variables take another 512 bytes.
My most recent DOS/65 code, now at Version 3.04, has some additional code updates which reduced the size of the modules a bit more. I also separated the source modules out so there are separate files for CCM, PEM, SIM, which are called by the main source file. Version 3.04 is sitting out on my GitHub page and I'm quite happy with it. I've been running it for months on a 3.3V prototype system with a Hitachi Microdrive with 35-pin PATA interface (true IDE, not a Compact Flash format device).
I still need to look more closely at the core set of DOS/65 utilities and start moving them over to WDC Tools and get them working with my current 3.04 version. A few are moved over already... the Super Directory, Submit and Ucopy utilities. There is an Xmodem utility I did some initial changes to and had that working, but my terminal app (Serial on OSX) stopped supporting the non-CRC Xmodem protocol, so I'll likely just rewrite that at a later date. For now I just the Xmodem commands in m Monitor code, which has the limitation of only transferring between RAM and the main system... which has a limit of 24KB when DOS/65 is loaded.
Hope this long post helps answer any questions about DOS/65 and perhaps some might find it useful. I've not had any recent communication with Richard lately, as he does have some health concerns and seems to have scaled back some of his projects. Still, I think he did a great job on porting CP/M over... and the disk format used is the same.