Dos Is Still Alive

  • Thread starter Thread starter netfreak
  • Start date Start date
  • Replies Replies 18
  • Views Views 4,523
😀 some companies use this to ship consoles as the OS of the system.
 
dos 4 and earlier were 8 bitdos 5,6,7 are 16 bitwindows 3.1 was 16 bit and virtual 32 bit.win95 was virtual 32 bitwin98 to xp was 32 bitwinxp64 is 64 bitso obviously dos is slower than windows 32 bit.you can see the diff in copying a huge file in dos and in windows 32
 
QUOTE(sifyfan @ May 13 2006, 02:51 PM) [snapback]51154[/snapback]
so obviously dos is slower than windows 32 bit.

you can see the diff in copying a huge file in dos and in windows 32
[/b]

1. What makes a 16 bit system slower then 32 bit system? 16 bit system might not be able to access as much memory as 32 bit system, but how will they be slower/faster?

2. File copy speed should be restricted by Hard disk read/write speed, rather then OS speed. Since data transfer happens over DMA (without any kind of involvement from CPU).

In fact, "some" programs will run fater in DOS (e.g. SuperPI). Since all they need to do is crunch numbers and display output. In Linux/Windows, something as simple as writing a pixel to screen or allocating a block of memory takes thousands of instructions to execute. These operations are done by kernel in Linux/Windows for a good reason, but it involves a context switch and thats a costly operation.

In DOS, its just:

Code:
void main(void){   unsigned char far *screen;          // pointer to the VGA video memory   int screen_width, screen_height,x,y,colour;   screen=MK_FP(0xa000, 0);          //  Assume screen is in 13 h mode   screen_width=320;     // Actual line of code...   *(screen + y*screen_width + x)=colour;}

And thats just a few ASM instructions...
Code:
  ;      ;    {  ;       unsigned char far *screen;          // pointer to the VGA video memory  ;       int screen_width, screen_height,x,y,colour;  ;       screen=MK_FP(0xa000, 0);          //  Assume screen is in 13 h mode  ;        mov    word ptr [bp-2],40960    mov    word ptr [bp-4],0  ;      ;       screen_width=320;  ;        mov    word ptr [bp-6],320  ;      ;         // Actual line of code...  ;       *(screen + y*screen_width + x)=colour;  ;        mov    ax,word ptr [bp-10]    imul    word ptr [bp-6]    les    bx,dword ptr [bp-4]    add    bx,ax    add    bx,word ptr [bp-8]    mov    al,byte ptr [bp-12]    mov    byte ptr es:[bx],al  ;      ;    }  ;    



I know its a long post.. but DOS programming has a Nostalgic effect.
 


QUOTE(netfreak @ May 14 2006, 02:31 AM) [snapback]51204[/snapback]
1. What makes a 16 bit system slower then 32 bit system? 16 bit system might not be able to access as much memory as 32 bit system, but how will they be slower/faster?

2. File copy speed should be restricted by Hard disk read/write speed, rather then OS speed. Since data transfer happens over DMA (without any kind of involvement from CPU). [/b]
AFAIK, the OS must have the DMA drivers to actually drive the DMA controllers otherwise it will be plain old transfer using the CPU. Also, 16-bit OS means not only lesser address space but also lesser data transferred per clock cycle
 
QUOTE(max @ May 14 2006, 01:41 PM) [snapback]51240[/snapback]
AFAIK, the OS must have the DMA drivers to actually drive the DMA controllers otherwise it will be plain old transfer using the CPU.
[/b]

In MS DOS things work a bit different for floppy and IDS drives. Disk access is done by BIOS. And you can enable / disable DMA in BIOS. All a program needs to do is raise INT 13h.

13H is a software interrupt. In IBM comatible PCs, this vector always lands in BIOS code. BIOS can dransfer data with programmed I/O or DMA. Default is DMA, but you can choose to disable that through BIOS.

This inerrupt supports floppy and HDD only, device number goes into a1 dl- drive (0..7fh is floppy 80h..ffh is hard disk)

CD Drives are not directly supported by BIOS and there you need driver support.


QUOTE(max @ May 14 2006, 01:41 PM) [snapback]51240[/snapback]
Also, 16-bit OS means not only lesser address space but also lesser data transferred per clock cycle
 
QUOTE(netfreak @ May 14 2006, 02:45 PM) [snapback]51247[/snapback]
If you step into 13h, you can see examples of 32 bit requests being generated for hdd reads and writes.[/b]
I dont like seeing ASM code...And I guess there is no way to see the C code. BTW I am interested in seeing all this. I already have a VM installed at my place ( QEMU ). I may install DOS 6.22. Care to give me some instructions?
 
Download ISO from :

http://freedos.sourceforge.net/freedos/files/

And boot your VM with fdbootcd.iso

Once you hare in DOS,

1. run debug command
2. have a look at 13h vector (note value stored at 13h)
3. dump memory at locatio nthat sstored at 13h
4. diassemble (unassemble) the dump

You will see BIOS code there.

Exact code will depend on the BIOS emulated by VM.
 
dma is only used when you enable it by using smartdrv.or else it will eat your hdd and cpu while copying a huge file.if smartdrv is enabled then it wont use much cpu. it will use ram more.also speed depends more on available base memory which is limited to 640KB only.hence if you load more programs in upper memory then u get increased in speeds in dos.
 
It depends on BIOS.DOS hands over HDD read and HDD write commands to INT 13h.Some BIOS are pretty bad and have code only for programmed I/O. Others (specially IBM) are better. But yes, if a program desires then the program can engage in DMA itself and smartdrv is one of such programs.
 
If you want some code to test, here is one

how to screw up your HDD (Erase partition table)

Run command "debug" in dos, eter followinf code/commands

Code:
- f 200 L200 0- a 100xxxx:xxxx mov ax,301 (ignore segment :offset values at left)xxxx:xxxx mov bx,200xxxx:xxxx mov cx,1xxxx:xxxx mov dx,0080xxxx:xxxx int 13xxxx:xxxx int 3xxxx:xxxx (Press ENTER an extra time here)- g=100- q
Now run FDISK....

It wont see any partition.

Ofcourse do it only on VM
 
QUOTE(max @ May 15 2006, 10:45 PM) [snapback]51396[/snapback]
thanks netfreak, will try out 🙂
[/b]

Here is an article from Digg.. author of this article tries to modify the BIOS
 

Top