开发者

what are the differences between these nasm stack pushes?

开发者 https://www.devze.com 2023-03-19 08:21 出处:网络
this is in 16 bit, real mode, NASM. ; ---- variables ------ cursorRow db 1 . . . ; what are the differences between these two pushes?

this is in 16 bit, real mode, NASM.

 ; ---- variables ------
    cursorRow db 1
 .
 .
 .

 ; what are the differences between these two pushes?
 push cursorRow ; is this th开发者_运维技巧e address of?

 push [cursorRow] ; is this the value of?

I'm having trouble altering this variable in function where cursorRow is a parameter. A question I posted that is relevant: Updating variable that lives in the data segment from the stack and its segment


cursorRow is the value and [cursorRow] is the value at location cursorRow. If you need to put the address of cursorRow on the stack then you need to push bp+1 or whatever the actual address of the variable is


If cursorRow (not [cursorRow] ) is initiated in the data section, it is like a C pointer. Using [cursorRow] would dereference it and return the value stored there and you'll have to prefix [cursorRow] with the size of value like mov al, byte [cursorRow].

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号