Open jgharston opened 1 year ago
LDX #userRegKeyboardDelay:JSR ReadUserReg:TAX:LDA #osbyteSetAutoRepeatDelay:JSR OSBYTE
LDX #userRegKeyboardRepeat:JSR ReadUserReg:TAX:LDA #osbyteSetAutoRepeatPeriod:JSR OSBYTE
LDX #userRegPrinterIgnore:JSR ReadUserReg:TAX:LDA #osbyteSetPrinterIgnore:JSR OSBYTE
; 33bytes
LDX #userRegKeyboardDelay:LDA #osbyteSetAutoRepeatDelay:JSR xxxx
LDX #userRegKeyboardRepeat:LDA #osbyteSetAutoRepeatPeriod:JSR xxxx
LDX #userRegPrinterIgnore:LDA #osbyteSetPrinterIgnore:JSR xxxx
.... xxxx PHA:JSR ReadUserReg:TAX:PLA:JMP OSBYTE ; 30bytes
.SoftReset JSR IbosSetUp
; Implement the *CONFIGURE TV setting.
LDX #userRegModeShadowTV:JSR ReadUserReg
PHA
; Arithmetic shift A right 5 bits to get a sign-extended version of the vertical shift
; setting in A.
LDY #5
.ShiftLoop CMP #&80:ROR A ; Shift Right Arithmetic DEY:BNE ShiftLoop ; Do it five times TAX PLA:PHA AND #&10:BEQ InterlaceInY ; Y=0 from above INY .InterlaceInY LDA #osbyteTV:JSR OSBYTE ; old 35bytes, new 30bytes
; Set the screen mode. On a soft reset we preserve the last selected mode (like the
; Master), unless we're in OSMODE 0; on other resets we select the *CONFIGUREd mode.
LDX lastBreakType:BNE DontPreserveScreenMode ; branch if not soft reset
LDX #prvOsMode - prv83:JSR ReadPrivateRam8300X:BEQ DontPreserveScreenMode
PLA ; Drop the MODE we saved in TV
LDX #prvLastScreenMode - prv83:JSR ReadPrivateRam8300X
JMP ScreenModeInA
.DontPreserveScreenMode PHA:AND #&0F ; Get the MODE we saved in setting TV ; Map the "compressed mode" in the range 0-15 to 0-7 or 128-135. ; SQUASH: We have at least two copies of this, worth sharing? CMP #maxMode + 1:BCC ScreenModeInA EOR #&88 ; Force to MODE &80+n .ScreenModeInA PHA LDA #vduSetMode:JSR OSWRCH PLA:JSR OSWRCH .ScreenModeSet
; old 44bytes, new 39bytes
; Implement *CONFIGURE FDRIVE and *CONFIGURE BOOT.
; There are 3 bits allocated to FDRIVE, but *FX255 only has two bits for drive speed.
LDX #16:JSR ReadUserReg ; Get Data/Boot/Scroll/Tube/Shadow
TAY ; Save Data/Boot in Y
PLA ; get *CONFIGURE FDRIVE bits from userRegFdriveCaps earlier
LDX lastBreakType:BEQ DontUpdateOptions ; branch if soft reset
AND #&03
ROR A:ROR A:ROR A:ROR A:PHA ; b7=0, b6-b5=FDRIVE, b4-b0=00000
LDX #userReg_DFSNFS_flag:JSR ReadUserReg
AND #the_bit_DFSNFS_flag_is_in ; keep DFS/NFS flag
CMP #the_bit_DFSNFS_flag_is_in ; copy it to Carry
PLA:ROR A:STA tmp ; b7=DFS/NFS flag, b5-b4=FDRIVE
TYA:PHA ; Get BOOT/NOBOOT from earlier, save it for later
LSR A ; Move it to bit 3
EOR #8:ORA tmp:STA tmp ; A=d0ffb000
LDA currentMode:AND #7:ORA tmp ; A=d0ffdmmm
LDY #%01000000
TAX:LDA #osbyteReadWriteStartupOptions:JSR OSBYTE ; set to (<old value> AND Y) EOR X
; We should be setting the language as part of the startup sequence
LDX #userRegLang ; location 5
BIT tubePresenceFlag:BPL GetLanguageRomNumber
JSR GetMyROMByte ; LDA ROMID,AND #15,CLC,ADC #30,TAX,RTS
.GetLanguageRomNumber JSR ReadUserReg ; Get LANG or HILANG into b7-b4 JSR LsrA4 ; Is now in b3-b0 STA osbyteCurrentLanguage
.DontUpdateOptions ; stack holds Data/Boot/Scroll/Tube/Shadow back for following
All occurances of reading the filing system can be: LDA #0:TAY:JSR OSARGS there's not enough occurances to make it worth putting in a subroutine.
Optimise: ; Test for OSBYTE &6C - Select Shadow/Screen memory for direct access .osbyte6C { LDA oswdbtA:CMP #&6C:BNE osbyte72 ASSERT ramselShen == 1 << 7
; old 31bytes, new 26bytes LDX #0:PLA:BMI osbyte6Cexit:INX .osbyte6Cexit STX oswdbtX JMP ExitAndClaimServiceCall ; old 12bytes, new 11bytes }