MACHINE CODE INTO MTERM (again)
Last month I wrote an article on loading machine code into the buffer area of MTERM. Everything was fine except that I forgot to mention that the POKES should be done twice. So here it is again!
As is, there is no way to load a machine code routine into the buffer of MTERM (unless it’s in a REM statement). You can exit to BASIC and load a BASIC program, but how do you load a M/C routine to send to a friend?
The BASIC area in the computer which begins at 26710 is also the buffer area for MTERM. To simply say LOAD “”CODE 26710 will result in the error “Nonsence in BASIC”. It may seem the code loaded in but when you call up MTERM you’ll find that the BUFUSD=0.
Looking in the manual you’ll find that the variables area is the next thing above the program area (page 254). On page 263 you will find two system variables PROG and VARS. PROG is a 2 byte system variable that contains the address of the first byte in the BASIC area.
TRY THIS:
PRINT PEEK 23635+256*PEEK 23636
This will give you 26710.
This is the address of the first byte in BASIC and the address of the first byte in the buffer of MTERM. To find the first byte of the variables area
TRY THIS:
PRINT PEEK 23627+256*PEEK 23628
This address will change as you add or delete lines from a BASIC program. The address that you come up with is also the address AFTER the last byte of the buffer. By POKEing VARS you can open the buffer (also the BASIC area) to hold your code. Once the buffer is open to the EXACT number of bytes you can now use LOAD “”CODE 26710.
As an example, to send a M/C routine that is 1000 bytes long you need to open the buffer by 1000 bytes. To do this, first add 1000 to 26710. This will give you 27710. This is the address that you need to POKE into VARS. Next divide 27710 by 256 (PRINT 27710/256) this will give you 108.24219. Write down 108 so you’ll remember (this is the high part of the 2 byte number). Take the decimal remainder and multiply it by 256 (PRINT .24219*256), this will give you 62.00064. Write down 62, this is the low part of a 2 byte number. The computer stores 2 byt numbers low byte first, so to get this into VARS, do this.
POKE 23627,62:POKE 23628,108
Call up MTERM and look at BUFUSD it won’t be right. Exit to BASIC and make the POKES again.
POKE 23627,62:POKE 23628,108
Call up MTERM again and you will find that the buffer has been opened up by 1000 bytes. I have no idea why you have to make the POKES twice but it works every time. You can now use LOAD”” CODE 26710 to load in the 1000 byte routine.
Here is a summary of the steps to use.
1) Calculate the address to POKE into VARS by adding the number of bytes you need to 26710.
2) Calculate the high and low bytes as described above.
3) POKE the two numbers into VARS like this:
POKE 23627,lo:POKE 23628,hi
4) Call up MTERM.
PRINT USR 54016
5) Exit to BASIC.
6) POKE the two numbers into VARS again:
POKE 23627,lo:POKE 23628,hi
7) Call up MTERM and check BUFUSD.
8) Exit to BASIC
9) LOAD “”CODE 26710
To send a M/C program that is to big to fit in the buffer you can send it in two parts. As an example to send 30000 bytes which begin at 30000, LOAD it in as you would normally. SAVE it on a cassette in two parts like this:
SAVE "a" CODE 30000,15000
SAVE "b" CODE 45000,15000
Now you’ll have the code split into two blocks and can send one block at a time.
The person on the recieving end, should SAVE the two blocks one after the other on the same tape. After recieving the first block, exit to BASIC and use this:
SAVE "a" CODE 26710,15000
After recieving the second block exit to BASIC and SAVE it after the first block like this again:
SAVE "b" CODE 26710,15000
Now to LOAD the code in use:
LOAD ""CODE 30000
LOAD ""CODE 45000
We’ve lost the credits on this one, if you recognize it, please let us know who to thank. (Editor)
First Annual T-S Horizon Awards
Best USER GROUP/Best NEWSLETTER Awards |Triangle Sinclair User Group-Doug Dewey, Ed. |Capitol Area Timex Sinclair(C.A.T.S.)-Jules Gesang, Ed. |Bay Area Timex Sinclair User Groups/Timelinez
Best new user group/newsletter: |Long Island Timex Sinclair(L.I.S.T.)-Paul Donelly, Ed.
Most promising new newsletter: |Pheonix User Group-Doug Gangi, Ed.
Best special-interest group/newsletter: |QZX
WALL STREET ON-LINE: CALL OUR 300/1200 BAUD MODEM TELEPHONE # (212) 543-9033
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.