Creating String Arrays in PicBASIC

Status
Not open for further replies.

transistance

New Member
Code:
DEFINE OSC 4

scheme VAR word[10]
name VAR WORD[10]
i var byte
set var bit
bck var bit
fwd var bit

scheme[0] = "<    STANDARD E    >" : scheme[1] = "<    STANDARD Eb   >"
name[0]   = "  E  A  D  G  B  E  " : name[1]   = "  Eb Ab Db Gb Bb Eb "
scheme[2] = "<    STANDARD D    >" : scheme[3] = "<    STANDARD Db   >"
name[2]   = "  D  G  C  F  A  D  " : name[3]   = "  Db Gb B  E  Ab Db "
scheme[4] = "<    STANDARD C    >" : scheme[5] = "<    DROPPED D     >"
name[4]   = "  C  F  Bb Eb G  C  " : name[5]   = "  D  A  D  G  B  E  "
scheme[6] = "<    DROPPED Db    >" : scheme[7] = "<    DROPPED C     >" 
name[6]   = "  Db Ab Db Gb Bb Eb " : name[7]   = "  C  G  C  F  A  D  "
scheme[8] = "<    DROPPED B     >" : scheme[9] = "<      MANUAL      >"
name[8]   = "  B  Gb B  Fb Ab Db " : name[9]   = ""
 
pause 500

i = 0

menu:   lcdout $fe, 1,#scheme[i]
        LCDOUT $fe, $c0, #name[i]
poll:   if set = 0 then 
            I = 0
            goto tuning
        ENDIF
        IF bck = 0 then
            if i > 0 then i = i - 1
            else i = 9
            goto menu
        endif
        if fwd = 0 then
            if i < 9 then i = i + 1
            else i = 0
            GOTo menu
        endif
        goto poll

How can I create a string array in PICBASIC? I know that the above code doesn't compile, it's there so you get the general idea about what I'm trying to do.

Is there a less exhaustive approach to make such a menu work?

thanks,
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…