Re-writing a program ...

A forum for anything about the Steem Engine STE emulator, comments, problems, bug reports etc. Steven Seagal regularly provides updated versions of the original STEem code. The current version is v3.9.4.

Moderators: Mug UK, Steem Authors, Moderator Team

vodkasoda
Atari maniac
Atari maniac
Posts: 94
Joined: Wed Jul 07, 2010 3:55 pm

Re-writing a program ...

Postby vodkasoda » Wed Jul 07, 2010 5:00 pm

Hi all, I am attempting to rewrite a GFA program in C# ... it's not easy because (a) my GFA is very rusty & (b) I am new to C# ... but I'll get there eventually 8) ...

I can run the program in Steem and I can put a trace on so that I get every statement, this is what I need in order to break down the GFA program ... however, this just scrolls off the screen & I can't see previous screens, or if I can, I don't know how to !!! What I would really like to do is to let the program run, replying on screen as necessary when the Alert boxes pop up but to have the trace information recorded to a file that I can then look at in Word or as a hardcopy, on paper. Is there a way of doing this, either via a command put into the top of the program, or via a Steem option ?!?!?

Thanks in advance ... :cheers:

BTW, just so you know, this is not hacking, I am doing it at the request of the owner of the program !!!

vodkasoda
Atari maniac
Atari maniac
Posts: 94
Joined: Wed Jul 07, 2010 3:55 pm

Re: Re-writing a program ...

Postby vodkasoda » Thu Jul 08, 2010 12:06 pm

Does nobody know how I can get a trace of this program running :cry: ?!?!?

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2531
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: Re-writing a program ...

Postby charles » Thu Jul 08, 2010 10:54 pm

am willing to decipher some gfa for you ,
we should work together ,
this way i can pick up some basic c pointers

how do you feel towards this?

charles
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

vodkasoda
Atari maniac
Atari maniac
Posts: 94
Joined: Wed Jul 07, 2010 3:55 pm

Re: Re-writing a program ...

Postby vodkasoda » Fri Jul 09, 2010 8:27 am

I have no problem with that Charles as I obviously need help, it must be 20 years since I wrote a BASIC program of any kind !!!

It will be a while before I get on to C# (C-Sharp in case that character is not showing up, not C or C++, just so you know !) though, I have to break this program down and find out what it's doing first !!!

Gary

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2531
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: Re-writing a program ...

Postby charles » Fri Jul 09, 2010 1:23 pm

well
i am here if you need me

i have a private message and an email

charles.copp@sympatico.ca

charles
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2442
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Re-writing a program ...

Postby lp » Sat Jul 10, 2010 2:04 am

What method are you using to trace which causes the screen scroll? Is it the TRON command?

vodkasoda
Atari maniac
Atari maniac
Posts: 94
Joined: Wed Jul 07, 2010 3:55 pm

Re: Re-writing a program ...

Postby vodkasoda » Sat Jul 10, 2010 12:51 pm

lp wrote:What method are you using to trace which causes the screen scroll? Is it the TRON command?


Yes, and as far as I can see, it is doing what I want, it's just that I can't see it, :roll: !!!

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2442
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Re-writing a program ...

Postby lp » Sat Jul 10, 2010 4:48 pm

Ok, then do this at the very top of the program:

Code: Select all

TRON my_trace

Then add this procedure:

Code: Select all

PROCEDURE my_trace
  OPEN "A",#99,"a:\blah.lst"  !change the path here to suit you, as a floppy will be slow
  PRINT #99;TRACE$
  CLOSE #99
RETURN

I used channel 99 so it does not conflict with any open channels in the program, in case you used some.

This will stop the screen from scrolling by redirecting the trace to a disk file.

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 5122
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Re-writing a program ...

Postby simonsunnyboy » Sat Jul 10, 2010 5:01 pm

lp wrote:Ok, then do this at the very top of the program:

Code: Select all

TRON my_trace

Then add this procedure:

Code: Select all

PROCEDURE my_trace
  OPEN "A",#99,"a:\blah.lst"  !change the path here to suit you, as a floppy will be slow
  PRINT #99;TRACE$
  CLOSE #99
RETURN

I used channel 99 so it does not conflict with any open channels in the program, in case you used some.

This will stop the screen from scrolling by redirecting the trace to a disk file.


Interesting technique: does this dump to disk exactly while tracing or is the trace buffered and written to disk only at program exit?
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2442
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Re-writing a program ...

Postby lp » Sat Jul 10, 2010 5:07 pm

simonsunnyboy wrote:Interesting technique: does this dump to disk exactly while tracing or is the trace buffered and written to disk only at program exit?


It will dump each line of code as its encountered in real-time. Likely horribly slow with a floppy and it will eat up disk space rather fast I suspect. However, GFA internally buffers all file read/writes up to 4kb, so it will appear to have a delayed reaction at times. :wink:

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 5122
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Re-writing a program ...

Postby simonsunnyboy » Sat Jul 10, 2010 5:15 pm

So a nogo to trace game or democode this way - but in general a very handy feature indeed!
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2442
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Re-writing a program ...

Postby lp » Sat Jul 10, 2010 5:28 pm

In side the TRON procedure TRACE$ contains the code to be executed next. TRACE$ is treated like any normal string variable. You can easily send it to any standard device, out the serial port if you like, for example. You can also use gfx commands and display it on the screen somewhere to. Its possible to trace about anything, if you make a custom trace routine. I have a set of routines I made a long time ago that sends the trace code out the MIDI port and its then displayed on the machine sitting next to it with a special receiver program. That's somewhat radical way to debug though, however it let me run the app without disturbing the screen.

vodkasoda
Atari maniac
Atari maniac
Posts: 94
Joined: Wed Jul 07, 2010 3:55 pm

Re: Re-writing a program ...

Postby vodkasoda » Sun Jul 11, 2010 5:19 pm

lp wrote:Ok, then do this at the very top of the program:

Code: Select all

TRON my_trace

Then add this procedure:

Code: Select all

PROCEDURE my_trace
  OPEN "A",#99,"a:\blah.lst"  !change the path here to suit you, as a floppy will be slow
  PRINT #99;TRACE$
  CLOSE #99
RETURN

I used channel 99 so it does not conflict with any open channels in the program, in case you used some.

This will stop the screen from scrolling by redirecting the trace to a disk file.


OK, I've done this (I put the Procedure right at the bottom of the program as there are already almost 200 procedures, is that ok ?) but I get an error ... the first thing that happens is that STEEM immediately puts a # in front of the my_trace statement and capitalises it, so the statement becomes "Tron #My_trace" ... I run the program and it says "File not open" ... I wondered if it is because the file doesn't exist on my C:Drive, so I created it but it made no difference :(

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2442
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Re-writing a program ...

Postby lp » Sun Jul 11, 2010 6:21 pm

Which version of GFA? Must be version 2. :wink:

Ok do this instead. At the very top:

Code: Select all

OPEN "O",#99,"a:\blah.lst"  !change path if needed
TRON #99 !redirect the trace output to the file

When the program ends:

Code: Select all

CLOSE #99

This method should work. It appears version 2 of GFA does not support the fancy tracing option with a special procedure.

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2531
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: Re-writing a program ...

Postby charles » Mon Jul 12, 2010 5:25 am

i tried it lonny , it worked for me ...

but the first version needed a file existing already to "A" append to

so i changed mine to 0 and worked ,, i use gfa v 3.6tt

no way to trace a compilled program is there?
force the compillier to leave in the trace/tron?

charles
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2442
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Re-writing a program ...

Postby lp » Mon Jul 12, 2010 6:36 am

charles wrote:no way to trace a compilled program is there?
force the compillier to leave in the trace/tron?


Do you realize how stupid that comment is?

vodkasoda
Atari maniac
Atari maniac
Posts: 94
Joined: Wed Jul 07, 2010 3:55 pm

Re: Re-writing a program ...

Postby vodkasoda » Tue Jul 13, 2010 9:26 am

lp wrote:Which version of GFA? Must be version 2. :wink:

Ok do this instead. At the very top:

Code: Select all

OPEN "O",#99,"a:\blah.lst"  !change path if needed
TRON #99 !redirect the trace output to the file

When the program ends:

Code: Select all

CLOSE #99

This method should work. It appears version 2 of GFA does not support the fancy tracing option with a special procedure.


I will give this a try in a minute and let you know how I get on, haven't been able to look at this project since Saturday !!!

Thanks for your help ...

vodkasoda
Atari maniac
Atari maniac
Posts: 94
Joined: Wed Jul 07, 2010 3:55 pm

Re: Re-writing a program ...

Postby vodkasoda » Thu Jul 15, 2010 10:37 am

Ip, that works, thank you very much !!

BUT, ever since I've run it successfully I can't get the program to run again, not even the original un-edited version, not even by exiting & re-starting STEEM as Administrator and re-loading the original program, I just get "INVALID HANDLE" ... what does that mean ?!?!?

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2442
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Re-writing a program ...

Postby lp » Thu Jul 15, 2010 3:02 pm

That might be related to a file channel. Try removing the trace stuff and see if it goes away if that is all you changed, likely that. Or its possible the file does not get closed and when you try to run it a 2nd time then the file is already open.

You can do a test. Press escape (go to direct mode) when the program ends, type "close" press return, then press escape to get back to the editor. Then if it runs ok, it was an open file not closed.

vodkasoda
Atari maniac
Atari maniac
Posts: 94
Joined: Wed Jul 07, 2010 3:55 pm

Re: Re-writing a program ...

Postby vodkasoda » Thu Jul 15, 2010 6:38 pm

lp wrote:That might be related to a file channel. Try removing the trace stuff and see if it goes away if that is all you changed, likely that. Or its possible the file does not get closed and when you try to run it a 2nd time then the file is already open.

You can do a test. Press escape (go to direct mode) when the program ends, type "close" press return, then press escape to get back to the editor. Then if it runs ok, it was an open file not closed.


Perfect, I wondered if it might be something like that, but (a) I would have assumed that closing STEEM & re-starting it would have resolved it and (b) I wouldn't have had a clue how to sort it out myself !!!

Thanks again, I might be able to get somewhere now :cheers:

Gaz


Social Media

     

Return to “Steem”

Who is online

Users browsing this forum: No registered users and 2 guests