Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I just have started to learn assembly. I made program below but compiler showed two error messages to me. First one is in the line number 30. The content of the message is: Operand types do not match. The content of the second message is: Unexpected end of file encountered. Its in the line nr. 34. I am using TASM compiler. The program main task is find the smallest number of the array.


              .MODEL  huge                   ;1
                                              ;2    
.code                                         ;3
ORG    256h                                   ;4   
                                              ;5  
                ASSUME  CS:Dane, DS:Kod, SS:  ;6
                                              ;7   
Start:                                        ;8      
                                              ;9 
DL_TABLICA      EQU     10                    ;10   
Tablica         DB      01h, 02h, 00h, 10h, 12h, 33h ;11
                DB      15h, 09h, 11h, 08h, 0Ah, 00h ;12
Najmniejsza     DB      ?                      ;13   

                jmp     Poczatek               ;15

Poczatek:                                       ;17
                mov     ah, [si]                ;18
                mov     dx, DL_TABLICA          ;19

Petla:                                          ;21
                mov     bx, SEGMNT Tablica      ;22
                cmp     dl, [bx]                ;23
                jae     Petla                   ;24  
                mov     al, [di]                ;25
                dec     bx                      ;26  
Skok:                                           ;27
                loop     Skok                   ;28

                mov     ax, Najmniejsza          ;30

                mov     ax, 4C13h                ;32
                int     21h                      ;33 

 Dane END                                        ;34


What I have tried:

I tried to replavce
mov     ax, Najmniejsza
with
movzx ax, byte ptr Najmniejsza 
but its still does not work.
Posted
Updated 31-Mar-17 1:49am

1 solution

The syntax used by x86 assemblers differs slightly. So you have to read the corresponding manual.

To load an address into a register, TASM uses the OFFSET keyword:
Borland Turbo Assembler User's Guide:
If you wish to refer to the offset of a symbol within a segment, you must explicitly use the OFFSET operator
mov     ax, OFFSET Najmniejsza

The error "Unexpected end of file encountered" is probably sourced by the wrong END statement. It must be like
END Start
I recommend to get a copy of the Borland Turbo Assembler User's Guide. It can be found in the web as PDF file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900