Page 1 of 2
CA65: how to get a simple one file binary for a EEPROM/Flash
Posted: Fri Aug 26, 2022 6:48 am
by willie68
purely out of curiosity,
normally i'm working with retroAssembler for my sbc. But jesterday, purely out of curiosity, i had a look into CC65 and the CA65.
But i didn't get that working. In my asm file i have some jump tables just like this:
Code: Select all
jump_table:
.segment "JUMPTABLE"
.org $FF00 ; STROUT output string, A = high, X = low
jmp do_strout
.org $FF81 ; SCINIT Initialize "Screen output", (here only the serial monitor)
jmp do_scinit
.org $FF84 ; IOINIT Initialize VIA & IRQ
jmp do_ioinit
.org $FF87 ; RAMTAS RAM test and search memory end
jmp do_ramtas
.org $FF8A ; RESTOR restore default kernel vectors
jmp do_restor
As you can easily see, the individual jumps are not continuously connected. If I now specify the segment for the table, the 1st jump is placed correctly, but the others specified with .org are not. However, everything is correct in the list file. So I suspect that the linker is not configured correctly here. How do I set this up correctly?
Re: CA65: how to get a simple one file binary for a EEPROM/F
Posted: Fri Aug 26, 2022 7:07 am
by jeffythedragonslayer
the 1st jump is placed correctly, but the others specified with .org are not.
I don't see a jmp that lacks the .org directive?
Re: CA65: how to get a simple one file binary for a EEPROM/F
Posted: Fri Aug 26, 2022 7:13 am
by willie68
Thats the point, but in the linker generated bin file, all jump are directly behind each other, ignoring the .org directrive.
With retro assembler (which didn't need a linker) it work like charm. But retroassembler is a assembler only.
Re: CA65: how to get a simple one file binary for a EEPROM/F
Posted: Fri Aug 26, 2022 7:21 am
by jeffythedragonslayer
I don't know why you navigated to $1F00 in the screenshot. That's quite the distance from $FF00 where the first JMP opcode should be.
Re: CA65: how to get a simple one file binary for a EEPROM/F
Posted: Fri Aug 26, 2022 7:33 am
by willie68
because the eeprom base adress is at $e000,
so $1f00 +$e000 = $ff00
Re: CA65: how to get a simple one file binary for a EEPROM/F
Posted: Fri Aug 26, 2022 7:36 am
by jeffythedragonslayer
How does the EEPROM base address being at $e000 make you want to look at $1F00? edit: ok, I see you added an addition.
Re: CA65: how to get a simple one file binary for a EEPROM/F
Posted: Fri Aug 26, 2022 7:43 am
by jeffythedragonslayer
What does the line containing "JUMPTABLE" in your mem map config file look like?
Re: CA65: how to get a simple one file binary for a EEPROM/F
Posted: Fri Aug 26, 2022 7:46 am
by willie68
THis is the full config file
Code: Select all
MEMORY
{
ZP: start=$0, size=$100, type=rw, define=yes;
RAM: start=$200, size=$7fff, type=rw, define=yes;
ROM: start=$e000, size=$2000, type=rw, fill=yes, fillval=$ea, file=%O;
}
SEGMENTS
{
ZEROPAGE: load=ZP, type=zp;
CODE: load=ROM, type=ro;
VECTORS: load=ROM, start= $fffa, type= overwrite;
JUMPTABLE: load=ROM, start= $ff00, type= overwrite;
}
Re: CA65: how to get a simple one file binary for a EEPROM/F
Posted: Fri Aug 26, 2022 7:56 am
by GARTHWILSON
because the eeprom base adress is at $e000,
so $1f00 +$e000 = $ff00
I hardly know anything about linkers. I used one 30+ years ago, but with a batch file set up by someone else (who initially had a lot of trouble getting it going), and I modified it from the templates for different projects without really understanding it. However, I still wonder if you're trying to use the linker for something that's not generally the linker's job. (E)EPROM programmers' driver software offer offsets, sets, splits, and so on, and the file pointer, buffer pointer, and device pointer can all be different. I now use the Cross-32 (C32) assembler which does not use a linker.
Re: CA65: how to get a simple one file binary for a EEPROM/F
Posted: Fri Aug 26, 2022 7:56 am
by jeffythedragonslayer
Not sure; since you know the first jmp is in the correct spot, can you try putting each jmp in its own segment and specify the addresses you were using with .org in the memmap configuration? JUMPTABLE1, JUMPTABLE2, etc.
Re: CA65: how to get a simple one file binary for a EEPROM/F
Posted: Fri Aug 26, 2022 8:34 am
by willie68
But than i double the effort, have to insert .segment and .org part in asm, and a segment in the configuration...
I'm looking for an easy solution for this...
Re: CA65: how to get a simple one file binary for a EEPROM/F
Posted: Fri Aug 26, 2022 8:42 am
by Proxy
If you use .segement you don't need .org
I have something similar for the ROM of my 65816 SBC. Once I get home I can see If I can get your example to work
Re: CA65: how to get a simple one file binary for a EEPROM/F
Posted: Fri Aug 26, 2022 9:02 am
by willie68
If you use .segement you don't need .org
I have something similar for the ROM of my 65816 SBC. Once I get home I can see If I can get your example to work
But the effort for this, creating a segment for every bios routine jump, is quite high for such a simple requirement.
I open an issue to the developer of CA65 (
https://github.com/cc65/cc65/issues/1841) maybe they have another simple idea.
Otherwise maybe CA65 is the wrong tool for this and for me... i like KISS
Re: CA65: how to get a simple one file binary for a EEPROM/F
Posted: Fri Aug 26, 2022 9:48 am
by BigEd
Could you add in a DB or similar 'declare bytes' padding to fill in between the JMPs? I suppose that's a little manual.
Re: CA65: how to get a simple one file binary for a EEPROM/F
Posted: Fri Aug 26, 2022 10:02 am
by Proxy
i commented on the github issue suggesting basically what BigEd said, ca65 has the ".res" (aka reserve) directive which allows you to insert x amount of bytes directly where you placed it in the assembly file.
using it the jumps can be pushed apart without messing with segments, but obviously it takes a bit of work as you need to do the math to know how large the gaps should be.