Re: LOW LEVEL I/O
From: flekso (taurus_at_email.hinet.hr)
Date: 10/12/03
- Next message: Annie: "Re: HLA is productive"
- Previous message: T.M. Sommers: "Re: BSS with MS Link"
- In reply to: I.G. Abel: "Re: LOW LEVEL I/O"
- Next in thread: I.G. Abel: "Re: LOW LEVEL I/O"
- Reply: I.G. Abel: "Re: LOW LEVEL I/O"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 12 Oct 2003 09:50:25 +0200
"I.G. Abel" <iga20@hermes.cam.ac.uk> wrote in message
news:Pine.SOL.4.58.0310111831340.1899@green.csi.cam.ac.uk...
> It will run under MSDOS. Compile as a .com program or compile to a .obj
> and run LINK to produce a .exe for dos.
>
> There is a major distinction between MSDOS and Win *, UNIX etc
> on an x86.
> Dos runs in real mode, in which you can only access 1MB of memory
> directly (hence the need for ems/xms). Under real mode only one program
> runs at a time and Dos lives in memory as a set of interrupt routines
> (int 21h etc.). There is no memory protection and a poorly written dos
> program can overwrite dos/ivt and other data. Importntly in this case you
> can use the BIOS routines from real mode.
> Windows runs in protected mode where all interrupts are not just vectors
> in the ivt at 0000:0000, but are entries in an OS controlled Interrupt
> Descriptor Table. As the Bios routines are real mode routines you cannot
> call them from inside windows, or any other protected mode OS. To access
> the floppy from protected mode you must use the I/O ports, this is only
> nessecary if you are writing OSes or Device Drivers, Windows provides
> routines for reading the low level data from a floppy. The command for
> Win95/Win98 is DeviceIoCtl() (look up in MSDN) and for Win NT/2k/XP is
> OpenFile("\\.\\a:" ...) or similar. These commands are designd to be
> called from a C prog but can be INVOKEd from MASM (i dont know the MASM
> syntax though). Sometimes the OS prevents port access to non-kernel
> programs.
>
> HTH
>
> Ian Abel
> Trinity Hall College,
> Cambridge University
>
> On Sat, 11 Oct 2003, RICHARD BROMBERG wrote:
>
> > Here is a program to do a low level READ/WRITE to a floppy.
> > It compiles clean using MASM32, but generates errors under Win 98, 2000,
XP.
> >
> > Question ! . Will it run on a dos box ??
> >
> > Question 2 . What do I have to change to make it Shellable from Visual
> > Basic.
> > Many Thanks
> >
> > ; MINIVER2.ASM LOW LEVEL DISK I/0
> >
> > .486
> > .model flat, stdcall
> > option casemap :none ; case sensitive
> >
> > include \masm32\include\windows.inc
> > include \masm32\include\user32.inc
> > include \masm32\include\kernel32.inc
> >
> > includelib \masm32\lib\user32.lib
> > includelib \masm32\lib\kernel32.lib
> >
> > .data
> >
> > databuf db 900 dup(0h) ;data buffer plenty of space
> > databuf2 db 900 dup(0h)
> >
> > .code
> >
> > start:
> > mov ah,2 ; read sectors ; set up registers
> > mov dl,0 ; drive number
> > mov dh,0 ; head number
> > mov ch,5 ; track number
> > mov cl,2 ; sector number
> > mov al,1 ; number of sectors
> > lea bx,databuf ; read write here
> > int 13h
> >
> > call ExitProcess
> > end start
> >
> >
> >
but it links to windows libraries and calls exitprocess - isn't that going
to be a real showstopper in msdos ?
- Next message: Annie: "Re: HLA is productive"
- Previous message: T.M. Sommers: "Re: BSS with MS Link"
- In reply to: I.G. Abel: "Re: LOW LEVEL I/O"
- Next in thread: I.G. Abel: "Re: LOW LEVEL I/O"
- Reply: I.G. Abel: "Re: LOW LEVEL I/O"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|