How can i declare a pointer for the first element in a list of a struct like this:
section .bss
struc agenda
name resb 10
number resd 10
type resw 10
endstruc
Simply declaring the structure does not reserve memory for it. You need an instance of it. Either:
section .bss
my_agenda resb agenda_size
; or perhaps...
agenda_array resb agenda_size * MAX_COUNT
; or...
section .data
an_agenda istruc agenda
at name db "fred"
at number db "42"
at type db "regular"
iend
section .text
mov esi, an_agenda
mov al, [esi + name]
Something like that?
Heh! Jester has just posted essentially the same thing. He introduces the '.' notation for local labels. Probably a good idea. Without it, name
is a global identifier and can't be reused. It takes slightly more typing - agenda.name
, agenda.number
, agenda.type
. Probably worth it for increased clarity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With