flat assembler
Message board for the users of flat assembler.
Index
> Windows > Hello world.exe compile error |
Author |
|
baldr 14 Nov 2010, 09:35
stack,
Why do you need PE with 16-bit code which won't work (under regular Windows)? In protected mode you don't have much choice in user-mode: there are APIs you can use, there are (barely documented) OS services. None of them resemble DOS int 21h or BIOS int 16h (indeed you'll have access violation trying to use those instructions). You don't want to use WriteConsole()? Use WriteFile() then. |
|||
14 Nov 2010, 09:35 |
|
stack 14 Nov 2010, 09:47
baldr, thanks for reply. I thought that the problem in the syntax only or maybe something with ds register value
|
|||
14 Nov 2010, 09:47 |
|
stack 14 Nov 2010, 12:24
Hmm, "format mz" works. At least there is no any compilation error, but the output is: "()&^#(&^@#... Hello World!". How should I modify the source code to set proper output address for 21h interrupt? And I get a NTVDM.exe unstable crash...
|
|||
14 Nov 2010, 12:24 |
|
drobole 14 Nov 2010, 14:13
I think it complains because dx is too small to hold a 32 bit address. If you use edx instead, the error goes away.
Still, as baldr said, there is other issues. Basically you are using old DOS interrupts that does not work in protected mode. Are you on Windows, Linux or other system? |
|||
14 Nov 2010, 14:13 |
|
stack 14 Nov 2010, 15:25
I'm on Win7. The following code is work ok except unstable crash of NTVDM.exe on exit.
Code: format mz org 100h mov edx,msg mov ah,9h int 21h mov ah,10h int 16h int 21h msg db "Hello World!$" I just wanted to start with basic DOS programs for studying, because there are a lot of tutorials of them.[/code] |
|||
14 Nov 2010, 15:25 |
|
drobole 14 Nov 2010, 16:50
The interrupt to exit a com program is 20h I think, not 21h
|
|||
14 Nov 2010, 16:50 |
|
stack 14 Nov 2010, 17:16
Oh, yes. I changed interrupt to exit, but the crash of NTVDM.exe still here:
Problem Event Name: APPCRASH Application Name: ntvdm.exe Application Version: 6.1.7600.16385 Application Timestamp: 4a5bc158 Fault Module Name: StackHash_2264 |
|||
14 Nov 2010, 17:16 |
|
Alphonso 15 Nov 2010, 09:47
Code: format mz ;org 100h push cs pop ds mov dx,msg mov ah,9h int 21h mov ah,0h int 16h mov ax,4c00h ;Use AL for error/return code int 21h msg db "Hello World!$" |
|||
15 Nov 2010, 09:47 |
|
stack 16 Nov 2010, 18:40
Thanks, Alphonso!
|
|||
16 Nov 2010, 18:40 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.