1。寄存器传值
1 page 60,132 2 TITLE 堆栈传值 3 ;------------------------------------ 4 .MODEL SMALL 5 .STACK 64 6 ;------------------------------------ 7 .DATA 8 BCX DW 65535 ;被乘数 9 MULS DW 2 ;乘数 10 ;------------------------------------ 11 .CODE 12 MAIN PROC FAR 13 MOV AX,@data 14 MOV DS,AX 15 16 PUSH BCX 17 PUSH MULS 18 19 CALL MYMUL 20 21 MOV AX,4C00H 22 INT 21H 23 MAIN ENDP ;过程结束 24 25 MYMUL PROC NEAR 26 PUSH BP 27 MOV BP,SP 28 MOV AX,SS:[BP+6] 29 MUL WORD PTR SS:[BP+4] 30 31 POP BP 32 RET 4 33 MYMUL ENDP 34 35 END MAIN ;程序结束 36
2。堆栈传值。
1 page 60,132 2 TITLE 堆栈传值 3 ;------------------------------------ 4 .MODEL SMALL 5 .STACK 64 6 ;------------------------------------ 7 .DATA 8 BCX DW 65535 ;被乘数 9 MULS DW 2 ;乘数 10 ;------------------------------------ 11 .CODE 12 MAIN PROC FAR 13 MOV AX,@data 14 MOV DS,AX 15 16 PUSH BCX 17 PUSH MULS 18 19 CALL MYMUL 20 21 MOV AX,4C00H 22 INT 21H 23 MAIN ENDP ;过程结束 24 25 MYMUL PROC NEAR 26 PUSH BP 27 MOV BP,SP 28 MOV AX,SS:[BP+6] 29 MUL WORD PTR SS:[BP+4] 30 31 POP BP 32 RET 4 33 MYMUL ENDP 34 35 END MAIN ;程序结束 36
3。寄存器传引用
1 page 60,132 2 TITLE 寄存器传引用 3 ;------------------------------------ 4 .MODEL SMALL 5 .STACK 64 6 ;------------------------------------ 7 .DATA 8 BCX DW 65535 ;被乘数 9 MULS DW 2 ;乘数 10 ;------------------------------------ 11 .CODE 12 MAIN PROC FAR 13 MOV AX,@data 14 MOV DS,AX 15 LEA BX,BCX 16 LEA SI,MULS 17 18 CALL MYMUL 19 20 MOV AX,4C00H 21 INT 21H 22 MAIN ENDP ;过程结束 23 24 MYMUL PROC NEAR 25 MOV AX,[BX] 26 MUL WORD PTR [SI] 27 RET 28 MYMUL ENDP 29 30 END MAIN ;程序结束 31
4。堆栈传引用
1 page 60,132 2 TITLE 堆栈传引用 3 ;------------------------------------ 4 .MODEL SMALL 5 .STACK 64 6 ;------------------------------------ 7 .DATA 8 BCX DW 65535 ;被乘数 9 MULS DW 2 ;乘数 10 ;------------------------------------ 11 .CODE 12 MAIN PROC FAR 13 MOV AX,@data 14 MOV DS,AX 15 16 LEA AX, OFFSET BCX 17 PUSH AX 18 LEA AX, OFFSET MULS 19 PUSH AX 20 CALL MYMUL 21 22 MOV AX,4C00H 23 INT 21H 24 MAIN ENDP ;过程结束 25 26 MYMUL PROC NEAR 27 28 PUSH BP 29 MOV BP,SP 30 MOV BX,[BP+6] 31 MOV SI,[BP+4] 32 MOV AX,[BX] 33 MUL WORD PTR [SI] 34 35 POP BP 36 RET 4 37 38 MYMUL ENDP 39 40 END MAIN ;程序结束 41