movea.b movea.w why these exist?

All 680x0 related coding posts in this section please.

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2407
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

movea.b movea.w why these exist?

Postby charles » Mon Sep 03, 2018 1:53 am

just curious on how often coders really use the
movea.b and movea.w

I have never found use for these.......
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

alain
Retro freak
Retro freak
Posts: 12
Joined: Sun Jun 24, 2018 6:57 am

Re: movea.b movea.w why these exist?

Postby alain » Mon Sep 03, 2018 6:24 am

movea is used with registers A0-A7.
I never write movea but move and the assembler convert it in movea when it's a move to address register.

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2407
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: movea.b movea.w why these exist?

Postby charles » Mon Sep 03, 2018 6:27 am

but what about just a byte of the address or a word of the address... I guess for 16 bit 8 bit compatibility they might use those commands but is there any other ways to apply these in a practical sence?
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

mikro
Hardware Guru
Hardware Guru
Posts: 1784
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: movea.b movea.w why these exist?

Postby mikro » Mon Sep 03, 2018 6:56 am

movea.w is useful when you are accessing low/high addresses: movea.w #$8000,a0 = movea.l #$ffff8000,a0

AFAIK there's no movea.b.

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2407
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: movea.b movea.w why these exist?

Postby charles » Mon Sep 03, 2018 7:11 am

gfa asm there is
I think ?
want me to wtite a code the disassemble to see what really is burnin?
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

mikro
Hardware Guru
Hardware Guru
Posts: 1784
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: movea.b movea.w why these exist?

Postby mikro » Mon Sep 03, 2018 9:51 am

Instead of thinking you could google for "movea m68k" and see it for yourself (first link): http://68k.hax.com/MOVEA

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2407
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: movea.b movea.w why these exist?

Postby charles » Mon Sep 03, 2018 2:57 pm

I see ....was just trying a gfa assembler prgm someone had macros made ...wide world of probabilities...
thanks for great reference ..
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

User avatar
mfro
Atari Super Hero
Atari Super Hero
Posts: 766
Joined: Thu Aug 02, 2012 10:33 am
Location: SW Germany

Re: movea.b movea.w why these exist?

Postby mfro » Mon Sep 03, 2018 6:06 pm

charles wrote:just curious on how often coders really use the
movea.b and movea.w

I have never found use for these.......


You always use movea if you have an address register as destination as there is no move xxx, Ax instruction. Most assemblers silently convert move xx,Ax to movea xx, Ax. The same is true for add -> adda, ...

User avatar
Frank B
Atari Super Hero
Atari Super Hero
Posts: 974
Joined: Wed Jan 04, 2006 1:28 am
Location: Boston

Re: movea.b movea.w why these exist?

Postby Frank B » Mon Sep 03, 2018 8:09 pm

adda doesn't set CPU flags.. you can do address arithmetic without changing the state.. eg you could do a beq twice in a routine.
That wouldn't work for normal arithmetic. :)

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2407
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: movea.b movea.w why these exist?

Postby charles » Mon Sep 03, 2018 8:21 pm

frank u are always one step ahead of me ......! : )
combinatory speaking actually way ahead,but on this topic just one step .

just last night I wondered if ill ever understand why I haven't used a ccr or sr code yet...
these are the names of cpu flags correct?
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

ijor
Hardware Guru
Hardware Guru
Posts: 3627
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: movea.b movea.w why these exist?

Postby ijor » Mon Sep 03, 2018 9:53 pm

mfro wrote:You always use movea if you have an address register as destination as there is no move xxx, Ax instruction. Most assemblers silently convert move xx,Ax to movea xx, Ax. The same is true for add -> adda, ...


From the point of view of the assembler, it is actually the other way around. Assemblers convert MOVEA to MOVE, or they just ignore the difference. There is no MOVEA instruction at the encoding level. Or, if you want, MOVEA it is encoded exactly as MOVE to Ax.

The difference between MOVE & MOVEA is at the CPU behaviour, of course. But that's something that assemblers don't care. The difference is not only that condition codes are not changed, also word operations are extended to 32 bits, that sometimes can be very useful.

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2407
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: movea.b movea.w why these exist?

Postby charles » Mon Sep 03, 2018 10:56 pm

insightfull........knew this
the machine does what its programmed to do...the labels only tell where to do it...
dynamic actions ...so many I want to study over and over and over again .....

whats youre thoughts on macros ijor? used in assemblers?
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

mikro
Hardware Guru
Hardware Guru
Posts: 1784
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: movea.b movea.w why these exist?

Postby mikro » Tue Sep 04, 2018 5:49 am

ijor wrote:There is no MOVEA instruction at the encoding level. Or, if you want, MOVEA it is encoded exactly as MOVE to Ax.

Thank you for this interesting piece of information. I was always lazy to actually check that, always just wondering why on earth MOVE has also Ax as one of the destination fields if there's MOVEA?

So this MOVE / MOVEA dance was only to help the poor programmer to realise that OK, now I'm changing CCR and now I'm not?

ijor
Hardware Guru
Hardware Guru
Posts: 3627
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: movea.b movea.w why these exist?

Postby ijor » Tue Sep 04, 2018 12:35 pm

mikro wrote:So this MOVE / MOVEA dance was only to help the poor programmer to realise that OK, now I'm changing CCR and now I'm not?


Yes, I think so. It's a matter of point of view. For the coder it is a different instruction with different behaviour. The coder doesn't care too much how it is exactly encoded. For the assembler, it doesn't care about the different behaviour, only about the encoding and about allowed variants (say, MOVEA with byte size is invalid).

FedePede04
Atari God
Atari God
Posts: 1072
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: movea.b movea.w why these exist?

Postby FedePede04 » Tue Sep 04, 2018 1:51 pm

when speaking about 8bit address mode, is it not true that you can do a fast shift 8, by pushing a 8 bit to the stack and recover it as an 16 bit like this

Code: Select all

   Move.b   d0,-(Sp)
   move.w   (Sp)+,D0



or maybe it the other way around

Code: Select all

   Move.w   d0,-(Sp)
   move.b   (Sp)+,D0

Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

User avatar
troed
Atari God
Atari God
Posts: 1436
Joined: Mon Apr 30, 2012 6:20 pm
Location: Sweden

Re: movea.b movea.w why these exist?

Postby troed » Tue Sep 04, 2018 7:09 pm

It's true. I use it in my YM-stream playback code.

czietz
Hardware Guru
Hardware Guru
Posts: 783
Joined: Tue May 24, 2016 6:47 pm

Re: movea.b movea.w why these exist?

Postby czietz » Tue Sep 04, 2018 7:14 pm

I wonder what happens when an interrupt happens to occur just while the stack pointer is odd due to the code above. Address error?

deeez
Atari User
Atari User
Posts: 41
Joined: Fri May 03, 2013 4:51 pm

Re: movea.b movea.w why these exist?

Postby deeez » Tue Sep 04, 2018 7:25 pm

It is never odd (AFAIK), thats why the trick works.

User avatar
mfro
Atari Super Hero
Atari Super Hero
Posts: 766
Joined: Thu Aug 02, 2012 10:33 am
Location: SW Germany

Re: movea.b movea.w why these exist?

Postby mfro » Tue Sep 04, 2018 7:32 pm

czietz wrote:I wonder what happens when an interrupt happens to occur just while the stack pointer is odd due to the code above. Address error?


The stack pointer never becomes odd. It will point to the (superfluous) zero byte that gets pushed to keep it even. Pure C libraries, for example, are famous (at least for ColdFire enthusiasts) to use this "trick" to do a fast left shift by 8. This fails on ColdFires that can cope with a misaligned stack (they just get a little slower).

FedePede04
Atari God
Atari God
Posts: 1072
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: movea.b movea.w why these exist?

Postby FedePede04 » Tue Sep 04, 2018 7:33 pm

troed wrote:It's true. I use it in my YM-stream playback code.


can you do both a
lsl #8 if you using one of the example
and a lsr #8 if you use the other one?
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

ThorstenOtto
Captain Atari
Captain Atari
Posts: 450
Joined: Sun Aug 03, 2014 5:54 pm

Re: movea.b movea.w why these exist?

Postby ThorstenOtto » Tue Sep 04, 2018 7:34 pm

czietz wrote:I wonder what happens when an interrupt happens to occur just while the stack pointer is odd due to the code above. Address error?


You didn't know that? Come on :)

When pushing a byte, the SP is adjusted by 2, but only the byte is written to the new location. Similar when you pop a byte. I think that is faster than lsl #8 or similar, but only on plain 68k. Also, as long as you are in user mode, an interrupt would not care about your user SP being odd.

mikro
Hardware Guru
Hardware Guru
Posts: 1784
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: movea.b movea.w why these exist?

Postby mikro » Tue Sep 04, 2018 8:00 pm

ThorstenOtto wrote:
czietz wrote:I wonder what happens when an interrupt happens to occur just while the stack pointer is odd due to the code above. Address error?


You didn't know that? Come on :)

You'd be surprised how many respected experts are not aware of this. The author of vasm (yes, the assembler!) is another fine example. He had to run it on real Amiga to believe me. ;-)

ijor
Hardware Guru
Hardware Guru
Posts: 3627
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: movea.b movea.w why these exist?

Postby ijor » Tue Sep 04, 2018 8:26 pm

mikro wrote:You'd be surprised how many respected experts are not aware of this. The author of vasm (yes, the assembler!) is another fine example. He had to run it on real Amiga to believe me. ;-)


He didn't believe the original official Motorola manual? It is not an undocumented feature.

Btw, it is not exact that the SP can't never be odd. It is only when using the pre-decrement and post-increment addressing modes that it is not incremented or decremented just by one. Something like "MOVE #13,SP" is perfectly valid. It might provoke an address exception later, but the SP can perfectly hold an odd value.

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2407
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: movea.b movea.w why these exist?

Postby charles » Tue Sep 04, 2018 8:33 pm

wow techniques not easy for me to keep on this thread ...thanks guys
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!


Social Media

     

Return to “680x0”

Who is online

Users browsing this forum: No registered users and 3 guests