Menu

Function Keys

Tuxtoo
2020-03-26
2020-04-01
  • Tuxtoo

    Tuxtoo - 2020-03-26

    Hi,

    I am new to PC-BASIC and I am trying to run PC-BASIC with the following program (pcbinit.bas) auto loading:

    10 CHDIR "basic"
    20 KEY 5, "FILES" + chr$(13)
    30 KEY 6, "CHDIR" + CHR$(34)
    40 KEY ON
    50 NEW

    My OS is Puppy Linux Xenial 64 and running the above program from the command line with:

    pcbasic z:pcbinit.bas

    Works as expected, that is, PC-BASIC starts with the Function Keys 5 and 6 changed as per the program. However, when I create a bash script with the following to do the same thus:

    #!/bin/sh
    pcbasic z:pcbinit.bas

    PC-BASIC starts, but then immediately closes.

    Does anyone have any ideas or a better way to do this, perhaps with PCBASIC.INI

    Stuart

     

    Last edit: Tuxtoo 2020-03-26
  • Smithdoor

    Smithdoor - 2020-03-31

    I hope this hepls

    Dave

    10 '
    20 ' USING F1 - F10 KEYS
    30 '
    40 '
    FIRST IS TO CLEAR F1-F1O in BASIC
    50 '
    60 DATA KEY1, KEY2, KEY3, KEY4, KEY5, Key6, key7, key8, key9, key0
    70 FOR N=1 TO 10: READ SOFTKEYS$(N)
    80 KEY N, SOFTKEYS$(I)
    90 NEXT N
    100 KEY ON
    110 '
    120 ' *** INKEY$ FOR INPUT
    130 ' ## PAGE UP , PAGE DOWN & Esc keys can program
    140 A$=INKEY$:IF A$="" THEN 140
    150 IF A$=CHR$(0)+";" THEN PRINT "F1":END
    160 IF A$=CHR$(0)+":" THEN PRINT "F?":END
    170 IF A$=CHR$(0)+"<" THEN PRINT "F2":END
    180 IF A$=CHR$(0)+"=" THEN PRINT "F3":END
    190 IF A$=CHR$(0)+">" THEN PRINT "F4":END
    200 IF A$=CHR$(0)+"?" THEN PRINT "F5":END
    210 IF A$=CHR$(0)+"@" THEN PRINT "F6":END
    220 IF A$=CHR$(0)+"A" THEN PRINT "F7":END
    230 IF A$=CHR$(0)+"B" THEN PRINT "F8":END
    240 IF A$=CHR$(0)+"C" THEN PRINT "F9":END
    250 IF A$=CHR$(0)+"D" THEN PRINT "F10":END
    260 IF A$=CHR$(0)+"E" THEN PRINT "??":END
    270 GOTO 140

     
  • Tuxtoo

    Tuxtoo - 2020-04-01

    Hi Dave,

    Not sure what I done wrong, but its working now, including the BASH script. This is what I wanted to achieve when I start PC-BASIC:

    1. Change directory to my ‘BASIC’ files directory.
    2. Change the KEY’s to my preferred choice
    3. Exit the program with no program in memory and the KEY’s ready for use for a programming sesion.

    10 CHDIR "basic"
    20 KEY 5, "FILES" + CHR$(13)
    30 KEY 6, "CHDIR" + CHR$(34)
    40 KEY 7, "FILES"+CHR$(34)
    50 KEY 8, "EDIT "
    60 KEY 9, "WIDTH 40"+CHR$(13)
    70 KEY 10, "WIDTH 80"+CHR$(13)
    90 KEY ON
    100 NEW

    Thanks for your help Dave.

    Stuart

     

    Last edit: Tuxtoo 2020-04-01
  • Smithdoor

    Smithdoor - 2020-04-01

    This shows how I did trying to do
    I hope it helps
    Dave

    8000 ' *
    8010 '
    8020 ' * ### START menu FOR BASIC
    8030 ' * By David B. Smitth
    8040 ' * Clovis, California
    8050 ' * free to use
    8060 ' * no copyright 2020
    8070 '
    *
    8140 KEY 1,"List "
    8160 KEY 2,"RUN"+CHR$(13)
    8180 KEY 3,"load "+CHR$(34)
    8200 KEY 4,"SAVE"+CHR$(34)
    8210 KEY 5,"Edit "
    8220 KEY 6,"Renum "
    8240 KEY 7,"FILES"+CHR$(34)
    8260 KEY 8,"WIDTH 40"+CHR$(13)
    8280 KEY 9,"WIDTH 80"+CHR$(13)
    8300 KEY 10,"COLOR 14,1"+CHR$(13)
    8310 KEY ON:COLOR 14,1:CLS:LOCATE 1,1

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.