Commit 2bd19ff4 authored by Neil Turton's avatar Neil Turton
Browse files

Version Spin_merge taken

parent 21fe8ed4
......@@ -302,6 +302,9 @@ intcolour_selecttable
intcolour_selecttable_doneflags
Debug mjs,"select_table stored effective R5 = ",R5
STR R5, ctrans_selgentab_R5 ;store the R5 flags value (zapped to 0 as appropriate)
[ Medusa
BL intcolour_16or32 ;Is source mode 16 or 32bpp?
STRVS R0,[sp,#CallerR0] ;Poke error return address onto the stack
......@@ -324,6 +327,8 @@ intcolour_generatetable
Push "R0-R9,LR" ;Preserve the registers, return address already pushed
STR R5, ctrans_selgentab_R5 ;store the entry R5 flags value
[ Medusa
BL intcolour_16or32 ;Is source mode 16 or 32bpp?
STRVS R0,[sp,#CallerR0] ;Poke error return address onto the stack
......@@ -378,8 +383,8 @@ intcolour_not_jpeg
SWIVC XColourTrans_GenerateTable
BVS intcolour_table_errored
LDR R5, [sp, #24] ; get caller R5 back (interested in bit4 'wide')
Debug mjs,"mjs: generate table, caller R5 = ",R5
LDR R5,ctrans_selgentab_R5 ; get effective caller R5 back (interested in bit4 'wide')
Debug mjs,"mjs: generate/select table effective R5 = ",R5
; R8 -> buffer to be filled with pixtrans values
; R9 => start of the table to be processed
......
......@@ -196,6 +196,7 @@ FontHandleEnsure SETL {TRUE} ;Apply the bug fix
; Setting the 'debug' variable to FALSE will turn off all NDR debugging
debug SETL {FALSE} :LAND: BeingDeveloped
;debug SETL {TRUE}
hostvdu SETL {TRUE}
debug_flush SETL {FALSE} :LAND: (:LNOT: hostvdu)
......
......@@ -141,6 +141,8 @@ fontpaint_spacecount # 4 ;Number of spaces within the line
fontpaint_initmatrix # 4*6 ;Matrix to use at start of day
fontpaint_matrix # 4*6
ctrans_selgentab_R5 # 4 ;R5 for _SelectTable or _GenerateTable
jpeg_ctransflag # 4 ;limits scope of ColourTrans intercept for JPEG's
jpeg_maxmemory # 4 ;max memory SpriteExtend requires for any JPEG's
......@@ -148,6 +150,9 @@ counting_pass # 4 ;flag - true if asking for rectangles only to
; count such things as JPEG memory requirements
counting_nextrect # 4 ;next user rectangle in counting pass
; mjs fudge
PDriverDPMaxMemBuff # 32
; Any extra chunk of RMA that is temporarily claimed during a call should
; have its address placed here, so that it can be released on a soft break.
......
......@@ -246,7 +246,7 @@ image_scaling
STR R4,job_spritescale+28 ; (Y3)
STR R4,job_spritescale+20 ; (Y2)
ADR R6,job_spritescale ; R6 -> SpriteOp 56 style destination block
ADRL R6,job_spritescale ; R6 -> SpriteOp 56 style destination block
Pull "R0-R4,R8,PC"
......
......@@ -57,7 +57,7 @@ job_htonealign # 1 ; current alignment within the halftone
job_sarea_change # 4 ; amount we have changed system sprite area by
job_spritearea # 4 ; which sprite area we are using
job_linebuffer # 12 * (max_passes+1)
job_linebuffer # 12 * (max_passes+2)
; name(s) of/pointer to our sprite for buffering lines
job_currentbuffer # 4 ; pointer to (name of) sprite we are currently
; redirecting output to
......
......@@ -24,7 +24,7 @@ Font SETD false
FontSlaving SETD false
ManageJob SETD false
PageBox SETD false
PageBoxMem SETD true
PageBoxMem SETD false
Plot SETD false
Private SETD false
Privatemjs SETD true
......@@ -34,8 +34,8 @@ Info SETD false
TransSprite SETD false
xx SETD false
CallPDumper SETD false
Dump SETD true
JPEG SETD true
Dump SETD false
JPEG SETD false
mjs SETD false
GBLL DescribeWS
......
......@@ -349,7 +349,10 @@ managejob_abortalt ROUT
[ MultiplePasses
ADR r0, job_linebuffer+12
LDRB r2, job_strip_type
CMP r2, #3 ;multiple pass 16m colours
LDRB r2, job_no_passes
ADDEQ r2,r2,#1
00
BL losebuffersprite
ADD r0, r0, #12
......
......@@ -595,6 +595,7 @@ divide_and_scale
flip_buffer ROUT
Push "r0-r3, lr"
LDRB lr, job_buffer_marked
CMP lr, #0
......@@ -818,43 +819,42 @@ main_loopy16
]
[ Libra1
Handle_32bpp_rotation
LDR R4, [r1, #spHeight]
ADD r4, r4, #1
MOV R6, R4
LDR R5, [r1, #spWidth]
ADD R5, R5, #1
MOV R7, R5
; now set initial pixel pointers
LDR r7, [r0, #spImage]
ADD r0, r0, r7
; destination copy starts at the first pixel on the last row
LDR r7, [r1, #spImage]
ADD r1, r1, r7 ; point at first byte after sprite
MOV R7, R5
MOV R3, R4, LSL #2
ADD R0, R0, R3
MOV R2, R0
Start_loop32
SUB R2, R2, #4
MOV R0, R2
main_loopy32
LDR LR, [R0], R3
STR LR, [R1], #4
SUBS R5, R5, #1
BGT main_loopy32
MOV R5, R7
SUBS R4, R4, #1
BGT Start_loop32
Push "R8-R11"
LDR R2, [R1, #spHeight]
ADD R2,R2,#1 ;dest height, or source width
LDR R3, [R1, #spWidth]
ADD R3,R3,#1 ;dest width, or source height
; Debug PageBoxMem,"32bpp rotate: source width height = ",R2,R3
LDR R4, [R0, #spImage]
ADD R0,R0,R4 ;R0 -> 1st source pixel
LDR R4, [R1, #spImage]
ADD R1,R1,R4 ;R1 -> 1st dest pixel
MUL R5,R2,R3 ;R5 = (dest height).(dest width)
ADD R1,R1,R5,LSL #2
SUB R1,R1,R3,LSL #2 ;R1 -> 1st dest pixel of last row
MOV R7,R3 ;source row counter
; Debug PageBoxMem,"32bpp rotate:R0 R1 start = ",R0,R1
01
MOV R6,R2 ;source column counter
02
LDR R8,[R0],R2,LSL #2 ;load next 4 pixels...
LDR R9,[R0],R2,LSL #2
LDR R10,[R0],R2,LSL #2
LDR R11,[R0],R2,LSL #2 ;...columnwise from source
STMIA R1,{R8-R11} ;store them rowwise in dest.
SUB R0,R0,R2,LSL #4 ;reset R0
ADD R0,R0,#4 ;move to next source column
SUB R1,R1,R3,LSL #2 ;move to next dest row up
SUBS R6,R6,#1
BNE %BT02 ;till columns done
ADD R0,R0,R2,LSL #3
ADD R0,R0,R2,LSL #2 ;move R0 to next set of 4 source rows
ADD R1,R1,R5,LSL #2
ADD R1,R1,#16 ;move R1 to next set of 4 pixels, bottom row
SUBS R7,R7,#4 ;4 more source rows done
; Debug PageBoxMem,"32bpp rotate:R0 R1 next = ",R0,R1
BNE %BT01
Pull "R8-R11"
Pull "r0-r7, pc",,^
]
......@@ -1169,6 +1169,201 @@ spin8x8_in_words ROUT
MOVS pc, lr ; preserve flags
]
;
;fast copysprite_withrotate, 32 bpp case, 90 degrees
;
copysprite_withrotate_32bpp90 ROUT
Push "R0-R11,LR"
Debug PageBoxMem,"copysprite_withrotate_32bpp90"
MOV R2,R0
BL get_sprite_address
MOV R0,R2
MOV R2,R1
BL get_sprite_address
MOV R1,R2
LDR R2, [R1, #spHeight]
ADD R2,R2,#1 ;dest height, or source width
LDR R3, [R1, #spWidth]
ADD R3,R3,#1 ;dest width, or source height
LDR R4, [R0, #spImage]
ADD R0,R0,R4 ;R0 -> 1st source pixel
LDR R4, [R1, #spImage]
ADD R1,R1,R4 ;R1 -> 1st dest pixel
MUL R5,R2,R3 ;R5 = (dest height).(dest width)
ADD R1,R1,R5,LSL #2
SUB R1,R1,R3,LSL #2 ;R1 -> 1st dest pixel of last row
MOV R7,R3 ;source row counter
01
MOV R6,R2 ;source column counter
02
LDR R8,[R0],R2,LSL #2 ;load next 4 pixels...
LDR R9,[R0],R2,LSL #2
LDR R10,[R0],R2,LSL #2
LDR R11,[R0],R2,LSL #2 ;...columnwise from source
STMIA R1,{R8-R11} ;store them rowwise in dest.
SUB R0,R0,R2,LSL #4 ;reset R0
ADD R0,R0,#4 ;move to next source column
SUB R1,R1,R3,LSL #2 ;move to next dest row up
SUBS R6,R6,#1
BNE %BT02 ;till columns done
ADD R0,R0,R2,LSL #3
ADD R0,R0,R2,LSL #2 ;move R0 to next set of 4 source rows
ADD R1,R1,R5,LSL #2
ADD R1,R1,#16 ;move R1 to next set of 4 pixels, bottom row
SUBS R7,R7,#4 ;4 more source rows done
BNE %BT01
Pull "R0-R11,PC",,^
;
;fast copysprite_withrotate, 32 bpp case, 270 degrees (implicit flips)
;
copysprite_withrotate_32bpp270 ROUT
Push "R0-R11,LR"
Debug PageBoxMem,"copysprite_withrotate_32bpp270"
MOV R2,R0
BL get_sprite_address
MOV R0,R2
MOV R2,R1
BL get_sprite_address
MOV R1,R2
LDR R2, [R1, #spHeight]
ADD R2,R2,#1 ;dest height, or source width
LDR R3, [R1, #spWidth]
ADD R3,R3,#1 ;dest width, or source height
LDR R4, [R0, #spImage]
ADD R0,R0,R4 ;R0 -> 1st source pixel
LDR R4, [R1, #spImage]
ADD R1,R1,R4 ;R1 -> 1st dest pixel
MUL R5,R2,R3 ;R5 = (dest height).(dest width)
ADD R1,R1,R3,LSL #2
SUB R1,R1,#16 ;R1 -> last 4-pixels of 1st row
MOV R7,R3 ;source row counter
01
MOV R6,R2 ;source column counter
02
LDR R11,[R0],R2,LSL #2 ;load next 4 pixels...
LDR R10,[R0],R2,LSL #2
LDR R9,[R0],R2,LSL #2
LDR R8,[R0],R2,LSL #2 ;...columnwise from source
STMIA R1,{R8-R11} ;store them rowwise in dest.
SUB R0,R0,R2,LSL #4 ;reset R0
ADD R0,R0,#4 ;move to next source column
ADD R1,R1,R3,LSL #2 ;move to next dest row down
SUBS R6,R6,#1
BNE %BT02 ;till columns done
ADD R0,R0,R2,LSL #3
ADD R0,R0,R2,LSL #2 ;move R0 to next set of 4 source rows
SUB R1,R1,R5,LSL #2
SUB R1,R1,#16 ;move R1 to next set of 4 pixels, top row
SUBS R7,R7,#4 ;4 more source rows done
BNE %BT01
Pull "R0-R11,PC",,^
;
;fast copysprite_withrotate, 8 bpp case, 90 degrees
;
copysprite_withrotate_8bpp90 ROUT
Push "R0-R12,LR"
Debug PageBoxMem,"copysprite_withrotate_8bpp90"
MOV R2,R0
BL get_sprite_address
MOV R0,R2
MOV R2,R1
BL get_sprite_address
MOV R1,R2
LDR R2, [R1, #spHeight]
ADD R2,R2,#1 ;dest height, or source width
LDR R3, [R1, #spWidth]
ADD R3,R3,#1
MOV R3,R3,LSL #2 ;dest width, or source height
LDR R4, [R0, #spImage]
ADD R0,R0,R4 ;R0 -> 1st source pixel
LDR R4, [R1, #spImage]
ADD R1,R1,R4 ;R1 -> 1st dest pixel
ADD R12,R2,#3
BIC R12,R12,#3 ;R12:=source width, word aligned
MUL R5,R2,R3 ;R5 = (dest height).(dest width)
ADD R1,R1,R5
SUB R1,R1,R3 ;R1 -> 1st dest pixel of last row
MOV R7,R3 ;source row counter
01
MOV R6,R2 ;source column counter
02
LDRB R8,[R0],R12 ;load next 4 pixels...
LDRB R9,[R0],R12
LDRB R10,[R0],R12
LDRB R11,[R0],R12 ;...columnwise from source
ORR R8,R8,R9,LSL #8
ORR R8,R8,R10,LSL #16
ORR R8,R8,R11,LSL #24
STR R8,[R1] ;store them rowwise in dest.
SUB R0,R0,R12,LSL #2 ;reset R0
ADD R0,R0,#1 ;move to next source column
SUB R1,R1,R3 ;move to next dest row up
SUBS R6,R6,#1
BNE %BT02 ;till columns done
ADD R0,R0,R12,LSL #1
ADD R0,R0,R12 ;move R0 to next set of 4 source rows
ADD R1,R1,R5
ADD R1,R1,#4 ;move R1 to next set of 4 pixels, bottom row
SUBS R7,R7,#4 ;4 more source rows done
BNE %BT01
Pull "R0-R12,PC",,^
;
;fast copysprite_withrotate, 8 bpp case, 270 degrees (implicit flips)
;
copysprite_withrotate_8bpp270 ROUT
Push "R0-R12,LR"
Debug PageBoxMem,"copysprite_withrotate_8bpp270"
MOV R2,R0
BL get_sprite_address
MOV R0,R2
MOV R2,R1
BL get_sprite_address
MOV R1,R2
LDR R2, [R1, #spHeight]
ADD R2,R2,#1 ;dest height, or source width
LDR R3, [R1, #spWidth]
ADD R3,R3,#1
MOV R3,R3,LSL #2 ;dest width, or source height
LDR R4, [R0, #spImage]
ADD R0,R0,R4 ;R0 -> 1st source pixel
LDR R4, [R1, #spImage]
ADD R1,R1,R4 ;R1 -> 1st dest pixel
ADD R12,R2,#3
BIC R12,R12,#3 ;R12:=source width, word aligned
MUL R5,R2,R3 ;R5 = (dest height).(dest width)
ADD R1,R1,R3
SUB R1,R1,#4 ;R1 -> last 4-pixels of 1st row
MOV R7,R3 ;source row counter
01
MOV R6,R2 ;source column counter
02
LDRB R11,[R0],R12 ;load next 4 pixels...
LDRB R10,[R0],R12
LDRB R9,[R0],R12
LDRB R8,[R0],R12 ;...columnwise from source
ORR R8,R8,R9,LSL #8
ORR R8,R8,R10,LSL #16
ORR R8,R8,R11,LSL #24
STR R8,[R1] ;store them rowwise in dest.
SUB R0,R0,R12,LSL #2 ;reset R0
ADD R0,R0,#1 ;move to next source column
ADD R1,R1,R3 ;move to next dest row down
SUBS R6,R6,#1
BNE %BT02 ;till columns done
ADD R0,R0,R12,LSL #1
ADD R0,R0,R12 ;move R0 to next set of 4 source rows
SUB R1,R1,R5
SUB R1,R1,#4 ;move R1 to next set of 4 pixels, top row
SUBS R7,R7,#4 ;4 more source rows done
BNE %BT01
Pull "R0-R12,PC",,^
; ******************************************************************
......
......@@ -203,7 +203,7 @@ sprite_put_altentry
STR R4,job_spritescale+20 ; ,Y0
ADR R6,job_spritescale ; -> new sprite scaling table
ADRL R6,job_spritescale ; -> new sprite scaling table
CMP R7,#0 ; has a translation table been specified?
BGT %FT01 ; yes, so no need to generate one
......
......@@ -37,11 +37,13 @@ configure_init
ADR LR,size_globalvalues
STMIA LR,{R0-R5}
; Initialise to not adding CTRL-D's to the ends of jobs, and to not doing auto-accent generation
; Initialise to not adding CTRL-D's to the ends of jobs, to not doing auto-accent generation,
; and to not Level2
MOV r14, #0
STRB r14, globalusectrld
STRB r14, globalaccents
STRB r14, globallevel2
; Initialise to inteligent prologue generation
......@@ -204,6 +206,8 @@ configure_setprinter ROUT
; Entry: R0: bit 0 set if CTRL-D is to be added to the end of the output.
; R0: bit 1 set if a verbose prologue is required.
; R0: bit 2 set if auto-accent generation is required
; R0: bit 3-7 define target 'level'
; currently, driver just checks bit 3; set if target is Level 2 (else Level 1)
; Exit: All registers preserved.
configure_setdriver ENTRY "r1"
......@@ -222,6 +226,12 @@ configure_setdriver ENTRY "r1"
MOVEQ R1,#0
MOVNE R1,#-1
STRB R1,globalaccents
TST R0,#&8
MOVEQ R1,#0
MOVNE R1,#-1
STRB R1,globallevel2
EXIT
configure_vetinfo
......
......@@ -56,7 +56,7 @@ spritelog2bpp EQU globaltempws+4 ;1 word, overlaid
ASSERT ?globaltempws >= 5*4+1
]
; The use of this temporary workspace during sprite plotting.
; The use of this temporary workspace during JPEG plotting.
jpeg_buffer_sprite EQU globaltempws ; 1 word
jpeg_buffersp_save EQU globaltempws+4 ; 4 words
......@@ -98,8 +98,19 @@ globalverbose # 1
globalaccents # 1
; whether Level2 requested
globallevel2 # 1
# (-:INDEX:@):AND:3 ;Re-align to word boundary
;ASCII85 encoding workspace (Level 2)
a85pending # 4
a85Npending # 1
a85Ncolumns # 1
bputNbuff # 1
bputbuff # 0 ;shared with a85linebuffer
a85linebuffer # 93 ;enough for at least 85 chars + "~>" + linefeed
# (-:INDEX:@):AND:3 ;Re-align to word boundary
[ Medusa
......
......@@ -60,7 +60,6 @@ jpeg_plotscaled
]
BVS jpeg_plotscaled_return
BL jpeg_translatebyR1R2
BL jpeg_scaling
; get info on JPEG
Push "R0-R4" ; don't care about R5
......@@ -76,6 +75,11 @@ jpeg_plotscaled
AND R7, R0, #1 ; R7 bit 0 = JPEG-is-grey flag (1/0 for grey/colour)
Pull "R0-R4"
Push "R4"
MOV R4,R6 ; height in pixels
BL jpeg_scaling
Pull "R4"
LDR LR, info_features
TST LR, #1 ; is output to monochrome printer?
ORREQ R7, R7, #2 ; if yes, set printer-is-grey flag in R7 (bit 1)
......@@ -91,6 +95,14 @@ jpeg_plotscaled
; R1,R2,R3,R8 = scratch
;
jpeg_do_output
LDRB R8,joblevel2
CMP R8,#0
BEQ jdo_notL2
BL jpeg_do_outputL2
BVS jpeg_plotscaled_return
B jpeg_do_output_done
jdo_notL2
BL jpeg_output_to_buffersprite
BVS jpeg_plotscaled_return
......@@ -104,11 +116,11 @@ jpeg_do_output
CMP R7, #0
BEQ %FT01
Debug JPEG, " - printer and/or jpeg is grey (use image operator)"
PrLnIm "S8" ; image operator
PrLnIm "J8" ; image operator
B %FT02
01
Debug JPEG, " - printer and jpeg are colour (use colorimage operator)"
PrLnIm "S32" ; colorimage operator
PrLnIm "J32" ; colorimage operator
02
MOV R8, R5 ; R8 = width
LDR R1, jpeg_buffer_sprite
......@@ -189,6 +201,7 @@ jpeg_psimage_outpix_done
SUBS R6, R6, #1 ; R6 = rows of image left
BNE jpeg_psimage_nextrow
jpeg_do_output_done
BL output_grestore ; done so grestore
BVS jpeg_plotscaled_return
......@@ -204,6 +217,28 @@ jpeg_plotscaled_return
Pull "PC"
;routine used for JPEG output in Level2 case
;hey, we can just dump the JPEG data via ASCII85 encoding (a LOT more compact)!
;entry as for jpeg_do_output fragment of jpeg_plotscaled
jpeg_do_outputL2
PrError jpdol2_return
Push "LR"
PrPair R5, R6 ; width, height
TST R7,#1
BEQ jpdol2_colourjp
PrLnIm "J8"
B jpdol2_dump
jpdol2_colourjp
PrLnIm "J32"
jpdol2_dump
BL ascii85_begin
MOV R1,R4
BL ascii85_block
BL ascii85_end
PrError
jpdol2_return
Pull "PC"
; ----- jpeg_translatebyR1R2 -----
;
......@@ -237,12 +272,15 @@ jpeg_translatebyR1R2_return
; adjust jpeg scaling for current eig factors, and set PS scaling matrix
;
; Entry:
; R3 = pointer to scling factors, or 0 for unit scale
; R3 = pointer to scaling factors, or 0 for unit scale
; R4 = JPEG height, in pixels
;
jpeg_scaling
Push "R0-R7,LR"
Push "R0-R8,LR"
PrError jpeg_scaling_return
MOV R8,R4
CMP R3, #0
LDMNEIA R3, {R4-R7}
MOVEQ R4, #1
......@@ -261,14 +299,13 @@ jpeg_scaling
PrPair R5, R7
PrLnIm "SS"
MOV R2, #1
MOV R2,R8
PrNumSp R2
PrLnIm "SM", FallThroughOnError
PrLnIm "JM", FallThroughOnError
PrError
jpeg_scaling_return
STRVS R0, [R13]
Pull "R0-R7,PC"
Pull "R0-R8,PC"
; ----- jpeg_output_to_buffersprite -----
......@@ -440,7 +477,10 @@ jpeg_plottransformed
PrLnIm "PAR" ; fit into parallogram command
RSB R6, R6, #0 ; un-negate height
PrLnIm "1 1 1 1 SS 1 SM" ; unit scaling info
; unit scaling info
PrLnIm "1 1 1 1 SS"
PrNumSp R6
PrLnIm "JM"
MOV R4, R3 ; R4 = length of jpeg
B jpeg_do_output
......@@ -459,6 +499,7 @@ jpeg_trans_matrix
BL jpeg_trans_matrix_scaling
BVS jpeg_plottransformed_error_return
MOV R4, R3 ; R4 = length of jpeg
B jpeg_do_output
......@@ -470,7 +511,7 @@ jpeg_plottransformed_error_return
; for the transform to matrix case, scale appropriately:
; output: 180 <x dpi> 180 <y dpi> SS 1 SM
; output: 180 <x dpi> 180 <y dpi> SS <height> JM
; where dpi are dots-per-inch of JPEG, and 180,180 is user dpi for PostScript