Author Topic: BASlist Java Tool to list BASIC files  (Read 15542 times)

0 Members and 1 Guest are viewing this topic.

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
    • Awards
BASlist Java Tool to list BASIC files
« on: 12:28, 05 September 11 »
I coded a little Tool in java to list BASIC files.
It's an 1:1 adaption of Kevin Thacker's baslist.exe
But I also handle the 0x1f Token to get decimal values.
Also my tool formats the BASIC listing proper (no missing spaces between commands and other variables)
Interesting is that it can change CTRL chars to ";CHR$(char);".
This changes all CTRL+KEY combinations inside a PRINT line to the original chr$.
When the screen turns red after listing a file, it uses these chars.
When a line is too long after listing, you will see an error message and should edit the output file by hand...

The GUI (Amstrad font, simple input parsing, etc...) is just for fun!
The 2 buttons (LIST file and Copy) and also the checkbox to convert control chars are important.
After listing a file, you can copy it into clipboard and use in a notepad or other text program.
(Only the listing is copied! Not the other screen output!)

If you don't know, how to run a .jar file:
Add a .BAT file containing:
java -jar BASlist.jar

Have fun!
like
0
No reactions
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 17.118
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #1 on: 12:42, 05 September 11 »
Why not add an Open function?

Nice little thing, I just might start programming in BASIC again :D
like
0
No reactions

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #2 on: 13:42, 05 September 11 »
Why not add an Open function?

Nice little thing, I just might start programming in BASIC again :D

So I see you did not use my tool :P
When you click "LIST file" you can open a .BAS file.

Edit:
This app. is planned for usage in a Java-DSK editor later... But I found it useful to code a little GUI for it...
« Last Edit: 13:44, 05 September 11 by Devilmarkus© »
like
0
No reactions
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #3 on: 15:27, 05 September 11 »
Examples:
Code: [Select]
10 MODE 1:INK 0,0:INK 1,24:INK 2,6:INK 3,26:BORDER 0
20 MEMORY &3FFF
40 LOAD "PLAYER.BIN",&4000
50 LOAD "takeoff.BIN",&8000
60 CALL &4000,&8000
70 EVERY 1,1 GOSUB 150
80 GOTO 80
150 CALL &4003:RETURN

Code: [Select]
1 ON BREAK CONT:ENV 2,1,14,1,14,-1,7:|SO:|ST:CALL &C7D0:|SP:|M1
2 |M1:|PL:mn=1200:D$="":F$="":X=2:C$="":V$="":E$="":PU=0:w$="PUEDES VER ":y$=" SALIDAS:":u$=" PUERTA":PRINT "           ARQUIMEDES XXI":PRINT "           PROGRAMA:EGROJ":PRINT "       GRAFICOS:LUIS RODRIGUEZ":PRINT " ADAPTACION:DEVILMARKUS Y MIGUELSKY"
3 PRINT "  COPYRIGHT  DINAMIC SOFTWARE 1986":|SHOW,&5200,192:CALL &BB18:|M2:|ST:m0=1:mn=1200:EVERY 50,1 GOSUB 10000:Q=0:S=0:u=0:V=0:w=0:y=0:Z=0:A=0:C=0:F=0:I=0:J=0:K=0:L=0:M=0:O=0:p=0:R=0:NA=0
101 |SHOW,&5200,192:E=2:PRINT "ESTAS EN LA SALA DE AUTOMATISMOS.  ";w$ + "UN ORDENADOR CPM2. HAY   UNA SALIDA HACIA EL ESTE. PUEDES":V$="VER UN CARTEL":IF Q=0 THEN V$=V$ + " Y UNA GRAPADORA"
106 PRINT V$
110 GOSUB 7999:IF A$="COGEGRAP" AND Q=0 THEN Q=1:V$="BIEN HECHO":GOTO 248
114 IF A$="COGEGRAP" AND Q=1 THEN V$="NO PUEDES":GOTO 248
116 IF A$="E" AND F=0 THEN V$="NO PUEDO IR TODAVIA":GOTO 248
117 IF A$="EXAMPARE" THEN V$="VES UN BOTON AMARILLO":GOTO 248

------- snip --------
4001 IF LEN(cl$)>6 THEN PRINT " ";ELSE IF LEN(cl$)>5 THEN PRINT " ";ELSE IF LEN(cl$)>4 THEN PRINT " ";ELSE IF LEN(cl$)>3 THEN PRINT " ";ELSE PRINT " ";
------- snip --------
Without CHR$ replacement!

Code: [Select]
4001 IF LEN(cl$)>6 THEN PRINT " ";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";ELSE IF LEN(cl$)>5 THEN PRINT " ";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";ELSE IF LEN(cl$)>4 THEN PRINT " ";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";ELSE IF LEN(cl$)>3 THEN PRINT " ";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";ELSE PRINT " ";CHR$(8);"";CHR$(8);"";CHR$(8);"";CHR$(8);"";Line 4001 with CHR$ replacement.
Of course it's too long but a coder should be able to change this ;)
« Last Edit: 15:31, 05 September 11 by Devilmarkus© »
like
0
No reactions
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline copychr$

  • Supporter
  • CPC664
  • *
  • Posts: 69
  • Country: ch
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #4 on: 17:59, 24 June 13 »
Also my tool formats the BASIC listing proper (no missing spaces between commands and other variables)

Hi D,
Some 10 years ago I used BASLIST and Cpcxfs with a batch file lash-up.
It was possible to extract from a large collection of dsk files in one go.
Hundreds of files would appear instantly, each in bas and asc version. Htm pages also w. clean code, using SED.

Using simple fc on known clean ASC files and those produced by baslist, Kevin squashed a fair number of bugs in one go.
There still remained the problem with floating numbers though, and that made fully automated ripping impossible.
About 1/3 of bas files would fail to copy out good to asc.

I'd like to roll this thing again, and would like to know if an updated BASLIST.EXE is now available.
Also, cpcxfsw.exe was necessary at the time. Is it still available, or can current cpcfxs now do the same batch file jobs?

Staggering what you do w. Java, and all without a GOTO ;-)


« Last Edit: 10:06, 25 June 13 by copychr$ »
like
0
No reactions

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #5 on: 14:01, 25 June 13 »
There's  no update yet.

What do you mean with batch files?

Did you extract many .BAS files on the fly to ASCII?

About CPCXFS I can't tell you. Kevin may help you here...
like
0
No reactions
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline copychr$

  • Supporter
  • CPC664
  • *
  • Posts: 69
  • Country: ch
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #6 on: 00:34, 26 June 13 »
Yes, plain batch files.
For example mget.bat will call: cpcxfsw %1 -mg *.bas
This batchfile runs once for each dsk in the folder.
More commands get automated and one winds up with a dsk ripper.

Each bas file gets a txt version using baslist exe.
Also a port of this txt to htm using SED to escape all characters offensive to html.

The result can be mouthwatering, but because my version of baslist is 10 years old,
many extracted bas files are no good.

Using file compare on good code saved with ,A on the cpc and results from baslist,
turned up a fair number of bugs that got corrected then.

But the set-up only makes sense if the baslist results are trusted.
No verification is possible on so many files.

cpcxfsw still works in a dosbox under win 7. Updated SED also.
I only corresponded briefly w. Kevin on this, and afterwards did not find a version later then 2003.

From your program description, it seems you are using a version with more corrections.
That was the reason for posting here.

Attached a zip w. random results, using only bas programs known to work OK w. baslist.
Viewing the htm source in browser will show up all the escape characters sed puts in.
« Last Edit: 10:49, 26 June 13 by copychr$ »
like
0
No reactions

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #7 on: 18:48, 26 June 13 »
I could do this for regular 40 tracks data dsk's...

For that it's no problem.
like
0
No reactions
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline copychr$

  • Supporter
  • CPC664
  • *
  • Posts: 69
  • Country: ch
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #8 on: 23:34, 26 June 13 »
Baslist turned up in Kevin's archives, 2009 version.
So it looks like I answered all my own questions, as usual.

Haven't been at it for a long time ... Sorry for any bother.

It's mostly an archiving project, getting possibly useful versions of a bas program under one roof.
I'll diddle dos some more and see if results are  usable.
This Baslist should be interesting. Thanks to Kevin for taking it up again, an itch there maybe?



« Last Edit: 23:37, 26 June 13 by copychr$ »
like
0
No reactions

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #9 on: 02:07, 27 June 13 »
You can't compare Kev's Baslist and mine...
Mine is just based on his work, but has a few changes. (Also it's coded in Java instead of C) ;)

The Baslist I use in JavaCPC internally is already better improved.

JavaCPC Desktop's BASIC debugger uses it. So you can see what happens in your program in realtime...

JavaCPC Basic debugger - Trace Basic line by line

Basic Breakpoints

You can of course also list a program what is in the CPC's memory here...
« Last Edit: 02:09, 27 June 13 by Devilmarkus »
like
0
No reactions
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #10 on: 02:15, 27 June 13 »
That's pretty cool things! 8)
like
0
No reactions
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline copychr$

  • Supporter
  • CPC664
  • *
  • Posts: 69
  • Country: ch
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #11 on: 14:34, 27 June 13 »
Thanks to both for being encouraging and to Dev for pointing out some facts of life and tools.
new baslist = old baslist. Reboot? (Y/N): N

The dumb thing is that automation was good already on Win95/97 on a RAM disk.
Some rewriting specifically to do batch file compare on different text versions, turned up a lot of "easy" information.

** poster removes lewd code.

If you are interested I can try some more of that for fun ;-)
« Last Edit: 14:27, 28 June 13 by copychr$ »
like
0
No reactions

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #12 on: 15:14, 27 June 13 »
I am aware mine is out of date.

Markus provided me with some fixes and I need to upload a new version.

I'll do that this weekend hopefully.
like
0
No reactions
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline copychr$

  • Supporter
  • CPC664
  • *
  • Posts: 69
  • Country: ch
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #13 on: 15:35, 27 June 13 »
hmm ...  I may have bugged the wrong victim.
last time around you guys were on comp.sys

Things are still set up and any new version of baslist very welcome.
More fun yet ...


like
0
No reactions

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #14 on: 23:36, 27 June 13 »
As I told ;)

In JavaCPC Desktop the BASList already has the fixes:

 [ Invalid Attachment ]

I just need to make it standalone again...

(When I find the motivation / time)

like
0
No reactions
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #15 on: 01:43, 28 June 13 »
I fiddled a bit around.

So I've done a slight update to Baslist.

Actually it's a Windows .EXE! (Need to find a better way to parse java params)

You still need Java installed!

But for a test it should be enough.

What has changed?

- Some token calculation have been fixed
- Simple CPC filesystem integrated to extract BAS files from 40 tracks DATA DSK
- Simple parameters added.

I attach a file here with a few examples included.

Example:
Extract a few dsk files:

Baslist.exe -extractdsk "disk1.dsk" "disk2.dsk" "disk3.dsk" "C:\CPCFiles\MyDisk.dsk"

After -extractdsk parameter you can add as many dsk files as you wish.

Example 2:
Extract all DSK files inside a given folder:
Baslist.exe -extractdsk "C:\CPCFiles\*"

You can also open a DSK file with this tool. -> Right click on DSK -> Open with -> Select Baslist.exe

It's also possible to open .BAS files with this tool.

.BAS are only in single commands possible yet. No batch processing implemented. It's late now... ;)

Attached file: Baslist.exe, few DSK images,  a BAS example, 3 .BAT file examples

[ Invalid Attachment ]

Known bugs:
- Sometimes BASIC files have no spaces between Commands and other expressions. (I re-entered a whole basic prog with autotype after "printing" it out, then it worked... Strange, really)
- Relative jumps not possible because a) BASIC prog. cannot be executed and b) no CPC emulation included. (They normally only appear while a program is running, so no worries)

Help me to improve it ;)

It's no official release! I just attached it here for copychr$ and for you all of course, too, to try it.

The extracted files all appear in the same folder, where Baslist.exe is located. (Make sure, it has write permissions inside it's folder)
« Last Edit: 01:52, 28 June 13 by Devilmarkus »
like
0
No reactions
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #16 on: 14:12, 28 June 13 »
Some bugs fixed: (One was, that the app. didn't close)


like
0
No reactions
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline copychr$

  • Supporter
  • CPC664
  • *
  • Posts: 69
  • Country: ch
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #17 on: 14:13, 28 June 13 »
Up and running sweet.
In tandem with Kevin's ...

I will remove that posting about those weird REMs, as it achieved its objective ;-)
That also made rid of those "too long lines".

Repeatedly calling it from dos without a problem, working through a filename list.

Also tried your "Open with" advice on the BAS file extention in windows.
Every bas file gets its icon. With a double click a txt file pops up.
Instant read in the view pane. Voilà.

Not to gush, but now I have 2 favorite programs up.
Same named twins by Kev and Dev :-) What's a user to do?
« Last Edit: 14:41, 28 June 13 by copychr$ »
like
0
No reactions

Offline copychr$

  • Supporter
  • CPC664
  • *
  • Posts: 69
  • Country: ch
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #18 on: 15:30, 30 June 13 »
Attached are file compare results on 11 BAS files from your test download.

4 passed in both Kevin's and your version of Baslist. Exact copies.
Please find other info in the zip.

I'm doing this on random basic files also, and will foreward anything useful.
like
0
No reactions

Offline copychr$

  • Supporter
  • CPC664
  • *
  • Posts: 69
  • Country: ch
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #19 on: 15:52, 30 June 13 »
Markus provided me with some fixes and I need to upload a new version.

I leeched on to markus as soon as it said baslist in the searchbox ;-)
Didn't ignore you, but hey, you all go by more names now than some people on WoW.

We went through this routine before, so these results are familiar.
Both baslist versions do the same run and results are accessible side by side.
Please consider this meant equally for your use.

like
0
No reactions

Offline copychr$

  • Supporter
  • CPC664
  • *
  • Posts: 69
  • Country: ch
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #20 on: 19:18, 30 June 13 »
 :blank: Now the sun shines.

12 old type-ins, all pass the 2 baslist hurdle. One is 16K.

All the escape chars required for correct html. have been inserted.
Code can be copy/pasted from the browser window.

The txt files contain the code as baslist output.

Nothing says they actually run, one would have to play them from the included dsk.
Provenance is mentioned in the zip.
like
0
No reactions

Offline copychr$

  • Supporter
  • CPC664
  • *
  • Posts: 69
  • Country: ch
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #21 on: 00:27, 05 July 13 »
Hello Kevin and Markus,

I've picked out fails etc, or quircks from about 50 programs, and put them into 2 test programs.
In the end it's pretty simple; numbers and a few other things ;-)

It doesn't look like there is anything much new for you.

Results are very fair, most numbers are perfect after putting ascii back to dsk!
More in the zip, along with some exceptional characters in the 10 liner Minicalc.bas by ...

« Last Edit: 00:29, 05 July 13 by copychr$ »
like
0
No reactions

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #22 on: 16:06, 05 July 13 »
Great tests!

I have just fixed how I translate REM statements. There was a bug there.

Much better :)

I need to do fix more with the display of numbers.

Interestingly, integer numbers like 49152 are tokenized as floating point numbers!

like
0
No reactions
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #23 on: 00:47, 06 July 13 »
Interestingly, integer numbers like 49152 are tokenized as floating point numbers!

Due to it exceeding 32767 I presume.
like
0
No reactions
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline copychr$

  • Supporter
  • CPC664
  • *
  • Posts: 69
  • Country: ch
    • Awards
Re: BASlist Java Tool to list BASIC files
« Reply #24 on: 01:50, 06 July 13 »
Experimenting with putting ascii code back to dsk and saving to bas, is pretty useful.

Kevin's baslist was letter perfect  on MINICALC.BAS, and when put back to the CPC listed and ran as when birthed (by forceps no doubt).

Java test_baslist pulls out numbers well, but shows some added digits at the end:
Code: [Select]
370 PRINT 0.0
380 PRINT 0.12345678
390 PRINT 1.2345678
400 PRINT 2.345678
410 PRINT 3.45678
420 PRINT 4.5678
430 PRINT 5.677999999
440 PRINT 6.779999999
450 PRINT 7.800000001
460 PRINT 8.0
470 '
490 PRINT 0.00000003
500 PRINT 0.00000032
510 PRINT 0.00000327
520 PRINT 0.00003276
530 PRINT 0.00032766
540 PRINT 0.00327669
550 PRINT 0.03276699
560 PRINT 0.32766999
570 PRINT 3.2766999
580 PRINT 327.669989944
590 PRINT 3276.699899673
600 PRINT 32766.999000549
610 PRINT 327669.989990234

However, once saved back to BAS on the CPC, the original listing shows again:
Code: [Select]
370 PRINT 0
380 PRINT 0.12345678
390 PRINT 1.2345678
400 PRINT 2.345678
410 PRINT 3.45678
420 PRINT 4.5678
430 PRINT 5.678
440 PRINT 6.78
450 PRINT 7.8
460 PRINT 8
480 '
490 PRINT 0.00000003
500 PRINT 0.00000032
510 PRINT 0.00000327
520 PRINT 0.00003276
530 PRINT 0.00032766
540 PRINT 0.00327669
550 PRINT 0.03276699
560 PRINT 0.32766999
570 PRINT 3.2766999
580 PRINT 327.66999
590 PRINT 3276.6999
600 PRINT 32766.999
610 PRINT 327669.99

Picture perfect, love it or leave it.
« Last Edit: 01:55, 06 July 13 by copychr$ »
like
0
No reactions