80-Bus News


April-June 1982, Volume 1, Issue 2

Page 13 of 55


bit-slice processors, but I am still reading about them. It remains to be seen whether they too are ruled out by their cost, of course. All this extra hardware is still at the "thinking about it" stage, and should really wait until some minor speed problems on some of my other boards have been fixed. Recommended reading, if you are at all interested in either sixteen bit hardware or bit-slices, is "Modern Microprocessor System Design” by Daniel R. McGlynn, published by Wiley-Interscience and not cheap! Of course, in the event of boards with extra processors appearing, someone will need to write the software to coordinate the tasks they are each


Something useful (at last!) for CP/M hackers.

‘me mm vs sy ty ce seem hm et hit iy sa te a te‘ me tw se Sik ey mi emt Ws

The subroutine below is one that I have found very useful in programs that send a lot of text to the screen. The usual output routine sends all text up to the delimiter, which is a dollar sign, direct to the screen, without any regard to what is happening to the words at the end of each line. It is, of course, possible to write your program in such a way that all the output fits the screen nicely. It also happens to be boring work to do this, and the program will be no good at all on a system with a different screen width. The routine that follows will output the contents of a text buffer of any length, which is terminated with a 00 byte, without breaking any words. The text must not contain new line characters, or the output will be somewhat bizarre, to say the least.


WIDTH EQU 48 :Or 80, or whatever it is. LF EQU £0A sLine feed character. CR EQU £0D ;Carriage return character.


OUTPUT LD HL OUTBUF ;Point to the start of the text. ouTPO2 LD D E :Set CP/M’s text pointer. LD E L LD B WIDTH ;Set B to screen width given. ouTPO4 LD A (HL) ;Get a character from the text. OR A :Test for end of text. JR NZ OUTPOS ;Jump if it is not. OUTPO6 PUSH HL s;Save the text pointer. CALL OUTP40 ;Call subroutine to output one line. POP HL ;Get text pointer back. – LD (HL) £00 ;Remove dollar sign inserted by OUTP40. RET sReturn to caller. oUTPO8 INC HL ;Advance lookahead pointer. DINZ OUTPO4 ;Loop until looked 1 line ahead. LD OA (HL) ;Check for terminator after line. OR A JR Z OUTPOG ;Jump if it is. OUTPIO LD A (HL) ;Read a byte of text. cP SPACE ;Suitable place for end of line? JR Z OUTP14 ;Jump if it is. DEC HL :Move pointer left. INC B sIf this not done, no CR LF needed. JR OUTP10 ;Loop round to find space. OUTP14 CALL OUTP16 ;Prints the line so far. LD (HL) SPACE ;Repair damage! INC HL s;Advance pointer to next word. JR OUTPO2 s;Loop until all text printed. OUTP40 PUSH BC ;Save CR LF flag which is in B.

LD (HL) DOLLAR ;Insert a CP/M print terminator. LD Cc PRTBUF ;CP/M routine number.

This is an OCR’d version of the scanned page and likely contains recognition errors.

Page 13 of 55