X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FDraw_amips.s;h=29aa7db844928bea4e51ee16c739b89a5b3d078f;hb=2aa27095f2dbf5b38950fcb1f856d5ffc6a70361;hp=ca3368aa77d59061748397300bc1d1a8455784e7;hpb=8ef001cc89adfb193dd6bfb31e25007abfece972;p=picodrive.git diff --git a/Pico/Draw_amips.s b/Pico/Draw_amips.s index ca3368a..29aa7db 100644 --- a/Pico/Draw_amips.s +++ b/Pico/Draw_amips.s @@ -1,10 +1,14 @@ # vim:filetype=mips -# only CLUT for now.. +# several drawing related functions for Allegrex MIPS +# (c) Copyright 2007, Grazvydas "notaz" Ignotas +# All Rights Reserved .set noreorder # don't reorder any instructions .set noat # don't use $at +.text +.align 4 # void amips_clut(unsigned short *dst, unsigned char *src, unsigned short *pal, int count) @@ -41,6 +45,43 @@ amips_clut_loop: nop +.global amips_clut_6bit + +amips_clut_6bit: + srl $a3, 2 + li $t4, 0 + li $t5, 0 + li $t6, 0 + li $t7, 0 +amips_clut_loop6: + lbu $t0, 0($a1) # tried lw here, no improvement noticed + lbu $t1, 1($a1) + lbu $t2, 2($a1) + lbu $t3, 3($a1) + ins $t4, $t0, 1, 6 + ins $t5, $t1, 1, 6 + ins $t6, $t2, 1, 6 + ins $t7, $t3, 1, 6 + addu $t0, $t4, $a2 + addu $t1, $t5, $a2 + addu $t2, $t6, $a2 + addu $t3, $t7, $a2 + lhu $t0, 0($t0) + lhu $t1, 0($t1) + lhu $t2, 0($t2) + lhu $t3, 0($t3) + ins $t0, $t1, 16, 16 # ins rt, rs, pos, size - Insert size bits starting + ins $t2, $t3, 16, 16 # from the LSB of rs into rt starting at position pos + sw $t0, 0($a0) + sw $t2, 4($a0) + addiu $a0, 8 + addiu $a3, -1 + bnez $a3, amips_clut_loop6 + addiu $a1, 4 + jr $ra + nop + + # $a0 - pd, $a1 - tile word, $a2 - pal # ext rt, rs, pos, size // Extract size bits from position pos in rs and store in rt @@ -1671,6 +1712,9 @@ tile00000001: jr $ra sb $t0, 0($a0) +.data +.align 4 + TileTable: .long 000000000000, tile00000001, tile00000010, tile00000011, tile00000100, tile00000101, tile00000110, tile00000111 .long tile00001000, tile00001001, tile00001010, tile00001011, tile00001100, tile00001101, tile00001110, tile00001111