Nascom Newsletter |
Volume 3 · Number 1 · April 1983 |
Page 10 of 37 |
---|
((TYPE x 4) + F)). Store the most significant byte first. Use a couple of shift lefts to multiply by 2 and 4, and don’t corrupt anything!!. You may now send your Nascom off to Control. But wait!! The table of routine addresses is, as yet, unconstructed.
This table will start with the address of routine 0 then 1, 2 etc, finishing with that of routine 7. Control will work along similar lines to the last routine described. You now want, OK need, to know about the other routines. They are subroutines, and as such MUST end with a RET (£C9) instruction. This applies to all of the routines 0 to 7.
Routine 0 – This is, in effect, a jump but depending on the value held in H (not of HL fame). H can be 0 through 7. So a table will need to be built directly after the £00 byte calling this routine. This table will be 16 bytes long and contain 8 addresses, corresponding to H=0, H=1 etc. Work out which address is needed and then put it into HL’. This will trick Control into effecting a very complex 8 way jump. Note that bit 7 of the calling code for this routine must NEVER be set else when Control is returned to, it will think that has just finished the last routine and not loop back to do our carefully prepared jump. For some unknown reason this routine played havoc with my disassembler. That is, until I remembered that Routine 0 is the first routine – Not Routine 1.
If I might digress for a while to give a short analogy as to what I see Control as. Control seems to be a microprocessor itself. It has HL’ as its program counter. Bits 0, 1 and 2 represent the opcode, bits 3, 4 and 5 the data (if required). Routines 0 to 7 are just units, black boxes if you like (you haven’t heard of the Black-Box Theory!!!), within the processor. Routine 0 is just a complex jump instruction. Some of the other routines are for handling lists. I hope this analogy is useful to you. I know – Clear as mud!!!
Routine 1 – This routine will add a string of characters to STRDIS. Don’t forget the painter/marker system has to be updated. The first character will be pionted to by HL’ and when the routine is finished HL” must point to the byte after the last character that was added. Confused? I was, but if you can do this properly then a lot of work (and RAM) is saved later on. This routine can be compared to STRDIS-STRDIS+"xxxxxx" in BASIC. Where xxxxxx is the literal string to be added. May I suggest setting bit 7 of the last character of your literal? Thus, when this is sensed your routine will know the last character. Remember to reset bit 7 before adding to STRDIS.
For example
01 41 42 43 C4 nn
will cause ABCD to be added to STRDIS, leaving HL’ pointing to nn. C4 is ASCII for D, but with bit 7 set. What will
Page 10 of 37 |
---|