2. A Simple Example


You might like to print out this page, or open it in a new window, so that you can refer to it as you take the tour.

To examine how Relogix translates your source code, we will start by seeing what it would produce if asked to translate a 680x0 source file called sample.sa, which contains just one simple subroutine: (For an x86 equivalent, click here)

sample.sa


         XDEF     MOVETOK
         SECTION  CODE 
 
ENDMARK  EQU      $80000000
TOKCHAR  EQU      0
TOKALT   EQU      1
TOKBUF   EQU      2
TOKCTR   EQU      6
 
; Routine to move token block to buffer
MOVETOK: MOVE.L   TOKCTR(A0),D0
         BEQ.S    DONE
         TST.L    TOKBUF(A0)
         BEQ.S    DONE
         MOVE.L   TOKBUF(A0),A0
LOOP:    MOVE.L   (A0)+,D1           ; Get token
         CMP.L    #ENDMARK,D1        ; Hit end marker?
         BEQ.S    DONE
         MOVE.L   D1,(A1)+           ; Move into destination  
         SUBQ.L   #1,D0
         BNE.S    LOOP
DONE:    RTS