Commit 92e90b01 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Add support for custom teletext modes

Detail:
  This set of changes:
  * Adds support for the T, TX and TY mode string elements (as per RISCOS Ltd)
  * Adds support for entering arbitrary-resolution teletext modes by using mode selector blocks with the Teletext mode flag set
  * ScrRCol and ScrBRow mode variables can be provided in the mode selector in order to restrict the number of text rows/columns in teletext modes (as per RISCOS Ltd)
  * If the rows / columns are restricted in this manner then the text window will be centered on the screen, to try and avoid things looking too ugly (no variable text scaling implemented)
  * For HiResTTX, all colour depths >= 4bpp are now supported by teletext. This essentially makes the TTX256 switch obsolete.
  * If the "native" mode 7 is unavailable then the kernel will try a series of fallback resolutions & colour depths in an effort to find a combination that works
  Known bugs/issues:
  * Teletext column count has a max limit of 255 due to TTXDoubleCounts being a byte array
  * If there's a border around the text window, the border will not be refreshed when changing transparency modes using a VDU 23,18,0 sequence
  * ScreenLoad looks like it can overflow the LargeCommon buffer (no buffer size check) - needs fixing before LargeCommon can be safely shrunk below (Old)TTXMapSize
  File changes:
  - hdr/KernelWS - Make CharWidth non-conditional. Adjust handling of teletext workspace; it's now allocated from the system heap to allow it to cope with arbitrary screen sizes
  - s/vdu/vdu23 - Make CharWidth non-conditional
  - s/vdu/vducursoft - Make CursorTeletext cope with arbitrary colour depths, make CharWidth non-conditional, remove hard-coded teletext values
  - s/vdu/vdudriver - Deal with teletext workspace allocation during ModeChangeSub. Deal with selecting teletext modes (and validating colour depth) in GenerateModeSelectorVars.
  - s/vdu/vdugrafl - Make CharWidth non-conditional. Calculate offset required for text window centering.
  - s/vdu/vdumodes - Remove TTX256
  - s/vdu/vduswis - Try other teletext modes if native mode 7 not available. Extend OS_ScreenMode reason codes to cope with teletext mode strings.
  - s/vdu/vduttx - Update to use dynamic workspace. Replace various hardcoded values with variable lookups. Update character plotting + colour/palette selection to work with true-colour modes if HiResTTX.
  - s/vdu/vduwrch - Move some useful code into a subroutine. Update FastCLS to cope with true-colour teletext. Update AddressR0R1 to cope with text window centering offset. Make CharWidth non-conditional.
Admin:
  Tested on Raspberry Pi, BB-xM
  VDU 23,18,0 in 256-colour teletext now works correctly (previously 64-colour mode was in use, causing palette update to be ruined by VIDC1-mangling)


Version 5.74. Tagged as 'Kernel-5_74'
parent 5cfe8f63
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.73"
Module_Version SETA 573
Module_MajorVersion SETS "5.74"
Module_Version SETA 574
Module_MinorVersion SETS ""
Module_Date SETS "13 Dec 2016"
Module_ApplicationDate SETS "13-Dec-16"
Module_Date SETS "15 Dec 2016"
Module_ApplicationDate SETS "15-Dec-16"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.73"
Module_HelpVersion SETS "5.73 (13 Dec 2016)"
Module_FullVersion SETS "5.74"
Module_HelpVersion SETS "5.74 (15 Dec 2016)"
END
/* (5.73)
/* (5.74)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 5.73
#define Module_MajorVersion_CMHG 5.74
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 13 Dec 2016
#define Module_Date_CMHG 15 Dec 2016
#define Module_MajorVersion "5.73"
#define Module_Version 573
#define Module_MajorVersion "5.74"
#define Module_Version 574
#define Module_MinorVersion ""
#define Module_Date "13 Dec 2016"
#define Module_Date "15 Dec 2016"
#define Module_ApplicationDate "13-Dec-16"
#define Module_ApplicationDate "15-Dec-16"
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.73"
#define Module_HelpVersion "5.73 (13 Dec 2016)"
#define Module_LibraryVersionInfo "5:73"
#define Module_FullVersion "5.74"
#define Module_HelpVersion "5.74 (15 Dec 2016)"
#define Module_LibraryVersionInfo "5:74"
......@@ -854,10 +854,14 @@ TeletextCount # 4 ; Number of vsyncs till next teletext flash
WrchNbit # 4 ; Pointer to char code for current mode
[ HiResTTX
CharWidth # 4 ; Width of a character in bytes (same as BytesPerChar except
; in MODE 7, where characters are 16 pixels wide)
]
; in HiResTTX MODE 7, where characters are 16 pixels wide)
; This could also be defined as (TCharSizeX<<Log2BPC)/8
TextOffset # 4 ; Byte offset into screen bank at which text window starts.
; Keeps the text window centered when e.g. when mode 7 picks
; a higher resolution mode than strictly necessary.
TTXFlags # 4 ; VDU 23,18 flags
TTXFlag_Suspend * 1:SHL:0
TTXFlag_Conceal * 1:SHL:1
......@@ -878,12 +882,12 @@ BeepBlock # 8 ; OSWORD block for VDU 7
ScreenMemoryClaimed # 1 ; NZ => memory has been claimed or is unusable
ExternalFramestore # 1 ; NZ => using external framestore rather than screen memory DA
[ :DEF: ShowWS
! 0,"16 ":CC::STR:@
]
AlignSpace 16 ; Align workspace to 16 bytes
AlignSpace
TTXDoubleCounts # 25 ; Number of double height chars on each line
TTXDoubleCountsPtr # 4 ; Number of double height chars on each line
TTXMapPtr # 4
TTXLineStartsPtr # 4
TTXNewWorkspace # 4 ; Temp variable to allow mode changes to fail gracefully if TTX workspace can't be allocated
[ :DEF: ShowWS
! 0,"16 ":CC::STR:@
......@@ -947,14 +951,14 @@ TTXSoftFonts * TextExpand + 2*1024 ; Soft fonts in teletext mode
; Teletext map and copy/move buffer are overlaid
TTXMapSize * 41*25*4 ; (&1004 bytes)
LargeCommon # TTXMapSize ; the largest area
TTXMap * LargeCommon
OldTTXMapSize * 41*25*4 ; (&1004 bytes)
LargeCommon # OldTTXMapSize ; the largest area
ScrLoaSpriteCB * LargeCommon ; (size = SpriteCBsize + MaxSpritePaletteSize)
ScrLoaBuffer * LargeCommon ; (size = one pixel row)
ScrSavCommon * LargeCommon ; (size = SpriteAreaCBsize + SpriteCBsize
; + MaxSpritePaletteSize)
TempModeSelector * LargeCommon ; (size = ModeSelector_MaxSize)
FldQueueSize * ScratchSpaceSize
FldQueueStart * ScratchSpace
......
......@@ -732,11 +732,7 @@ MoveRight
CMP R0, R4
MOVCS PC, R14
LDR R2, [R11, #CursorAddr-CursorX]
[ HiResTTX
LDR R3, [WsPtr, #CharWidth]
|
LDR R3, [WsPtr, #BytesPerChar]
]
ADD R0, R0, #1
ADD R2, R2, R3
STR R0, [R11, #CursorX-CursorX]
......@@ -751,11 +747,7 @@ MoveLeft
CMP R4, R0
MOVCS PC, R14
LDR R2, [R11, #CursorAddr-CursorX]
[ HiResTTX
LDR R3, [WsPtr, #CharWidth]
|
LDR R3, [WsPtr, #BytesPerChar]
]
SUB R0, R0, #1
SUB R2, R2, R3
STR R0, [R11, #CursorX-CursorX]
......@@ -827,11 +819,7 @@ CHT
LDR R0, [WsPtr, #CursorX]
LDR R2, [WsPtr, #CursorAddr]
[ HiResTTX
LDR R3, [WsPtr, #CharWidth]
|
LDR R3, [WsPtr, #BytesPerChar]
]
LDR R4, [WsPtr, #TWRCol]
ADD R0, R0, #1
......
......@@ -174,32 +174,26 @@ Cursor2loop
MOV PC, R14
CursorTeletext
[ TTX256
ASSERT HiResTTX
Push "R0, R1, R14"
ADD R0, R0, #320*1024 ; go to other screen
ADD R1, R1, #320*1024
BL Cursor16bit
Pull "R0, R1, R14"
B Cursor16bit
|
Push "R0, R1, R3, R5, R14"
LDR R14, [WsPtr, #ScreenSize]
ADD R0, R0, R14, LSR #1 ; go to other screen
ADD R1, R1, R14, LSR #1
LDR R5, [WsPtr, #Log2BPC]
ADRL R14, CursorNbitTab
[ HiResTTX
Push "R0, R1, R14"
ADD R0, R0, #160*1024 ; go to other screen
ADD R1, R1, #160*1024
BL Cursor8bit
Pull "R0, R1, R14"
B Cursor8bit
ADD R5, R5, #1
]
LDR R5, [R14, R5, LSL #2]
ADD R5, R5, R14
[ NoARMv5
MOV R14, PC
MOV PC, R5
|
Push "R0, R1, R14"
ADD R0, R0, #40*1024 ; go to other screen
ADD R1, R1, #40*1024
BL Cursor4bit
Pull "R0, R1, R14"
; and drop thru to ...
BLX R5
]
]
MOV R8, R5
Pull "R0, R1, R3, R5, R14"
MOV PC, R8
Cursor4bit
LDR R8, [R0, R2]!
......@@ -262,6 +256,39 @@ Cursor32loop
BNE Cursor32loop
MOV PC, R14
Cursor64bit
ADD R0, R0, R2
SUB R3, R3, #64
Cursor64loop
LDMIA R0, {R8-R11}
EOR R8, R8, R4
EOR R9, R9, R4
EOR R10, R10, R4
EOR R11, R11, R4
STMIA R0!, {R8-R11}
LDMIA R0, {R8-R11}
EOR R8, R8, R4
EOR R9, R9, R4
EOR R10, R10, R4
EOR R11, R11, R4
STMIA R0!, {R8-R11}
LDMIA R0, {R8-R11}
EOR R8, R8, R4
EOR R9, R9, R4
EOR R10, R10, R4
EOR R11, R11, R4
STMIA R0!, {R8-R11}
LDMIA R0, {R8-R11}
EOR R8, R8, R4
EOR R9, R9, R4
EOR R10, R10, R4
EOR R11, R11, R4
STMIA R0!, {R8-R11}
ADD R0, R0, R3
TEQ R0, R1
BNE Cursor64loop
MOV PC, R14
; *****************************************************************************
;
; PostWrchCursor - Put back cursors after Wrch
......@@ -375,16 +402,8 @@ TeletextFlashTest ROUT
BNE %FT20 ; count not expired
LDR R1, [WsPtr, #TeletextOffset]
[ TTX256
ASSERT HiResTTX
EORS R1, R1, #320*1024 ; switch to other flash bank
|
[ HiResTTX
EORS R1, R1, #160*1024 ; switch to other flash bank
|
EORS R1, R1, #40*1024 ; switch to other flash bank
]
]
LDR R0, [WsPtr, #ScreenSize]
EORS R1, R1, R0, LSR #1 ; switch to other flash bank
STR R1, [WsPtr, #TeletextOffset]
MOVEQ R3, #OnFlashTime
MOVNE R3, #OffFlashTime
......@@ -657,11 +676,7 @@ AddressCursors
InputCursorLeft
LDR R0, [WsPtr, #InputCursorX]
LDR R2, [WsPtr, #InputCursorAddr]
[ HiResTTX
LDR R3, [WsPtr, #CharWidth]
|
LDR R3, [WsPtr, #BytesPerChar]
]
LDR R4, [WsPtr, #TWLCol]
SUB R0, R0, #1
......@@ -678,11 +693,7 @@ InputCursorLeft
InputCursorRight
LDR R0, [WsPtr, #InputCursorX]
LDR R2, [WsPtr, #InputCursorAddr]
[ HiResTTX
LDR R3, [WsPtr, #CharWidth]
|
LDR R3, [WsPtr, #BytesPerChar]
]
LDR R4, [WsPtr, #TWRCol]
ADD R0, R0, #1
......@@ -716,4 +727,6 @@ ICHTExit
Pull R14
B AddressInputCursor
LTORG
END
......@@ -584,6 +584,7 @@ CursorNbitTab
& Cursor8bit-CursorNbitTab
& Cursor16bit-CursorNbitTab
& Cursor32bit-CursorNbitTab
& Cursor64bit-CursorNbitTab
; table of susbstitute mode numbers to cater for hardware that might
; not support all of 1,2,4,8 bpp (bits per pixel) modes
......@@ -607,11 +608,7 @@ ModePromoTable
DCB 1, 1 ; 4
DCB 2, 2 ; 5
DCB 1, 13 ; 6
[ TTX256
DCB 8, &FF ; 7
|
DCB 4, 13 ; 7
]
DCB 2, 12 ; 8
DCB 4, 13 ; 9
DCB 8, &FF ; 10
......@@ -690,6 +687,24 @@ VduBadExit ; jumped to if an error in VDU code
Pull PC
ModeChangeSub ROUT
; Wrap the bulk of ModeChangeSub in some code that will free any new
; TTX workspace pointer if the mode change fails (or the pointer isn't
; claimed for any other reason)
Entry
MOV r0, #0
STR r0, [WsPtr, #TTXNewWorkspace]
BL %FT01
LDR r2, [WsPtr, #TTXNewWorkspace]
TEQ r2, #0
EXIT EQ
MRS r3, CPSR
MOV r4, r0
BL FreeSysHeapNode
MSR CPSR_c, r3
MOV r0, r4
EXIT
01
Push lr
;If its a common mode number (0..49) consider a possible mode number
......@@ -763,6 +778,13 @@ mchsub_3
BL PushModeInfo
BVS %FT07 ; [probably duff mode selector]
; Allocate new teletext workspace if required
LDR R0, [R13, #wkModeFlags]
TST R0, #ModeFlag_Teletext
MOVNE R0, R13
BLNE TeletextAlloc
BVS %FT07
LDR R11, [R13, #wkScreenSize] ; get screen size for this mode
LDR R9, [WsPtr, #TotalScreenSize] ; maximum allowed amount
......@@ -1160,7 +1182,7 @@ IssueModeService Entry "r2,r3"
; onto stack, having generated it by possibly issuing service
;
; in: R10 = mode to try for
; R11 = mode to use if service not claimed
; R11 = mode to use if service not claimed (and R10 is mode number)
; R10 and R11 should have bit 7 CLEAR (if mode numbers)
;
; out: If r10 is an invalid mode selector or invalid new format sprite word then
......@@ -1440,6 +1462,64 @@ GenerateModeSelectorVars Entry "r0,r1,r3-r8,r10-r12"
ADD r4, r2, #ModeSelector_ModeVars ; now do pairs of mode variables
BL ProcessModeVarPairs
; Fixup teletext modes
LDR r0, [r9, #wkModeFlags]
TST r0, #ModeFlag_Teletext
BEQ %FT09
; Force the mode flags to be correct for our implementation
[ HiResTTX
ORR r0, r0, #ModeFlag_NonGraphic+ModeFlag_GapMode+ModeFlag_DoubleVertical
|
BIC r0, r0, #ModeFlag_DoubleVertical
ORR r0, r0, #ModeFlag_NonGraphic+ModeFlag_GapMode
]
STR r0, [r9, #wkModeFlags]
; Ensure colour depth is acceptable
LDR r0, [r9, #wkNColour]
CMP r0, #15
[ HiResTTX
ADRLOL r0, ErrorBlock_BadPixelDepth
BLO %FT90
CMP r0, #63
ADREQL r0, ErrorBlock_BadPixelDepth
BEQ %FT90
|
ADRNEL r0, ErrorBlock_BadPixelDepth
BNE %FT90
]
; Fixup PalIndex
CMP r0, #255
MOVLS r0, #4
STRLS r0, [r9, #wkPalIndex]
; Massage ScreenSize, needs to be large enough for two screen banks
LDR r0, [r9, #wkScreenSize]
MOV r0, r0, LSL #1
STR r0, [r9, #wkScreenSize]
; Clamp ScrRCol, ScrBRow
LDR r0, [r9, #wkScrRCol]
CMP r0, #254 ; TTXDoubleCounts is a byte array
MOVHI r0, #254
LDR r7, [r2, #ModeSelector_XRes]
MOV lr, #1
[ HiResTTX
RSB r7, lr, r7, LSR #4
|
RSB r7, lr, r7, LSR #3
]
CMP r0, r7
MOVHI r0, r7
STR r0, [r9, #wkScrRCol]
LDR r0, [r9, #wkScrBRow]
[ HiResTTX
DivRem r7, r5, #20, lr, norem
|
DivRem r7, r5, #10, lr, norem
]
CMP r0, r7
SUBHS r0, r7, #1
STR r0, [r9, #wkScrBRow]
09
CLRV
EXIT
......
......@@ -310,8 +310,8 @@ SwitchOutputToMask ROUT
[ HiResTTX
TST R6, #ModeFlag_Teletext ; in teletext mode
MOVNE R7, R7, LSL #1 ; characters are 16 pixels, not 8
STR R7, [WsPtr, #CharWidth]
]
STR R7, [WsPtr, #CharWidth]
TST R6, #ModeFlag_BBCGapMode ; is it a BBC gap mode ?
MOVNE R7, #&55 ; yes, then use colour 1
......@@ -319,9 +319,11 @@ SwitchOutputToMask ROUT
TEQ R0, #2 ; if (1<<2=4) bits per pixel
MOVEQ R7, #&77 ; then use colour 7 for cursor
MOVNE R7, #&FF ; else use colour 15
[ TTX256
TST R6, #ModeFlag_Teletext ; unless it's teletext
MOVNE R7, #&07 ; in which case still use colour 7
[ HiResTTX
TST R6, #ModeFlag_Teletext ; unless it's 256 colour teletext
BEQ %FT70
TEQ R0, #3
MOVEQ R7, #&07 ; in which case still use colour 7
]
70
ORR R7, R7, R7, LSL #8 ; fill out to whole word
......@@ -348,6 +350,35 @@ SwitchOutputToMask ROUT
MUL R7, R8, R7
STR R7, [WsPtr, #RowLength]
ANDS R14, R6, #ModeFlag_Teletext
BEQ %FT71
; Calculate TextOffset necessary to center the text window
; First, Y offset
LDR R7, [WsPtr, #RowMult]
LDR R14, [WsPtr, #ScrBRow]
ADD R14, R14, #1
MUL R14, R7, R14 ; text window height, pixels
LDR R7, [WsPtr, #YWindLimit]
ADD R7, R7, #1
SUB R14, R7, R14 ; spare rows on screen
MOV R14, R14, LSR #1
MUL R14, R8, R14 ; byte offset to start at correct row
; Now, X offset
LDR R7, [WsPtr, #TCharSpaceX]
LDR R8, [WsPtr, #ScrRCol]
ADD R8, R8, #1
MUL R8, R7, R8 ; text window width, pixels
LDR R7, [WsPtr, #XWindLimit]
ADD R7, R7, #1
SUB R8, R7, R8 ; spare columns on screen
MOV R8, R8, LSR #1
LDR R7, [WsPtr, #Log2BPP]
MOV R8, R8, LSL R7 ; spare bits on row
ADD R14, R14, R8, LSR #3 ; combine with vertical offset
BIC R14, R14, #3 ; TTX assumes word alignment
71
STR R14, [WsPtr, #TextOffset]
; finished doing other variables
SWI XColourTrans_InvalidateCache ; let ColourTrans know we've changed mode
......@@ -395,6 +426,9 @@ 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]
......@@ -608,19 +642,11 @@ CompressionTable
CompressionTableEnd
MainSize * CompressedSize + SavedDataOffset
; N.B. teletext state is not saved
ASSERT MainSize <= SaveAreaSize
! 0, "Space free in VDU save area = ":CC::STR:(SaveAreaSize-MainSize)
[ {FALSE} ; don't allow teletext mode for now
TTXCompressionTable
CompStart
CompMult TTXDoubleCounts, 28 ; (25 rounded up to a word)
CompMult TTXMap, 41*25*4
CompEnd
TTXCompressionTableEnd
TTXSize * CompressedSize
]
; *****************************************************************************
;
......
......@@ -831,16 +831,11 @@ VLM_3 VIDC_List 1, 72, 62, 88, 640, 88, 74, 3,16,20,250,20, 3,16000,0
VLM_4 VIDC_List 0, 72, 62, 88, 640, 88, 74, 3,16,17,256,17, 3,16000,0 ; MODE 4
VLM_5 VIDC_List 1, 36, 30, 44, 320, 44, 38, 3,16,17,256,17, 3, 8000,0 ; MODE 5
VLM_6 VIDC_List 1, 36, 30, 44, 320, 44, 38, 3,16,20,250,20, 3, 8000,0 ; MODE 6
[ TTX256
ASSERT HiResTTX
VLM_7 VIDC_List 3, 56,112, 0, 640, 0, 88, 3,18, 6,500, 6, 1,24000,0 ; MODE 7
|
[ HiResTTX
VLM_7 VIDC_List 2, 56,112, 0, 640, 0, 88, 3,18, 6,500, 6, 1,24000,0 ; MODE 7
|
VLM_7 VIDC_List 2, 36, 30, 44, 320, 44, 38, 3,16,20,250,20, 3, 8000,0 ; MODE 7
]
]
VLM_8 VIDC_List 1, 72, 62, 88, 640, 88, 74, 3,16,17,256,17, 3,16000,0 ; MODE 8
VLM_9 VIDC_List 2, 36, 30, 44, 320, 44, 38, 3,16,17,256,17, 3, 8000,0 ; MODE 9
VLM_10 VIDC_List 3, 36, 30, 44, 320, 44, 38, 3,16,17,256,17, 3, 8000,0 ; MODE 10
......@@ -1094,16 +1089,11 @@ VW_3 VWSTAB 3, 40K,160, 639,249,5,1,2, 1, 79, 24,1,1,0,0,ModeFlag_NonGraphic
VW_4 VWSTAB 4, 20K, 80, 319,255,4,2,2, 1, 39, 31,1,0,0,4,0 ; MODE 4
VW_5 VWSTAB 5, 20K, 80, 159,255,4,3,2, 3, 19, 31,2,1,1,2,0 ; MODE 5
VW_6 VWSTAB 6, 20K, 80, 319,249,4,2,2, 1, 39, 24,1,1,0,0,ModeFlag_NonGraphic+ModeFlag_GapMode+ModeFlag_BBCGapMode ; MODE 6
[ TTX256
ASSERT HiResTTX
VW_7 VWSTAB 7,640K,640, 639,499,5,1,1,63, 39, 24,3,3,4,0,ModeFlag_NonGraphic+ModeFlag_GapMode+ModeFlag_Teletext+ModeFlag_DoubleVertical ; MODE 7
|
[ HiResTTX
VW_7 VWSTAB 7,320K,320, 639,499,5,1,1,15, 39, 24,2,2,4,0,ModeFlag_NonGraphic+ModeFlag_GapMode+ModeFlag_Teletext+ModeFlag_DoubleVertical ; MODE 7
|
VW_7 VWSTAB 7, 80K,160, 319,249,5,2,2,15, 39, 24,2,2,4,0,ModeFlag_NonGraphic+ModeFlag_GapMode+ModeFlag_Teletext ; MODE 7
]
]
VW_8 VWSTAB 8, 40K,160, 639,255,5,1,2, 3, 79, 31,1,1,1,2,0 ; MODE 8
VW_9 VWSTAB 9, 40K,160, 319,255,5,2,2,15, 39, 31,2,2,2,3,0 ; MODE 9
VW_10 VWSTAB 10, 80K,320, 159,255,6,3,2,63, 19, 31,4,3,3,5,0 ; MODE 10
......
......@@ -925,6 +925,77 @@ FindOKMode ROUT
; unknown monitor type, so offer service
10
; if monitor type 7 (file), and requesting mode 7, try some alternative teletext modes before asking for external help
TEQ r3, #7
TEQEQ r10, #7
BNE %FT19
Push "r0,r3"
; Build up a temporary mode selector (however, needs to be in a static buffer to allow return via OS_CheckModeValid)
ADD r10, WsPtr, #TempModeSelector
ADR r0, AltTTXModeProto
MOV r2, #AltTTXMode_Size
11
SUBS r2, r2, #4
LDR r3, [r0, r2]
STR r3, [r10, r2]
BNE %BT11
; For each resolution, try all the pixel formats supported by the driver
ADR r11, AltTTXModes
12
LDMIA r11!, {r3, r4}
CMP r3, #-1
BEQ %FT18
ASSERT ModeSelector_XRes = 4
ASSERT ModeSelector_YRes = 8
ASSERT ModeSelector_PixelDepth = 12
MOV r14, #2 ; Start at 4BPP and work up
STMIB r10, {r3, r4, r14}
13
LDR r4, [WsPtr, #CurrentGraphicsVDriver]
MOV r4, r4, LSL #24
ORR r4, r4, #GraphicsV_PixelFormats
BL CallGraphicsV
CMP r4, #0
BNE %FT18
; Look for pixel formats that match the current Log2BPP
CMP r1, #0
BEQ %FT18
14
ASSERT GVPixelFormat_NColour = 0
ASSERT GVPixelFormat_ModeFlags = 4
ASSERT GVPixelFormat_Log2BPP = 8
ASSERT GVPixelFormat_Size = 12
LDMIA r0!, {r2-r4}
LDR r14, [r10, #ModeSelector_PixelDepth]
CMP r4, r14
BNE %FT17
STR r2, [r10, #AltTTXMode_NColour]
ORR r3, r3, #ModeFlag_Teletext+ModeFlag_GapMode
STR r3, [r10, #AltTTXMode_Flags]
Push "r0"
BL PushModeInfo
ADDVC r13, r13, #PushedInfoSize
Pull "r0"
MOVVC r1, r10
Pull "r0,r3",VC
BVC %FT20
17
SUBS r1, r1, #1
BNE %BT14
; Try next BPP
LDR r14, [r10, #ModeSelector_PixelDepth]
ADD r14, r14, #1
CMP r14, #7
STRLO r14, [r10, #ModeSelector_PixelDepth]
BLO %BT13
; Try next resolution
B %BT12
18
Pull "r0,r3"
MOV r10, #7
19
MOV r2, r10
MOV r1, #Service_ModeTranslation
IssueService
......@@ -976,6 +1047,43 @@ SubstType4
SubstType8