BIOS2:0A0C MemoryCheck proc near ; DATA XREF: BIOS2:off_FA0A08o

BIOS2:0A0C mov al, PITMODE_counter_rate_generator or PITMODE_cnt_16 or PITMODE_counter1

BIOS2:0A0E out PITmodeport, al ; Timer 8253-5 (AT: 8254.2).

BIOS2:0A10 jmp short $+2 ; Jump

BIOS2:0A12 mov al, 12h

BIOS2:0A14 out PITcnt1, al ; Timer 8253-5 (AT: 8254.2).

BIOS2:0A16 jmp short $+2 ; Jump

BIOS2:0A18 mov al, 0

BIOS2:0A1A out PITcnt1, al ; Timer 8253-5 (AT: 8254.2).

BIOS2:0A1C jmp short $+2 ; Jump


BIOS2:0A1E 01h Memory check

BIOS2:0A1E DRAM size check

BIOS2:0A1E Memory structure configuration

BIOS2:0A1E SM-RAM stack area test

BIOS2:0A1E mov dx, PRNDataLatch

BIOS2:0A21 mov al, Phase_01 ; Memory check

BIOS2:0A23 out dx, al ; Printer Data Latch:

BIOS2:0A23 ; send byte to printer

BIOS2:0A24 mov ax, SG_0x18 ; Memory segment 0x00000000-0xFFFFFFFF 16 bit

BIOS2:0A27 mov ds, ax

BIOS2:0A29 assume ds:nothing

BIOS2:0A29 mov dx, Special188A ; DRAM config register

BIOS2:0A2C in al, AT_KEYcmdstat ; AT Keyboard controller 8042.

BIOS2:0A2E test al, AT_ctrl_SystemFlag ; Logical Compare

BIOS2:0A30 jnz short skip_0x188A_init ; Jump if Not Zero (ZF=0)

BIOS2:0A32 fill 0x188a registers 0x90-0x96 with 0x01

BIOS2:0A32 mov ax, 190h


BIOS2:0A35 fill_0x188a_1: ; CODE XREF: MemoryCheck+2Ej

BIOS2:0A35 out dx, ax

BIOS2:0A36 inc al ; Increment by 1

BIOS2:0A38 cmp al, 97h ; '' ; Compare Two Operands

BIOS2:0A3A jnb short fill_0x188a_1 ; Jump if Not Below (CF=0)

BIOS2:0A3C mov ax, 1A0h

BIOS2:0A3F fill 0x188a registers

BIOS2:0A3F 0xA0-0xA7 01

BIOS2:0A3F 0xA8-0xAF 02

BIOS2:0A3F 0xB0-0xB7 04

BIOS2:0A3F 0xB8-0xBF 08

BIOS2:0A3F 0xC0-0xC7 10

BIOS2:0A3F 0xC8-0xCF 20

BIOS2:0A3F 0xD0-0xD7 40

BIOS2:0A3F 0xD8-0xDF 80



BIOS2:0A3F loc_FA0A3F: ; CODE XREF: MemoryCheck+41j

BIOS2:0A3F out dx, ax

BIOS2:0A40 mov bx, ax

BIOS2:0A42 mov cx, 8

BIOS2:0A45 xor si, si ; Logical Exclusive OR

BIOS2:0A47 rep lodsb ; Load String

BIOS2:0A49 mov ax, bx

BIOS2:0A4B shl ah, 1 ; Shift Logical Left

BIOS2:0A4D jnb short loc_FA0A3F ; Jump if Not Below (CF=0)


BIOS2:0A4F skip_0x188A_init: ; CODE XREF: MemoryCheck+24j

BIOS2:0A4F mov cx, 101h

BIOS2:0A52 xor ebp, ebp ; Logical Exclusive OR

BIOS2:0A55 ; fill 0x188A registers:

BIOS2:0A55 ; 03=08 07=08 0B=08 0F=08 13=08 17=08 1B=08 1F=08 23=08 27=08


BIOS2:0A55 r188a_03_27: ; CODE XREF: MemoryCheck+E0j

BIOS2:0A55 mov al, 3


BIOS2:0A57 loc_FA0A57: ; CODE XREF: MemoryCheck+52j

BIOS2:0A57 mov ah, 8

BIOS2:0A59 out dx, ax

BIOS2:0A5A add al, 4 ; Add

BIOS2:0A5C cmp al, 27h ; ''' ; Compare Two Operands

BIOS2:0A5E jbe short loc_FA0A57 ; Jump if Below or Equal (CF=1 | ZF=1)

BIOS2:0A60 0x188A register 0xA0

BIOS2:0A60 move cl -> ah

BIOS2:0A60 0xA0 -> al

BIOS2:0A60 write to 0x188A

BIOS2:0A60 read back 0x188A reg 0xA0

BIOS2:0A60 compare to cl.

BIOS2:0A60 ; probably this checks whether a bank is available or not

BIOS2:0A60 mov ah, cl

BIOS2:0A62 mov al, 0A0h ; ' '

BIOS2:0A64 out dx, ax

BIOS2:0A65 out dx, al ; 188A: A0=01 02 04 08 10 20

BIOS2:0A66 inc dx ; Increment by 1

BIOS2:0A67 in al, dx

BIOS2:0A68 dec dx ; Decrement by 1

BIOS2:0A69 cmp al, cl ; Compare Two Operands

BIOS2:0A6B jnz short test_next_bank ; Jump if Not Zero (ZF=0)

BIOS2:0A6D ; write to 0x188A

BIOS2:0A6D ; 01=00 02=00 03=00 41=00 42=00 43=00

BIOS2:0A6D mov al, ch ; ch = 01 05 09 0D 11 15

BIOS2:0A6F mov ah, 0

BIOS2:0A71 out dx, ax ; 188A: 01=00 or 05=00 or 09=00 or 0D=00 or 11=00 or 15=00

BIOS2:0A72 inc al ; Increment by 1

BIOS2:0A74 out dx, ax ; 188A: 02=00 or 06=00 or 0A=00 or 0E=00

BIOS2:0A75 inc al ; Increment by 1

BIOS2:0A77 out dx, ax ; 188A: 03=00 or 07=00 or 0B=00 or 0F=00

BIOS2:0A78 add al, 3Eh ; '>' ; Add

BIOS2:0A7A mov ah, 0

BIOS2:0A7C out dx, ax ; 188A: 41=00 or 45=00 or 49=00 or 4D=00

BIOS2:0A7D inc al ; Increment by 1

BIOS2:0A7F out dx, ax ; 188A: 42=00 or 46=00 or 4A=00 or 4E=00

BIOS2:0A80 inc al ; Increment by 1

BIOS2:0A82 out dx, ax ; 188A: 43=00 or 47=00 or 4B=00 or 4F=00

BIOS2:0A83 mov al, ch

BIOS2:0A85 shr al, 2 ; Shift Logical Right

BIOS2:0A88 and al, 0Fh ; Logical AND

BIOS2:0A8A add al, 80h ; '' ; al = 80 or 81 or 82 or 83 or 84 or 85

BIOS2:0A8C mov ah, 0Eh

BIOS2:0A8E out dx, ax ; 188A: 80=0E 81=0E 82=0E 83=0E 84=0E 85=0E

BIOS2:0A8F add al, 10h ; a1 = 90 or 91 or 92 or 93 or 94 or 95

BIOS2:0A91 mov ah, 3

BIOS2:0A93 out dx, ax ; 188A: 90=03 91=03 92=03 93=03 94=03 95=03

BIOS2:0A94 ;

BIOS2:0A94 ; test memory location at 0x010008000

BIOS2:0A94 ;

BIOS2:0A94 mov eax, 5A5A5A5Ah

BIOS2:0A9A xchg eax, ds:1000800h ; Exchange Register/Memory with Register

BIOS2:0AA2 xor esi, esi ; Logical Exclusive OR

BIOS2:0AA5 cmp dword ptr ds:1000000h, 5A5A5A5Ah ; Compare Two Operands

BIOS2:0AB1 jnz short mem_pattern_mismatch ; Jump if Not Zero (ZF=0)

BIOS2:0AB3 mov esi, 10000h

BIOS2:0AB9 jmp short cont_here ; Jump

BIOS2:0ABB ; ---------------------------------------------------------------------------


BIOS2:0ABB mem_pattern_mismatch: ; CODE XREF: MemoryCheck+A5j

BIOS2:0ABB cmp dword ptr ds:1000800h, 5A5A5A5Ah ; Compare Two Operands

BIOS2:0AC7 jnz short cont_here ; Jump if Not Zero (ZF=0)

BIOS2:0AC9 mov esi, 1


BIOS2:0ACF cont_here: ; CODE XREF: MemoryCheck+ADj

BIOS2:0ACF ; MemoryCheck+BBj

BIOS2:0ACF xchg eax, ds:1000800h ; Exchange Register/Memory with Register

BIOS2:0AD7 bsf ax, cx ; Bit Scan Forward

BIOS2:0ADA xchg al, cl ; Exchange Register/Memory with Register

BIOS2:0ADC shl esi, cl ; Shift Logical Left

BIOS2:0ADF or ebp, esi ; Logical Inclusive OR

BIOS2:0AE2 xchg al, cl ; Exchange Register/Memory with Register

BIOS2:0AE4 ;

BIOS2:0AE4 ; cl ranges 01 02 04 08 10 20

BIOS2:0AE4 ; ch ranges 01 05 09 0D 11 15

BIOS2:0AE4 ;


BIOS2:0AE4 test_next_bank: ; CODE XREF: MemoryCheck+5Fj

BIOS2:0AE4 add ch, 4 ; Add

BIOS2:0AE7 shl cl, 1 ; Shift Logical Left

BIOS2:0AE9 test cl, 40h ; Logical Compare

BIOS2:0AEC jz r188a_03_27 ; Jump if Zero (ZF=1)

BIOS2:0AF0 ;

BIOS2:0AF0 ; Here it is done

BIOS2:0AF0 ; we know now how much memory slots are filled.

BIOS2:0AF0 ;

BIOS2:0AF0 mov esp, ebp

BIOS2:0AF3 mov cx, bp

BIOS2:0AF5 ror ebp, 10h ; Rotate Right

BIOS2:0AF9 or cx, bp ; Logical Inclusive OR

BIOS2:0AFB ror ebp, 10h ; Rotate Right

BIOS2:0AFF mov al, 0A0h ; ' '

BIOS2:0B01 mov ah, cl

BIOS2:0B03 out dx, ax

BIOS2:0B04 inc al ; Increment by 1

BIOS2:0B06 mov ah, ch

BIOS2:0B08 out dx, ax

BIOS2:0B09 Write in 0x188A:

BIOS2:0B09 0x00-0x17: 0xFF

BIOS2:0B09 mov cx, 18h

BIOS2:0B0C mov ax, 0FF00h


BIOS2:0B0F fill_0x00_0x17: ; CODE XREF: MemoryCheck+106j

BIOS2:0B0F out dx, ax

BIOS2:0B10 inc al ; Increment by 1

BIOS2:0B12 loop fill_0x00_0x17 ; Loop while CX != 0

BIOS2:0B14 Write in 0x188A:

BIOS2:0B14 0x40-0x57: 0x00

BIOS2:0B14 mov ax, 40h ; '@'

BIOS2:0B17 mov cx, 18h


BIOS2:0B1A fill_0x40_0x57: ; CODE XREF: MemoryCheck+111j

BIOS2:0B1A out dx, ax

BIOS2:0B1B inc al ; Increment by 1

BIOS2:0B1D loop fill_0x40_0x57 ; Loop while CX != 0

BIOS2:0B1F Write in 0x188A:

BIOS2:0B1F 0x80-0x86: 0x00

BIOS2:0B1F mov ax, 80h ; ''

BIOS2:0B22 mov cx, 6


BIOS2:0B25 fill_0x80_0x86: ; CODE XREF: MemoryCheck+11Cj

BIOS2:0B25 out dx, ax

BIOS2:0B26 inc al ; Increment by 1

BIOS2:0B28 loop fill_0x80_0x86 ; Loop while CX != 0

BIOS2:0B2A Write in 0x188A

BIOS2:0B2A 0x90-0x96: 0x00

BIOS2:0B2A mov ax, 90h ; ''

BIOS2:0B2D mov cx, 6


BIOS2:0B30 fill_0x90_0x96: ; CODE XREF: MemoryCheck+127j

BIOS2:0B30 out dx, ax

BIOS2:0B31 inc al ; Increment by 1

BIOS2:0B33 loop fill_0x90_0x96 ; Loop while CX != 0

BIOS2:0B35 xor bx, bx ; Logical Exclusive OR

BIOS2:0B37 mov di, offset mem_bank34


BIOS2:0B3A loc_FA0B3A: ; CODE XREF: MemoryCheck+13Ej

BIOS2:0B3A ; MemoryCheck+1B1j

BIOS2:0B3A xor ax, ax ; Logical Exclusive OR

BIOS2:0B3C bsf ax, bp ; Bit Scan Forward

BIOS2:0B3F jnz short loc_FA0B4C ; Jump if Not Zero (ZF=0)

BIOS2:0B41 shr ebp, 10h ; Shift Logical Right

BIOS2:0B45 jz short loc_FA0BC0 ; Jump if Zero (ZF=1)

BIOS2:0B47 mov di, offset mem_bank12

BIOS2:0B4A jmp short loc_FA0B3A ; Jump

BIOS2:0B4C ; ---------------------------------------------------------------------------


BIOS2:0B4C loc_FA0B4C: ; CODE XREF: MemoryCheck+133j

BIOS2:0B4C mov si, di

BIOS2:0B4E btr bp, ax ; Bit Test and Reset

BIOS2:0B51 mov ah, 0FFh

BIOS2:0B53 xor cx, cx ; Logical Exclusive OR

BIOS2:0B55 bsf cx, bp ; Bit Scan Forward

BIOS2:0B58 jz short loc_FA0B62 ; Jump if Zero (ZF=1)

BIOS2:0B5A btr bp, cx ; Bit Test and Reset

BIOS2:0B5D mov ah, cl

BIOS2:0B5F add si, 9 ; Add


BIOS2:0B62 loc_FA0B62: ; CODE XREF: MemoryCheck+14Cj

BIOS2:0B62 mov cx, ax


BIOS2:0B64 loc_FA0B64: ; CODE XREF: MemoryCheck+1ABj

BIOS2:0B64 mov al, cl

BIOS2:0B66 add al, 90h ; '' ; Add

BIOS2:0B68 mov ah, cs:[si+mem_init.reg_0x9x]

BIOS2:0B6B out dx, ax ; Printer Data Latch:

BIOS2:0B6B ; send byte to printer

BIOS2:0B6C add al, 0F0h ; '' ; Add

BIOS2:0B6E mov ah, cs:[si+mem_init.reg_0x8x]

BIOS2:0B72 out dx, ax ; Printer Data Latch:

BIOS2:0B72 ; send byte to printer

BIOS2:0B73 mov al, cl

BIOS2:0B75 shl al, 2 ; Shift Logical Left

BIOS2:0B78 inc al ; Increment by 1

BIOS2:0B7A mov ah, 0

BIOS2:0B7C cmp ch, 0 ; Compare Two Operands

BIOS2:0B7F jnz short loc_FA0B85 ; Jump if Not Zero (ZF=0)

BIOS2:0B81 mov ah, cs:[si+mem_init.anonymous_2]


BIOS2:0B85 loc_FA0B85: ; CODE XREF: MemoryCheck+173j

BIOS2:0B85 out dx, ax ; Printer Data Latch:

BIOS2:0B85 ; send byte to printer

BIOS2:0B86 xchg bx, cx ; Exchange Register/Memory with Register

BIOS2:0B88 inc al ; Increment by 1

BIOS2:0B8A mov ah, cl

BIOS2:0B8C out dx, ax ; Printer Data Latch:

BIOS2:0B8C ; send byte to printer

BIOS2:0B8D inc al ; Increment by 1

BIOS2:0B8F mov ah, ch

BIOS2:0B91 out dx, ax ; Printer Data Latch:

BIOS2:0B91 ; send byte to printer

BIOS2:0B92 xchg bx, cx ; Exchange Register/Memory with Register

BIOS2:0B94 add al, 3Eh ; '>' ; Add

BIOS2:0B96 mov ah, cs:[si+mem_init.x41_45_49_4d]

BIOS2:0B9A out dx, ax ; Printer Data Latch:

BIOS2:0B9A ; send byte to printer

BIOS2:0B9B inc al ; Increment by 1

BIOS2:0B9D mov ah, cs:[si+mem_init.x42_46_4a_4e]

BIOS2:0BA1 out dx, ax ; Printer Data Latch:

BIOS2:0BA1 ; send byte to printer

BIOS2:0BA2 inc al ; Increment by 1

BIOS2:0BA4 mov ah, cs:[si+mem_init.x43_47_4b_4f]

BIOS2:0BA8 out dx, ax ; Printer Data Latch:

BIOS2:0BA8 ; send byte to printer

BIOS2:0BA9 cmp ch, 0 ; Compare Two Operands

BIOS2:0BAC jz short loc_FA0BB9 ; Jump if Zero (ZF=1)

BIOS2:0BAE cmp ch, 0FFh ; Compare Two Operands

BIOS2:0BB1 jz short loc_FA0BB9 ; Jump if Zero (ZF=1)

BIOS2:0BB3 mov cl, ch

BIOS2:0BB5 mov ch, 0

BIOS2:0BB7 jmp short loc_FA0B64 ; Jump

BIOS2:0BB9 ; ---------------------------------------------------------------------------


BIOS2:0BB9 loc_FA0BB9: ; CODE XREF: MemoryCheck+1A0j

BIOS2:0BB9 ; MemoryCheck+1A5j

BIOS2:0BB9 add bx, word ptr cs:[si+mem_init.anonymous_7] ; Add

BIOS2:0BBD jmp loc_FA0B3A ; Jump

BIOS2:0BC0 ; ---------------------------------------------------------------------------


BIOS2:0BC0 loc_FA0BC0: ; CODE XREF: MemoryCheck+139j

BIOS2:0BC0 mov ax, 1A2h

BIOS2:0BC3 out dx, ax ; Printer Data Latch:

BIOS2:0BC3 ; send byte to printer

BIOS2:0BC4 shr bx, 4 ; Shift Logical Right

BIOS2:0BC7 mov di, offset SMRAM_stackarea_check

BIOS2:0BCA jmp MemStructConfig ; Jump