6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Mar 28, 2024 9:31 am

All times are UTC




Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Fri Aug 26, 2022 6:48 am 
Offline
User avatar

Joined: Wed Jul 27, 2022 6:14 am
Posts: 54
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:
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?

_________________
don't count on me, i'm engineer (Animotion)
my arduino pages: http://rcarduino.de


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 26, 2022 7:07 am 
Offline

Joined: Sun Oct 03, 2021 2:17 am
Posts: 114
willie68 wrote:
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?


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 26, 2022 7:13 am 
Offline
User avatar

Joined: Wed Jul 27, 2022 6:14 am
Posts: 54
Thats the point, but in the linker generated bin file, all jump are directly behind each other, ignoring the .org directrive.
Attachment:
Screenshot 2022-08-26 09.12.04.png
Screenshot 2022-08-26 09.12.04.png [ 668.68 KiB | Viewed 642 times ]

With retro assembler (which didn't need a linker) it work like charm. But retroassembler is a assembler only.

_________________
don't count on me, i'm engineer (Animotion)
my arduino pages: http://rcarduino.de


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 26, 2022 7:21 am 
Offline

Joined: Sun Oct 03, 2021 2:17 am
Posts: 114
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.


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 26, 2022 7:33 am 
Offline
User avatar

Joined: Wed Jul 27, 2022 6:14 am
Posts: 54
because the eeprom base adress is at $e000,
so $1f00 +$e000 = $ff00

_________________
don't count on me, i'm engineer (Animotion)
my arduino pages: http://rcarduino.de


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 26, 2022 7:36 am 
Offline

Joined: Sun Oct 03, 2021 2:17 am
Posts: 114
How does the EEPROM base address being at $e000 make you want to look at $1F00? edit: ok, I see you added an addition.


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 26, 2022 7:43 am 
Offline

Joined: Sun Oct 03, 2021 2:17 am
Posts: 114
What does the line containing "JUMPTABLE" in your mem map config file look like?


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 26, 2022 7:46 am 
Offline
User avatar

Joined: Wed Jul 27, 2022 6:14 am
Posts: 54
THis is the full config file
Code:
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;
}

_________________
don't count on me, i'm engineer (Animotion)
my arduino pages: http://rcarduino.de


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 26, 2022 7:56 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8412
Location: Southern California
willie68 wrote:
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.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 26, 2022 7:56 am 
Offline

Joined: Sun Oct 03, 2021 2:17 am
Posts: 114
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.


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 26, 2022 8:34 am 
Offline
User avatar

Joined: Wed Jul 27, 2022 6:14 am
Posts: 54
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...

_________________
don't count on me, i'm engineer (Animotion)
my arduino pages: http://rcarduino.de


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 26, 2022 8:42 am 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 735
Location: Germany
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


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 26, 2022 9:02 am 
Offline
User avatar

Joined: Wed Jul 27, 2022 6:14 am
Posts: 54
Proxy wrote:
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

_________________
don't count on me, i'm engineer (Animotion)
my arduino pages: http://rcarduino.de


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 26, 2022 9:48 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10760
Location: England
Could you add in a DB or similar 'declare bytes' padding to fill in between the JMPs? I suppose that's a little manual.


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 26, 2022 10:02 am 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 735
Location: Germany
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: