IDEAL ; Ideal-Modus des Turbo Assemblers einschalten MODEL SMALL ; Speichermodell = SMALL w„hlen ; SAVE.ASM : Speichert Bildschirmausschnitt in Pointer-Variable ; ; Autor: Frank Riemenschneider ; Anpassung an Turbo C: Michael Schuschk CODESEG DEBUG equ 1 PUBLIC _Save PROC _Save FAR ARG spseg: word, spofs: word, groesse: word, x1: word, y1: word, x2: word, y2: word push bp mov bp, sp push ax push bx push cx push si push di push ds push es mov ax,[spseg] mov ds,ax mov di,[spofs] ;Speicheradresse Pointer laden mov ax,[di+2] ;Segment Speicherbereich holen mov es,ax mov di,[di] ;Offset Speicherbereich holen mov ax,[groesse] ;Gr”áe reservierter Breich cld ;immer inkrementieren stosw ;speichern mov ax,[y1] mov bx, 160 mul bx ;Startadresse Video-RAM berechnen: mov bx,[x1] shl bx,1 ;Y1*160+X1*2 add ax,bx mov si,ax ;= Offset mov ax, 0B000h mov ds,ax ;Segmentadresse Videoram mov ax,[x1] stosw mov ax,[y1] ;Koordinaten abspeichern stosw mov ax,[x2] sub ax,[x1] ;(x2-x1+1) Bytes in X-Richtung inc ax mov bx,ax ;merken und stosw ;abspeichern mov ax,[y2] sub ax,[y1] inc ax ;(y2-y1+1) Bytes in Y-Richtung stosw ;abspeichern mov cx,ax ;Als Z„hler setzen Loop1: push cx push si mov cx,bx ;Anzahl X-Bytes holen rep movsw ;Speicherworte kopieren pop ax add ax,160 ;Neue Zeile anfangen mov si,ax pop cx loop Loop1 ;N„chste Zeile pop es pop ds pop di pop si pop cx pop bx pop ax mov sp, bp pop bp ret ENDP ; LOAD.ASM : L„dt Bildschirmdaten aus Pointer-Variablen ein ; ; Autor: Frank Riemenschneider ; Anpassung an Turbo C: Michael Schuschk PUBLIC _Load PROC _Load FAR ARG speseg: word, speofs: word push bp mov bp, sp push bx push cx push si push di push ds push es mov ax,[speseg] mov ds,ax mov si,[speofs] ;Speicheradresse Pointer laden mov ax,[si+2] ;Segment Speicherbereich holen mov si,[si] ;Offset Speicherbereich holen mov ds,ax cld lodsw ;Gr”áe reservierter Speicherbereich holen push ax ;und merken lodsw ;X-Koordinate holen mov bx,ax lodsw ;Y-Koordinate holen mov cx, 160 mul cx ;Startadresse Video-RAM berechnen: shl bx,1 ;Y1*160+X1*2 add ax,bx mov di,ax ;= Offset mov ax, 0B000h mov es,ax ;Segmentadresse Videoram lodsw ;Anzahl X-Bytes pro Zeile holen mov bx,ax ;Als Z„hler setzen lodsw ;Anzahl y-Bytes pro Zeile holen mov cx,ax Loop2: push cx push di mov cx,bx ;Anzahl X-Bytes holen rep movsw ;Speicherworte kopieren pop ax add ax,160 ;Neue Zeile anfangen mov di,ax pop cx loop Loop2 ;N„chste Zeile IFNDEF DEBUG mov ah,18 ;Bildschirm refreshen int 97 ENDIF pop ax ;Bereichsgr”áe zurckliefern pop es pop ds pop di pop si pop cx pop bx mov sp, bp pop bp ret ENDP END