MichaelPetch

bl1

Dec 19th, 2020 (edited)
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. bits 32
  2. boot2:
  3. mov ax, DATA_SEG
  4. mov ds, ax
  5. mov es, ax
  6. mov fs, ax
  7. mov gs, ax
  8. mov ss, ax
  9. mov esi,hello
  10. mov ebx,0xb8000
  11.  
  12. .loop:
  13. lodsb
  14. or al,al
  15. jz printcr0
  16. or eax,0x0100 ; <----- this looks wrong as it uses junk already in EAX
  17. mov word [ebx], ax
  18. add ebx,2
  19. jmp .loop
  20.  
  21. hello: db "Hello world!",0
  22.  
  23. printcr0:
  24. mov edx, cr0
  25. mov ecx, 8 ; 8 nibbles (groups of 4 bits) in a dword
  26. ;mov ebx, 000B8000h ; Remove this and continue with the previous value
  27. ; in EBX after Hello world! printed
  28. .loop:
  29. rol edx, 4
  30. mov eax, edx
  31. and eax, 15
  32. add eax, 00000130h
  33. cmp al, '9' ; "0" to "9" are fine
  34. jbe .ok
  35. add eax, 7 ; This produces "A" to "F"
  36. .ok:
  37. mov [ebx], ax
  38. add ebx, 2
  39. dec ecx
  40. jnz .loop
  41. halt:
  42. cli
  43. hlt
  44. jmp halt
Add Comment
Please, Sign In to add comment