But whatever I tried, It would not assemble without error.
You are actually trying to get a reloctable program into the format of an absolute one. You may be better off starting a program targetted to ROM with an
might do the trick (OFFSET forces the next label to be at exactly that position in the relocatable section). The problem is that OFFSET doesn't allow you anything but allocation of space, so this might only work in data sections.
If that doesn't work, simply use the RORG directive to place a label at an exact offset to the beginning of a SECTION (I have found that works best for me):
Martin_Head wrote: Tue Nov 07, 2023 10:42 am
I was trying to do something in QMAC, but I could not get it to work. I don't know if I am just doing something wrong, or if it's just not possible.
I want to assemble a program to create a ROM image. So it needs to be 16384 bytes long .
What I was trying to do, was to have a DS.B instruction at the end of the program to automatically pad out the assembly file to 16384 bytes.
Derek_Stewart wrote: Tue Nov 07, 2023 5:42 pm
Hi Martin,
What is the error message?
I can't remember exactly offhand. But I think it's something to do with relocatable objects.
I'm still fairly new to using QMAC (I'm used to the Talent/Quanta Assembler Workbench). I have not delved into things like linking or macros. I just assemble with the -NOLINK option.
The QMAC manual's not too helpful, if you don't know what you are doing in the first place.
Now I know it can be done, I will have a further play with the suggestions made. I think Mark Swifts solution looks like a good bet. I take it, that it just pads out with NOP's.
5016
5017 00 000022F4 31820000 cg_pat2a move.w d2,(a0,d0.w) ;set instruction
5018
5019
5020
5021 00 000022F8 7000 cg_exit2 moveq #$00,d0 ;exit with no error
5022 00 000022FA 4E75 rts
5023
5024
5025 ; **************************************************
5026 ; Uncomment the following when creating a ROM image
5027
5028 ;prog_end dcb.w ((0-(prog_end-start))&$3fff)/2,$4e71
5029
5030 00 000022FC prog_end dcb.w (16384-prog_end)/2,$4e71
|
****** ERROR 14 -- line 5030 - 0 - relocatable value not allowed here
5031 ; **************************************************
5032
5033
5034 end
****** TOTAL ERRORS 1 (line 5030)
**** TOTAL WARNINGS 0 (line 0)
memory usage 71 kbytes
Both calculations give the same result - $1D04. I don't know what the first calculation doe's that's different. Unless the 16384 looks like some kind of forward reference.
Isn't it because prog_end-start can be resolved immediately as an absolute number. But 16384-prog_end can't because prog_end position can't be resolved until linking/assembly? (16384 seen as fixed address, thus dcb.w size can't be resolved). QMAC manual page 29 Relocation factors: +1-1 (=0 absolute), +1 (+1 simple relocatable).