Page 1 of 1

Echo Nr to screen...

Posted: Sat Jul 12, 2003 9:03 am
by Paeron
This is a function I wrote in nasm for my OS, but it does not work... I get an error on the div 0Ah line saying I used the wrong opcode... what is wrong??! I think I used the right syntax.

echonr:      ; This will echo ax's numreric value to the screen
   div 0Ah
   mov bl, al
   mov al, ah
   mov ah, 0Eh
   mov bh, 0
   mov cx, 1
   int 10h
   
   mov ax, bl
   cmp ax,0
   jne echonr
   
   ret

Re:Echo Nr to screen...

Posted: Sun Jul 13, 2003 1:09 am
by anubis
Its been a lot of time since i have programmed in NASM, but i think its becos u have used immediate value 0ah with div which is not allowed. Div works only with registers or memory.

maybe div's syntax may help
its here!!!