eliminate texrels, part 3

This commit is contained in:
notaz 2017-08-06 22:25:26 +03:00
parent 6027c719ba
commit 98a2714234
16 changed files with 125 additions and 112 deletions

View file

@ -8,8 +8,7 @@
* this is highly specialized, be careful if changing related C code!
*/
.extern Pico
.extern PicoDraw2FB
#include "pico_int_o32.h"
@ define these constants in your include file:
@ .equiv START_ROW, 1
@ -25,16 +24,16 @@
.text
.align 2
.global BackFillFull @ int reg7
@ void BackFillFull(void *dst, int reg7)
.global BackFillFull
BackFillFull:
stmfd sp!, {r4-r9,lr}
ldr lr, =PicoDraw2FB @ lr=PicoDraw2FB
mov r0, r0, lsl #26
ldr lr, [lr]
add lr, r0, #328*8
mov r0, r1, lsl #26
mov r0, r0, lsr #26
add lr, lr, #328*8
orr r0, r0, r0, lsl #8
orr r0, r0, r0, lsl #16
@ -67,8 +66,8 @@ BackFillFull:
bne .bff_loop
ldmfd sp!, {r4-r9,r12}
bx r12
ldmfd sp!, {r4-r9,lr}
bx lr
.pool
@ -343,17 +342,19 @@ BackFillFull:
@ DrawLayerTiles(*hcache, *scrpos, (cells<<24)|(nametab<<9)|(vscroll&0x3ff)<<11|(shift[width]<<8)|planeend, (ymask<<24)|(planestart<<16)|[htab||hscroll]
@static void DrawLayerFull(int plane, int *hcache, int planestart, int planeend)
@ void DrawLayerFull(int plane, int *hcache, int planestart, int planeend,
@ struct PicoEState *est)
.global DrawLayerFull
DrawLayerFull:
ldr r12,[sp] @ est
stmfd sp!, {r4-r11,lr}
mov r6, r1 @ hcache
ldr r11, =(Pico+0x22228) @ Pico.video
ldr r10, =(Pico+0x10000) @ r10=Pico.vram
ldr r11, [r12, #OFS_Pico_video]
ldr r10, [r12, #OFS_Pico_vram]
ldrb r5, [r11, #13] @ pvid->reg[13]
ldrb r7, [r11, #11]
@ -402,9 +403,9 @@ DrawLayerFull:
and r4, r4, #7
orr lr, lr, r4, lsl #13 @ lr|=nametab_bits{3}<<13
ldr r11, =PicoDraw2FB @ r11=PicoDraw2FB
ldr r11,[sp, #9*4] @ est
sub r4, r9, #(START_ROW<<24)
ldr r11, [r11]
ldr r11, [r11, #OFS_Draw2FB]
mov r4, r4, asr #24
mov r7, #328*8
mla r11, r4, r7, r11 @ scrpos+=8*328*(planestart-START_ROW);
@ -571,8 +572,9 @@ DrawLayerFull:
.pool
@ void DrawTilesFromCacheF(int *hc, struct PicoEState *est)
.global DrawTilesFromCacheF @ int *hc
.global DrawTilesFromCacheF
DrawTilesFromCacheF:
stmfd sp!, {r4-r10,lr}
@ -580,14 +582,13 @@ DrawTilesFromCacheF:
mov r9, #0xff000000 @ r9=prevcode=-1
mvn r6, #0 @ r6=prevy=-1
ldr r4, =PicoDraw2FB @ r4=PicoDraw2FB
ldr r1, [r0], #4 @ read y offset
ldr r4, [r4]
ldr r4, [r1, #OFS_Draw2FB]
ldr r2, [r0], #4 @ read y offset
mov r7, #328
mla r1, r7, r1, r4
sub r12, r1, #(328*8*START_ROW) @ r12=scrpos
mla r2, r7, r2, r4
sub r12, r2, #(328*8*START_ROW) @ r12=scrpos
ldr r10, =(Pico+0x10000) @ r10=Pico.vram
ldr r10, [r1, #OFS_Pico_vram]
mov r8, r0 @ hc
mov r0, #0xf
@ -666,12 +667,14 @@ DrawTilesFromCacheF:
@ @@@@@@@@@@@@@@@
@ (tile_start<<16)|row_start
.global DrawWindowFull @ int tstart, int tend, int prio
@ void DrawWindowFull(int start, int end, int prio, struct PicoEState *est)
.global DrawWindowFull
DrawWindowFull:
stmfd sp!, {r4-r11,lr}
ldr r11, =(Pico+0x22228) @ Pico.video
ldr r11, [r3, #OFS_Pico_video]
ldrb r12, [r11, #3] @ pvid->reg[3]
mov r12, r12, lsl #10
@ -686,11 +689,11 @@ DrawWindowFull:
and r4, r0, #0xff
mla r12, r5, r4, r12 @ nametab += nametab_step*start;
ldr r10, [r3, #OFS_Pico_vram]
mov r4, r0, lsr #16 @ r4=start_cell_h
add r7, r12, r4, lsl #1
@ fetch the first code now
ldr r10, =(Pico+0x10000) @ lr=Pico.vram
ldrh r7, [r10, r7]
cmp r2, r7, lsr #15
ldmnefd sp!, {r4-r11,pc} @ hack: simply assume that whole window uses same priority
@ -704,11 +707,10 @@ DrawWindowFull:
mov r9, #0xff000000 @ r9=prevcode=-1
ldr r11, =PicoDraw2FB @ r11=scrpos
ldr r11, [r3, #OFS_Draw2FB]
and r4, r0, #0xff
ldr r11, [r11]
sub r4, r4, #START_ROW
add r11, r11, #328*8
sub r4, r4, #START_ROW
add r11, r11, #8
mov r7, #328*8
@ -873,8 +875,9 @@ DrawWindowFull:
b 52b
.endm
@ void DrawSpriteFull(unsigned int *sprite, struct PicoEState *est)
.global DrawSpriteFull @ unsigned int *sprite
.global DrawSpriteFull
DrawSpriteFull:
stmfd sp!, {r4-r11,lr}
@ -902,9 +905,8 @@ DrawSpriteFull:
and r3, lr, #0x6000
mov r3, r3, lsr #9 @ r3=pal=((code>>9)&0x30);
ldr r11, =PicoDraw2FB @ r11=scrpos
ldr r10, =(Pico+0x10000) @ r10=Pico.vram
ldr r11, [r11]
ldr r11, [r1, #OFS_Draw2FB]
ldr r10, [r1, #OFS_Pico_vram]
sub r1, r12, #(START_ROW*8)
mov r0, #328
mla r11, r1, r0, r11 @ scrpos+=(sy-START_ROW*8)*328;