Author Topic: Nothing before the comma???  (Read 1334 times)

0 Members and 1 Guest are viewing this topic.

Offline CirclotronTopic starter

  • Super Contributor
  • ***
  • Posts: 3500
  • Country: au
Nothing before the comma???
« on: May 25, 2023, 05:26:05 am »
If we have
Code: [Select]
COM  LOCATION,Xthen that's easy. It complements a memory location that is offset by the amount contained in X
But what if we have
Code: [Select]
COM  ,XSeeing there is nothing before the comma, what memory location is it offset from?
I've seen other instructions that have a blank before the comma. What does this mean?
« Last Edit: May 25, 2023, 06:34:38 am by Circlotron »
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 5812
  • Country: nz
Re: Nothing before the comma???
« Reply #1 on: May 25, 2023, 07:58:26 am »
You need to specify what CPU you are talking about.

The M6809 uses such syntax to indicate register indirect or indexed addressing with no offset. It is the same as 0,R where R is any of X, Y, U, S. There is also ,R+  ,R++ ,-R and ,--R

If the assembler is smart it should generate ,R if you write 0,R. They both use the same amount of code, but no offset at all takes 1 cycle less than a 5 bit offset.
 

Offline CirclotronTopic starter

  • Super Contributor
  • ***
  • Posts: 3500
  • Country: au
Re: Nothing before the comma???
« Reply #2 on: May 25, 2023, 11:55:07 am »
You need to specify what CPU you are talking about.
NXP S08 family.
I'll study your explanation more closely when I'm not so tired.  :=\
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 5812
  • Country: nz
Re: Nothing before the comma???
« Reply #3 on: May 25, 2023, 01:01:40 pm »
You need to specify what CPU you are talking about.
NXP S08 family.
I'll study your explanation more closely when I'm not so tired.  :=\

Oh gosh, another wacky variation on the 6800!

Dropped the B register, but the lower half of the index register (now called H:X instead of X for arithmetic, but just X for all 16 bits in addressing modes) can do most of the things the B register can do in 6800. And of course where the 6800 has only 8 bit offset from X (and you have to put 0 whether you need it or not), the 6808 (like the 6809 and other later members) allows no offset (1 byte instruction), 8 bit offset (2 byte instruction) or 16 bit offset (3 byte instruction).

That must have saved ... fractions of a cent.

And made code porting a nightmare.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf