100 '*******************************************
105 '
110 '              DISKEYS.BAS
115 '
120 '*******************************************
125 '
130 'An  MBASIC  program   for  the   Osborne  1
135 'to print out the current definitions of the
140 'arrow and function keys    -     works with
145 'monitor   ROM   revisions   1.3   to   1.44
150 '
155 '*******************************************
160 '
165 '     Copyright (c) 1983 CompuMagic, Inc.
170 ' Modified by Daybreak Productions,  Canada.
175 ' Permission granted  for personal use only!
180 '
185 '*******************************************
190 '
195 'Note: this program will not run properly if
200 'MBASIC is run under the R  command of Word-
205 'Star,  nor if MBASIC  has been  modified by
210 '         the program MANYKEYS.
215 '
220 '********************************************
225 '
230 DIM ADR(14),LNG(14),AKS(4),CPM(4),WS(4)
235 'Store code for CP/M and WordStar arrow keys
240 FOR I=1 TO 4:READ CPM(I):NEXT I
245 FOR I=1 TO 4:READ WS(I):NEXT I
250 DATA &H0B,&H0C,&H0A,&H08,&H05,&H04,&H18,&H13
255 FOR CLS=1 TO 12:PRINT:NEXT CLS
260 PRINT "***************************************************":PRINT
265 PRINT "*** DISKEYS Copyright (C) 1983 Compumagic, Inc. ***":PRINT
270 PRINT "***************************************************":PRINT
275 PRINT "Modified by Daybreak Productions, Vancouver, Canada":PRINT
280 PRINT "This program prints the definitions of the FUNCTION"
285 PRINT "and  ARROW KEYS  of the disk from which you booted." 
290 PRINT "Please re-boot from the disk of interest, then exit"
295 PRINT "to the system and reload  MBASIC  and this program.":PRINT
300 PRINT "If you have already done this,  please ensure  that"
305 PRINT "the printer is ON,  then press any key to continue.":PRINT
310 A$=INPUT$(1)
315 'Store  function key  "names"  for printing.
320 CK$="0123456789^>v<"
325 'Function to get f.key characters from BIOS.
330 DEF FNA(I)=PEEK(I)+256*PEEK(I+1)
335 'Get pointers to location & length of f.keys
340 A0=256*PEEK(2)+&H6B
345 AOLD=FNA(A0)
350 'Get address & length of each f.key definit.
355 FOR I=1 TO 14
360    ADR(I)=AOLD:A0=A0+2
365    AOLD=FNA(A0)
370    LNG(I)=AOLD-ADR(I)
375 NEXT I
380 'Begin  printout with heading and disk name.
385 LINE INPUT "Enter your name for the boot disk: ",TITLE$
390 IF TITLE$="" THEN TITLE$="boot"
395 LPRINT TAB(11);"***** DISKEYS.BAS *****":LPRINT
400 LPRINT TAB(11);"Function and arrow keys for ";
405 LPRINT TITLE$;" disk:":LPRINT
410 'Make next loop 1 - 14  if printout  of each
415 'arrow key is desired, otherwise use 1 - 10.
420 FOR IKEY=1 TO 14
425    LPRINT TAB(11);MID$(CK$,IKEY,1);": ";
430    CK=ADR(IKEY)
435    FOR ICH=1 TO LNG(IKEY)
440    CH=PEEK(CK):CK=CK+1
445 'Character codes past 127 are not pure ASCII 
450 'so strip the 8th. bit to get  valid  ASCII.
455    IF CH>127 THEN CH=CH-127
460    IF CH=0 THEN C$="<NULL>":GOTO 515
465    IF CH>&H21 THEN C$=CHR$(CH):GOTO 515
470    IF CH<>&H20 THEN 485 ELSE C$="<SP>":GOTO 515
475 'For control characters,print appropriately.
480 'Print <CR>, <LF> and <ESC>  as shown  here.
485    IF CH<>&HD THEN 490 ELSE C$="<CR>":GOTO 515
490    IF CH<>&HA THEN 495 ELSE C$="<LF>":GOTO 515
495    IF CH<>&H1B THEN 500 ELSE C$="<ESC>":GOTO 515
500    IF CH<>&HC THEN 510 ELSE C$="<FF>":GOTO 515
505 'Print other controls CP/M style: "^letter".
510    C$="^"+CHR$(CH+&H40)
515    LPRINT C$;
520    NEXT ICH
525    LPRINT
530 NEXT IKEY
535 'Check definition of arrow keys; first check  
540 'whether they are > 1 byte  (non-standard!).
545 FOR IKEY=11 TO 14:IF LNG(IKEY)<>1 THEN 605
550 NEXT IKEY:    'if loop ends, all are 1 byte.
555 'Get each  arrow-key  byte,  and examine it.
560 FOR AK=1 TO 4:AD=ADR(11)+AK-1
565    AKS(AK)=PEEK(AD):NEXT AK
570 'Are they CP/M arrow keys?
575 FOR I=1 TO 4:IF AKS(I)<>CPM(I) THEN 590
580 NEXT I:AK$="CP/M":GOTO 610
585 'If not CP/M,  are they WordStar arrow keys?
590 FOR I=1 TO 4:IF AKS(I)<>WS(I) THEN 605
595 NEXT I:AK$="WordStar":GOTO 610
600 'Arrow keys definit'ns must be non-standard!
605 AK$="Non-standard"
610 LPRINT:LPRINT TAB(11);"ARROW KEYS: ";AK$
615 LPRINT CHR$(&HC)
620 PRINT:PRINT "***************************************************"
625 PRINT:PRINT "Printout is completed.  You may wish to print these"
630 PRINT "definitions again,  or print those of another disk.":GOTO 290
rintout is completed.  You may wish to print t