The gcc assembler syntax is a bit more complicated than the syntax used by 68kasm. Please refer to the documentation (at end of this lab manual and on ENGN3213 website). We will become familiar with the basics by working with examples and studying the assembly code produced by the gcc C compiler.
Download the file clab70s.s:
/* clab70s.s - m68k-coff-as version of clab52s.s */ .text .even .global main main: /* start of main program */ clr.w sum /* clear variable sum */ move.w count,%d0 /* load count value */ loop: add.w %d0,sum /* add d0 to sum */ sub.w #1,%d0 /* decrement counter */ bne loop /* loop if counter not zero */ move.w sum,%d7 rts /* return to caller */ sum: .space 2 count: .word 25
This is a version of clab52s.s ment for the gcc assembler, m68k-coff-as. Note the following points:
ANU Engineering - ENGN3213