NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: OpAmp on December 29, 2019, 08:34:03 PM
-
https://imgur.com/1YWkAyo
Here's what I'm trying to do:
//Develop a sequence of instructions that converts the unsigned number in AX (values of
//0–65535) into a 5-digit BCD number stored in memory, beginning at the location addressed
//by the BX register in the data segment. Note that the most significant character is stored
//first and no attempt is made to blank leading zeros.
I'm trying to load the contents of AL into the location addressed by the BX register in the data segment, but the debugger doesn't seem to like my code:
MOV [EBX], AL;
Any thoughts?
-
Hi OpAmp,
Welcome to the forum.
I'm afraid I'm confused. Your code looks like 16 bit,but the exception looks like 'doze.
What command line did you give Nasm? How are you trying to run this?
I'm not very familiar with GoDev. Maybe ask at Jeremy's site?
Best,
Frank
-
MOV [EBX], AL;
Any thoughts?
yep...
https://www.tutorialspoint.com/assembly_programming/assembly_registers.htm
also...
https://stackoverflow.com/questions/32836589/nasm-how-do-you-move-an-8-bit-register-into-a-full-32-bit-register
-
Nice links, Structure, but what's your point? What are you saying OpAmp should have done?
Best,
Frank
-
What are you saying OpAmp should have done?
I'm no assembly expert it's just a thought...
Perhaps try: movzx ?
-
What are you saying OpAmp should have done?
I'm no assembly expert it's just a thought...
Perhaps try: movzx ?
No such thing as
movzx mem,reg
but
MOVZX EDX,AL
MOV [EBX],EDX
would do it.
Sadly that doesn't solve the actual problem, it only fixes the posted instruction :)
I'll help more with the homework when OpAmp figures posts an attempt to convert to BCD :)
The docs from nasm 0.98 contain a full description of all instructions, if you need it.
I will look up how I did this, it's been a while :)