Plug-in ROM without $4AFB0001 Header

Anything QL Software or Programming Related.
User avatar
t0nyt
Gold Card
Posts: 438
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Plug-in ROM without $4AFB0001 Header

Post by t0nyt »

I was wondering if anyone could confirm, please, that if a ROM at $C000 does NOT have the $4AFB0001 header then the QL does nothing with it? i.e. no initialisation code gets run etc.

And therefore any program that wants to make use of whatever it has in it, HAS to call routines in it directly please?

Many thanks!


User avatar
tofro
Font of All Knowledge
Posts: 2714
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Plug-in ROM without $4AFB0001 Header

Post by tofro »

t0nyt wrote: Thu May 02, 2024 4:11 pm I was wondering if anyone could confirm, please, that if a ROM at $C000 does NOT have the $4AFB0001 header then the QL does nothing with it? i.e. no initialisation code gets run etc.

And therefore any program that wants to make use of whatever it has in it, HAS to call routines in it directly please?

Many thanks!
That's it, exactly. $4afb0001 is the valid ROM header, that is (or, rather should, ideally be) checked at every 16k boundary in the ROM and expansion port address space. (Some ROM versions are very buggy in this respect, but the ROM port address is reliable here). IF a ROM doesn't have a valid header, it will be ignored by the OS. Even if a header isn't present, well the code is still there and can be called using other methods.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
t0nyt
Gold Card
Posts: 438
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Plug-in ROM without $4AFB0001 Header

Post by t0nyt »

tofro wrote: Thu May 02, 2024 6:19 pm
t0nyt wrote: Thu May 02, 2024 4:11 pm I was wondering if anyone could confirm, please, that if a ROM at $C000 does NOT have the $4AFB0001 header then the QL does nothing with it? i.e. no initialisation code gets run etc.

And therefore any program that wants to make use of whatever it has in it, HAS to call routines in it directly please?

Many thanks!
That's it, exactly. $4afb0001 is the valid ROM header, that is (or, rather should, ideally be) checked at every 16k boundary in the ROM and expansion port address space. (Some ROM versions are very buggy in this respect, but the ROM port address is reliable here). IF a ROM doesn't have a valid header, it will be ignored by the OS. Even if a header isn't present, well the code is still there and can be called using other methods.
Thanks Tofro.

Am damned if I can find how the program is accessing the ROM code so far, but at least I now know for sure it must be in there somewhere!

Many thanks


User avatar
Pr0f
QL Wafer Drive
Posts: 1318
Joined: Thu Oct 12, 2017 9:54 am

Re: Plug-in ROM without $4AFB0001 Header

Post by Pr0f »

Is the ROM in a cartridge? If so - that header should be there, but if you are reading the ROM chip outside of the cartridge - it's just possible that the address and or data lines are not in order on the ROM chip but are on the interface itself - if that makes sense.


User avatar
t0nyt
Gold Card
Posts: 438
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Plug-in ROM without $4AFB0001 Header

Post by t0nyt »

It’s a ROM I’ve dumped from a cartridge

I know it’s meant to be missing the header as when the program tries to verify the ROM is present it checks for 2 long words starting at $c000, and also the ROM works ok if I load it as a backup ROM in Q-emuLator

I’ve written a patch routine so I can tell the program where the ROM is so it passes the validation check, but I’m struggling to find how it actually uses it

On the upside I’m learning various utilities like multimon


Derek_Stewart
Font of All Knowledge
Posts: 4027
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Plug-in ROM without $4AFB0001 Header

Post by Derek_Stewart »

Hi,

The QL ROM header is an automatic way for the operating system to load code extensions to extend the system.

See the QDOS Technical Guide or SMSQ/E Reference Guide for more details of the ROM Header specification.

You can load in the ROM code and use EPROM_LOAD, which sometimes works, but this maybe only in SMSQ/E.

But the ROM code can be loaded to a memory and a call can be made which is equivalent to the ROM header jump code.


Regards,

Derek
User avatar
t0nyt
Gold Card
Posts: 438
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Plug-in ROM without $4AFB0001 Header

Post by t0nyt »

Derek_Stewart wrote: Fri May 03, 2024 8:46 am Hi,

The QL ROM header is an automatic way for the operating system to load code extensions to extend the system.

See the QDOS Technical Guide or SMSQ/E Reference Guide for more details of the ROM Header specification.

You can load in the ROM code and use EPROM_LOAD, which sometimes works, but this maybe only in SMSQ/E.

But the ROM code can be loaded to a memory and a call can be made which is equivalent to the ROM header jump code.
Hi Derek,

It's the CPMulator ROM I'm working with, so no header involved

I did look at EPROM_LOAD but it's SMSQ/E (as far as I can tell) which I don't have as it doesn't run on standard QL as far as I know?

Many thanks
Tony


User avatar
tofro
Font of All Knowledge
Posts: 2714
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Plug-in ROM without $4AFB0001 Header

Post by tofro »

The EPROM was apparently used as a means of copy protection.

Had I done that, I'd likely have coded the EPROM contents as position-dependent, which makes it next to impossible to simply load the EPROM contents to some other address and run it from there.

EPROM_LOAD is indeed SMSQ/E only (to work properly, it needs RAM at $C000 to be able to load code where it belongs), so this will only work on Gold and SuperGold cards.

In case you can't find a direct or indirect (via register) branch into the ROM area: Did you check whether the code on Microdrive uses a trap redirection table (look for a TRAP #1 with d0 = $7, MT.TRAPV)? - This could have been used to redirect a trap vector into the ROM area.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Derek_Stewart
Font of All Knowledge
Posts: 4027
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Plug-in ROM without $4AFB0001 Header

Post by Derek_Stewart »

t0nyt wrote: Fri May 03, 2024 8:54 am
Derek_Stewart wrote: Fri May 03, 2024 8:46 am Hi,

The QL ROM header is an automatic way for the operating system to load code extensions to extend the system.

See the QDOS Technical Guide or SMSQ/E Reference Guide for more details of the ROM Header specification.

You can load in the ROM code and use EPROM_LOAD, which sometimes works, but this maybe only in SMSQ/E.

But the ROM code can be loaded to a memory and a call can be made which is equivalent to the ROM header jump code.
Hi Derek,

It's the CPMulator ROM I'm working with, so no header involved

I did look at EPROM_LOAD but it's SMSQ/E (as far as I can tell) which I don't have as it doesn't run on standard QL as far as I know?

Many thanks
Tony
Hi Tony,

Sorry to be vague, I used to use CPMulator v2.00, there is a small boot loader that is required to modify the CPMulator startup, when the ROM is in ram. Which works in SMSQ/E, Minerva.

I would post a full working copy of the emulator, but I am not sure if the Sandy software is still copyright.


Regards,

Derek
User avatar
t0nyt
Gold Card
Posts: 438
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Plug-in ROM without $4AFB0001 Header

Post by t0nyt »

Hi Tofro,

The base program CPMU_EXE starts by checking for 2 long words at $C000, I assume just to make sure the ROM is plugged in (this is the part I've written a boot patch for so far), but there's no other reference to the range $C000-$FFFF in CPMU_EXE

If it's position dependent then that's a problem for using it, but at the moment I'm just intrigued as to how CPMU_EXE even uses/accesses the ROM (when it IS plugged in) given it's not initialised and therefore is, in theory, just a lump of memory

Thanks


Post Reply