CPCWiki forum

General Category => Programming => Topic started by: Fran123 on 07:29, 11 April 22

Title: searching a rom command
Post by: Fran123 on 07:29, 11 April 22
Hello

I'm trying execute a command from my custom rom.

I have this code:
my_function:
ld hl, cmd_read_sector
call #bcd4 ; <hl=address <c=rom number

...

.cmd_read_sector equ #84


If I execute that from a program in RAM it works (HL=#C030 and C=7=AMSDOS ROM),
but if I execute it from my ROM, HL gets #C045 and C=#10 (empty ROM)

What is wrong?

Thanks
Title: Re: searching a rom command
Post by: pelrun on 09:28, 11 April 22
HL points at a RAM address, but I bet you're assembling cmd_read_sector to ROM. You'll need to put the command name somewhere in RAM for KL FIND COMMAND to work; the link below suggests a convenient method is to push it onto the stack.

https://www.cpcwiki.eu/forum/programming/kl_find_command-within-a-rom/
Powered by SMFPacks Menu Editor Mod