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!


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.