PMode mem moving doesn´t work

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
FlashBurn

PMode mem moving doesn´t work

Post 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 :

Code: Select all

in al,0x92
or al,0x02
out 0x92,al
It works in bochs, but it seems not to work on a real pc.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:PMode mem moving doesn´t work

Post by Pype.Clicker »

where did you found that 'A20-enabling code' ? afaik, A20 gate enabling uses the 0x60 port, not that 0x92 stuff ...
FlashBurn

Re:PMode mem moving doesn´t work

Post by FlashBurn »

I don?t remember from where this code is. And how is the right code?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:PMode mem moving doesn´t work

Post 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)
FlashBurn

Re:PMode mem moving doesn´t work

Post by FlashBurn »

Maybe you could give me a link to this tutorial. It sounds good. And thanks for the code.
FlashBurn

Re:PMode mem moving doesn´t work

Post 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]
beyondsociety

Re:PMode mem moving doesn´t work

Post 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

Code: Select all

jmp 100000h
Should be

Code: Select all

jmp 0x08:100000h

There might be other problems, these are the main ones I see.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:PMode mem moving doesn´t work

Post 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..
-- Stu --
FlashBurn

Re:PMode mem moving doesn´t work

Post 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!
beyondsociety

Re:PMode mem moving doesn´t work

Post 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
FlashBurn

Re:PMode mem moving doesn´t work

Post by FlashBurn »

It seems to be the same like I have now. But you have forgotten some code.
beyondsociety

Re:PMode mem moving doesn´t work

Post by beyondsociety »

Yes, but it works for me.
FlashBurn

Re:PMode mem moving doesn´t work

Post by FlashBurn »

Yes, but what could be the problem, when my code is executed till the mem move?
FlashBurn

Re:PMode mem moving doesn´t work

Post by FlashBurn »

Isn?t here any guru, who know what my problem is?!
drizzt

Re:PMode mem moving doesn´t work

Post 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
Post Reply