Memory Wrap-Around (A20-Gate)

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.
Post Reply
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Memory Wrap-Around (A20-Gate)

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 9:02 pm, edited 2 times in total.
slacker

Re:Memory Wrap-Around (A20-Gate)

Post by slacker »

Perica: according to your tutorial on sourceforge:

Memory Wrap-Around does exactly what the name suggests, it makes the memory wrap around! So, for example - If you tried to Acess the Address 0xFFFF:0x0010 you would actually be acessing the Memory at 0x0000:0x0000
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Memory Wrap-Around (A20-Gate)

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 9:02 pm, edited 1 time in total.
slacker

Re:Memory Wrap-Around (A20-Gate)

Post by slacker »

actually the tutorial was on BonaFide:(osdev.neopages.net)
slacker

Re:Memory Wrap-Around (A20-Gate)

Post by slacker »

btw perica. that tutorial was one of the best ive read on real mode.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Memory Wrap-Around (A20-Gate)

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 9:05 pm, edited 1 time in total.
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:Memory Wrap-Around (A20-Gate)

Post by Pype.Clicker »

what if your BIOS decided to start the PC with A20 gate enabled ? some BIOSes do, some don't, some other have an option for it ...

Your code seems okay for me ... maybe you could try to invalidate cache entries before you re-read ...
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Memory Wrap-Around (A20-Gate)

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 9:06 pm, edited 1 time in total.
slacker

Re:Memory Wrap-Around (A20-Gate)

Post by slacker »

my A20 code(works):

Code: Select all

;---enable a20 line---
jmp enable_a20

wait_for_controller:       ;this waits for kbd controller to process data
xor al, al
in  al, 0x64               ;check port 0x64
test al, 0x02              ;check for bit 1=1  
jnz wait_for_controller    ;if not 1, loop until 1
ret

enable_a20:                ;begin a20 enable
cli                         ;disable interrupts

call wait_for_controller    
mov al, 0xD1                 ;send 0xD1
out 0x64, al
call wait_for_controller
mov al, 0xDF                 ;send 0xDF  
out 0x60, al
call wait_for_controller
sti
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Memory Wrap-Around (A20-Gate)

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 9:06 pm, edited 2 times in total.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Memory Wrap-Around (A20-Gate)

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 9:06 pm, edited 1 time in total.
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:Memory Wrap-Around (A20-Gate)

Post by Pype.Clicker »

perica, were you able to determine whether BOCHS's bios boots with A20 enabled or disabled ? it could help other people to know it, imho ;)
Post Reply