View Full Version : old dos programs
sandyrepope
08-06-2008, 18:15
I've been looking at old programs for DOS for a while now and am shocked. Program sources for gw-basic and qbasic, for example, are extremely difficult to understand. The problem is the goto statement and a lack of comments. Also, the naming of variables. All three of these contribute to making a source very hard to understand.
I think that the goto statement is mainly the reason old code is so hard to understand. Even in the shortest programs it's next to impossible to follow the logic.
I started out with the idea that some of the old programs for console could be rewritten for thinbasic. It sounded like something that would be relative easy to do. *I was wrong about this*. I wonder why people wrote such strange code.
I'm beginning to question whether some of these programs 'can' be rewritten at all.
What do you think?
Thanks
Sandy
zlatkoAB
08-06-2008, 19:35
Welcome to the '80 !!
Yes GOTO is very unlogic command but in past is the main command
especialy with 8bit computer.
Petr Schreiber
08-06-2008, 19:42
Hi,
I was little worried about Eros decision to not put GOTO in thinBASIC, but more I use tB, more I appreciate he did it like that. GOTO is not evil, I have nothing against use of its equivalent in short assembler proggies, but in high level language it is pretty redundant today.
If I am not wrong, GOTO was only way to escape 3 nested FORs in C for example, but in thinBASIC we can go EXIT EXIT EXIT FOR and we are out of here :)
I must admit in last programs I started to put lower number of comments, will try to correct this habit.
I think every GOTO source code can be rewritten to "modern" shape, but it will need slightly different approach in the logic of the code.
Petr
P.S. I still use GTO on my 4bit ubercalc, but that is because I have no better option in the language used there. Solution is to document the code on piece of paper, to not get lost later :)
Michael Clease
08-06-2008, 22:35
Sandy please post any code you have I am sure it can be converted and would love to try.
I remeber that the JMP command in 68000 and that I would use it instead of JSR all you needed to do was to push the return address on the stack then called the sub routine with a JMP this would use less CPU cycles.
sandyrepope
09-06-2008, 02:26
Sandy please post any code you have I am sure it can be converted and would love to try.
Ok. Here is something for you to look at. Let me know what you think.
Thanks
Sandy
ErosOlmi
09-06-2008, 07:53
:o OMG.
Now you know why I avoided to develp GOTO/GOSUB ;)
Michael Clease
09-06-2008, 09:50
ALIAS CALL as GOSUB
they are almost the same ;)
Petr Schreiber
09-06-2008, 10:02
Hehe,
good trick Abraxas!
ErosOlmi
09-06-2008, 10:33
Very clever Abraxas !
Michael Clease
11-06-2008, 01:30
Sandy I had a look and all of it can done in TB but I am not sure what all that poking is about my best guess is something to do with audio.
sandyrepope
11-06-2008, 04:13
I've tried cutting out all the graphics and sounds and then rewriting just the text parts in thinbasic. I've got about 1/3rd way through and am now totally lost. I just can't seem to get it right now. I'll take a break from it and then get back to it later.
Thanks
Sandy