beebasm -boot and -opt

Development tools discussion area.
Post Reply
User avatar
sydney
Posts: 2232
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne
Contact:

beebasm -boot and -opt

Post by sydney » Sat Sep 08, 2018 6:24 am

In my current project I have a BASIC loader than I want to load and run when the disk is booted. If I use beebasm's -boot and -opt 4,3 options like so:

Code: Select all

beebasm -i main.asm -do disk.ssd -boot HMC -opt4,3 
It doesn't work as beebasm defaults to *RUN HMC in the !boot file and since HMC is a BASIC file it fails.
My current workaround is to not use the -boot option have a boot file which I add to the disk using:

Code: Select all

PUTFILE "BOOT","!BOOT",&FFFF
Where BOOT is:

Code: Select all

*BASIC
CHAIN "HMC"
However, if I do this then beebasm fails to set OPT to 4,3 , I can't boot the disk and have to manually do it in the emulator or on the beeb.
I've done some searching and the only solution that I can find was suggested by Tricky in this thread on RetroSoftware:

http://www.retrosoftware.co.uk/forum/vi ... =hex#p7634

That seems like a lot of work for a simple boot file.
Am I missing something obvious that will do what I want or would it be a good idea to add this functionality to beebasm?

EDIT:
Just rereading the beebasm readme (for about the tenth time today!) and -boot will set opt to -4,3 so the opt in my command line above is not needed and opt 4,x is used to override this. So it seems that -opt is not meant to be used on its own.
Last edited by sydney on Sat Sep 08, 2018 6:25 am, edited 1 time in total.

User avatar
sydney
Posts: 2232
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne
Contact:

Re: beebasm -boot and -opt

Post by sydney » Sat Sep 08, 2018 7:21 am

I've come up with a temporary solution which is a small script which changes the byte in the ssd from '03' (opt 4,0) to '33' (opt 4,3). I then call this at the end of my build script and everything is fine.

Code: Select all

#!/bin/bash
file=disk.ssd
out=tempdisk.ssd
offset=262


dd if="$file" of="$out" conv=notrunc bs=1 count=$offset
printf '\x33' >> $out
dd if="$file"  conv=notrunc bs=1 skip=$(($offset + 1)) >> $out

cp tempdisk.ssd disk.ssd
rm tempdisk.ssd

User avatar
ctr
Posts: 165
Joined: Wed Jul 16, 2014 2:53 pm
Contact:

Re: beebasm -boot and -opt

Post by ctr » Sat Sep 08, 2018 11:15 am

The -opt parameter only accepts the boot option (i.e. miss out the 4):

Code: Select all

beebasm -i main.asm -do disk.ssd -boot HMC -opt 3
Or if you have a -boot parameter it defaults to boot option 3 so you can leave it out:

Code: Select all

beebasm -i main.asm -do disk.ssd -boot HMC

User avatar
sydney
Posts: 2232
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne
Contact:

Re: beebasm -boot and -opt

Post by sydney » Sat Sep 08, 2018 11:33 am

Thanks! I knew it would be something obvious.
Last edited by sydney on Sat Sep 08, 2018 11:35 am, edited 1 time in total.

User avatar
tricky
Posts: 2768
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: beebasm -boot and -opt

Post by tricky » Sat Sep 08, 2018 2:42 pm

Or you can use an .ssd as a template, in which case, I think beebasm copies it and adds your files, but it's been a while.

Post Reply