Programme résident

RootASM Messages postés 17 Date d'inscription lundi 16 janvier 2006 Statut Membre Dernière intervention 4 avril 2006 - 23 févr. 2006 à 20:19
BLUEBIBUBBLE Messages postés 116 Date d'inscription samedi 4 juin 2005 Statut Membre Dernière intervention 10 avril 2013 - 20 mars 2006 à 00:11
Bonjour,

J'ai fait un programme qui affiche l'heure et je voudrais le rendre résident en détournent l'interruption 05h.
Je voudrais lancer mon programme une fois, puis si j'appuye sur la touche Printscreen, l'heure s'en va et si je réappuye dessus elle reapparait.

Merci

3 réponses

BLUEBIBUBBLE Messages postés 116 Date d'inscription samedi 4 juin 2005 Statut Membre Dernière intervention 10 avril 2013 1
2 mars 2006 à 01:47
Ok, l'idée est bonne, utilise la fonc 35h pour récupérer le vecteur d'interruption original de l'interruption 05h, modifie le vecteur avec la function 25h pour qu'il pointe sur ta routine (qui doit ensuite appeler l'ancienne fonction) puis rend ton programme résident avec la fonction 31h. (tout avec l'int 21h)
0
RootASM Messages postés 17 Date d'inscription lundi 16 janvier 2006 Statut Membre Dernière intervention 4 avril 2006
18 mars 2006 à 14:03
Salut,

Voila mon programme, il n'est pas encore résident mais il y a un probleme. Lorsque je le lance sous Virtual Player Computer et que j'appuye une fois sur Printscreen l'heure s'affiche mais apres plus rien l'heure reste figée au dessus de l'écran.

.MODEL SMALL
.STACK
.DATA


prtscn DB 0
ancip DW ?
ancseg DW ?
mvideo DB 20 dup(' ')

.CODE


include a:hex2asc.asm
JMP START

ROUTINETIMER:

CLI
PUSH AX ; SAUVEGARDE DES DIFFÉRENT REGISTRES
PUSH CX
PUSH DX
PUSH SI
PUSH DI
PUSH DS
PUSH ES

MOV AX, 0B800h
MOV ES, AX


MOV SI, 142

MOV AH, 02h ; LECTURE DE L'HEURE
INT 1Ah

MOV AL, CH ; AFFICHE LES HEURES
CALL HEX2ASCII

MOV AH, 07
MOV AL, ':' ; CARACTÈRE ':'
MOV ES:[SI], AX
INC SI
INC SI

MOV AL, CL ; AFFICHE LES MINUTES
CALL HEX2ASCII

MOV AH, 07
MOV AL, ':' ; CARACTÈRE ':'
MOV ES:[SI], AX
INC SI
INC SI

MOV AL, DH ; AFFICHE LES SECONDES
CALL HEX2ASCII

POP AX ; RECUPERATION DES DIFFÉRENT REGISTRES
POP CX
POP DX
POP SI
POP DI
POP DS
POP ES
STI

IRET

ROUTINE05h:


CLI
MOV AX, @DATA
MOV DS, AX


CMP prtscn, 1
JE ECRAN


MOV AL, 1Ch
MOV AH, 35h ;Lit l'ancien vecteur
CLI
INT 21h
MOV ancip, BX
MOV AX, ES
MOV ancseg, AX ;ancien IP et SEGMENT dans ES:BX


PUSH ES


MOV AX, 0B800h
MOV ES, AX
MOV SI, 142 ;Premier chiffre de l'heure
MOV DI, 0


SVGVIDEO1:


MOV BH, ES:[SI]
MOV mvideo[DI], BH ;Premier chiffre de l'heure sauve
INC DI
INC SI
MOV BL, ES:[SI] ;Second
MOV mvideo[DI], BL
CMP DI, 17
JE SUITE ;Quand toute l'heure est sauvegardée on arrete
INC DI
INC SI
JMP SVGVIDEO1


SUITE:


POP ES
PUSH DS
PUSH CS
POP DS
LEA DX, ROUTINETIMER ;Place la routine
MOV AH, 25h
MOV AL, 1Ch ;Detourne 1Ch
CLI
INT 21h
STI
POP DS
MOV prtscn, 1
JMP FIN


ECRAN:


MOV DX, ancip ;Remet l ancien IP
MOV AX, ancseg ;et SEGMENT
PUSH DS
MOV DS, AX
MOV AH, 25h
MOV AL, 1Ch
CLI
INT 21h
STI
POP DS
PUSH ES


MOV AX, 0B800h
MOV ES, AX
MOV SI, 142
MOV DI, 0


SVGVIDEO2:


MOV BH, mvideo[DI]
INC DI
MOV BL, mvideo[DI]
MOV ES:[SI], BX ;Réaffiche l'heure
CMP DI, 17
JE SUITE2
INC DI
INC SI
INC SI
JMP SVGVIDEO2


SUITE2:


POP ES
MOV prtscn, 0


FIN:


STI
IRET


START:


PUSH DS
PUSH CS
POP DS
LEA DX, ROUTINE05h
MOV AH, 25h
MOV AL, 05h
CLI
INT 21h
STI
POP DS


FINSTART:


MOV AX, 4C00h
INT 21h


END START
0
BLUEBIBUBBLE Messages postés 116 Date d'inscription samedi 4 juin 2005 Statut Membre Dernière intervention 10 avril 2013 1
20 mars 2006 à 00:11
Il ne faut pas détourner l'int 1Ch (qui n'est appellée par le système une seule fois par heure!), seule l'int 05h doit être détournée.
La nouvelle procédure int 05h (print screen) doit contenir la lecture et l'affichage de l'heure
Il est possible de terminé la routine avec un jmp cs:OldInt05 si on défint:

OldInt05 LABEL DWORD
Int05ofs DW ?
Int05seg DW ?
0
Rejoignez-nous