Page 1 of 1
QMAC Assembler
Posted: Tue Nov 07, 2023 10:42 am
by Martin_Head
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.
I tried things like
and
But whatever I tried, It would not assemble without error.
Re: QMAC Assembler
Posted: Tue Nov 07, 2023 11:31 am
by Pr0f
I've seen similar fill's in the Minerva source - not sure if that helps at all - at work so I don't have access to any notes / info to assist further.
Re: QMAC Assembler
Posted: Tue Nov 07, 2023 12:01 pm
by tofro
Martin_Head wrote: Tue Nov 07, 2023 10:42 am
I tried things like
and
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
and end it with an
and the linker will fill the space automatically. I have found that RORG works best for me, however (see below).
If you absolutely don't want to use the ORG directive, maybe something like
Code: Select all
SECTION code
OFFSET 32767
codeend: DS.B 0
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):
Re: QMAC Assembler
Posted: Tue Nov 07, 2023 5:42 pm
by Derek_Stewart
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.
I tried things like
and
But whatever I tried, It would not assemble without error.
Hi Martin,
What is the error message?
Re: QMAC Assembler
Posted: Tue Nov 07, 2023 7:32 pm
by Mark Swift
Hi Martin,
I've not checked the syntax, but I usually do something like this to pad to the nearest 16K...
Code: Select all
BASE:
DC.B 'Put your code here',$A,$0
PAD16K:
DCB.W ((0-(PAD16K-BASE))&$3FFF)/2,$4E71
Re: QMAC Assembler
Posted: Wed Nov 08, 2023 9:58 am
by Martin_Head
Thanks for the response's
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.
Re: QMAC Assembler
Posted: Fri Nov 10, 2023 11:32 am
by Martin_Head
I tried Mark's solution and it works fine.
I wondered why the calculation looked so complicated. So I tried to simplify it, but I got the errors back on trying to assemble it
Code: Select all
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.
Re: QMAC Assembler
Posted: Fri Nov 10, 2023 3:27 pm
by Silvester
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).
Edit: Just tried this and it also worked
Code: Select all
prog_end dcb.w (16384-(prog_end-start))/2,$4e71
BTW for ROM shouldn't it be pad with $FF ?