What makes MOVEQ quicker than a normal MOVE in 68000 assembly?Meaning of $ and $$ in Modcomp assembly languageMSX Assembly/Basic programming documentation68000 and memory access speedWhat is the origin of different styles of assembly language mnemonics?Replacing 80286 with 68000Resource for 6502 assembly directives?What does “jmp *” mean in 6502 assembly?What limited the use of the Z8000 (vs. 68K and 8086) CPU for 16-bit computers?What was the first publication documenting AT&T syntax assembly language?Can Access Fault Exceptions of the MC68040 caused by internal access faults occur in normal situations?
When can a polynomial be written as a polynomial function of another polynomial?
How to draw a winding on a toroid of a circular cross section?
Term “console” in game consoles
Is there a difference between PIO and GPIO pins?
Which GPUs to get for Mathematical Optimization (if any)?
Strategy to pay off revolving debt while building reserve savings fund?
How to find location on Cambridge-Mildenhall railway that still has tracks/rails?
How can electric field be defined as force per charge, if the charge makes its own, singular electric field?
Locked-up DOS computer beeped on keypress. What mechanism caused that?
The most secure way to handle someone forgetting to verify their account?
Why can't I hear fret buzz through the amp?
What would be the safest way to drop thousands of small, hard objects from a typical, high wing, GA airplane?
Change Opacity of Style
Pauli exclusion principle - black holes
How to interpret a promising preprint that was never published?
Should I use a resistor between the gate driver and MOSFET (gate pin)?
Software need db owner permission to master database (sql2016)
"Je suis petite, moi?", purpose of the "moi"?
Is it possible to have two words with the same particle in a sentence?
I have found a mistake on someone's code published online: what is the protocol?
What did Jeremy Hunt mean by "slipped" to miss a vote?
What were the problems on the Apollo 11 lunar module?
"This used to be my phone number"
Why is Google approaching my VPS machine?
What makes MOVEQ quicker than a normal MOVE in 68000 assembly?
Meaning of $ and $$ in Modcomp assembly languageMSX Assembly/Basic programming documentation68000 and memory access speedWhat is the origin of different styles of assembly language mnemonics?Replacing 80286 with 68000Resource for 6502 assembly directives?What does “jmp *” mean in 6502 assembly?What limited the use of the Z8000 (vs. 68K and 8086) CPU for 16-bit computers?What was the first publication documenting AT&T syntax assembly language?Can Access Fault Exceptions of the MC68040 caused by internal access faults occur in normal situations?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm "re-learning" 68000 assembly language and came across the "MOVEQ" command that is labeled "MOVE QUICK".
According to the NXP Programmers Reference Manual (reference below), the command MOVEQ (MOVE QUICK) is described as:
Moves a byte of immediate data to a 32-bit data register. The data in an 8-bit
field within the operation word is sign- extended to a long operand in the data
register as it is transferred.
I've searched the manual and cannot find why it's "quick".
Meaning, what's the difference (in performance) in the following instructions?
MOVEQ #100, D0
MOVE #100, D0
I gather the MOVEQ is a better fit for moving 8-bit data. Or, is it ONLY 8-bits of data as I cannot seem to confirm.
Any information on this would be appreciated.
Thanks.
REF:
https://www.nxp.com/files-static/archives/doc/ref_manual/M68000PRM.pdf
assembly motorola-68000
add a comment |
I'm "re-learning" 68000 assembly language and came across the "MOVEQ" command that is labeled "MOVE QUICK".
According to the NXP Programmers Reference Manual (reference below), the command MOVEQ (MOVE QUICK) is described as:
Moves a byte of immediate data to a 32-bit data register. The data in an 8-bit
field within the operation word is sign- extended to a long operand in the data
register as it is transferred.
I've searched the manual and cannot find why it's "quick".
Meaning, what's the difference (in performance) in the following instructions?
MOVEQ #100, D0
MOVE #100, D0
I gather the MOVEQ is a better fit for moving 8-bit data. Or, is it ONLY 8-bits of data as I cannot seem to confirm.
Any information on this would be appreciated.
Thanks.
REF:
https://www.nxp.com/files-static/archives/doc/ref_manual/M68000PRM.pdf
assembly motorola-68000
add a comment |
I'm "re-learning" 68000 assembly language and came across the "MOVEQ" command that is labeled "MOVE QUICK".
According to the NXP Programmers Reference Manual (reference below), the command MOVEQ (MOVE QUICK) is described as:
Moves a byte of immediate data to a 32-bit data register. The data in an 8-bit
field within the operation word is sign- extended to a long operand in the data
register as it is transferred.
I've searched the manual and cannot find why it's "quick".
Meaning, what's the difference (in performance) in the following instructions?
MOVEQ #100, D0
MOVE #100, D0
I gather the MOVEQ is a better fit for moving 8-bit data. Or, is it ONLY 8-bits of data as I cannot seem to confirm.
Any information on this would be appreciated.
Thanks.
REF:
https://www.nxp.com/files-static/archives/doc/ref_manual/M68000PRM.pdf
assembly motorola-68000
I'm "re-learning" 68000 assembly language and came across the "MOVEQ" command that is labeled "MOVE QUICK".
According to the NXP Programmers Reference Manual (reference below), the command MOVEQ (MOVE QUICK) is described as:
Moves a byte of immediate data to a 32-bit data register. The data in an 8-bit
field within the operation word is sign- extended to a long operand in the data
register as it is transferred.
I've searched the manual and cannot find why it's "quick".
Meaning, what's the difference (in performance) in the following instructions?
MOVEQ #100, D0
MOVE #100, D0
I gather the MOVEQ is a better fit for moving 8-bit data. Or, is it ONLY 8-bits of data as I cannot seem to confirm.
Any information on this would be appreciated.
Thanks.
REF:
https://www.nxp.com/files-static/archives/doc/ref_manual/M68000PRM.pdf
assembly motorola-68000
assembly motorola-68000
asked 8 hours ago
cbmeekscbmeeks
3,94912 silver badges59 bronze badges
3,94912 silver badges59 bronze badges
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
The MOVE immediate instruction takes 8 cycles in byte and word modes. There are two memory reads, one for the instruction and one for the immediate value.
The MOVEQ instruction encodes the immediate value into the instruction op-code itself, so only takes 4 cycles and 1 memory read. It can only take a byte immediate value.
MOVEQ #1, D0 (4 clocks, 1 memory read)MOVE.b #1, D0 (8 clocks, 2 memory reads)MOVE.w #1000, D0 (8 clocks, 2 memory reads)
As such, for loading values 0-255, it is twice as fast in instruction cycles and uses half as much memory bandwidth (important on systems where it is shared with DMA).
Low level fast access to the zero page predates the 68000. In the old days it was sort of thought of like we think of cache today - not much of it, but it's significantly faster. Use wisely.
– J...
4 mins ago
add a comment |
To give the exact cycle-by-cycle breakdown:
MOVEQ is a one word instruction so will nominally perform in four cycles; in practice it can occur immediately following operation decoding because all necessary information is within the instruction word. Four cycles are then expended fetching the next value to feed into the instruction prefetch queue.
Both MOVE.b MOVE.w are two-word instructions. The 68000 actually knows both words before either instruction begins, so both can occur pretty much immediately but both then require that a further two words be fetched to repopulate the instruction prefetch queue, which occupies eight cycles before the next instruction can begin.
MOVE.l is a three-word instruction. The 68000's prefetch queue is only two words long. So after decoding it can't actually be completed until a further word has been fetched, and after that fetch a further two will be needed to repopulate the queue. So twelve cycles total.
MOVEs are the most primitive operation available; the general rule is that the number of words needed to complete an operation plus the number needed then to [re]populate the prefetch queue is only a floor for cycle counting. See Yacht.txt for a more detailed summary of the work each instruction does; bear in mind that anything that things like RTS are only one word long but implies two further prefetches since the whole queue needs to be replenished, and anything that might change the supervisor flag will often result in a refetch of data that's ostensibly already in the queue, in case the memory subsystem is designed to serve conditional results.
add a comment |
I've searched the manual and cannot find why it's "quick".
Simply because MOVEQ is a single word (two byte) instruction, which can be fetched in a single memory cycle, while an equal constant move will be 2 (MOVE.W) or 3 words (MOVE.L) and need one/two additional memory cycles - each four clocks.
So effectively you'll get the following execution timing:
MOVEQ #5,D0- 4 Clocks,MOVE.B #5,D0- 8 Clocks,MOVE.W #5,D0- 8 Clocks,MOVE.L #5,D0- 12 Clocks,
making MOVEQ about 50/66% faster.
MOVEQ even got it's own opcode (7) to squeeze all into a single word.
ADDQ and SUBQ works similar (*1) - except mixed into the Scc/DBcc/TRAPcc group (5).
I gather the MOVEQ is a better fit for moving 8-bit data. Or, is it ONLY 8-bits of data as I cannot seem to confirm.
Only. There is no room for more within the 16 bit instruction word (*2), as the encoding is
|OPCODE|Dest.| Res || Data |
|Group |Reg. | || |
| 0111 | xxx | 0 || yyyy yyyy |
*1 - Not exactly like it as they may have additional parameters.
*2 - Well, in the original 68000 encoding there was one unused bit, but won't get far.
Don't forget the move.b instruction...
– UncleBod
8 hours ago
Timings are wrong.
– user
8 hours ago
move.w and move.l are wrong according to my manual, and online sources I checked.
– user
8 hours ago
@UncleBodMOVE.Bis exactly like MOVE.W
– Raffzahn
7 hours ago
1
@user ahh, followed the wrong line. Still, just shouting 'wrong' isn't as helpful as pointing out what exactly is wrong and where to check, isn't it?
– Raffzahn
7 hours ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "648"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f11720%2fwhat-makes-moveq-quicker-than-a-normal-move-in-68000-assembly%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
The MOVE immediate instruction takes 8 cycles in byte and word modes. There are two memory reads, one for the instruction and one for the immediate value.
The MOVEQ instruction encodes the immediate value into the instruction op-code itself, so only takes 4 cycles and 1 memory read. It can only take a byte immediate value.
MOVEQ #1, D0 (4 clocks, 1 memory read)MOVE.b #1, D0 (8 clocks, 2 memory reads)MOVE.w #1000, D0 (8 clocks, 2 memory reads)
As such, for loading values 0-255, it is twice as fast in instruction cycles and uses half as much memory bandwidth (important on systems where it is shared with DMA).
Low level fast access to the zero page predates the 68000. In the old days it was sort of thought of like we think of cache today - not much of it, but it's significantly faster. Use wisely.
– J...
4 mins ago
add a comment |
The MOVE immediate instruction takes 8 cycles in byte and word modes. There are two memory reads, one for the instruction and one for the immediate value.
The MOVEQ instruction encodes the immediate value into the instruction op-code itself, so only takes 4 cycles and 1 memory read. It can only take a byte immediate value.
MOVEQ #1, D0 (4 clocks, 1 memory read)MOVE.b #1, D0 (8 clocks, 2 memory reads)MOVE.w #1000, D0 (8 clocks, 2 memory reads)
As such, for loading values 0-255, it is twice as fast in instruction cycles and uses half as much memory bandwidth (important on systems where it is shared with DMA).
Low level fast access to the zero page predates the 68000. In the old days it was sort of thought of like we think of cache today - not much of it, but it's significantly faster. Use wisely.
– J...
4 mins ago
add a comment |
The MOVE immediate instruction takes 8 cycles in byte and word modes. There are two memory reads, one for the instruction and one for the immediate value.
The MOVEQ instruction encodes the immediate value into the instruction op-code itself, so only takes 4 cycles and 1 memory read. It can only take a byte immediate value.
MOVEQ #1, D0 (4 clocks, 1 memory read)MOVE.b #1, D0 (8 clocks, 2 memory reads)MOVE.w #1000, D0 (8 clocks, 2 memory reads)
As such, for loading values 0-255, it is twice as fast in instruction cycles and uses half as much memory bandwidth (important on systems where it is shared with DMA).
The MOVE immediate instruction takes 8 cycles in byte and word modes. There are two memory reads, one for the instruction and one for the immediate value.
The MOVEQ instruction encodes the immediate value into the instruction op-code itself, so only takes 4 cycles and 1 memory read. It can only take a byte immediate value.
MOVEQ #1, D0 (4 clocks, 1 memory read)MOVE.b #1, D0 (8 clocks, 2 memory reads)MOVE.w #1000, D0 (8 clocks, 2 memory reads)
As such, for loading values 0-255, it is twice as fast in instruction cycles and uses half as much memory bandwidth (important on systems where it is shared with DMA).
edited 8 hours ago
answered 8 hours ago
useruser
8,1722 gold badges14 silver badges33 bronze badges
8,1722 gold badges14 silver badges33 bronze badges
Low level fast access to the zero page predates the 68000. In the old days it was sort of thought of like we think of cache today - not much of it, but it's significantly faster. Use wisely.
– J...
4 mins ago
add a comment |
Low level fast access to the zero page predates the 68000. In the old days it was sort of thought of like we think of cache today - not much of it, but it's significantly faster. Use wisely.
– J...
4 mins ago
Low level fast access to the zero page predates the 68000. In the old days it was sort of thought of like we think of cache today - not much of it, but it's significantly faster. Use wisely.
– J...
4 mins ago
Low level fast access to the zero page predates the 68000. In the old days it was sort of thought of like we think of cache today - not much of it, but it's significantly faster. Use wisely.
– J...
4 mins ago
add a comment |
To give the exact cycle-by-cycle breakdown:
MOVEQ is a one word instruction so will nominally perform in four cycles; in practice it can occur immediately following operation decoding because all necessary information is within the instruction word. Four cycles are then expended fetching the next value to feed into the instruction prefetch queue.
Both MOVE.b MOVE.w are two-word instructions. The 68000 actually knows both words before either instruction begins, so both can occur pretty much immediately but both then require that a further two words be fetched to repopulate the instruction prefetch queue, which occupies eight cycles before the next instruction can begin.
MOVE.l is a three-word instruction. The 68000's prefetch queue is only two words long. So after decoding it can't actually be completed until a further word has been fetched, and after that fetch a further two will be needed to repopulate the queue. So twelve cycles total.
MOVEs are the most primitive operation available; the general rule is that the number of words needed to complete an operation plus the number needed then to [re]populate the prefetch queue is only a floor for cycle counting. See Yacht.txt for a more detailed summary of the work each instruction does; bear in mind that anything that things like RTS are only one word long but implies two further prefetches since the whole queue needs to be replenished, and anything that might change the supervisor flag will often result in a refetch of data that's ostensibly already in the queue, in case the memory subsystem is designed to serve conditional results.
add a comment |
To give the exact cycle-by-cycle breakdown:
MOVEQ is a one word instruction so will nominally perform in four cycles; in practice it can occur immediately following operation decoding because all necessary information is within the instruction word. Four cycles are then expended fetching the next value to feed into the instruction prefetch queue.
Both MOVE.b MOVE.w are two-word instructions. The 68000 actually knows both words before either instruction begins, so both can occur pretty much immediately but both then require that a further two words be fetched to repopulate the instruction prefetch queue, which occupies eight cycles before the next instruction can begin.
MOVE.l is a three-word instruction. The 68000's prefetch queue is only two words long. So after decoding it can't actually be completed until a further word has been fetched, and after that fetch a further two will be needed to repopulate the queue. So twelve cycles total.
MOVEs are the most primitive operation available; the general rule is that the number of words needed to complete an operation plus the number needed then to [re]populate the prefetch queue is only a floor for cycle counting. See Yacht.txt for a more detailed summary of the work each instruction does; bear in mind that anything that things like RTS are only one word long but implies two further prefetches since the whole queue needs to be replenished, and anything that might change the supervisor flag will often result in a refetch of data that's ostensibly already in the queue, in case the memory subsystem is designed to serve conditional results.
add a comment |
To give the exact cycle-by-cycle breakdown:
MOVEQ is a one word instruction so will nominally perform in four cycles; in practice it can occur immediately following operation decoding because all necessary information is within the instruction word. Four cycles are then expended fetching the next value to feed into the instruction prefetch queue.
Both MOVE.b MOVE.w are two-word instructions. The 68000 actually knows both words before either instruction begins, so both can occur pretty much immediately but both then require that a further two words be fetched to repopulate the instruction prefetch queue, which occupies eight cycles before the next instruction can begin.
MOVE.l is a three-word instruction. The 68000's prefetch queue is only two words long. So after decoding it can't actually be completed until a further word has been fetched, and after that fetch a further two will be needed to repopulate the queue. So twelve cycles total.
MOVEs are the most primitive operation available; the general rule is that the number of words needed to complete an operation plus the number needed then to [re]populate the prefetch queue is only a floor for cycle counting. See Yacht.txt for a more detailed summary of the work each instruction does; bear in mind that anything that things like RTS are only one word long but implies two further prefetches since the whole queue needs to be replenished, and anything that might change the supervisor flag will often result in a refetch of data that's ostensibly already in the queue, in case the memory subsystem is designed to serve conditional results.
To give the exact cycle-by-cycle breakdown:
MOVEQ is a one word instruction so will nominally perform in four cycles; in practice it can occur immediately following operation decoding because all necessary information is within the instruction word. Four cycles are then expended fetching the next value to feed into the instruction prefetch queue.
Both MOVE.b MOVE.w are two-word instructions. The 68000 actually knows both words before either instruction begins, so both can occur pretty much immediately but both then require that a further two words be fetched to repopulate the instruction prefetch queue, which occupies eight cycles before the next instruction can begin.
MOVE.l is a three-word instruction. The 68000's prefetch queue is only two words long. So after decoding it can't actually be completed until a further word has been fetched, and after that fetch a further two will be needed to repopulate the queue. So twelve cycles total.
MOVEs are the most primitive operation available; the general rule is that the number of words needed to complete an operation plus the number needed then to [re]populate the prefetch queue is only a floor for cycle counting. See Yacht.txt for a more detailed summary of the work each instruction does; bear in mind that anything that things like RTS are only one word long but implies two further prefetches since the whole queue needs to be replenished, and anything that might change the supervisor flag will often result in a refetch of data that's ostensibly already in the queue, in case the memory subsystem is designed to serve conditional results.
answered 6 hours ago
TommyTommy
18.1k1 gold badge51 silver badges90 bronze badges
18.1k1 gold badge51 silver badges90 bronze badges
add a comment |
add a comment |
I've searched the manual and cannot find why it's "quick".
Simply because MOVEQ is a single word (two byte) instruction, which can be fetched in a single memory cycle, while an equal constant move will be 2 (MOVE.W) or 3 words (MOVE.L) and need one/two additional memory cycles - each four clocks.
So effectively you'll get the following execution timing:
MOVEQ #5,D0- 4 Clocks,MOVE.B #5,D0- 8 Clocks,MOVE.W #5,D0- 8 Clocks,MOVE.L #5,D0- 12 Clocks,
making MOVEQ about 50/66% faster.
MOVEQ even got it's own opcode (7) to squeeze all into a single word.
ADDQ and SUBQ works similar (*1) - except mixed into the Scc/DBcc/TRAPcc group (5).
I gather the MOVEQ is a better fit for moving 8-bit data. Or, is it ONLY 8-bits of data as I cannot seem to confirm.
Only. There is no room for more within the 16 bit instruction word (*2), as the encoding is
|OPCODE|Dest.| Res || Data |
|Group |Reg. | || |
| 0111 | xxx | 0 || yyyy yyyy |
*1 - Not exactly like it as they may have additional parameters.
*2 - Well, in the original 68000 encoding there was one unused bit, but won't get far.
Don't forget the move.b instruction...
– UncleBod
8 hours ago
Timings are wrong.
– user
8 hours ago
move.w and move.l are wrong according to my manual, and online sources I checked.
– user
8 hours ago
@UncleBodMOVE.Bis exactly like MOVE.W
– Raffzahn
7 hours ago
1
@user ahh, followed the wrong line. Still, just shouting 'wrong' isn't as helpful as pointing out what exactly is wrong and where to check, isn't it?
– Raffzahn
7 hours ago
add a comment |
I've searched the manual and cannot find why it's "quick".
Simply because MOVEQ is a single word (two byte) instruction, which can be fetched in a single memory cycle, while an equal constant move will be 2 (MOVE.W) or 3 words (MOVE.L) and need one/two additional memory cycles - each four clocks.
So effectively you'll get the following execution timing:
MOVEQ #5,D0- 4 Clocks,MOVE.B #5,D0- 8 Clocks,MOVE.W #5,D0- 8 Clocks,MOVE.L #5,D0- 12 Clocks,
making MOVEQ about 50/66% faster.
MOVEQ even got it's own opcode (7) to squeeze all into a single word.
ADDQ and SUBQ works similar (*1) - except mixed into the Scc/DBcc/TRAPcc group (5).
I gather the MOVEQ is a better fit for moving 8-bit data. Or, is it ONLY 8-bits of data as I cannot seem to confirm.
Only. There is no room for more within the 16 bit instruction word (*2), as the encoding is
|OPCODE|Dest.| Res || Data |
|Group |Reg. | || |
| 0111 | xxx | 0 || yyyy yyyy |
*1 - Not exactly like it as they may have additional parameters.
*2 - Well, in the original 68000 encoding there was one unused bit, but won't get far.
Don't forget the move.b instruction...
– UncleBod
8 hours ago
Timings are wrong.
– user
8 hours ago
move.w and move.l are wrong according to my manual, and online sources I checked.
– user
8 hours ago
@UncleBodMOVE.Bis exactly like MOVE.W
– Raffzahn
7 hours ago
1
@user ahh, followed the wrong line. Still, just shouting 'wrong' isn't as helpful as pointing out what exactly is wrong and where to check, isn't it?
– Raffzahn
7 hours ago
add a comment |
I've searched the manual and cannot find why it's "quick".
Simply because MOVEQ is a single word (two byte) instruction, which can be fetched in a single memory cycle, while an equal constant move will be 2 (MOVE.W) or 3 words (MOVE.L) and need one/two additional memory cycles - each four clocks.
So effectively you'll get the following execution timing:
MOVEQ #5,D0- 4 Clocks,MOVE.B #5,D0- 8 Clocks,MOVE.W #5,D0- 8 Clocks,MOVE.L #5,D0- 12 Clocks,
making MOVEQ about 50/66% faster.
MOVEQ even got it's own opcode (7) to squeeze all into a single word.
ADDQ and SUBQ works similar (*1) - except mixed into the Scc/DBcc/TRAPcc group (5).
I gather the MOVEQ is a better fit for moving 8-bit data. Or, is it ONLY 8-bits of data as I cannot seem to confirm.
Only. There is no room for more within the 16 bit instruction word (*2), as the encoding is
|OPCODE|Dest.| Res || Data |
|Group |Reg. | || |
| 0111 | xxx | 0 || yyyy yyyy |
*1 - Not exactly like it as they may have additional parameters.
*2 - Well, in the original 68000 encoding there was one unused bit, but won't get far.
I've searched the manual and cannot find why it's "quick".
Simply because MOVEQ is a single word (two byte) instruction, which can be fetched in a single memory cycle, while an equal constant move will be 2 (MOVE.W) or 3 words (MOVE.L) and need one/two additional memory cycles - each four clocks.
So effectively you'll get the following execution timing:
MOVEQ #5,D0- 4 Clocks,MOVE.B #5,D0- 8 Clocks,MOVE.W #5,D0- 8 Clocks,MOVE.L #5,D0- 12 Clocks,
making MOVEQ about 50/66% faster.
MOVEQ even got it's own opcode (7) to squeeze all into a single word.
ADDQ and SUBQ works similar (*1) - except mixed into the Scc/DBcc/TRAPcc group (5).
I gather the MOVEQ is a better fit for moving 8-bit data. Or, is it ONLY 8-bits of data as I cannot seem to confirm.
Only. There is no room for more within the 16 bit instruction word (*2), as the encoding is
|OPCODE|Dest.| Res || Data |
|Group |Reg. | || |
| 0111 | xxx | 0 || yyyy yyyy |
*1 - Not exactly like it as they may have additional parameters.
*2 - Well, in the original 68000 encoding there was one unused bit, but won't get far.
edited 7 hours ago
answered 8 hours ago
RaffzahnRaffzahn
63.9k6 gold badges157 silver badges264 bronze badges
63.9k6 gold badges157 silver badges264 bronze badges
Don't forget the move.b instruction...
– UncleBod
8 hours ago
Timings are wrong.
– user
8 hours ago
move.w and move.l are wrong according to my manual, and online sources I checked.
– user
8 hours ago
@UncleBodMOVE.Bis exactly like MOVE.W
– Raffzahn
7 hours ago
1
@user ahh, followed the wrong line. Still, just shouting 'wrong' isn't as helpful as pointing out what exactly is wrong and where to check, isn't it?
– Raffzahn
7 hours ago
add a comment |
Don't forget the move.b instruction...
– UncleBod
8 hours ago
Timings are wrong.
– user
8 hours ago
move.w and move.l are wrong according to my manual, and online sources I checked.
– user
8 hours ago
@UncleBodMOVE.Bis exactly like MOVE.W
– Raffzahn
7 hours ago
1
@user ahh, followed the wrong line. Still, just shouting 'wrong' isn't as helpful as pointing out what exactly is wrong and where to check, isn't it?
– Raffzahn
7 hours ago
Don't forget the move.b instruction...
– UncleBod
8 hours ago
Don't forget the move.b instruction...
– UncleBod
8 hours ago
Timings are wrong.
– user
8 hours ago
Timings are wrong.
– user
8 hours ago
move.w and move.l are wrong according to my manual, and online sources I checked.
– user
8 hours ago
move.w and move.l are wrong according to my manual, and online sources I checked.
– user
8 hours ago
@UncleBod
MOVE.B is exactly like MOVE.W– Raffzahn
7 hours ago
@UncleBod
MOVE.B is exactly like MOVE.W– Raffzahn
7 hours ago
1
1
@user ahh, followed the wrong line. Still, just shouting 'wrong' isn't as helpful as pointing out what exactly is wrong and where to check, isn't it?
– Raffzahn
7 hours ago
@user ahh, followed the wrong line. Still, just shouting 'wrong' isn't as helpful as pointing out what exactly is wrong and where to check, isn't it?
– Raffzahn
7 hours ago
add a comment |
Thanks for contributing an answer to Retrocomputing Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f11720%2fwhat-makes-moveq-quicker-than-a-normal-move-in-68000-assembly%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown