Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

number.s File Reference

Assembler for void RScreenUtils::NumberAsm(TUint16 *iPos,TUint32 aNumber, TUint16 aForeColor,TUint16 aBackColor);. More...

Go to the source code of this file.


Detailed Description

Assembler for void RScreenUtils::NumberAsm(TUint16 *iPos,TUint32 aNumber, TUint16 aForeColor,TUint16 aBackColor);.

@@  Copyright 2002 Kenneth Guy,
@@  
@@  You are free to take the source and do as you wish with it.
@@  However it would be nice if you let me know if the code was useful
@@  to you and give me an acknowledgement if you use a significant portion
@@  of the code in an application.
@@  
                .global NumberAsm__12RScreenUtilsPUsUlUsUs
NumberAsm__12RScreenUtilsPUsUlUsUs:
        @@ r0, address to start at
        @@ r1, number to draw
        @@ r2, fore color
        @@ r3, back color
        stmfd sp!, {r0-r12,lr}

        orr r2,r2,r2,lsl #16    @ make color 2 pixels wide
        orr r3,r3,r3,lsl #16    @ make color 2 pixels wide
        
        ldr r12,.numdata        @ point r12 at number bitmaps
        mov r11,r0              @ remember plot address
        mov r10,#28             @ only ploy seven digits
        mov r8,#0               @ flag set when we have a non-zero digit

nloop2:                         @ foreach 4 bits
        
        sub r10,r10,#4          
        mov r7,r1,lsr r10       @ get the next four bits        
        and r7,r7,#0xf
        orr r8,r8,r7            @ r8 will be non-zero after first non-zero
        cmp r10,#0
        moveq r8,#1            @ always plot last zero
        

        @@ Find the correct bitmap
        add r9,r12,r7,lsl #7 @ 128 bytes per letter

        @@ Plot the bitmap (8 lines)
        mov r14,#8
nloop1:                         @ foreach bitmap line
        mov r6,#0xf0000000      @ move 0xffffffff into r6
        mov r6,r6,asr #28        
        cmp r8,#0
        ldrne r4,[r9],#4         
        moveq r4,#0      
        eor r6,r6,r4            @  r6 = not r4
        and r4,r4,r2            @ r4 = fore color if pixel is white
        and r6,r6,r3            @ r6 = back color if pixel is black
        orr r6,r6,r4            @ merge fore and background
        str r6,[r0],#4          @  plot it
        
        mov r6,#0xf0000000      @ move 0xffffffff into r6
        mov r6,r6,asr #28
        cmp r8,#0
        ldrne r4,[r9],#4         
        moveq r4,#0      
        eor r6,r6,r4            @  r6 = not r4
        and r4,r4,r2            @ r4 = fore color if pixel is white
        and r6,r6,r3            @ r6 = back color if pixel is black
        orr r6,r6,r4            @ merge fore and background
        str r6,[r0],#4          @  plot it
        
        mov r6,#0xf0000000      @ move 0xffffffff into r6
        mov r6,r6,asr #28
        cmp r8,#0
        ldrne r4,[r9],#4         
        moveq r4,#0      
        eor r6,r6,r4            @  r6 = not r4
        and r4,r4,r2            @ r4 = fore color if pixel is white
        and r6,r6,r3            @ r6 = back color if pixel is black
        orr r6,r6,r4            @ merge fore and background
        str r6,[r0],#4          @  plot it
        
        mov r6,#0xf0000000      @ move 0xffffffff into r6
        mov r6,r6,asr #28
        cmp r8,#0
        ldrne r4,[r9],#4         
        moveq r4,#0      
        eor r6,r6,r4            @  r6 = not r4
        and r4,r4,r2            @ r4 = fore color if pixel is white
        and r6,r6,r3            @ r6 = back color if pixel is black
        orr r6,r6,r4            @ merge fore and background
        str r6,[r0],#4          @  plot it
        

        
        add r0,r0,#1264
        subs r14,r14,#1 
        bne nloop1 @ branch while r2 != 0

        add r11,r11,#16         @ plot next digit at screen base +16
        mov r0,r11              
        cmp r10,#0
        bne nloop2              @  loop while we have bits remaining
        
        ldmfd sp!, {r0-r12,lr}
        @ handle returning to thumb code
        bx lr   
        
.numdata:
.word   KNumbers


Definition in file number.s.


Documentation for Game (Beta) version 1.44.