6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 4:05 pm

All times are UTC




Post new topic Reply to topic  [ 72 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject: Re: CP/M for the 6502!
PostPosted: Sun Oct 09, 2022 9:33 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
Well, after watching the first video, I did figure out how the BIOS was being called. I've watched a few more hours so far... but hey, translating code from one assembly type to another just isn't going to get everyone excited. Personally, I've found it fun to watch and informative. However, some of the things being typed in for CC65 simply don't have any clarity for me... I'm old and got used to older tools like the original Commodore 64 Macro Assembler and used the IBM Macro Assembler (DOS Based of course) back in the 80's. I've used TASM and a few other 65xx assemblers over the years, but I guess I just like it simpler with the ability to view a full listing file for output.

For myself (yes, being selfish for what I want), I don't have any plans on running something like this on retro hardware or an emulator. From my view, I would find it more useful if the CPM/65 code would be a simple set of source and include files that allow me (or anyone) to easily build the CCP and BDOS modules with a defined set of memory addresses and being to use a less complicated tool set (e.g., TASM or dare I say, WDC Tools). Beyond that, just having a reasonably well documented BIOS interface should be sufficient to get it running on a hobby built 6502 system. Sadly, I'm not a C programmer type... and I'm not a huge user of Macros, so the more I examine the CC65 code base with all of it's inherent structures, the more confusing it looks when I'm thinking about how to move it over to WDC Tools. I really don't want to have to learn another development tool for my 65C02 projects (okay, selfish switch off).

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
 Post subject: Re: CP/M for the 6502!
PostPosted: Sun Oct 09, 2022 10:21 pm 
Offline
User avatar

Joined: Thu Oct 12, 2017 10:51 pm
Posts: 90
I'm actually in the process of migrating from cc65 to llvm-mos, so it only needs one toolchain. Unfortunately it has bugs, so I might need to do another migration (cc65 has bugs too). I've been wondering about 64tass, which I've used before. The biggest roadblock to switching assemblers is the need to generate relocatable binaries. That's not negotiable: the whole project simply won't work without it. I can generate these from any binary provided it gets assembled three times at different addresses, but I originally thought it'd be cleaner to generate them directly. I'm now thinking that it would be more understandable to live with multiple assembly...

WDCTools is flatly impossible, I'm afraid --- it's commercial. I need an open source assembler. That rules out TASM, too, assuming you mean Borland Turbo Assembler.


Top
 Profile  
Reply with quote  
 Post subject: Re: CP/M for the 6502!
PostPosted: Mon Oct 10, 2022 1:47 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8505
Location: Midwestern USA
Although I’m no fan of CP/M or its clones, I think DOS/65 is a more productive target for a 65xx system than any of the superannuated CP/M retreads, especially those (re)written in C (there are no good C compilers extant for the eight-bit 6502 family, WDC’s included). Although both suffer from the same woefully outdated concepts, especially in the area of mass storage, at least DOS/65 has been created to be native to a 6502/65C02, instead of being an 8080/Z80 rehash.

Having perused flooby's source code for his DOS/65 port to the 65C02, I daresay it wouldn’t be too much a stretch to get it to run on a 65C816 system in native mode, using 16-bit operations for many things—disk I/O would particularly benefit from that. With 128K or more of RAM, bank $00 could be given over entirely to the BDOS, BIOS and CCP (as well as direct page and the stack), and addresses beyond $00FFFF would be the TPA. As the CCP would be permanently resident and the TPA elsewhere, some disk activity could be avoided, since the CCP would never (in theory) be stepped on by a transient program.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: CP/M for the 6502!
PostPosted: Mon Oct 10, 2022 2:03 am 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
Well, understandable on wanting an open source assembler.

When I got back into the 65C02 about 10 years ago, I looked at several assembler packages, but eventually opted to get a licensed version of WDC Tools, which was just reduced to $50 (it's now a free download). It's not perfect, but as you pointed out, none of the opensource ones are either. You've probably seen the list on 6502.org:

http://6502.org/tools/asm/

There's also the Kowalski package, which some of the folks out here use. Daryl Rictor has been updating/maintaining it and is available on his website, but I haven't looked into it as of yet.

I'm still planning to get your CPM/65 ported to my C02 Pocket SBC (a modified prototype version), but right now, I'm working towards a bootable IDE drive setup and partitioning scheme, which will be a pre-req.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
 Post subject: Re: CP/M for the 6502!
PostPosted: Mon Oct 10, 2022 7:30 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
BigDumbDinosaur wrote:
Although I’m no fan of CP/M or its clones, I think DOS/65 is...


This thread is clearly about CP/M for the 6502. I can't think why you'd want to derail it, unless your intent is to cause trouble. You know how to start new threads, and I suspect you can figure out how to link back to previous threads - if you really want a discussion about something else, that's the way to do it.


Top
 Profile  
Reply with quote  
 Post subject: Re: CP/M for the 6502!
PostPosted: Mon Oct 10, 2022 1:21 pm 
Offline

Joined: Thu Mar 12, 2020 10:04 pm
Posts: 704
Location: North Tejas
hjalfi wrote:
WDCTools is flatly impossible, I'm afraid --- it's commercial. I need an open source assembler. That rules out TASM, too, assuming you mean Borland Turbo Assembler.


Borland's assembler never handled anything except x86.

By TASM, I think he is talking about someone's table-driven assembler which can handle multiple instruction sets. I do not know anything else about it.

I totally understand why you may not want a commercial tool set; you do not want to have to pay someone else to give away your toy and people should not have to pay someone else to play with your toy. But insisting on open source does not guarantee that you can do anything you want with it either.

Edit: as in the "free beer" vs "free speech" argument, you may be better off specifying freeware with an appropriate license.


Last edited by BillG on Mon Oct 10, 2022 1:57 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: CP/M for the 6502!
PostPosted: Mon Oct 10, 2022 1:45 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1117
Location: Albuquerque NM USA
BigEd wrote:
BigDumbDinosaur wrote:
Although I’m no fan of CP/M or its clones, I think DOS/65 is...


This thread is clearly about CP/M for the 6502. I can't think why you'd want to derail it, unless your intent is to cause trouble. You know how to start new threads, and I suspect you can figure out how to link back to previous threads - if you really want a discussion about something else, that's the way to do it.

DOS/65 is a version of CP/M. Floobydust has done great work porting DOS/65 to his hardware and added additional features. Getting CP/M to run on my own hardware is something I want to do this winter. viewtopic.php?f=1&t=4634&hilit=leary#p55032
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: CP/M for the 6502!
PostPosted: Mon Oct 10, 2022 2:45 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
I'm referring to TASM version 3.01. This is from Thomas Anderson from 1993. It states in the documentation that it uses Borland's C runtime library. Perhaps this is what David is referring to. Either way, it is described as shareware and there is a registration and order form for anything beyond some personal use.

DOS/65 - yes, this is Richard's version of CP/M for the 6502. Having looked at David's source for CPM/65, my view is that David has taken the CP/M 2.2 source code and directly ported it to the 6502. Richard's DOS/65 provides a functional equivalent of CP/M but does not appear to have been a direct port routine by routine. All of the BDOS functions exist in PEM and all of the CCP functions exist in CCM, but they are not written the same way. Code size is fairly equivalent however.

I don't think I've actually done any additional features to DOS/65. What I've done is used CMOS instructions and addressing modes to make the code somewhat smaller and a bit faster. I also streamlined the RAM usage for the ROM version and changed the startup via SIM somewhat. Functionally, I don't think there's any changes/additions. The ROM foot print has been reduced a fair amount by having a routine clear out the RAM based allocation maps (zeros them out) versus the initial copying of a large amount of zeroed ROM space to RAM. Integrating SIM and Monitor also reduced code size and improved performance a bit. I recently did a 3.04 version which is a handful of small changes to CCM/PEM/SIM and split the assembly files up for a cleaner build, at least in my view.

I do think talking about (and comparing) both code builds worthwhile... as they essentially mirror CP/M for the 8080/Z80 to the 6502 (my version pre-reqs a 65C02). David's approach has a different end goal for relocatable code, which is very different to CP/M's SYSGEN build utility.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
 Post subject: Re: CP/M for the 6502!
PostPosted: Mon Oct 10, 2022 6:37 pm 
Offline
Site Admin
User avatar

Joined: Fri Aug 30, 2002 1:08 am
Posts: 281
Location: Northern California
floobydust wrote:
DOS/65 - yes, this is Richard's version of CP/M for the 6502. Having looked at David's source for CPM/65, my view is that David has taken the CP/M 2.2 source code and directly ported it to the 6502. Richard's DOS/65 provides a functional equivalent of CP/M but does not appear to have been a direct port routine by routine. All of the BDOS functions exist in PEM and all of the CCP functions exist in CCM, but they are not written the same way. Code size is fairly equivalent however.

I'd be interested in hearing more details about CPM65, including any comparisons to DOS/65. Since DOS/65 is very CP/M-like, it's probably reasonable to talk about DOS/65 a bit in this thread, if David has no objections.

I'm not sure it's totally on-topic for this forum, but I was reading the CPM65 commits and the storage of the CP/M filesystem on top of the CBM DOS filesystem caught my attention. I dealt with this on the SoftBox (webpage, disassemblies), which is a CP/M add-on for the Commodore PET/CBM computers. It also stores CP/M sectors directly in CBM DOS sectors, where one 256-byte CBM DOS sector contains two 128-byte CP/M sectors. I found this explanation of how DOS/65 does it. Another CP/M add-on for PET, the Z-RAM, uses REL files as CPM65 initially did.

_________________
- Mike Naberezny (mike@naberezny.com) http://6502.org


Top
 Profile  
Reply with quote  
 Post subject: Re: CP/M for the 6502!
PostPosted: Mon Oct 10, 2022 7:00 pm 
Offline
User avatar

Joined: Thu Oct 12, 2017 10:51 pm
Posts: 90
I don't actually know much about DOS/65 --- I actually initially ruled it out due to the license. But floobydust informs me (on one of the five or so forums I've been talking about this stuff on, sorry for not getting back to you as I couldn't find your message...) that it's probably been relicensed as GPL3, which is great news. So --- eh, I wasn't using those 45 hours of my life anyway...

I deliberately tried to stick to the classic CP/M-80 design for CP/M-65 partly because I like it but also because at some point I want to write a 6502 PL/M compiler and try and port the original Digital Research tooling, inasmuch as it makes sense. The BDOS system calls should all be the same after adjusting for calling convention. (If they're not, that's a bug.) The biggest difference from the user perspective is the way parameters are passed to programs, via a PSP-like-but-unlike block immediately after the program binary. The BIOS entrypoints are largely the same but use a BDOS-like function code based interface, due to the need for relocation.

Re SoftBox: I would actually like to do a PET port but haven't figured out how to talk to the disk drive yet. I'm guessing the SoftBox talks directly to the drive without going via the PET itself, and so probably can't help me there?

It'd be really cool to add support for these disk formats to CP/M-65, but I'll have to think about how (or whether to) detect them. CP/M isn't great at that.


Top
 Profile  
Reply with quote  
 Post subject: Re: CP/M for the 6502!
PostPosted: Mon Oct 10, 2022 7:30 pm 
Offline

Joined: Thu Jan 07, 2021 1:29 pm
Posts: 14
Hjalfi, if you need an advanced 6502 assembler you might want to have a good look at Jasm. Open source, fast and very good to use in my opinion. I'm having trouble NOT using it in my old projects.
http://kollektivet.nu/jasm/

_________________
/NollKollTroll


Top
 Profile  
Reply with quote  
 Post subject: Re: CP/M for the 6502!
PostPosted: Mon Oct 10, 2022 10:02 pm 
Offline
Site Admin
User avatar

Joined: Fri Aug 30, 2002 1:08 am
Posts: 281
Location: Northern California
hjalfi wrote:
Re SoftBox: I would actually like to do a PET port but haven't figured out how to talk to the disk drive yet. I'm guessing the SoftBox talks directly to the drive without going via the PET itself, and so probably can't help me there?

Yes, the SoftBox talks directly to the drive.

Programming the IEEE-488 bus on the PET/CBM computers via the built-in ROM routines is similar to programming the IEC bus on the C64. However, there is not one PET but a family of computers with different, incompatible ROMs. The routines often work the same but are at different locations in ROM and use different RAM locations. There is a cross-reference in the back of the book "Programming the PET/CBM".

I suggest porting it to a specific PET/CBM machine first, then adapting it to the others. The CBM 8032 may a good fit because it has an 80-column screen, the business keyboard, and the later BASIC 4 ROMs. I recently disassembled an add-on ROM for the 8032 that calls almost all the IEEE-488 routines, so that list of locations may be helpful as a reference. The 8032 has only 32K RAM but there are supersets of it with expanded memory (the 8096, 8296, and SuperPET).

_________________
- Mike Naberezny (mike@naberezny.com) http://6502.org


Top
 Profile  
Reply with quote  
 Post subject: Re: CP/M for the 6502!
PostPosted: Mon Oct 10, 2022 10:25 pm 
Offline
User avatar

Joined: Thu Oct 12, 2017 10:51 pm
Posts: 90
Useful links --- thanks very much! Yes, the 8032 looks like a good option. (My second school had one, with twin floppy drive, daisywheel printer and Silicon Office, and I was the only person who used it, so it also has nostalgic value.)


Top
 Profile  
Reply with quote  
 Post subject: Re: CP/M for the 6502!
PostPosted: Mon Oct 10, 2022 10:36 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8505
Location: Midwestern USA
Mike Naberezny wrote:
I'm not sure it's totally on-topic for this forum, but I was reading the CPM65 commits and the storage of the CP/M filesystem on top of the CBM DOS filesystem caught my attention...

As I dimly recall from many years ago when I was fooling around with CP/M (not on CBM hardware, however), 5-1/4” disk interchangeability between different machines was problematic. I believe it was due to different manufacturers' notions on disk format, disparate use of hard-sectoring versus soft-sectoring and vagaries introduced by the different types of 5-1/4” disk drives and controllers that were used. I do remember that in some cases, a disk formatted on one Kaypro model couldn’t be read or written on a different Kaypro model due to differences in the drive electronics.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: CP/M for the 6502!
PostPosted: Tue Oct 11, 2022 1:10 am 
Offline
Site Admin
User avatar

Joined: Fri Aug 30, 2002 1:08 am
Posts: 281
Location: Northern California
BigDumbDinosaur wrote:
As I dimly recall from many years ago when I was fooling around with CP/M (not on CBM hardware, however), 5-1/4” disk interchangeability between different machines was problematic.

There are apparently 140 different CP/M formats that can be read in the Commodore 1571 and 1581 drives.

To get CP/M files from the internet into the SoftBox, I use the cpmtools package to copy the files into a CP/M filesystem image. I run a script on that image to make it into a CBM DOS image (e.g. D64, D80) suitable for the SoftBox. I see that CPM65 is doing similar stuff.

_________________
- Mike Naberezny (mike@naberezny.com) http://6502.org


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 72 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC


Who is online

Users browsing this forum: Miles J. and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: