I have this entire code in assembly for 8086, it has to chain a interrupt vector. The problem is that the interruption isn't pointing to this code im memory. I try to print a message just to test and it doesn't work. I don't know what to do anymore. Can anyone see the problem, I need this help. THANKS!

.model tiny
org 100h
   jmp primeiro
   msg db 'Comando Invalido! /i--Instalar  /d--Desinstalar$'
   msg2 db 'Instalou',0dh,'$'
   msg3 db 'Programa já instalado!$'
   msg4 db '..$'
   msg5 db 'ALARME! Deu o tempo, maluco!$'
   entra db 'Digite a hora do alarme (hhmm): $'
   hh db 10
   hr db 10
   mh db 10
   min db 10
   BEEP_TONE EQU 440 ; Beep tone in hertz
   BEEP_DURATION EQU 6 ; Number of clocks during beep,
   TIME    DB  '00:00$'        ; time format hr:min:sec
 Residente proc far
    push    BX
    push    CX
    push    DX
    push    SI
    push    DI
    push    DS
    push    ES
    push    BP
    mov dx,offset msg4
    mov ah,09h
    int 21h 
	cmp ah,0fh
	jne check_time
	mov al,01h
	jmp pos_comp
	mov AH, 2CH                   ; get the current system time
    int 21H 

	mov ah,ch
	cmp ah,hr
	jne pos_comp
	mov ah,cl
	cmp ah,min
	jne pos_comp
   ; mov dx,offset msg5
   ; mov ah,09h
   ; int 21h 
	call desinstala
	pop bp
	pop es
	pop ds
	pop di
	pop si
	pop dx
	pop cx
	pop bx
   residente endp 
 desinstala proc
   mov ah,62h
   int 21h
   mov     es, bx
   mov     es, es:[2Ch]    ;Get address of environment block.
   mov     ah, 49h         ;DOS deallocate block call.
   int     21h

   mov     es, bx         ;Now free the program's memory
   mov     ah, 49h         ; space.
   int     21h
 desinstala endp
  mov si,ax
  mov bx,81h
  mov byte ptr ss:[bx+si],'$'
  mov dl,ss:[82h] ;81h tem o espaço
  cmp dl,'/'
  jne ajuda


  mov dl,ss:[83h]
  cmp dl,'i'
  je Instalar

  cmp dl,'d'
  je Desinstalar

  mov dx,offset msg
  mov ah,09h
  int 21h 
  jmp encerra

  ;; verifica instalação:
  mov ax,00h
  mov ah,0fh
  int 1ch
  cmp al,01h
  je instalado
  mov dx,offset msg2
  mov ah,09h
  int 21h 
  mov dx,offset entra
  mov ah,09h
  int 21h
  mov ah,1 ;;le o primeiro numero da hora
  int 21H
  mov hh,al
  mov al,10
  mul hh ;multiplica por 10
  mov hh,al
  mov ah,1 ;;le o segundo caractere da hora
  int 21H
  add al,hh ;;adiciona o segundo algarismo a hora total
  mov hr,al
  mov ah,1 ;espera o 1º min
  int 21H
  mov ah,00h
  mov mh,al
  mov al,10h
  mul mh
  mov mh,dl
  mov ah,1 ;espera o 2º min
  int 21H
  add al,mh
  mov min,al
  mov ax, seg residente
  mov ds,ax
  mov ah,25h
  mov al,1ch ;seta o novo vetor de interrupção
  lea dx,residente
  int 21
  mov dx,offset EndofResident
  mov ah,31h
  int 21h
    mov dx,offset msg3
    mov ah,09h
    int 21h
  mov ah,4ch
  int 21h

 end start
5 Years
Discussion Span
Last Post by coffeeuncle

Is the program not working at all or just not as expected ?
Is PC working after execution or hangs ?


It's not working. it has to go resident and to do the interrup vector to point to my procedure.


To make DOS, and even some BIOS, calls from a TSR, you have to go to elaborate lengths to prevent the operating system from crashing. In particular, you need some DOS functions which Microsoft never officially documented until towards the end of MS-DOS's lifetime - although everybody knew they existed. Presumably the intention was to give Microsoft's own software an unfair advantage.

I can't remember all of them now, but some of the undocumented int 21h function calls you would need are 34h, 50h and 51h. Unfortunately, books about writing DOS TSR's are likely to be a bit thin on the ground in 2011.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.