( ) around absolute short addressing mode
Moderator: BigEvilCorporation
( ) around absolute short addressing mode
So in Megadrive disassembles, they write move.b ($FFFFF600).w,d0 .
Why do they add parentheses around the address ( Screen Mode in case ); after all, we are not indirect referencing an address register. Is it really necessary to make it an absolute short addressing mode (XXX).w? I could swear the binary of this opcode is the sane without parenthesis (tested with snasm) . Or is it because Assemblers like Snasm allow periods in labels , so they want to declare explicitly that ".w" isn't part of the label. Is this some efficient way to save time for assembling so it doesn't have to scan right to left the .w to see that the .w mean s its a word or something?
Why do they add parentheses around the address ( Screen Mode in case ); after all, we are not indirect referencing an address register. Is it really necessary to make it an absolute short addressing mode (XXX).w? I could swear the binary of this opcode is the sane without parenthesis (tested with snasm) . Or is it because Assemblers like Snasm allow periods in labels , so they want to declare explicitly that ".w" isn't part of the label. Is this some efficient way to save time for assembling so it doesn't have to scan right to left the .w to see that the .w mean s its a word or something?
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
Re: ( ) around absolute short addressing mode
There are a number of different syntax formats for the 680x0, depending on who did the original assembler. Most assemblers tend to stick with Motorola format, but you will see others. The parenthesis are standard for showing memory access. a0 and (a0) are not the same thing - (a0) means the memory pointed to by a0. Similarly, (abs).size is the memory pointed to by abs.size. You can do (abs).l (a long absolute address), or (abs).w (a word absolute address - the word is sign extended to a long before being used).
Re: ( ) around absolute short addressing mode
I thought parenthesis for indirect referring is only for address registers .
if you are reffering to to an address like $FFFFFFFF , doesn’t the $ state that it is the value stored at the address $FFFFFFFF ?
Say A byte at $Ffffffff value is 0xF4
Wouldn’t this move the byte value at memory address $FFFFFFFF to do ... move 0xF4 to do
As opposed to $FFFFFFFF , would that be an immediate value?
Moves the Low byte of value #$FFFFFFFF TO DO SO DO = FF
Just wondering because if that was the case, the () wouldn’t be necessary but please tell me if I am wrong. I tested with snasm and without () seemed to still seemed to get the value at the address .
if you are reffering to to an address like $FFFFFFFF , doesn’t the $ state that it is the value stored at the address $FFFFFFFF ?
Say A byte at $Ffffffff value is 0xF4
Code: Select all
Move.b $FFFFFFFF,D0
As opposed to $FFFFFFFF , would that be an immediate value?
Code: Select all
Move.b #$FFFFFFFF,D0
Just wondering because if that was the case, the () wouldn’t be necessary but please tell me if I am wrong. I tested with snasm and without () seemed to still seemed to get the value at the address .
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
Re: ( ) around absolute short addressing mode
Most assemblers will treat ABS.x and (ABS).x the same, but some will throw an error for one or the other. Consult the docs for the assembler your using, especially if it allows setting the syntax used. It should tell you what variants are allowed and which are not.
Re: ( ) around absolute short addressing mode
Thanks. So what I had been taught that a # indicated an immediate value , so $FFFF doesn't have a # in front so that is enough to indicate it is an address and not a hex value literally . Why is () necessary for some assemblers if not having a # denotes an address?
-
- Very interested
- Posts: 749
- Joined: Sat Dec 15, 2007 7:49 am
- Location: Kazakhstan, Pavlodar
Re: ( ) around absolute short addressing mode
Everyone should stick with official docs, specifically M68000 Family Programmer's Reference Manual. At the page 2-20 (61 in the PDF) there summary table of all available addressing modes.
Re: ( ) around absolute short addressing mode
The ($FFFFF600).w means to pack the value in a word (16 bits) instead of a long (32bits), which -depending on the compiler- it will do by default. It works because this cpu will always do sign extension while expanding address.
Edit: My mistake (thanks guardian angel)
Edit: My mistake (thanks guardian angel)
HELP. Spanish TVs are brain washing people to be hostile to me.
Re: ( ) around absolute short addressing mode
ok, let's try it again, I think I read it to fast last time.
MY OPINION: In fact the second way is more correct in case you want to expand the cpu grammar. Take for example a new instruction like:
move (0x1111.l,(0x4444.w,a1)), d0
Also "move 4(a0), d0", "move (4,a0), d0" and "move 2+4/2(a0), d0" are all valid and the same. The later is specially useful in case of parametrized macros.
Not exactly, the '$' means exactly the same as "0x" on a C/C++ compiler, it just entails that the following number is in hexadecimal notation, nothing more.
By default all indirections in 68k go in between parentheses, no matter if is an immediate address or a register. Then most compilers allow to omit the parentheses in case of immediate address. Why? Perhaps because in older grammars that was the way, and habits are hard to change.
No
No, you can write it as "move.b ($FFFFF600).w,d0" or "move.b ($FFFFF600.w),d0"; doesn't matter (again depending on the compiler).Okie wrote: ↑Wed Aug 18, 2021 2:17 amOr is it because Assemblers like Snasm allow periods in labels , so they want to declare explicitly that ".w" isn't part of the label. Is this some efficient way to save time for assembling so it doesn't have to scan right to left the .w to see that the .w mean s its a word or something?
MY OPINION: In fact the second way is more correct in case you want to expand the cpu grammar. Take for example a new instruction like:
move (0x1111.l,(0x4444.w,a1)), d0
Also "move 4(a0), d0", "move (4,a0), d0" and "move 2+4/2(a0), d0" are all valid and the same. The later is specially useful in case of parametrized macros.
Imagine writing the instruction "move (a0,4),d0" without parentheses.
HELP. Spanish TVs are brain washing people to be hostile to me.
Re: ( ) around absolute short addressing mode
Thank you very much Miquel. Sorry for late reply been doing disassembly stuff on s3k. I will look at the response tonight. Thanks