Thread: hpl me plzzzz
View Single Post
Old Oct 29th, 2005, 7:28 PM   #35
ASMvsC++
Newbie
 
Join Date: Oct 2005
Posts: 12
Rep Power: 0 ASMvsC++ is on a distinguished road
Sorry everyone for my mistakes ,dont argue any more please

Thanks electric Pharaoh and everyone

electricParaoh ! I have some more question please
1)So a program contains all 32 bit opcode can run in realmode not only P mode?
Because I think 32 bit opcode just can run in Pmode not real mode
---------------------------------
2) Some compiler like GCC (some kinda DGJPP -or somethin like that) ,It compiler a program to 32 bit code and run in protected mode by some funtion in souce program like enter_protetcdmode32() ...or go_32dmpi_.... something like that I dont remeber exactly.
Like Pharaoh said "If this is the case with your program, it will be executing in protected mode"
So why some compiler like that provide some func to enter pmode while it already in pmode when it excute wherther I used some func "enterpmode... or enter 32 dmpi " or not ?
---------------------------------
3) I wrote some code in NASM like this
segment data
var1 db 2
segment code
start:
         move eax,[var1]

when I complied : nasm -f obj ex1.asm -o ex1.exe
and no erro warning
but when I excuted it ,it halt the system
I tried to look for some code in Nasm and compile it and run
SECTION .data		; data section
msg:	db "Hello World",10	; the string to print, 10=cr
len:	equ $-msg		; "$" means "here"
				; len is a value, not an address

	SECTION .text		; code section
        global main		; make label available to linker 
main:				; standard  gcc  entry point
	
	mov	edx,len		; arg3, length of string to print
	mov	ecx,msg		; arg2, pointer to string
	mov	ebx,1		; arg1, where to write, screen
	mov	eax,4		; write sysout command to int 80 hex
	int	0x80		; interrupt 80 hex, call kernel
	
	mov	ebx,0		; exit code, 0=normal
	mov	eax,1		; exit command to kernel
	int	0x80		; interrupt 80 hex, call kernel

but cause error ,it sutdown DOs Console and show the error message in the message box of windows ,said that instruction error and give some address of memory
so let me ask you why?
and can you write me a simple example in nasm ?,since NASM document I read have no "full example" except some code snippet ,I try to find some more on net but I just found some thing like the code I showed above
-------------------------------------------
4) I read some document about DPMI 1.0
and it said to enter p.mode we call 2FH func and int 1687h
and the return value in ES and DI
and it said ES contains realmode segment of DMPI host data
and it give a snippet code to enter p.mode

modesw dd 0 ; far pointer to DPMI host's
; mode switch entry point
.
.
.
mov ax,1687h ; get address of DPMI host's
int 2fh ; mode switch entry point
or ax,ax ; exit if no DPMI host
jnz error
mov word ptr modesw,di ; save far pointer to host's
mov word ptr modesw+2,es ; mode switch entry point
or si,si ; check private data area size
jz @@1 ; jump if no private data area
mov bx,si ; allocate DPMI private data
mov ah,48h ; area below 1 MB boundary
int 21h ; transfer to DOS
jc error ; jump, allocation failed
mov es,ax ; let ES=segment of data area
@@1: mov ax,0 ; bit 0=0 indicates 16-bit app
call modesw ; switch to protected mode
jc error ; jump if mode switch failed
; else we're in prot. mode now

I try to search and find me some understanding about this but...
I wanna ask :
- Why do this code allocate memory for DMPI private data? It just allocate some memory and that's it ,no effect? see?
mov bx,si ; allocate DPMI private data
mov ah,48h ; area below 1 MB boundary
int 21h ; transfer to DOS

- when it make a call to enter p mode : call modesw
why we must call this ?
Does it setup some segment descriptor or selector ,or some thing like that

- when we in protect mode by calling call modesw ,what is in TR ( task resgister) , a selector to TSS ?

Thanks

Ok I edited !if it still has something that make you unpleasant but you still understand please pass it
ASMvsC++ is offline   Reply With Quote