putChar





3
Date Submitted Mon. Nov. 26th, 2007 1:01 PM
Revision 1 of 1
Helper DrivingManiac
Tags assembler | microblaze | putChar | UART
Comments 0 comments
Microblaze ISA assembler for putChar to UART
.globl myPrintString
myPrintString:
        ; Save r15 to stack (return address of original function call)
        addi r1, r1, -4
        swi r15,r1,0

        ; Save character pointer in r9
        addk r9, r5, r0

        ; Init r10 to first character of the string being passed in
        lbui r10, r9, 0

.globl stringCharLoop
stringCharLoop:
        ; Check loop condition (if r10 = null then function is finished)
        beqi r10, endStringCharLoop
        nop

        ; Increment character pointer (move to next character)
        addi r9, r9, 1
       
        ; Move character to print into r5
        addi r5, r10, 0

        ; Call print function (return address stored in r15)
        brlid r15, myPrintChar
        nop

        ; Load in new character to print (lookup [msgPointer + counter])
        lbui r10, r9, 0
        # Branch back to loop condition
        bri stringCharLoop
        nop

Victor Prechtel

Comments

There are currently no comments for this snippet.

Voting

Votes Down