View Single Post
  #1   (View Single Post)  
Old 3rd October 2019
billy_bazooka billy_bazooka is offline
Port Guard
Join Date: Sep 2016
Posts: 25
Default [solved] at&t assembly question

writing a game in assembly on netbsd.. i'm used to flat assembler, but i'm trying out gas syntax a little bit. its actually not that bad.

my question is this:

in flat assembler i have:
  MY_OFFSET = $29
    rb $ff     ; reserve $ff bytes in .bss
  mov byte [input + MY_OFFSET], $01
and it works, of course, nothing special there.

BUT in gas i have something like this:
  .global MY_OFFSET
  .equ MY_OFFSET, 0x29
  .lcomm input, 0xff
  movb $0x01, input + MY_OFFSET (%rip)
and gas says:
error: invalid operands (*und* and *und* sections) for '+'

if i put the value instead of MY_OFFSET it works
  movb $0x01, input + 0x29 (%rip)
this works.

whats the proper way to do what i want in gas?

Last edited by billy_bazooka; 3rd October 2019 at 10:28 PM. Reason: solved this thing
Reply With Quote