It's quite helpful to know C when working in assembler if you are writing assembler that has to interoperate with libraries written in C.. so you know how structures work, how to set up/preserve the stack etc.
Since you obviously already know asm, I guess you knew that already
I find it strange you know asm and yet you are reluctant to use C. Surely you've got enough time to sit through a few C tutorials
C code should be readable even if you haven't used it much (compared to ASM!).
Here's my suggestion: there must be a few Amiga apps out there compiled with GCC, that has the source freely available. Take the C program, compile with debugging symbols, and then decompile it again with verbose output. For example, after compiling an elf file with GCC with my MC68HC12 "beeos" project using:
m68hc12-gcc -m68hc12 -mshort -Wall -Wmissing-prototypes -g -Os -msoft-reg-count=0 -fomit-frame-pointer -ffixed-z -c -o beeos.o beeos.c
I can "decompile" it using:
m68hc12-objdump -xDSstrGg beeos.elf > beeos.dump
So from the following C code excerpt from beeos.c:
void addTask(void (*addr)(void), uchar meta, uint tickinterval) /* 55 bytes */
{ /* addTask(): sbrk's space for a new task */
tasknode_t *pNewTask = (tasknode_t*) bsbrk(sizeof(tasknode_t));
tasknode_t *pTask = pHeadTask; /*holds node of where insert search is at */
pNewTask->next = NULL;
pNewTask->addr = addr;
pNewTask->tickinterval = tickinterval;
pNewTask->lastrun = 0;
pNewTask->meta = meta;
if (pHeadTask == NULL) pHeadTask = pNewTask;
else { /* append task: first tasks have priority over tasks @end of list */
while (pTask->next != NULL) pTask = pTask->next;
pTask->next = pNewTask;
}
return;
}
I get this dissassembly:
00000e20 :
void addTask(void (*addr)(void), uchar meta, uint tickinterval) /* 55 bytes */
{ /* addTask(): sbrk's space for a new task */
e20: 34 pshx
e21: 6c 80 std 0,SP
tasknode_t *pNewTask = (tasknode_t*) bsbrk(sizeof(tasknode_t));
e23: cc 00 0a ldd #a <__data_section_size>
e26: 16 0d 89 jsr d89
e29: b7 45 tfr D,X
tasknode_t *pTask = pHeadTask; /*holds node of where insert search is at */
e2b: fd 08 02 ldy 802
pNewTask->next = NULL;
e2e: 69 01 clr 1,X
e30: 69 00 clr 0,X
pNewTask->addr = addr;
e32: 18 02 80 02 movw 0,SP, 2,X
pNewTask->tickinterval = tickinterval;
e36: 18 02 86 06 movw 6,SP, 6,X
pNewTask->lastrun = 0;
e3a: 69 05 clr 5,X
e3c: 69 04 clr 4,X
pNewTask->meta = meta;
e3e: 18 02 84 08 movw 4,SP, 8,X
if (pHeadTask == NULL) pHeadTask = pNewTask;
e42: 04 66 05 tbne Y,e4a
e45: 7c 08 02 std 802
e48: 20 0c bra e56
else { /* append task: first tasks have priority over tasks @end of list */
while (pTask->next != NULL) pTask = pTask->next;
e4a: ec 40 ldd 0,Y
e4c: 27 06 beq e54
e4e: ed 40 ldy 0,Y
e50: ec 40 ldd 0,Y
e52: 26 fa bne e4e
pTask->next = pNewTask;
e54: 6e 40 stx 0,Y
}
return;
}
e56: 30 pulx
e57: 3d rts
Not as good as proper commented asm, but better than nothing
The m68hc12- prefixed commands "gcc" and "objdump" should be comparable to the gcc chain for other CPUs, such as M68k and x86 but I haven't confirmed that. I was using GCC 3.2.x.
Cheers,
- Paul