; Name: integeraddition.asm;; Description: This function demonstrates simple addition using; various-sized integers.;; Source: Modern x86 Assembly Language Programming p.46; These are defined in IntegerAddition.cppextern GlChar
extern GlShort
extern GlInt
extern GlLongLong
global IntegerAddition
section .text
; extern "C" void IntegerTypes_(char a, short b, int c, long long d);%define a [ebp+8]%define b [ebp+12]%define c [ebp+16]%define dlow [ebp+20]%define dhigh [ebp+24]IntegerAddition:; Function prologpushebpmovebp,esp; Compute GlChar += amoval,a
add [GlChar],al; Compute GlShort += b, note offset of 'b' on stackmovax,b
add [GlShort],ax; Compute GlInt += c, note offset of 'c' on stackmoveax,c
add [GlInt],eax; Compute GlLongLong += d, note use of dword ptr operator and adcmoveax,dlow
movedx,dhigh
adddword[GlLongLong],eaxadcdword[GlLongLong+4],edx; Function epilogpopebpret