home *** CD-ROM | disk | FTP | other *** search
- ;* ------------------------------------------------------- *
- ;* HELP.ASM *
- ;* Residentes Help-Tool *
- ;* (c) 1989 Meik Stoll & TOOLBOX *
- ;* ------------------------------------------------------- *
-
- BIOS SEGMENT AT 0
- ORG 417h
- shiftflag DB ?
- BIOS ENDS
-
- CODE SEGMENT
- ASSUME CS:CODE, DS:CODE, ES:BIOS, SS:CODE
-
- ORG 80h
-
- cmdlen DB ?
- cmd DB ?
- filename DB ?
-
- ORG 100h
-
- dos MACRO nummer
- MOV AH,nummer
- INT 21h
- ENDM
-
- print MACRO text
- MOV DX,OFFSET text
- DOS 9
- ENDM
-
- ;* ------------------------------------------------------- *
-
- interrupt = 5h
-
- main: jmp begin
-
- card db ? ; 7 = Herc, sonst CGA
- cardseg dw ? ; Segment Grafikkarte
-
- oldvec dw ?,? ;Alter PRTSC-Vektor
-
- busy dw ? ;Flag für beschäftigt
-
- handle dw ?
- filelen dw ? ;Länge der HELP-Datei
-
- suchwort db 80 dup (?)
- laenge dw ?
-
- spalte db ?
- zeile db ?
- ofs dw ?
-
- msg db 13,10,'HELP',13,10
- db '(c) 1989 Meik Stoll & TOOLBOX',13,10
- db 'Aufruf mit SHIFT + SHIFT + PRTSC'
- db 13,10,13,10,'$'
-
- errormsg db 'Aufruf von MS-DOS: '
- db 'HELP [Laufwerk:][Pfad]Dateiname'
- db 13,10,'$'
-
- msgerr db 'Fehler!!!',13,10
- db 'HELP wurde nicht '
- db 'resident installiert!!!'
- db 13,10,'$'
-
- begin: print msg ; MSG drucken
- cmp cmdlen,0
- jnz ok1
- jmp fehler
- ok1: call loadfile
- mov ah,15 ; Videomodus holen
- int 10h
- mov card,al ; mitsp. in card
- cmp al,7
- je herc
- mov cardseg,0b800h ; CGA-Seg. setzen
- jmp skip
- herc: mov cardseg,0b000h ; Herc.Seg.setzen
- skip: mov al,interrupt ; Alte Interrupt-
- dos 35h ; Adresse merken ...
- mov oldvec[0],bx
- mov oldvec[2],es
- mov al,interrupt ; ... und neue setzen
- mov dx,offset new28h
- dos 25h
- mov busy,0
- mov dx,offset prgend ; Anz. Par. in DX
- add dx,filelen ; Dateilänge dazu
- mov cl,4
- shr dx,cl
- add dx,3
- mov al,0 ; Errorlevel=0
- dos 31h ; TSR
- fehler: print errormsg
- mov ax,4c01h
- int 21h
-
- loadfile proc near
- mov si,offset cmd ; CR durch #0 ers.
- dec si
- lf1: inc si
- cmp byte ptr [si],13
- jnz lf1
- mov byte ptr [si],0
-
- mov ax,3d00h ; Datei öffnen
- mov dx,offset filename
- int 21h
- jc error
- mov handle,ax
-
- mov ax,4202h ; Länge feststellen
- mov bx,handle
- xor cx,cx
- xor dx,dx
- int 21h
- jc error
- mov filelen,ax
-
- mov ax,4200h ; Wieder auf 0 pos.
- mov bx,handle
- xor cx,cx
- xor dx,dx
- int 21h
- jc error
-
- mov bx,handle ; Datei lesen
- mov cx,filelen
- mov dx,offset datei
- dos 3fh
- jc error
-
- mov bx,handle ; Datei schließen
- dos 3eh
- jc error
-
- ret
- loadfile endp
-
- error: print msgerr
- mov ax,4c01h
- int 21h
-
- savescreen proc near
- mov cx,4000 ; 4000 Zeichen
- mov ax,cs:cardseg ; Card-Segment in DS
- mov ds,ax
- mov ax,cs ; Puffer-Seg. in ES
- mov es,ax
- xor si,si ; Start bei Offset 0
- mov di,offset buffer ; Start bei
- ; Offset. v. Buffer
- cld ; nach oben kopieren
- repz movsb ; und los geht's ...
- ret
- savescreen endp
-
- loadscreen proc near
- mov cx,4000 ; 4000 Zeichen
- mov ax,cs ; Puffer-Seg. in DS
- mov ds,ax
- mov ax,cs:cardseg ; Card-Seg. in ES
- mov es,ax
- mov si,offset buffer ; Kopierstart bei
- ; Offset von Buffer
- xor di,di ; Start bei Offset 0
- cld ; nach oben kopieren
- repz movsb ; und los geht's
- ret
- loadscreen endp
-
- search proc near ; Suchwort suchen
- mov ax,cs
- mov ds,ax
- mov si,offset suchwort
- mov di,offset datei
- xor cx,cx
- search2: mov al,[di]
- cmp al,26
- jz eof
- cmp al,[si] ; Buchstabe mit
- jz search1 ; Suchwort vergl.
- xor al,32 ; in UPPER/LOWER-
- ; Case umwandeln
- cmp al,[si] ; und vergleichen
- jz search1
- inc di
- xor cx,cx
- mov si,offset suchwort
- jmp short search2
-
- eof: mov ax,1
- ret
-
- search1: inc cx
- cmp cx,laenge
- jz found
- inc si
- inc di
- jmp short search2
-
- found: add di,3
- mov bx,di
- xor ax,ax
- ret
- search endp
-
- help proc near
- mov cs:suchwort,'#' ; '#' als Anfang
- ; für Suchwort
- mov ah,3 ; Cursorpos.
- mov bh,0 ; feststellen
- int 10h
- mov cs:zeile,dh
- mov cs:spalte,dl
- mov al,cs:zeile ; Offset des
- xor ah,ah ; Cursors berechnen
- mov cx,160
- mul cx
- mov bl,cs:spalte
- xor bh,bh
- shl bx,1
- add ax,bx
- mov cs:ofs,ax
- mov ax,cs:cardseg
- mov es,ax
- mov bx,cs:ofs
-
- scan: dec bx ; Suchwort festst.
- dec bx
- cmp byte ptr es:[bx],'A'
- jl no
- cmp byte ptr es:[bx],'z'
- jg no
- cmp byte ptr es:[bx],'Z'
- jle scan
- cmp byte ptr es:[bx],'a'
- jge scan
-
- no: inc bx ; es:[bx]=bildschirm
- inc bx
- mov bp,offset suchwort+1 ; ds:[bp]=
- mov ax,cs ; suchwort im
- mov ds,ax ; speicher
-
- no2: mov ax,es:[bx] ; von bildschirm in
- mov ds:[bp],ax ; speicher kopieren
- inc bx
- inc bx
- inc bp
- cmp byte ptr es:[bx],'A'
- jl no1
- cmp byte ptr es:[bx],'z'
- jg no1
- cmp byte ptr es:[bx],'Z'
- jle no2
- cmp byte ptr es:[bx],'a'
- jge no2
-
- no1: mov byte ptr ds:[bp],'#' ; #=Ende
- ; des Suchworts
- dec bp
- sub bp,offset suchwort-2
- mov cs:laenge,bp ; Länge des
- ; Suchworts speichern
-
- call search ; Suchwort suchen
- cmp ax,1
- jz notfound
-
- push bx ; Textstelle sichern
- mov ah,15 ; Bildschirm löschen
- int 10h
- xor ah,ah
- int 10h
- pop bx ; Textstelle wieder
- ; holen
-
- no21: mov al,[bx] ; Gefundenen Text
- mov ah,0eh ; ausgeben
- push bx
- mov bx,0
- int 10h
- pop bx
- inc bx
- cmp word ptr [bx],'$$' ; Ende?
- jnz no21
-
- mov cx,80 ; 80 mal '-' ausgeben
- no6: push cx
- mov ah,0eh
- mov al,196
- mov bx,0
- int 10h
- pop cx
- loop no6
-
- mov ah,0 ; Auf Tastendruck
- int 16h ; warten
-
- no30: mov bx,0 ; alte Cursorpos.
- mov ah,2 ; setzen
- mov dh,cs:zeile
- mov dl,cs:spalte
- int 10h
-
- helpback: ret
-
- notfound: mov ah,0eh ; BELL, wenn nicht
- mov al,7 ; gefunden
- mov bx,0
- int 10h
- jmp short no30
- help endp
-
- new28h proc far
- pushf ; Alles sichern
- push ax
- push bx
- push cx
- push dx
- push si
- push di
- push ds
- push es
- push bp
- xor ax,ax
- mov es,ax
- mov al,es:shiftflag ; Test, ob beide
- and al,3 ; SHIFT-Tasten
- cmp al,3 ; gedrückt sind
- jnz back
- cmp cs:busy,1
- jz back
- mov cs:busy,1
- call savescreen
- call help
- call loadscreen
- pop bp ; alles wieder
- pop es ; holen
- pop ds
- pop di
- pop si
- pop dx
- pop cx
- pop bx
- pop ax
- popf
- mov cs:busy,0 ; und zurück
- iret
- back: pop bp
- pop es ; normale
- pop ds ; PRTSC-Routine
- pop di
- pop si
- pop dx
- pop cx
- pop bx
- pop ax
- popf
- jmp dword ptr cs:[oldvec]
- new28h endp
-
-
- buffer db 4096 dup(?) ; Screen-Buffer
-
- prgend:
-
- datei: ; Hier wird die HELP-Datei
- ; abgelegt.
- code ends
- end main
-
- ;* ------------------------------------------------------- *
- ;* Ende von HELP.ASM *