From 6708de4d29b0133645aa15c6b3e5009a15bb017d Mon Sep 17 00:00:00 2001 From: "Christian A. Weber" Date: Sun, 12 Jul 2020 12:38:10 +0200 Subject: _RawPrintfFunc optimiert und besser dokumentiert --- RawDoFmt.S | 51 +++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/RawDoFmt.S b/RawDoFmt.S index 0a4818e..a491616 100644 --- a/RawDoFmt.S +++ b/RawDoFmt.S @@ -19,6 +19,9 @@ SECTION text,CODE + INCLUDE "relcustom.i" + + XDEF RawDoFmtFunc,_RawPrintfFunc RB_LEFTALIGNED: EQU 0 ; Flag-Definitionen @@ -42,7 +45,7 @@ MainLoop: move.b (a4)+,d0 ; Nächstes Zeichen beq.s Ende ; fertig ---> cmpi.b #'%',d0 beq.s DoFormat -DirectOut: jsr (a2) ; Zeichen direkt ausgeben +DirectOut: jsr (a2) ; Zeichen direkt ausgeben (schrottet d1) bra.s MainLoop ; ---> Ende: jsr (a2) ; Endzeichen ausgeben @@ -327,38 +330,42 @@ Filler: move.b #' ',d2 ; Füllcode: Space * This function may be called at any time, including * interrupts. * -* Bryce Nesbitt, 02-24-89 +* Bryce Nesbitt, 02-24-89, enhanced by CHW! * ************************************************************************* XDEF _RawPrintfFunc -_RawPrintfFunc: movem.l a0/a1,-(SP) - move.l 4*3(SP),A0 ;grab format string - lea.l 4*4(SP),A1 ;grab stack address of parameters - movem.l A2/A3/D0/D1,-(SP) - lea.l PSCODE(pc),a2 - suba.l a3,a3 +_RawPrintfFunc: movem.l d0-d1/a0-a3,-(SP) + move.l 4*7(SP),a0 ; grab format string + lea 4*8(SP),a1 ; grab stack address of parameters + lea serputchar(pc),a2 + lea custom,a3 ; will be available in serputchar bsr RawDoFmtFunc - movem.l (SP)+,D0/D1/A2/A3 - movem.l (SP)+,a0/a1 + movem.l (SP)+,d0-d1/a0-a3 rts + *** called by RawDoFmt, d0=char to write, a3=custom + +serputchar: tst.b d0 + beq.s .ignore + +.wait: move.w serdatr(a3),d1 ; serdatr + btst #13,d1 ; transmit buffer empty? + beq.s .wait ; not yet ---> wait -PSCODE: tst.b d0 - beq.s ignore -1$ move.w $DFF018,d1 ;_serdatr - btst #13,d1 ;TBE bit - beq.s 1$ and.b #$7f,d1 - cmp.b #$18,d1 ;Check for CAN (^X) - beq.s ignore - cmp.b #$13,d1 ;Check for Xoff - beq.s 1$ + cmp.b #$18,d1 ; Check for CAN (^X) + beq.s .ignore + cmp.b #$13,d1 ; Check for Xoff + beq.s .wait ; --> wait + and.w #$ff,d0 - or.w #$100,d0 - move.w d0,$DFF030 ;_serdat -ignore: rts + or.w #$100,d0 ; add stop bit + move.w d0,serdat(a3) +.ignore: + rts + ***************************************************************************** -- cgit v1.2.3