Author: wmb Date: Thu Feb 3 07:58:08 2011 New Revision: 2165 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2165
Log: ARM / graphics - added bscan, wscan, lscan primitives and used them if present in replace-color.
Modified: cpu/arm/kerncode.fth dev/video/common/rectangle16.fth
Modified: cpu/arm/kerncode.fth ============================================================================== --- cpu/arm/kerncode.fth Thu Feb 3 07:57:03 2011 (r2164) +++ cpu/arm/kerncode.fth Thu Feb 3 07:58:08 2011 (r2165) @@ -952,6 +952,66 @@ = until c;
+\ Find the first occurence of bvalue, returning the residual string +code bscan ( adr len bvalue -- adr' len' ) + ldmia sp!,{r0,r1} \ r0-len r1-adr tos-bvalue + mov r2,tos \ r2-bvalue + movs tos,r0 \ tos-len + psheq r1,sp + nxteq \ Bail out if len=0 + + begin + ldrb r0,[r1],#1 + cmp r0,r2 + deceq r1,#1 + psheq r1,sp + nxteq + decs tos,1 + = until + psh r1,sp +c; + +\ Find the first occurrence of wvalue, returning the residual string +code wscan ( adr len wvalue -- adr' len' ) + ldmia sp!,{r0,r1} \ r0-len r1-adr tos-lvalue + mov r2,tos \ r2-lvalue + movs tos,r0 \ tos-len + psheq r1,sp + nxteq \ Bail out if len=0 + + begin + ldrh r0,[r1],#2 + cmp r0,r2 + deceq r1,#2 + psheq r1,sp + nxteq + decs tos,2 + <= until + psh r1,sp + mov tos,#0 +c; + +\ Find the first occurrence of lvalue, returning the residual string +code lscan ( adr len lvalue -- adr' len' ) + ldmia sp!,{r0,r1} \ r0-len r1-adr tos-lvalue + mov r2,tos \ r2-lvalue + movs tos,r0 \ tos-len + psheq r1,sp + nxteq \ Bail out if len=0 + + begin + ldr r0,[r1],#4 + cmp r0,r2 + deceq r1,#4 + psheq r1,sp + nxteq + decs tos,4 + <= until + psh r1,sp + mov tos,#0 +c; + + \ code /link ( -- /link ) psh tos,sp mov tos,/link c;
code /char ( -- 1 ) psh tos,sp mov tos,#1 c;
Modified: dev/video/common/rectangle16.fth ============================================================================== --- dev/video/common/rectangle16.fth Thu Feb 3 07:57:03 2011 (r2164) +++ dev/video/common/rectangle16.fth Thu Feb 3 07:58:08 2011 (r2165) @@ -234,17 +234,39 @@ : dimensions ( -- width height ) width height ;
: replace-color ( old new -- ) - depth d# 32 = if + depth d# 32 = if ( old new ) swap 565>argb-pixel swap 565>argb-pixel ( old' new' ) - frame-buffer-adr width height * /l* bounds do + frame-buffer-adr width height * /l* ( old new adr len ) +[ifdef] lscan + begin ( old new adr len ) + fourth lscan ( old new adr' len' ) + dup while ( old new adr' len' ) + third third l! ( old new adr len ) + /l /string ( old new adr' len' ) + repeat ( old new adr' len' ) + 4drop ( ) +[else] + bounds do ( old new ) over i l@ xor h# ffffff and 0= if dup i l! then /l +loop 2drop - else - frame-buffer-adr width height * /w* bounds do - over i w@ = if dup i w! then - /w +loop - 2drop +[then] + else ( old new ) + frame-buffer-adr width height * /w* ( old new adr len ) +[ifdef] wscan + begin ( old new adr len ) + fourth wscan ( old new adr' len' ) + dup while ( old new adr' len' ) + third third w! ( old new adr len ) + /w /string ( old new adr' len' ) + repeat ( old new adr' len' ) + 4drop ( ) +[else] + bounds do ( old new ) + over i w@ = if dup i w! then ( old new ) + /w +loop ( old new ) + 2drop ( ) +[then] then ; \ This creates a device method from a termemu method
openfirmware@openfirmware.info