APPLICATIONSDIVERS ★ TRON ★

Tron (Amstrad Computer User)Applications Divers
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

KEEP TRON TRUCKING

You know how it is: you have just spent three days typing in that listing from a magazine, or three weeks composing that 30K masterpiece, and when you finally run the whole thing it starts printing gibberish on the screen, and not playing that Submarine Flight Simulator like it should. Well, now is the time to use the Amstrad's Trace function, to print out the line numbers as the program is executing them, and if you didn't know that it had one - read your manual. It's amazing how many people don't, you know. Anyway, to get back to the point, the trace function is turned on with the command TRON (TRace ON, and wasn't it a great film?) and off with -obviously enough - TROFF. With TRON running the screen looks even worse. It just prints the line number at the next available cursor position, and so the screen rapidly becomes full of numbers, which is not as useful as it could be.

Fear not; with this program the line numbers are directed to Channel 7 and the program will chug along as it would normally. Also, to give you more of a chance to see which are the offending lines, you have a variable speed control with 255 speeds (and normal speed) to choose from. And as if that isn't enough, so as to leave the display completely intact, you can have all the TRON output sent to your printer if you have one connected. Type in the program and run it. You do not need to save it first as it cannot do anything until you page it in. If you get any of the data wrong then the program will tell you which line needs attention. If all is well it will have moved HIMEM down by 208 bytes and put itself above it out of the way. It doesn't matter where you have HIMEM as the POKES in the program will tell it where it is. So, if you find that it conflicts with any of your programs that use that area, then lower HIMEM before running it for the FIRST time. When it has run once it will not lower HIMEM again - if you have to make corrections to the DATA for example.

When you have a proper working copy then you can save it. To see it in action you need to page it in. As all that is neccesary to do this is three POKES, I didn't see the point for a special RSX, but what the program does do is put a command string in the ZERO key on the numeric key pad to do the POKES, and one in the POINT key on the pad to turn it off. Hit ZERO, press ENTER to send the command and you should see....nothing at all. This is because you aren't running a program. Type NEW and ENTER then type in this little program as shown.

10 FOR n=32 TO 255
15 REM
20 PRINT CHR$(n);
25 REM
30 NEXT n

The REMs are just so you can see more numbers when it runs. Set up a suitable window for the TRON numbers to go into, such as:

WINDOW #7,1,40,25,25

which is the bottom line of the screen in Mode one, and type in:

TRON:CLS: RUN

Do not type 'MODE 1' to clear the screen or this will reset the window for channel 7. It is not a good idea to try this on the actual program you have just saved because it will crash as it tries to change itself while it is running.

What you should see is the character set being printed out as normal at the top of the screen and the line numbers being printed on the bottom of the screen. To see the difference, press ESC ESC, page out the routine by pressing the POINT key on the pad and ENTER, and run the program again. Press ESC ESC and page it back in for the next bit. This is all very useful but the numbers go a bit quickly and so now you can try out the speed control. Simply POKE 2 with a number between 0 and 255: 0 is normal and 255 is very slow. Try 20 and you will notice that the 'Ready' message is printed slower than normal. This is because the routine slows down all the printing on the screen, except what you type in from the keyboard and during editing, as the interpreter uses a lower level of indirection for those tasks. Your program will list slower too. Now run it and if you still think it's too fast then slow it down some more. If you don't want the TRON numbers to appear on the screen at all, whether it's because you have a very full screen • and remember you can put Channel 7 anywhere on the screen - or you are using all the windows already, you can send all the numbers to the printer. You do this by POKE 3,0. Any other number will send them to the screen. If you don't have a printer and you have a very full screen, the problem with making a very small window for the numbers is that if they are not all the same size, parts of them appear on different lines and they are very hard to read. To get around this POKE 4,0 then carriage return and a line feed is printed after each number, so they all start printing on the left of the window. Define your window three characters wider than the number of digits in your highest line number and two high, e.g. if your highest number is 12000 use:

WINDOW #7,1,8,24,25

or similar. This is one for the brackets either side and a SPACE to stop the window scrolling when the cursor reaches the right hand side. Any other number POKEd into location 4 will turn off this feature. I don't suggest you use it with the numbers going to the printer or you will use a of a lot of paper.

Now, this is an overview of the routine and some of its limitations. Firstly, when the PRINT indirection is directed to it, it prints as normal until it meets the '[' character which is printed before each line number when TRON is working. It then sets a flag, but does not print the character. It waits until the next character and if it is a number it prints both the '[' character and the number to channel 7 or the printer depending on which you have selected, and sets a flag to say 'output to channel 7 from now on'. However, if the character following the'[' was not a number it prints them both to the normal screen, and resets the 'output to 7' flag. This has minor limitations. If you really want to print a '[' and a digit on the normal screen then it will go to channel 7, but who uses '[' in BASIC? There is one other check on the characters. If you print the'[' character on the screen and then the routine wants to print the line number it would revert control to the screen when it came across a second '[' at the start of the number. For this case when'[' is followed by '[' one goes to the screen, one to channel 7 and the 'output to 7' flag is left on. This means that for every'[' followed by'[' on the screen an extra one goes to channel 7 (or the printer) for good luck. This is not really a problem as at least the normal display gets the correct characters. This also means that if you print multiple '['s, then they will be echoed in channel 7 even when TRON is TROFFed. If you really want to do this then page out the routine as you are not using it anyway.

When the 'output to 7' flag is set all the output is of course sent to channel 7 until the ']' character is found; where upon it is reset to the screen, after checking whether a carriage return and line feed need to be sent after printing the ']' character. Altogether, this routine should help make debugging large programs less of a nightmare. This means that any text you want to send to the printer can be prefixed by a (1. Then ] to stop output to the printer. This is ideal for printinga catalogue.

ACU #8512

★ PUBLISHER: Amstrad Computer User
★ YEAR: 1985
★ CONFIG: 64K + AMSDOS
★ LANGUAGE:
★ LiCENCE: LISTING
★ AUTHOR: Chris Wood

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» RSX-Tron-Chris  WoodDATE: 2014-05-05
DL: 226
TYPE: PDF
SiZE: 216Ko
NOTE:

★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
Je participe au site:
» Pour ce titre nous ne disposons de fichier executable sur CPC (Dump, Saisie du listing) , alors si vous avez ça dans vos cartons ou vous désirez usé vos petit doigts boudinés sur votre clavier faites le nous savoir.
» Vous avez des infos personnel ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 557 millisecondes et consultée 1694 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.