[Coco] Programming in BASIC YouTube series URBANE Version

Stephen H. Fischer SFischer1 at Mindspring.com
Fri Apr 29 21:06:39 EDT 2016


I suggest that this post be read with the colorized "ubn_in.htm" in another window. I am not sure if using a monospaced font helps this.

----- Original Message ----- 
From: "Arthur Flexser" <flexser at fiu.edu>
To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
Sent: Friday, April 29, 2016 5:09 PM
Subject: Re: [Coco] Programming in BASIC YouTube series URBANE Version


>I notice two changes from standard Basic in this:  no line numbers in most
> lines, and where line numbers are used, they appear between underscores.

'''             CHARACTERS IN COLUMN ONE
'               "A-Za-z", "_", "0-9"   =    LINE LABLE
'               "#"                    =    Urbane COMMAND
'               " "                    =    NO LINE LABLE
'               "'"                    =    COMMENT
'               any other character    =    COMMENT

>where line numbers are used, they appear between underscores.

That is just my convention when converting an existing DECB program. I never wrote a conversion program but thought about one. the old line numbers might still work, I wondered even if an existing DECB program would work. But my idea was to get the noise out first.

Look at the source for URBANE, it also is the language definition. I said some more words on: http://www.tandycoco.com/coco-forum/basic-ly-speaking 
 
> This is typed in (to a word processor?) by the user and saved as a data
> file and then Urbane reads that data file and converts it, outputting the
> conversion results to an Ascii file that standard Basic can load in?

YES!

I used Windows "CONTEX" programming editor with syntax coloring to write the program and I think Jeff's "PORT" utility to copy from a Windows file to a DECB disk. URBANE is a CoCo  2 program that will run on a CoCo 3 and yes handle CoCo 3 programs even if run on a CoCo 2. The input and output file names are fixed as well as the other files written. I used Jeff's CoCo 2 emulator after the switch from FLEX's basic was completed. The only way URBANE was possible was because version 1.0 was purchased by me when I got FLEX. I did not realize what I had purchased until I was stumped by the four string sorts to all four running on the same screen at the same time conversion. It just popped into my head after four days. How valiable are libraries of DECB subroutines?  

As the complete source is right there before your eyes, it can be changed and if someone found a bug they could fix it and never tell me about it. The only bug reported was really in the emulator used. That was discussed right here.
 
> This example seems not to contain any long variable names.  How are such
> long names converted to standard Basic variable names?  That is, what
> method do you use to avoid the problem simple truncation would have in
> cases where several long names start with the same beginning characters?

The entire variable name is checked to see if it is a new one, several times I made a typo and had to examine the cross reference raw file to find the exact name I had used before. Some two character variables are not used.

'               Illegal Two Character Variable Table    NOTE: "PI" is a variable that is NOT replaced
                DATA AS,BF,FN,IF,ON,OR,PI,TO,"\"

> Allowing lowercase in variable names would be nice, if that is not already
> a feature.

The lowercase letters are converted to upper case  because DECB does not allow them. New two character names are assigned starting with "AA".

GET_VLSTRING    VLSTRING$ = IN_LINE_CH$
NEXT_VLSTRING_CH GOSUB GET_IN_LINE_CHAR
                IF IN_LINE_CH  <  NUM_0   THEN RETURN
                IF IN_LINE_CH  >= ASC_A_U AND IN_LINE_CH  <= ASC_Z_U GOTO VLSTRING_ADD_UPPER_ALPHA
                IF IN_LINE_CH  >= ASC_a_L AND IN_LINE_CH  <= ASC_z_L GOTO VLSTRING_ADD_LOWER_ALPHA
                IF IN_LINE_CH  >= ASC_0   AND IN_LINE_CH  <= ASC_9   GOTO VLSTRING_ADD_NUMBER
                IF IN_LINE_CH   = ASC_UNDERSCORE                     GOTO VLSTRING_ADD_SPECIAL
                IF IN_LINE_CH   = ASC_TILDE                          GOTO VLSTRING_ADD_SPECIAL
                IF IN_LINE_CH   = ASC_DOLLAR                         GOTO VLSTRING_ADD_DOLLAR
'               REM Character Found that cannot be in Variable or line Label
                RETURN

VLSTRING_ADD_LOWER_ALPHA IN_LINE_CH   = IN_LINE_CH  - ( ASC_a_L - ASC_A_U )
                IN_LINE_CH$ = CHR$(IN_LINE_CH)
VLSTRING_ADD_UPPER_ALPHA  REM
VLSTRING_ADD_NUMBER       REM
VLSTRING_ADD_SPECIAL      REM
VLSTRING_ADD_DOLLAR       REM
                VLSTRING$ = VLSTRING$ + IN_LINE_CH$
'               If an "ASC_DOLLAR" is found, declare label or variable end found
                IF IN_LINE_CH  =  ASC_DOLLAR THEN LAST_CH = IN_LINE_CH : GOSUB GET_IN_LINE_CHAR : RETURN
                GOTO NEXT_VLSTRING_CH
 
> Art
> 
> On Fri, Apr 29, 2016 at 3:03 PM, Stephen H. Fischer <
> SFischer1 at mindspring.com> wrote:
> 
>> Agreed, but I cannot download files.
>>
>> Someone else would need to do it.
>>
>> But then the resulting post could not be sent to the mailing list as it
>> would be too large.
>>
>> That's why zip files were invented.
>>
>> The dim witted (SOME only) that refuse to use facebook and
>> tandycoco.com/coco-forum are locking themselves out of much that is good.
>>
>> I will see if a post of the converted Selection Sort does not break the
>> mailing list limit.
>>
>> SHF
>>
>> ---------------------------------------------
>> '********************
>> '*                  *
>> '*  SELECTION SORT  *
>> '*                  *
>> '********************
>> '
>>
>> _1100_ ' GENERATE RANDOM DATA
>> '      PMODE 4
>> '      SCREEN 1,0
>> '      DIM NO( 126 )
>> '      PCLS 0
>>
>>        FOR I = 1 TO N
>>        NO( I ) = INT( RND( 190 ) )
>>        HLINE ( I * D, 190 ) - ( I * D, 190 -NO( I )), PSET
>>        NEXT
>>        HCOLOR 3,2: FOR I = 0 TO 80 STEP 16 : HPRINT(I,0)," SELECTION
>> SORT.": NEXT I : HCOLOR 1,2
>>        FOR J = N TO 1 STEP -1
>>        LS = -1: SI = -1
>>        FOR I=1 TO J:IF NO( I ) > LS THEN LS = NO( I ): SI =I: NEXT I ELSE
>> NEXT I
>>        GOSUB _1290_
>>        TM = NO( J ) : NO( J ) = NO( SI ): NO( SI ) = TM
>>        GOSUB _1320_
>>        NEXT J
>>        RETURN
>>
>> '      LINE DISPLAY SUBROUTINES
>>
>> _1290_ HLINE ( J * D, 190 ) - ( J * D, 0 ),PRESET
>>        HLINE ( ( SI ) * D, 190 ) - (  ( SI ) * D, 0 ), PRESET
>>        RETURN
>> _1320_ HLINE ( J * D, 190 ) - ( J * D, 190 - NO( J ) ), PSET
>>        HLINE ( ( SI ) * D, 190 ) - ( ( SI ) * D, 190 - NO( SI ) ), PSET
>>        RETURN



More information about the Coco mailing list