home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 44
/
Amiga_Dream_44.iso
/
RiscPc
/
jeux
/
biohazard.arc
/
s
/
weapon
< prev
next >
Wrap
Text File
|
1994-12-15
|
21KB
|
1,134 lines
; Use the GET directive to include register definitions as if typed here
KEEP
GET h.WolfReg
; Use the GET directive to include a list of SWI names as if typed here
GET h.SWInames
; Area name C$$code advisable as wanted to link with C output
AREA |C$$code|, CODE, READONLY
; Export global symbols
EXPORT |PlotWeapon|
;Plot Sprite
;
; on entry :-
; r0 = pointer to data block where :-
; 0 = frame number
; 1 = left clip value
; 2 = right clip value (relative to size of sprite)
; 3 = size of square (height)
; 4 = increment (16 bit fixed point number)
; 5 = x position of square centre on screen
; 6 = screen address
; 7 = pointer to frame base address
; 8 = screen width
; 9 = screen height
; 10 = y_value
; 11 = reverse increment (width / 240)
|PlotWeapon|
STMFD r13!,{r0-r12,link}
;compute base screen address for plot
LDR r1,[r0,#32] ;load screen width
LDR r2,[r0,#12] ;load height
LDR r3,[r0,#20] ;load centre pos
LDR r4,[r0,#36] ;load screen height
LDR r14,[r0,#24] ;load screen address
;clear y_value
MOV r5,#0
STR r5,[r0,#40]
;((screen height - (height)/2) * 320)
MOV r5,r4,LSR #1
SUB r5,r5,r2,LSR #1
MOV r12,r5,LSL #6 ; * 64
ADD r5,r12,r5,LSL #8 ; + (* 256)
;(screen width + centre pos - (height/2))
;SUB r6,r3,r2,LSR #1
;ADD r6,r6,r1
;sum results and add to screen base
;ADD r5,r5,r6
ADD r5,r5,r14
STR r5,[r0,#24]
;get data from Frame Database
; locate frame data in Database
LDR r6,[r0,#28] ;load pointer to database
;skip the inital 4 words, these are not required
ADD r6,r6,#16
;locate pointer to our frame
LDR r7,[r0] ;load frame number
;multiply by 4, and add to database pointer
ADD r7,r6,r7,LSL #2
;get the address of the frame data
LDR r7,[r7]
SUB r6,r6,#16
ADD r6,r6,r7 ;add databaase pointer to frame address
;calculate reverse increment
LDR r10,[r0,#44]
PlotNextLine
;load the number of vertical lines to skip
LDRB r7,[r6],#1
CMP r7,#254
BEQ EndPlotSprite
;compute increment and number of lines to plot
LDR r8,[r0,#40]
LDR r9,[r0,#16]
ADD r11,r8,r9
MOV r12,r11,LSR #20
SUBS r12,r12,r8,LSR #20
STRNE r12,[r0,#44]
STRNE r11,[r0,#40]
MOVNE r11,#1
STRNE r11,[r0,#48]
BNE Skip_Calc
ADD r11,r11,r9
MOV r12,r11,LSR #20
SUBS r12,r12,r8,LSR #20
STRNE r12,[r0,#44]
STRNE r11,[r0,#40]
MOVNE r11,#2
STRNE r11,[r0,#48]
BNE Skip_Calc
ADD r11,r11,r9
MOV r12,r11,LSR #20
SUBS r12,r12,r8,LSR #20
STRNE r12,[r0,#44]
STRNE r11,[r0,#40]
MOVNE r11,#3
STRNE r11,[r0,#48]
BNE Skip_Calc
ADD r11,r11,r9
MOV r12,r11,LSR #20
SUBS r12,r12,r8,LSR #20
STRNE r12,[r0,#44]
STRNE r11,[r0,#40]
MOVNE r11,#4
STRNE r11,[r0,#48]
BNE Skip_Calc
Skip_Calc
;multiply by reverse increment
MUL r7,r10,r7
MOV r7,r7,LSR #20
;multiply by 320
MOV r8,r7,LSL #6
ADD r7,r8,r7,LSL #8
;add to base screen address
ADD r5,r5,r7
NextSegment
;load the line length and horizontal skip
LDRB r14,[r6],#1 ;line length
ADD r14,r14,#1
LDRB r9,[r6],#1 ;horizontal skip
ADD r9,r9,#1
;reverse increment = height/128
;we treat 'height' as reverse increment wiht 7 bit
;fixed point accuracy.
;multiply horizontal skip by reverse increment to get 'offset'
; load increment
;LDR r10,[r0,#16]
LDR r2,[r0,#12]
MUL r9,r10,r9
MOV r9,r9,LSR #20
SUB r11,r3,r2,LSR #1 ;centre-(height/2)
ADD r9,r9,r11 ;hs + (centre-(height/2))
;multiply source domain line length by increment to get real
;'line length'
MUL r8,r10,r14
MOV r8,r8,LSR #20
;load left and right clip values
LDR r11,[r0,#4] ;left
LDR r12,[r0,#8] ;right
LDR r2,[r0,#16]
CMP r12,r9
MOVLE r8,#0
MOVLE r9,#0
BLE skip_leftclip_else
;if offset < left clip then
; source offset = ((left clip - offset) * reverse increment)
; base screen address += left clip
; line length = (line length - (left clip - offset)
;end if
SUBS r1,r11,r9 ;left clip - offset
BMI skip_leftclip
ADD r7,r8,r9
CMP r11,r7
MOVGE r8,#0
MOVGE r9,#0
BGE skip_leftclip_else
MUL r4,r2,r1
MOV r4,r4,LSR #20 ;((left clip - offset) * increment)
ADD r7,r6,r4
ADD r5,r5,r11 ;base screen address += left clip
MOV r9,r11
SUB r8,r8,r1
B skip_leftclip_else
skip_leftclip
ADD r5,r5,r9 ;base screen address += offset
MOV r7,r6
skip_leftclip_else
CMP r8,#0
BEQ skip_reg_load
;clip right by modifying line length
ADD r4,r8,r9
CMP r4,r12
SUBGT r8,r12,r9
;store registers on stack
STMFD r13!,{r0-r12,link}
;set up registers
MOV r4,r7
MOV r6,r8
MOV r1,r5
LDR r11,[r0,#48]
B PlotLine
NextLine
;load registers from stack
LDMFD r13!,{r0-r12,link}
skip_reg_load
;modify database pointer to point to end of line block
ADD r6,r6,r14
;ADD r6,r6,#1
LDRB r7,[r6]
CMP r7,#254
BEQ Test2EndPlotSprite
CMP r7,#255
SUB r5,r5,r9
BNE NextSegment
LDR r8,[r0,#44]
CMP r8,#1
BEQ skip_modify_database
;skip required number of lines through database
ADD r6,r6,#1
SUB r8,r8,#1
ADD r5,r5,#320 ;modify screen address
skip_database_line
;load vskip
ADD r6,r6,#1
skip_next_segment
;load length
LDRB r12,[r6],#1
;load hskip
ADD r6,r6,#2
ADD r6,r6,r12
LDRB r7,[r6]
CMP r7,#254
BEQ TestEndPlotSprite
CMP r7,#255
BNE skip_next_segment
SUBS r8,r8,#1
ADD r6,r6,#1
BNE skip_database_line
B PlotNextLine
skip_modify_database
;update screen address
LDR r8,[r0,#48]
MOV r11,r8,LSL #6
ADD r8,r11,r8,LSL #8
ADD r5,r5,r8
ADD r6,r6,#1
B PlotNextLine
TestEndPlotSprite
B EndPlotSprite
Test2EndPlotSprite
B EndPlotSprite
; line plotter
;
; on entry :-
; r11 = number of lines to plot
; r4 = source base address
; r6 = line length
; r2 = increment
; r1 = screen address
PlotLine
;check for zero length line
CMP r6,#0
BEQ end_plotOne
;update y incrememt and calculate number of lines to draw
CMP r11,#1
BEQ OneLine
CMP r11,#2
BEQ TwoLine
CMP r11,#3
BEQ ThreeLine
B FourLine
;**********************************
;
; One Line draw
;
;**********************************
OneLine
;find offsets - start & end of line
AND r7,r1,#3
RSB r7,r7,#4
AND r7,r7,#3
ADD r11,r1,r6
AND r11,r11,#3
MOV r12,r6
;plot start pixels
MOV r3,#0
CMP r7,#0
BEQ skip_start_plotOne
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1],#1
;check for small pixel line
SUBS r12,r12,#1
BEQ end_plotOne
CMP r7,#1
BEQ skip_start_plotOne
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1],#1
;check for small pixel line
SUBS r12,r12,#1
BEQ end_plotOne
CMP r7,#2
BEQ skip_start_plotOne
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1],#1
;check for small pixel line
SUBS r12,r12,#1
BEQ end_plotOne
skip_start_plotOne
MOV r12,r6
ADD r9,r7,r11
SUB r9,r6,r9
MOV r9,r9,LSR #2
MOVS r8,r9,LSR #2
BEQ skip_four_word_plotOne
four_word_plotOne
LDRB r5,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r5,r5,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r5,r5,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r5,r5,r14,LSL #24
LDRB r6,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r6,r6,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r6,r6,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r6,r6,r14,LSL #24
LDRB r7,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #24
LDRB r8,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #24
STMIA r1!,{r5-r8}
SUB r9,r9,#4
MOVS r8,r9,LSR #2
BNE four_word_plotOne
skip_four_word_plotOne
ANDS r8,r9,#2
BEQ skip_two_word_plotOne
;two word plot
LDRB r7,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #24
LDRB r8,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #24
STMIA r1!,{r7-r8}
SUB r9,r9,#2
skip_two_word_plotOne
ANDS r8,r9,#1
BEQ skip_one_word_plotOne
;one word plot
LDRB r8,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #24
STR r8,[r1],#4
skip_one_word_plotOne
;plot_end_pixels
CMP r11,#0
BEQ end_plotOne
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1],#1
;check for small pixel line
SUBS r12,r12,#1
BEQ end_plotOne
CMP r11,#1
BEQ end_plotOne
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1],#1
;check for small pixel line
SUBS r12,r12,#1
BEQ end_plotOne
CMP r11,#2
BEQ end_plotOne
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1],#1
;check for small pixel line
SUBS r12,r12,#1
BEQ end_plotOne
end_plotOne
B NextLine
;**********************************
;
; Two Line draw
;
;**********************************
TwoLine
;find offsets - start & end of line
AND r7,r1,#3
RSB r7,r7,#4
AND r7,r7,#3
ADD r11,r1,r6
AND r11,r11,#3
;plot start pixels
MOV r3,#0
CMP r7,#0
BEQ skip_start_plotTwo
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#320]
STRB r10,[r1],#1
;check for 1 pixel line
CMP r6,#1
BEQ end_plotTwo
CMP r7,#1
BEQ skip_start_plotTwo
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#320]
STRB r10,[r1],#1
;check for 2 pixel line
CMP r6,#2
BEQ end_plotTwo
CMP r7,#2
BEQ skip_start_plotTwo
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#320]
STRB r10,[r1],#1
;check for 3 pixel line
CMP r6,#3
BEQ end_plotTwo
skip_start_plotTwo
ADD r9,r7,r11
SUB r9,r6,r9
MOV r9,r9,LSR #2
MOVS r8,r9,LSR #2
BEQ skip_four_word_plotTwo
four_word_plotTwo
LDRB r5,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r5,r5,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r5,r5,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r5,r5,r14,LSL #24
LDRB r6,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r6,r6,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r6,r6,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r6,r6,r14,LSL #24
LDRB r7,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #24
LDRB r8,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #24
ADD r1,r1,#320
STMIA r1,{r5-r8}
SUB r1,r1,#320
STMIA r1!,{r5-r8}
SUB r9,r9,#4
MOVS r8,r9,LSR #2
BNE four_word_plotTwo
skip_four_word_plotTwo
ANDS r8,r9,#2
BEQ skip_two_word_plotTwo
;two word plot
LDRB r7,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #24
LDRB r8,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #24
ADD r1,r1,#320
STMIA r1,{r7-r8}
SUB r1,r1,#320
STMIA r1!,{r7-r8}
SUB r9,r9,#2
skip_two_word_plotTwo
ANDS r8,r9,#1
BEQ skip_one_word_plotTwo
;one word plot
LDRB r8,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #24
STR r8,[r1,#320]
STR r8,[r1],#4
skip_one_word_plotTwo
;plot_end_pixels
CMP r11,#0
BEQ end_plotTwo
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#320]
STRB r10,[r1],#1
CMP r11,#1
BEQ end_plotTwo
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#320]
STRB r10,[r1],#1
CMP r11,#2
BEQ end_plotTwo
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#320]
STRB r10,[r1],#1
end_plotTwo
B NextLine
;**********************************
;
; Three Line draw
;
;**********************************
ThreeLine
;find offsets - start & end of line
AND r7,r1,#3
RSB r7,r7,#4
AND r7,r7,#3
ADD r11,r1,r6
AND r11,r11,#3
;plot start pixels
MOV r3,#0
CMP r7,#0
BEQ skip_start_plotThree
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#640]
STRB r10,[r1,#320]
STRB r10,[r1],#1
;check for 1 pixel line
CMP r6,#1
BEQ end_plotTwo
CMP r7,#1
BEQ skip_start_plotThree
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#640]
STRB r10,[r1,#320]
STRB r10,[r1],#1
;check for 2 pixel line
CMP r6,#2
BEQ end_plotTwo
CMP r7,#2
BEQ skip_start_plotThree
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#640]
STRB r10,[r1,#320]
STRB r10,[r1],#1
;check for 3 pixel line
CMP r6,#3
BEQ end_plotTwo
skip_start_plotThree
ADD r9,r7,r11
SUB r9,r6,r9
MOV r9,r9,LSR #2
MOVS r8,r9,LSR #2
BEQ skip_four_word_plotThree
four_word_plotThree
LDRB r5,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r5,r5,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r5,r5,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r5,r5,r14,LSL #24
LDRB r6,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r6,r6,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r6,r6,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r6,r6,r14,LSL #24
LDRB r7,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #24
LDRB r8,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #24
ADD r1,r1,#320
STMIA r1,{r5-r8}
ADD r1,r1,#320
STMIA r1,{r5-r8}
SUB r1,r1,#640
STMIA r1!,{r5-r8}
SUB r9,r9,#4
MOVS r8,r9,LSR #2
BNE four_word_plotThree
skip_four_word_plotThree
ANDS r8,r9,#2
BEQ skip_two_word_plotThree
;two word plot
LDRB r7,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #24
LDRB r8,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #24
ADD r1,r1,#320
STMIA r1,{r7-r8}
ADD r1,r1,#320
STMIA r1,{r7-r8}
SUB r1,r1,#640
STMIA r1!,{r7-r8}
SUB r9,r9,#2
skip_two_word_plotThree
ANDS r8,r9,#1
BEQ skip_one_word_plotThree
;one word plot
LDRB r8,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #24
STR r8,[r1,#640]
STR r8,[r1,#320]
STR r8,[r1],#4
skip_one_word_plotThree
;plot_end_pixels
CMP r11,#0
BEQ end_plotThree
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#320]
STRB r10,[r1,#640]
STRB r10,[r1],#1
CMP r11,#1
BEQ end_plotThree
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#640]
STRB r10,[r1,#320]
STRB r10,[r1],#1
CMP r11,#2
BEQ end_plotThree
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#640]
STRB r10,[r1,#320]
STRB r10,[r1],#1
end_plotThree
B NextLine
;**********************************
;
; Four Line draw
;
;**********************************
FourLine
;find offsets - start & end of line
AND r7,r1,#3
RSB r7,r7,#4
AND r7,r7,#3
ADD r11,r1,r6
AND r11,r11,#3
;plot start pixels
MOV r3,#0
CMP r7,#0
BEQ skip_start_plotFour
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#960]
STRB r10,[r1,#640]
STRB r10,[r1,#320]
STRB r10,[r1],#1
;check for 1 pixel line
CMP r6,#1
BEQ end_plotFour
CMP r7,#1
BEQ skip_start_plotFour
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#960]
STRB r10,[r1,#640]
STRB r10,[r1,#320]
STRB r10,[r1],#1
;check for 2 pixel line
CMP r6,#2
BEQ end_plotFour
CMP r7,#2
BEQ skip_start_plotFour
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#960]
STRB r10,[r1,#640]
STRB r10,[r1,#320]
STRB r10,[r1],#1
;check for 3 pixel line
CMP r6,#3
BEQ end_plotFour
skip_start_plotFour
ADD r9,r7,r11
SUB r9,r6,r9
MOV r9,r9,LSR #2
MOVS r8,r9,LSR #2
BEQ skip_four_word_plotFour
four_word_plotFour
LDRB r5,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r5,r5,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r5,r5,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r5,r5,r14,LSL #24
LDRB r6,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r6,r6,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r6,r6,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r6,r6,r14,LSL #24
LDRB r7,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #24
LDRB r8,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #24
ADD r1,r1,#320
STMIA r1,{r5-r8}
ADD r1,r1,#320
STMIA r1,{r5-r8}
ADD r1,r1,#320
STMIA r1,{r5-r8}
SUB r1,r1,#960
STMIA r1!,{r5-r8}
SUB r9,r9,#4
MOVS r8,r9,LSR #2
BNE four_word_plotFour
skip_four_word_plotFour
ANDS r8,r9,#2
BEQ skip_two_word_plotFour
;two word plot
LDRB r7,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r7,r7,r14,LSL #24
LDRB r8,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #24
ADD r1,r1,#320
STMIA r1,{r7-r8}
ADD r1,r1,#320
STMIA r1,{r7-r8}
ADD r1,r1,#320
STMIA r1,{r7-r8}
SUB r1,r1,#960
STMIA r1!,{r7-r8}
SUB r9,r9,#2
skip_two_word_plotFour
ANDS r8,r9,#1
BEQ skip_one_word_plotFour
;one word plot
LDRB r8,[r4,r3,LSR #20]
ADD r3,r3,r2
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #8
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #16
LDRB r14,[r4,r3,LSR #20]
ADD r3,r3,r2
ADD r8,r8,r14,LSL #24
STR r8,[r1,#960]
STR r8,[r1,#640]
STR r8,[r1,#320]
STR r8,[r1],#4
skip_one_word_plotFour
;plot_end_pixels
CMP r11,#0
BEQ end_plotFour
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#960]
STRB r10,[r1,#320]
STRB r10,[r1,#640]
STRB r10,[r1],#1
CMP r11,#1
BEQ end_plotFour
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#960]
STRB r10,[r1,#640]
STRB r10,[r1,#320]
STRB r10,[r1],#1
CMP r11,#2
BEQ end_plotFour
LDRB r10,[r4,r3,LSR #20]
ADD r3,r3,r2
STRB r10,[r1,#960]
STRB r10,[r1,#640]
STRB r10,[r1,#320]
STRB r10,[r1],#1
end_plotFour
B NextLine
EndPlotSprite
LDMFD r13!,{r0-r12,pc}
END