Pop quiz: in the original code (show below), what does the line
mul cx do, and why are you doing it?
Code: Select all
vga:
; Draw pixel in middle of screen
mov ax, [ycoord]
mov bx, [xcoord]
mov cx, 320
mul cx
add ax, bx
mov di, ax
mov dl, [color]
mov [es:di],dl
Given that you repeat this code (sans the indirections; by making your loads immediates, without giving them equates to name the constants, you have made the whole less readable) in a way that makes the multiply pointless (as you are multiplying by
one in the second repetition), I am not convinced you know. I am not even convinced you know what the original code was meant to do, for that matter (hint - one of the comments says it explicitly).
Similarly, can you tell me why you are using mode 0x13, rather than some other mode? There is a reason in the original, I am wondering if you can tell me what that reason is.
Can you tell me what you expected it to display? I would love to hear it.
EDIT: I want you to understand that I am not doing this to pick on you, but to make a point about how you are coming across to us, and how many problems you will have if you keep trying to Frankenstein together other people's code into a system without really understanding what the code does. The Sewage Overflow copypasta approach
does not work in OS dev. There is no substitute for understanding here, and, to paraphrase Euclid, no royal road to OS dev.