home *** CD-ROM | disk | FTP | other *** search
- ; Listing 2. INPUT.ASM.
- ; The input() method as pure assembly language
-
- push bp ; Create stack frame
- mov bp, sp
- push si ; Must save si register
- mov si, word ptr [bp+4] ; Point to object data with si
- mov ax, word ptr [bp+6] ; Load AX with i
- add word ptr [si],ax ; sum += i
- inc word ptr [si+2] ; n++
- pop si ; Restore si register
- pop bp ; Remove the stack frame
- ret ; Return to caller
-
-