Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bits 32
- boot2:
- mov ax, DATA_SEG
- mov ds, ax
- mov es, ax
- mov fs, ax
- mov gs, ax
- mov ss, ax
- mov esi,hello
- mov ebx,0xb8000
- .loop:
- lodsb
- or al,al
- jz printcr0
- or eax,0x0100 ; <----- this looks wrong as it uses junk already in EAX
- mov word [ebx], ax
- add ebx,2
- jmp .loop
- hello: db "Hello world!",0
- printcr0:
- mov edx, cr0
- mov ecx, 8 ; 8 nibbles (groups of 4 bits) in a dword
- ;mov ebx, 000B8000h ; Remove this and continue with the previous value
- ; in EBX after Hello world! printed
- .loop:
- rol edx, 4
- mov eax, edx
- and eax, 15
- add eax, 00000130h
- cmp al, '9' ; "0" to "9" are fine
- jbe .ok
- add eax, 7 ; This produces "A" to "F"
- .ok:
- mov [ebx], ax
- add ebx, 2
- dec ecx
- jnz .loop
- halt:
- cli
- hlt
- jmp halt
Add Comment
Please, Sign In to add comment