Error: operation size not specified

Hello guys,
The below given code gives me an error: operation size not specified. Since I am new to assembly language, I can’t figure out what is the reason for this particular error. I need some serious help guys.

org 0x7c00        ; start at 0x7c00

mov bx,label      ; First address of label is moved to bx
call print        ; call print function
jmp $             ; infinate loop

print:            ; begining of print fun
pusha             ; copy content of all reg to stack

slen:
cmp [bx],0        ; check content of bx is zero  ----> error 
jz finished       ; if zero jump to finished
mov al,[bx]       ; else mov content of bx to al
mov ah,0x0e       ; scrolling teletype bios routine
INT 0x10          ; BIOS interrupt
inc bx
jmp slen          ; jump

finished:
popa              ; pop out everything out of stack
ret               ; return print function call

label:
db 'engineersasylum.com',0

times 510-($-$$) db 0  ; padding everything with zero
dw 0xaa55              ; Magic number

This statement has a big problem. You have not specified the size of the data, which you are comparing. In this case, the data in the bx register can be anything and the assembler is confused about the size of data.
You have to change above line to cmp byte[bx],0

See the modified code below:

slen:
cmp byte[bx],0    ;  ---->  Change
jz finished       ; zero jump to finished
mov al,[bx]       ; mov content of bx to al
mov ah,0x0e       ; scrolling teletype bios routine
INT 0x10          ; BIOS interrupt
inc bx
jmp slen          ; jump
2 Likes

Thanks! Now everything is fine.