bespokeasm icon indicating copy to clipboard operation
bespokeasm copied to clipboard

Stack Position Labels

Open michaelkamprath opened this issue 3 years ago • 0 comments

I have no idea how the notation would make sense, and I also never have seen this anywhere. But one thing would be extremely useful:

a label for stack positions (offsets)

    ld a,0x42 ; var_x
    push a
    ld a,0x23 ; var_y
    push a
    
    ld a,[sp+1] ; stackpointer=var_y, stackpointer+1 = var_x
    
    ld a,0xff ; var_z
    push a
    
    ld a,[sp+2] ; stackpointer=var_z, stackpointer+1 = var_y, stackpointer+2 = var_x

sometimes it's hard to keep track of this, and everytime you insert something, you'll have to update all the stackpointer offsets.

to make this work the assembler needs to know which instructions modify the stackpointer and I have no idea how the labels would look like.

Originally posted by @sebseb7 in https://github.com/michaelkamprath/bespokeasm/issues/17#issuecomment-1186608346

michaelkamprath avatar Jul 17 '22 23:07 michaelkamprath