home *** CD-ROM | disk | FTP | other *** search
- ;* ------------------------------------------------------- *
- ;* UHR.TSR *
- ;* Uhrroutine zum Einbinden in das TSR Gerüstprogramm *
- ;* (c) 1992 Ralph Seelig & DMV-Verlag *
- ;* ------------------------------------------------------- *
-
- scrpuffer db 160 dup (?)
- aktseite db ?
- scrofs dw ?
-
-
- WriteByte proc
- ; gibt eine Zahl zwischen 0 .. 99 dezimal aus
- ; AL = Zahl
- ; DL,DH = Koordinate
- push cx
- push bx
- xor ah,ah
- mov bh,al
- mov bl,100
- div bl ; AL= int(AL / 100)
- mul bl ; AL= int(AL / 100) * 100
- sub bh,al ; 100 er löschen
- mov al,bh ; AL enthält nur Zahlen zwischen 0..99
- xor ah,ah
- mov bl,10 ; Teilerfaktor
- mov bh,al
- mov cx,2
- wrbl:
- push cx
- div bl
- push ax
- push bx
- mov bh,aktseite
- mov ah,02
- int 10h ; Cursor setzen
- inc dl ; x Position erhöhen
- add al,48 ; numerisch => alphanumerisch
- mov ah,09
- mov cx,1
- mov bl,07h ; Farbattribut
- int 10h ; Zeichen setzen
- pop bx
- pop ax
- mul bl
- sub bh,al ; höherwertige Stelle löschen
- mov al,bh
- mov bl,1
- pop cx
- loop wrbl
- pop bx
- pop cx
- ret
- WriteByte endp
-
- TsrProgram proc
- ; speicherresidente Uhrroutine
- 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 Screenseite
- 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 Bildschirmseite
- mov ds,ax
- mov cx,160 ; 160 Bytes
- rep movsb ; vom Bildschirm retten
- push es
- pop ds ; DS wieder herstellen
-
- ; eigentliches Programm
-
- xor dh,dh
- mov dl,72 ; x - Position festlegen
- mov cx,2
- SetDPunkt:
- push cx
- push dx
- mov bh,aktseite
- mov ah,02h
- int 10h ; Cursor setzen
- mov cx,1
- mov ah,09
- mov bl,7
- mov al,':'
- int 10h ; einen Doppelpunkt anzeigen
- pop dx
- add dl,3 ; x Position erhöhen
- pop cx
- loop SetDPunkt
- xor bx,bx
- UhrLoop:
- mov ah,2ch
- int 21h
- cmp dh,bl ; eine Sekunde weiter
- jz UhrLoop ; nein, dann nochmal Uhrzeit holen
- mov bl,dh ; Sekunden nach BL
- push dx ; Sekunden retten
- mov al,ch ; Stunden nach AL
- xor dh,dh
- mov dl,70 ; x Position
- call WriteByte
- inc dl ; x Position incrementieren
- mov al,cl ; Minuten nach AL
- call WriteByte
- pop ax ; Sekunden restaurieren
- mov al,ah
- inc dl ; x Position
- call WriteByte
- mov ah,01h
- int 16h ; ist Taste gedrückt worden ?
- jz Uhrloop ; nein, dann weiter Uhr anzeigen
- xor ax,ax
- int 16h
-
- pop es ; Segment der Videokarte
- mov di,scrofs
- mov si,offset scrpuffer
- mov cx,160 ; Bildschirmausschnitt
- rep movsb ; restaurieren
- pop dx ; Cursorposition holen
- mov bh,aktseite
- mov ah,02h
- int 10h ; Cursor setzen
- ret
- TsrProgram endp
-