EASy68K
http://www.easy68k.com/EASy68Kforum/

Accessing part of a filled register
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=6&t=1538
Page 1 of 1

Author:  Obeisance [ Sat Feb 27, 2016 3:40 am ]
Post subject:  Accessing part of a filled register

I preemptively apologize for asking a very elementary question; my searches did not quickly yield my answer.

I understand that when I want to access data from memory, the size of the instruction dictates what is read:


ex.
Code:
MOVE.L #0,D0
MOVE.L #0,D1
MOVE.L #0,D2
MOVE.L #0,D3

MOVE.L #524292,($40).L
MOVE.L ($40).L,D0
MOVE.W ($40).L,D1

MOVE.W D0,D2
MOVE.B D0,D3


I expect that this results in a filled D0:
54292 = 0000000000001000 0000000000000100
D0 = 0000000000001000 0000000000000100
and a half filled (lower order byte) D1 = 0000000000000000 0000000000001000

This is because the second move instruction reads 4 bytes and the first one reads only 2 bytes starting at address pointed to by the value stored at address $40.
My question is: when I read a word value from a filled register, is the higher order byte the one which is read (starting at the first byte at bit 31) or is the lower order byte the one that is read (starting at bit 15)? Alternately, would D2 contain #4 or #8?

Author:  profkelly [ Sat Feb 27, 2016 11:23 am ]
Post subject:  Re: Accessing part of a filled register

The MOVE.W $40,D0 instruction copies the 16 bit value contained in address $40 and $41 to the lower 16 bits of register D0 resulting in 8.

Be careful about using memory locations below $400. Those addresses are reserved for exception vectors by the 68000.

Author:  Obeisance [ Sat Feb 27, 2016 12:42 pm ]
Post subject:  Re: Accessing part of a filled register

Thanks for the response.

I understand that putting data into a register results in filling from the lowest order byte, but does reading from the register do the same? i.e. reading a word from the 32 bit register (which has bits throughout) takes the lower order word in the register?

Aside: Here is another interesting thought about the exception table- I find, when reading my disassembly, that the exception table is re-defined throughout the code.

Author:  profkelly [ Sun Feb 28, 2016 9:55 am ]
Post subject:  Re: Accessing part of a filled register

Reading is the same as writing.

Author:  RetroGames [ Mon Feb 29, 2016 9:41 am ]
Post subject:  Re: Accessing part of a filled register

profkelly wrote:
Be careful about using memory locations below $400. Those addresses are reserved for exception vectors by the 68000.

Looking in the 68000 programmer's manual, I see that $100..$3FF contains "user-defined" vectors, but I don't see much else about them. Could you explain what those vectors are used for?

Author:  profkelly [ Mon Feb 29, 2016 12:44 pm ]
Post subject:  Re: Accessing part of a filled register

Exception vectors are described in EASy68K help. Go to Help/Simulator Operation/Exceptions.

Author:  RetroGames [ Fri Mar 04, 2016 7:35 pm ]
Post subject:  Re: Accessing part of a filled register

profkelly wrote:
Exception vectors are described in EASy68K help. Go to Help/Simulator Operation/Exceptions.

Thank you for the tip, Professor. I looked at the page you referred to in the help file, but I don't see any information about the user-defined vectors from $100..$3FF. In fact, there's only information on some of the Motorola-defined vectors from below $C0. I also used the help file's search to look for info on exceptions and interrupts, but I can't find anything about these user-defined vectors. Am I missing something?

Author:  profkelly [ Sat Mar 05, 2016 12:41 pm ]
Post subject:  Re: Accessing part of a filled register

This book explains the user defined vectors.
"The 68000 Microprocessor" by Andrew M. Veronis
https://books.google.com/books?id=O2DTBwAAQBAJ&lpg=PA84&ots=7iGO7lRJkp&dq=68000%20user%20defined%20vectors&pg=PR2#v=onepage&q=68000%20user%20defined%20vectors&f=false

Author:  RetroGames [ Sat Mar 05, 2016 3:14 pm ]
Post subject:  Re: Accessing part of a filled register

profkelly wrote:

Thank you very much, Professor! :D

Author:  Obeisance [ Sat Mar 05, 2016 3:26 pm ]
Post subject:  Re: Accessing part of a filled register

In my attempt at disassembly, I find that some of the user defined vectors are referenced to interrupts for processor specific functions. For instance, when a function is setting up interrupts for serial communication it references the 64th vector, the first user defined vector, and the address that that vector points to contains actions for what to do with serial data.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/