2 years ago
#8162
Tyson
Calculating size in paragraphs from an address, as a NASM constant expression
I am converting an assembly language program from A86 assembler to the NASM assembler.
I have most of the program converted except this line
mov bx, (stack_end / 10h) + 1
The bss section is defined as follows
section .bss
stack_start resb 07feh ; create stack almost 2k in size
stack_end equ $ - 1
The error nasm is throwing when I build is
division operator may only be applied to scaler values
I have debugged the application and seen what value it is actually calculating and could just plug that number in but would rather keep the existing logic if possible. Plus it would be a good learning experience.
This is part of a DOS 16-bit COM executable. I know what you're asking, why am I converting it, well the open source project owner has requested that all assembly language programs be converted to NASM since it is more widely supported.
EDIT:
I am compiling with nasm -fbin.
The code can be seen here, minus the conversion to nasm syntax.
https://gitlab.com/FreeDOS/util/switchar/-/blob/master/SOURCE/SWITCHAR/SWITCHAR.S
I used jesters comment ((stack_end - stack_start / 10h) + 1 and the error went away but like stated it would be 80h, the original value is 103h
assembly
nasm
dos
x86-16
memory-segmentation
0 Answers
Your Answer