I am making a little asm x86 bootloder code to test cmp in asm, but it is giving me the following error:
boot.asm:9: error: invalid combination of opcode and operands
I am just comparing bx with 0x0107, they are all 16 bit numbers so I don't see any problem.
My code is the following:
mov ah, 0x0e ; int 10/ ah = 0eh -> scrolling teletype BIOS routine
mov bp, 0x8000 ; Set the base of the stack a little above where BIOS
mov sp, bp ; loads our boot sector - so it won't overwrite us. sp -> 0x8000, bp -> 0x8000
push 0x0107 ; Pushes 0x0107 onto the stack (Test number)
pop bx ; Gets the value and stores it in bx
cmp 0x0107, bx ; Compares the value in bx to 0x0107
je equal ; If they are equal, jump to equal
jmp not_equal ; If they aren't equal, jump to not_equal
equal:
mov al, 'E' ;
int 0x10 ; Prints a 'E' as for Equal
jmp end ; Skips not_equal
not_equal:
mov al, 'N' ;
int 0x10 ; Prints a 'N' as for Not Equal
end:
jmp $ ; Jump forever.
; Padding and magic BIOS number.
times 510 -( $ - $$ ) db 0
dw 0xaa55