diff --git a/s/Wimp01 b/s/Wimp01 index 874947dc51d83eba3897ad515fad0d627af52002..b6df53a771c53cd9952f5428a9c9ada255689739 100644 --- a/s/Wimp01 +++ b/s/Wimp01 @@ -1969,7 +1969,7 @@ ChangeEnvCode Pull "R1,PC" ; pass it on! -UpCallCode +UpCallCode ROUT TEQ R0,#UpCall_MediaSearchEnd BEQ finishupcall ; this comes round if it works! @@ -1977,27 +1977,24 @@ UpCallCode TEQNE R0,#UpCall_MediaNotKnown MOVNE PC,LR ; Pass it on -; In R1 = fs number -; R2 -> media title, 0 -; r3 = device number (-1 for ADFS) -; r4 = iteration number (so we can 'reverse poll' ADFS) +; In r1 = fs number +; r2 -> media name, or = -1 => r6 -> message +; r3 = device number (-1 for irrelevant) +; r4 = iteration number (so we can 'reverse poll' if required) ; r5 = timeout between reverse polls (large if not wanted) -; r6 = name of media (eg. 'disc' for FileCore) +; r6 -> media type (eg. 'disc' for FileCore) (if r2 <> -1) +; = -1 for disc (if r2 <> -1) +; -> complete message to display (if r2 = -1) -XADFS_FloppyFlags * Auto_Error_SWI_bit + &40246 +; Note PRM p1-179 says that r2 may be -1 if irrelevant, the comment above +; said it may be 0. Both were wrong. We take advantage of the +; documentation to provide slightly modified behaviour, since no-one +; can have been relying on r2 = -1 working before. Push "R1-R6" ; no need to stash LR (we'll claim vector) -; SWI XADFS_FloppyFlags ; 4 bytes, bits 6,7 set => can poll -; AND R0,R0,R0,LSL #16 -; AND R0,R0,R0,LSL #8 -; MOVS R0,R0,LSR #30 ; can poll if C=1,Z=0 (HI) -; MOVHI R5,#10 ; poll every 1/10 sec -; MOVLS R5,#&10000000 ; don't poll at all! -; ADR R6,disc ; cheat - CMP R6,#0 ; bodge for old FileCores - ADRLT R6,disc + ADRLTL R6,disc MOVLT R5,#bignum ; long timeout if R6 invalid SUB sp,sp,#32 @@ -2020,16 +2017,31 @@ XADFS_FloppyFlags * Auto_Error_SWI_bit + &40246 SUBS r2, sp, #0 ; CLRV, r2 -> buffer. ; Push "R2-R5" + LDR r5, [sp, #32+1*4+4*4] ; media name or -1 + CMP r5, #-1 + BEQ %04 + ADRL R2,errorbuffer MOV R3,#252 MOV R14,#0 ; error number STR R14,[R2],#4 ; ADR R0,ensuredisc ; "Please insert %0 '%1'" - MOV R4,R6 - LDR R5,[sp,#32+1*4+4*4] ; Disc name + MOV R4,R6 ; media type ; BL LookupToken ; resolve into suitable string + + B %05 +04 + ;Just use the message provided (copied into the same buffer) + ADRL r2, errorbuffer + ADD r2, r2, #4 ;don't care about error number +06 LDRB lr, [r6], #1 ;read from given message + STRB lr, [r2], #1 ;write to error buffer + TEQ lr, #0 ;NUL-terminated + BNE %06 +05 + Pull "R2-R5" ; SWI XOS_ReadMonotonicTime @@ -2079,7 +2091,7 @@ disc DCB "disc", 0 ; cheat ; Doesn't reset the common sprite pool (only done in Die) ; -deallocateptrs +deallocateptrs ROUT Push "R0-R5,LR" ; ; release block used for holding pixtrans tables diff --git a/s/Wimp07 b/s/Wimp07 index 918ba2cca44a71da10d71a7133290828bde4db81..13325af568445c3be95eeaa214acb86deee60d4f 100644 --- a/s/Wimp07 +++ b/s/Wimp07 @@ -1638,7 +1638,27 @@ servicecallend LDR R14,commandflag ; finally un-suspend the window BIC R14,R14,#cf_suspended STR R14,commandflag -; + + [ outlinefont + ;Restore the current font and font colours that were in force on + ; entry, if they've been changed. This must be done *before* + ; making the service call, so the code in ExitWimp is too late. + Push "r0-r3" + LDR R0, currentfont + TEQ R0, #0 + BEQ ReportError_restored_font_colours + LDR R1, systemfont + TEQ R1, R0 + LDRNE R1, currentbg + LDRNE R2, currentfg + LDRNE R3, currentoffset + SWINE XFont_SetFontColours + MOV R0, #0 + STR R0, currentfont +ReportError_restored_font_colours + Pull "r0-r3" + ] + MOV R1,#Service_WimpReportError MOV R0,#0 ; closing down STRB R0,errorbox_open @@ -1836,6 +1856,26 @@ starterror_next MOV R1,#2 STR R1,[sp] ; cancel + [ outlinefont + ;Restore the current font and font colours that were in force on + ; entry, if they've been changed. This must be done *before* + ; making the service call, so the code in ExitWimp is too late. + Push "r0-r3" + LDR R0, currentfont + TEQ R0, #0 + BEQ ReportError_restored_font_colours2 + LDR R1, systemfont + TEQ R1, R0 + LDRNE R1, currentbg + LDRNE R2, currentfg + LDRNE R3, currentoffset + SWINE XFont_SetFontColours + MOV R0, #0 + STR R0, currentfont +ReportError_restored_font_colours2 + Pull "r0-r3" + ] + MOV R1,#Service_WimpReportError MOV R0,#0 ; closing down STRB R0,errorbox_open