How to make an Auto-Loading RFS image?

discussion of beeb/electron applications, languages, utils and educational s/w
Post Reply
User avatar
aferenbach
Posts: 247
Joined: Sat Oct 01, 2005 4:00 pm
Location: Dundee, in Bonny Scotland
Contact:

How to make an Auto-Loading RFS image?

Post by aferenbach » Wed Apr 11, 2007 3:27 pm

Hi All

I was pottering around with the acorn electron emulator and when I popped the rom image in for Hopper then started up the machine it immediately started loading hopper and all of a sudden it was ready.

I was then struck by the idea that if a BBC B, for example, was fitted with a ROM like that then on power-up it would immediately load say, Chuckie Egg, for example without any need for the user to know any loading commands.

Does anyone know how to make an RFS image auto-load? random question I know.

Andrew

John Kortink
Posts: 116
Joined: Tue Mar 21, 2006 9:47 am

Post by John Kortink » Wed Apr 11, 2007 7:26 pm

I suppose the ROM *RUNs its own files once it gets an early service call (see AUG).

User avatar
sorvad
Posts: 2172
Joined: Wed Aug 24, 2005 12:13 pm
Location: Back of beyond
Contact:

Post by sorvad » Thu Apr 12, 2007 8:14 am

I wrote a auto starting ROM for a disabled project about 1990 ish. I actually wrote the program (that controlled some hardware to control lights/TV etc.) in BASIC (as that gave quickest dev time and speed wasn't an issue). I then stored the BASIC program in a sideways ROM which when it got a start up service code copied the BASIC contents into RAM, and then I think I may have shoved "RUN" into the keyboard buffer before exiting the service call.

That might not be 100% excactly how I got it to run but it'll be very close.

Basically you need to get down and dirty and add in a little assembler into the ROM code when it gets a service call as John points out.

I may be able to get the assembler source for my code sometime if your stuck, but it'll be on floppy somewhere and I've yet to go through my old disks to archive them. So would be sometime before I gave you the code.

User avatar
aferenbach
Posts: 247
Joined: Sat Oct 01, 2005 4:00 pm
Location: Dundee, in Bonny Scotland
Contact:

Advanced user guide

Post by aferenbach » Thu Apr 12, 2007 10:42 am

Hi there Sorvad

I had a thumb through the Advanced User Guide but alas my programming prowess never got beyond monkeying around writing very bad games during the 1980s.

I was wondering if there was any way of my scrutinising the rom images for the Electron cartridges and grabbing the relevant piece (which might be common to several of them) and blending it with my own RFS image.

I also had the thought that one ROM on the machine could be a Universal automatic boot - that contains the assembler thing and specifically chains a file called LOADER or some other general name. Then people could throw together another RFS image at their leisure with the first file called LOADER and put it in the next socket down the priority list and presto - any auto loading rom could be made! Alas that is also way beyond my abilities.

If anybody fancies the challenge of making a universal RFS boot rom I would be very grateful.

User avatar
CMcDougall
Posts: 6096
Joined: Wed Feb 02, 2005 3:13 pm
Location: Shadow in a Valley of Scotland
Contact:

Post by CMcDougall » Thu Apr 12, 2007 12:38 pm

have u tried copying the !boot file from Hopper, change ch."hopper" to "loader" .....worth a go.

if no work, then must have a *opt4,3 somewhere :roll:
ImageImageImage

User avatar
aferenbach
Posts: 247
Joined: Sat Oct 01, 2005 4:00 pm
Location: Dundee, in Bonny Scotland
Contact:

booting

Post by aferenbach » Thu Apr 12, 2007 1:59 pm

A few mins ago I thought I was having a eureka moment...

I thought i could hot wire hopper's boot to load my file instead of its own... muahahaha!

so far I have tried popping the rom image into a text editor and changing CH."HOPPER" to CH."LOADER" and the image self destructs the second it is loaded into sideways ram. This is only in an emulator so perhaps if i did that then put it onto an EPROM which couldn't erase itself there might be a hope.

Is there some sort of copy protection/monkeying about protection built in?

Does anyone else fancy performing surgery on the Hopper rom cart image to make it do my loading? I may try putting it onto eprom to see if it works that way.

Andrew

User avatar
CMcDougall
Posts: 6096
Joined: Wed Feb 02, 2005 3:13 pm
Location: Shadow in a Valley of Scotland
Contact:

Post by CMcDougall » Thu Apr 12, 2007 2:31 pm

i could not get it to 'auto-boot' on a Master emulator either (original Hopper).

no protection on those old game carts :wink:
ImageImageImage

User avatar
aferenbach
Posts: 247
Joined: Sat Oct 01, 2005 4:00 pm
Location: Dundee, in Bonny Scotland
Contact:

hopper

Post by aferenbach » Thu Apr 12, 2007 4:00 pm

The Electron hopper cart can be auto booted when you hit CTRL-BREAK. But when I used Advanced ROM manager to change it to LOADER rather than HOPPER it went bananas and gave "Data?" error. Also my attempts at changing the rom file with a Notepad before popping it in a disc image generated the "Illegal instruction" error when trying to load to sideways ram.

Can somebody perform more delicate surgery on Hopper? not sure if it is some sort of internal checksum or if it is just my meddling corrupting some subtle feature of the rom.

ho hum

Andrew

User avatar
regregex
Posts: 558
Joined: Sun Jan 02, 2005 9:51 pm
Location: London, UK
Contact:

Post by regregex » Thu Apr 12, 2007 5:27 pm

The MOS has a 'universal boot routine' built in; press SHIFT+]+BREAK and it will auto-run a file named !BOOT in the highest priority ROM. The ] can be any key not recognised by another ROM, e.g. D belongs to DFS.)

If you want a ROM to boot when the machine is turned on, as well as making link 5 on the keyboard you'll need to claim service call 3 as Andrew points out. (See AUG.) Or remove the DFS and ADFS ROMs so that the call goes unclaimed.

If there's no file named !BOOT in any ROM, you get:

Code: Select all

BBC Computer

Searching
File not found

BASIC

>
If there is, it will be *RUN, not *EXECed or *LOADed. (Actually it's */ed.) A short machine code binary can be used to start BASIC and CHAIN the main program, e.g.

Code: Select all

0E00  A2 2E A0 0E 20 F7 FF A9  .... ...
0E08  02 A2 00 20 F4 FF A9 15  ... ....
0E10  A2 00 08 78 20 F4 FF A9  ...x ...
0E18  8A A2 00 A0 80 20 F4 FF  ..... ..
0E20  28 A2 28 A0 0E 4C F7 FF  (.(..L..
0E28  42 41 53 49 43 0D 4B 45  BASIC.KE
0E30  59 30 50 41 47 45 3D 26  Y0PAGE=&
0E38  45 30 30 3A 43 48 41 49  E00:CHAI
0E40  4E 22 21 42 6F 6F 74 49  N"!BootI
0E48  6D 61 67 65 22 7C 4D 0D  mage"|M.
which does the equivalent of

Code: Select all

*KEY 0 PAGE=&E00:CHAIN"!BootImage"|M   (define f0 key)
*FX 2,0                                (take input from keyboard)
*FX 21,0                               (clear keyboard buffer)
*FX 138,0,128                          (insert f0 key into buffer)
*BASIC                                 (start BASIC)
If you do claim service call 3, you're free to do *EXEC, CHAIN or whatever you like.

Re: Hopper, most commercial titles try to clobber themselves in case they've been copied to sideways RAM. Nothing for it but to get out the byte-sabre and declaw the little beast.

--Greg

Edit: changed dump into 40-column format, added explanation of binary.
Last edited by regregex on Fri Apr 13, 2007 12:48 pm, edited 3 times in total.

User avatar
aferenbach
Posts: 247
Joined: Sat Oct 01, 2005 4:00 pm
Location: Dundee, in Bonny Scotland
Contact:

hopper

Post by aferenbach » Thu Apr 12, 2007 9:38 pm

declaw the beast? sounds wonderful. So do you reckon it would work if I made a bona-fide ROM chip of Hopper with the boot target changed?

Or

i remove DFS and put my own rom in highest slot with runnable boot thingy.

User avatar
sorvad
Posts: 2172
Joined: Wed Aug 24, 2005 12:13 pm
Location: Back of beyond
Contact:

Post by sorvad » Fri Apr 13, 2007 7:49 am

When I wrote my ROM to do this the machines had DFS fitted and I didn't need to change any links...

Having said that it definitely worked on a Master as that was how it was developed. And I'm sure we ran and tested it on a blown eprom on the beeb.... or did we.... Did I just load in the BASIC program normally to demo the software... You know how memory plays tricks over time.

I will really have to try and dig that floppy out with the source code on. I think all I did was use the normal ROM startup service entry point to do all my jiggery pokery.

But my chip didn't contain a ROMFS image though, but was highly custom in what it contained and did, does that make any difference ?

User avatar
aferenbach
Posts: 247
Joined: Sat Oct 01, 2005 4:00 pm
Location: Dundee, in Bonny Scotland
Contact:

jiggery pokery

Post by aferenbach » Fri Apr 13, 2007 11:12 am

well, so long as you can subvert the code of yours to just chain LOADER in RFS then we have ourselves a universal auto-loader.

User avatar
regregex
Posts: 558
Joined: Sun Jan 02, 2005 9:51 pm
Location: London, UK
Contact:

Post by regregex » Fri Apr 13, 2007 12:33 pm

Well if you're handling the service calls you have control of the computer and can dump stuff from ROM directly into main memory, or do whatever you like. The only difference with RFS is you get named files that can be CHAINed, OPENINed etc, and have built-in checksums.

Depending on how the ROM is coded you may end up losing the ability to boot from disc, but as long as you respect other ROMs' hotkeys and the boot flag (in Y on entry to service call 3) they can coexist happily.

By declawing I meant taking out the copy-protection bits that clobber the ROM image itself. It would be easier just to take the autoloading bit out of Hopper and put it into a new image. It shouldn't take two ROMs to do an autoload.

For example this code hooked into the service routine of a RFS ROM will allow it to claim auto-boot like DFS. The optional hotkey is R+BREAK to select RFS, or SHIFT+R+BREAK to auto-run a !BOOT file in the ROM.

Code: Select all

\ (Untested. With some excerpts from EDOS)
.svc    CMP #3 \service call handler
        BEQ boot \if A=3 then handle auto-boot call
        CMP #... \else test for other calls...
        BEQ ...
        ...

.boot   PHA \save service call number
        TYA
        PHA \save parameter
        LDA #&7A
        JSR osbyte \scan keyboard from code &10
        TXA
        BMI doboot \if no keypress allow boot
        CMP #-52 + 256 \key code for R (see INKEY)
        BNE throw \if keypress other than R then no boot
        LDA #&78
        JSR osbyte \else register keypress for 2-key rollover
.doboot LDA #141
        JSR osbyte \do *ROM to select ROM filing system
        PLA
        BNE exit \if Y>0 on entry then don't autoboot
        LDX #LEN($bootcmd) \else copy boot command into stack page
.bootloop
        LDA bootcmd,X \as this ROM is about to disappear!
        STA &0100,X
        DEX
        BPL bootloop
        INX \X=0
        INY \Y=1
        JSR oscli \run the *command in the stack page
.exit   PLA \discard service call number
        LDA #0 \set A=0 to say we've dealt with it
        RTS \and exit.
.throw  PLA \restore parameter and call number
        TAY
        PLA \exit, passing the call to the next ROM
        RTS
.bootcmd
        EQUS "/!BOOT" \or "EXEC !BOOT" or "LOAD !BOOT" as desired
        EQUB &0D

User avatar
aferenbach
Posts: 247
Joined: Sat Oct 01, 2005 4:00 pm
Location: Dundee, in Bonny Scotland
Contact:

coding a rom

Post by aferenbach » Fri Apr 13, 2007 1:08 pm

hi Beardo

That machine code looks impressive, but alas I don't know how to use that per-se. My big stumbling block is that I don't have a clue about the dark art of machine code on the BBC or any other machine, hence my plea for someone to make a universal loader rom image for me.

It would be my plan to deprive a BBC of the ability to boot from disc or any other external filing system. Conceivably someone could fit a machine with several roms housing spanned game files in RFS and the Universal loader could be hooked up to a Menu program.

The main purpose of this would be for a computer inept friend of mine who loves Chuckie egg but would find remembering a loading command too much effort.

If someone was wonderful enough to make a universal loading rom then anyone wishing to do so could create hard-wired BBC machines which are exclusively devoted to either one or a select few games. All the person would need to do as well as fit the universal loader is to make an RFS image which features the filename LOADER and the universal rom will do the rest.

User avatar
regregex
Posts: 558
Joined: Sun Jan 02, 2005 9:51 pm
Location: London, UK
Contact:

Post by regregex » Fri Apr 13, 2007 6:37 pm

Ah, ok. A modular system is a nice idea. So you're after a MMCMenu kind of thing but without a GoMMC board. That would make a neat shell, exactly the kind of thing [paged ROM] was designed for.

That will take some doing but in the meantime how about lashing up a BASIC menu for the titles you're putting together? If someone (maybe me) would be so kind as to put the code above into RFSHEAD or the like (and maybe combine it with the binary) you could build it yourself, Andrew.

I'll have a look at it and get back to you.

--Greg

User avatar
aferenbach
Posts: 247
Joined: Sat Oct 01, 2005 4:00 pm
Location: Dundee, in Bonny Scotland
Contact:

MENU for rom

Post by aferenbach » Mon Apr 16, 2007 2:00 pm

Hi All

Here are links to the disc image files I have put together.

Here is a ROM I made with PROMMER which contains a *MENU and *CHUCKIE - MENUROM.

It also contains the original basic file for the menu and a runnable CHUCKIE.

And it also has MENURFS which is a RFS image with menu and chuckie.

here is the link...

http://arseburger.50megs.com/menurom.txt

you have to rename it to menurom.ssd (my hoster wigs out at the SSD extension.


If either of these roms can be made auto-loading then it means that it can be fitted along with the very amazing arcadians on ROM which is available in the "Compressed RFS images" thread and my own PROMMER treated copy of Pacman (which I will supply to anyone on request, to save the bother of re-making it).

Thanks in advance for people's help

Andrew

User avatar
aferenbach
Posts: 247
Joined: Sat Oct 01, 2005 4:00 pm
Location: Dundee, in Bonny Scotland
Contact:

alternative download link

Post by aferenbach » Tue Apr 17, 2007 1:12 pm

or you can download it from here...

http://www.mediafire.com/?64wyyqvdyqy

Cheers in advance

andrew

g7jjf
Posts: 359
Joined: Sun Aug 07, 2005 7:29 pm
Location: Notts, England
Contact:

Post by g7jjf » Fri Apr 20, 2007 8:00 pm

Try this then :

http://www.g7jjf.com/progs/autorun.rom

This should auto run your loader menu on power on or Break.

When used on a Master 128, a Ctrl-Break is needed to auto run but on a Beeb, you can use Break or Ctrl-Break.

I've tried it with chuckie and arcadians and both seem to work ok.

Jon.

User avatar
aferenbach
Posts: 247
Joined: Sat Oct 01, 2005 4:00 pm
Location: Dundee, in Bonny Scotland
Contact:

auto loader

Post by aferenbach » Wed Apr 25, 2007 12:07 am

wow, I totally have to get this onto eprom and check it out

Many many thanks

Andrew

User avatar
aferenbach
Posts: 247
Joined: Sat Oct 01, 2005 4:00 pm
Location: Dundee, in Bonny Scotland
Contact:

disc image of the complete trio!

Post by aferenbach » Wed Apr 25, 2007 11:38 am

I tested them under BeebEm and they work like magic - fantastic, yet another triumph from Jon Welch!

Here is a link to a disc image with all three for anyone who fancies creating an Arcadians, Pacman and Chuckie Egg devoted machine.

http://www.mediafire.com/?0ktnml50dmz

The roms are ARCADIA, PACMAN and AUTORUN - the rest are stray files of mine.

User avatar
aferenbach
Posts: 247
Joined: Sat Oct 01, 2005 4:00 pm
Location: Dundee, in Bonny Scotland
Contact:

Universal loader

Post by aferenbach » Thu Apr 26, 2007 2:45 pm

Hi Jon

I just had a couple of questions about the making of the auto-loader. Could you do a version of the rom which is not combined with the RFS image I supplied, but does *ROM and CHAIN"MENU" automatically? That way I could change the menu (present on a separate RFS ROM) and the mix of games without hassling you for a re-write each time.

Thanks again

Andrew

g7jjf
Posts: 359
Joined: Sun Aug 07, 2005 7:29 pm
Location: Notts, England
Contact:

Post by g7jjf » Thu Apr 26, 2007 7:04 pm

Replied via PM

Post Reply