13e1 TITLE MCGADump.ASM ;==== ;==== Dumps MCGA screens (640x480x256) to disk ;==== ;-------------------------------------------------------------------- CSEG SEGMENT ASSUME CS:CSEG,DS:CSEG ORG 100H Start: jmp install_TSR ;================================ Org_Rutin DD ? ;================================ vidseg dw 0A000h ;------------------------------------------------------------------- Start_TSR: ;H„r startar den programkod som ;kommer att bli minnesresident Our_Layer PROC FAR ASSUME CS:CSEG,DS:CSEG ;M†ste deklareras i denna del som ;f”rblir i minnet push ds ;DS-registrets v„rde sparas f”r ;att †terh„mtas vid †terhoppet push cs ;Under arbetet i 'Our_Layer' m†ste pop ds ;DS ha samma v„rde som CS annars ;kommer l„sning/skrivning fr†n/till ;minne att g† till fel datasegment sti ;F”r ordningens skull f”r att ;m”jligg”ra nytt interrupt pushf ;ett INT simuleras call Org_Rutin ;Originalrutinen anropas ;--------------------------------------------------------------------- ; Till denna punkt †terkommer vi sedan originalrutinen exekverats ;--------------------------------------------------------------------- call ScrDump pop ds ;Det v„rde DS hade vid inhopp ;†terh„mtas iret ;Kontrollen tillbaka till ;anropande program (DOS) Our_Layer ENDP ScrDump PROC NEAR ASSUME CS:CSEG,DS:CSEG push ax push bx push cx push dx mov ah,3ch ; create dump file mov cx,00h mov dx,offset fname int 21h mov ah,03dh ;Open for writing mov al,01h int 21h mov handle,ax mov cx,256 mov DACreg,0 savepal: push cx mov ah,10h ;Save DAC palette mov al,15h mov bh,00 mov bl,DACreg int 10h inc DACreg mov red,dh mov green,ch mov blue,cl mov ah,40h mov bx,handle mov cx,1 mov dx,offset red int 21h mov ah,40h mov cx,1 mov dx,offset green int 21h mov ah,40h mov cx,1 mov dx,offset blue int 21h pop cx loop savepal ; mov ch,green ;ch=green value ; mov cl,blue ;cl=blue value ; mov dh,red ;dh=red value mov ah,40h ;Write screen to dump file mov cx,64000 ;64000 bytes mov ds,vidseg ;MCGA video adress mov dx,0 ;Start of segment int 21h mov ah,3eh ;Close the dump file int 21h pop dx pop cx pop bx pop ax ret ScrDump ENDP handle dw 0 red db 0 green db 0 blue db 0 DACreg db 0 fname db 'MCGA.DMP',0 ;---------------------------------------------------------------------- End_TSR: ;Minnesresident del slut ;======================================================================= msgstr db 'MCGADump Installed. Press Alt-PrtScr to grab screen',13,10,'$' Install_TSR: ASSUME CS:CSEG,DS:CSEG mov ah,09h mov dx,offset msgstr int 21h push cs ;DS m†ste peka p† r„tt segment pop ds ;d† vi skall ladda om vektorn mov al,05h ;H„mta vektorn till INT 05 (PrintScr) mov ah,35h int 21h mov word ptr Org_Rutin,BX ;Org_Rutinens OFFSET h„mtas mov word ptr Org_Rutin+2,es ;Segment sparas mov dx,OFFSET Start_TSR ;Peka p† v†rt skikt mov al,05h ;Int 05h mov ah,25h ;Ladda om vektor int 21h mov dx,OFFSET End_TSR ;Peka p† slutet p† den del som ;skall bli minnesresident int 27h ;G”r minnesresident ;------------------------------------------------------------------------- CSEG ENDS END Start ;-------------------------------------------------------------------------- . 0