( ) around absolute short addressing mode

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
Okie
Interested
Posts: 25
Joined: Wed Jun 30, 2021 7:31 pm
Location: United States Of America

( ) around absolute short addressing mode

Post by Okie » Wed Aug 18, 2021 2:17 am

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?

Chilly Willy
Very interested
Posts: 2858
Joined: Fri Aug 17, 2007 9:33 pm

Re: ( ) around absolute short addressing mode

Post by Chilly Willy » Wed Aug 18, 2021 3:55 pm

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).

Okie
Interested
Posts: 25
Joined: Wed Jun 30, 2021 7:31 pm
Location: United States Of America

Re: ( ) around absolute short addressing mode

Post by Okie » Wed Aug 18, 2021 4:52 pm

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

Code: Select all

Move.b $FFFFFFFF,D0
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?

Code: Select all

Move.b #$FFFFFFFF,D0 
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 .

Chilly Willy
Very interested
Posts: 2858
Joined: Fri Aug 17, 2007 9:33 pm

Re: ( ) around absolute short addressing mode

Post by Chilly Willy » Wed Aug 18, 2021 5:56 pm

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.

Okie
Interested
Posts: 25
Joined: Wed Jun 30, 2021 7:31 pm
Location: United States Of America

Re: ( ) around absolute short addressing mode

Post by Okie » Tue Aug 24, 2021 9:00 pm

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?

HardWareMan
Very interested
Posts: 733
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Re: ( ) around absolute short addressing mode

Post by HardWareMan » Wed Aug 25, 2021 10:56 am

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.
Image

Post Reply