Reusing a declared byte in Assembly - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Reusing a declared byte in Assembly

Hi everyone,

I am using NASM on a Linux computer with the Intel x86 syntax.

The problem I am having is that I cannot use a string I declare as an initialized constant more than once.

For example,

section .data

notDone: db 'Loop not finished.', 0Ah
nDLength: equ$-notDone

section .text

;loop for checking to see if a number is equal to 0
;if not, print the "notDone" string using the standard

As one can see, I am looping until a number is 0, and while the number is not zero, I am printing the "notDone" string.

Whenever I do this, however, I get a segmentation fault. If I declare the same string with different identifiers, then the code works fine, but I need ten times more code (variables, functions, etc.)

Any help is greatly appreciated.


Sign In or Register to comment.