Personal Computer News


Using The Memotech USR Command

Categories: Letter

 
Author: Mark Cytera
Published in Personal Computer News #078

Using The Memotech USR Command

Q. Could you tell me how to use the undocumented USR command on the Memotech MTX 500?

The manual states that the computer jumps to the address stored at FA89H, but it does not explain precisely how to define the syntax at bytes FA85H to FA88H.

Also, can you tell me how to utilise FEXPAND at FA&E and USERNOD at FAA1.

Mark Cytera
Bristol, Avon

A. The MTX supports two ways of executing machine code. You can do this either by using the built-in 'Front Panel' or by using the USR function.

To use the USR function you must supply the address of the machine code routine in a Basic statement, for example LET MC=USR(nnnn). Here you're just pointing at a memory address from Basic, and the machine code is executed from there.

For example:

10 GOTO 20
20 LET MC=USR(16450) (DECIMAL OF £4042)
30 GOTO 30
40 REM MACHINE CODE SECTION
50 CODE
  £4042 LD HL,150
  £4045 LD A,18
  £4047 ADD A,L
  £4049 LD B,H
  ... LD C,L
  ... RET

After calling the machine code routine, the USR will return with the value of the BC registers.

And in this case the register pair is assigned to MC, and MC will equal 168.

Mark Cytera