Re: buggy KEYIN; MasterBASIC's tokenized format; buggy RENUM

2012-11-16 Thread Simon Owen
On 15 Nov 2012, at 22:57, Marcos Cruz wrote:
 What do you mean auto-typed? Text spooling?

Yep, that's it!  It's currently a Windows-only feature at the moment, but I'll 
extend it to support other platforms.


 AFAIK SimCoupe lacks a file spooling option (in fact it is what I need: 
 SimCoupe to type the
 content of a text file of the host machine).

I'll add file spooling for non-Windows platforms, and clipboard paste once SDL 
2.0 is supported.  The Windows version will likely remain clipboard only, since 
sniffing the encoding from text files is just too unreliable.


 there are many labels in the imported KEYIN-ed code. I'll remove them too 
 --just
 to see what happens.

I'll be interested to hear how you get on with this.  If it does fix it, labels 
are definitely to be avoided until the ROM issue is tracked down and 
(hopefully) fixed.

Si



Re: buggy KEYIN; MasterBASIC's tokenized format; buggy RENUM

2012-11-16 Thread Tim Paveley

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...?
So this may or may not be related but I've memories of long basic 
programs getting corrupted, and the corruption would happen around a 
page boundary.  I'd end up putting long REM statements around the area 
affected.


I've found an example in the fortress code on the sad snail 
collection.  There are a bunch of REMS around line 40250.  I'm pretty 
certain if I could remember how to check this will be at a page boundary.


HTH,
Tim


Re: buggy KEYIN; MasterBASIC's tokenized format; buggy RENUM

2012-11-16 Thread david

Quoting Tim Paveley u...@samcoupescrapbook.co.uk:


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...?
So this may or may not be related but I've memories of long basic  
programs getting corrupted, and the corruption would happen around a  
page boundary.  I'd end up putting long REM statements around the  
area affected.


I'm sure I had this issue with the Newsdisk Basic text viewer a few  
times... and very sure I had the same problem when I used similar code  
for the Blitz diskzine. (SAM Prime used a special text editor from  
Nigel Kettlewell so it didn't have that issue)


buggy KEYIN; MasterBASIC's tokenized format; buggy RENUM

2012-11-15 Thread Marcos Cruz
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

-- 
http://programandala.net


Re: buggy KEYIN; MasterBASIC's tokenized format; buggy RENUM

2012-11-15 Thread Simon Owen
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 x
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

   



Re: buggy KEYIN; MasterBASIC's tokenized format; buggy RENUM

2012-11-15 Thread Marcos Cruz
En/Je/On 2012-11-15 20:37, Simon Owen escribió / skribis / wrote :

 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, 

What do you mean auto-typed? Text spooling? AFAIK SimCoupe lacks a
file spooling option (in fact it is what I need: SimCoupe to type the
content of a text file of the host machine).

 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?

I think I tried everything I could imagine when I developed the several
versions of MBimport one year ago. Nevertheless I've just written a new
label-less version of MBimport. It's easy to remove the two or three
labels of the importer, but it makes no difference because there are
many labels in the imported KEYIN-ed code. I'll remove them too --just
to see what happens.

Thank you
Marcos

-- 
http://programandala.net