flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
DOS386 08 Jun 2008, 23:32
> flat assembler > Windows > Simple trouble. (List of formats?)
> I have been using: "format MZ" Wrong forum. ![]() ![]() > Is this related to the format? NO. "push cs pop ds" missing. > it works fine. But isn't. You are trashing your PSP. It's a severe BUG ![]() > What other formats are there? RTFM > In which of them can I get my precious DOS interrupts? All (binary, MZ, COFF, PE (YES !!!), ELF (theoretically only, no usefulness by now) ... as long as you develop for DOS ![]() > Well... actually any format where I have easy console output is okay. Again, it's not the format, it's the target OS ![]() |
|||
![]() |
|
PerryTachett 08 Jun 2008, 23:49
First off, thank you.
I can't believe I missed something so basic. (About push cs pop ds) I am used to A86, with COM files, and not needing stuff like that. Also, about the list of formats, I couldn't find it. I looked in TFM that I Red, but to no avail. Where is such a list located? (Or is that too something obvious that I missed?) |
|||
![]() |
|
DOS386 09 Jun 2008, 00:07
> Where is such a list located?
http://flatassembler.net/docs.php?article=manual#2.4 + my post above ![]() > Or is that too something obvious that I missed NO, it's unique to FASM, not really obvious. > I am used to A86, with COM files, and not needing stuff like that. Right, DOS COM files don't need it (but it won't hurt if inserted nevertheless). You main problem is that A86 is most likely a DOS-only ASM (I don't use it), and DOS COM is a DOS-only executable format ... it won't run natively in Windaube (it might run using (auto-invoked) "NTVDM" hack ... but then don't ask how to access physical disks, how to OGL, how to VESA, how to RDMSR, how to increase priority, and why it doesn't work on 64 bits ![]() http://board.flatassembler.net/topic.php?t=6735 MZ via binary, MZ, PE via binary http://board.flatassembler.net/topic.php?t=8670 DOS PE and DOS LE via binary |
|||
![]() |
|
revolution 09 Jun 2008, 05:41
PerryTachett wrote: I am used to A86, with COM files, and not needing stuff like that. PerryTachett wrote:
|
|||
![]() |
|
DOS386 09 Jun 2008, 09:22
> You can make COM files with fasm.
Code: format binary as "COM" org $0100 jmp @f xx: db 68 @@: mov dl,byte [xx] mov ah,2 int $21 mov ax,$4C00 int $21 But now this should get moved into DOS or Main ![]() |
|||
![]() |
|
revolution 09 Jun 2008, 10:06
From the examples that come with fasm:
Code: ; fasm example of writing 16-bit COM program org 100h ; code starts at offset 100h use16 ; use 16-bit code display_text = 9 mov ah,display_text mov dx,hello int 21h int 20h hello db 'Hello world!',24h |
|||
![]() |
|
PerryTachett 09 Jun 2008, 16:21
Urk... now I'm cornfuzzled:
Code: format MZ push CS pop DS mov AH, 02 mov DL, byte [vara] int 21h mov AH, 4Ch mov AL, 00 int 21h vara db 'B' This works fine. (Outputs a 'B') When I add use32, it stops working. Outputs a 't', and this doesn't change with the value in vara. Does this mean that the 't' is the low order 8 bits of the address vara is at? Or maybe this is a similar issue to the one I had before? Is there some sort of special 32-bit addressing mode where I need to address it differently? Grr... curse these 32-bit directives... |
|||
![]() |
|
revolution 09 Jun 2008, 16:28
MZ format is meant for 16bit code. That means the CPU is in 16bit mode. If you start trying to use 32bit code in 16bit mode then it is not surprising that you get unexpected results. Fortunately the simple remedy is don't put in use32 when you are coding for 16bit modes.
You can still use all the 32bit registers (eax, ebx, ...) for data in 16bit mode, the assembler inserts the necessary override bytes automatically. For addressing I don't recommend you use 32bit registers unless you can guarantee that the high order 16bits are zero, else you will get an exception (read: it will crash). |
|||
![]() |
|
System86 09 Jun 2008, 19:19
Quote:
Unless you switch into protected mode, load segments with 4 GB limit selectors, and switch back into real mode without restoring segment limits (aka switch into flat real mode). |
|||
![]() |
|
revolution 09 Jun 2008, 19:32
System86 wrote: Unless you switch into protected mode, load segments with 4 GB limit selectors, and switch back into real mode without restoring segment limits (aka switch into flat real mode). |
|||
![]() |
|
DOS386 09 Jun 2008, 23:06
> When I add use32, it stops working.
Read this: http://board.flatassembler.net/topic.php?t=6633 > The format directive is not needed for simple com programs. Maybe true ... but I prefer straightforward design from black magic in the background. > For addressing I don't recommend you use 32bit registers unless you can guarantee Yeah ... 16-bit RM has 64 KiB segment limit ![]() Quote:
http://board.flatassembler.net/topic.php?t=2528 |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.