📄 plotmap.s
字号:
@@ Copyright 2002 Kenneth Guy,
@@
.global PlotMapLineAsm__4CMap
PlotMapLineAsm__4CMap:
stmfd sp!, {r0-r12,lr}
@@ r0 CMap*
@@ - offset 0 vtable
@@ - offset 4 const TInt16* iMapData;
@@ - offset 8 TUint16* iMapDrawPoint;
@@ - offset 12 TUint16* iDrawArea;
@@ - offset 16 TUint16* iDrawEnd;
@@ - offset 20 TUint16* iScreenBase;
@@ - offset 24 TUint16* iBlitStart;
@@ - offset 28 const TUint16* iMapSprites;
add r0,r0,#4 @ skip vtable pointer
ldmia r0, {r1,r2,r3,r4} @ iMapData,iMapDrawPoint,iDrawArea,iDrawEnd
ldr r10,[r0,#24] @ iMapSprites
add r14,r1,#2 @ ignore first TInt16 of map data
@@ update CMap for map line after this one.
add r1,r1,#16 @ increment CMap.iMapData by 8*sizeof(TInt16)
add r5,r2,#128 @ and CMap.iMapDrawPoint
cmp r5,r4
movge r5,r3
stmia r0, {r1,r5} @ write back CMap.iMapOffset & CMap.iMapDrawPoint
@@ at this point r14 points to map line to display
@@ r2 points to area to draw to
@@ r4 points to limit of draw area
mov r12,#0
MapPlotSprite:
ldrh r1, [r14,r12] @ r1= sprite number to plot (half word/TInt16)
@ r0 = iMapSprites(r10) + r1*6400 (sizeof a sprite)
add r0,r10,r1, lsl #12
add r0,r0,r1, lsl #11
add r0,r0,r1, lsl #8
mov r11,#50
MapPlotLineLoop:
@@ copy a line of sprite data from r0 to r2
ldmia r0!,{r1,r3,r5-r9}
stmia r2!,{r1,r3,r5-r9}
ldmia r0!,{r1,r3,r5-r9}
stmia r2!,{r1,r3,r5-r9}
ldmia r0!,{r1,r3,r5-r9}
stmia r2!,{r1,r3,r5-r9}
ldmia r0!,{r1,r3,r5-r9}
stmia r2!,{r1,r3,r5-r9}
ldmia r0!,{r5-r8}
stmia r2!,{r5-r8}
add r2,r2,#1280 @ next line
cmp r2,r4
subge r2,r2,#0x4D000 @ length of draw area
subs r11,r11,#1
bne MapPlotLineLoop @ loop 50 times (50 lines in a sprite)
add r12,r12,#2 @ loop 4 times (four sprites per map line)
cmp r12,#8
blt MapPlotSprite
skipall:
ldmfd sp!, {r0-r12,lr}
@ handle returning to thumb code
bx lr
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -