Echo Nr to screen...

Programming, for all ages and all languages.
Post Reply
Paeron

Echo Nr to screen...

Post 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
anubis

Re:Echo Nr to screen...

Post 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!!!
Post Reply