Commit 9e035568 authored by Ben Avison's avatar Ben Avison
Browse files

Main new features in Ursula build so far

(some are also available in other builds):

* New icon highlighting scheme - hue rotated 180 degrees, photographic negative,
  darkened 25% - suits Ursula icons better.
* Release-button window tools compile-time switch turned on.
* Any "TASK" word cleared on exit from Wimp_OpenWindow, Wimp_GetWindowState,
  Wimp_ForceRedraw and Wimp_CloseDown.
* Child windows are no longer allowed to be opened inside the icon bar.
* Message_IconizeAt generation optimised, and no longer calls non-X SWIs.
* Message_IconsChanged implemented, and switched out on speed grounds.
* Wimp_ReadSysInfo 15 removed, replaced with (new) Wimp_Extend 11.
* Backwindows are now segregated from normal windows. A new category,
  foreground windows, are added, and stay above all other windows. (The error
  box template is updated to make it a foreground window.)
* ROM sprites override RAM sprites (and duplicate RAM sprites are deleted
  during the building of the sprite lookup list, preceding the first sprite
  plot after a sprite pool update).
* Wimp_ReadSysInfo 16 added, to return sprite area pointers in order of
  priority (Wimp_BaseOfSprites retains the ROM/RAM distinction).
* Error box code altered:
  + symbolic names used for offsets into tempworkspace
  + error button text buffer enlarged
  + stretched error buttons now shrink back for next use
  + int_flush_opens called at appropriate points to ensure buttons are seen to
    slab in, and to reduce flicker when redisplaying error box at a different
    width (also fixes some redraw bugs)
  + Cancel button given the R6 type border when it will be activated by Return
    (and is therefore moved to the extreme right in such cases)
  + Escape now always selects the second-right button (unless there's only one
    button!) - this also fixes a bug when there's a single user-defined button
  + keypresses in "xxx may have gone wrong" error boxes are now correctly
    interpreted - previously the buttons available in the underlying box were
    being used to determine the effect of keys
  + maximum number of buttons increased from 4 to 8, and the machine no longer
    crashes when the maximum is exceeded
  + window stretches horizontally to keep error message to 7 lines or less
* Bugfix: opening or creating a window with a minimum x visible area coordinate
  of -1 was leading to any of smearing/flickering/recursive drawing. (This was
  actually due to a failure to recognise which windows' positions had been
  updated.)
* Features merged in from spinner branch Wimp:
  + support for UpCall_MediaSearchEndMessage added
  + control-termination allowed in upcalls (used to require null-termination)
  + escape character switched to default during error box display, then
    switched back again afterwards
* GetRectangle filters are now called with (internal) window handle in R10.
* Autohourglass is deactivated whenever WrchV is invoked. (Also optimised.)
* Action button bugfixes:
  + action buttons now deselect if the pointer is dragged off and a window tool
    is the pressed before all the buttons have been released
  + action buttons now slab in following a long (autorepeating) press on a
    scroll arrow window tool
parent 82a9df7d
......@@ -41,8 +41,6 @@
Option DoubleIcon, false ; allow double-clicking on icon bar
Option BounceClose, false ; debounce close icon, sadly fails for anything that
; then does a get pointer info to check which mouse button
Option standalone, false ; include messages / templates
Option fastborders, true ; use PutSpriteAtUserCoords for border plotting
Option fixrmatools, false
......
......@@ -18,9 +18,9 @@
; To debug the Wimp, set debug to true, then turn on the debugXXX options of your choice.
;========================================================================================
;
Option hostvdu, false ; destination for debug output
Option hostvdu, false ; destination for debug output
Option debug_flush, true ; flushing if going to file
Option pdebug_module, true ; use PDebug module
Option pdebug_module, false ; use PDebug module
Option DebugMemory, false
......@@ -65,7 +65,7 @@
OptionD ub, false ; User definable scroll bars
OptionD val, false ; New validation string commands (K)
OptionD check, false ; Check for inconsistent window stacks and flags
OptionD err, true ; Wimp_ReportError and errors in general
OptionD err, false ; Wimp_ReportError and errors in general
OptionD autoopen, false ; For opening of wimp's own windows
OptionD rma, false
OptionD perth, false ; For Perth power managerment
......@@ -94,5 +94,6 @@
OptionD mjs3, false ; Mike's debugs 3
OptionD mjs4, false ; Mike's debugs 4 (TransferBlock)
OptionD autohg, false ; AutoHourglass
OptionD sprprior, false ; ROM vs RAM sprite priority
END
......@@ -57,7 +57,11 @@
Option ChocolateScreen, false ; Clean cached screen after redraw loops
Option KernelLocksFreePool, false ; use OS_Memory 10 to lock Free Pool for Wimp_ClaimFreeMemory
Option StretchErrorButtons, true ; Stretch buttons in error box to fit text
Option StretchErrorText, false ; Stretch error box to contain long error messages neatly
Option AutoHourglass, false ; Hourglass automatically on between Wimp_Polls
Option UrsulaHighlighting, false ; Uses icon highlighting algorithm to suit Ursula new-look
Option ForegroundWindows, false ; Layering of windows within each stack
Option SpritePriority, false ; Allow configurable sprite pool priority
Option DoubleHeightVDU4, false ; Wimp_SetMode selects modes with double height VDU 4 output
Option RegisterMessages, false
......
......@@ -17,10 +17,15 @@
;
Option IconiseButton, true ; Windows given iconise button
Option BounceClose, true ; Furniture buttons are release-type
Option ChocolateScreen, true ; Clean cached screen after redraw loops
Option ShrinkableAreas, true ; Support Shrinkable Dynamic Areas
Option KernelLocksFreePool, true ; use OS_Memory 10 to lock Free Pool for Wimp_ClaimFreeMemory
Option StretchErrorText, true ; Stretch error box to contain long error messages neatly
Option AutoHourglass, true ; Hourglass automatically on between Wimp_Polls (requires Ursula Task Manager and Hourglass)
Option UrsulaHighlighting, true ; Uses icon highlighting algorithm to suit Ursula new-look
Option ForegroundWindows, true ; Layering of windows within each stack
Option SpritePriority, true ; Allow configurable sprite pool priority
ASSERT International_Help <> 0
......
......@@ -300,6 +300,8 @@ SWIWimp_Extend
RSBGES R14,R0,#10 ; In: R1 = window handle, or -1 for top-level ; Out: R1 = result handle, or -1 for none
BGE %FT01
]
TEQ R0,#11 ; In: R1 = pointer to block to fill with furniture dimensions
BEQ %FT11 ; [R1,#0] = window handle to use, or 0 for generic values
B ExitWimp
[ ChildWindows
......@@ -366,4 +368,203 @@ extendjumptable
B exitcicon
B int_setcolour
^ 0, R1
furnblock_handle # 4
furnblock_lborder # 4
furnblock_bborder # 4
furnblock_rborder # 4
furnblock_tborder # 4
furnblock_back # 4
furnblock_close # 4
furnblock_titlegap0 # 4
furnblock_title # 4
furnblock_titlegap1 # 4
furnblock_iconise # 4
furnblock_togglew # 4
furnblock_toggleh # 4
furnblock_vscrgap1 # 4
furnblock_up # 4
furnblock_vscr # 4
furnblock_down # 4
furnblock_vscrgap0 # 4
furnblock_adjusth # 4
furnblock_adjustw # 4
furnblock_hscrgap1 # 4
furnblock_right # 4
furnblock_hscr # 4
furnblock_left # 4
furnblock_hscrgap0 # 4
11
LDR handle, furnblock_handle
TEQ handle, #0
BEQ %FT01
BL checkhandle_iconbar
BVS ExitWimp
ADD R0, handle, #w_ow0
LDMIA R0, {cx0, cy0, cx1, cy1} ; cx0-cy1 = visible area
LDMIA R0, {x0, y0, x1, y1} ; x0-y1 = visible area
BL calc_w_x0y0x1y1 ; x0-y1 = window outline
SUB R0, cx0, x0
STR R0, furnblock_lborder
SUB R0, cy0, y0
STR R0, furnblock_bborder
SUB R0, x1, cx1
STR R0, furnblock_rborder
SUB R0, y1, cy1
STR R0, furnblock_tborder
SUB x1, x1, x0 ; calc total lengths of sides - top edge
SUB y1, y1, y0 ; - right edge
MOV x0, x1 ; - bottom edge
LDR R14, [handle, #w_flags] ; load flags
B %FT02
01 LDR R0, dx ; assume max border widths
STR R0, furnblock_lborder
LDR R0, hscroll_height1
STR R0, furnblock_bborder
LDR R0, vscroll_width1
STR R0, furnblock_rborder
LDR R0, title_height1
STR R0, furnblock_tborder
MOV x1, #&200 ; assume reasonably large
MOV y1, x1
MOV x0, x1
MOV R14, #wf_iconbits ; assume all border flags set
02
TST R14, #wf_icon1 ; back icon?
LDRNE R0, back_width
MOVEQ R0, #0
SUB x1, x1, R0
STR R0, furnblock_back
TST R14, #wf_icon2 ; close / iconise icons?
LDRNE R0, close_width
MOVEQ R0, #0
SUB x1, x1, R0
STR R0, furnblock_close
[ IconiseButton
LDRNE R0, iconise_width
|
MOV R0, #0
]
SUB x1, x1, R0
STR R0, furnblock_iconise
TST R14, #wf_icon4 ; toggle-size icon?
LDRNE R0, vscroll_width
MOVEQ R0, #0
SUB x1, x1, R0
STR R0, furnblock_togglew
LDRNE R0, title_height
SUB y1, y1, R0
STR R0, furnblock_toggleh
TST R14, #wf_icon3 ; title bar?
MOVEQ x1, #0
STR x1, furnblock_title
MOV R0, #0
STR R0, furnblock_titlegap0 ; provided to support future expansion
STR R0, furnblock_titlegap1 ; eg extra buttons, or a squashable title bar
MVN R0, R14
TST R0, #wf_icon5 :OR: wf_icon7
TSTNE R0, #wf_icon6 ; adjust-size / blank?
LDREQ R0, hscroll_height
MOVNE R0, #0
SUB y1, y1, R0
STR R0, furnblock_adjusth
LDREQ R0, vscroll_width
SUB x0, x0, R0
STR R0, furnblock_adjustw
TST R14, #wf_icon5 ; if no vscroll, clear the vscroll words
MOV R0, #0
STREQ R0, furnblock_vscrgap1
STREQ R0, furnblock_up
STREQ R0, furnblock_vscr
STREQ R0, furnblock_down
STREQ R0, furnblock_vscrgap0
BEQ %FT04
Push "R14"
TEQ handle, #0
; MOVEQ R0, #0 ; gap0 = 0
MOVEQ R14, #0 ; gap1 = 0
BEQ %FT03
[ ChildWindows
Push "x0,y1" ; determine vertical gaps
MOV R0, #iconposn_vscroll
BL calc_w_iconposn2
SUB R0, y0, cy0
SUB R14, cy1, y1
Pull "x0,y1"
]
03 STR R0, furnblock_vscrgap0
STR R14, furnblock_vscrgap1
SUB y1, y1, R0
SUBS y1, y1, R14
; CMP y1, #0 ; see if vertical arrows are squashed
MOVLE cy0, #0 ; arrows given 0 length if scrollbar has -ve length (it can happen!)
MOVLE cy1, #0
LDRGT cy0, down_height ; standard lengths
LDRGT cy1, up_height
ADDGT R14, cy0, cy1
RSBGTS R0, y1, R14
MOVGT cy0, y1, LSR#1 ; which may be squashed
SUBGT cy1, y1, cy0
SUB y1, y1, cy0 ; take arrows from the bar length to give the well length
SUB y1, y1, cy1
STR cy1, furnblock_up
STR y1, furnblock_vscr
STR cy0, furnblock_down
Pull "R14"
04
TST R14, #wf_icon7 ; if no hscroll, clear the hscroll words
MOV R0, #0
STREQ R0, furnblock_hscrgap1
STREQ R0, furnblock_right
STREQ R0, furnblock_hscr
STREQ R0, furnblock_left
STREQ R0, furnblock_hscrgap0
BEQ ExitWimp ; all done
TEQ handle, #0
; MOVEQ R0, #0 ; gap0 = 0
MOVEQ R14, #0 ; gap1 = 0
BEQ %FT05
[ ChildWindows
Push "x0" ; determine horizontal gaps
MOV R0, #iconposn_hscroll
BL calc_w_iconposn2
SUB R0, x0, cx0
SUB R14, cx1, x1
Pull "x0"
]
05 STR R0, furnblock_hscrgap0
STR R14, furnblock_hscrgap1
SUB x0, x0, R0
SUBS x0, x0, R14
; CMP x0, #0 ; see if horizontal arrows are squashed
MOVLE cx0, #0 ; arrows given 0 length if scrollbar has -ve length (it can happen!)
MOVLE cx1, #0
LDRGT cx0, left_width ; standard lengths
LDRGT cx1, right_width
ADDGT R14, cx0, cx1
RSBGTS R0, x0, R14
MOVGT cx0, x0, LSR#1 ; which may be squashed
SUBGT cx1, x0, cx0
SUB x0, x0, cx0 ; take arrows from the bar length to give the well length
SUB x0, x0, cx1
STR cx1, furnblock_right
STR x0, furnblock_hscr
STR cx0, furnblock_left
B ExitWimp ; all done
END
......@@ -934,6 +934,5 @@
;; 15-Sep-95 3.71 Remove mode check from module initialisation to enable soft loadable modes.
;;
;;----------------------------------------------------------------------------
;;
;;
;;----------------------------------------------------------------------------
;; 29th Apr 97 3.89 (JRC) Modify UpCall handler; restore font colours before calling Service_WimpReportError at end
;; of SWI Wimp_ReportError.
......@@ -315,13 +315,21 @@ findwimpspritefordepth
BNE %FT05
MOV R0,#24
ORR R0,R0,#256
[ SpritePriority
LDR R1,baseofhisprites
|
LDR R1,baseofsprites
]
ADD R2,SP,#4
SWI XOS_SpriteOp
BVC %FT07
MOV R0,#24
ORR R0,R0,#256
[ SpritePriority
LDR R1,baseoflosprites
|
LDR R1,baseofromsprites
]
ADD R2,SP,#4
SWI XOS_SpriteOp
B %FT07
......
......@@ -581,7 +581,7 @@ WimpWriteDir_Code
CMP R2,#1
Pull "PC",GT
MOV r0,#-1
SWI Territory_WriteDirection
SWI XTerritory_WriteDirection
MOVVS R0,#0
TST R0,#1
SUBNE R2,R2,#1
......@@ -1039,31 +1039,47 @@ IconSprites_Code
MOVVS R2,R3 ; R2 -> original filename
MOVVS R0,#SpriteReason_MergeSpriteFile
SWIVS XWimp_SpriteOp
BVS %FT05
[ windowsprite
MOVVC R0,#-1
STRVC R0,tiling_sprite
MOV R0,#-1
STR R0,tiling_sprite
]
BVC %FT05
Push R0
[ true ; don't send error back
LDR R0,[R0]
LDR R14,=ErrorNumber_WimpBadSprites
TEQ R0,R14 ; not really an error!
CLRV EQ
[ false
MOV R14,#ms_data ; message block size
STR R14,[sp,#-ms_data]!
MOV R14,#0 ; your_ref
STR R14,[sp,#ms_yourref]
LDR R14,=Message_IconsChanged
STR R14,[sp,#ms_action]
MOV R0,#User_Message
MOV R1,sp
MOV R2,#0 ; broadcast message
BL int_sendmessage_fromwimp
ADD sp,sp,#ms_data
CLRV ; ignore errors
]
Pull "R0,R12,PC"
05
; this merge bumps the RMA up, compress it again just in case.
[ Medusa
Pull "R12,PC" ; Medusa uses DA
]
|
; this merge bumps the RMA up, compress it again just in case.
MOV R0,#1
MOV R1,#-&10000000 ; try and shrink RMA
SWI XOS_ChangeDynamicArea
CLRV ; may cause an error, but ok.
end_iconspr
;
Pull "R12,PC"
]
05
Push "R0"
[ true ; don't send error back
LDR R0,[R0]
LDR R14,=ErrorNumber_WimpBadSprites
TEQ R0,R14 ; not really an error!
CLRV EQ
]
Pull "R0,R12,PC"
;............................................................................
......@@ -1204,6 +1220,14 @@ int_merge_sprites
MOVVC R3,R4 ; extend by enough to cover new file
BLVC allocatespritememory
STRVC R2,baseofsprites ; do this now just in case !!!
[ SpritePriority
BVS %FT06
LDR R1, preferredpool
TEQ R1, #0 ; preserves V
STREQ R2, baseofhisprites
STRNE R2, baseoflosprites
06
]
DebugE spr,"Extending sprite block"
[ debugspr
......@@ -1254,6 +1278,14 @@ int_merge_sprites
MOVVC R0,#ModHandReason_ExtendBlock
BLVC allocatespritememory
STRVC R2,baseofsprites
[ SpritePriority
BVS %FT06
LDR R1, preferredpool
TEQ R1, #0 ; preserves V
STREQ R2, baseofhisprites
STRNE R2, baseoflosprites
06
]
[ debugspr
BVS %FT55
Debug spr,"baseofsprites (2) ",r2
......@@ -1443,6 +1475,12 @@ gotwork
ADDVC R0,R2,R2,ASL #2 ; R0*5
MOVVC R0,R0,ASL #1 ; R0*10
STR R0,menudragdelay
;
[ SpritePriority
MOV R0,#ReadCMOS
MOV R0,#1 ; ie ROM has priority - will need to add CMOS read stuff when allocated
STR R0,preferredpool
]
;
ADRL R14,paltable ; initialise palette
ADR R11,emergencypalette
......@@ -1458,6 +1496,12 @@ gotwork
BL allocatespritememory
MOVVS R2,#nullptr
STR R2,baseofsprites ; NB this is null if error occurs
[ SpritePriority
LDR R1, preferredpool
TEQ R1, #0 ; preserves V
STREQ R2, baseofhisprites
STRNE R2, baseoflosprites
]
STRVC R3,[R2,#saEnd]
STRVC R3,[R2,#saFirst]
STRVC R3,[R2,#saFree]
......@@ -1500,6 +1544,9 @@ gotwork
[ NewErrorSystem
STR R0,watchdogarea ; 'watchdog' isn't active
]
[ StretchErrorText
STR R0,linecount
]
STR R0,wimpswiintercept
STR R0,plotsprCB
[ PoppingIconBar
......@@ -1854,8 +1901,19 @@ getromsprites
;
AND R2,R2,#&FF
TEQ R2,#fsnumber_resourcefs
[ SpritePriority
BNE %FT06
SUB R2,R1,#4 ; R2 -> sprite area (including size)
STR R2,baseofromsprites
LDR R1, preferredpool
TEQ R1, #0 ; preserves V
STREQ R2, baseoflosprites
STRNE R2, baseofhisprites
06
|
SUBEQ R2,R1,#4 ; R2 -> sprite area (including size)
STREQ R2,baseofromsprites
]
;
MOV R0,#0
MOV R1,R3
......@@ -1873,7 +1931,13 @@ loseromsprites
Debug ub,"lose ROM sprites"
ADRL R14,romsprites
STR R14,baseofromsprites
Pull "PC"
[ SpritePriority
LDR R1, preferredpool
TEQ R1, #0 ; preserves V
STREQ R14, baseoflosprites
STRNE R14, baseofhisprites
]
Pull "R1,PC"
; Service_ModeChange: cache new graphics parameters
......@@ -2005,7 +2069,9 @@ ChangeEnvCode
UpCallCode ROUT
TEQ R0,#UpCall_MediaSearchEnd
BEQ finishupcall ; this comes round if it works!
BEQ finishupcall ; this comes round if it works!
TEQ R0,#UpCall_MediaSearchEndMessage
BEQ finishupcall_withmessage ; this comes round if it works!
TEQ R0,#UpCall_MediaNotPresent
TEQNE R0,#UpCall_MediaNotKnown
......@@ -2060,7 +2126,7 @@ UpCallCode ROUT
MOV R14,#0 ; error number
STR R14,[R2],#4
;
ADR R0,ensuredisc ; "Please insert %0 '%1'"
ADRL R0,ensuredisc ; "Please insert %0 '%1'"
MOV R4,R6 ; media type
;
BL LookupToken ; resolve into suitable string
......@@ -2068,12 +2134,28 @@ UpCallCode ROUT
B %05
04
;Just use the message provided (copied into the same buffer)
[ false
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
|
ADRL r2, errorbuffer
ADD r3, r2, #251 ;r3 holds the end address of the error buffer
ADD r2, r2, #4 ;don't care about error number
06 LDRB lr, [r6], #1 ;read from given message
TEQ lr, #0 ;NUL-terminated
TEQNE lr, #10 ;test for end of line searching too far
TEQNE lr, #13 ;test for cr
TEQNE r2, r3 ;test end of buffer
STRNEB lr, [r2], #1 ;write to error buffer
BNE %06
MOV lr, #0 ;ensure always NUL-terminated
STRB lr, [r2]
]
05
Pull "R2-R5"
......@@ -2112,6 +2194,35 @@ finishupcall
;
Pull "R0-R1,PC",,^ ; claim vector
finishupcall_withmessage
Push "R0-R3"
;
;Just use the message provided (copied into the same buffer)
ADRL r2, errorbuffer
ADD r3, r2, #251 ;r3 holds the end address of the error buffer
ADD r2, r2, #4 ;don't care about error number
01 LDRB lr, [r1], #1 ;read from given message
TEQ lr, #0 ;NUL-terminated
TEQNE lr, #10 ;test for end of line searching too far
TEQNE lr, #13 ;test for cr
TEQNE r2, r3 ;test end of buffer
STRNEB lr, [r2], #1 ;write to error buffer
BNE %01
MOV lr, #0 ;ensure always NUL-terminated
STRB lr, [r2]
ADRL R0, errorbuffer
SUB R0, r2, r0
Debug temp,"string size",R0
ADRL R0, errorbuffer
MOV R1,#erf_okbox:OR:erf_poll ; Draw the Box
SWI XWimp_ReportError
MOV R1,#erf_okbox:OR:erf_pollexit ; Request the Box Removed
SWI XWimp_ReportError
;
Pull "R0-R3,PC",,^ ; claim vector
messagefrom DCB "MF", 0
ensuredisc DCB "ID",0 ; followed by media type (eg. 'disc')
disc DCB "disc", 0 ; cheat
......@@ -2467,10 +2578,6 @@ sz_scrbot2 * 0
sz_scrbot * 0 ; was 96 (to allow for icon bar)
sz_scrtop * 1024
[ AutoHourglass
hourglass_delay * 33 ; delay before showing hourglass for "dodgy apps" in 1/100 secs
]
; contents of task word if task is dead
......@@ -2685,6 +2792,7 @@ continueflag # 1 ; for changing extent while dragging
;fpemulator_flag # 1
iconbar_needs_rs # 1
reentrancyflag # 1
old_escape # 1
ALIGNHASH 4
......@@ -2720,7 +2828,7 @@ drg_on * dragsubr_on - dragwsptr
drg_off * dragsubr_off - dragwsptr
drg_move * dragsubr_move - dragwsptr
ALIGN 16
ALIGNHASH 16 ; missing HASH! JRC 25 Jul 1997
clipx0 # 4
clipy0 # 4
clipx1 # 4
......@@ -2770,8 +2878,10 @@ backwindowhandle # 4 ; handle of 'new' bg window
commandhandle # 4 ; handle of 'command' window
commandflag # 4 ; is a command window pending?
[ :LNOT: NewErrorSystem
highlighted_colour # 4 ; colour of OK box initially
unhighlighted_colour # 4 ; colour of Cancel box initially
]
iconbarhandle # 4
iconbarheight # 4
......@@ -2851,7 +2961,12 @@ currentfg # 4 ; its foreground colour
currentoffset # 4 ; its colour offset
]
baseofsprites # 4 ; base of common sprite pool (in RMA)
[ SpritePriority
preferredpool # 4 ; 1 => ROM, 0 => RAM
baseoflosprites # 4 ; base of low priority common sprite pool
baseofhisprites # 4 ; base of high priority common sprite pool
]
baseofsprites # 4 ; base of common sprite pool (in RAM)
oldCAOpointer # 4 ; used in OS_ChangeDynamicArea
handlerword # 4 ; flag word ==> has handler changed?
......@@ -3144,17 +3259,42 @@ lastxpos # 4 ; stop mouse highlighting menus unless i
lastypos # 4
]
[ AutoHourglass
hourglass_delay * 100 ; delay before showing hourglass for "dodgy apps", in 1/100 secs
hourglass_status # 4 ; autohourglass status (0 => no hourglass or WrchV routine, 1 => just routine,
] ; 2 => routine is on vector & hourglass is pending or active)
ALIGNHASH 64
[ NewErrorSystem
errortitle # 200 ; for building up 'Error from ...'
errortitle # 256 ; for building up 'Error from ...'
errortitend # 0
errorbuttonsize * 64
errorbuttonsize * 256
errorbuttons # errorbuttonsize ; this is used to copy button labels
buttontextsize * 24
oktext # 0 ; SMC: now lookup text for buttons (OK same as Continue)
conttext # buttontextsize
quittext # buttontextsize
progerrsaveblk # 4 * 4 ; caller R0-R3, stored while the "may have gone wrong" window is displayed
errbut_y0_def # 4 ; bottom of default action button, read from "Continue"
errbut_y1_def # 4 ; top of default action button, read from "Continue"
errbut_fl_def # 4 ; icon flags of default action button, read from "Continue"
errbut_va_def # 4 ; validation string of default action button, read from "Continue"
errbut_w_def # 4 ; width of default action button, read from "Continue"
errbut_y0 # 4 ; bottom of action button, read from "Cancel"
errbut_y1 # 4 ; top of action button, read from "Cancel"
errbut_fl # 4 ; icon flags of action button, read from "Cancel"
errbut_va # 4 ; validation string of action button, read from "Cancel"
errbut_w # 4 ; width of action button, read from "Cancel"
errapp_x0 # 4 ; LHS of application sprite
errtype_x0 # 4 ; LHS of error type sprite
errmess_x0 # 4 ; LHS of error message icon
[ StretchErrorText
linecount # 4 ; flags counting and returns number of lines required for error message
errmess_maxlines * 7 ; maximum number of lines to allow for error message
errmess_increment * 48 ; step size (in OS units) to increase error box size by when enlarging
]
maxno_error_buttons * 8 ; maximum number of action buttons (needs this many Additional buttons in template)
|
errortitle # 128 ; old versions have smaller template file
errortitend # 0
......@@ -3249,6 +3389,7 @@ fontnamebuffer # 60 ; used to store last ROM font.
iconbar_pop_previous # 4 ; where to go back to
]
[ DebugMemory
memory_claims # 8 ; build a list of mem claims for debugging
]
......@@ -3419,7 +3560,9 @@ w_cw1 # 0 ; end of Create_Window section
w_size # 0 ; end of window data
[ ChildWindows
ASSERT (w_old_end - w_old_data) = (w_new_end - w_new_data)
]
; bit masks for flags/status
......@@ -4056,7 +4199,12 @@ SWIWimp_ReadSysInfo
B sysinfo_messages ; 12= message queue
B sysinfo_memclaim ; 13= list of memory claims
B sysinfo_transtables
B sysinfo_IconiseButton
B err_badR0
[ SpritePriority
B sysinfo_baseofsprites ; 16 = low/high priority sprite areas
|
B err_badR0
]
err_badR0
MyXError WimpBadSysInfo
......@@ -4163,13 +4311,13 @@ sysinfo_transtables
STMIA sp,{R1-R2}
B ExitWimp
sysinfo_IconiseButton
[ IconiseButton
LDR R0,iconise_width
|
MOV R0,#0
]
[ SpritePriority
sysinfo_baseofsprites
LDR R0, baseoflosprites
LDR R1, baseofhisprites
STR R1, [sp]
B ExitWimp
]
;;-----------------------------------------------------------------------------
;; Command Window handling
......@@ -4405,12 +4553,6 @@ mywrch
MOV R14,#cf_active
STR R14,commandflag
[ Version >= 394 :LAND: AutoHourglass
SWI XHourglass_Smash ; the easy option for consistent behaviour
CLRV
Debug autohg,"Hourglass_Smash at CommandWindow start"
]
; optimisation - if first char is 22 (mode change),
; don't bother about window cos it'll be overwritten anyway
......@@ -5786,11 +5928,29 @@ WimpKillSprite_Code
STR R0,lengthflags
MOV R0,#25 ; delete sprite
BL wimp_SpriteOp
[ windowsprite
MOVVC R0,#-1
STRVC R0,tiling_sprite
]
BLVC freelist ; mark list invalid
[ false
BVS %FT02
MOV R14,#ms_data ; message block size
STR R14,[sp,#-ms_data]!
MOV R14,#0 ; your_ref
STR R14,[sp,#ms_yourref]
LDR R14,=Message_IconsChanged
STR R14,[sp,#ms_action]
MOV R0,#User_Message
MOV R1,sp
MOV R2,#0 ; broadcast message
BL int_sendmessage_fromwimp
ADD sp,sp,#ms_data
CLRV ; ignore errors
02
]
Pull "r12,PC"
END
......@@ -195,14 +195,9 @@ taskidentifier2 DCB "TASK"
initfirsttask
Push "R0-R3"
[ Version >= 394 :LAND: AutoHourglass
Push "R0"
BL pointeron
MOV R0,#1
SWI XHourglass_Start
CLRV
Pull "R0"
Debug autohg,"Hourglass_Start at initfirsttask"
[ AutoHourglass
MOV R0, #0
STR R0, hourglass_status ; note that autohourglass is initially switched off
]
;
[ true
......@@ -427,6 +422,48 @@ initfirsttask
STRVC R0,errorhandle
BVS exitinit
;
[ NewErrorSystem
LDR R14, [handle, #w_icons] ; read important values from the template before they get corrupted
ADD R3, R14, #i_size * 1 ; use Continue button as template for default (aka "highligted") buttons
LDR R2, [R3, #i_bby0]
STR R2, errbut_y0_def
LDR R2, [R3, #i_bby1]
STR R2, errbut_y1_def
LDR R2, [R3, #i_flags]
BIC R2, R2, #is_inverted :OR: is_deleted
STR R2, errbut_fl_def
LDR R2, [R3, #i_data + 4]
STR R2, errbut_va_def
LDR R2, [R3, #i_bbx0]
LDR R3, [R3, #i_bbx1]
SUB R2, R3, R2
STR R2, errbut_w_def
ADD R3, R14, #i_size * 4 ; use Cancel button as template for other buttons
LDR R2, [R3, #i_bby0]
STR R2, errbut_y0
LDR R2, [R3, #i_bby1]
STR R2, errbut_y1
LDR R2, [R3, #i_flags]
BIC R2, R2, #is_inverted :OR: is_deleted
STR R2, errbut_fl
LDR R2, [R3, #i_data + 4]
STR R2, errbut_va
LDR R2, [R3, #i_bbx0]
LDR R3, [R3, #i_bbx1]
SUB R2, R3, R2
STR R2, errbut_w
LDR R2, [R14, #i_size * 2 + i_bbx0] ; remember distance app sprite is in from the side
STR R2, errapp_x0
LDR R2, [R14, #i_size * 3 + i_bbx0] ; remember distance error type sprite is in from the side
STR R2, errtype_x0
LDR R2, [R14, #i_size * 0 + i_bbx0] ; remember distance error message is in from the side
STR R2, errmess_x0
|
LDR R14,[handle,#w_icons]
LDR R14,[R14,#1*i_size+i_flags] ; OK box
AND R14,R14,#if_fcol:OR:if_bcol
......@@ -435,6 +472,7 @@ initfirsttask
LDR R14, [R14, #4*i_size+i_flags] ; Cancel box
AND R14,R14,#if_fcol:OR:if_bcol
STR R14,unhighlighted_colour
]
01
LDR R0,commandhandle
CMP R0,#0
......@@ -1878,7 +1916,7 @@ closedown
;
LDR R5,taskidentifier
TEQ R1,R5 ; R1="TASK" ==> use R0 as task handle
BEQ %FT01
BEQ %FT01 ; note, R1 = 0 if called due to initialisation
;
LDR R5,taskhandle ; close down current task
LDR R6,[wsptr,R5]
......@@ -1889,6 +1927,8 @@ closedown
ORR R2,R5,R14,LSL #flag_versionbit
B %FT02
01
MOV R2,#0 ; ensure <> "TASK"
STR R2,[sp,# 0*4 + 4] ; store in stack, to be returned in R1
MOV R2,R0 ; R2 = external task handle (see below)
BL validtask_alive ; R5 = internal task handle if OK
Pull "PC",VS,^ ; assume task deleted if invalid
......@@ -1972,14 +2012,6 @@ closelast
ADRL R1,UpCallCode
BL release
;
[ Version >= 394 :LAND: AutoHourglass
Push "R0"
SWI XHourglass_Smash
CLRV
Pull "R0"
Debug autohg,"Hourglass_Smash at closelast"
]
[ Version >= 317
[ mousecache
MOV R0,#TickerV ; tidy the mouse handler
......@@ -2898,6 +2930,8 @@ SWIWimp_ForceRedraw
[ ChildWindows
LDR R14,taskidentifier
TEQ R1,R14 ; watch out for the 'special' value
MOVEQ R14,#0 ; ensure <> "TASK"
STREQ R14,[sp,#0*4] ; and store where it will be reloaded into R1
BEQ force_redraw_special
]
......@@ -3615,6 +3649,11 @@ SWIWimp_OpenWindow
MyEntry "Open_Window"
[ ChildWindows
LDR R14,openidentifier1
TEQ R2,R14 ; watch out for the 'special' value
MOVEQ R14,#0 ; ensure <> "TASK"
STREQ R14,[sp,#1*4] ; and store where it will be reloaded into R2
CMP userblk,#0 ; If R1=0 or -1 on entry, just flush the pending opens
CMPNE userblk,#nullptr
BEQ doflush
......@@ -3672,7 +3711,11 @@ int_open_window
Push "handle"
MOV handle,R3
[ false
BL checkhandle_iconbar ; yes, you can open windows inside the iconbar!
|
BL checkhandle ; no, you can't any more
]
MOVVC R3,handle
Pull "handle"
Pull "PC",VS
......@@ -4253,6 +4296,150 @@ dontforceit
ADRL R4,activewinds+lh_forwards-ll_forwards
]
;
; Deal with layering and special bhandles
;
[ ForegroundWindows :LAND: ChildWindows
Push "R4"
Push "x0, x1, handle"
; Determine type of opening window
LDR R14, [handle, #w_flags]
TST R14, #wf_backwindow
MOVNE x0, #2
MOVEQ x0, #1
TST r14, #wf_inborder
MOVNE x0, #0
; Determine type of window-to-open-behind
LDR handle, [userblk, #u_bhandle]
CMP handle, #nullptr ; -1
MOVEQ x1, #3
BEQ %FT01
CMP handle, #nullptr2 ; -2
MOVEQ x1, #4
BEQ %FT01
CMP handle, #-3
MOVEQ x1, #5
BEQ %FT01
BL checkhandle ; handle must be open, and have the same parent
LDRVC R14, [handle, #w_flags]
TST R14, #wf_backwindow
MOVNE x1, #2
MOVEQ x1, #1
TST R14, #wf_inborder
MOVNE x1, #0
TST R14, #ws_open
SETV EQ
[ ChildWindows
LDRVC R14, [handle, #w_parent]
LDRVC R0, newparent
TEQVC R0, R14
SETV NE
]
ADDVC R4, handle, #w_active_link
MOVVS x1, #4
CLRV
01
TEQ x0, x1 ; if matching window types, open directly behind
Pull "x0, x1, handle", EQ
ADDEQ sp, sp, #4 ; use the R4 calculated from u_bhandle
BEQ openwlp3end
ADD x0, x0, x1, LSL#2 ; look up which method to determine where to open window
ADR R0, openwlp3_lookuptable
LDRB x0, [R0, x0]
ADR R0, openwlp3_jumptable
ADD R0, R0, x0, LSL#2
Pull "x0, x1, handle"
Pull "R4" ; use top-of-stack R4
ADR R14, openwlp3end ; where to return control to
MOV PC, R0
openwlp3_lookuptable
; fg std bg
DCB 0, 1, 2, 0 ; opened behind a fg window
DCB 1, 0, 2, 0 ; opened behind a std window
DCB 1, 2, 0, 0 ; opened behind a bg window
DCB 0, 1, 2, 0 ; opened behind -1
DCB 1, 2, 2, 0 ; opened behind -2 (or invalid handle not in range -1 - -3)
DCB 3, 3, 3, 0 ; opened behind -3
; backwindows opened behind -2 must use method 2 for compatibility reasons
openwlp3_jumptable
B openwlp3end ; method 0 - already set up for open-at-top-of-foreground
B openwlp3_skip_foreground ; method 1
B openwlp3_skip_standard ; method 2
B openwlp3_skip_to_bottom ; method 3
openwlp3_skip_to_bottom
Push "R14"
;
; R0->next window down stack, R14=its forwards pointer which is also lh_indicator for list headers
;
01 LDR R0,[R4,#ll_forwards]
LDR R14,[R0,#ll_forwards]
;
; Hit bottom of stack (next window is list header)
;
CMP R14,#nullptr
Pull "PC", EQ
;
; Move down below to next window
;
MOV R4,R0
B %BT01
openwlp3_skip_standard
Push "R14"
BL openwlp3_skip_foreground
;
; R0->next window down stack, R14=its forwards pointer which is also lh_indicator for list headers
;
01 LDR R0,[R4,#ll_forwards]
LDR R14,[R0,#ll_forwards]
;
; Hit bottom of stack (next window is list header)
;
CMP R14,#nullptr
Pull "PC", EQ
;
; Is next window a background window?
;
LDR R14,[R0,#w_flags-w_active_link]
TST R14,#wf_backwindow
Pull "PC", NE
;
; Next window is still a normal window, move down below to that
;
MOV R4,R0
B %BT01
openwlp3_skip_foreground
Push "R14"
;
; R0->next window down stack, R14=its forwards pointer which is also lh_indicator for list headers
;
01 LDR R0,[R4,#ll_forwards]
LDR R14,[R0,#ll_forwards]
;
; Hit bottom of stack (next window is list header)
;
CMP R14,#nullptr
Pull "PC", EQ
;
; Is next window a non-foreground window?
;
LDR R14,[R0,#w_flags-w_active_link]
TST R14,#wf_inborder
Pull "PC", EQ
;
; Next window is still a foreground window, move down below to that
;
MOV R4,R0
B %BT01
| ; :LNOT: ForegroundWindows
; Check handle for being 'On top'
Push "handle"
......@@ -4316,6 +4503,8 @@ openwlp3
MOV R4,R0
B openwlp3
] ; end ForegroundWindows
openwlp3end
; R4 -> window link to insert our window forwards of.
......@@ -4546,7 +4735,16 @@ int_flush_opens ROUT
LDR handle,openingwinds+lh_forwards
10 LDR R14,[handle,#ll_forwards]
10
; [ debugopn
; Push "R0,R14,handle"
; SUB handle, handle, #w_opening_link
; LDR R14,[handle,#w_flags]
; LDR R0,[handle,#w_old_flags]
; Debug opn, "int_flush_opens: handle, old/new flags:", handle, R0, R14
; Pull "R0,R14,handle"
; ]
LDR R14,[handle,#ll_forwards]
CMP R14,#nullptr
MOVNE R14,#0
STRNE R14,[handle,#w_xoffset - w_opening_link]
......@@ -4622,6 +4820,7 @@ int_flush_opens ROUT
ASSERT (w_old_end - w_old_parent ) = 13*4
ASSERT handle = R10
; Debug opn, "Copying new data to old for held-over handle", handle
ADD R14,handle,#w_parent ; copy from new data to old
ADD R9, handle,#w_old_parent
LDMIA R14!,{R0-R6}
......@@ -4640,13 +4839,18 @@ int_flush_opens ROUT
LDR handle,openingwinds + lh_forwards
03 LDR R14,[handle,#w_opening_link + ll_forwards]
03 LDR R14,[handle, #ll_forwards] ; BJGA: *not* #w_opening_link + ll_forwards !!
CMP R14,#nullptr
BEQ %FT04
ASSERT (w_old_end - w_old_parent ) = 13*4
ASSERT handle = R10
; [ debugopn
; SUB handle, handle, #w_opening_link
; Debug opn, "Copying new data to old for opening handle", handle
; ADD handle, handle, #w_opening_link
; ]
ADD R14,handle,#w_parent - w_opening_link ; copy from new data to old
ADD R9, handle,#w_old_parent - w_opening_link
LDMIA R14!,{R0-R6}
......@@ -4662,7 +4866,7 @@ int_flush_opens ROUT
04
; Debug opn,"**** copy_new_links_to_old for activewinds"
ADRL R0,activewinds
[ STB
[ true ; was STB
ADRL R1,oldactivewinds
|
ADR R1,oldactivewinds
......@@ -5153,8 +5357,11 @@ int_flush_open ROUT
LDR R14,[handle,#w_flags]
LDR R0,[handle,#w_old_flags]
; Debug opn, "int_flush_open: old/new flags:", R0, R14
AND R14,R0,R14
TST R14,#ws_open
; DebugIf NE, opn, "int_flush_open: handle staying open:", handle
; DebugIf EQ, opn, "int_flush_open: handle NOT staying open:", handle
BLEQ invalidate_oldnew
BEQ %FT80
......@@ -5378,6 +5585,7 @@ int_flush_open ROUT
LDR R14,rlinks + oldwindowrects
STR R14,[handle,#w_oldwindowrects]
; Debug opn, "rlinks_oldwindowrects copied to [handle,#w_oldwindowrects] :", R14
MOV R14,#nullptr
STR R14,rlinks + oldwindowrects
;
......@@ -5726,6 +5934,7 @@ int_blockcopy_all
SetRectPtrs
blcopynext_outer
; Debug opn,"blcopynext_outer" ;
MOV R14,#nullptr
STR R14,oldlink ; no rectangles to get rid of so far
......@@ -5733,6 +5942,7 @@ blcopynext_outer
LDR R2,openingwinds + lh_forwards
blcopynext_window
; Debug opn,"blcopynext_window" ;
LDR R14,[R2,#ll_forwards]
CMP R14,#nullptr
......@@ -5742,6 +5952,7 @@ blcopynext_window
SUB R1,R1,rectlinks ; bodge so [rectlinks,R1] -> next rectangle
blcopynext
; Debug opn,"blcopynext" ;
MOV R14,R1
LDR R1,[rectlinks,R1]
CMP R1,#nullptr
......@@ -5770,6 +5981,7 @@ blcopynext
LDR x0,openingwinds + lh_forwards
blcopynext_inner
; Debug opn,"blcopynext_inner" ;
LDR R14,[x0,#ll_forwards]
CMP R14,#nullptr
......@@ -5817,6 +6029,7 @@ blcopynext_inner
; block-copy the rectangle
goblockcopy
; Debug opn,"goblockcopy" ;
LDR R0,xoffset
CMP R0,#0
LDR R14,yoffset
......@@ -5859,6 +6072,7 @@ goblockcopy
LDR R2,oldlink
noblockcopy
; Debug opn,"noblockcopy" ;
LDR R1,[rectlinks,R2]
Debug opn,"Free old/rectangle",R2,R1
......@@ -5874,6 +6088,7 @@ noblockcopy
; got to the end of a window - if it had no rectangles, remove it from the list (speeds up the inner loop)
blcopyend
; Debug opn,"blcopyend" ;
LDR R14,[R2,#w_oldwindowrects - w_opening_link]
CMP R14,#nullptr
......@@ -6165,8 +6380,10 @@ int_close_window
;
; NB: set window's parent to -1 (must do this in case the parent is later deleted)
;
[ ChildWindows
MOV R14,#nullptr
STR R14,[handle,#w_parent]
]
;
; mark window as closed, and not top
;
......@@ -6311,11 +6528,9 @@ int_redraw_window
;
; go through appropriate rectangles, drawing the window outline
;
;
; *** AWOOGA! AWOOGA! The Filter Manager will currently expect to find handle at this position
; on the stack - if you change this, arrange for the handle to be in a register and change the
; Filter Manager accordingly.
;
; ***
; *** AWOOGA! AWOOGA! Filter Managers <0.19 will expect to find handle at this position on the stack
; ***
Push "userblk,handle"
;
MOV R1,#windowrects
......@@ -6326,12 +6541,12 @@ redrawoutlp
Debug child,"Redrawing rectangle",x0,y0,x1,y1
pullx "userblk,handle" ; used to be after BL forcedrag_off
CallFilter rectanglefilter
BL graphicswindow
BL forcedrag_off ; remove drag box while updating
;
pullx "userblk,handle"
Push "R1"
;
; set work area background colour and draw it
......@@ -7793,6 +8008,7 @@ igr_nochocupdate
; call the rectangle processing filter
LDR handle, [sp, #0*4] ; R10 = window handle (absolute)
CallFilter rectanglefilter
getrectend
......
......@@ -290,19 +290,7 @@ SWIWimp_Poll
01
MyEntry "Poll"
[ Version >= 394 :LAND: AutoHourglass
Push "R0"
SWI XHourglass_Off
CLRV
Pull "R0"
[ debugautohg
Push "handle"
LDR handle,taskhandle
Debug autohg,"Hourglass_Off at Wimp_Poll start, taskhandle =",handle
Pull "handle"
]
]
;
; remember task number, to allow optimisation of return to caller
;
; Entry: R0 = flag word
......@@ -316,6 +304,21 @@ SWIWimp_Poll
CallFilter prefilter
;
[ AutoHourglass ; it could still be a while until the next task switch,
LDR R1, hourglass_status ; so ensure the hourglass is off at this point
[ debugautohg
Push "handle"
LDR handle, taskhandle
Debug autohg, "Hourglass_Off at Wimp_Poll entry: taskhandle, old status =", handle, R1
Pull "handle"
]
TEQ R1, #2 ; is hourglass still pending or active?
MOVEQ R1, #1 ; yes, so turn off hourglass (but keep on vector for speed reasons)
STREQ R1, hourglass_status
SWIEQ XHourglass_Off
CLRV ; ignore errors
]
LDR R1,taskhandle
LDR R4,[wsptr,R1] ; R4 = task data pointer
TST R4,#task_unused ; if task not used, it's been deleted
......@@ -3015,7 +3018,7 @@ wicon_quit
Pull "r0-r4",NE
BNE not_alt
[ Version >= 393
[ Version >= 393 :LAND: IconiseButton
20
; Send a Message_IconizeAt (RML)
Push "r0-r4"
......@@ -3027,20 +3030,27 @@ wicon_quit
STR r0, [sp, #36]
MOV r1, sp
[ true
LDR r0, mousexpos
STR r0, [r1,#ms_data+8]
LDR r0, mouseypos
SUB r0, r0, #(32+17)
STR r0, [r1,#ms_data+12]
|
SWI Wimp_GetPointerInfo
LDR r0, [r1]
STR r0, [r1, #28] ; x co-ord
LDR r0, [r1, #4]
SUB r0, r0, #(32+17)
STR r0, [r1, #32] ; y co-ord
]
MOV r0, #40
STR r0, [r1] ; size
STR r0, [r1,#ms_size] ; size
MOV r0, #0
STR r0, [r1, #12] ; your ref
STR r0, [r1, #ms_yourref] ; your ref
LDR r0, =Message_IconizeAt ; (Message number 22)
STR r0, [r1, #16] ; message action
STR r3, [r1, #20] ; window handle
STR r0, [r1, #ms_action] ; message action
STR r3, [r1, #ms_data+0] ; window handle
; Work out task handle
LDR r2, taskhandle
......@@ -3049,11 +3059,11 @@ wicon_quit
LDREQ r4, [r4, #task_flagword]
MOVEQ r4, r4, LSR #flag_versionbit
ORREQ r2, r2, r4, LSL #flag_versionbit
STR r2, [r1, #24]
STR r2, [r1, #ms_data+4]
MOV r0, #User_Message
MOV r2, #0
SWI Wimp_SendMessage
BL int_sendmessage_fromwimp
ADD sp, sp, #48
Pull "r0-r4"
......
......@@ -1216,6 +1216,7 @@ icontext_paint
Trace menuw, "icontext: painting string ", S, R1
ADD R3,R3,#2 ; KJB - attempt to nobble it a bit
ADDNE R3,R3,#12 ; BJGA - attempt to fix right-to-left printing
SWI XFont_Paint ; then paint the string
[ BlendedFonts
......@@ -1321,6 +1322,7 @@ plotcxy1
; R2 --> text string
; x0,y0,x1,y1 = coordinates of surrounding box
; [linespacing] = amount to leave between lines
; Exit: R1-R4, PC pulled from stack
iconformatted TraceL L40
ASSERT x0=R6 ; can't use R6..R9
......@@ -1344,6 +1346,15 @@ iconformatted TraceL L40
BNE iconformatted_fancy
]
; draw, or return info on, formatted system font text
; Entry: R1 = icon flags
; R2 -> text string
; x0-y1 = icon bounding box
; [linespacing] = distance between baselines
; [linecount] <> 0 => just return number of lines required
; Exit: if returning number, R0-R5, R10, R14 corrupted, [linecount] contains line count, PC pulled from stack
; else: R5, R6, R10, R1-R4, PC pulled from stack
iconformatted_system TraceL L40
MOV R0,R2
; R0 -> string
......@@ -1391,6 +1402,14 @@ iconformatted_length
ADDHI R5,R5,R14
BHI iconformatted_skip_spaces
[ StretchErrorText
LDR R3, linecount
TEQ R3, #0
STRNE R10, linecount ; store the number of lines required
ADDNE sp, sp, R10, LSL#3 ; skip line markers on stack
Pull "PC", NE
]
; R5 = height of text in OSU
; R10 = no of lines
; on stack are pairs [addr,size] of strings (last one on top)
......@@ -1434,12 +1453,17 @@ iconformatted_system_done
Pull "R1-R4,PC"
[ outlinefont
iconformatted_fancy TraceL L40
; draw, or return info on, formatted outline font text
; Entry: R1 = icon flags
; R2 -> string to paint
; R3 = font handle
; ((R6, R7), (R8, R9)) = icon bbox
; [linespacing] = distance between baselines
; [linecount] <> 0 => just return number of lines required
; Exit: if returning number, R0-R6, R10, R14 corrupted, [linecount] contains line count, PC pulled from stack
; else: R5, R6, R10, R1-R4, PC pulled from stack
; R1 = icon flags
; R2 -> string to paint
; R3 = font handle
; ((R6, R7), (R8, R9)) = icon bbox
iconformatted_fancy TraceL L40
TraceK L40, "iconformatted: icon bbox is (("
TraceD L40, R6
......@@ -1513,6 +1537,16 @@ iconformatted_fancy_next_pass
BEQ iconformatted_fancy_first_pass
; R11 = number of lines formatted
[ StretchErrorText
LDR R0, linecount
TEQ R0, #0
BEQ %FT06
STR R11, linecount
ADD sp, sp, R10 ; balance stack after pushfontstring
Pull "R7-R9, R11, PC" ; exit with number of lines required in [linecount]
06
]
LDR R0, linespacing
MUL R11, R0, R11
......@@ -2423,7 +2457,7 @@ cachespritedata
MOV R5,#(1:SHL:0)
]
;
; we must now attempt to cope with the dilema of sorting out the correct
; we must now attempt to cope with the dilemma of sorting out the correct
; mapping table for the sprite.
;
; in earlier versions of the Window Manager it made no attempt to cope
......@@ -2436,8 +2470,15 @@ cachespritedata
CMP R14,#3 ; is it 8,16 or 32BPP?
CMPLT R7,#(spPalette+4) ; or does it have a palette?
LDRGE R0,baseofsprites ; 320nk Medusa fix
BGE %FT10
BLT %FT02
LDR R0,baseofromsprites ; might have 8+ bpp sprites in ROM now
LDR R4,[R0,#0]
ADD R4,R0,R4 ; R4 -> end of ROM sprite area
CMP R1,R0
CMPHS R4,R1 ; is sprite in ROM?
LDRLO R0,baseofsprites ; no, use RAM sprite area ; 320nk Medusa fix
B %FT10
;
; sprite is in a depth less than 8BPP so take the current palette and munge
; it based on the translation table defined in workspace
......@@ -2459,8 +2500,8 @@ cachespritedata
STR R2,pixtable_size
Pull "R3,R4"
EXIT
02
]
02
LDR R0,[R1,#spMode] ; R0 = mode of sprite
ADRL R1,temppaltable ; R1 -> temporary palette area
Push "R0-R3,R5"
......@@ -2598,9 +2639,15 @@ cachespriteaddress ROUT
EXIT
15
Debug sprite,"Looking in RMA"
[ SpritePriority
Debug sprite,"Looking in high-priority sprite area"
LDR R1,baseofhisprites
|
Debug sprite,"Looking in RAM"
LDR R1,baseofsprites ; R1 -> RAM based pool
]
BL checkforsprite
EXIT VC ; return if it has been found
......@@ -2609,9 +2656,15 @@ cachespriteaddress ROUT
TEQ R1,R2
BNE %FT25 ; if sprite not found then return R2 =0
[ SpritePriority
Debug sprite,"Looking in low-priority sprite area"
LDR R1,baseoflosprites
|
Debug sprite,"Looking in ROM"
LDR R1,baseofromsprites
]
20 BL checkforsprite
EXIT VC
......@@ -2620,7 +2673,11 @@ cachespriteaddress ROUT
TEQ LR,R2
BNE %FT25 ; if not then return with R2 =0
[ SpritePriority
LDR LR,baseoflosprites
|
LDR LR,baseofromsprites
]
TEQ LR,R1 ; Searching wimp areas?
BEQ %FT25 ; Yes then exit
......@@ -2904,14 +2961,22 @@ wimp_SpriteOp
ORRGE R0,R0,#&100 ; 1 ==> use common sprite pool
BNE %FT01
11
[ SpritePriority
LDR R1,baseofhisprites
|
LDR R1,baseofsprites ; common sprite pool is split in 2
]
MOV R11,R0
BL do_spriteop ; first try the RAM sprites
Pull "R1,R2,R11,PC",VC
LDR R14,[R0]
TEQ R14,#ErrorNumber_Sprite_DoesntExist ; preserves V
MOVEQ R0,R11
[ SpritePriority
LDREQ R1,baseoflosprites
|
LDREQ R1,baseofromsprites ; in resourcefs:
]
BLEQ do_spriteop ; then the ROM sprites
Pull "R1,R2,R11,PC"
01
......@@ -3005,6 +3070,42 @@ inversefunc ENTRY "R1-R4"
TST R12,#is_inverted ; Inverting?
BEQ %FT10 ; No then jump
[ UrsulaHighlighting ; New highlighting for Risc PC 2 release
TEQ R1,R2
TEQEQ R1,R3 ; grey ?
BEQ %FT20
MOV R0,R1,LSL #8 ; Convert to 16 bit fixed point
ADD R0,R0,#128
MOV R1,R2,LSL #8 ; Convert to 16 bit fixed point
ADD R1,R1,#128
MOV R2,R3,LSL #8 ; Convert to 16 bit fixed point
ADD R2,R2,#128
SWI XColourTrans_ConvertRGBToHSV ; R0->H, R1->S, R2->V
ADD R0,R0,#180:SHL:16
CMP R0,#360:SHL:16
SUBHI R0,R0,#360:SHL:16
SWI XColourTrans_ConvertHSVToRGB ; Form RGB
CMP R2,#1:SHL:16
MOVLO R3,R2, LSR #8 ; Convert to 8 bit
MOVHS R3, #255
CMP R1,#1:SHL:16
MOVLO R2,R1, LSR #8 ; Convert to 8 bit
MOVHS R2, #255
CMP R0,#1:SHL:16
MOVLO R1,R0, LSR #8 ; Convert to 8 bit
MOVHS R1, #255
20
RSB R1,R1,#255
RSB R2,R2,#255 ; make a negative
RSB R3,R3,#255
SUB R1,R1,R1,LSR #2
SUB R2,R2,R2,LSR #2 ; darken a little
SUB R3,R3,R3,LSR #2
|
TEQ R1,R2
TEQEQ R1,R3 ; grey ?
RSBEQ R1,R1,#255
......@@ -3039,13 +3140,14 @@ inversefunc ENTRY "R1-R4"
CMP R2,#1:SHL:16
MOVLO R3,R2, LSR #8 ; Convert to 8 bit
MOVHS R3, #255
CMP R2,#1:SHL:16
CMP R1,#1:SHL:16
MOVLO R2,R1, LSR #8 ; Convert to 8 bit
MOVHS R2, #255
CMP R2,#1:SHL:16
CMP R0,#1:SHL:16
MOVLO R1,R0, LSR #8 ; Convert to 8 bit
MOVHS R2, #255
MOVHS R1, #255
]
Debug inverse,"Inverted red,green,blue",R1,R2,R3
10 TST R12,#is_shaded ; Shaded?
......@@ -3469,6 +3571,8 @@ SWIWimp_GetWindowState
TEQ R2,R14
BNE ExitWimp
MOV R14,#0 ; ensure <> "TASK"
STR R14,[sp,#1*4] ; R2 on exit = 0
LDR R14,[handle,#w_parent]
CMP R14,#nullptr
Rel R14,R14,NE
......@@ -4682,7 +4786,7 @@ check8
;
; 2_1000 ==> x0 = cx1-vscroll_width , else cx0
; 2_0100 ==> y0 = cy1-title_height , else cy0
; 2_0010 ==> x1 = cx0 , else cx1
; 2_0010 ==> x1 = undefined , else cx1
; 2_0001 ==> y1 = cy0+hscroll_height, else cy0
;
......
......@@ -652,9 +652,11 @@ findcaret TraceL sc
BL findtextorigin ; cx1,cy1 = x,y coords
LDR R14,writeabledir
Push "x0"
LDR x0,[wsptr]
TST x0,#if_numeric
MOVNE R14,#0
Pull "x0"
TEQ R14,#0
SUBNE R14,cx1,x0
SUBNE cx1,x1,R14
......@@ -1148,7 +1150,14 @@ myFont_StringWidth
MOV R7,R5
MOV R4,R3
MOV R3,R2
[ true
LDR R2,writeabledir ;
TEQ R2,#0 ; This bit isn't ideal, but this stuff will all have to
MOV R2,#128 ; be rewritten anyway to cope with kerning
ORRNE R2,R2,#1<<10 ;
|
MOV R2,#128
]
SWI XFont_ScanString
MOV R2,R3
MOV R3,R4
......@@ -3352,6 +3361,22 @@ menu_checkforsprite ENTRY "R0-R6"
EXIT VS
07
[ SpritePriority
Push "R2"
CMP R1, #1 ; try any user area before either Wimp area
SETPSR V_bit, R0, EQ ; SETV will *not* do, it corrupts Z
MOVNE R0, #512+40 ; attempt to read sprite information
SWINE XOS_SpriteOp
MOVVS R0, #512+40
LDRVS R1, baseofhisprites
LDRVS R2, [SP]
SWIVS XOS_SpriteOp ; not there? try again within high-priority area
MOVVS R0, #512+40
LDRVS R1, baseoflosprites
LDRVS R2, [SP]
SWIVS XOS_SpriteOp ; not there? try again within low-priority area
Pull "R2" ; sprite op can stuff R2
|
TEQ R1,#1
LDREQ R1,baseofsprites ; area may be 1 from above
......@@ -3360,6 +3385,7 @@ menu_checkforsprite ENTRY "R0-R6"
LDRVS R1,baseofromsprites
MOVVS R0,#40+512
SWIVS XOS_SpriteOp
]
EXIT VS
; width in pixels now in R3, screen mode in R6
LDR R5,[SP,#8]
......
This diff is collapsed.
......@@ -112,7 +112,7 @@ makespritelist ENTRY "R0-R4,R8-R9"
;
25 LDR R0,baseofromsprites
LDR R1,[R0,#saFirst]
ADD R1,R1,R0 ; R1 -> start of RAM pool
ADD R1,R1,R0 ; R1 -> start of ROM pool
LDR R2,[R0,#saNumber] ; R2 = counter for number of sprites in area
;
Debug sprite,"ROM sprites; first, count =",R1,R2
......@@ -148,7 +148,11 @@ makespritelist ENTRY "R0-R4,R8-R9"
LDR R1,list_at ; start of list
SUB R0,R3,R1
MOV R0,R0,ASR #2 ; number of items in list
[ debugsprprior
ADRL R2,checkspritenames ; comparison routine
|
ADR R2,checkspritenames ; comparison routine
]
MOV R3,WsPtr
Debug sprite,"HeapSort: Items, At, Checker =",R0,R1,R2
......@@ -162,7 +166,11 @@ makespritelist ENTRY "R0-R4,R8-R9"
; same then we block the entire list back down assuming that the first name
; compared is the
[ SpritePriority
LDR R8,baseofhisprites
|
LDR R8,baseofsprites
]
LDR R9,[R8,#saEnd]
LDR R2,list_at ; start of the list to be scanned
......@@ -182,19 +190,81 @@ makespritelist ENTRY "R0-R4,R8-R9"
ADD R14,R0,#spName
DebugS sprite,"Duplicate:",R14,12
]
SUB R14,R0,R8 ; is first sprite in the RAM area?
SUB R14,R0,R8 ; is first sprite in the RAM low area? (or high-priority if SpritePriority true)
CMP R14,R9
ADDCC R2,R2,#4 ; advance past entry if inside the RAM area, otherwise copy next name over current
[ SpritePriority
LDR R4,[R2] ; note address of sprite being removed from list
]
MOV R0,R2 ; start to copy from
50 CMP R0,R3 ; have we finished yet?
SUBEQ R3,R3,#4
BEQ %BT40 ; looping until all copied (modify the end pointer as required)
BEQ %FT55 ; looping until all copied (modify the end pointer as required)
LDR R1,[R0,#4]
STR R1,[R0],#4 ; copy it down
B %BT50 ; loop until the list has been moved
55
[ SpritePriority
LDR R0, preferredpool
TEQ R0, #0
DebugIf EQ, sprprior, "RAM sprites preferred"
BEQ %BT40 ; don't do anything if RAM sprites have priority
Push "R8,R9"
LDR R8, baseofsprites ; see if the removed sprite was in the RAM sprite area
LDR R9, [R8, #saEnd]
SUB R0, R4, R8
CMP R0, R9
Pull "R8,R9", HS
[ debugsprprior
ADDHS R4, R4, #spName
DebugSIf HS, sprprior, "This removed sprite was not in RAM area: ", R4, 12
]
BHS %BT40 ; don't do anything if removed sprite wasn't in the RAM sprite area
Push "R2,R5"
LDR R5, [R4, #spNext] ; size of sprite (== amount to shift later pointers down by)
[ debugsprprior
Debug sprprior, "Deleting sprite from RAM area: addr, size =", R4, R5
ADD R4, R4, #spName
DebugS sprprior, "- name = ", R4, 12
SUB R4, R4, #spName
]
MOV R0, #512
ORR R0, R0, #25
MOV R1, R8
MOV R2, R4
SWI XOS_SpriteOp ; delete the unnecessary sprite
LDR R2, list_at ; go back to beginning of list
56 CMP R2, R3 ; have we finished yet?
Pull "R2,R5,R8,R9", EQ
BEQ %BT40 ; go back to check next pair of sprites
LDR R0, [R2]
SUB R1, R0, R8
CMP R1, R9
ADDHS R2, R2, #4
BHS %BT56 ; this sprite wasn't in the RAM area, so won't have been affected by the deletion
CMP R0, R4
ADDLO R2, R2, #4
BLO %BT56 ; this sprite was below the deleted sprite, so again no action is required
SUB R0, R0, R5
[ debugsprprior
ADD R0, R0, #spName
DebugS sprprior, "Realigned sprite:", R0, 12
SUB R0, R0, #spName
]
STR R0, [R2] ; move pointer down
ADD R2, R2, #4
B %BT56 ; check next pointer
|
B %BT40 ; go back to check next pair of sprites
]
60 MOV R0,#-1
STR R0,list_at ; flag as no valid list setup
STR R0,list_size
......
......@@ -1231,6 +1231,23 @@ modifytool_clicked
TST R14,#button_left+button_right
EXITS EQ ; if not start of press then ignore
; Unslab any slabbed-in action button
Push "R0-R2,handle"
LDR handle, border_windowselected
CMP handle, #nullptr
BEQ %FT01
LDR R0, border_iconselected
CMP R0, #nullptr
BLE %FT01
MOV R1, #0
MOV R2, #is_inverted
BL int_set_icon_state
MOV R0, #nullptr
STR R0, border_windowselected
STR R0, border_iconselected
01
Pull "R0-R2,handle"
ADRL R2,glyphs_selected
LDRB R2,[R2,R4]
TEQ R2,#0 ; is it possible for this glyph to have an alternate state?
......@@ -1320,6 +1337,9 @@ modifytool_release ENTRY "R4,handle"
STR R0,border_windowselected
;
BL invalidate_glyph ; ensure returned back to its original state
MOV R4, #0
STRB R4, autorepeating ; BJGA bugfix - deactivate autorepeat redraw optimisation
;
EXITS
......
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