Author Topic: Yet another "e: ic_of_p_and_o" errror  (Read 8234 times)

Dan

  • Guest
Yet another "e: ic_of_p_and_o" errror
« on: March 19, 2005, 12:02:51 PM »
Hi there,
I have as simple as could be program:
=================code=======
section .text
org 100h
pusha
mov ah,06h
mov al,00h
mov cx,0000h
mov dx,184fh
int 10h
mov ah,02h
mov bh,00
mov dx,0000h
int 10h
mov cx,256
lea dx,znak
d20: cmp znak,08h
jb d30
cmp znak,0dh
jbe d40
d30: mov ah,09h
int 21h
d40: inc znak
loop d20
popa
mov ax,4c00h
int 21h
section .data
znak dw 00, '$'
=========end code=============
while compiling there are errors with definition of 'znak' I thing:
$nasm -o d.com d.asm
:18: error: invalid combination of opcode and operands
:19: error: invalid combination of opcode and operands
:21: error: invalid combination of opcode and operands
:25: error: invalid combination of opcode and operands

i can't understand why?
please help
--
d.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Yet another "e: ic_of_p_and_o" errror
« Reply #1 on: March 19, 2005, 12:16:46 PM »
In each of the lines Nasm complains about, you want "[znak]", not "znak". You'll need to specify a size, too - although you define znak as word, you probably want "byte"...

Best,
Frank

Dan

  • Guest
Re: Yet another "e: ic_of_p_and_o" errror
« Reply #2 on: March 19, 2005, 01:42:04 PM »
thanks
it helped now it is only one mistake:
31: error: label or instruction expected at start of line
line 31: byte znak db 00, '$'
best & thx a lot
--
d.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Yet another "e: ic_of_p_and_o" errror
« Reply #3 on: March 19, 2005, 01:56:50 PM »
Oops. I misspoke. You don't need "byte" there, nor on the "lea" line... Like so:


section .text
org 100h
pusha
mov ah,06h
mov al,00h
mov cx,0000h
mov dx,184fh
int 10h
mov ah,02h
mov bh,00
mov dx,0000h
int 10h
mov cx,256
lea dx, [znak]
d20: cmp byte [znak], 08h
jb d30
cmp byte [znak],0dh
jbe d40
d30: mov ah,09h
int 21h
d40: inc byte [znak]
loop d20
popa
mov ax,4c00h
int 21h

section .data
znak db 0, ' ', '$'