So I've written a small 65C02 assembler program that I want to change from BIN to SYS. It is assembled (with my cross assembler) at $2000, and I can run it from the BASIC.SYSTEM command line or BITSY BYE.
Anyway, what is the easiest way to change a file type in ProDOS?
Not sure how to do it from ProDOS, but it's very easy from CiderPress. Simply select the file and then use "Edit Attributes" from the Action menu (or the context menu).
Well, I was able to run Ciderpress under Wine so that worked to change my file to $ff. Unfortunately after doing that it now crashes when it ecits most of the time. Weird it works when it is BIN. I've never developed a SYSTEM file before, so there is probably something that needs to be done when it exits that I'm not doing. My code just does an RTS at the end which is fine for a BIN.
What happens if you leave the fle attribute as BIN, but rename it to <something>.SYSTEM?
ProDOS only cares about the attribute, not the name itself.
The program will run if left as a BIN file with name xxxx.SYSTEM, however I don't think ProDOS will automatically run it at boot time which is what I want to happen...
If you want a command line tool from within ProDOS's BASIC.SYSTEM, I have an external command:
https://github.com/a2stuff/chtype
if you want a GUI on the device, I recently added a desk accessory to A2D that can change types. Grab a 1.4 alpha from:
https://github.com/a2stuff/a2d
Thanks. I will check those out. I was able to get it done using Ciderpress under Wine, but I really hate having to run things that way so the command line utility that runs on the BASIC.SYSTEM command line would probably be preferable. I don't use A2D much.
Anyway, I found that there is a whole specific way that SYSTEM files have to set themselves up and exit. I've not gotten that working yet, but I think I am on the right track. I am also looking at some disassembly of the .SYSTEM files created for some of the other 32MB ProDOS images. I think I can get it figured out. It is just a bit more involved than I originally thought it would be.
You are correct. ProDOS will automatically run the first file ending on .SYSTEM of type $FF.
Some info on how to write a ProDOS system program here: https://prodos8.com/docs/techref/writing-a-prodos-system-program/
I'm not where I can look anything up but if I remember correctly, .SYSTEM files had to bload at $2000 and then be reloacatable. I suspect detail are in Beneath Apple ProDOS by Worth and Lechner, but it has been a long time...
I suspect your .bin may not load at $2000 and just changing the file type bytes may not be enough.
Here's my lazy man's way to do this.
Make a copy of BASIC.SYSTEM, and call it MYPROG.SYSTEM. Then use a block editor (e.g. Block Warden or ChewBagger) to change the pstring 'STARTUP' (located at $2006) to the name of your BIN file.
Save it and just launch MYPROG.SYSTEM.
Yes, you're wasting disk space doing it that way, but otherwise it's quick and easy.
Note that 'pstring' is the filename preceded by a length byte of that filename string.
The BIN file is assembler code I wrote and assembled with my own assembler. I assembled it at $2000 so that isn't it. I have been looking at the document on how to write a system file that CVT mentioned. It's a little involved, but I think between that and looking at a disassebly of some similar SYSTEM files I think I can figure it out.
I will have to look at Beneath Apple ProDOS too, though, thanks for that suggestion. Those Quality Software books are quite often better than any of Apple's documents.