home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 44
/
Amiga_Dream_44.iso
/
RiscPc
/
jeux
/
biohazard.arc
/
s
/
AffLnVGA
< prev
next >
Wrap
Text File
|
1995-02-19
|
26KB
|
895 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 |DrawScaledLineVGA|
EXPORT |BigRedrawScreenVGA|
DSLineX1 DCB "DrawScaledLine", 0
ALIGN
DSLineY1 DCD &ff000000 + DSLineY1 - DSLineX1
;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 (13 bit resolution)
; 12- 15 = data addresses of graphics data
; 16 = screen address
; 17 = base address of graphics data
; 18 = smallest_height
; 19 = screen height
; 20 = pointer to gradient table
; 21 = scaling factor
; 22 = AND value
ALIGN
SmallestHeight1
DCD 0
ALIGN
|DrawScaledLineVGA|
STMFD r13!,{r0-r12,link}
;outer loop
;r0 = pointer to plot block.
LDMIA r0,{r1-r3}
SUB r1,r1,#16
SUB r2,r2,#16
ADD r3,r3,#4
LDR r4,[r0,#64]
ADD r4,r4,#4
STR r4,[r0,#64]
STMFD r13!,{r1-r4}
OuterLoop LDMFD r13!,{r1-r4}
ADD r1,r1,#16
ADD r2,r2,#16
SUBS r3,r3,#4
BEQ EndOuterLoop
ADD r4,r4,#4
STR r4,[r0,#64]
STMFD r13!,{r1-r4}
STMFD r13!,{r2}
LDMIA r1,{r5-r8}
;shift distances down 17 places
MOV r5,r5,LSR #18
MOV r6,r6,LSR #18
MOV r7,r7,LSR #18
MOV r8,r8,LSR #18
;clear result registers
MOV r1,#0
MOV r2,#0
MOV r3,#0
MOV r4,#0
;compute heights from distances
;wrk = temp register
;div = divisor (distance)
;num = number (64<<10)
;res = result
;RSBS wrk,div,num,LSR #bit
;ADC res,res,res
;SUBCS num,num,div,LSR #bit
;set up working registers
MOV r9,#64 ;num
MOV r9,r9,LSL #10
RSBS r14,r5,r9,LSR #16
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #16
RSBS r14,r5,r9,LSR #15
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #15
RSBS r14,r5,r9,LSR #14
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #14
RSBS r14,r5,r9,LSR #13
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #13
RSBS r14,r5,r9,LSR #12
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #12
RSBS r14,r5,r9,LSR #11
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #11
RSBS r14,r5,r9,LSR #10
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #10
RSBS r14,r5,r9,LSR #9
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #9
RSBS r14,r5,r9,LSR #8
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #8
RSBS r14,r5,r9,LSR #7
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #7
RSBS r14,r5,r9,LSR #6
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #6
RSBS r14,r5,r9,LSR #5
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #5
RSBS r14,r5,r9,LSR #4
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #4
RSBS r14,r5,r9,LSR #3
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #3
RSBS r14,r5,r9,LSR #2
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #2
RSBS r14,r5,r9,LSR #1
ADC r1,r1,r1
SUBCS r9,r9,r5,LSL #1
;set up working registers
MOV r9,#64 ;num
MOV r9,r9,LSL #10
RSBS r14,r6,r9,LSR #16
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #16
RSBS r14,r6,r9,LSR #15
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #15
RSBS r14,r6,r9,LSR #14
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #14
RSBS r14,r6,r9,LSR #13
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #13
RSBS r14,r6,r9,LSR #12
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #12
RSBS r14,r6,r9,LSR #11
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #11
RSBS r14,r6,r9,LSR #10
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #10
RSBS r14,r6,r9,LSR #9
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #9
RSBS r14,r6,r9,LSR #8
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #8
RSBS r14,r6,r9,LSR #7
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #7
RSBS r14,r6,r9,LSR #6
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #6
RSBS r14,r6,r9,LSR #5
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #5
RSBS r14,r6,r9,LSR #4
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #4
RSBS r14,r6,r9,LSR #3
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #3
RSBS r14,r6,r9,LSR #2
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #2
RSBS r14,r6,r9,LSR #1
ADC r2,r2,r2
SUBCS r9,r9,r6,LSL #1
;set up working registers
MOV r9,#64 ;num
MOV r9,r9,LSL #10
RSBS r14,r7,r9,LSR #16
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #16
RSBS r14,r7,r9,LSR #15
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #15
RSBS r14,r7,r9,LSR #14
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #14
RSBS r14,r7,r9,LSR #13
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #13
RSBS r14,r7,r9,LSR #12
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #12
RSBS r14,r7,r9,LSR #11
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #11
RSBS r14,r7,r9,LSR #10
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #10
RSBS r14,r7,r9,LSR #9
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #9
RSBS r14,r7,r9,LSR #8
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #8
RSBS r14,r7,r9,LSR #7
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #7
RSBS r14,r7,r9,LSR #6
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #6
RSBS r14,r7,r9,LSR #5
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #5
RSBS r14,r7,r9,LSR #4
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #4
RSBS r14,r7,r9,LSR #3
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #3
RSBS r14,r7,r9,LSR #2
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #2
RSBS r14,r7,r9,LSR #1
ADC r3,r3,r3
SUBCS r9,r9,r7,LSL #1
;set up working registers
MOV r9,#64 ;num
MOV r9,r9,LSL #10
RSBS r14,r8,r9,LSR #16
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #16
RSBS r14,r8,r9,LSR #15
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #15
RSBS r14,r8,r9,LSR #14
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #14
RSBS r14,r8,r9,LSR #13
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #13
RSBS r14,r8,r9,LSR #12
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #12
RSBS r14,r8,r9,LSR #11
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #11
RSBS r14,r8,r9,LSR #10
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #10
RSBS r14,r8,r9,LSR #9
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #9
RSBS r14,r8,r9,LSR #8
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #8
RSBS r14,r8,r9,LSR #7
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #7
RSBS r14,r8,r9,LSR #6
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #6
RSBS r14,r8,r9,LSR #5
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #5
RSBS r14,r8,r9,LSR #4
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #4
RSBS r14,r8,r9,LSR #3
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #3
RSBS r14,r8,r9,LSR #2
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #2
RSBS r14,r8,r9,LSR #1
ADC r4,r4,r4
SUBCS r9,r9,r8,LSL #1
;multiply by scaling factor
LDR r14,[r0,#84]
MUL r1,r14,r1
MUL r2,r14,r2
MUL r3,r14,r3
MUL r4,r14,r4
MOV r1,r1,LSR #16
MOV r2,r2,LSR #16
MOV r3,r3,LSR #16
MOV r4,r4,LSR #16
;shift and round
CMP r1,#2
MOVLT r1,#2
CMP r2,#2
MOVLT r2,#2
CMP r3,#2
MOVLT r3,#2
CMP r4,#2
MOVLT r4,#2
MOV r1,r1,ASL #1
MOV r2,r2,ASL #1
MOV r3,r3,ASL #1
MOV r4,r4,ASL #1
;load pointer to gradient table
LDR r5,[r0,#80]
;limit heights
MOV r6,#1024
SUB r6,r6,#1
CMP r1,r6
MOVGT r1,r6
CMP r2,r6
MOVGT r2,r6
CMP r3,r6
MOVGT r3,r6
CMP r4,r6
MOVGT r4,r6
MOV r6,#4
CMP r1,r6
MOVLT r1,r6
CMP r2,r6
MOVLT r2,r6
CMP r3,r6
MOVLT r3,r6
CMP r4,r6
MOVLT r4,r6
;load gradients from table
LDR r6,[r5,r1,LSL #2]
LDR r7,[r5,r2,LSL #2]
LDR r8,[r5,r3,LSL #2]
LDR r9,[r5,r4,LSL #2]
ADD r0,r0,#16
STMIA r0,{r6-r9}
SUB r0,r0,#16
;load smallest height
LDR r5,[r0,#76]
;modify height values
SUBS r14,r4,r5
MOVPL r14,r14,LSR #1
MULPL r12,r9,r14
MOVPL r4,r5
MOVMI r12,#0
SUBS r14,r1,r5
MOVPL r14,r14,LSR #1
MULPL r9,r6,r14
MOVPL r1,r5
MOVMI r9,#0
SUBS r14,r2,r5
MOVPL r14,r14,LSR #1
MULPL r10,r7,r14
MOVPL r2,r5
MOVMI r10,#0
SUBS r14,r3,r5
MOVPL r14,r14,LSR #1
MULPL r11,r8,r14
MOVPL r3,r5
MOVMI r11,#0
STMIA r0,{r1-r4}
ADD r0,r0,#32
STMIA r0,{r9-r12}
SUB r0,r0,#32
;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
STR r7,[r0,#72]
LDMFD r13!,{r9}
;load r11 with graphics data pointer
LDR r11,[r0,#68]
;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,[r9] ; load data address of data for line 1
ADD r3,r3,r4,LSL #14 ; 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,#480 ; find distance from top of screen
MOV r6,r6,LSR #1
MOV r8,r6,LSL #6 ; multiply height offset by 128
ADD r6,r8,r6,LSL #8 ; add to height offset * *256
ADD r5,r5,r6,LSL #1 ; 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,[r9,#4] ; load data address of data for line 2
ADD r3,r3,r4,LSL #14 ; 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,#480 ; find distance from top of screen
MOV r6,r6,LSR #1
MOV r8,r6,LSL #6 ; multiply height offset by 128
ADD r6,r8,r6,LSL #8 ; add to height offset * 256
ADD r5,r5,r6,LSL #1 ; 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,[r9,#8] ; load data address of data for line 3
ADD r3,r3,r4,LSL #14 ; 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,#480 ; 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,LSL #1 ; 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,[r9,#12] ; load data address of data for line 4
ADD r3,r3,r4,LSL #14 ; 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,#480 ; 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,LSL #1 ; add to screen base
ADD r5,r5,#3
MOV r1,r14
BL DrawByteLine
STR r3,[r0,#44] ; save gradient counter for line 4
DrawMainBlock
;preserve smallest height
LDR r14,[r0,#72]
LDR r12,[r0,#64] ; load screen address
;compute screen address
LDR r5,[r0,#64] ; load screen address
RSB r6,r14,#480 ; 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,LSL #1 ; add to screen base
;load and combine AND value with counter
LDR r9,[r0,#88]
ORR r14,r14,r9
ADD r0,r0,#16
LDMIA r0!,{r1-r4} ; load up gradients
LDMIA r0,{r5-r8} ; load up gradient counters + data addrs
StartPlotBlock
LDRB r10,[r11,r5,LSR #14]
AND r10,r10,r14,LSR #16
LDRB r9,[r11,r6,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #8
LDRB r9,[r11,r7,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #16
LDRB r9,[r11,r8,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #24
STR r10,[r12],#320
STR r10,[r12],#320
ADD r5,r5,r1
ADD r6,r6,r2
ADD r7,r7,r3
ADD r8,r8,r4
SUB r14,r14,#1
MOVS r10,r14,LSL #16
BEQ EndPlotBlock
LDRB r10,[r11,r5,LSR #14]
AND r10,r10,r14,LSR #16
LDRB r9,[r11,r6,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #8
LDRB r9,[r11,r7,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #16
LDRB r9,[r11,r8,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #24
STR r10,[r12],#320
STR r10,[r12],#320
ADD r5,r5,r1
ADD r6,r6,r2
ADD r7,r7,r3
ADD r8,r8,r4
SUB r14,r14,#1
MOVS r10,r14,LSL #16
BEQ EndPlotBlock
LDRB r10,[r11,r5,LSR #14]
AND r10,r10,r14,LSR #16
LDRB r9,[r11,r6,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #8
LDRB r9,[r11,r7,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #16
LDRB r9,[r11,r8,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #24
STR r10,[r12],#320
STR r10,[r12],#320
ADD r5,r5,r1
ADD r6,r6,r2
ADD r7,r7,r3
ADD r8,r8,r4
SUB r14,r14,#1
MOVS r10,r14,LSL #16
BEQ EndPlotBlock
LDRB r10,[r11,r5,LSR #14]
AND r10,r10,r14,LSR #16
LDRB r9,[r11,r6,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #8
LDRB r9,[r11,r7,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #16
LDRB r9,[r11,r8,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #24
STR r10,[r12],#320
STR r10,[r12],#320
ADD r5,r5,r1
ADD r6,r6,r2
ADD r7,r7,r3
ADD r8,r8,r4
SUB r14,r14,#1
MOVS r10,r14,LSL #16
BEQ EndPlotBlock
LDRB r10,[r11,r5,LSR #14]
AND r10,r10,r14,LSR #16
LDRB r9,[r11,r6,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #8
LDRB r9,[r11,r7,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #16
LDRB r9,[r11,r8,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #24
STR r10,[r12],#320
STR r10,[r12],#320
ADD r5,r5,r1
ADD r6,r6,r2
ADD r7,r7,r3
ADD r8,r8,r4
SUB r14,r14,#1
MOVS r10,r14,LSL #16
BEQ EndPlotBlock
LDRB r10,[r11,r5,LSR #14]
AND r10,r10,r14,LSR #16
LDRB r9,[r11,r6,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #8
LDRB r9,[r11,r7,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #16
LDRB r9,[r11,r8,LSR #14]
AND r9,r9,r14,LSR #16
ADD r10,r10,r9,LSL #24
STR r10,[r12],#320
STR r10,[r12],#320
ADD r5,r5,r1
ADD r6,r6,r2
ADD r7,r7,r3
ADD r8,r8,r4
SUB r14,r14,#1
MOVS r10,r14,LSL #16
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
LDR r6,[r0,#72]
;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
B OuterLoop
EndOuterLoop
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
;store return location on stack
STMFD r13!,{r14}
ByteLineLoop
;load AND value
LDR r14,[r0,#88]
LDRB r10,[r11,r3,LSR #14]
AND r10,r10,r14,LSR #16
STRB r10,[r5],#320
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BEQ EndByteLine
LDRB r10,[r11,r3,LSR #14]
AND r10,r10,r14,LSR #16
STRB r10,[r5],#320
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BEQ EndByteLine
LDRB r10,[r11,r3,LSR #14]
AND r10,r10,r14,LSR #16
STRB r10,[r5],#320
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BEQ EndByteLine
LDRB r10,[r11,r3,LSR #14]
AND r10,r10,r14,LSR #16
STRB r10,[r5],#320
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BEQ EndByteLine
LDRB r10,[r11,r3,LSR #14]
AND r10,r10,r14,LSR #16
STRB r10,[r5],#320
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BEQ EndByteLine
LDRB r10,[r11,r3,LSR #14]
AND r10,r10,r14,LSR #16
STRB r10,[r5],#320
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BEQ EndByteLine
LDRB r10,[r11,r3,LSR #14]
AND r10,r10,r14,LSR #16
STRB r10,[r5],#320
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BEQ EndByteLine
LDRB r10,[r11,r3,LSR #14]
AND r10,r10,r14,LSR #16
STRB r10,[r5],#320
STRB r10,[r5],#320
ADD r3,r3,r2
SUBS r1,r1,#1
BNE ByteLineLoop
EndByteLine
LDMFD r13!,{r15}
BRDScreenX DCB "BigRedrawScreen", 0
ALIGN
BRDScreenY DCD &ff000000 + BRDScreenY - BRDScreenX
;draw background graphics.
;on entry -
; r0 = screen address
|BigRedrawScreenVGA|
STMFD r13!,{r0-r12,link}
;initial height value
MOV r1,#128
;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
BRDloop 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!,{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,#128
;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!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
STMIA r0!,{r2-r11}
SUBS r1,r1,#1
BNE BRDloopA
EndBRDScreen
LDMFD r13!,{r0-r12,pc}
END