home *** CD-ROM | disk | FTP | other *** search
- ;* ------------------------------------------------------- *
- ;* GETKEY.TSR *
- ;* Assemblerroutine zum Einbinden ins TSR Gerüstprogramm *
- ;* (c) 1992 Ralph Seelig & DMV-Verlag *
- ;* ------------------------------------------------------- *
-
- prgnam db ' GetTastCode 1.0 ',0
- escmeld db ' ESC für Ende ',0
- text1 db ' Scancode : ',0
- leer db ' h ',0
- scrpuffer db 961 dup (?)
- aktseite db ?
- scrofs dw ?
-
- WriteHex proc
- ; gibt den Wert in AX hexadezimal aus
- ; AX => Wert
- ; DL,DH => Cursorposition (x,y)
- ; BL => Farbattribut
- push ax
- mov si,ax
- mov bh,aktseite
- mov ah,02h
- int 10h ; Cursor positionieren
- mov cx,4 ; 4 Rol Befehle vorbereiten
- wrhloop:
- push cx
- mov cl,4
- rol si,cl ; Ziffern verschieben
- mov ax,si
- and al,0fh ; andere Ziffern ausblenden
- add al,48 ; numerisch => alphanum.
- cmp al,58 ; Wert im Bereich von A..F
- jb kleiner10 ; dann weiteren Wert
- add al,7 ; hinzuaddieren
- kleiner10:
- mov ah,09h
- mov cx,1
- int 10h ; 1 Zeichen anzeigen
- inc dl ; x - Koordinate +1
- mov ah,02h
- int 10h
- pop cx
- loop wrhloop
- pop ax
- ret
- WriteHex endp
-
- WriteAsciiZ proc
- ; gibt einen String aus, der mit einem 0 Byte
- ; abgeschlossen ist
- ; BL => Farbe
- ; DL,DH => Cursorposition (x,y)
- ; DS:SI => Adresse des Strings
- push dx
- mov bh,aktseite
- wraloop:
- mov ah,02h
- int 10h
- lodsb ; Zeichen laden
- cmp al,0 ; war es das 0 Byte
- jz wraende ; dann Routine beenden
- mov cx,1
- mov ah,09h
- int 10h ; Zeichen anzeigen
- inc dl ; x - Koordinate + 1
- jmp wraloop
- wraende:
- mov ah,02h
- int 10h
- pop dx
- ret
- WriteAsciiZ endp
-
- Screen proc
- ; Bildschirmaufbau, gibt verschiedene Texte aus
- mov cx,6
- mov dl,45
- mov bh,aktseite
- mov bl,47h
- lom1: ; Teilbereich farbig
- push cx ; löschen
- mov dh,cl
- dec dh
- mov ah,02h
- int 10h ; Cursor setzen
- mov cx,32
- mov ah,09
- mov al,20h ; AL = Leerzeichen
- int 10h ; Zeichen ausgeben
- pop cx
- loop lom1
- mov dh,1
- mov dl,46
- mov bl,4eh
- mov si,offset prgnam
- call WriteAsciiZ
- inc dh
- mov si,offset escmeld
- mov bl,47h
- call WriteAsciiZ
- inc dh
- inc dh
- mov si,offset text1
- call WriteAsciiZ
- mov dl,60
- mov bl,1fh
- mov si,offset leer
- call WriteAsciiZ
- ret
- Screen endp
-
- TsrProgram proc
- ; eigentliches residentes Programm
-
- mov ah,0fh
- int 10h ; aktuellen Vidomode holen
- cmp al,4 ; Grafikmodi ?
- jb erlaubt
- mov dl,7 ; dann TSR Start verhindern
- mov ah,2
- int 21h ; Ton ausgeben
- ret
- erlaubt:
- push es
- xor dx,dx
- mov es,dx
- mov word ptr ax,es:[044eh] ; Bildschirmoffset holen
- mov scrofs,ax
- mov byte ptr al,es:[0462h] ; aktuelle Seite holen
- mov aktseite,al
- pop es
- mov ah,03h
- mov bh,al ; aktuelle Seite
- int 10h
- push dx ; Cursorposition retten
- mov di,offset scrpuffer ; Zeiger auf Puffer
- push ds
- pop es ; ES=DS
- mov ax,0b800h ; Segment der Videokarte
- push ax ; Wert retten
- mov si,ScrOfs ; Offset der akt. Seite
- mov ds,ax
- mov cx,960 ; 960 Bytes
- rep movsb ; vom Bildschirm retten
- push es
- pop ds ; DS wieder herstellen
- call screen
- xor ax,ax
- GetKey:
- mov dh,4 ; y und
- mov dl,61 ; x Position setzen
- mov bl,1fh ; Farbe setzen
- call WriteHex ; Zeichen anzeigen
- xor ax,ax
- int 16h ; Tastencode holen
- cmp al,1bh ; war es <ESC>
- jnz GetKey ; wenn nicht, dann nochmal
- pop es ; Segment der Videokarte
- mov di,ScrOfs
- mov si,offset scrpuffer
- mov cx,960 ; Bildschirmausschnitt
- rep movsb ; restaurieren
- pop dx ; Cursorposition holen
- mov bh,aktseite
- mov ah,02h
- int 10h ; Cursor setzen
- ret
- TsrProgram endp
-