
***************************************************************************
*   This routine is used to output a character string through the         *
*   MVME133A-20  front panel debug port.                                  *
*                                                          17-SEPT-1991   *
*                                                                         *
*                                                                         *
*   This routine sends an ASCII character string out through the          *
*   MVME133A-20  RS-232 front panel debug port.  A carriage return and    *
*   line feed is inserted at the end of the string.   This routine is     *
*   the same as the 133A Bug Monitor  WRITELN routine.                    *
*                                                                         *
*   The begining address of the character string is passed to this        *
*   routine on the stack.  The first byte is this string shows the        *
*   the number of caracters to be printed as a binary number 0...255.     *
*   This first byte is not sent out the debug port. To call this routine  *
*   first push the character string's starting address onto the stack as  *
*   a long word.  All working registers used by this routine are saved    *
*   and restored before the routine exits.  The parameter that is passed  *
*   to this routine on the stack is pulled off of the stack before this   *
*   routine exits.                                                        *
***************************************************************************

            Align 4

ChrStrgOut  Move.L  A5,-(A7)             ; Store the contents of register A5.
            Move.L  A6,-(A7)             ; Store the contents of register A6.
            Move.L  D0,-(A7)             ; Store the contents of register D0.

            MoveA.L  16(A7),A5           ; Load the starting address into A5.
            MoveA.L  A5,A6               ; Copy the starting address into A6.
            CLR.L    D0                  ; Clear Data Register D0.
            Move.B   (A5)+,D0            ; Get the Number of Characters in D0.
            AddA.L   D0,A6               ; Add the string length to reg A6.
                                         ; A6 now points to the last character.
            CLR.L    D0                  ; Clear Data Register D0.

ChkLstChar   IF.L  A5 <LE> A6  THEN.S         ; If past last character,.. quit
               Move.B  (A5)+,D0               ; Get the character into reg D0.
               Move.L  D0,-(A7)               ; Push contents on D0 onto stack.
               JSR     SendCharP1             ; Call routine to send character.
               JMP     ChkLstChar             ; Check for the last character.
             ENDI

            Move.B  #$0D,D0              ; Load the carriage return character
            Move.L  D0,-(A7)             ; into D0 and push D0 onto the stack.
            JSR     SendCharP1           ; Call routine to send character.

            Move.B  #$0A,D0              ; Load the line feed character
            Move.L  D0,-(A7)             ; into D0 and push D0 onto the stack.
            JSR     SendCharP1           ; Call routine to send character.


            Move.L  (A7)+,D0            ; Restore the contents of register D0.
            Move.L  (A7)+,A6            ; Restore the contents of register A6.
            Move.L  (A7)+,A5            ; Restore the contents of register A5.

            Move.L  (A7),4(A7)          ; Move the RTS return pointer.
            AddQ.L  #4,A7               ; Adjust the stack position.
            RTS                         ; Return to the calling routine.



***************************************************************************
*    This routine outputs a character through the front debug port.       *
*                                                           16-SEPT-1991  *
*                                                                         *
*    This routine sends an ASCII character out through the MVME133A-20    *
*    RS-232 front panel debug port.  The ASCII character is to be in      *
*    the LSB of a long word on the stack just above the return address.   *
*    This routine assumes that the MVME133A-20  MFP  MC68901 has already  *
*    been setup as required.  This routine is similar to the 133A Bug     *
*    Monitor OUTCHR routine.                                              *
*                                                                         *
*    All working registers are saved and have been restored before this   *
*    routine exits.  The long word passed to this routine is pulled from  *
*    the stack before this routine exits.                                 *
***************************************************************************

            Align 4

SendCharP1  Move.L   D1,-(A7)           ! Store the contents of register D1.

ChkTxRDY    Move.B   AdrTxStat,D1       ! Read the MFP Transmitter Status Reg.
            ANDI.L   #$00000080,D1      ! Mask all but the Buffer Empty Bit.

            IF.B  D1 <NE> #$80  THEN.S   ! Test if the Buffer Empty bit is set,
              JMP  ChkTxRDY              ! i.e.  is it ready to send the next
            ENDI                         ! character.  Keep testing as needed.

            Move.L   8(A7),D1           ! Get the character from the stack.
            Move.B   D1,AdrTxBufr       ! Load the character into Tx Buffer.

            Move.L   (A7)+,D1           ! Restore the contents of register D1.
            Move.L   (A7),4(A7)         ! Move the RTS return pointer.
            AddQ.L   #4,A7              ! Adjust the stack position.
            RTS                         ! Return to the calling routine.

            Align 4

AdrTxStat   EQU  $FFF8002D       ! Address of the MFP Transmitter Status Reg.
AdrTxBufr   EQU  $FFF8002F       ! Address of the MFP Transmitter Buffer Reg.




Chk31TxRDY      Move.B   AdrTxStat,D1       ! Read MFP Transmitter Status Reg.
                ANDI.L   #$00000080,D1      ! Mask all but Tx Buffr Empty Bit.
                IF.B  D1 <NE> #$80  THEN.S  ! Test if Buffer Empty bit is set,
                  JMP  Chk31TxRDY           ! i.e. ready to send next charctr?
                ENDI                        ! Keep testing as needed.   Load
                Move.B   #$31,AdrTxBufr     ! character "1" into Tx Buffer.

