Hello World! Building my own option rom for fun but code barely works.. Please help:

Hi,

I found a code snippet in this book ‘Shellcoders guide to hacking’ that is suppose to print something in color and ask for a password.
It is a basic ISA option rom and all I can get it to print to the screen is ‘Wuuuuuuu’ or ‘Wu’ so not sure what I’m doing wrong. I think the
code has errors such as originally it had the header as ‘55 0A’ as opposed to ‘55 AA’ which I fixed. Using FASM to compile it. I want it
to display a message on my older machines right at start up or ask for a password. Using QEMU to test out the code. Any assembly
coders out there want to take a look?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 
; ISAOEM.ASM
use16 ; ISA module operates in the 16-bit segment.
DB 55h, 0AAh ; Boot signature
 
DB 01h ; Block size in sectors (200h each)
 

JMP x_code ; Pass control to the password protection code.
 
x_code: ; Preparing the registers
 
; -----------------------
MOV DX, 101Dh ; Where to output (DH - Y, DL - X)
 
MOV SI, text ; What to output
;XOR BX, BX ; Initial color of characters - 1
MOV BX, 12h
MOV CX, 1 ; Output one character at a time.
 

; Display color string.
; _--------------------
 
print_string:
 

MOV AH, 02h ; Function for controlling the cursor
INT 10h ; Position the cursor.
INC DL ; Move to the next position.
 
LODSB ; Load the next character.
 
TEST AL, AL ; Is this the end of the line?
 
JZ input ; Exit if yes.

MOV AH, 09h ; Function for printing a character
INC BL ; Use all colors, one by one.
INT 10h ; Print a character.
 
JMP print_string ; Loop
 
input:
; Wait for the password.
; ----------------------
 
XOR DX, DX ; Checksum
 
enters:
XOR AX, AX ; Function for reading a character from the keyboard
INT 16h ; Read the character.
CMP AL, 0Dh ; Is this ENTER?
 
JZ input ; If yes, start the input again.

XOR AH, AH ; Clear the scan code.
ADD DX, AX ; Compute the CRC.
CMP DX, 'd' + 'a' + 'v' + ']' + '['
JNZ enters ; If the password is incorrect, continue.
RETF
 
text DB "The Matrix has you!",0