| 1 |
\chapter{HD6303 Processor} |
| 2 |
\label{processor:6303} |
| 3 |
\index{Processor!HD6303} |
| 4 |
|
| 5 |
\section{Endianness} |
| 6 |
|
| 7 |
The \mono{HD6303} is a big-endian machine. Byte ordering in words is high, then low. |
| 8 |
|
| 9 |
\section{Broken Opcodes Bug} |
| 10 |
\label{changelog:20200903bug} |
| 11 |
The \mono{AIM}, \mono{OIM}, \mono{EIM}, and \mono{TIM} opcodes are broken. These instructions are \textbf{three} bytes long according to the data sheets, yet in \dasm they are |
| 12 |
treated as \textbf{two} byte instructions. |
| 13 |
|
| 14 |
These instructions are supposed |
| 15 |
to work as follows: |
| 16 |
|
| 17 |
\begin{code} |
| 18 |
tim #$10,$C2 |
| 19 |
tim #$80,$00,x |
| 20 |
\end{code} |
| 21 |
|
| 22 |
So there's an immediate value \textbf{and} a zero-page address |
| 23 |
for these instructions! \dasm, however, only accepts these: |
| 24 |
|
| 25 |
\begin{code} |
| 26 |
tim $10 |
| 27 |
tim $10,x |
| 28 |
\end{code} |
| 29 |
|
| 30 |
These opcodes simply don't fit into the "regular pattern" of 8-bit CPUs |
| 31 |
we deal with in \dasm. Fixing this will require changes to |
| 32 |
\dasm beyond just fixing the instruction table, and the parser code is not even remotely ready for this. |
| 33 |
|
| 34 |
The "workaround" for now is to use macros instead of the |
| 35 |
actual instructions, see \mono{../test/broken6303hack.asm} for macro templates. |
| 36 |
|