DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 3rd October 2019
billy_bazooka billy_bazooka is offline
Port Guard
 
Join Date: Sep 2016
Posts: 31
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:
Code:
  MY_OFFSET = $29
  ...
  input:
    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:
Code:
  .global MY_OFFSET
  .equ MY_OFFSET, 0x29
  ...
  .bss
  .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
Code:
  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
  #2   (View Single Post)  
Old 3rd October 2019
billy_bazooka billy_bazooka is offline
Port Guard
 
Join Date: Sep 2016
Posts: 31
Default

actually. solved it.
.equ was in the different file/section, i though .global would make it properly accessible to the main program, when i put .equ in the same file as the code, it works.
problem solved.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
why does this simple assembly program abort trap? billy_bazooka Programming 1 26th July 2017 04:45 AM
learn assembly ephemera Book reviews 5 26th December 2012 06:29 PM
Sparc assembly anyone? Randux Programming 4 24th June 2011 07:10 AM
Undertaking computer science degree, which BSD for learning professional assembly? lionsong Programming 15 18th October 2009 11:26 PM
Assembly and kernel programming. bsdnewbie999 Programming 9 17th May 2009 05:52 AM


All times are GMT. The time now is 10:03 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick