home *** CD-ROM | disk | FTP | other *** search
- ;***********************************************************
- ;* POSTSHOT.ASM: PostScript-Snapshot für MCGA-Modus *
- ;* Assemblieren mit Microsoft MASM ab Version 5.0 oder *
- ;* einem kompatiblen Assembler. *
- ;* Anschließend EXE-File mit dem DOS-Programm EXE2BIN in *
- ;* ein COM-File umwandeln. *
- ;* (C) 1990 Ulrich Schmitz & TOOLBOX *
- ;***********************************************************
-
- TITLE POSTSHOT.ASM
-
- intnr equ 5h ;PrintScreen-Vektor
- CR equ 13
- LF equ 10
- Kopfbytes equ 324
- ;------------------------- M A K R O S --------------------
-
- CR_LF MACRO
- ;- CR und LF in Datei schreiben
- mov bx, Handle
- mov cx, 2 ;20 Bytes
- mov ax, CS
- mov DS, ax
- mov ah, 40h ;Funktionsnummer
- mov dx, OFFSET Crlf
- int 21h ;Datei beschreiben
- ENDM
-
- GET_VIDEO MACRO
- ;- liest den Videomodus aus
- mov ah, 0Fh
- int 10h
- ENDM
-
- ;-----------------------------------------------------------
- code segment para
- assume cs:code, ds:code, es:code
- org 100h
-
- anfang:
- jmp install
-
- ;--- Daten -------------------------------------------------
-
- intsave EQU THIS DWORD
- Handle DW '??'
- Dateiname DB 'PICTURE.EPS', 0
-
-
- ;-- Kopfdaten
- Kopf DB '%!PS-Adobe-2.0 EPSF-1.2', CR, LF
- DB '%%BoundingBox: 27 540 387 765', CR, LF
- DB '%%Creator: POSTSHOT by'
- DB ' Ulrich Schmitz & toolbox', CR, LF
- DB '%%Title: PICTURE.EPS', CR, LF
- DB '%%EndComments' , CR, LF
- DB 'gsave', CR, LF
- DB '/picstr 320 string def', CR, LF
- DB '27 765 moveto', CR, LF
- DB '360 225 scale', CR, LF
- DB '0 -1 rmoveto', CR, LF
- DB 'currentpoint translate', CR, LF
- DB '320 200 8', CR, LF
- DB '[320 0 0 -200 0 200]', CR, LF
- DB '{ currentfile picstr readhexstring pop }'
- DB CR, LF
- DB 'image', CR, LF
- ;-- 20 Bytes Kopfende
- Kopfende DB 'grestore', CR, LF
- DB 'showpage', CR, LF
- Punkt DB '*'
- Crlf DB 13, 10
- Zeile DB 1
- Vga DW 0A000h ;VGA-Bildschirmadresse
- Z_Offset DW 0
- Kennung DW '**'
-
- ;--- Eigene Interruptroutine -------------------------------
- einsprung:
- pushf
- push ax
- push bx
- push cx
- push dx
- push di
- push si
- push ES
- push DS
-
-
- ;--- richtiger Videomodus? ---------------------------------
- GET_VIDEO
- cmp al, 13h ;256 Farben, 320 x 200 Punkte
- je los_gehts
- jmp bye_bye ;unzulässiger Video-Modus
- los_gehts:
- ;--- Datei anlegen -----------------------------------------
- mov ah, 3Ch
- mov bx, CS
- mov DS, bx
- mov dx, OFFSET Dateiname
- mov cx, 0
- int 21h
- mov Handle, ax
-
- ;--- Postscript-Kopf schreiben (für 8 Bit/Punkt, 320 x 200)
- mov bx, Handle
- mov cx, Kopfbytes ;Anzahl Kopf-Bytes
- mov ax, CS
- mov DS, ax
- mov ah, 40h ;Funktionsnummer
- mov dx, OFFSET Kopf
- int 21h ;Datei beschreiben
-
- ;--- Bilddaten aus Bildschirmspeicher schreiben ------------
-
- sub di, di
- mov ax, Vga
- mov ES, ax ;ES initialisieren
- anfang_1:
- mov bx, CS:Z_Offset
- mov al, ES:[di+bx]
- mov cl, 4 ;um 4 Bits
- shr al, cl ;0000 1111
- sub si, si ;si = 0
- mov ah, 0
- weiter_1:
- cmp ax, si
- je ende_1
- inc si
- jmp weiter_1
- ende_1:
- add al, 48 ;+48 -> ASCII-Wert
- cmp al, 57 ;Wert 0 - 9
- jle ende_11
- add al, 7 ;Wert A - F
- ende_11:
- mov Punkt, al
-
- ;--- high Halb-Byte in Datei schreiben ---------------------
- mov bx, Handle
- mov cx, 1 ;1 Byte
- mov ax, CS
- mov DS, ax
- mov ah, 40h ;Funktionsnummer
- mov dx, OFFSET Punkt
- int 21h ;Datei beschreiben
-
- anfang_2:
- mov ax, Vga
- mov ES, ax
- mov bx, CS:Z_Offset
- mov al, ES:[di+bx]
- mov cl, 4 ;um 4 Bits
- shl al, cl ;Punktbyte in ax
- mov cl, 4
- shr al, cl ;Halbbyte isoliert
- sub si, si ;si = 0
- mov ah, 0
- weiter_2:
- cmp ax, si
- je ende_2
- inc si
- jmp weiter_2
- ende_2:
- add al, 48 ;+48 -> ASCII-Wert
- cmp al, 57 ;Wert 0 - 9
- jle ende_22
- add al, 7
- ende_22:
- mov Punkt, al
-
- ;--- low Halb-Byte in Datei schreiben ----------------------
- mov bx, Handle
- mov cx, 1 ;1 Byte
- mov ax, CS
- mov DS, ax
- mov ah, 40h ;Funktionsnummer
- mov dx, OFFSET Punkt
- int 21h ;Datei beschreiben
-
- ;------**
- inc di
- cmp di, 320 ;eine Zeile (320 Bytes)
- jl anfang_1
- CR_LF ;Carriage Return und Linefeed
- CR_LF
- mov ah, 0
- mov al, CS:Zeile
- cmp ax, 200 ;ganzes Bild gespeichert?
- jge fertig
- inc al
- mov CS:Zeile, al
- mov ax, CS:Z_Offset
- add ax, 320 ;di + Zeilen_Offset + ES
- mov CS:Z_Offset, ax
- sub di, di
- jmp anfang_1
- fertig:
- CR_LF
-
- ;--- Kopf-Ende schreiben
- mov bx, Handle
- mov cx, 20 ;20 Bytes
- mov ax, CS
- mov DS, ax
- mov ah, 40h ;Funktionsnummer
- mov dx, OFFSET Kopfende
- int 21h ;Datei beschreiben
-
-
- ;--- Datei schließen ! ------
- mov ah, 3Eh
- mov bx, Handle
- int 21h
-
- ;----------------------------
-
- bye_bye:
-
- ;--- Variablen zurücksetzen
- mov CS:Zeile ,1
- mov CS:Z_Offset ,0
- mov CS:Vga ,0A000h
-
- pop DS
- pop ES
- pop si
- pop di
- pop dx
- pop cx
- pop bx
- pop ax
- popf
-
- iret
- ;--- bis hier wird das Programm resident gelassen !! -------
- install:
-
- ;--- Vektor frei? - - - - - - - - - - - - - - - - - - - -
- mov ah, 35h
- mov al, intnr
- int 21h ;Get Interrupt Vektor
- mov al, ES:[bx] ;Anfang Interrupt-Routine
- cmp al, 0CFh ;IRET ?
- je continue ;installiere Programm
-
- ;--- Programm schon installiert? - - - - - - - - - - - -
- dec bx ;residente Daten sind vor Code
- mov al, ES:[bx]
- cmp al, '*' ;schon installiert?
- jne continue
- mov ah, 4Ch
- int 21h ;Programm beenden
-
- continue:
- ;--- INT auf eigene Routine verbiegen
- mov dx,offset einsprung
- mov ax,2500h+intnr
- int 21h
-
- ;--- Anzahl der resident bleibenden Paragraphen berechnen
- mov dx,offset install
- mov cl,4
- shr dx,cl
- inc dx
-
- mov ax,3100h
- int 21h
-
- code ends
- end anfang
-
- ;** ENDE POSTSHOT.ASM **************************************
-
-