简体   繁体   中英

The usage of push in 16bit - tasm

.data    
    SUM DW 250h
.text
     push SUM
     call func
     ....
 func:
      mov bp, sp
      mov ax, [bp + 2]
      inc ax
      mov [bp + 2], ax
      .....

When I use the push instruction do I push the reference of SUM, or the value? And does SUM changes after I call func?

You probably want to dereference the address you pass to the function

.data    
    SUM DW 250h
.text
     push [SUM]
     call func
     ....
 func:
     mov bp, sp
     mov bx, [bp + 2]
     mov ax,[bx]
     inc ax
     mov [bx],ax
     mov [bp + 2], ax
     .....

That seems really roundabout, and I'm sure there's an easier way but I don't have a machine with tasm handy. Extra roundabout since you can't use [ax] :(

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM