Listing to a file

By eimaster

Expert (108)

eimaster's picture

08-01-2017, 11:06

I used the console command listing and I saw a basic program listing on the console window but I could not scroll back and forth to see the whole program.
How can I save or direct the listing to a txt file so I can do whatever I want with it?

Note: I am talking about openMSX for Android.

Login or register to post comments

By sd_snatcher

Prophet (2579)

sd_snatcher's picture

08-01-2017, 12:02

You just have to use the ,A parameter of the SAVE command, like this:

SAVE"FILENAME.TXT",A

The LOAD command can load text files normally later.

By Manuel

Ascended (13478)

Manuel's picture

08-01-2017, 12:33

On Android it's a bit tricky... But it works the same as on PC in principle.
You have several options:
1. Redirect output of console command to file: that's a bit complex to type here on my phone
2. Save ASCII file to disk image and export it with diskmanipulator
3. Print the listing with the llist MSX basic command after plugging in the printer logger and perhaps first setting the printer log file name setting to a desired value

Don't have time to explain in more detail now, but our manual contains a lot of information to help you further with these hints. Or perhaps other users can fill in some details.

By eimaster

Expert (108)

eimaster's picture

09-01-2017, 00:07

Thanks for your help friends.
I already know how to save and print a BASIC listing. It only can be done if I am already in the basic interpreter and the program is not runnig.
What I want to do is concerning Sakhr built-in framework programs which I know and/or suspect to be written in BASIC. Try this:
Choose for example AX-170 and in the main menu choose the painter program. After it starts I can't stop its execution and basically LIST it, can I?!
So, the only thing to do is using the console. I open the console window and execute listing command. If you do that you 'll see the last lines of a BASIC program. Now how can I save that listing in a TXT file for later use or for editing?!
In the console window I can't even scroll back and forth the whole listings of any previously listinged BASIC program!
Now I hope that you got what I want to do.

By eimaster

Expert (108)

eimaster's picture

08-01-2017, 23:54

Manuel wrote:

Redirect output of console command to file: that's a bit complex to type here on my phone.

That's what I need to know how?!

By Wild_Penguin

Champion (404)

Wild_Penguin's picture

09-01-2017, 22:35

Can you do this with just basic redirections? Like so:

listing sakhr.bas > sakhr.txt

By Manuel

Ascended (13478)

Manuel's picture

09-01-2017, 23:30

No, you need to use the Tcl way, as the openMSX console is just an interactive Tcl shell...

Here's some ideas:
- http://stackoverflow.com/questions/8531031/how-can-i-redirec...
- https://community.cadence.com/cadence_technology_forums/f/31...

I was thinking of this solution myself (from the last link):

set _file [open "/sdcard/myfile.txt" w]
puts $_file [ listing ]
close $_file

where _file is just a variable name for the file handle. You can use any other (non-reserved) name of course, if that types easier :) I picked a path with /sdcard/, as that's probably what you want on Android.

Sorry that on Android there is no way to scroll the console... Perhaps you can connect some USB keyboard to your phone, then you can use PgUp and PgDown.... not sure if that's possible but it makes it a lot easier to work with the console.

Actually, if you install the Hacker's Keyboard, as recommended in the openMSX manual for Android, you can access the PgUp and PgDown keys. Very much recommended if you do keyboard stuff in openMSX Android!

By eimaster

Expert (108)

eimaster's picture

10-01-2017, 11:55

Manuel wrote:

No, you need to use the Tcl way, as the openMSX console is just an interactive Tcl shell...

I was thinking of this solution myself (from the last link):

set _file [open "/sdcard/myfile.txt" w]
puts $_file [ listing ]
close $_file

OK, but do i have to type-in the upper code right into the console window and press ENTER after every line or should I put that code in file?!
If I'm supposed to put that code in a file, then:

  1. where should I save it?!
  2. what sould I name it (under what name and what extension) filename.ext?!
  3. how can I execute it from within the console window?!
Manuel wrote:

Actually, if you install the Hacker's Keyboard, as recommended in the openMSX manual for Android, you can access the PgUp and PgDown keys. Very much recommended if you do keyboard stuff in openMSX Android!

I already have it installed ;)

Dear Manuel and other friends,
Thank you very much for bearing with me and for your constant, frequent, and fast help and response :D

By Manuel

Ascended (13478)

Manuel's picture

10-01-2017, 14:09

You can simply type it in and press enter after every line.
But you can also put it in a text file and load it with the 'source' Tcl command in the console. source /sdcard/path/to/my/scriptfile.tcl (filename and extension are irrelevant, as long as you give the filename to the source command.)

If you have the Hacker's Keyboard, you can scroll in the console with PgUp and PgDown keys of the hacker's keyboard.

My MSX profile