home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 44
/
Amiga_Dream_44.iso
/
RiscPc
/
jeux
/
biohazard.arc
/
s
/
AffLine4Pl
< prev
next >
Wrap
Text File
|
1994-06-12
|
15KB
|
558 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
IMPORT |x$stack_overflow|
EXPORT |DrawScaledLine|
EXPORT |BigRedrawScreen|
SmallestHeight
DCD 0
DSLineX DCB "DrawScaledLine", 0
ALIGN
DSLineY DCD &ff000000 + DSLineY - DSLineX
;scale line of graphics block to height value.
;on entry -
; r0 = pointer to Plot_Block where :-
; 0 - 3 = clipped heights of lines to draw
; 4 - 7 = gradients of lines to draw
; 8 - 11 = gradient counters (8 bit resolution)
; 12- 15 = data addresses of graphics data
; 16 = screen address
|DrawScaledLine|
STMFD r13!,{r0-r12,link}
LDMIA r0,{r1-r4}
;find smallest height, store in r7
MOV r7,r1
CMP r2,r7
MOVLT r7,r2
CMP r3,r7
MOVLT r7,r3
CMP r4,r7
MOVLT r7,r4
ADR r6,SmallestHeight
STR r7,[r6]
;clear r11 for as null pointer in byteline
MOV r11,#0
;draw upper section of line 1
LDR r2,[r0,#16] ; load gradient of line 1
LDR r3,[r0,#32] ; load gradient counter for line 1
LDR r4,[r0,#48] ; load data address of data for line 1
ADD r3,r3,r4,LSL #8 ; combine gradient counter & data addr
SUB r14,r1,r7 ; get height offset against smallest height
MOVS r14,r14,LSR #1
STREQ r3,[r0,#32] ; save gradient counter for line 1
BEQ DrawLine2
LDR r5,[r0,#64] ; load screen address
RSB r6,r1,#128 ; find distance from top of screen
MOV r6,r6,LSR #1
MOV r8,r6,LSL #6 ; multiply height offset by 64
ADD r6,r8,r6,LSL #8 ; add to height offset * *256
ADD r5,r5,r6 ; add to screen base
MOV r1,r14
BL DrawByteLine
STR r3,[r0,#32] ; save gradient counter for line 1
DrawLine2
;draw upper section of line 2
LDR r2,[r0,#20] ; load gradient of line 2
LDR r3,[r0,#36] ; load gradient counter for line 2
LDR r4,[r0,#52] ; load data address of data for line 2
ADD r3,r3,r4,LSL #8 ; combine gradient counter & data addr
LDR r1,[r0,#4]
SUB r14,r1,r7 ; get height offset against smallest height
MOVS r14,r14,LSR #1
STREQ r3,[r0,#36] ; save gradient counter for line 2
BEQ DrawLine3
LDR r5,[r0,#64] ; load screen address
RSB r6,r1,#128 ; find distance from top of screen
MOV r6,r6,LSR #1
MOV r8,r6,LSL #6 ; multiply height offset by 64
ADD r6,r8,r6,LSL #8 ; add to height offset * 256
ADD r5,r5,r6 ; add to screen base
ADD r5,r5,#1
MOV r1,r14
BL DrawByteLine
STR r3,[r0,#36] ; save gradient counter for line 2
DrawLine3
;draw upper section of line 3
LDR r2,[r0,#24] ; load gradient of line 3
LDR r3,[r0,#40] ; load gradient counter for line 3
LDR r4,[r0,#56] ; load data address of data for line 3
ADD r3,r3,r4,LSL #8 ; combine gradient counter & data addr
LDR r1,[r0,#8]
SUB r14,r1,r7 ; get height offset against smallest height
MOVS r14,r14,LSR #1
STREQ r3,[r0,#40] ; save gradient counter for line 3
BEQ DrawLine4
LDR r5,[r0,#64] ; load screen address
RSB r6,r1,#128 ; find distance from top of screen
MOV r6,r6,LSR #1
MOV r8,r6,LSL #6 ; multiply height offset by 64
ADD r6,r8,r6,LSL #8 ; add to height offset * 256
ADD r5,r5,r6 ; add to screen base
ADD r5,r5,#2
MOV r1,r14
BL DrawByteLine
STR r3,[r0,#40] ; save gradient counter for line 3
DrawLine4
;draw upper section of line 4
LDR r1,[r0,#12]
LDR r2,[r0,#28] ; load gradient of line 4
LDR r3,[r0,#44] ; load gradient counter for line 4
LDR r4,[r0,#60] ; load data address of data for line 4
ADD r3,r3,r4,LSL #8 ; combine gradient counter & data addr
SUB r14,r1,r7 ; get height offset against smallest height
MOVS r14,r14,LSR #1
STREQ r3,[r0,#44] ; save gradient counter for line 4
BEQ DrawMainBlock
LDR r5,[r0,#64] ; load screen address
RSB r6,r1,#128 ; find distance from top of screen
MOV r6,r6,LSR #1
MOV r8,r6,LSL #6 ; multiply height offset by 64
ADD r6,r8,r6,LSL #8 ; add to height offset * 256
ADD r5,r5,r6 ; add to screen base
ADD r5,r5,#3
MOV r1,r14
BL DrawByteLine
STR r3,[r0,#44] ; save gradient counter for line 4
DrawMainBlock
ADR r14,SmallestHeight
LDR r14,[r14]
LDR r12,[r0,#64] ; load screen address
;compute screen address
LDR r5,[r0,#64] ; load screen address
RSB r6,r14,#128 ; find distance from top of screen
MOV r6,r6,LSR #1
MOV r8,r6,LSL #6 ; multiply height offset by 64
ADD r6,r8,r6,LSL #8 ; add to height offset * 256
ADD r12,r5,r6 ; add to screen base
ADD r0,r0,#16
LDMIA r0!,{r1-r4} ; load up gradients
LDMIA r0,{r5-r8} ; load up gradient counters + data addrs
MOV r11,#0 ; clear r11 for use as base reg
StartPlotBlock
LDRB r10,[r11,r5,LSR #8]
LDRB r9,[r11,r6,LSR #8]
ADD r10,r10,r9,LSL #8
LDRB r9,[r11,r7,LSR #8]
ADD r10,r10,r9,LSL #16
LDRB r9,[r11,r8,LSR #8]
ADD r10,r10,r9,LSL #24
STR r10,[r12],#320
ADD r5,r5,r1
ADD r6,r6,r2
ADD r7,r7,r3
ADD r8,r8,r4
SUBS r14,r14,#1
BEQ EndPlotBlock
LDRB r10,[r11,r5,LSR #8]
LDRB r9,[r11,r6,LSR #8]
ADD r10,r10,r9,LSL #8
LDRB r9,[r11,r7,LSR #8]
ADD r10,r10,r9,LSL #16
LDRB r9,[r11,r8,LSR #8]
ADD r10,r10,r9,LSL #24
STR r10,[r12],#320
ADD r5,r5,r1
ADD r6,r6,r2
ADD r7,r7,r3
ADD r8,r8,r4
SUBS r14,r14,#1
BEQ EndPlotBlock
LDRB r10,[r11,r5,LSR #8]
LDRB r9,[r11,r6,LSR #8]
ADD r10,r10,r9,LSL #8
LDRB r9,[r11,r7,LSR #8]
ADD r10,r10,r9,LSL #16
LDRB r9,[r11,r8,LSR #8]
ADD r10,r10,r9,LSL #24
STR r10,[r12],#320
ADD r5,r5,r1
ADD r6,r6,r2
ADD r7,r7,r3
ADD r8,r8,r4
SUBS r14,r14,#1
BEQ EndPlotBlock
LDRB r10,[r11,r5,LSR #8]
LDRB r9,[r11,r6,LSR #8]
ADD r10,r10,r9,LSL #8
LDRB r9,[r11,r7,LSR #8]
ADD r10,r10,r9,LSL #16
LDRB r9,[r11,r8,LSR #8]
ADD r10,r10,r9,LSL #24
STR r10,[r12],#320
ADD r5,r5,r1
ADD r6,r6,r2
ADD r7,r7,r3
ADD r8,r8,r4
SUBS r14,r14,#1
BEQ EndPlotBlock
LDRB r10,[r11,r5,LSR #8]
LDRB r9,[r11,r6,LSR #8]
ADD r10,r10,r9,LSL #8
LDRB r9,[r11,r7,LSR #8]
ADD r10,r10,r9,LSL #16
LDRB r9,[r11,r8,LSR #8]
ADD r10,r10,r9,LSL #24
STR r10,[r12],#320
ADD r5,r5,r1
ADD r6,r6,r2
ADD r7,r7,r3
ADD r8,r8,r4
SUBS r14,r14,#1
BEQ EndPlotBlock
LDRB r10,[r11,r5,LSR #8]
LDRB r9,[r11,r6,LSR #8]
ADD r10,r10,r9,LSL #8
LDRB r9,[r11,r7,LSR #8]
ADD r10,r10,r9,LSL #16
LDRB r9,[r11,r8,LSR #8]
ADD r10,r10,r9,LSL #24
STR r10,[r12],#320
ADD r5,r5,r1
ADD r6,r6,r2
ADD r7,r7,r3
ADD r8,r8,r4
SUBS r14,r14,#1
BNE StartPlotBlock
EndPlotBlock
STMIA r0,{r5-r8} ; save gradient/data combos
STR r12,[r0,#32] ; save screen address
SUB r0,r0,#32 ; reset pointer to start of height data
ADR r6,SmallestHeight
LDR r6,[r6]
;draw lower section of line 1
MOV r5,r12 ; get old screen address
LDR r1,[r0] ; get height of line 1
SUB r1,r1,r6 ; length = height - smallest height
MOVS r1,r1,LSR #1 ; divide by 2
BEQ LowerLine2
LDR r2,[r0,#16] ; load gradient of line 1
LDR r3,[r0,#32] ; load gradient/data combo for line 1
LDR r4,[r0,#48] ; load data address of data for line 1
BL DrawByteLine
LowerLine2
;draw lower section of line 2
ADD r5,r12,#1
LDR r1,[r0,#4] ; get height of line 2
SUB r1,r1,r6 ; length = height - smallest height
MOVS r1,r1,LSR #1 ; divide by 2
BEQ LowerLine3
LDR r2,[r0,#20] ; load gradient of line 2
LDR r3,[r0,#36] ; load gradient/data combo for line 2
LDR r4,[r0,#52] ; load data address of data for line 2
BL DrawByteLine
LowerLine3
;draw lower section of line 3
ADD r5,r12,#2
LDR r1,[r0,#8] ; get height of line 3
SUB r1,r1,r6 ; length = height - smallest height
MOVS r1,r1,LSR #1 ; divide by 2
BEQ LowerLine4
LDR r2,[r0,#24] ; load gradient of line 3
LDR r3,[r0,#40] ; load gradient/data combo for line 3
LDR r4,[r0,#56] ; load data address of data for line 3
BL DrawByteLine
LowerLine4
;draw lower section of line 4
ADD r5,r12,#3
LDR r1,[r0,#12] ; get height of line 1
SUB r1,r1,r6 ; length = height - smallest height
MOVS r1,r1,LSR #1 ; divide by 2
BEQ EndDSLine
LDR r2,[r0,#28] ; load gradient of line 1
LDR r3,[r0,#44] ; load gradient/data combo for line 1
LDR r4,[r0,#60] ; load data address of data for line 1
BL DrawByteLine
EndDSLine
LDMFD r13!,{r0-r12,pc}
DBLineX DCB "DrawByteLine", 0
ALIGN
DBLineY DCD &ff000000 + DBLineY - DBLineX
;scale line of graphics block to height value.
;on entry -
; r1 = length of line to draw
; r2 = gradient of line
; r3 = gradient counter plus data address
; r5 = screen address
; r14 = return address
;
;on exit -
; r1 = zero
; r2 = gradient of line
; r3 = gradient counter plus data address, updated
; r5 = updated screen address
; r14 = return address
;
DrawByteLine
LDRB r10,[r11,r3,LSR #8]
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BEQ EndByteLine
LDRB r10,[r11,r3,LSR #8]
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BEQ EndByteLine
LDRB r10,[r11,r3,LSR #8]
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BEQ EndByteLine
LDRB r10,[r11,r3,LSR #8]
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BEQ EndByteLine
LDRB r10,[r11,r3,LSR #8]
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BEQ EndByteLine
LDRB r10,[r11,r3,LSR #8]
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BEQ EndByteLine
LDRB r10,[r11,r3,LSR #8]
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BEQ EndByteLine
LDRB r10,[r11,r3,LSR #8]
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BNE DrawByteLine
EndByteLine
MOV r15,r14 ; return to caller...
BRDScreenX DCB "BigRedrawScreen", 0
ALIGN
BRDScreenY DCD &ff000000 + BRDScreenY - BRDScreenX
;draw background graphics.
;on entry -
; r0 = screen address
|BigRedrawScreen|
STMFD r13!,{r0-r12,link}
;initial height value
MOV r1,#64
;load initial colour value into r2 & make word sized
MOV r2,#44
ADD r2,r2,r2,LSL #8
ADD r2,r2,r2,LSL #16
;move into other registers
MOV r3,r2
MOV r4,r2
MOV r5,r2
MOV r6,r2
MOV r7,r2
MOV r8,r2
MOV r9,r2
MOV r10,r2
MOV r11,r2
MOV r12,#0
MOV r14,#0
BRDloop STMIA r0!,{r2-r11} ;plot one line of colour data on screen
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r3-r12,r14}
STMIA r0!,{r3-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
SUBS r1,r1,#1
BNE BRDloop
;next height value
MOV r1,#63
;load next colour value into r2 & make word sized
MOV r2,#46
ADD r2,r2,r2,LSL #8
ADD r2,r2,r2,LSL #16
;move into other registers
MOV r3,r2
MOV r4,r2
MOV r5,r2
MOV r6,r2
MOV r7,r2
MOV r8,r2
MOV r9,r2
MOV r10,r2
MOV r11,r2
BRDloopA STMIA r0!,{r2-r11} ;plot one line of colour data on screen
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r3-r12,r14}
STMIA r0!,{r3-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
SUBS r1,r1,#1
BNE BRDloopA
;load initial colour value into r2 & make word sized
MOV r2,#0
;move into other registers
MOV r3,r2
MOV r4,r2
MOV r5,r2
MOV r6,r2
MOV r7,r2
MOV r8,r2
MOV r9,r2
MOV r10,r2
MOV r11,r2
MOV r12,#0
MOV r14,#0
STMIA r0!,{r2-r11} ;plot one line of colour data on screen
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
;initial height value
MOV r1,#64
;load initial colour value into r2 & make word sized
MOV r2,#44
ADD r2,r2,r2,LSL #8
ADD r2,r2,r2,LSL #16
;move into other registers
MOV r3,r2
MOV r4,r2
MOV r5,r2
MOV r6,r2
MOV r7,r2
MOV r8,r2
MOV r9,r2
MOV r10,r2
MOV r11,r2
BRDloopB STMIA r0!,{r2-r11} ;plot one line of colour data on screen
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r3-r12,r14}
STMIA r0!,{r3-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
SUBS r1,r1,#1
BNE BRDloopB
;next height value
MOV r1,#64
;load next colour value into r2 & make word sized
MOV r2,#46
ADD r2,r2,r2,LSL #8
ADD r2,r2,r2,LSL #16
;move into other registers
MOV r3,r2
MOV r4,r2
MOV r5,r2
MOV r6,r2
MOV r7,r2
MOV r8,r2
MOV r9,r2
MOV r10,r2
MOV r11,r2
BRDloopC STMIA r0!,{r2-r11} ;plot one line of colour data on screen
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r3-r12,r14}
STMIA r0!,{r3-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
SUBS r1,r1,#1
BNE BRDloopC
EndBRDScreen
LDMFD r13!,{r0-r12,pc}
END