Micro­power

  

Volume 2 · Number 2 · April 1982

Page 14 of 37
462CALL PRINT; PRINT IT
463INC IY; NEXT CHARACTER
464DJNZ PRLIN1; LOOP FOR 16 CHARACTERS
465CALL GAP; PRINT 4 SPACES
466LD B, 16; NOW DO 16 ASCII CHARACTERS
467LD IY, LINBUF; START OF BUFFER
468PRLIN2LD A, (IY); GET CHARACTER
469CP 20H; IS IT A CONTROL CHAR.?
470JP M, DOT; IF SO, PRINT A DOT
471CP 7BH; IS IT GREATER THAN z?
472JP P, DOT; IF SO, PRINT A DOT
473JR DOT1
474DOTLD A, "."
475DOT1CALL PRINT; PRINT IT
476INC IY; NEXT CHARACTER
477DJNZ PRLIN2; LOOP UNTIL 16 DONE
478LD A, CR; PRINT CARRIAGE RETURN
479CALL PRINT
480LD A, LF; AND LINE FEED
481CALL PRINT
482RET
483; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
486; ROUTINE TO O/P CHARACTER TO PRINTER
487; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
488PRINTPUSH AF; SAVE CHARACTER
489PR1IN A, (HSHAKE); HANDSHAKE, BIT 7 PORT 0
490AND 80H
491JR Z, PR1
491POP AF; RECOVER CHARACTER
492DEFB SCAL, SRLX; NAS-SYS SERIAL O/P
493RET
494; * * * * * * * * * * * * * * * * * * * * * * * * * * * *
496; SUBROUTINE FOR 4 SPACE GAP
497; * * * * * * * * * * * * * * * * * * * * * * * * * * * *
498GAPLD B, 4; NUMBER OF SPACES
499LD A, 20H; SPACE CHARACTER
500GAP1CALL PRINT; PRINT
501DJNZ GAP1; LOOP UNTIL DONE
502RET
503; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
504; PRINT HEX CDE AS TWO ASCII CHARS.
505; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
506PRTHEXPUSH AF; SAVE CHARACTER
507AND 0F0H; GET TOP 4 BITS
508RRCA; SHIFT TO BOTTOM 4 BITS
509RRCA
510RRCA
511RRCA
512CP 0AH; IS IT MORE THAN 10
513JP P, ADD37A; IF SO, JUMP
514ADD A, 30H; CONVERT TO ASCII 0 – 9
515PRTH1CALL PRINT; PRINT IT
516POP AF; RECOVER CHARACTER
517AND 0FH; GET BOTTOM 4 BITS
518CP 0AH; MORE THAN 10?
519JP P, ADD37B; IF SO, JUMP
520ADD A, 30H; CONVERT TO ASCII 0 – 9
521PRTH2CALL PRINT; PRINT IT
Page 14 of 37