page 60,132 tritle "SCR2TXT.ASM" ;*************************************************************************** ; SCR2TXT.ASM ;--------------------------------------------------------------------------- ;DESCRIZIONE: riprogrammazione dell'INT 05h collegato al tasto print screen. ; il file deve essere compilato come un file .com in modo che DS=CS ;--------------------------------------------------------------------------- ;------------ INIZIO SEGMENTO DI CODICE ------------------------------------ CODE SEGMENT ORG 0100H ; COM file origin ASSUME CS:CODE,DS:CODE,ES:CODE,SS:CODE ENTRY: jmp INSTALLA _INT05h: sti push ax push bx push cx push dx push si push di push ds push es push cs pop ds ;codice e dati nello stesso segmento push cs pop es ;---------------------------------------- ;apertura del file ed eventuale creazione ;---------------------------------------- ;ricerca esistenza file mov cx,20h ;archivio mov dx,OFFSET path mov ah,4Eh ;cerca file int 21h lahf ;flag in AH and ah,1 ;mask tutti tranne CF cmp ah,1 ;se CF = 1 => non trovato? je CREA ;apertura file mov al,2 ;read/write mov ah,3Dh ;apro file int 21h push ax ;salvo il file handle ;vado alla fine del file mov bx,ax xor cx,cx ;cx:dx offset dall'inizio file xor dx,dx mov al,2 ;andare fine -CX:DX mov ah,42h ;muovo file pointer int 21h jmp OK CREA: mov ah,3Ch ;creazione file int 21h push ax ;salvo il file handle mov bx,ax ;file handler ;SCRIVO LA LINEA DI INIZIO mov cx,84 ;80 car + fineriga mov dx,OFFSET startscr ;DS:DX buffer da scrivere mov ah,40h int 21h OK: pop bx ;ripristino file handler push bx ;salvo file handle ;trasferisco una riga per volta dalla memoria ;video leggendo un byte si ed uno no per ;evitare di leggere anche il colore mov dx,OFFSET buffer ;DS:DX buffer da scrivere xor SI,SI ;DS:SI inizio area video mov CS:righe,25 NEWROW: mov DS,video ;area video mov DI,1+OFFSET buffer ;ES = CS mov CS:col,80 RDROW: ;mov ax,[SI] ;debug movsb ;ES:DI<-DS:SI inc SI ;salto il colore ;mov ah,CS:[DI-1] ;debug dec cs:col jnz RDROW ;fino a fine riga push cs ;cambio ds pop ds ; ;SCRIVO NEL FILE LA RIGA LETTA mov cx,84 ;80 car + fineriga mov ah,40h ;ds:dx buffer da scrivere int 21h dec cs:righe jnz NEWROW ;per tutte le righe ;SCRIVO LA LINEA DI SEPARAZIONE mov cx,84 ;80 car + fineriga mov dx,OFFSET finescr ;DS:DX buffer da scrivere mov ah,40h int 21h pop bx mov ah,3Eh ;chiusura file int 21h mov cx,3000 BEEP: mov ax,3 out 61h,ax loop BEEP xor ax,ax out 61h,ax FINE: pop es pop ds pop di pop si pop dx pop cx pop bx pop ax cli iret ;------------------------------------------------------------------------- ; VARIABILI DI MEMORIA ;......................................................................... righe DB 25 ;numero righe col DB 80 ;numero colonne buffer DB 186 DB 80 DUP(" ") DB 186 DB 10,13 ;una riga di testo finescr DB 204,"@","i",78 DUP(205),185,10,13 startscr DB 201,80 DUP(205),187,10,13 video DW 0B800h ;indirizzo memoria video path DB "SCHERMO.TXT",00 ;nome ASCIIZ PROTECT EQU $-ENTRY ;fine tsr mess DB 10,13," Premere Shift+PrtScr per aggiungere" mess1 DB " al file SCHERMO.TXT",10,13 mess2 DB " la videata 80x25 desiderata",10,13,10,13 mess3 DB " SCR2TXT !!",10,13,"$" INSTALLA: push ax push dx push ds push cs pop ds mov dx,OFFSET _INT05h mov ah,25h ;set new interrupt mov al,05h ;printscreen int 21h mov dx,OFFSET mess mov ah,09h int 21h pop ds pop dx pop ax ;esco al DOS proteggendo la routin in memoria MOV AH,49 ;codice del servizio richiesto MOV AL,0 ;nessun errore riportato in uscita MOV DX,((OFFSET PROTECT + 15)/16)+16 INT 21H CODE ENDS END ENTRY