.PRG to .TXT and .HTM conversion

You need an actual VIC.

Moderator: Moderators

Post Reply
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

.PRG to .TXT and .HTM conversion

Post by Leeeeee »

As a kind of complement to Borays' Textport (see http://sleepingelephant.com/ipw-web/bul ... .php?t=167) I've hacked (written would imply some planning) together a QUICKBASIC program that does a similar job. The main difference, apart from running on a PC, is that it takes the raw .PRG basic program file and makes a text and html version of the listing.

You can see three examples here .. http://www.themotionstore.com/leeedavison/temp/vic20/ .. the first one is a bit long, 132Kbytes long. This is the raw output from the program and has not been edited at all.

Boray, I've included your program in html as an example output because it was a good test of my code. Thank you.

If anyone is interested I'll polish it up and post a page about the program.

Comments?

Cheers,

Lee.
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Cool! And it works for super expander as well I see!

Could you give me the ascii source code so that I could compile an amiga version in Hisoft Basic? (It's almost the same as quickbasic).

/Anders
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

I had to put the super expander codes in as the first program I tried it on was OLDORF.PRG.

I'm playing with having the option of putting in the Vic characters as 8x8 bitmaps for the inverse and graphics characters instead of the curly quoted names, {BLK} or {CLR} for example. It looks quite good but needs a shedload of small graphics files, half done so far, and makes an even bigger HTML file. The other problem is working out what gets shown and when.

I'll post the source when it's a little more presentable and I've added all the features I want. More little bitmaps to do.

Cheers,

Lee.
vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

Post by vic user »

i have not tried it yet, but it sounds great!

i write code in windows as a text file sometimes, and then resaving it as a .prg file then transferring to my vic, but your method sounds way more efficient and powerful

chris
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

There's another file available now in http://www.themotionstore.com/leeedavison/temp/vic20/ called textport.zip. This is the graphic version of Boray's program with 8x8 bitmaps replacing all the C= special characters. This is probably the most different C= characters you'll ever find in one program, 100 of them at my count.

It's as a .zip file because I didn't want 101 extra files in the directory. 8^)=

Boray if you could grab this and have a look sometime and tell me if it looks right.

Comments anyone?

Cheers,

Lee.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Lee,

I checked the *.zip file, and couldn't find any obvious errors. However, I found the strings somehow difficult to read, as green on white doesn't have a good contrast on the CRT I use.

I do use an own program similar to TEXTPORT, but written in C, that checks for repeated runs, and adjacent quoted characters. Only a single space is left unquoted - otherwise you'd have a {SPACE} after each line number. This program does 95% of the job. I then replace '} {' with ',SPACE,', '} "' with ',SPACE}", '" {' with '"{SPACE,', and break the lines manually in a text editor. I did tron.txt like this.

The conversion to *.HTML with included graphic and control characters expands the data even more (and, alas, this time with the proviso, that a re-conversion is now near impossible - at least automatically):

1. One could render the whole program as bitmap. As example I made a hand-crafted example of TRON using several screenshots in VICE. This needn't be a *.PNG of course, any other portable bitmap format could serve as well.

2. TEXTPORT and/or my C Program could be complemented by a program, that does the (rather trivial) back conversion. IIRC there was a way to re-tokenise a SEQ PETSCII file by re-directing input to this file. Otherwise the tokenizing also would have to be done on the big machine, but there are dozens of BASIC extensions...

[half an hour later:]

63995 POKE812,238:OPEN2,8,2,"<program name>,S,R"
63996 IFST<>0THENPOKE812,239:CLOSE2:END
63997 PRINT"{CLR}";
63998 GET#2,A$:PRINTA$;:IFA$<>CHR$(13)THEN63998
63999 PRINT"GOTO63996":POKE631,19:POKE632,13:POKE633,13:POKE198,3

I see it's near half past two a.m. Central European Time. I'll go to bed now...,

Michael
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

Go here .. http://www.themotionstore.com/leeedavis ... index.html .. where the program and all other bits needed now resides. (It's also on Lycos but this is add free!)

I did try the dark red/blue/green but they were a bit too dark on the LCD on my laptop, perhaps a later version will be configurable.

Right, let's see a plethora of HTML Vic listings! 8^)=

Cheers,

Lee.
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

Of course on converting a few test programs this worning I discover some of the ASCII versions of the characters are incorrect, nuts!

It should all be ok now, I've also added some specials that you wouldn't usually see such as {ENA} and {DIS} for enable and disable case switch and I've changed the C= + key to remove the spaces.

Version is now 1.37

Cheers,

Lee.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Leeeeee wrote:[...] I've also added some specials that you wouldn't usually see such as {ENA} and {DIS} for enable and disable case [...]
Additionally you could refer to CHR$(3) as {STOP}, and CHR$(131) as {RUN}. The first can be entered directly in quote/insert mode, the second is available as "artificial" control character. I use both in my LIFE program.

Regarding artificial control characters: Type in

PRINT""{DEL,RVS ON}N{RVS OFF}""{DEL}

...and press RETURN. This actually works!

Greetings,

Michael
User avatar
Schema
factor
Posts: 1430
Joined: Tue Mar 23, 2004 7:07 am
Website: http://www.jammingsignal.com
Location: Toronto, Ontario

Post by Schema »

Once again - Online .prg to .txt converter. Very handy.

http://www.davidviner.com/cbmlister.php
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

Additionally you could refer to CHR$(3) as {STOP}, and CHR$(131) as {RUN}. The first can be entered directly in quote/insert mode, the second is available as "artificial" control character. I use both in my LIFE program.
Bother! Done, v1.38 available now.

I can get the {STOP} without too much trouble but how do you get {RUN} from the keyboard? I can't find reference to either of them BTW.

Cheers,

Lee.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

{RUN} can be embedded in double quotes likewise as in my {CTRL-N} example above:

"{RUN}" := ""{DEL,RVS ON,SHIFT-C,RVS OFF}""{DEL}

so that, for example

GETA$:IFA$="{RUN}"THEN do_something

and

GETA$:IFA$=CHR$(131)THEN do_something

are equivalent. If you want to check for STOP, you need to de-activate its normal action. I use POKE 788,194 for this (alas stops the jiffy clock, too). You could investigate LIFE's BASIC listing, which is visible after a STOP+RESTORE, and check your converter against it.

Other references? I don't know in the moment, but I remember, that I checked this way for the STOP key as early as '85. :)

Greetings,

Michael
Last edited by Mike on Fri Feb 04, 2005 4:34 pm, edited 1 time in total.
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Thanks for the source... But it seems Hisoft basic/quick basic are more incompatible than I thought... After about 15 compiler errors, I gave up... ;) Maybe I will give it a better try some say...

/Anders
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Post Reply