Re: weird 64 bit mode ......
Posted: Thu Jul 22, 2010 11:50 am
About the 000 thing... 48 = '0' ASCII.
The Place to Start for Operating System Developers
https://f.osdev.org/
Code: Select all
PD: Here an real output:
0000.0000.0000.0000 + 0FFF.9000.0000.0000 = 0FFF.9000.0000.0000 /OK
0FFF.9000.0000.0000 + 0F40.0000.0000.0000 = 000F.A000.0000.0000 /?
000F.E000.0000.0000 + 000F.2000.0000.0000 = 0000.F100.0000.0000 /?
0000.F100.0000.0000 + 5FFF.F000.0000.0000 = 000F.FFF5.0000.0000 /?! etc.....
Code: Select all
mov EAX, 0B8000h
mov CL, [DS:0] ;Here is the number of entries in the e820 structure
mov EDX, 500h ;At [DS:500h] is placed the e820 structure itself
mov EDI, 0
print_1:
print_2:
mov BL, [DS:EDX]
and BL, 0Fh
call print_hex
add EAX, 2
mov BL, [DS:EDX] ;again
shr BL, 4
call print_hex
add EAX, 2
inc EDX
inc EDI
cmp EDI, 24
jne print_2
mov EDI, 0
add EAX, 40h
dec CL
cmp CL, 0
jne print_1
jmp next
print_hex:
l0:
cmp BL, 0
jne l1
mov byte [DS:EAX], "0"
ret
l1:
cmp BL, 1
jne l2
;.............
Code: Select all
;......
mov dword [DS:9], 0 ;Here will be the constant for the ram available
mov dword [DS:9], 0
mov EAX, 500h
mov CL, [DS,0]
search_amount_of_ram:
movdqu XMM0, [DS:EAX]
add EAX, 8
movdqu XMM1, [DS:EAX]
sub EAX, 8
paddq XMM0, XMM1
movq XMM2, XMM0
movdqu XMM3, [DS:9]
psubq XMM0, XMM3
movdqu [DS:SSE_temp], XMM0
mov EDX, [DS:SSE_temp+4]
bt EDX, 31
jb another_loop
movdqu [DS:9], XMM2
another_loop:
add EAX, 24
dec CL
cmp CL, 0
jne search_amount_of_ram
Code: Select all
;.........
mov EAX, 0B8000h
mov BL, [0]
mov EDX, 500h
print:
mov RCX, [EDX]
mov R8, RCX ;Save RCX, because the print function destroys the RCX
;print RCX
add EAX, 0Ah ;Print stuff
add EDX, 8
mov RCX, [EDX]
mov R9, RCX
;print RCX
add EAX, 0Ah
add R8, R9
mov RCX, R8
;print RCX
add EAX, 20h+18 ;new line
add EDX, 16 ;new entry
dec BL
cmp BL, 0
jne print