This sounds like a problem I was looking at with Josef a few months
back, where long ported programs failed on SAM.  As far as I could tell
it was a bug with LABEL management -- his problem listing used many
labels (no use of KEYIN).  I was able to narrow it down to a boundary
case, as demonstrated with this test program:

1 PRINT "Running..."
2 FOR x=1 TO 111
3 PRINT at 1,0;x
4 KEYIN STR$ (x*2+100)+" LABEL l"+STR$ x+": PRINT "+STR$ x+": STOP"
5 KEYIN STR$ (x*2+101)+" REM xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
6 NEXT x
7 CLS : STOP
8 REM ---------------------------------X

1) Type that into a freshly booted SAM, run it, then wait for the
counter to reach 111.  If you then type CLEAR it gets stuck and never
returns.
2) Next, do the same again but remove the 'X' from the end of line 8. 
This time the CLEAR command will finish after about 30 seconds, which I
believe is the time taken to rebuild the LABEL table from scratch.

To rule out a problem with KEYIN, I used LLIST to write the program to a
text file using the SimCoupe printer option.  I then auto-typed the
contents back in to a freshly reset SimCoupe, so KEYIN was never
actually executed, even though it was still part of the listing.  I was
still able to demonstrate the same issue, with the single character
difference.  My guess is that the final label might be at some kind of
page boundary, which trips up the code building the table.  I haven't
tried to look into it -- any volunteers...?

I noticed your program also uses labels, though not as many.  It might
be worth trying to remove the labels, to see if that magically fixes it?

Si

On 15/11/2012 18:17, Marcos Cruz wrote:
> Hi all,
>
> Some time ago I wrote a toolkit to write MasterBASIC programs with the
> Vim editor (http://vim.org) and import them into SimCoupe (see
> http://programandala.net/en.program.mbim). It didn't work because the
> KEYIN command has bugs (in SAM BASIC, but MasterBASIC didn't fix them).
> In fact, a similar tool for ZX Spectrum's Beta BASIC (see, in Spanish:
> http://programandala.net/es.programa.bbim) works like a charm: I can
> write Beta BASIC code (in an improved format with new features) with
> Vim, and then, with a keypress, convert it to "real" Beta BASIC and
> create a fake disk image ready to be imported into the Beta BASIC
> interpreter. It would be nice to work the same way with the more
> powerful MasterBASIC...
>
> Is there any patch to fix SAM Coupé's KEYIN? I'm afraid not.
>
> I thought an alternative: I could write a program to convert the source
> code into tokenized MasterBASIC and copy it into a SAM disk image. But
> the tokenized format is not fully described in the Technical Manual or
> the MasterBASIC User Manual (though many details can be found there and
> others are similar to the ZX Spectrum format). In
> theory this approach is feasible, but much more complex.
>
> Any other idea?
>
> I'd like to develop some project in MasterBASIC, but its own editor
> would be a pain compared with the features of a modern editor. Beside,
> also the RENUM command is buggy, what is a serious limitation.
>
> Marcos
>
>   

Reply via email to