Merlin32 and DOS3.3 binary header

4 posts / 0 new
Last post
Offline
Last seen: 1 month 3 days ago
Joined: Jul 29 2025 - 15:51
Posts: 6
Merlin32 and DOS3.3 binary header

Hello all,

    I am trying to set up a simply development environment on my Mac to learn 6502 assembly on Apple II, it's got the following components

  • Emulator: Mariani (AppleWin Mac port)
  • Editor: VS Code
  • Assembler: Merlin32
  • Disk Image handling: CiderPress2

Basically the workflow is

1. assemble the source using Merlin32

2. using CiderPress2 to import the produced binary into disk image (.po, .do) file 

3. using CiderPress2 to set proper attributes (BINARY, AUX)

4. reboot Mariani.

This works well if it's on ProDOS, as the metadata (file type & load addr) are stored as file attribute, not part of binary file itself. 

Here is the relevant source

  TYP BIN

  DSK MYPROG

  ORG $8000

  ... More 6502 instructions

  

But if the disk image is DOS 3.3, This would not work, as the first 4 byte of the binary will be used as header,  once the program is BLOAD'd , the first 4 bytes of code are gone.  Not sure if  CiderPress overwrote the first 4 bytes with header? so I had to tweak the source like this:

  TYP BIN

  DSK MYPROG

  ORG $8000-4

  DS 4, $EA  ;4 NOPs.

  ... More 6502 instructions

It's also strange to me that I can't just put 'DS 4' there without $EA (NOP). 

 

Ideally I'd like to get rid of this header set up in source code, and use post assembly process (CiderPress, etc) so same source/binary can be used for ProDOS or DOS3.3 - Is it possible?

 

BTW, I think merlin32 has a bug with regard to ORG pseudo command - no matter what value is there, the AuxType in _FileInformation.txt is always $0000.

 

Thanks!

 

 

mmphosis's picture
Offline
Last seen: 1 week 1 day ago
Joined: Aug 18 2005 - 16:26
Posts: 461
My 6502 setup and workflow

 

If I had the money, I'd use a Mac and Virtual ][. I develop on a Linux PC using 6502 assembly. Here is my set up:

• Emulator: KEGS and/or AppleWin using Wine

• Editor: Xed (GTK/Linux) or Xcode (if I was on a Mac) 

• Assembler: Merlin32

• Disk Image handling: dskbsave (my own custom command to bsave to DOS 3.3 image files.)  

Basically the workflow is:

1. Use a makefile and type make

2. KEGS Conifugration (press F4) > Disk Configuration > cursor down to s6d1 > select dos33.dsk image file

No headers needed.

Offline
Last seen: 1 day 13 hours ago
Joined: Mar 2 2024 - 12:19
Posts: 23
.

I'm not super familiar with CiderPress, but in general you will want to specify the file type and address at the time the file is imported, rather than adjusting the metadata afterwards.

CiderPress has a few ways to do this, but one way is to encode it in the file name.

cp2 add dosdisk.dsk myprog.bin#062000

#068000 sets the file type to $06 (BIN) and address to $8000. Note that you actually have to rename the file to include the "#068000" at the end.

CiderPress will take care of adding the DOS header or ProDOS metadata depending on the file system type.

The _FileInformation.txt file is used by Cadius, which only supports ProDOS disk images.

When I'm working with Merlin32 and Cadius I create my own FileInformation.txt template with the metadata I need for my files, rather than relying on the one automatically generated by Merlin32. E.g.:

PRODOS=Type(FF),AuxType(0000),Access(21) QUIT.SYSTEM=Type(FF),AuxType(2000),Access(21) BASIC.SYSTEM=Type(FF),AuxType(2000),Access(21) BITSY.BOOT=Type(FF),AuxType(2000),Access(21) MYPROG1=Type(06),AuxType(A102),Access(E3) MYPROG2=Type(06),AuxType(5000),Access(E3) MYPROG.SYSTEM=Type(FF),AuxType(2000),Access(E3)

My _FileInformation.txt file gets copied into a "build" directly along with my binaries generated by Merlin32. Cadius will pickup the metadata automatically:

cadius addfile mydisk.po /MYDISK build/myprog.system
Offline
Last seen: 1 month 3 days ago
Joined: Jul 29 2025 - 15:51
Posts: 6
des1 wrote:I'm not super
des1 wrote:

I'm not super familiar with CiderPress, but in general you will want to specify the file type and address at the time the file is imported, rather than adjusting the metadata afterwards.

CiderPress has a few ways to do this, but one way is to encode it in the file name.

cp2 add dosdisk.dsk myprog.bin#062000

#068000 s

Thanks for the detailed comment!

I just tried this, and it kind of worked - kind of as 'cp add doesn't seem to be very reliable for some reason.  In emulator I delete the file, then run cp add, no error messages but CATALOG with either cp2 or emulator show no file actually added. run same 'cp add' again, bam it shows up.

This might not be related to this particular solution, as I haven't tried to delete from the emulator prior to this, my original cp add command could have the same issue.

 

One small problem is that I have to rename my binary with the #068000 suffix, but I am going to writre a python script to paruse the assembly source to get the ORG and TYP anyway. so no big deal. Thanks again!

Log in or register to post comments