Comments / improvement on the A20 Line wiki article
Posted: Fri Jul 18, 2014 9:14 am
Hello,
I'm kind of new to this forum, but I've been reading it for a couple of weeks now and started doing a bit of OS development.
I have a (very small) concern about the A20 Line article, more specifically the part about testing whether the A20 line is enabled (http://wiki.osdev.org/A20_Line#Testing_the_A20_line).
Let me quote the relevant part :
Basically, we save the bytes at [ds:di] and [es:di] by pushing them on the stack before overwriting them with 0x00 and 0xFF to test whether the memory wraps around. Now, what if the current stack pointer happens to point to somewhere around 0x500 ? Wouldn't there be a risk to overwrite it and defeat the purpose of saving the bytes ? Of course, there is the BDA just below 0x500, so it would be risky in the first place to have the stack so close. But anyways, I think it's not even necessary to use the stack here, we could just leave the values in ax, like this :
Do you think this would be a reasonable improvement ?
Yeah, lots of text for such a small detail, that's my frenchness talking
I'm kind of new to this forum, but I've been reading it for a couple of weeks now and started doing a bit of OS development.
I have a (very small) concern about the A20 Line article, more specifically the part about testing whether the A20 line is enabled (http://wiki.osdev.org/A20_Line#Testing_the_A20_line).
Let me quote the relevant part :
Code: Select all
xor ax, ax ; ax = 0
mov es, ax
not ax ; ax = 0xFFFF
mov ds, ax
mov di, 0x0500
mov si, 0x0510
mov al, byte [es:di]
push ax
mov al, byte [ds:si]
push ax
mov byte [es:di], 0x00
mov byte [ds:si], 0xFF
cmp byte [es:di], 0xFF
pop ax
mov byte [ds:si], al
pop ax
mov byte [es:di], al
Code: Select all
mov al, byte [es:di]
mov ah, byte [ds:si]
mov byte [es:di], 0x00
mov byte [ds:si], 0xFF
cmp byte [es:di], 0xFF
mov byte [ds:si], ah
mov byte [es:di], al
Yeah, lots of text for such a small detail, that's my frenchness talking