flat assembler
Message board for the users of flat assembler.
Index
> DOS > [trying execute data] can't store a char in db? |
Author |
|
revolution 22 Jan 2015, 12:00
COM files begin execution at the very first byte. For your code above the first instruction to be executed to whatever 0x79 disassembles to.
If you want to display 'y' to the screen then you will need to write code to send the character 'y' to the OS to to get it displayed. You placed this topic in the Windows forum so I don't know how to properly advise because you posted DOS code. If you can confirm whether you want Windows code or DOS code then we can help you better. |
|||
22 Jan 2015, 12:00 |
|
theguy 22 Jan 2015, 12:05
oops sorry about posting in the wrong forum, yea i'm working with a dos console program.
this code works perfectly fine. Code: org 100h Looop: jmp Looop It just loops and doesn't crash but when i add the db 'y' in the code it will crash and i won't be able to print a char to screen if i can't first store it. |
|||
22 Jan 2015, 12:05 |
|
revolution 22 Jan 2015, 12:16
Store the character below the code:
Code: org 100h Looop: jmp Looop db 'y' |
|||
22 Jan 2015, 12:16 |
|
theguy 22 Jan 2015, 12:25
Well that worked! thanks, it's kind of weird because i was following a guy who wrote his code the way i showed you, and it worked for him but maybe it's because he's using linux.
|
|||
22 Jan 2015, 12:25 |
|
revolution 22 Jan 2015, 12:29
Even in DOS you can put your data and strings first if you use an EXE format. You also have to tell the assembler where the first instruction is so that the EXE file can tell the OS how to run the code.
It is the COM format that requires the first instruction to be at the beginning of the file. So for you the first instruction was 'y' (0x79, ...) which is clearly not what you wanted. |
|||
22 Jan 2015, 12:29 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.