News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Devilmarkus

BASlist Java Tool to list BASIC files

Started by Devilmarkus, 10:28, 05 September 11

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Devilmarkus

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!
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

Gryzor

Why not add an Open function?

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

Devilmarkus

#2
Quote from: Gryzor on 10: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...
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

Devilmarkus

#3
Examples:
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


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!

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 ;)
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

copychr$

#4
Quote from: Devilmarkus on 10:28, 05 September 11
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 ;-)



Devilmarkus

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...
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

copychr$

#6
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.

Devilmarkus

I could do this for regular 40 tracks data dsk's...

For that it's no problem.
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

copychr$

#8
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?




Devilmarkus

#9
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...
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

TFM

TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

copychr$

#11
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 ;-)

arnoldemu

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.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

copychr$

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 ...



Devilmarkus

As I told ;)

In JavaCPC Desktop the BASList already has the fixes:

[attach=2]

I just need to make it standalone again...

(When I find the motivation / time)
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

Devilmarkus

#15
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

[attachurl=2]

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)
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

Devilmarkus

Some bugs fixed: (One was, that the app. didn't close)


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

copychr$

#17
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?

copychr$

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.

copychr$

Quote from: arnoldemu on 13:14, 27 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.


copychr$

 :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.

copychr$

#21
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 ...


arnoldemu

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!

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

AMSDOS

Quote from: arnoldemu on 14:06, 05 July 13
Interestingly, integer numbers like 49152 are tokenized as floating point numbers!

Due to it exceeding 32767 I presume.
* 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

copychr$

#24
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:

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:

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.

Powered by SMFPacks Menu Editor Mod