Commit b9898460 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Add OS_NVMemory 6

Permits applications to query what value would be used in the event of a CMOS reset for a given configure value. Notably, the configure plugins will use this in favour of 'ResetCMOS'.
hdr/Options: retire the 'Select16BitSound' switch, add comment for ChecksumCMOS switch
hdr/KernelWS: DuffEntry and Nowhere moved here
Kernel.s: Unused OSMD removed, retire single use of SPIRQ in favour of r13_irq
Middle.s: Retire SPIRQ
NewReset.s: Trim out 300+ lines of CMOS reset defaults, call OS_NVMemory 6 instead
PMF/i2cutils.s: CMOS reset default code and table moved here with refactoring
Note, the previous code preserved YearCMOS during the zeroing, only to unconditionally write it later - so have removed it from the zeroing step.
Note, the locations 80-111 are now considered as system CMOS in the allocations hence are now wiped too (previously they got skipped as user CMOS during R-power-on).

Tested on OMAP3 ROM with delete-power-on and R-power-on variants, and a simple BASIC program to read locations 0-255 via OS_NVMemory.

Version 5.35, 4.79.2.180. Tagged as 'Kernel-5_35-4_79_2_180'
parent e91fc098
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
GBLS Module_ComponentPath GBLS Module_ComponentPath
Module_MajorVersion SETS "5.35" Module_MajorVersion SETS "5.35"
Module_Version SETA 535 Module_Version SETA 535
Module_MinorVersion SETS "4.79.2.179" Module_MinorVersion SETS "4.79.2.180"
Module_Date SETS "05 Dec 2012" Module_Date SETS "10 Jan 2013"
Module_ApplicationDate SETS "05-Dec-12" Module_ApplicationDate SETS "10-Jan-13"
Module_ComponentName SETS "Kernel" Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel" Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.35 (4.79.2.179)" Module_FullVersion SETS "5.35 (4.79.2.180)"
Module_HelpVersion SETS "5.35 (05 Dec 2012) 4.79.2.179" Module_HelpVersion SETS "5.35 (10 Jan 2013) 4.79.2.180"
END END
...@@ -5,19 +5,19 @@ ...@@ -5,19 +5,19 @@
* *
*/ */
#define Module_MajorVersion_CMHG 5.35 #define Module_MajorVersion_CMHG 5.35
#define Module_MinorVersion_CMHG 4.79.2.179 #define Module_MinorVersion_CMHG 4.79.2.180
#define Module_Date_CMHG 05 Dec 2012 #define Module_Date_CMHG 10 Jan 2013
#define Module_MajorVersion "5.35" #define Module_MajorVersion "5.35"
#define Module_Version 535 #define Module_Version 535
#define Module_MinorVersion "4.79.2.179" #define Module_MinorVersion "4.79.2.180"
#define Module_Date "05 Dec 2012" #define Module_Date "10 Jan 2013"
#define Module_ApplicationDate "05-Dec-12" #define Module_ApplicationDate "10-Jan-13"
#define Module_ComponentName "Kernel" #define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel" #define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.35 (4.79.2.179)" #define Module_FullVersion "5.35 (4.79.2.180)"
#define Module_HelpVersion "5.35 (05 Dec 2012) 4.79.2.179" #define Module_HelpVersion "5.35 (10 Jan 2013) 4.79.2.180"
#define Module_LibraryVersionInfo "5:35" #define Module_LibraryVersionInfo "5:35"
...@@ -265,6 +265,8 @@ DCacheCleanAddress * &FAF00000 ; eg. for StrongARM, 256k of space, up to FAF400 ...@@ -265,6 +265,8 @@ DCacheCleanAddress * &FAF00000 ; eg. for StrongARM, 256k of space, up to FAF400
KbuffsBaseAddress * &FAF40000 ; kernel buffers for long command lines, size KbuffsMaxSize KbuffsBaseAddress * &FAF40000 ; kernel buffers for long command lines, size KbuffsMaxSize
HALWorkspaceNCNB * &FAFE8000 ; 32K of uncacheable HAL workspace (if requested) HALWorkspaceNCNB * &FAFE8000 ; 32K of uncacheable HAL workspace (if requested)
CursorChunkAddress * &FAFF0000 CursorChunkAddress * &FAFF0000
DuffEntry * &FAFF8000 ; No page ever mapped in here (L2PT entry always 0), also, all non mapped pages
Nowhere * DuffEntry ; use this as their CAM entry. There is only one 'Nowhere' (synonym).
L2PT * &FB000000 L2PT * &FB000000
L1PT * &FB400000 L1PT * &FB400000
SysHeapChunkAddress * &FB404000 SysHeapChunkAddress * &FB404000
...@@ -289,6 +291,8 @@ SysHeapAddress * SysHeapChunkAddress+SVCStackSize ...@@ -289,6 +291,8 @@ SysHeapAddress * SysHeapChunkAddress+SVCStackSize
SysHeapMaxSize * &00200000-SVCStackSize SysHeapMaxSize * &00200000-SVCStackSize
CursorChunkAddress * &01F00000 ; Fixed size 32K CursorChunkAddress * &01F00000 ; Fixed size 32K
DuffEntry * &01F08000 ; No page ever mapped in here (L2PT entry always 0), also, all non mapped pages
Nowhere * DuffEntry ; use this as their CAM entry. There is only one 'Nowhere' (synonym).
ScreenEndAdr * &05000000 ; was &02000000 ScreenEndAdr * &05000000 ; was &02000000
ScreenMaxSize * 480*1024 ScreenMaxSize * 480*1024
......
...@@ -102,19 +102,9 @@ RISCPCBurstMode SETL {FALSE} ...@@ -102,19 +102,9 @@ RISCPCBurstMode SETL {FALSE}
GBLL DoInitialiseMode GBLL DoInitialiseMode
DoInitialiseMode SETL {TRUE} :LAND: Embedded_UI DoInitialiseMode SETL {TRUE} :LAND: Embedded_UI
[ STB
GBLL Select16BitSound ; STBs and pre-IOMD systems don't have this link
Select16BitSound SETL {FALSE}
|
GBLL Select16BitSound
Select16BitSound SETL {TRUE}
]
GBLL Japanese16BitSound GBLL Japanese16BitSound
Japanese16BitSound SETL {TRUE} :LAND: STB Japanese16BitSound SETL {TRUE} :LAND: STB
GBLL ChecksumCMOS
ChecksumCMOS SETL {TRUE}
GBLL SqueezeMods ; whether squeezed modules are allowed GBLL SqueezeMods ; whether squeezed modules are allowed
SqueezeMods SETL {TRUE} SqueezeMods SETL {TRUE}
...@@ -148,6 +138,9 @@ CheckProtectionLink SETL {TRUE} ; NB affects Delete/Copy/R/T and ...@@ -148,6 +138,9 @@ CheckProtectionLink SETL {TRUE} ; NB affects Delete/Copy/R/T and
GBLL ValidateCMOS ; Apply special CMOS-corruption detection code, GBLL ValidateCMOS ; Apply special CMOS-corruption detection code,
ValidateCMOS SETL {TRUE} ; and do minimal default settings. ValidateCMOS SETL {TRUE} ; and do minimal default settings.
GBLL ChecksumCMOS ; Inspect the CMOS checksum byte, and act like a CMOS reset if it's
ChecksumCMOS SETL {TRUE} ; invalid. Also, calculate CMOS checksum and write it when needed.
GBLL LCDInvert GBLL LCDInvert
LCDInvert SETL {TRUE} :LAND: :LNOT: STB LCDInvert SETL {TRUE} :LAND: :LNOT: STB
......
...@@ -255,7 +255,6 @@ ROMatTop SETL {TRUE} ...@@ -255,7 +255,6 @@ ROMatTop SETL {TRUE}
ROM * &03800000 ROM * &03800000
ROMLimit * &04000000 ROMLimit * &04000000
] ]
OSMD * &11111111
VideoPhysRam * &02000000 ; Amazing - it's in the same place! VideoPhysRam * &02000000 ; Amazing - it's in the same place!
DRAM0PhysRam * &10000000 ; 4 DRAM banks DRAM0PhysRam * &10000000 ; 4 DRAM banks
...@@ -280,10 +279,6 @@ CR * 13 ...@@ -280,10 +279,6 @@ CR * 13
LF * 10 LF * 10
space * " " space * " "
; Registers
SPIRQ RN R13
; Callback byte bits: ; Callback byte bits:
CBack_OldStyle * 1 CBack_OldStyle * 1
CBack_Postpone * 2 CBack_Postpone * 2
......
...@@ -825,7 +825,7 @@ UNDEF1 ...@@ -825,7 +825,7 @@ UNDEF1
MOV R2, #0 MOV R2, #0
STR R2, [R1, #IRQsema] STR R2, [R1, #IRQsema]
] ]
LDR SPIRQ, =IRQSTK LDR r13_irq, =IRQSTK
SWI OS_GenerateError SWI OS_GenerateError
LTORG LTORG
......
...@@ -14,21 +14,8 @@ ...@@ -14,21 +14,8 @@
; ;
SUBT => NewReset SUBT => NewReset
; DuffEntry is the address of "Nowhere" ; Reset types
; - there should never be any page actually mapped to this address (L2PT entry always 0) SoftReset * 0
; - a page that is not mapped in should always have this special address in its CAM entry,
; ie. should only be one Nowhere
;
[ HAL32
DuffEntry * &FAFF8000
|
DuffEntry * &01F08000
]
Nowhere * DuffEntry ; synonym
SoftReset * 0 ; Reset types
PowerOnReset * 1 PowerOnReset * 1
ControlReset * 2 ControlReset * 2
...@@ -708,7 +695,6 @@ kbdthere ...@@ -708,7 +695,6 @@ kbdthere
MOV R3, #-1 ; do all RAM if we do any MOV R3, #-1 ; do all RAM if we do any
BL ValChecksum ; Always check the checksum BL ValChecksum ; Always check the checksum
BNE cmos_reset BNE cmos_reset
] ]
[ ValidateCMOS :LAND: STB [ ValidateCMOS :LAND: STB
...@@ -739,7 +725,6 @@ reset_loop ...@@ -739,7 +725,6 @@ reset_loop
CMP R0, #2037 - 1995 CMP R0, #2037 - 1995
BHI cmos_reset BHI cmos_reset
checkboot
; Bit 4 of DBTBCMOS should be 1 (Boot) ; Bit 4 of DBTBCMOS should be 1 (Boot)
MOV R0, #DBTBCMOS MOV R0, #DBTBCMOS
BL Read BL Read
...@@ -809,18 +794,8 @@ checkboot ...@@ -809,18 +794,8 @@ checkboot
STRNEB R14, [R3, #MentionCMOSReset] STRNEB R14, [R3, #MentionCMOSReset]
BEQ no_cmos_reset ; power on bit checked again there BEQ no_cmos_reset ; power on bit checked again there
[ :LNOT: STB
ADD sp, sp, #4 ; junk CannotReset flag from stack
]
; CMOS reset detectified. ; CMOS reset detectified.
; ************************************************************************** ; Wipe it, then squirt in the MOS's table of default values
; Note: if this CMOS reset code ever needs changing again, it's probably
; better to rewrite it. The Compact apparently has a table of default
; CMOS values; R-p.o. just writes the table, DEL-p.o. zeroes all, then
; writes the table. With skipping of the time CMOS, and post-prodding of
; the sync, that would probably be a better algorithm.
; **************************************************************************
[ HAL [ HAL
TST R7, #KbdFlag_Copy:OR:KbdFlag_Delete TST R7, #KbdFlag_Copy:OR:KbdFlag_Delete
...@@ -829,83 +804,39 @@ checkboot ...@@ -829,83 +804,39 @@ checkboot
ASSERT (Copy_Down_Flag - Del_Down_Flag) = 1 ASSERT (Copy_Down_Flag - Del_Down_Flag) = 1
MOVS R3, R7, LSR #16 ; full reset or just system? MOVS R3, R7, LSR #16 ; full reset or just system?
] ]
MOVNE R3, #-1 ; Del or Copy does all RAM MOVNE R3, #-1 ; Del or Copy does all RAM
MOVEQ R3, #UserCMOS ; R or T just system MOVEQ R3, #UserCMOS ; R or T just system
[ ChecksumCMOS [ ChecksumCMOS
BL ValChecksum ; unless the CMOS ram's corrupt .. BL ValChecksum ; unless the CMOS ram's corrupt ..
MOVNE R3, #-1 ; .. then blast it anyway. MOVNE R3, #-1 ; .. then blast it anyway.
]
cmos_reset cmos_reset
[ STB
ADD sp, sp, #4 ; junk CannotReset flag from stack
]
DebugTX "Reset CMOS" DebugTX "Reset CMOS"
MOVNE R0, #0 ; even the econet station number ADD sp, sp, #4 ; junk CannotReset flag from stack
MOVEQ R0, #1
|
MOV R0, #1 ; leave the econet station number
]
MOV R1, #0 ; zero it first
cmrlp BL Write ; CMOS(R0) := R1
ADD R0, R0, #1
CMP R0, R3
MOVEQ R0, #&80 ; skip user cmos
CMP r0, #YearCMOS
ADDEQ r0, r0, #2
CMP r3, #UserCMOS ; system only?
BNE skipskipforTC
CMP r0, #NewADFSCMOS
CMPNE r0, #CountryCMOS ; skip these if so
ADDEQ r0, r0, #1
skipskipforTC
CMP R0, #CMOSLimit
BNE cmrlp
[ ChecksumCMOS
BL MakeChecksum ; create a valid checksum
]
; now put nice values in where necessary
; first full reset defaults
CMP r3, #-1
BNE not_full_reset
[ STB :LAND: IOMD_C_PALNTSCType <> 0
MOV r4, #IOMD_Base ; configure territory, country and timezone based on PAL/NTSC bit
LDRB r4, [r4, #IOMD_CLINES]
MOV r0, #TerritoryCMOS
TST r4, #IOMD_C_PALNTSCType
MOVEQ r1, #0 ; PAL = territory UK
MOVNE r1, #49 ; NTSC = territory USA
BL Write
MOV r0, #CountryCMOS
TST r4, #IOMD_C_PALNTSCType
MOVEQ r1, #1 ; PAL = country UK
MOVNE r1, #48 ; NTSC = country USA
BL Write
MOV r0, #TimeZoneCMOS
TST r4, #IOMD_C_PALNTSCType
MOVEQ r1, #0 ; PAL = 0 from UTC (GMT)
MOVNE r1, #&E0 ; NTSC = -8 hours from UTC (USA Pacific)
BL Write
[ STB :LAND: :DEF: ObsoleteNC1CMOS
MOV r0, #MiscellaneousNCCMOS
TST r4, #IOMD_C_PALNTSCType
MOVEQ r1, #0 ; PAL = A4 paper size
MOVNE r1, #1 ; NTSC = US letter paper size
BL Write
]
|
MOV r0, #CountryCMOS
MOV r1, #1 ; country UK
BL Write
]
[ :LNOT: STB
MOV r0, #NewADFSCMOS
MOV r1, #&41 ; floppies=1, ST506=0, IDE=1 (changed 01-Sep-93)
BL Write
]
not_full_reset MOV R4, #0
cmrlp
CMP R3, #-1
BEQ cmrall ; ignore system-only wipe checks
CMP R4, #UserCMOS
MOVEQ R4, #&50 ; skip User (30-45) & 3rd party (46-59) & high podules (60-79)
BEQ cmrall
CMP R4, #PoduleCMOS
MOVEQ R4, #&80 ; skip low podules (112-127)
BEQ cmrall
TEQ R4, #NewADFSCMOS ; documented in 'Troubleshooting' in
TEQNE R4, #CountryCMOS ; the RISC OS 3.7 user guide as preserved
BEQ cmrskip
cmrall
MOV R1, R4
BL NVMemory_ResetValue ; get the reset value
MOVS R1, R2 ; when -ve, leave alone
MOVPL R0, R4
BLPL Write ; CMOS(R0) := R1
cmrskip
ADD R4, R4, #1
CMP R4, #CMOSLimit
BCC cmrlp
; IF R or Delete pressed THEN set sync 0 ELSE set sync Auto ; IF R or Delete pressed THEN set sync 0 ELSE set sync Auto
LDR R0, =ZeroPage+InitIRQWs LDR R0, =ZeroPage+InitIRQWs
...@@ -923,247 +854,10 @@ not_full_reset ...@@ -923,247 +854,10 @@ not_full_reset
MOVEQ R1, #MonitorTypeAuto :OR: Sync_Separate ; if T or Copy MOVEQ R1, #MonitorTypeAuto :OR: Sync_Separate ; if T or Copy
BL Write BL Write
[ HAL [ ChecksumCMOS
[ M_32 BL MakeChecksum ; create a valid checksum
; M_32 used for IOMD based machines, select quadrature or PS2 as appropriate
AddressHAL
MOV R0, #0
MOV R1, #&400
CallHAL HAL_ControllerAddress
CMP R0, #0
MOVEQ R1, #PointerDevice_USB
BEQ program_mousetype
LDRB R1, [R0, #IOMD_ID1]
LDRB R0, [R0, #IOMD_ID0]
ORR R0, R0, R1, LSL #8
LDR R1, =IOMD_Original
TEQ R0, R1
MOVEQ R1, #PointerDevice_QuadMouse
BEQ program_mousetype
LDR R1, =IOMD_7500
TEQ R0, R1
LDRNE R1, =IOMD_7500FE
TEQNE R0, R1
MOVEQ R1, #PointerDevice_PS2Mouse
MOVNE R1, #PointerDevice_USB
program_mousetype
MOV R0, #MouseCMOS
BL Write
|
MOV R0, #MouseCMOS
MOV R1, #PointerDevice_USB
BL Write
]
; set print and sound CMOS (16bit sound)
MOV R0, #TutuCMOS
MOV R1, #2_10100100 ; tbs chars valid, ctrlchars '|x'
BL Write
|
[ MorrisSupport
MOV R8, #IOMD_Base
LDRB r0, [r8, #IOMD_ID0]
LDRB r1, [r8, #IOMD_ID1]
ORR r0, r0, r1, LSL #8
LDR r1, =IOMD_Original
TEQ r0, r1
BEQ dont_program_mousetype
;
; Morris based machines use PS2 mice/tracker balls
;
MOV R0, #MouseCMOS
MOV R1, #PointerDevice_PS2Mouse ;type 3
BL Write
[ Select16BitSound
; set print and sound CMOS (16bit sound)
B Config16BitSound
]
dont_program_mousetype
] ; MorrisSupport
[ Select16BitSound
LDR r0, =IOMD_MonitorType
; on Issue A's the protection bit is only weakly pulled up,
; so force it high, then read it back
LDR r1, [r0]
ORR r1, r1, #IOMD_SoundsystemLinkBit
STR r1, [r0]
LDR r1, [r0]
TST r1, #IOMD_SoundsystemLinkBit
BEQ Config16BitSound ; if zero, must be Rimmer, so assume 16bit sound hardware present
; set print and sound CMOS (8bit sound)
MOV R0, #TutuCMOS
MOV R1, #2_0100 ; tbs chars valid, ctrlchars '|x'
BL Write
B ConfigSoundDone
Config16BitSound
; set print and sound CMOS (16bit sound)
MOV R0, #TutuCMOS
MOV R1, #2_10100100 ; tbs chars valid, ctrlchars '|x'
BL Write
ConfigSoundDone
]
] ; HAL
ADR R8, DefaultCMOSTable
50
LDRB R0, [R8], #1
CMP R0, #&FF
BEQ hard_reset ; power on bit musta bin set
LDRB R1, [R8], #1
BL Write
B %BT50
LTORG
[ ValidateCMOS :LAND: STB
DefaultCMOSTable ; list of non-zero options wanted :
; byte pairs of offset, value
; terminated by offset &FF
= KeyDelCMOS, 32
= KeyRepCMOS, 8
= MODETVCMOS, &10 ; TV 0,1
= StartCMOS, (1:SHL:7):OR:(2:SHL:3) ; NONUM, NOCAPS
= DBTBCMOS, (1:SHL:4) ; Boot
= YearCMOS, 02
= YearCMOS+1, 20
[ IOMD_C_MonitorType = 0 :LAND: IOMD_C_PALNTSCType = 0
; TV if we don't have a MonitorType auto-detect bit
= VduCMOS, Sync_Separate :OR: MonitorType0
|
; auto-detect if we have a MonitorType auto-detect bit
= VduCMOS, Sync_Auto :OR: MonitorTypeAuto
]
= MouseStepCMOS, 2
= SystemSpeedCMOS, (1:SHL:2):OR:(1:SHL:4):OR:(0:SHL:5)
; Delete-etc reset
; WimpMode auto
; Cache on
| ;ValidateCMOS
DefaultCMOSTable ; list of non-zero options wanted :
; byte pairs of offset, value
; terminated by offset &FF
= KeyDelCMOS, 32
[ M_CortexA8 :LOR: M_CortexA9
= FileLangCMOS, fsnumber_SCSIFS ; SCSIFS for OMAP3, etc.
|
[ M_ARM11ZF
= FileLangCMOS, fsnumber_SDFS ; SDFS for Pi, etc.
|
= FileLangCMOS, fsnumber_adfs ; ADFS
] ]
] B hard_reset ; CMOS reset only checked on power on, so was hard
= FontCMOS, 64 ; KJB 13-Dec-02: Changed to 256K from 64K
= PigCMOS, 10
= KeyRepCMOS, 8
= RMASizeCMOS, 0
= SpriteSizeCMOS, 0
= SysHeapCMOS, 8
= MODETVCMOS, &10 ; TV 0,1
= NetFSIDCMOS, 254
= NetPSIDCMOS, 235
= PSITCMOS, (3:SHL:2) :OR: (1:SHL:5)
; Baud 3
; print 1
= DBTBCMOS, (1:SHL:4) :OR: (4:SHL:5)
; Boot (changed from NoBoot 01-Sept-93)
; Data 4
= StartCMOS, (4:SHL:0) :OR: (2:SHL:3) :OR: (1:SHL:6) :OR: (0:SHL:7)
; ^ ^ ^ ^
; ADFS DR.4 NOCAPS NODIR (moot) NUM
[ NewClockChip ; only on A1's!
= NewADFSCMOS+1, &FF ; step 3 for each drive
]
= NewADFSCMOS+2, 1 ; ADFSBuffers 1
= SoundCMOS, &F0 ; speaker on, volume 7, channel 1
= LanguageCMOS, ConfiguredLang
= YearCMOS, 04
= YearCMOS+1, 20
[ :LNOT: Select16BitSound
= TutuCMOS, 2_0100 ; tbs chars valid, ctrlchars '|x'
]
= NetFilerCMOS, (0:SHL:0) :OR: (1:SHL:1) :OR: (0:SHL:2)
; FS list order by name
; Use $.Arthurlib
; Large icons
; = Mode2CMOS, WimpModeAutoBit :OR: CMOSResetBit ;AKA SystemSpeedCMOS - removed by RManby and SCormie 8/3/95
= DesktopCMOS, 2_01000000 ; verbose ON
= WimpFlagsCMOS, 2_01101111 ; instant effects, drags off screen
= ProtectionCMOS, 2_01110110 ; allow only peek and user RPC
= MouseStepCMOS, 2
= FileSwitchCMOS,(1:SHL:0) :OR: (1:SHL:1) :OR: (0:SHL:2) :OR: (0:SHL:3) :OR: (0:SHL:6)
; truncate names
; Use DragASprite (changed 01-Sept-93)
; Interactive file copying
; Wimp dither colours off
; last shutdown ordinary
= DesktopFeaturesCMOS,(1:SHL:0) :OR: (8:SHL:1) :OR: (0:SHL:7)
; 3D look
; Homerton.Medium
; tiled window background
[ STB
= SystemSpeedCMOS,(1:SHL:0):OR:(0:SHL:1):OR:(1:SHL:2):OR:(0:SHL:3):OR:(1:SHL:4):OR:(0:SHL:5):OR:(1:SHL:6):OR:(0:SHL:7)
; AUN ROMBoot Enabled
; AUN auto-station numbering off
; Delete-etc reset
; power saving off
; WimpMode auto
; Cache on
; Broadcast loader disabled
; broadcast loader colours off
|
= SystemSpeedCMOS,(0:SHL:0):OR:(0:SHL:1):OR:(1:SHL:2):OR:(0:SHL:3):OR:(1:SHL:4):OR:(0:SHL:5):OR:(1:SHL:6):OR:(0:SHL:7)
; AUN BootNet Disabled
; AUN auto-station numbering off
; Delete-etc reset
; power saving off
; WimpMode auto
; Cache on
; Broadcast loader disabled
; broadcast loader colours off
]
[ :LNOT: STB
= FontMaxCMOS, 64 ; 4096k
= FontMax2CMOS, 36:EOR:12 ; 36 point
= FontMax3CMOS, 36:EOR:24 ; 36 point
= FontMax4CMOS, 16 ; 16 point
|
; yes, omitting FontMaxCMOS is deliberate!
= FontMax2CMOS, &2C ; 32 point
= FontMax3CMOS, &38 ; 32 point
]
= AlarmAndTimeCMOS,2_00010000 ; !Alarm autosave on
= FSLockCMOS+5, &EA ; Checksum for no password
[ M_CortexA8 :LOR: M_CortexA9 :LOR: M_ARM11ZF
= CDROMFSCMOS, &C0 ; drives = 0, buffer size = 256K
= NetworkFlags, LanManFStransport ; LMTransport is NetBIOS over IP
= WimpDragMoveLimitCMOS, (1:SHL:7) ; WimpIconiseButton
= SparrowMarker, FreewayNoAutoAddress ; Stop Freeway assigning addresses to interfaces
|
= CDROMFSCMOS, &C1 ; drives = 1, buffer size = 256K
]
]
= &FF
ALIGN
no_cmos_reset ; R1 has por_bit set if power on no_cmos_reset ; R1 has por_bit set if power on
Push "r1" Push "r1"
...@@ -1451,11 +1145,7 @@ doobry Pull "R1" ; IOCControl restoration ...@@ -1451,11 +1145,7 @@ doobry Pull "R1" ; IOCControl restoration
MOV R0, #SoftReset MOV R0, #SoftReset
B ResetPart1Done B ResetPart1Done
| ] ; SoftResets
; if soft resets are disabled, drop thru into hard reset code
] ; end of code to do with soft resets
hard_reset hard_reset
[ DebugForcedReset [ DebugForcedReset
...@@ -1686,14 +1376,7 @@ WallopDuffOnes ...@@ -1686,14 +1376,7 @@ WallopDuffOnes
; get here with R2 = highest CAM entry used (in old model) ; get here with R2 = highest CAM entry used (in old model)
; [ HAL32
; MOV R0, #0
; LDR R0, [R0, #RAMLIMIT]
; SUB R0, R0, #32*1024
; MOV R0, R0, LSR #12
; |
LDR R0, =(AplWorkMaxSize-32*1024):SHR:12 ; maximum number of pages in aplspace LDR R0, =(AplWorkMaxSize-32*1024):SHR:12 ; maximum number of pages in aplspace
; ]
MOV R3, #32*1024 ; aplwork start MOV R3, #32*1024 ; aplwork start
LDR R1, =ZeroPage+AplWorkSize ; aplwork size LDR R1, =ZeroPage+AplWorkSize ; aplwork size
MOV r11, #AP_AppSpace MOV r11, #AP_AppSpace
......
...@@ -1896,7 +1896,7 @@ NVMemorySWI Entry ...@@ -1896,7 +1896,7 @@ NVMemorySWI Entry
ExitSWIHandler ExitSWIHandler
NVMemorySub NVMemorySub
CMP R0, #4 CMP R0, #6
ADDLS PC, PC, R0, LSL #2 ADDLS PC, PC, R0, LSL #2
B NVMemory_Unknown B NVMemory_Unknown
B NVMemory_Size B NVMemory_Size
...@@ -1904,14 +1904,16 @@ NVMemorySub ...@@ -1904,14 +1904,16 @@ NVMemorySub
B NVMemory_Write B NVMemory_Write
B NVMemory_ReadBlock B NVMemory_ReadBlock
B NVMemory_WriteBlock B NVMemory_WriteBlock
B NVMemory_Unknown ; Reserved for Kernel-5_41 divergence
B NVMemory_ResetValue
NVMemory_Unknown NVMemory_Unknown
ADRL R0, ErrorBlock_HeapBadReason ADRL R0, ErrorBlock_HeapBadReason
[ International [ International
Push LR Push LR
BL TranslateError BL TranslateError
Pull LR Pull LR
] ]
RETURNVS RETURNVS
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
...@@ -1922,7 +1924,7 @@ NVMemory_Unknown ...@@ -1922,7 +1924,7 @@ NVMemory_Unknown
; out: R1 = NV memory size in bytes ; out: R1 = NV memory size in bytes
; ;
NVMemory_Size NVMemory_Size
[ E2ROMSupport [ E2ROMSupport
[ ZeroPage = 0 [ ZeroPage = 0
LDRB R1, [R0, #NVRamSize] LDRB R1, [R0, #NVRamSize]
| |
...@@ -1930,9 +1932,9 @@ NVMemory_Size ...@@ -1930,9 +1932,9 @@ NVMemory_Size
LDRB R1, [R1, #NVRamSize] LDRB R1, [R1, #NVRamSize]
] ]
MOV R1, R1, LSL #8 MOV R1, R1, LSL #8
| |
MOV R1, #240 MOV R1, #240
] ]
MOV PC, LR MOV PC, LR
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
...@@ -1959,15 +1961,15 @@ NVMemory_Read ...@@ -1959,15 +1961,15 @@ NVMemory_Read
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; OS_NVMemory 2 - write a byte ; OS_NVMemory 2 - write a byte
; ;
; in: R0 = 1 ; in: R0 = 2
; R1 = location ; R1 = location
; R2 = value ; R2 = value
; ;
NVMemory_Write ROUT NVMemory_Write ROUT
[ ProtectStationID [ ProtectStationID
TEQ R1, #0 ; just ignore writes to byte 0 TEQ R1, #NetStnCMOS ; just ignore writes
MOVEQ PC, R14 MOVEQ PC, R14
] ]
Entry "R1,R4" Entry "R1,R4"
MRS R4, CPSR MRS R4, CPSR
BIC R0, R4, #I32_bit BIC R0, R4, #I32_bit
...@@ -1990,7 +1992,6 @@ NVMemory_Write ROUT ...@@ -1990,7 +1992,6 @@ NVMemory_Write ROUT
; ;
NVMemory_ReadBlock NVMemory_ReadBlock
Entry "R1-R4" Entry "R1-R4"
MOV R4, PC
MRS R4, CPSR MRS R4, CPSR
BIC R0, R4, #I32_bit BIC R0, R4, #I32_bit
MSR CPSR_c, R0 ; enable interrupts - this may take some time MSR CPSR_c, R0 ; enable interrupts - this may take some time
...@@ -2006,7 +2007,7 @@ NVMemory_ReadBlock ...@@ -2006,7 +2007,7 @@ NVMemory_ReadBlock
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; OS_NVMemory 4 - write a block ; OS_NVMemory 4 - write a block
; ;
; in: R0 = 3 ; in: R0 = 4
; R1 = location ; R1 = location
; R2 = buffer ; R2 = buffer
; R3 = length ; R3 = length
...@@ -2016,14 +2017,15 @@ NVMemory_WriteBlock ROUT ...@@ -2016,14 +2017,15 @@ NVMemory_WriteBlock ROUT
MRS R4, CPSR MRS R4, CPSR
BIC R0, R4, #I32_bit BIC R0, R4, #I32_bit
MSR CPSR_c, R0 ; enable interrupts - this may take some time MSR CPSR_c, R0 ; enable interrupts - this may take some time
[ ProtectStationID [ ProtectStationID
TEQ R1, #0 ASSERT NetStnCMOS = 0
TEQ R1, #NetStnCMOS
BNE %FT10 BNE %FT10
ADD R1, R1, #1 ADD R1, R1, #1
ADD R2, R2, #1 ADD R2, R2, #1
TEQ R3, #0 TEQ R3, #0
SUBNE R3, R3, #1 ; steer clear of station ID SUBNE R3, R3, #1 ; steer clear of station ID
] ]
10 MOV R0, R1 10 MOV R0, R1
MOV R1, R2 MOV R1, R2
MOV R2, R3 MOV R2, R3
...@@ -2033,4 +2035,277 @@ NVMemory_WriteBlock ROUT ...@@ -2033,4 +2035,277 @@ NVMemory_WriteBlock ROUT
MSR CPSR_cf, R4 ; restore interrupt state MSR CPSR_cf, R4 ; restore interrupt state
EXIT EXIT
; -----------------------------------------------------------------------------
; OS_NVMemory 6 - query CMOS value that would be used on a Delete-Power-On reset
;
; in: R0 = 6
; R1 = location
;
; out: R2 = value, or -1 if the value is unknown/untouched
;
NVMemory_ResetValue ROUT
Entry "R3"
MOV R2, #-1 ; assume outside our remit
TEQ R1, #NetStnCMOS
EXIT EQ
ASSERT CheckSumCMOS = CMOSLimit - 1
CMP R1, #CheckSumCMOS
EXIT CS
TEQ R1, #MouseCMOS
BEQ %FT20 ; code driven
TEQ R1, #PrintSoundCMOS
BEQ %FT30 ; code driven
[ STB :LAND: IOMD_C_PALNTSCType <> 0
TEQ R1, #TerritoryCMOS
BEQ %FT40 ; code driven
TEQ R1, #CountryCMOS
BEQ %FT41 ; code driven
TEQ R1, #TimeZoneCMOS
BEQ %FT42 ; code driven
[ :DEF: ObsoleteNC1CMOS
TEQ R1, #MiscellaneousNCCMOS
BEQ %FT43 ; code driven
]
]
ADR R3, DefaultCMOSTable
10
LDRB R2, [R3], #2 ; table is of location/value pairs...
TEQ R2, #&FF ; ...terminated by &FF
MOVEQ R2, #0 ; not in the table, so must be zero
EXIT EQ
TEQ R2, R1 ; location match?
LDREQB R2, [R3, #-1]
EXIT EQ
B %BT10
20
[ HAL
[ M_32 ; M_32 used for IOMD based machines, select quadrature or PS2 as appropriate
Push "R0-R1,R9,R12"
AddressHAL
MOV R0, #0
MOV R1, #&400 ; SSpace hopefully exists
CallHAL HAL_ControllerAddress
LDRB R1, [R0, #IOMD_ID1]
LDRB R0, [R0, #IOMD_ID0]
ORR R0, R0, R1, LSL #8
LDR R1, =IOMD_Original
TEQ R0, R1
MOVEQ R2, #PointerDevice_QuadMouse ; Risc PC
MOVNE R2, #PointerDevice_PS2Mouse ; A7000 et al
Pull "R0-R1,R9,R12"
|
; Everyone else is on USB
MOV R2, #PointerDevice_USB
]
|
Push "R0-R1"
MOV R3, #IOMD_Base
LDRB R1, [R3, #IOMD_ID1]
LDRB R0, [R3, #IOMD_ID0]
ORR R0, R0, R1, LSL #8
LDR R1, =IOMD_Original
TEQ R0, R1
MOVEQ R2, #PointerDevice_QuadMouse ; Risc PC
MOVNE R2, #PointerDevice_PS2Mouse ; A7000 et al
Pull "R0-R1"
]
EXIT
30
[ HAL
MOV R2, #2_10100100
; ^^^ interpolate at low rates, 16 bit DAC, fully programmable rates
; ^^^^^ tbs chars valid, escape with GSTrans
|
Push "R0-R1"
MOV R3, #IOMD_Base
LDRB R1, [R3, #IOMD_ID1]
LDRB R0, [R3, #IOMD_ID0]
ORR R0, R0, R1, LSL #8
LDR R1, =IOMD_7500
TEQ R0, R1
LDRNE R1, =IOMD_7500FE
TEQNE R0, R1
[ STB
MOVEQ R2, #2_00000100 ; Cheapskates
|
MOVEQ R2, #2_10100100 ; A7000 et al always have 16 bit sound
]
BEQ %FT31
; on Issue A's the protection bit is only weakly pulled up,
; so force it high, then read it back
LDR R3, =IOMD_MonitorType
LDR R1, [R3]
ORR R1, R1, #IOMD_SoundsystemLinkBit
STR R1, [R3]
LDR R1, [R3]
TST R1, #IOMD_SoundsystemLinkBit
MOVEQ R2, #2_10100100 ; if zero, must be Rimmer, so assume 16bit sound hardware present
MOVNE R2, #2_00000100 ; 8 bit sound on the motherboard (can't detect plugin upgrades)
31
Pull "R0-R1"
]
EXIT
[ STB :LAND: IOMD_C_PALNTSCType <> 0
40
MOV R2, #0 ; PAL = territory UK
MOV R3, #49 ; NTSC = territory USA
B %FT44
41
MOV R2, #1 ; PAL = country UK
MOV R3, #48 ; NTSC = country USA
B %FT44
42
MOV R2, #0 ; PAL = 0 from UTC (GMT)
MOV R3, #&E0 ; NTSC = -8 hours from UTC (USA Pacific)
B %FT44
[ :DEF: ObsoleteNC1CMOS
43
MOV R2, #0 ; PAL = A4 paper size
MOV R3, #1 ; NTSC = US letter paper size
]
44
MOV R14, #IOMD_Base
LDRB R14, [R14, #IOMD_CLINES]
TST R14, #IOMD_C_PALNTSCType
MOVNE R2, R3 ; Select NTSC when line high
EXIT
]
[ ValidateCMOS :LAND: STB
DefaultCMOSTable
; Minimalist table
DCB KeyDelCMOS, 32
DCB KeyRepCMOS, 8
DCB MODETVCMOS, &10 ; TV 0,1
DCB StartCMOS, (1:SHL:7):OR:(2:SHL:3) ; NONUM, NOCAPS
DCB DBTBCMOS, (1:SHL:4) ; Boot
DCB YearCMOS+0, 00
DCB YearCMOS+1, 20
[ IOMD_C_MonitorType = 0 :LAND: IOMD_C_PALNTSCType = 0
; TV if we don't have a MonitorType auto-detect bit
DCB VduCMOS, Sync_Separate :OR: MonitorType0
|
; auto-detect if we have a MonitorType auto-detect bit
DCB VduCMOS, Sync_Auto :OR: MonitorTypeAuto
]
DCB CountryCMOS, 1 ; UK
DCB MouseStepCMOS, 2
DCB SystemSpeedCMOS, (1:SHL:2):OR:(1:SHL:4):OR:(0:SHL:5)
; Delete-etc reset
; WimpMode auto
; Cache on
|
DefaultCMOSTable
; Normal table
DCB KeyDelCMOS, 32
[ M_CortexA8 :LOR: M_CortexA9
DCB FileLangCMOS, fsnumber_SCSIFS ; SCSIFS for OMAP3, etc.
|
[ M_ARM11ZF
DCB FileLangCMOS, fsnumber_SDFS ; SDFS for Pi, etc.
|
DCB FileLangCMOS, fsnumber_adfs ; ADFS
]
]
DCB FontCMOS, 64 ; KJB 13-Dec-02: Changed to 256K from 64K
DCB PigCMOS, 10
DCB KeyRepCMOS, 8
DCB RMASizeCMOS, 0
DCB SpriteSizeCMOS, 0
DCB SysHeapCMOS, 8
DCB MODETVCMOS, &10 ; TV 0,1
DCB NetFSIDCMOS, 254
DCB NetPSIDCMOS, 235
DCB PSITCMOS, (3:SHL:2) :OR: (1:SHL:5)
; Baud 3
; Print 1
DCB DBTBCMOS, (1:SHL:4) :OR: (4:SHL:5)
; Boot (changed from NoBoot 01-Sep-93)
; Data 4
DCB StartCMOS, (4:SHL:0) :OR: (2:SHL:3) :OR: (1:SHL:6) :OR: (0:SHL:7)
; ^ ^ ^ ^
; ADFS DR.4 NOCAPS NODIR (moot) NUM
[ :LNOT: STB
DCB NewADFSCMOS+0, &41 ; floppies=1, ST506=0, IDE=1 (changed 01-Sep-93)
]
DCB NewADFSCMOS+1, 4_3333 ; step 3 for each drive
DCB NewADFSCMOS+2, 1 ; ADFSBuffers 1
DCB SoundCMOS, &F0 ; speaker on, volume 7, channel 1
DCB LanguageCMOS, ConfiguredLang
DCB YearCMOS+0, 00
DCB YearCMOS+1, 20
DCB NetFilerCMOS, (0:SHL:0) :OR: (1:SHL:1) :OR: (0:SHL:2)
; FS list order by name
; Use $.Arthurlib
; Large icons
DCB DesktopCMOS, 2_01000000 ; verbose ON
DCB WimpFlagsCMOS, 2_01101111 ; instant effects, drags off screen
DCB ProtectionCMOS, 2_01110110 ; allow only peek and user RPC
DCB MouseStepCMOS, 2
DCB FileSwitchCMOS, (1:SHL:0) :OR: (1:SHL:1) :OR: (0:SHL:2) :OR: (0:SHL:3) :OR: (0:SHL:6)
; Truncate names
; Use DragASprite (changed 01-Sept-93)
; Interactive file copying
; Wimp dither colours off
; Last shutdown ordinary
DCB DesktopFeaturesCMOS,(1:SHL:0) :OR: (8:SHL:1) :OR: (0:SHL:7)
; 3D look
; Homerton.Medium
; Tiled window background
[ STB
DCB SystemSpeedCMOS, (1:SHL:0):OR:(0:SHL:1):OR:(1:SHL:2):OR:(0:SHL:3):OR:(1:SHL:4):OR:(0:SHL:5):OR:(1:SHL:6):OR:(0:SHL:7)
; AUN ROMBoot Enabled
; AUN auto-station numbering off
; Delete-etc reset
; Power saving off
; WimpMode auto
; Cache on
; Broadcast loader disabled
; Broadcast loader colours off
|
DCB SystemSpeedCMOS, (0:SHL:0):OR:(0:SHL:1):OR:(1:SHL:2):OR:(0:SHL:3):OR:(1:SHL:4):OR:(0:SHL:5):OR:(1:SHL:6):OR:(0:SHL:7)
; AUN BootNet Disabled
; AUN auto-station numbering off
; Delete-etc reset
; Power saving off
; WimpMode auto
; Cache on
; Broadcast loader disabled
; Broadcast loader colours off
]
[ STB
; FontMaxCMOS yes, omitting is deliberate!
DCB FontMax2CMOS, &2C ; 32 point
DCB FontMax3CMOS, &38 ; 32 point
|
DCB FontMaxCMOS, 64 ; 4096k
DCB FontMax2CMOS, 36:EOR:12 ; 36 point
DCB FontMax3CMOS, 36:EOR:24 ; 36 point
DCB FontMax4CMOS, 16 ; 16 point
]
DCB AlarmAndTimeCMOS, 2_00010000 ; !Alarm autosave on
DCB FSLockCMOS+5, &EA ; Checksum for no password
DCB SparrowMarker, FreewayNoAutoAddress ; Stop Freeway assigning addresses to interfaces
DCB NetworkFlags, LanManFStransport ; LMTransport is NetBIOS over IP
DCB WimpDragMoveLimitCMOS, (1:SHL:7) ; WimpIconiseButton
[ M_CortexA8 :LOR: M_CortexA9 :LOR: M_ARM11ZF
DCB CDROMFSCMOS, &C0 ; drives = 0, buffer size = 256K
|
DCB CDROMFSCMOS, &C1 ; drives = 1, buffer size = 256K
]
]
DCB &FF
ALIGN
END END
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