TASM program freezes after mov

338 views Asked by At

I have an issue with my program. Everything works well except mov bx, 0 freezes the program. Also, dosbox gives error:

Illegal read from de74395c, CS:IP 1a2: 140

I have no clue why it does this. I tried loadfix command, but it didn't help. Any advice? Thank you.

LOCALS @@
.386
.model small

.stack 1000h

.code
start:        

check_args:
  call get_argc

exit:
  mov ah, 4Ch
  int 21h

proc get_argc
  mov bx, 0         
  jmp exit
  mov di, 80h       
  mov cx, es:[di]  

  @@L1:
    inc di         
    mov al, es:[di] 
    cmp al, 20h     
    je @@L1        
    cmp al, 09h    
    je @@L1        
    cmp al, 0Dh     
    je @@done       

    inc bx         

  @@L2:
    inc di
    mov al, es:[di]
    cmp al, 20h
    je @@L1
    cmp al, 09h
    je @@L1
    cmp al, 0Dh
    je @@done
        jmp @@L2

    @@done:
        mov ax, bx
        ret
endp

end start
1

There are 1 answers

0
rkhb On

Your .386 is at the wrong place. It must be set (if at all) after the .model small directive.