It seems that I may be here a lot over the next couple days... :)
My code is as follows and works for BOCHS x86 emulator
-- BOOT.ASM --
[org 0x7c00]
mov dx, 0x7c00
call printhex
mov bx, printthistoo
call printaddr
jmp $
%include "print.asm"
printthis:
db 'Letters!', 0
printthistoo:
db ' Yes, all of these!', 0
times 510-($-$$) db 0
dw 0xaa55
-- PRINT.ASM --
printaddr:
pusha
mov ah, 0x0e
lp:
mov al, [bx]
cmp al, 0
jne printch
jmp doneaddr
printch:
int 0x10
add bx, 1
jmp lp
doneaddr:
popa
ret
printhex:
mov cx, 0x3
mov ax, 0xF
lph:
mov bx, 0x0
add bx, ax
and bx, dx
cmp bx, ax
je log
sub ax, 0x1
jmp lph
log:
cmp ax, 0x9
jle lognum
jmp loglet
finlog:
cmp cx, 0x0
je printnd
mov ax, 0xF
sub cx, 0x1
shr dx, 4
jmp lph
lognum:
mov bx, extemplate
add bx, cx
add bx, 0x2
add ax, 48
mov [bx], al
jmp finlog
loglet:
mov bx, extemplate
add bx, cx
add bx, 0x2
add ax, 0x7
add ax, 48
mov [bx], al
jmp finlog
printnd:
mov bx, extemplate
call printaddr
ret
extemplate:
db '0x0000', 0
After a couple of tries with BOCHS, I decided to try the code on my physical computer. I loaded the code onto a USB stick with RUFUS and booted it. However, all that happened was a cursor freaking out and then a spade character printing onto the screen. Can anyone tell me what I did wrong?