To anyone who programs for the Motorola 68000, what is your favorite cross-assembler that works well on a Linux host pc?
To anyone who programs for the Motorola 68000, what is your favorite cross-assembler that works well on a Linux host pc?
I spent the better part of an evening trying to build a toolchain old enough to bootstrap gcc 4.1.2, without success. Good thing TIGCC's binary packages from 2006 (!) still work on a modern x86-64 linux system.
Anyway, here is hello world. It's in C not assembly, but I think that's enough progress for one night.
Hello world in assembly doesn't look much different, but you don't wanna know how many times I crashed my emulator trying (and failing) to shave a few bytes off the example program I found.
Against all judgment and taste, I am using gnu as, which is one of the two assemblers that comes tightly integrated into TIGCC. (The other is A68K, whose syntax is not meaningfully different). This means I'm saddled with AT&T syntax. and boy is that not how my brain works.
Switching back to x86 for a second for familiarity, compare:
GAS syntax
_start:
lea value, %eax # 0x40101c
mov $value, %ebx # 0x40101c
mov value, %ecx # 0x12345678
value:
.long 0x12345678, 0x12345678
NASM syntax
_start:
lea eax, value ; 0x40101c
mov ebx, value ; 0x40101c
mov ecx, [value] ; 0x12345678
value:
dd 0x12345678, 0x12345678
NASM's symmetry between the lea and first mov instruction (which resolve to the same value) makes sense to me. GAS makes no sense to me.
And that isn't even getting into the operands being backwards!
GNU "as" across different CPUs isn't even consistent!
Like on x86 to load literals you use,
mov $1, %eax # imm: 1
But on 68k this is,
move #1, %a1 | imm: 1
Even the comment character changes!
Pretty sure GAS is just a conspiracy to make people want to use C.
.intel_syntax noprefix (and if you use .S files for C comments and cpp macros), it’s okay, at least for i386, sparc, probably MIPS but it’s been too long