I'm trying to do a for loop in assembly. I'm using TASM and TLINK. I also have a library that my professor gave to me, but I'm trying to do all the things on my own, and to my surprise, it's not working. So, I just copy pasted my profesor's code and I receive the same error. The error is as follows.
I can compile with TASM, even i create the .exe, I run it, and after running it, insted of doing what it supposed to do, it just says "Syntax error".
Here's my code:
MODEL small
.stack 100h
N equ 20
.DATA
mensaje db "Hola mundo",10,13,"$"
mensajefin db "Finalizo el for, presiona cualquier tecla para terminar$"
i db (?)
.code
imprimefor PROC
mov ax,@data
mov ds,ax
mov ah,03h
int 10h
mov [i],0
@@for_cmp: cmp [i],N
ja @@for_end
mov dx,offset mensaje
mov ah,09h
int 21h
inc [i]
jmp @@for_cmp
@@for_end: mov dx,offset mensajefin
mov ah,09h
int 21h
mov ah,01h
int 21h
mov ax,4c00h
int 21
ENDP
END
Here's my professor's:
MODEL small
.STACK 100h
;----- Insert INCLUDE "filename" directives here
;----- Insert EQU and = equates here
INCLUDE procs.inc
LOCALS
N equ 20
CR EQU 13
LF EQU 10
.DATA
mens db 'Hola Mundo',CR,LF,0
i db (?)
.CODE
;----- Insert program, subrutine call, etc., here
Principal PROC
mov ax,@data
mov ds,ax
call clrscr
; i=0
mov [i],0
; i<n
@@cmp_for: cmp [i],N
ja @@fin_for
mov al,[i]
inc al
add al,30h ; convierte a ASCII
call putchar
mov ax,'-'
call putchar
mov dx,offset mens
call puts
; i++
inc [i]
jmp @@cmp_for
@@fin_for: call getch
mov ah,04ch ; fin de programa
mov al,0 ;
int 21h ;
ENDP
END
I looked in a lot of places but I haven't been able to find anything that helps. Any suggestions? Also my professor has a broken leg, so he's not teaching classes to us, so we're kinda screwed.