Page 1 of 3

ProgramViewer CE

Unread postPosted: 27 Feb 2016, 19:32
by PT_
Today I've been busy with my new program, an *advanced* program viewer for the CE in pure ASM. It takes the program name as a string in Ans, and it displays the whole program, but instead of the usual 9 lines, you can see about 28 lines of code, and I'm going to add indentation as well. This is a hard project, because I'm not really experienced with ASM, but no one cares :P
I've used Mateo's _PrintString routine for displaying the whole program, which has a nice font, and is pretty small.
How the basic program works:
Code: Select all
Read Ans as a string
Convert it to a program name in OP1
Check if program exists, and if not, return
Setup the graphics
For each token of the data of the program:
  Get the token in ASCII characters with _Get_Tok_Strng
  Display all the characters, if not offscreen
  If (newline) is entered, move the cursor to the newline
  If end of program reached, stop
End
Possibility to move up or down and eventually left or right
Pause
Return

I'm now at the stage for displaying the characters. This is what I got so far:
Image
Image
(That last characters looks awesome but is not intended :P)

In a later version, I will maybe add editing as well, now I'm okay with this :D

I know, this could be MUCH easier with the C libraries, but with C it is very hard to convert the number to a string, so I made this in pure ASM.

If you have any suggestions or questions, please post :)

Re: ProgramViewer CE

Unread postPosted: 27 Feb 2016, 20:15
by critor
Very interesting! :)

Keep up the good work.

Re: ProgramViewer CE

Unread postPosted: 27 Feb 2016, 20:48
by Epharius
Much more practical than the program editor, but of course, very hard to program ;)
Maybe you could add syntaxic coloration if you have the time? I think it would be nice, and useful. For example, while/For/Repeat are blue etc...

Good luck and keep us informed!

Re: ProgramViewer CE

Unread postPosted: 27 Feb 2016, 21:47
by PT_
critor wrote:Very interesting! :)

Keep up the good work.

Thanks :)
Epharius wrote:Much more practical than the program editor, but of course, very hard to program ;)
Maybe you could add syntaxic coloration if you have the time? I think it would be nice, and useful. For example, while/For/Repeat are blue etc...

Good luck and keep us informed!

Yea, that sounds really hard, but it is a good idea ;)

Re: ProgramViewer CE

Unread postPosted: 28 Feb 2016, 05:15
by DoOmnimaga
Seems like a cool project. I hope you can pull it off as it could become handy to many people. Will it feature the ability to jump to the next label, counting Ends and checking if there are too many and such stuff?

Re: ProgramViewer CE

Unread postPosted: 29 Feb 2016, 10:38
by PT_
DJ Omnimaga wrote:Seems like a cool project. I hope you can pull it off as it could become handy to many people. Will it feature the ability to jump to the next label, counting Ends and checking if there are too many and such stuff?

I will give it a try of the Lbl-jump, with the help of Epharius (I believe he already did such thing).
What is counting Ends useful for?
But anyway, I've holidays this week, so hopefully enough time to work on it! :)

Re: ProgramViewer CE

Unread postPosted: 29 Feb 2016, 14:14
by Bisam
Counting "Ends" is useful to check the syntax of the program while typing instead of checking it at execution.

As for the feature requests, maybe an automatic indentation of the code could be a good idea (and counting the "Ends" would have a second interest :p )

Re: ProgramViewer CE

Unread postPosted: 29 Feb 2016, 15:02
by PT_
Bisam wrote:Counting "Ends" is useful to check the syntax of the program while typing instead of checking it at execution.

As for the feature requests, maybe an automatic indentation of the code could be a good idea (and counting the "Ends" would have a second interest :p )

Ah thanks!
PT_ wrote:...and I'm going to add indentation as well...

:troll:

Re: ProgramViewer CE

Unread postPosted: 29 Feb 2016, 15:15
by Bisam
I knew I had read that somewhere... but I couldn't find it.
It seems that I'm not used to fast read english...

Re: ProgramViewer CE

Unread postPosted: 29 Feb 2016, 15:50
by PT_
Bisam wrote:I knew I had read that somewhere... but I couldn't find it.
It seems that I'm not used to fast read english...

Don't mind ;)

I've implemented the new-line-routine, with some struggles, but it seems to work!

Image

EDIT: I've added the : for each new line!

Image