Skip to content

Commit

Permalink
#407 32X rasterize_asm
Browse files Browse the repository at this point in the history
  • Loading branch information
XProger committed Mar 8, 2022
1 parent c49a46d commit 9cf4294
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/platform/32x/asm/rasterize.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "common.i"

#define type r0
#define proc r1

#define flags r4 // arg
#define L r5 // arg
#define R r6
#define pixel flags
#define y type

.text
.align 4
.global _rasterize_asm
_rasterize_asm:
mov flags, type
shll2 type
swap.w type, type
and #15, type

cmp/eq #FACE_TYPE_F, type
bf/s 0f
mov L, R
extu.b flags, R

0: // proc = table[type]
mov type, proc
mova var_table, type
shll2 proc
mov.l @(type, proc), proc

// pixel = fb + y * 320
mov.w @(VERTEX_Y, L), y
mov.l var_fb, pixel
shll8 y
add y, pixel // pixel += y * 256
shlr2 y
jmp @proc
add y, pixel // pixel += y * 64
nop

var_fb:
.long 0x24000200
var_table:
.long _rasterizeS_c
.long _rasterizeF_c
.long _rasterizeFT_c
.long _rasterizeFTA_c
.long _rasterizeGT_c
.long _rasterizeGTA_c
.long _rasterizeSprite_c
.long _rasterizeFillS_c
.long _rasterizeLineH_c
.long _rasterizeLineV_c

0 comments on commit 9cf4294

Please sign in to comment.