Commit 06079048 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Fix screen redirection when in teletext modes. Fix *ScreenLoad buffer overflow.

Detail:
  s/vdu/vdugrafl, s/vdu/vduttx - Adjust initialisation & shutdown of TTX workspace to fix workspace being erroneously freed/reinitialised when redirecting output to a sprite
  s/vdu/vdugrafk - If ScreenLoad needs to load one row at a time (e.g. when graphics window width != sprite width), allocate a block from the RMA instead of assuming that ScrLoaBuffer is large enough
  hdr/KernelWS - Get rid of ScrLoaBuffer, and shrink LargeCommon to a suitable size. Frees about 2K of VDU workspace.
  s/GetAll - Move Hdr:Sprite earlier in list of GETs
Admin:
  Tested on Raspberry Pi


Version 5.75. Tagged as 'Kernel-5_75'
parent 89fa2c01
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.74"
Module_Version SETA 574
Module_MajorVersion SETS "5.75"
Module_Version SETA 575
Module_MinorVersion SETS ""
Module_Date SETS "15 Dec 2016"
Module_ApplicationDate SETS "15-Dec-16"
Module_Date SETS "17 Dec 2016"
Module_ApplicationDate SETS "17-Dec-16"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.74"
Module_HelpVersion SETS "5.74 (15 Dec 2016)"
Module_FullVersion SETS "5.75"
Module_HelpVersion SETS "5.75 (17 Dec 2016)"
END
/* (5.74)
/* (5.75)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 5.74
#define Module_MajorVersion_CMHG 5.75
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 15 Dec 2016
#define Module_Date_CMHG 17 Dec 2016
#define Module_MajorVersion "5.74"
#define Module_Version 574
#define Module_MajorVersion "5.75"
#define Module_Version 575
#define Module_MinorVersion ""
#define Module_Date "15 Dec 2016"
#define Module_Date "17 Dec 2016"
#define Module_ApplicationDate "15-Dec-16"
#define Module_ApplicationDate "17-Dec-16"
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.74"
#define Module_HelpVersion "5.74 (15 Dec 2016)"
#define Module_LibraryVersionInfo "5:74"
#define Module_FullVersion "5.75"
#define Module_HelpVersion "5.75 (17 Dec 2016)"
#define Module_LibraryVersionInfo "5:75"
......@@ -949,16 +949,17 @@ TTXSoftFonts * TextExpand + 2*1024 ; Soft fonts in teletext mode
]
AlignSpace 64 ; Align workspace to 64 bytes
; Teletext map and copy/move buffer are overlaid
; Some infrequently used buffers which can be overlaid
OldTTXMapSize * 41*25*4 ; (&1004 bytes)
LargeCommon # OldTTXMapSize ; the largest area
LargeCommon # SpriteAreaCBsize + SpriteCBsize + MaxSpritePaletteSize ; the largest area
ScrLoaSpriteCB * LargeCommon ; (size = SpriteCBsize + MaxSpritePaletteSize)
ScrLoaBuffer * LargeCommon ; (size = one pixel row)
ASSERT ?LargeCommon >= SpriteCBsize + MaxSpritePaletteSize
ScrSavCommon * LargeCommon ; (size = SpriteAreaCBsize + SpriteCBsize
; + MaxSpritePaletteSize)
ASSERT ?LargeCommon >= SpriteAreaCBsize + SpriteCBsize + MaxSpritePaletteSize
TempModeSelector * LargeCommon ; (size = ModeSelector_MaxSize)
ASSERT ?LargeCommon >= ModeSelector_MaxSize
FldQueueSize * ScratchSpaceSize
FldQueueStart * ScratchSpace
......
......@@ -37,6 +37,7 @@
GET Hdr:CMOS
GET Hdr:Heap
GET Hdr:Sprite
GET Hdr:PublicWS
GET Hdr:KernelWS
GET Hdr:HALEntries
......@@ -47,7 +48,6 @@
GET Hdr:HighFSI
GET Hdr:NewErrors
GET Hdr:Proc
GET Hdr:Sprite
GET Hdr:KeyWS
GET Hdr:RS423
GET Hdr:ModHand
......
......@@ -425,21 +425,24 @@ ScreenLoad ROUT
MOV R4, R4, LSL #2
STR R4, [WsPtr, #ScrLoaFilOfst] ; file ptr offset
LDR R4, [WsPtr, #SPltColCnt]
ADD R4, R4, #2
MOV R4, R4, LSL #2
STR R4, [WsPtr, #ScrLoaBytes]
; Allocate a temp RMA block which we can load individual rows into
LDR R3, [WsPtr, #SPltColCnt]
ADD R3, R3, #2
MOV R3, R3, LSL #2
STR R3, [WsPtr, #ScrLoaBytes]
ADD R4, WsPtr, #ScrLoaBuffer
STR R4, [WsPtr, #SPltMemAdr]
STR R4, [WsPtr, #ScrLoaBufAdr]
MOV R0, #ModHandReason_Claim
SWI XOS_Module
BVS %FT70
STR R2, [WsPtr, #SPltMemAdr]
STR R2, [WsPtr, #ScrLoaBufAdr]
10 ; read row from file
ADD R1, WsPtr, #ScrLoaHandle
LDMIA R1, {R1,R2,R3,R4} ; Handle,BufAdr,Bytes,FilPtr
MOV R0, #3
SWI XOS_GBPB
BVS %FT70
BVS %FT57
ADD R0, WsPtr, #SPltScrAdr
LDMIA R0, {R0-R1,R5-R7} ; R0 ,R1 , R5 ,R6 ,R7
......@@ -527,6 +530,10 @@ ScreenLoad ROUT
ADD R4, R4, R5
STR R4, [WsPtr, #ScrLoaFilPtr]
BGE %BT10 ; plot next scanline
LDR R2, [WsPtr, #ScrLoaBufAdr]
MOV R0, #ModHandReason_Free
SWI XOS_Module
52
MOV R0, #0 ; close file
SWI XOS_Find
......@@ -536,6 +543,13 @@ ScreenLoad ROUT
Pull R14
RETURNVC
57
STR R0, [WsPtr, #RetnReg0]
LDR R2, [WsPtr, #ScrLoaBufAdr]
MOV R0, #ModHandReason_Free
SWI XOS_Module
B %FT75
60
ADRL R0,SpriteErr_NotGraphics
[ International
......
......@@ -426,9 +426,6 @@ SwitchOutputToMask ROUT
STR R0, [WsPtr, #GCharSpaceX] ; and with 8x8 spacing
STR R0, [WsPtr, #GCharSpaceY]
; Free any old teletext workspace
BL TeletextFinalise
LDR R1, [WsPtr, #ModeFlags]
LDR R0, [WsPtr, #CursorFlags]
......@@ -437,7 +434,15 @@ SwitchOutputToMask ROUT
TST R1, #ModeFlag_Teletext ; is it teletext ?
ORRNE R0, R0, #TeletextMode ; yes, then set bit
STR R0, [WsPtr, #CursorFlags]
BLNE TeletextInit ; initialise TTX if appropriate
ADRNE LR, %FT85
BNE TeletextInit ; (re-)initialise TTX if appropriate
; Not teletext mode. If we're switching output to screen, then we might
; be in the middle of a mode change from TTX to regular, so free any
; old TTX workspace.
LDR R2, [WsPtr, #VduSprite]
TEQ R2, #0
BLEQ TeletextFinalise
85
BL InitCursor ; initialise cursor after
; cursorflags
......
......@@ -136,6 +136,14 @@ TeletextAlloc ROUT
TeletextInit ROUT
Entry
; Claim the workspace that was previously allocated by TeletextAlloc
LDR R2, [WsPtr, #TTXNewWorkspace]
TEQ R2, #0
BEQ %FT05 ; If there's no pending workspace pointer then VDU output is switching from sprite back to screen and we should skip most of this
BL TeletextFinalise ; Ensure old workspace is freed
MOV R0, #0
STR R0, [WsPtr, #TTXNewWorkspace]
; Calculate offsets to the different components
; NOTE: TTXFastCLS relies on TTXLineStarts directly following TTXMap
LDR R4, [WsPtr, #ScrRCol]
......@@ -146,11 +154,6 @@ TeletextInit ROUT
MOV R6, R6, LSL #2 ; TTXMap size, TTXLineStarts offset
ADD R7, R6, R5, LSL #2 ; TTXMap+TTXLineStarts size, TTXDoubleCounts offset
; Claim the workspace that was previously allocated by TeletextAlloc
LDR R2, [WsPtr, #TTXNewWorkspace]
MOV R0, #0
STR R0, [WsPtr, #TTXNewWorkspace]
; Fill in the pointers
STR R2, [WsPtr, #TTXMapPtr]
ADD R6, R2, R6
......@@ -167,6 +170,7 @@ TeletextInit ROUT
TEQ R6, R7
BNE %BT01
05
MOV R0, #1 ; set to flash immediately
STR R0, [WsPtr, #TeletextCount]
......@@ -243,7 +247,7 @@ TeletextInit ROUT
;
TeletextFinalise ROUT
Entry
Entry "r0-r2"
; TTXMapPtr is the pointer to the allocated block
LDR R2, [WsPtr, #TTXMapPtr]
CMP R2, #0
......
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