Article View: comp.lang.asm.x86
Article #131Re: Loading files in DPMI
From: Andrey Chirikba
Date: Tue, 28 Jul 1998 00:00
Date: Tue, 28 Jul 1998 00:00
56 lines
2838 bytes
2838 bytes
On 26 Jul 1998 02:37:55 GMT, Marcus Johansson <marcus.johansson@mbox005.swipnet.se> wrote:
Just load it by parts of 64Kb. I don't know how about PM, but in the real mode I use something like this:
mov ecx,[filesize]
mov ax,[segment]
mov ds,ax
Again:
push ecx ; Store on stack, how much left to read
test ecx,0FFFF0000h ; Less than 64Kb -- than read it
jz NotTooMuch
mov cx,0FFFFh ; Else read 65535
NotTooMuch:
<here we read 65535 bytes> ; DOS call (don't forget BX=FileHandle)
pop eax ; Restore the value
jc Error ; Any errors?
sub eax,cx ; How much left to read?
jz Done ; Nothing -- out
push ecx
mov dx,0FFFFh ; Read one byte to the
mov cx,1 ; very end of the segment
<read one more byte> ; DOS call
pop ecx
jc Error
dec ecx ; Nothing left -- then exit
jz Done
mov ax,ds ; Increase DS by 1000h -- to the next phys. segment
add ax,1000h
mov ds,ax
jmp Again ; "On and on... "
Done:
. . .
Error:
I don't guarantee you'll be able to use this in PM (I never written progs for PM in asm), but, it's not bad (I don't say
"not buggy")
>I am almoust finsihed with my DPMI loader but I can only load 64kbit
>files, anyone know how to load programs when operating in protectedmode?
>
>The dos routine for loading files seemes to be limited to 64kb so how do
>
>I load larger files, anyone got any code for it? Or suggestions?
>
>Thanks,
>Marcus
>
>
{****************************************}
{ If you want to run Setup, *}
{ Press DELETE at the startup *}
{****************************************}
Delete <chirikba@rullet.leidenuniv.nl>
Technical Details
Message-ID:
<6plaes$ot5$1@winter.news.erols.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6pe4q3$oej$3@winter.news.erols.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 110df7,f21f69c019c6776d X-Google-Attributes: gid110df7,public X-Google-Thread: 1093da,f21f69c019c6776d X-Google-Attributes: gid1093da,public X-Google-Thread: 1072bd,f21f69c019c6776d X-Google-Attributes: gid1072bd,public X-Google-Thread: feaef,f21f69c019c6776d X-Google-Attributes: gidfeaef,public X-Google-Thread: 104440,f21f69c019c6776d X-Google-Attributes: gid104440,public X-Google-Thread: f7d8d,f21f69c019c6776d X-Google-Attributes: gidf7d8d,public X-Google-Thread: 114917,f21f69c019c6776d X-Google-Attributes: gid114917,public From: chirikba@rullet.leidenuniv.nl (Andrey Chirikba) Subject: Re: Loading files in DPMI Date: 1998/07/28 Message-ID: <6plaes$ot5$1@winter.news.erols.com> X-Deja-AN: 375758709 Approved: <johnfine@erols.com> References: <6pe4q3$oej$3@winter.news.erols.com> X-Mozilla-Status: 0801 X-Complaints-To: abuse@rcn.com X-Trace: winter.news.erols.com 901655836 25509 207.172.234.190 (28 Jul 1998 19:57:16 GMT) Organization: World Online Newsgroups: comp.lang.asm.x86,sk.comp.asm,comp.lang.asm,borland.public.tasm,alt.lang.asm,alt.os.assembly,de.comp.lang.assembler.misc