diff options
| author | Michal Idziorek <m.i@gmx.at> | 2015-05-14 10:44:00 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2015-05-14 10:44:00 +0200 |
| commit | dc7bf2f47d6f97407e3b50ae0b8ab59fd51079e5 (patch) | |
| tree | 1ed444c804d9ff55e23a7a007275c3d5c649a455 /xxx/boot2/check_a20_16.asm | |
| parent | 7df4060ae807dd27f3ae0a11f243897f36053ba1 (diff) | |
moving unused files folder
Diffstat (limited to 'xxx/boot2/check_a20_16.asm')
| -rw-r--r-- | xxx/boot2/check_a20_16.asm | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/xxx/boot2/check_a20_16.asm b/xxx/boot2/check_a20_16.asm new file mode 100644 index 0000000..43da6e3 --- /dev/null +++ b/xxx/boot2/check_a20_16.asm @@ -0,0 +1,61 @@ +; The following code is public domain licensed + +[bits 16] + +; Function: check_a20 +; +; Purpose: to check the status of the a20 line in a completely self-contained state-preserving way. +; The function can be modified as necessary by removing push's at the beginning and their +; respective pop's at the end if complete self-containment is not required. +; +; Returns: 0 in ax if the a20 line is disabled (memory wraps around) +; 1 in ax if the a20 line is enabled (memory does not wrap around) + +check_a20: + pushf + push ds + push es + push di + push si + + cli + + 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 + + mov ax, 0 + je check_a20__exit + + mov ax, 1 + +check_a20__exit: + pop si + pop di + pop es + pop ds + popf + + ret |
