17 Jan 2013

FireBee Diary 2: from MC68000 to ColdFire

To get volksForth running on the FireBee, the machine code instructions that are available on the MC68000, but not in the ColdFire CPU need to be replaced with a series of instructions that perform the same action.

I found the "Digger V8" dissassembler on Heenk Robbers webpage along with the AHCC C-Compiler. The Digger is able to disassemble both ColdFire and MC68000, and it can switch between the two CPU types with a simple switch. Finding instructions that cannot be executed on the ColdFire is now only a matter of switching the CPU type and watching the assembler code change.

The Digger package also contains a list of all M68000 assembler instructions, with information on the instructions available on each CPU type (MC68000, MC68020, MC68030, ColdFire …).

04923b6d-7a78-4d0f-b6b2-ff229b8a77da.jpg bc7a1b88-5039-4a04-8c68-9c3ceecada90.jpg

I made the table below as a quick look-up tool to find MC68000 instructions that need replacement on the ColdFire (this table is still work in progress, the column "workaround" will be filled while I work on the ColdFire porting project):

Opcode possible workaround Description
ori -> ccr   OR immediate to CCR
ori -> sr   OR immediate to Status Register
andi -> ccr   AND immediate to CCR
andi -> sr   AND immediate to Status Register
eori -> ccr   EOR immediate to CCR
eori -> sr   EOR immediate to Status Register
movep   Move peripheral data
trapv   Trap on Overflow
rtr   Return and restore condition codes
chk.w   Check register against bounds
dbcc   Test condition, decrement and branch
sbcd Dx,Dy   Subtract decimal with extend
sbcd -(Ax),-(Ay)   Subtract decimal with extend
suba.w   Subtract address
subx -(Ax),-(Ay)   Subtract extended
linea   LINE-A access
abcd Dx,Dy   Add decimal with extend
abcd -(Ax),-(Ay)   Exchange registers
exg Dx,Dy   Exchange registers
exg Ax,Ay   Exchange registers
exg Dx,Ay   Exchange registers
adda.w   Add address
addx -(Ax),-(Ay)   Add extended
roxl   Rotate left with extend
roxr   Rotate right with extend
rol   Rotate left
ror   Rotate right
asl   Arithmetic shift left
asr   Arithmetic shift right
lsl   Logical shift left
lsr   Logical shoft right
Other posts
Creative Commons License by Carsten Strotmann is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License .