Debugging Tips - The LearnixOS Book #53
Replies: 1 comment
-
|
For anyone curious about assembler code for the "hello world" kernel, running ; Sets ECX to -11 (in two's complement), which is the string length.
; After 11 increments, ECX becomes 0.
00000000 66B9F5FFFFFF mov ecx,0xfffffff5
; Loads a character from memory address (0x7c25 + ECX offset)
00000006 678A91257C0000 mov dl,[ecx+0x7c25]
; BIOS teletype function (prints character).
; Move the character to AL register (value is read from DL).
; Call BIOS interrupt to print the character in AL.
0000000D B40E mov ah,0xe
0000000F 88D0 mov al,dl
00000011 CD10 int byte 0x10
; Loop: Increment ECX.
; Jump back to line 2 if ECX is not zero.
00000013 6641 inc ecx
00000015 75EF jnz 0x6
; Halt and return
00000017 F4 hlt
00000018 66C3 retd
; String data (ignore the asm code, just look at the raw data)
0000001A 68656C push word 0x6c65
0000001D 6C insb
0000001E 6F outsw
0000001F 20776F and [bx+0x6f],dh
00000022 726C jc 0x90
00000024 640000 add [fs:bx+si],al
00000027 0000 add [bx+si],al
...
; Required boot sector signature.
000001FD 0055AA add [di-0x56],dl |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
ch01-03-debugging-methods
https://www.learnix-os.com/ch01-03-debugging-methods.html
Beta Was this translation helpful? Give feedback.
All reactions