ASM calls sub-process, passing Parameters

Source: Internet
Author: User

1. Register transfer value

 1 Page 60 , 132  2   Title stack pass value  3   ;  ------------------------------------  4   . Model small  5 . Stack 64  6   ;  ------------------------------------ 7   . Data  8 BCX DW 65535      ;  Multiplier  9 Muls DW 2          ;  Multiplier  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  21 h  23 Main endp ;  Process ended  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 ;  ProgramEnd  36          

 

2. Stack value.

 1 Page 60 , 132  2   Title stack pass value 3   ;  ------------------------------------  4   . Model small  5 . Stack 64  6   ;  ------------------------------------  7   . Data  8 BCX DW 65535      ; Multiplier  9 Muls DW 2          ;  Multiplier  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  21 h  23 Main endp ;  Process ended  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 ;  Program ended  36          

3. Register transfer reference

 1 Page 60 , 132  2   Title register transfer reference  3   ;  ------------------------------------  4   . Model small  5 . Stack 64  6   ;  ------------------------------------  7   . Data  8 BCX DW 65535      ;  Multiplier  9 Muls DW 2          ;  Multiplier  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  21 h  22 Main endp ;  Process ended  23   24   Mymul proc near 25           MoV  Ax, [BX]  26           Mul  Word PTR [Si]  27           RET  28   Mymul endp  29   30 End main ;  Program ended  31          

4. Stack reference

 1 Page60 , 132  2   Title stack reference  3   ;  ------------------------------------  4   . Model small  5 . Stack 64  6   ;  ------------------------------------  7  . Data  8 BCX DW 65535      ;  Multiplier  9 Muls DW 2          ;  Multiplier  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  21 h  24 Main endp ;  Process ended  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;  Program ended  41          

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.