Page 1 of 2
PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 7:47 am
by FlashBurn
As the thread says I want to move some mem from 1018h to 100000h, but this wont work?! I think that maybe the a20gate is not on, but I do it with this code :
It works in bochs, but it seems not to work on a real pc.
Re:PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 8:21 am
by Pype.Clicker
where did you found that 'A20-enabling code' ? afaik, A20 gate enabling uses the 0x60 port, not that 0x92 stuff ...
Re:PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 8:34 am
by FlashBurn
I don?t remember from where this code is. And how is the right code?
Re:PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 8:41 am
by Pype.Clicker
Code: Select all
F_Enable_A20:
;==================================================================
;== init Enable HMA access (real mode)
;== assumes interrupts disabled
;==================================================================
push ax
push cx
call A20@wt ;wait 8042 to be ready
mov al,0D1h ;message: writing on port 0x60
out 64h,al ;sent to COMMAND PORT
call A20@wt
mov al,0DFh ;enable 32 bits addresses
out 60h,al
call A20@wt
pop cx
pop ax
ret
A20@wt: xor cx,cx ;WAIT 8042 STATE
A20@00: in al,64h
test al,2
loopne A20@00
jne A20@01
ret
A20@01: add sp,6 ;cleans up the stack
mov ax,code_16
mov ds,ax
mov dx,dat(xmsg4) ;error message !
jmp error
This one is from TRAN (start32/pmode tutorial)
Re:PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 8:52 am
by FlashBurn
Maybe you could give me a link to this tutorial. It sounds good. And thanks for the code.
Re:PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 8:59 am
by FlashBurn
I use now the new code, but it still wont work. The problem is also still the mem move from 1018h to 100000h. I attach my code. Maybe there are some more failures!
[attachment deleted by admin]
Re:PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 11:01 am
by beyondsociety
You shouldn't "cli" before you reset the ax register to zero and the ds segment register.
Instead of this
Code: Select all
cli
xor ax,ax
mov ds,ax
mov ax,9000h
mov ss,ax
mov sp,0ffffh
sti
It should be like this
Code: Select all
xor ax,ax
mov ds,ax
cli
mov ax,9000h
mov ss,ax
mov sp,0ffffh
sti
I don't think this is your problem, but its better to be safe than sorry.
Changed
Code: Select all
mov eax,cr0
or eax,1 ; or al,1
mov cr0,eax
Where's your GDT?
Jump to kernel is wrong
Should be
There might be other problems, these are the main ones I see.
Re:PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 11:20 am
by df
trans pmode stuff is all over the demo sites. search for trans pmode 1.33 (iirc 1.33 was the last... mm its been a long time...)..
also the DOS32 source code for dos32 extender... 386power.. and others..
Re:PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 11:27 am
by FlashBurn
Yeah, but this is not my problem! The problem has to be the a20gate, because my code is working till the mem move to 100000h!
Re:PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 11:33 am
by beyondsociety
I don't use your method, but through the keyboard port.
Try this:
Code: Select all
Empty_KeyboardBuffer:
xor al, al
in al, 0x64
test al, 0x02
jnz Empty_KeyboardBuffer
ret
Empty_KeyboardBuffer:
xor al, al
in al, 0x64
test al, 0x02
jnz Empty_KeyboardBuffer
ret
Re:PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 12:17 pm
by FlashBurn
It seems to be the same like I have now. But you have forgotten some code.
Re:PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 12:43 pm
by beyondsociety
Yes, but it works for me.
Re:PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 12:50 pm
by FlashBurn
Yes, but what could be the problem, when my code is executed till the mem move?
Re:PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 2:17 pm
by FlashBurn
Isn?t here any guru, who know what my problem is?!
Re:PMode mem moving doesn´t work
Posted: Mon Jan 27, 2003 3:53 pm
by drizzt
I haven't read your code closely... but you can try to enable A20 first with the keyboard controller and then with the system control port A (port 0x92):
Code: Select all
; A20 enabled with keyboard controller
call empty_keyb_buf
mov al, 0xd1
out 0x64, al
call empty_keyb_buf
mov al, 0xdf
out 0x60, al
call empty_keyb_buf
; A20 enabled via system control port A
in al, 0x92
or al, 0x02
out 0x92, al