; DEC 222222222222 AAAAAAAAAAAAAAAA table * zp0 ; ************ Alias for ZP0 thoughout user * &F2 restco * &F2 ; location used by OSCLI for start addr. of command textte * 0 ; to be compatible with ROM header ; ; ;******************************************************************* ;* ;* HELP handler for TFS ;* ;* Table driven information system ;* ;* OnAY entry (restco) points to the user input following ;* the *HELP command ;* This routine gets each word and compares it with a table of ;* keywords. If a match is found, a page of information is displayed. ;* If a word doesn't match, it is ignored. ;* Note that abbreviations (.) are recognised. ;* If there is nothing following the *HELP command, the table of ;* keywords is listed with a title, in keeping with other ROMs ;* ;* On exit, X and Y are preserved ;* ;******************************************************************* ; help Tya ; preserve Y for benefit of other ROMs Pha Txa ; preserve X Pha ; ; Lda user ; preserve parameter pointer Pha ; for other roms. Lda user+1 Pha Jsr addoff ; synchronise pointers for string comparisons ; helpsk LdyIM 0 LdaIY user ; skip leading spaces CmpIM &0D ; check for OSCLI string terminator Beq help00 ; if no more chars. or all spaces give summary CmpIM " " Bne helpco ; if have non-space char, compare strings Inc user Bne helpsk Inc user+1 Bne helpsk ; always true ; helpco Jsr comp04 ; compare next word in user stream with keywords Bcs helpfi ; carry set = no match Jsr dispte ; display help page;pointer set by comp04 LdyIM 0 helpfi LdaIY user ; current char. in user stream CmpIM &0D ; end of user stream? Beq helpex ; yes. CmpIM " " ; no. find terminator for this word Beq helpsy CmpIM "." ; check for abbrev. Beq helpsy Iny ; advance window Jmp helpfi ; helpsy Iny ; advance window beyond terminator Jsr addoff ; synchronise pointers and Jmp helpco ; try next word in user stream ; ; help00 Jsr osnewl LdaIM :LSB: titles Sta table ; set pointer to start of title string LdaIM :MSB: titles Sta table+1 Jsr dispte ; display title string LdaIM " " Jsr oswrch Iny ; advance to version string Jsr dispte ; display the version string Jsr osnewl LdaIM :LSB: helpsu Sta table ; point to start of keyword table LdaIM :MSB: helpsu Sta table+1 LdyIM 0 Jsr dispte ; display first subheading LdxIM 1 ; count table entrie helpli CpxIM 3 ; end of table list? Bcs helplf ; yes. tidy up LdaIM &0A ; line feed Jsr oswrch LdaIM " " Jsr oswrch Jsr oswrch Iny ; advance beyond terminator Iny ; advance beyond data pointer bytes Iny Jsr dispte ; display next keyword Inx Jmp helpli ; list rest ; helplf LdaIM &0A Jsr oswrch ; helpex ; Pla ; restore parameter pointer Sta user+1 Pla Sta user ; Pla ; restore value of X on entry Tax Pla ; restore Y Tay Rts ; ; ;**************************** ;* ;* addoff ;* ;* addsAu Y to userser+1 ;* to slide the user stream ;* under the window (Y) ;* ;**************************** ; addoff Tya Clc Adc user ; add Y to base value to give indexing with Y=0 Sta user ; Y then has a common starting point for Bcc addexi ; string comparison Inc user+1 addexi Rts ; ; ;********************************* ;* ;* comp04 ;* ;* compares a word in the user ;* stream with keyword table ;* stream ;* ;* On entry, the streams are ;* synchronised. i.e. Y=0 ;* windows the first char. in ;* each ;* Abbreviations are recognised. ;* On exit, ;* Carry clear = match ;* Carry set = no match ;* user,user+1 point to last ;* char. in word and Y=0 ;* ;********************************* ; comp04 LdaIM :LSB: helpta Sta table ; pointer to keyword table LdaIM :MSB: helpta Sta table+1 LdxIM 1 ; count table entrie ; comp02 LdyIM &FF ; initialise window to strings compar Iny ; window next pair of chars. - Y always < 255 LdaIY user ; get next char. in user stream CmpIM "." ; abbreviation match? Beq comp03 ; yes. get pointer to display page CmpIY table ; no. compare with table stream Beq comp00 Sec ; no match. lower case? SbcIM &20 ; lower to upper case displacement CmpIY table ; try again Beq comp00 CmpIM 32-&20 ; char mismatch. space vs. return? Bne comp06 ; no. strings don't match LdaIY table ; yes. see if table stream is CmpIM &0D Beq comp03 ; exact match ; comp06 ; no match CpxIM 3 ; more table entrie to try? Bcs comp05 ; no. Inx ; yes. get next entry LdaIM 12 ; advance pointer to next table entry Jsr adva00 Jmp comp02 ; comp00 CmpIM &0D ; end of both strings? Bne compar ; no. keep comparing streams comp03 ; match Jsr addoff ; point to terminator or dot in user stream LdaIM 10 ; point to display data pointer Jsr adva00 LdyIM 0 ; reset window LdaIY table ; low byte of data pointer Pha Iny LdaIY table ; high byte Sta table+1 Pla Sta table Clc ; indicate string match Bcc comp01 ; exit with carry flag and pointer ; comp05 Jsr addoff ; point to terminator Sec ; indicate no match ; comp01 LdyIM 0 ; exit pointing to current char. in user stream Rts ; and with carry flag (clear=match) ; ; ;****************************** ;* ;* adva00 ;* ;* addAt A to tableable+1 ;* to get table entrie etc. ;* ;****************************** ; adva00 Clc Adc table Sta table Bcc advanc Inc table+1 advanc Rts ; ; ;********************************** ;* ;* dispte ;* ;* displays the text pointed to ;* byIY table until terminator ;* ;********************************** ; dispte LdaIY table ; pick up char byte CmpIM textte ; end of display text? Beq dispex Jsr oswrch Iny ; rollover? Bne dispte ; no. Inc table+1 Bne dispte ; dispex Rts ; ; ; ----- KEYWORD TABLE :AND: DISPLAY DATA ; helpsu = " " ; embedded spaces for summary display helpta = "TELETEXT" = &0D = textte ; final terminator for dispte & helpte ; pointer to display page data = "TELESOFT" = &0D = textte & helpso = "OPT" & &0D0D ; pad to 8 bytes with terminators & &0D0D & &0D0D = textte & helpop ; helpte = " TELETEXT TERMINAL MODE COMMANDS" & &0A0D ; cr,lf = " f0 Select a page / wild card" & &0A0D = &0A ; blank line = " f1 Select last explicit page" & &0A0D = "SH f1 Select index page" & &0A0D = &0A = " f2 Reveal hidden text and hold page" & &0A0D = "SH f2 Conceal text & retain hold state" & &0A0D = &0A = " f3 Keep page up to date in memory" & &0A0D = "SH f3 Release a kept page" & &0A0D = &0A = " f4 Select channel (1,2,3 or 4)" & &0A0D = "SH f4 Tune channel using scale" & &0A0D = &0A = " f5 Enter operating system * command" & &0A0D = " f6 Load a page from file" & &0A0D = " f7 Save displayed page to file" & &0A0D = " f8 Hold the displayed page" & &0A0D = &0A = " f9 Exit to previous language" & &0A0D = "SH f9 Exit to Telesoft (& exec program)" & &0A0D = textte ; terminator for dispte helpso = " TELESOFT MODE COMMANDS" & &0A0D = &0A = "BBC1,BBC2 Select channel 1 or 2" & &0A0D = "CH1 etc. Select any channel" & &0A0D = "DATE Show todays date" & &0A0D = "DISPLAY Display stored page" & &0A0D = "EXEC Download ASCII data" & &0A0D = "ITV1,ITV2 Select channel 3 or 4" & &0A0D ; = "OPT See *HELP OPT" ; & &0A0D = "PAGE Select current page" & &0A0D = "TELETEXT Enter terminal mode" & &0A0D = " (See *HELP TELETEXT)" & &0A0D = "TIME Show clock time" & &0A0D = "TRANSFER Store current page" & &0A0D = "TUNE Tune current channel" & &0A0D = &0A = " = file specification" & &0A0D = " = hexadecimal address" & &0A0D = textte helpop = "OPT 0 Reset default options" & &0A0D = &0A = "OPT 1,0 Suppress all messages" & &0A0D = "OPT 1,128 Enable 'Searching' messages" & &0A0D = " (default)" & &0A0D = &0A = "OPT 2,0 Ignore data errors" & &0A0D = "OPT 2,1 Retry on errors (default)" & &0A0D = "OPT 2,2 Abort on error" & &0A0D = textte ; LNK DEC3