Commit 711c4b83 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Fix new format *ScreenSave'd sprites containing lefthand wastage

Detail:
  s/vdu/vdugrafk - When saving a new format sprite that would otherwise contain lefthand wastage, copy each screen row to a temporary buffer before saving it out in order to allow the wastage to be removed
Admin:
  Tested on Pandaboard
  Fixes issue reported on forums:
  https://www.riscosopen.org/forum/forums/4/topics/2802


Version 5.35, 4.79.2.237. Tagged as 'Kernel-5_35-4_79_2_237'
parent 13e1fc5c
......@@ -13,11 +13,11 @@
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.35"
Module_Version SETA 535
Module_MinorVersion SETS "4.79.2.236"
Module_Date SETS "15 Sep 2014"
Module_ApplicationDate SETS "15-Sep-14"
Module_MinorVersion SETS "4.79.2.237"
Module_Date SETS "16 Sep 2014"
Module_ApplicationDate SETS "16-Sep-14"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.35 (4.79.2.236)"
Module_HelpVersion SETS "5.35 (15 Sep 2014) 4.79.2.236"
Module_FullVersion SETS "5.35 (4.79.2.237)"
Module_HelpVersion SETS "5.35 (16 Sep 2014) 4.79.2.237"
END
......@@ -5,19 +5,19 @@
*
*/
#define Module_MajorVersion_CMHG 5.35
#define Module_MinorVersion_CMHG 4.79.2.236
#define Module_Date_CMHG 15 Sep 2014
#define Module_MinorVersion_CMHG 4.79.2.237
#define Module_Date_CMHG 16 Sep 2014
#define Module_MajorVersion "5.35"
#define Module_Version 535
#define Module_MinorVersion "4.79.2.236"
#define Module_Date "15 Sep 2014"
#define Module_MinorVersion "4.79.2.237"
#define Module_Date "16 Sep 2014"
#define Module_ApplicationDate "15-Sep-14"
#define Module_ApplicationDate "16-Sep-14"
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.35 (4.79.2.236)"
#define Module_HelpVersion "5.35 (15 Sep 2014) 4.79.2.236"
#define Module_FullVersion "5.35 (4.79.2.237)"
#define Module_HelpVersion "5.35 (16 Sep 2014) 4.79.2.237"
#define Module_LibraryVersionInfo "5:35"
......@@ -79,6 +79,45 @@ ScreenSave ROUT
ADDVS sp, sp, #4 ; (if error, junk stacked filename ptr and exit)
BVS %FT35
; Out: ImageSize
; If this is a new format sprite, we must remove any lefthand wastage
LDR LR, [R2, #spMode]
MOV R10, #0
CMP LR, #256
LDRHS LR, [R2, #spLBit]
CMPHS LR, #1
BLO %FT05
; Wastage removal needed
; Recalculate the sprite width and header
MOV R11, LR ; R11 becomes shift amount
LDR LR, [R2, #spRBit]
SUB LR, LR, R11
LDR R3, [R2, #spWidth]
ADD LR, LR, R3, LSL #5 ; LR = Bit width of sprite, minus 1
MOV R4, LR, LSR #5 ; New spWidth
AND LR, LR, #31 ; New spRBit
STR R10, [R2, #spLBit]
STR R4, [R2, #spWidth]
STR LR, [R2, #spRBit]
; Shrink sprite size if we've lost a column of words
TEQ R3, R4
LDRNE LR, [R2, #spNext]
LDRNE R3, [R2, #spHeight]
SUBNE LR, LR, #4
SUBNE LR, LR, R3, LSL #2
STRNE LR, [R2, #spNext]
ORRNE R11, R11, #1<<31 ; Set top bit of R11 to act as a flag
; Allocate temp buffer large enough for a single scanline
MOV R3, R4, LSL #2
ADD R3, R3, #8 ; note +8 so that we can blindly write the last word, even if it's empty
MOV R0, #ModHandReason_Claim
Push "R2"
SWI XOS_Module
MOVVC R10, R2
Pull "R2"
ADDVS sp, sp, #4
BVS %FT30
05
; now add the sprite to the sprite area
LDR R3, [R2, #spNext] ; total size of new sprite
LDMIA R1, {R4,R5,R6,R7} ; saEnd,saNumber,saFirst,saFree
......@@ -137,6 +176,11 @@ ScreenSave ROUT
LDR R6, [WsPtr, #SGetHeight] ; height-1
LDR R7, [WsPtr, #LineLength]
TEQ R10, #0
RSBNE R9, R11, #32
BNE %FT50
SUBS R7, R7, R5 ; zero then can do as one lump
MLAEQ R5, R6, R5, R5 ; R5 = R5*(R6+1)
MOVEQ R6, #0 ; only one chunk to do
......@@ -155,6 +199,7 @@ ScreenSave ROUT
SUBS R6, R6, #1
BGE %BT10
15
MOV R0, #0 ; close file
SWI XOS_Find
BVS %FT30
......@@ -169,6 +214,7 @@ ScreenSave ROUT
|
SETV
]
MOV R10, #0
B %FT30
40 ; return point after an error
......@@ -177,11 +223,71 @@ ScreenSave ROUT
SWI XOS_Find
30 ; return point after an error
STRVS R0, [WsPtr, #RetnReg0] ; R0 ptr to message
MOVS R2, R10
MOVNE R0, #ModHandReason_Free
SWINE XOS_Module ; Release temp buffer
35
SWI XOS_RestoreCursors
Pull R14
RETURNVS
50
; R1 = file handle
; R2 = screen addr
; R5 = source width, bytes
; R6 = height-1
; R7 = source stride
; R9 = left shift amount
; R10 = temp buffer
; R11 = right shift amount
; if top bit is set, indicates destination is narrower than source
Push "R5,R7"
; Work from right to left to hurt my brain less
; LR used to hold the bits which were shifted out of the right of the
; previously written word (i.e. the word to the right of the current)
MOV LR, #0
ADD R2, R2, R5
ADD R10, R10, R5
55
LDR R0, [R2, #-4]!
ORR R3, LR, R0, LSR R11
MOV LR, R0, LSL R9
STR R3, [R10, #-4]!
SUBS R5, R5, #4
BEQ %FT65
60
CMP R5, #4*4
BLT %BT55
; Do 4 words at a time
LDMDB R2!, {R0, R3, R4, R7}
ORR R8, LR, R7, LSR R11
MOV LR, R7, LSL R9
ORR R7, LR, R4, LSR R11
MOV LR, R4, LSL R9
ORR R4, LR, R3, LSR R11
MOV LR, R3, LSL R9
ORR R3, LR, R0, LSR R11
MOV LR, R0, LSL R9
STMDB R10!, {R3, R4, R7, R8}
SUBS R5, R5, #4*4
BNE %BT60
65
Pull "R5,R7"
MOV R8, R2
MOV R2, R10
SUB R3, R5, R11, LSR #29 ; Work out actual row length
MOV R0, #2
SWI XOS_GBPB
BVS %BT40
ADD R2, R8, R7
SUBS R6, R6, #1
BGE %BT50
MOV R2, R10
MOV R0, #ModHandReason_Free
SWI XOS_Module
B %BT15
ScrSavSpriteName
= "screendump", 0
ALIGN
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment