Page 1 of 1
Another QMAC question.....
Posted: Mon Oct 20, 2014 1:08 pm
by prime
Ok,
So I'm trying to port the released QLSD source for use in my own hardware implementation. This will be on a standard expansion card and so i will need to put the I/O registers at a specified offset from the beginning of the ROM and **NOT** an absolute address.
I just can't figure out how to do this in QMAC
I know i will need something like :
Code: Select all
REGBASE equ $3ff0
lea REGBASE(PC),a5
this however generates the error :
Code: Select all
86 01 00000020 4BFA3FCE lea IFBASE(PC),a5
|
****** ERROR 31 -- line 86 - 0 - wrong relocation for PC-relative address
Any idea what I can do to fix this ?
Cheers.
Phill.
Re: Another QMAC question.....
Posted: Mon Oct 20, 2014 1:27 pm
by tofro
Phill,
try an indexed register, somewhat like that:
Code: Select all
ROMSTART: dc.l $4afb0001
CODESTART: lea ROMSTART(PC),a0
move.l #register_offset,d0
lea 0(a0,d0.w),a0
This should work. PC-relative addressing doesn't like absolute offsets that are directly equated (I pretty much doubt that even if it had worked you'd be ending up at the correct address - I guess you put in the absolute offset of the registers from the beginning instead of the the difference between the PC and the register...). It want's to see these in your code and calculate on its own....
Tobias
Re: Another QMAC question.....
Posted: Tue Jan 20, 2015 12:34 am
by ql_freak
prime wrote:Ok,
So I'm trying to port the released QLSD source for use in my own hardware implementation. This will be on a standard expansion card and so i will need to put the I/O registers at a specified offset from the beginning of the ROM and **NOT** an absolute address.
I just can't figure out how to do this in QMAC :(
I know i will need something like :
Code: Select all
REGBASE equ $3ff0
lea REGBASE(PC),a5
this however generates the error :
Code: Select all
86 01 00000020 4BFA3FCE lea IFBASE(PC),a5
|
****** ERROR 31 -- line 86 - 0 - wrong relocation for PC-relative address
Any idea what I can do to fix this ?
You load relative to the PC (program counter) with LEA (load effective address?) an absolute address(?). Relative addressing on the 68k is only -32768 to +32767 (it is not a real 32-bit processor). So if your program is loaded in the TPA, this relative addressing is too large?
Don't know, if this is correct (I haven't do any programming for 68k for long times) - so the assembler (the 68k-processor) can't relocate (do) this (physically not cabable).
Re: Another QMAC question.....
Posted: Tue Jan 20, 2015 9:30 pm
by ppe
prime wrote:Ok,
I know i will need something like :
Code: Select all
REGBASE equ $3ff0
lea REGBASE(PC),a5
Any idea what I can do to fix this ?
Cheers.
Phill.
Hi Phill,
I think you need to leave out the "(pc)" bit in assembler source and just specify the offset, i.e, go for
Kind regards,
Petri
Re: Another QMAC question.....
Posted: Tue Jan 20, 2015 9:47 pm
by ql_freak
ppe wrote:prime wrote:I think you need to leave out the "(pc)" bit in assembler source and just specify the offset, i.e, go for
I think you are right. The assembler calculates the distance from the PC to the address - programmers are lazy and this saves 4 characters typing ;-)
Re: Another QMAC question.....
Posted: Wed Jan 21, 2015 10:11 am
by prime
Just as a quick update I fixed it by defining a symbol ROMSTART at the beginning of the ROM then doing :
Code: Select all
GENIF IS_ROMREL = 1
lea ROMSTART(PC),a5 ; point to base of ROM
ENDGEN
GENIF IS_ROMREL = 0
move.l #IF_BASE,a5 ; a5=Pointer to QLROMEXT control registers
ENDGEN
And then defining all the offsets for the IO relative to the start of the ROM if ROMREL=1, and relative to IF_BASE if not.
Cheers.
Phill.