assembly - Print string using INT 0x10 in bootsector -


i want create printl function allow me print string in ax register. in 16-bit real mode , can not find way print message. using int 0x10 print single letter.

i try pass argument (string print) in bx register, in loop print letter letter , go using popa , ret. code didn't work -- either created infinite loop or printed strange sign.

if know more efficient way it's not problem. ask comment code if gave any

this code

boot.asm:

start:     mov bx, welcome    ;put argument bx     call printl        ;call printl function in sysf.asm     hlt                ;halt cpu  welcome db 'hello', 0  include 'sysf.asm' times 510 - ($-$$) db 0  db 0x55 db 0xaa 

sysf.asm:

;print function ; al 1 letter argument (type java:char) ; print:         pusha         mov ah, 0x0e         int 0x10         popa         ret              ; go  ;printl function ; bx argument of type java:string ; printl:         pusha         jmp printl001 printl001:         lodsb             ; working si register use bx register         or al,al         jz printl002         mov ah, 0x0e         int 0x10         jmp printl001  printl002:         popa         ret 

the lodsb instruction loads byte pointed ds , si registers haven't loaded either valid value. since bootloader need use org directive, otherwise assembler won't know code, , therefor welcome, gets loaded memory. try changing start of of program to:

org 0x7c00  start:     push cs     pop ds     mov si, welcome 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -