OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.74/] [tools/] [asm-11/] [lib/] [kprfmt.mac] - Blame information for rev 38

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 wfjm
; $Id: kprfmt.mac 503 2013-04-06 19:44:13Z mueller $
2
; Copyright 2013- by Walter F.J. Mueller 
3
; License disclaimer see LICENSE_gpl_v2.txt in $RETROBASE directory
4
;
5
; synchronous (polling) console print: very simple printf
6
; Call:
7
;   jsr pc, kprfmt
8
; Arguments:
9
;   r0: pointer format string
10
;   r1: pointer to argument list
11
;
12
; r2-r5 registers preserved
13
;
14
 
15
kprfmt: mov     r2,-(sp)        ; save r2
16
 
17
        mov     r0,r2           ; r2 now ptr to fmt string
18
 
19
1$:     movb    (r2)+,r0        ; next fmt char
20
        beq     20$             ; if zero quit
21
        cmpb    #'%,r0          ; is it '%' ?
22
        bne     10$             ; if not, print
23
        movb    (r2)+,r0        ; if yes, get next
24
        beq     20$             ; if zero quit
25
 
26
        cmpb    #'s,r0          ; %s found ?
27
        bne     2$
28
        mov     (r1)+,r0        ; get next arg
29
        jsr     pc,kprstr       ; and print string
30
        br      1$              ; go for next fmt char
31
 
32
2$:     cmpb    #'o,r0          ; %o found ?
33
        bne     3$
34
        mov     (r1)+,r0        ; get next arg
35
        jsr     pc,kproct       ; and print octal number
36
        br      1$              ; go for next fmt char
37
 
38
3$:     cmpb    #'d,r0          ; %d found
39
        bne     4$
40
        mov     (r1)+,r0        ; get next arg
41
        jsr     pc,kprdec       ; and print as decimal number
42
        br      1$
43
 
44
4$:     movb    -2(r2),r0       ; was neither %s,%o,%d
45
        jsr     pc,kprchr       ; so simply print these two letters...
46
        movb    -1(r2),r0
47
 
48
10$:    jsr     pc,kprchr       ; print fmt char
49
        br      1$              ; go for next fmt char
50
 
51
20$:    mov     (sp)+,r2        ; restore r2
52
        rts     pc
53
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.