From: Mike Gonta on 30 May 2010 19:11 On May 26, 7:38 am, James Harris <james.harri...(a)googlemail.com> wrote: > We could do with a standard piece of code to carry out the test and > report the results. Any offers? Hi James, Here is a version based on the int 15h, ax=2402 BIOS function specification. This was a PS/2 BIOS function which never made it's way into most AT compatible BIOS. This function does not change upper memory, and also reports with the carry flag set if there is no upper memory. It's presented here as a FAT12 boot sector which will boot and run from either a floppy disk or flash drive. It can be assembled with either FASM or NASM. ; Original code by Mike Gonta, Public Domain 2010 use16 org 7C00h jmp start nop db ' ' dw 512 ; bytes per sector db 1 ; sectors per cluster reserved_sector_count: dw 1 db 2 ; number of FATs dw 16*14 ; root directory entries dw 18*2*80 ; sector count db 0F0h ; media byte dw 9 ; sectors per fat sectors_per_track: dw 18 number_of_heads: dw 2 dd 0 ; hidden sectors dd 0 ; number of sectors huge drive_number: db 0 db 0 ; reserved db 29h ; signature dd 0 ; volume ID db ' ' ; volume label db 'FAT12 ' ; file system type start: xor ax, ax mov ds, ax mov es, ax call get_A20_gate_status jc no_hi_mem test al, al je A20_disabled call print db 'The A20 line is enabled.', 0 jmp exit A20_disabled: call print db 'The A20 line is disabled.', 0 jmp exit no_hi_mem: call print db 'There is no high memory.', 0 exit: call print db 13, 10, 'Press any key to reboot!', 13, 10, 0 xor ah, ah int 16h int 19h print: pop si mov ah, 0Eh xor bh, bh ..1: lodsb test al, al je .2 int 10h jmp .1 ..2: jmp si get_A20_gate_status: ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; 15.24.02 ; Misc - Get A20 Gate Status ; Input: ; (ax = 2402h) ; Output: ; ah = status = 0 - function supported ; CF = 0 if success ; al = A20 gate status (0 = disabled) ; (1 = enabled) ; CF = 1 if no high memory ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pushf cli push ds push es xor ax, ax mov ds, ax ; 0 sub ax, 1 mov es, ax ; 0FFFFh mov ax, [es:502h+16] ; 0FFFFh+502h+16=100502h xor ax, -1 ; invert mov [502h], ax cmp ax, [es:502h+16] mov ax, 0 clc je .2 ; A20 disabled, exit carry clear, al=0 cmp ax, -1 ; might be non existent memory jne .1 xor ax, ax mov [es:502h+16], ax cmp ax, [es:502h+16] stc jne .2 ; no high memory, exit carry set mov [es:502h+16], ax ; restore memory ..1: mov ax, 1 ; A20 enabled, exit carry clear, al=1 clc ..2: pop es pop ds popf ret ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ times (512-2)-($-$$) db 0 dw 0AA55h Mike Gonta look and see - many look but few see http://mikegonta.com/pdBIOS32
From: io_x on 4 Jun 2010 13:42 what is a "gate"?
From: Nathan Baker on 4 Jun 2010 16:20 "io_x" <a(a)b.c.invalid> wrote in message news:4c0938d1$0$12126$4fafbaef(a)reader4.news.tin.it... > what is a "gate"? > > In this case, a 'logic gate' such as AND, OR, NOT. See here: http://en.wikipedia.org/wiki/Logic_gate The "A20" refers to the 20th line (21st bit) of the address bus. See here why it is significant: http://en.wikipedia.org/wiki/A20_line Nathan.
|
Pages: 1 Prev: A few errors to deal with [Correction] Next: GetProcessTimes |