'can not see the instruction for calling start: in nasm?
I am learning the os-tutorial of https://github.com/cfenollosa/os-tutorial. In the chapter 5. There is one instruction for calling the funciton print: But, after I inspected the inner of boot_sect_print.asm, I didn't see any instructions to call start: which has code for printing the content. Is there any knowledge else for this I missed? Relevant files are as follow:
boot_sect_main.asm
[org 0x7c00] ; tell the assembler that our offset is bootsector code
; The main routine makes sure the parameters are ready and then calls the function
mov bx, HELLO
call print
call print_nl
mov bx, GOODBYE
call print
call print_nl
mov dx, 0x12fe
call print_hex
; that's it! we can hang now
jmp $
; remember to include subroutines below the hang
%include "boot_sect_print.asm"
%include "boot_sect_print_hex.asm"
; data
HELLO:
db 'Hello, World', 0
GOODBYE:
db 'Goodbye', 0
; padding and magic number
times 510-($-$$) db 0
dw 0xaa55
boot_sect_print.asm
print:
pusha
; keep this in mind:
; while (string[i] != 0) { print string[i]; i++ }
; the comparison for string end (null byte)
start:
mov al, [bx] ; 'bx' is the base address for the string
cmp al, 0
je done
; the part where we print with the BIOS help
mov ah, 0x0e
int 0x10 ; 'al' already contains the char
; increment pointer and do next loop
add bx, 1
jmp start
done:
popa
ret
print_nl:
pusha
mov ah, 0x0e
mov al, 0x0a ; newline char
int 0x10
mov al, 0x0d ; carriage return
int 0x10
popa
ret
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
