Micro­power

  

Volume 2, Number 1 – February 1982











Page 33 of 37











SCAL FFLP DF 5E

This routine sets and then resets output lines in port 0. On entering the routine the accumulator must have the bits corresponding to the lines to be changed set to one. This data is exclusive ORed with the byte at £0C00, which maps the current state of port 0, so that only the selected bits are changed, and output to port 0. The original state of port 0 is then recovered from £0C00 and output to port 0.

SCAL MFLP DF 5F

This routine changes the state of the tape LED, which is controlled by bit 4 of port 0. The LED gives an indication that loading or saving of tape data is proceeding, but if a small relay is connected to the output which drives the LED the signal can be more usefully employed to switch the cassette motor on and off through the ‘ remote’ socket. If you don’t use the signal to control a tape motor, and alternative use is to produce ‘music’ by connecting the LED output to a small 80 Ohm speaker. Notes can be produced by flipping bit 4 at different rates. However, there are two spare output lines on port 0, bits 2 and 5, and you can use these to produce sounds by simply adding a simple buffer and loudspeaker. These bits can be flipped by setting the required bit in the accumulator and doing a direct call to £0053 (CD 53 00). Now you are not supposed to use direct calls to Nas-Sys – the whole idea of the subroutine call system is that if changes are made to the monitor software using the monitor does not need to be changed because it does not use absolute addresses. However, providing you realise the full implications of what you are doing, there is no reason why you shouldn’t use a direct call this once. The alternative is to write a short piece of machine code to change the necessary bits of port 0.

SCAL ARGS DF 60

This routine loads the contents of the ARG1, ARG2 and ARG3 (£0C0C, £0C0E, £0C10) into HL, DE and BC. As noted previously, when a program is entered by the Execute command, the contents of HL, DE and BC are picked up from the Register save area in the monitor workspace, and so you cannot pass arguments entered under E directly to a program, you must recover the values stored at ARG1 – ARG3, and this can most easily be done by means of SCAL ARGS.

In the next article, I shall continue with the subroutine calls, starting with keyboard calls, DF 61 and DF 62












Page 33 of 37