|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 21760 (0x5500) Types: TextFile Names: »HELPD.MAC«
└─⟦01b5c9619⟧ Bits:30005906 Microsoft Multiplan v1.05 og HELP └─ ⟦this⟧ »HELPD.MAC«
title CP/M Help data module (danish) Ver.: 1.0 850915:1525 aseg .z80 ORG 00100H lf equ 0ah ;line feed cr equ 0dh ;carriage return bdos equ 5 ;CP/M entry tab equ 9 ;tabulate esc equ 1bh ;escape cls equ esc-1 ;clear screen cur_li equ '=' ;cursor lead in buffer equ 80h ;************************************************ ; * ; Initialize of program * ; * ;************************************************ CALL cmd2 ;Check for 2. cmd. JP NZ,A0126 ;skip if cmd. warmst: XOR A ;clear a A010D: ld sp,100h PUSH AF ;save status CALL scinit ;print sign on POP AF OR A CALL NZ,p_nlok ;error: no look-up word CALL getcmd ;get a command number ADD A,A ;command * 2 LD E,A ;move it into DE LD D,0 LD HL,cmdtab ;start of command index table ADD HL,DE ;calculate address of routine LD E,(HL) ;get address of routine into DE INC HL LD D,(HL) EX DE,HL ;Move it to HL JP (HL) ;Execute it ! ; ;************************************************ ; * ; * ; * ;************************************************ A0126: CALL lookui ;try to look it up internal PUSH HL CALL rdinxf ;open and read index file POP HL CALL A024E ;find word in index file LD A,1 ;set error flag JP NZ,A010D ;error: no look-up word LD (stinxw),HL ;save start of index word CALL A0262 ;open data file LD HL,(stinxw) ;get start of index word LD DE,17 ;offset for sector in index word ADD HL,DE ;add it LD E,(HL) ;DE = sector address INC HL LD D,(HL) INC HL LD A,(HL) ;get offset from sector start LD (offpnt),A DEC DE ;sector address -1 LD (fchman+33),DE CALL A03BC ;read 512 bytes (4 sectors) LD DE,(offpnt) ;E = offset from sector start LD D,0 LD HL,(datpnt) ;address of data buffer (start) ADD HL,DE ;include offset LD (datpnt),HL ;store in pointer LD HL,(rdleng) ;lenght of read AND A SBC HL,DE ;subtract offset LD (rdleng),HL ;save lenght of help word CALL clrhom ;clear screen CALL A0283 ; LD HL,txname ;'NAME' CALL ptxt CALL A03F1 ;print message LD HL,txsynt ;'SYNTAX' CALL ptxt CALL A03F1 ;print message LD HL,txdesc ;'DESCRIPTION' CALL ptxt CALL A03F1 ;print message LD HL,txexam ;'EXAMPLE' CALL ptxt CALL A03F1 ;print data LD HL,txeror ;'ERROR MESSAGES' CALL ptxt CALL A03F1 ;print message LD HL,txextr ;'EXTERNAL REF:' CALL ptxt CALL A03F5 ;print message JP warmst ;goto main menu lookui: POP IX ;get return address LD DE,ikntx1 ;ikon text 1 CALL A01D0 ;compare JP Z,ikon ;ikon menu LD DE,ikntx2 ;ikon text 2 CALL A01D0 ;compare JP Z,ikon ;ikon menu LD DE,martx1 ;markør text 1 CALL A01D0 ;compare JP Z,markor ;markør menu LD DE,komtx1 ;komando text 1 CALL A01D0 ;compare JP Z,comand ;komando menu JP (IX) ;return ;************************************************ ; * ; compare 2 strings * ; * ; entry: DE = reference * ; HL = data * ; exit: z = they match * ; nz = different * ;************************************************ A01D0: PUSH HL ;save entered entry start PUSH DE ;save ref. start A01D2: LD A,(DE) ;get character CP (HL) ;the same ? JR NZ,A01DD ;no => skip OR A ;zero ? JR Z,A01DD ;yes => skip (END) INC DE ;point to next INC HL JR A01D2 ;repeat A01DD: POP DE ;restore start of strings POP HL RET ;************************************************ ; * ; Open and read index file * ; * ;************************************************ rdinxf: LD A,(inxfl1) ;index file read flag OR A ;something allread read ? RET NZ ;yes => skip LD DE,FCHNDX ;file control block for index file CALL opfile JR Z,rderr ;error => skip LD DE,inxwsp ;index file wsp LD B,16 ;read 16 sectors rdinx1: PUSH BC PUSH DE LD C,26 ;set dma address CALL bdos LD DE,fchndx ;index file control block LD C,20 ;read next record CALL bdos POP DE POP BC OR A ;error ? JR NZ,rdinx2 ;yes => skip LD HL,128 ;sector lenght ADD HL,DE EX DE,HL DJNZ rdinx1 ;repeat until done LD A,0 LD (inxend),A ;set end of index rdinx2: LD A,1 ;set read index flag LD (inxfl1),A RET ;************************************************ ; * ; read / open error * ; * ;************************************************ rderr: LD hl,lin24 call ptxt ld hl,ndxnf ;index file not found A0221: call ptxt CALL getchr JP A04B6 ;************************************************ ; * ; Open file FCB address in DE * ; * ;************************************************ opfile: PUSH DE ;try to open it on default drive LD C,15 ;open file command CALL bdos POP DE ;restore FCB INC A ;error ? RET NZ ;no => skip PUSH DE ;save FCB LD A,1 ;try drive A: LD (DE),A LD C,15 ;open file command CALL bdos POP DE ;restore FCB INC A ;error ? RET NZ ;no => skip PUSH DE ;save FCB LD E,0 ;set user to 0 LD C,32 ;set/get user code CALL bdos POP DE ;restore FCB LD C,15 ;open file commnad CALL bdos INC A ;set flag RET ;************************************************ ; * ; look word up in index file * ; * ;************************************************ A024E: EX DE,HL ;seek word buffer start in DE LD HL,inxwsp ;start of index buffer LD BC,14H ;lenght of a index entry A0255: LD A,(HL) ;get a character OR A ;end of word ? JR Z,A0260 ;yes => skip CALL A01D0 ;compare (HL) to (DE) RET Z ;the same => skip ADD HL,BC ;else start of next index word JR A0255 ;repeat ;************************************************ ; * ; set end of index file flag * ; * ;************************************************ A0260: DEC A RET ;************************************************ ; * ; open data file * ; * ;************************************************ A0262: LD A,(datfl1) ;data file opend ? OR A RET NZ ;yes => skip LD DE,fchman ;else open HELP.MAN CALL opfile LD A,1 LD (datfl1),A ;set open flag RET NZ ;return if ok XOR A ;else clear flag LD (datfl1),A LD HL,T06A8 ;error HELP.MAN not found JP A0221 ;wait for keypress ;************************************************ ; * ; print help word * ; * ;************************************************ A0283: LD HL,loktxt ;start of line text LD DE,lokbuf ;buffer start LD BC,78 ;lenght LDIR LD HL,cmd2bf ;help word PUSH HL CALL A0323 ;find lenght POP HL PUSH HL LD C,B LD B,0 ;BC = lenght PUSH BC LD DE,lokbuf LDIR ;move help word into line text POP BC POP DE LD HL,lokbuf+55 ;second place on line AND A SBC HL,BC EX DE,HL LDIR ;move it LD HL,lokbuf ;start of buffer JP ptxt ;print it \f ;************************************************ ; * ; print out text routine * ; * ; entry: HL = start of text * ; * ; text is terminated with 0 (NULL) * ; * ;************************************************ ptxt: LD A,(HL) ;get charcter OR A ;end ? RET Z ;yes => skip CALL ptxt1 ;print charcter INC HL ;point to next JR ptxt ;repeat ptxt1: PUSH HL push de push bc ld e,a ;character to e cp lf ;is it line feed ? jr nz,ptxt2 ;no => skip ld hl,line ;line count inc (hl) ;adv counter ld a,(hl) cp 22 ;line 22 ? jr c,ptxt2 ;no => skip call getpag ;get a command xor a ld (hl),a ;clear counter ptxt2: ld c,2 ;console out call bdos pop bc pop de pop hl ret ;************************************************ ; * ; Ask for continue on line 23 * ; * ; And check for esc * ; * ;************************************************ getpag: push hl push de push bc ld hl,lin24 call ptxt ld de,esctx1 ;ask for a key ld c,9 call bdos call getchr ;get charcter push af call clrhom ;clear screen pop af pop bc pop de pop hl cp esc ;escape ? ret nz ;no jp warmst ;warm start ;************************************************ ; * ; print error no look up word * ; * ;************************************************ p_nlok: LD HL,cmd2bf ;After 2. cmd buffer CALL A0323 PUSH BC ld hl,lin24 ;print it on line 24 call ptxt LD HL,T05F2 ;error: no look up word call ptxt POP BC LD HL,cmd2bf p_nlo1: ld a,(hl) ;get character or a ;zero ? ret z ;yes => skip push bc call ptxt1 ;print character pop bc inc hl ;point to next djnz p_nlo1 ;repeat RET ;************************************************ ; * ; find lenght of word in command table * ; * ;************************************************ A0323: LD B,0 ;clear counter A0325: LD A,(HL) ;get charcter OR A ;end of text ? RET Z ;yes => skip INC HL ;point to next INC B ;advance counter JR A0325 ;repeat until end ;************************************************ ; * ; Check for and move 2.nd command * ; * ;************************************************ cmd2: LD HL,buffer+1 ;default 2. entry cmd2l1: LD A,(HL) ;get character INC HL ;point to next OR A ;a entry ? RET Z ;no => skip CP '!' ;char less than ! JR C,cmd2l1 ;Yes => skip LD DE,cmd2bf ;point to destination LD (DE),A ;save drive name LD A,(HL) ;get next character INC HL ;point to next CP ':' ;drive terminator ? JR Z,cmd2l1 ;yes => skip DEC HL ;no => make a adjust INC DE LD B,001H cmd2l2: LD A,(HL) CP '!' ;letter ? JR C,cmd2te ;no => skip CP '.' ;decimal point ? JR Z,cmd2te ;yes => skip LD (DE),A ;store character INC HL ;poitn to next INC DE INC B ;increment counter LD A,B ;move it to Acc. CP 16 ;more than 16 ? JR C,cmd2l2 cmd2te: XOR A ;terminate string LD (DE),A LD HL,cmd2bf ;HL = start of buffer INC A ;A = non zero RET ;************************************************ ; * ; print sign on on screen * ; * ;************************************************ scinit: CALL clrhom ;make frame LD HL,inittx JP ptxt clrhom: ld e,cls ;clear screen ld c,2 ;con out call 5 ;BDOS push af xor a ;line number ld (line),a pop af RET ;************************************************ ; * ; read data from data file * ; * ;************************************************ A03A5: CALL A03BC ;read data from data file A03A8: LD HL,(rdleng) ;get read lenght LD A,H ;lenght = zero ? OR L JR Z,A03A5 ;yes => repeat DEC HL ;else adjust lenght LD (rdleng),HL LD HL,(datpnt) ;read pointer (data) LD A,(HL) INC HL LD (datpnt),HL RET ;************************************************ ; * ; read 4 sectors from file (random) * ; * ;************************************************ A03BC: PUSH HL PUSH DE PUSH BC LD B,4 ;number of sectors LD DE,datwsp ;start of buffer LD (datpnt),DE ;save in pointer A03C8: PUSH BC ;save number of sectors LD HL,(fchman+33) ;adjust sector address for next sector INC HL LD (fchman+33),HL PUSH DE ;save dma address LD C,26 ;set dma address CALL bdos LD DE,fchman ;fcb of HELP.MAN LD C,33 ;random read CALL bdos POP DE ;restore dma address LD HL,128 ;sector lenght ADD HL,DE EX DE,HL ;hl= next sector POP BC ;restore number of sectors to read DJNZ A03C8 ;repeat until done LD HL,200h ;default read lenght (512 bytes) LD (rdleng),HL POP BC POP DE POP HL RET ;************************************************ ; * ; print until ^B is found * ; * ;************************************************ A03F1: LD B,2 ;^B marked words JR A03F7 ;************************************************ ; * ; print until ^S is found * ; * ;************************************************ A03F5: LD B,013H ;start of a new look-up word A03F7: CALL A03A8 ;get a character CP B ;is it one of them we want ? JR Z,A0402 ;yes => skip CALL ptxt1 ;print charcter JR A03F7 ;repeat until done ;************************************************ ; * ; control charcters is enounced * ; * ;************************************************ A0402: LD A,B CP 2 ;was it ^B ? RET Z ;yes => skip A0406: ld hl,lin24 ;print on line 24 call ptxt LD HL,endtx1 ;print end of text call ptxt jp getchr ;************************************************ ; * ; print out characters * ; * ;************************************************ A0456: CALL A04CF PUSH DE LD A,(pnt1) OR A CALL Z,A049D DEC A LD (pnt1),A LD A,(pnt2) OR A JR Z,A0471 DEC A LD (pnt2),A JR A048C A0471: PUSH HL PUSH BC ; clear line 24 POP BC POP HL LD DE,-80 ;line lenght ADD HL,DE A048C: LD A,(pnt3) LD E,A XOR A LD D,A LD (pnt3),A SBC HL,DE LD DE,80 ;line lenght ADD HL,DE POP DE RET A049D: PUSH HL PUSH DE PUSH BC ld de,lin241 ;cursor pos ld de,9 call bdos LD DE,esctx1 ld c,9 ;print text call bdos CALL getchr CP esc JR Z,A04B6 CP 018H JR NZ,A04BC A04B6:; LD SP,02B71H JP warmst A04BC: LD C,14H CP cr JR NZ,A04C4 LD C,1 A04C4: ;clear ? LD A,C POP BC POP DE POP HL RET A04CF: CALL A04DC RET Z CP 013H RET NZ getchr: CALL A04DC JR Z,getchr RET A04DC: PUSH HL PUSH DE PUSH BC LD E,0FFH LD C,006H CALL bdos OR A POP BC POP DE POP HL RET ;************************************************ ; * ; Quit to system (cmd 0) * ; * ;************************************************ quit: LD E,cls ;clear screen cmd LD C,2 ;print it CALL bdos JP 0 ;warm boot CP/M ;************************************************ ; * ; IKON menu * ; * ;************************************************ ikon: CALL clrhom LD HL,ikontx CALL ptxt CALL A0406 JP warmst ;************************************************ ; * ; MARKØR menu * ; * ;************************************************ markor: CALL clrhom LD HL,martx2 ;start of text area CALL ptxt ;print text CALL A0406 ;print line 24 and wait until keypress JP warmst ;************************************************ ; * ; Kommando menu * ; * ;************************************************ comand: CALL clrhom LD HL,komtx2 ;start of command text area CALL ptxt ;print it CALL A0406 ;wait until keypress JP warmst ;goto main menu ;************************************************ ; * ; Help manual look up words * ; * ;************************************************ helpwd: CALL rdinxf ;open and read index file CALL clrhom ;clear screen LD HL,hmanup ;manuals key words CALL ptxt ;print index word line LD HL,inxwsp ;start of index buffer LD DE,20 ;lenght of a index entry A0534: LD A,cr ;get new line CALL ptxt1 ld a,lf call ptxt1 LD C,4 ;print 4 word on a line A053B: LD A,(HL) ;get character OR A ;end of word JR Z,A055A ;yes => skip PUSH HL ;save source address CALL A0323 ;find lenght of word POP HL PUSH HL CALL ptxt ;print next word POP HL ADD HL,DE ;point to next word LD A,19 ;19 columns wide SUB B LD B,A A0550: LD A,20h ;space CALL ptxt1 DJNZ A0550 DEC C ;still same line ? JR NZ,A053B ;yes => skip JR A0534 ;print cr,lf ;************************************************ ; * ; get entry (look-up word * ; * ;************************************************ A055A: LD HL,hwhcmd ;which word ? CALL ptxt LD B,16 ;lenght of word (max) LD HL,cmd2bf A0565:; LD A,20H ; ; CALL ptxt1 CALL getchr CP esc ;escape ? JP Z,warmst CP 18H ;^X ? JP Z,warmst CP lf ;line feed ? JR Z,A05B4 CP cr ;carriage return ? JR Z,A05B4 CP 08H ;backspace ? JR Z,A058E CP 7FH ;del ? JR NZ,A059C A058E: LD A,B CP 16 ;lenght = max ? JR Z,A0565 ;yes => skip LD A,08 ;del CALL ptxt1 ld a,20h ;space call ptxt1 ld a,08 call ptxt1 DEC HL INC B JR A0565 ;************************************************ ; * ; convert to upper case * ; * ;************************************************ A059C: LD C,A ;move char to C LD A,B ;get lenght OR A ;zero lenght ? JR Z,A0565 ;yes => skip (get a new entry) DEC B ;adjust LD A,C ;get character CP 'a' ;under lower case ? JR C,A05AD ;yes => skip CP 'z'+1 ;over z ? JR NC,A05AD ;yes => skip AND 0DFH ;make it to upper case A05AD: LD (HL),A ;store charcter in buffer INC HL ;point to next CALL ptxt1 ;print character JR A0565 ;get a new charcter ;************************************************ ; * ; Look word up in index * ; * ;************************************************ A05B4: LD (HL),0 ;store a zero in end of text LD HL,cmd2bf ;point to start LD A,(HL) ;get charcater OR A ;zero ? JR NZ,A05DE ;no => skip PUSH HL ;save start LD DE,(pnt4) DEC DE LD (pnt4),DE LD DE,d_cmd1 ;default text (HELP) A05CA: LD A,(DE) ;get character OR A ;end ? JR Z,A05D6 ;yes => skip LD (HL),A ;store it CALL ptxt1 ;and print it INC HL ;point to next INC DE JR A05CA ;repeat until done ;************************************************ ; * ; store a zero in end of text * ; * ;************************************************ A05D6: LD (HL),0 POP HL A05DE: JP A0126 ;************************************************ ; * ; default command * ; * ;************************************************ d_cmd1: defb 'HELP',0 ;************************************************ ; * ; Get a number betwin 0-4 into a * ; * ;************************************************ getcmd: CALL getchr SUB '0' JR C,getcmd CP 2 ;5 JR NC,getcmd RET ;************************************************ ; * ; text area * ; * ;************************************************ T05F2: defb 'Ikke opslagsord ',0 T063E: T0640: T0672: T06A8: NOP ;************************************************ ; * ; Default text buffer * ; * ;************************************************ lin24: defb esc,cur_li,' '+23,' ',0 lin241: defb esc,cur_li,' '+23,' ','$' hwhcmd: defb cr,lf,lf,lf,'Hvilket opslagsord ønskes ? ',0 ndxnf: defb ' HELP.NDX findes ikke, tryk på en tast for fortsættelse',0 esctx1: defb ' Tryk <ESC> for afslutning, anden tast for fortsættelse$' endtx1: defb ' Opslagsordet er slut, tryk på en tast for fortsættelse',0 hmanup: defb cr,lf,tab,tab,'--- Manualens uppslagsord ---',cr,lf,0 inittx: defb cr,lf defb ' --- HELP Ver.: 1.0 Hovedmenu ---',cr,lf,lf,lf ; defb ' 1. IKON-definitioner',cr,lf,lf ; defb ' 2. MARKØR-styrning',cr,lf,lf ; defb ' 3. KOMMANDO-radsmetoder',cr,lf,lf defb ' 1. HELP-manualens opslagsord',cr,lf,lf,lf,lf,lf,lf defb ' 0. Afslutte HELP-programmet',cr,lf,lf,lf,lf defb ' --- Vælg den ønskede funktion ved trykning på ''1'' el. ''0'' ---' defb 0 ;end of text ;************************************************ ; * ; Ikon texts * ; * ;************************************************ ikontx: defb 0 ;end of text ;************************************************ ; * ; Markør menu * ; * ;************************************************ martx2: defb 0 ;************************************************ ; * ; command help menu * ; * ;************************************************ komtx2: defb 0 ;************************************************ ; * ; Command decode text's * ; * ;************************************************ ikntx1: defb '!"#$',0 ikntx2: defb '!"#$',0 martx1: defb '!"#$',0 komtx1: defb '!"#$',0 txname: defb cr,lf,'NAVN',cr,lf,0 txsynt: defb 'SYNTAX',cr,lf,0 txdesc: defb 'BESKRIVELSE',CR,LF,0 txexam: defb 'EKSEMPEL',cr,lf,0 txeror: defb 'FEJL MEDDELSER',cr,lf,0 txextr: defb 'EKSTERNE REF.:',cr,lf,0 loktxt: defb ' ' defb '--- Manualens opslagsord ---' defb ' ',0,0 ;************************************************ ; * ; command index table * ; * ;************************************************ cmdtab: defw quit ;command 0 address (QUIT) ; defw ikon ;command 1 address (IKON) ; defw markor ;command 2 address (MARKØR) ; defw comand ;command 3 address (KOMMANDO) defw helpwd ;command 4 address (HELP) ;************************************************ ; * ; File control blocks * ; * ;************************************************ fchndx: defb 0 ;user / drive defb 'HELP NDX' defs 24 ;space fchman: defb 0 ;user / drive defb 'HELP MAN' defs 24 ;space ;************************************************ ; * ; work space * ; * ;************************************************ stinxw: defw 0 ;start of index word rdleng: defb 0 ;lenght of read datfl1: defb 0 ;data file open flag inxfl1: defb 0 ;indexfile open flag cmd2bf: defs 50 ;command buffer pnt1: defs 1 pnt2: defs 1 pnt3: defs 1 pnt4: defs 2 datpnt: defs 2 ;address of data offpnt: defs 2 ;offset from start of record line: defs 1 ;line count inxwsp: defs 16*128 ;index file workspace inxend: defs 1 ;end of index datwsp: defs 16*128 ;read data buffer lokbuf: defs 50 END «eof»