sasha
sasha

Reputation: 35

Assembler:Problem with initializing variable

I try find maximum repetitive number.

I get error when try initalize variable:

unknown opcode byte: Fh
Not supported yet. Not 8086 instruction.

So that is my code:

#make_COM#
    ORG 100H
    ARRAY DB 5,2,7,12,8,2,8,3,5,2,3,2,13,2
    ARRAYcnt DW 13
    ARRAYmax DW 0
    MOV AH,0
    MOV CX,ARRAYcnt
    MOV BX,0
    MOV AL,0
    MOV DL,ARRAY[BX] 
    xor si,si  

    External:  
    push CX
    MOV AH,0
    MOV DL,ARRAY[BX]
    MOV CX,ARRAYcnt
    Internal:
    CMP DL,ARRAY[si]
    JE label1
    continiue:
    INC si
    LOOP Internal
    xor si,si
    CMP AH,AL
    JG label2:
    continiue1:
    pop CX 
    INC BX
    LOOP External  

    HLT

    label1:INC AH
           JMP continiue
    label2:MOV AL,AH
           push BX  
           MOV BX,ARRAY[BX]
           MOV ARRAYmax,BX
           pop BX
           JMP continiue1

After that is error:ARRAYcnt DW 15

I change DW to DB .

Also I have tried write 15 as 0Fh.No result.

Please help

Upvotes: 1

Views: 119

Answers (1)

fuz
fuz

Reputation: 92986

The problem you have is that code execution begins at location 100h, but your program has data, not code there. Thus the processor attempts to execute your data as code, causing the problems you observe. To fix this, move your data out of the path of execution, e.g. to the end of the program.

Upvotes: 2

Related Questions