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.
This is the x86 equivalent of the 68K assembler example sample.sa, which contains just one simple subroutine: (For the 68K version, click here)
In this x86 version, registers ESI and EDI are used in place of the 68K A0 and A1 registers, and ECX and EAX replace D0 and D1.
sample.sa
.386P
.MODEL FLAT
.CODE
ENDMARK EQU 80000000h
TOKCHAR EQU 0
TOKALT EQU 1
TOKBUF EQU 2
TOKCTR EQU 6
; Routine to move token block to buffer
PUBLIC MOVETOK
MOVETOK:
MOV ECX,[ESI+TOKCTR]
JECXZ DONE
CMP DWORD PTR [ESI+TOKBUF],0
JE DONE
MOV ESI,[ESI+TOKBUF]
RPT: LODSD ; Get token
CMP EAX,ENDMARK ; Hit end marker?
JE DONE
STOSD ; Move into destination
LOOP RPT
DONE: RET