.include "macros.inc"
.section .text, "ax"
.global GDSetBlendMode
GDSetBlendMode:
mflr r0
stw r0, 4(r1)
stwu r1, -0x28(r1)
stw r31, 0x24(r1)
addi r31, r6, 0
stw r30, 0x20(r1)
mr r30, r5
stw r29, 0x1c(r1)
addi r29, r4, 0
stw r28, 0x18(r1)
addi r28, r3, 0
lwz r7, __GDCurrentDL@sda21(r13)
lwz r3, 8(r7)
lwz r0, 0xc(r7)
addi r3, r3, 1
cmplw r3, r0
ble lbl_800B1864
bl GDOverflowed
lbl_800B1864:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 0x61
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B1898
bl GDOverflowed
lbl_800B1898:
lwz r4, __GDCurrentDL@sda21(r13)
li r8, 0xfe
li r7, 0
lwz r3, 8(r4)
li r6, 0x1f
li r5, 0xe3
addi r0, r3, 1
stw r0, 8(r4)
stb r8, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r7, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r6, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 1
cmplw r3, r0
ble lbl_800B1914
bl GDOverflowed
lbl_800B1914:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 0x61
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B1948
bl GDOverflowed
lbl_800B1948:
cmpwi r28, 1
li r4, 1
beq lbl_800B1960
cmpwi r28, 3
beq lbl_800B1960
li r4, 0
lbl_800B1960:
subfic r3, r28, 3
lwz r6, __GDCurrentDL@sda21(r13)
subfic r0, r28, 2
cntlzw r0, r0
lwz r7, 8(r6)
rlwinm r0, r0, 0x1c, 4, 0x1e
cntlzw r9, r3
or r8, r0, r4
addi r5, r7, 1
stw r5, 8(r6)
slwi r3, r30, 5
slwi r4, r29, 8
or r6, r3, r8
or r8, r4, r6
rlwinm r5, r9, 6, 0, 0x14
slwi r6, r31, 0xc
or r8, r5, r8
or r8, r6, r8
oris r8, r8, 0x4100
srwi r8, r8, 0x18
stb r8, 0(r7)
cmpwi r28, 1
li r7, 1
beq lbl_800B19CC
cmpwi r28, 3
beq lbl_800B19CC
li r7, 0
lbl_800B19CC:
or r7, r0, r7
lwz r9, __GDCurrentDL@sda21(r13)
or r7, r3, r7
or r7, r4, r7
lwz r8, 8(r9)
or r7, r5, r7
or r10, r6, r7
addi r7, r8, 1
oris r10, r10, 0x4100
stw r7, 8(r9)
rlwinm r7, r10, 0x10, 0x18, 0x1f
cmpwi r28, 1
stb r7, 0(r8)
li r7, 1
beq lbl_800B1A14
cmpwi r28, 3
beq lbl_800B1A14
li r7, 0
lbl_800B1A14:
or r7, r0, r7
lwz r9, __GDCurrentDL@sda21(r13)
or r7, r3, r7
or r7, r4, r7
lwz r8, 8(r9)
or r7, r5, r7
or r10, r6, r7
addi r7, r8, 1
oris r10, r10, 0x4100
stw r7, 8(r9)
rlwinm r7, r10, 0x18, 0x18, 0x1f
cmpwi r28, 1
stb r7, 0(r8)
li r7, 1
beq lbl_800B1A5C
cmpwi r28, 3
beq lbl_800B1A5C
li r7, 0
lbl_800B1A5C:
or r0, r0, r7
lwz r7, __GDCurrentDL@sda21(r13)
or r0, r3, r0
or r0, r4, r0
lwz r3, 8(r7)
or r0, r5, r0
or r4, r6, r0
addi r0, r3, 1
stw r0, 8(r7)
ori r4, r4, 0
stb r4, 0(r3)
lwz r0, 0x2c(r1)
lwz r31, 0x24(r1)
lwz r30, 0x20(r1)
lwz r29, 0x1c(r1)
lwz r28, 0x18(r1)
addi r1, r1, 0x28
mtlr r0
blr
.global GDSetBlendModeEtc
GDSetBlendModeEtc:
mflr r0
stw r0, 4(r1)
stwu r1, -0x40(r1)
stmw r25, 0x24(r1)
addi r25, r3, 0
addi r26, r4, 0
mr r27, r5
addi r28, r6, 0
addi r29, r7, 0
addi r30, r8, 0
addi r31, r9, 0
lwz r10, __GDCurrentDL@sda21(r13)
lwz r3, 8(r10)
lwz r0, 0xc(r10)
addi r3, r3, 1
cmplw r3, r0
ble lbl_800B1AF0
bl GDOverflowed
lbl_800B1AF0:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 0x61
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B1B24
bl GDOverflowed
lbl_800B1B24:
cmpwi r25, 1
li r4, 1
beq lbl_800B1B3C
cmpwi r25, 3
beq lbl_800B1B3C
li r4, 0
lbl_800B1B3C:
subfic r3, r25, 3
lwz r6, __GDCurrentDL@sda21(r13)
subfic r0, r25, 2
cntlzw r0, r0
lwz r10, 8(r6)
rlwinm r0, r0, 0x1c, 4, 0x1e
cntlzw r11, r3
or r7, r0, r4
addi r5, r10, 1
stw r5, 8(r6)
rlwinm r3, r31, 2, 0x16, 0x1d
rlwinm r4, r29, 3, 0x15, 0x1c
or r6, r3, r7
or r7, r4, r6
rlwinm r5, r30, 4, 0x14, 0x1b
or r8, r5, r7
slwi r6, r27, 5
or r9, r6, r8
slwi r7, r26, 8
rlwinm r8, r11, 6, 0, 0x14
or r11, r7, r9
slwi r9, r28, 0xc
or r11, r8, r11
or r11, r9, r11
oris r11, r11, 0x4100
srwi r11, r11, 0x18
stb r11, 0(r10)
cmpwi r25, 1
li r10, 1
beq lbl_800B1BC0
cmpwi r25, 3
beq lbl_800B1BC0
li r10, 0
lbl_800B1BC0:
or r10, r0, r10
lwz r12, __GDCurrentDL@sda21(r13)
or r10, r3, r10
or r10, r4, r10
lwz r11, 8(r12)
or r10, r5, r10
or r10, r6, r10
or r10, r7, r10
or r10, r8, r10
or r26, r9, r10
addi r10, r11, 1
oris r26, r26, 0x4100
stw r10, 8(r12)
rlwinm r10, r26, 0x10, 0x18, 0x1f
cmpwi r25, 1
stb r10, 0(r11)
li r10, 1
beq lbl_800B1C14
cmpwi r25, 3
beq lbl_800B1C14
li r10, 0
lbl_800B1C14:
or r10, r0, r10
lwz r12, __GDCurrentDL@sda21(r13)
or r10, r3, r10
or r10, r4, r10
lwz r11, 8(r12)
or r10, r5, r10
or r10, r6, r10
or r10, r7, r10
or r10, r8, r10
or r26, r9, r10
addi r10, r11, 1
oris r26, r26, 0x4100
stw r10, 8(r12)
rlwinm r10, r26, 0x18, 0x18, 0x1f
cmpwi r25, 1
stb r10, 0(r11)
li r10, 1
beq lbl_800B1C68
cmpwi r25, 3
beq lbl_800B1C68
li r10, 0
lbl_800B1C68:
or r0, r0, r10
lwz r10, __GDCurrentDL@sda21(r13)
or r0, r3, r0
or r0, r4, r0
lwz r3, 8(r10)
or r0, r5, r0
or r0, r6, r0
or r0, r7, r0
or r0, r8, r0
or r4, r9, r0
addi r0, r3, 1
stw r0, 8(r10)
ori r4, r4, 0
stb r4, 0(r3)
lmw r25, 0x24(r1)
lwz r0, 0x44(r1)
addi r1, r1, 0x40
mtlr r0
blr
.global GDSetZMode
GDSetZMode:
mflr r0
stw r0, 4(r1)
stwu r1, -0x28(r1)
stw r31, 0x24(r1)
mr r31, r5
stw r30, 0x20(r1)
addi r30, r4, 0
stw r29, 0x1c(r1)
addi r29, r3, 0
lwz r6, __GDCurrentDL@sda21(r13)
lwz r3, 8(r6)
lwz r0, 0xc(r6)
addi r3, r3, 1
cmplw r3, r0
ble lbl_800B1CF4
bl GDOverflowed
lbl_800B1CF4:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 0x61
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B1D28
bl GDOverflowed
lbl_800B1D28:
lwz r4, __GDCurrentDL@sda21(r13)
clrlwi r5, r29, 0x18
slwi r0, r30, 1
lwz r3, 8(r4)
rlwinm r6, r31, 4, 0x14, 0x1b
or r0, r5, r0
or r0, r6, r0
oris r7, r0, 0x4000
addi r0, r3, 1
stw r0, 8(r4)
srwi r0, r7, 0x18
rlwinm r6, r7, 0x10, 0x18, 0x1f
stb r0, 0(r3)
rlwinm r5, r7, 0x18, 0x18, 0x1f
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r6, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r7, 0(r3)
lwz r0, 0x2c(r1)
lwz r31, 0x24(r1)
lwz r30, 0x20(r1)
lwz r29, 0x1c(r1)
addi r1, r1, 0x28
mtlr r0
blr
.global GDSetDstAlpha
GDSetDstAlpha:
mflr r0
stw r0, 4(r1)
stwu r1, -0x18(r1)
stw r31, 0x14(r1)
addi r31, r4, 0
stw r30, 0x10(r1)
addi r30, r3, 0
lwz r5, __GDCurrentDL@sda21(r13)
lwz r3, 8(r5)
lwz r0, 0xc(r5)
addi r3, r3, 1
cmplw r3, r0
ble lbl_800B1DF0
bl GDOverflowed
lbl_800B1DF0:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 0x61
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B1E24
bl GDOverflowed
lbl_800B1E24:
lwz r4, __GDCurrentDL@sda21(r13)
rlwinm r5, r30, 8, 0x10, 0x17
rlwimi r5, r31, 0, 0x18, 0x1f
lwz r3, 8(r4)
oris r7, r5, 0x4200
rlwinm r6, r7, 0x10, 0x18, 0x1f
addi r0, r3, 1
stw r0, 8(r4)
srwi r0, r7, 0x18
rlwinm r5, r7, 0x18, 0x18, 0x1f
stb r0, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r6, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r7, 0(r3)
lwz r0, 0x1c(r1)
lwz r31, 0x14(r1)
lwz r30, 0x10(r1)
addi r1, r1, 0x18
mtlr r0
blr