; NEWINT.ASM : Neue Interrupt-Routine fr Int 21h ; ; Autor: Frank Riemenschneider IDEAL ; Ideal-Modus des Turbo Assemblers einschalten MODEL TPASCAL ; Speichermodell = TURBO PASCAL w„hlen CODESEG PROC Scroll NEAR push dx mov ah,06 ;Nach oben scrollen mov al,01 ;Um eine Zeile mov ch,[ylo] ;Obere Begrenzung mov cl,[xlo] ;Linke Begrenzung mov dh,[yru] ;Untere Begrenzung mov dl,[xru] ;Rechte Begrenzung mov bh,15 ;Farbe int 16 ;Scrollen pop dx ret ENDP DATASEG extrn xru : byte; extrn xlo : byte; extrn ylo : byte; extrn yru : byte; CODESEG PROC NewInt FAR PUBLIC NewInt cmp ah,14 ;Interrupt-Funtion prfen jnz altint ;Keine Zeichenausgabe, dann alter Interrupt push bx push cx push si push di push es push dx push ds push ax mov ax,0 mov ds,ax ;Datensegment aus Speicherstellen mov bx,[0024] ;$0000:$0018/$0000:$0019 holen mov ds,bx mov ah,03 ;Cursorposition holen mov bh,00 int 16 pop ax ;Zeichencode holen push ax cmp al,10 ;Linefeed ? jnz noline cmp [yru],dh ;Untere Begrenzung erreicht ? jna scrollen ;Ja, scrollen inc dh ;Zeile erh”hen jmp noscroll ;Sonderzeichen Ende noline: cmp al,13 ;Return ? jnz normal mov dl,[xlo] ;Cursor auf linke Begrenzung jmp noscroll ;Sonderzeichen Ende normal: cmp dl,[xru] jbe altezeile ;Rechte Fensterbegrenzung ? inc dh ;Ja, Zeile erh”hen mov dl,[xlo] ;Cursor auf linke Begrenzung altezeile: cmp [yru],dh ;unterer Fensterrand erreicht ? jnb noscroll ;Nein, noch nicht ! dec dh scrollen: call scroll ;Fenster um eine Zeile nach oben schieben noscroll: mov bh,00 mov ah,02 ;Cursor positionieren int 16 pop ax pop ds pop dx pop es pop di pop si pop cx pop bx cmp al,13 ;Bei RETURN oder jz newexit cmp al,10 ;Linefeed keinen alten Interrupt ! jz newexit altint: int 10 ;Alten Interrupt aufrufen newexit: iret ENDP ; SAVE.ASM : Speichert Bildschirmausschnitt in Pointer-Variable ; ; Autor: Frank Riemenschneider PROC Save FAR spseg : word, spofs : word, groesse : word, x1 : word, y1 : word, x2 : word, y2 : word PUBLIC Save 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,45056 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 ret ENDP ; LOAD.ASM : L„dt Bildschirmdaten aus Pointer-Variablen ein ; ; Autor: Frank Riemenschneider PROC Load FAR speseg : word, speofs : word PUBLIC Load 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,45056 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 mov ah,18 ;Bildschirm refreshen int 97 pop ax ;Bereichsgr”áe zurckliefern pop es pop ds pop di pop si pop cx pop bx ret ENDP END