Vista previa del material en texto
Pasaje de Parámetros por pila ORG 1000H ; Memoria de datos NUM1 DW 5H NUM2 DW 3H RES DW ? ORG 2000H ; Prog principal MOV AX, NUM1 PUSH AX MOV AX, NUM2 PUSH AX MOV AX, OFFSET RES PUSH AX CALL MUL POP AX POP AX POP AX HLT END 7FF0h 7FF1h 7FF2h 7FF3h 7FF4h 7FF5h 7FF6h 7FF7h DirL POPAX 7FF8h DirH opAXH 7FF9h 04 7FFAh 10 7FFBh 03 7FFCh 00 7FFDh 05 7FFEh 00 8000h AX 1004 BX CX DX NUM1 1000h 05 1001h 00 NUM2 1002h 03 1003h 00 RES 1004h 0F 00 Pasaje de Parámetros por pila ORG 3000H MUL: PUSH BX ; preservar registros PUSH CX PUSH AX PUSH DX MOV BX, SP ADD BX, 12 MOV CX, [BX] ; cx = num2 ADD BX, 2 ; bx apunta a num1 MOV AX, [BX] ; ax = num1 SUB BX, 4 ; bx apunta a la dir de result MOV BX, [BX] ; guardo MOV DX, 0 SUMA: ADD DX, AX DEC CX JNZ SUMA MOV [BX], DX ; guardar resultado POP DX ;restaurar registros POP AX POP CX POP BX RET SP 7FEFh 7FF0h DH 7FF1h AL 7FF2h AH 7FF3h CL 7FF4h CH 7FF5h BL 7FF6h BH 7FF7h Dir L 7FF8h Dir H 7FF9h 04 7FFAh 10 7FFBh 03 7FFCh 00 7FFDh 05 7FFEh 00 8000h AX orig BX orig CX orig DX Orig Pasaje de Parámetros por pila Pasaje de Parámetros por pila