home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
programs
/
desktop
/
newbar
/
Source
/
s
/
module
< prev
Wrap
Text File
|
1998-08-08
|
8KB
|
341 lines
AREA |!!!Module$$Header|, CODE, READONLY
GET OS:hdr.OSModule
GET OS:hdr.OSFind
GET OS:hdr.OSFile
GET OS:hdr.Wimp
GET OS:hdr.WimpReadSysInfo
GET hdr.ibpatch
GET hdr.debug
IMPORT pre_wimp_createicon
IMPORT pre_wimp_deleteicon
IMPORT pre_wimp_createmenu
IMPORT pre_wimp_getwindowstate
IMPORT pre_wimp_getwindowinfo
IMPORT pre_wimp_seticonstate
IMPORT pre_wimp_geticonstate
IMPORT pre_wimp_forceredraw
IMPORT pre_wimp_whichicon
IMPORT pre_wimp_dragbox
IMPORT pre_wimp_getwindowoutline
IMPORT pre_wimp_sendmessage
IMPORT post_wimp_getpointerinfo
IMPORT pre_wimp_resizeicon
; Module header
ENTRY
module_base
DCD rm_start - module_base
DCD rm_init - module_base
DCD rm_final - module_base
DCD rm_service - module_base
DCD rm_title - module_base
DCD rm_help - module_base
DCD rm_hc_table - module_base
; Zero the SWI-related offsets just in case
DCD 0, 0, 0, 0
; Essential module information
rm_title
= "IconbarPatch", 0
rm_help
= "IconbarPatch", 9
= "1.10 (08 Aug 1998), "
[ :DEF:DEBUG
= "debug build"
|
= "normal build"
]
= ", by Mark Seaborn", 0
ALIGN
; Unused module entry points
rm_start * module_base
rm_hc_table * module_base
; Module initialisation point
[ :DEF:DEBUG
debug_file
= "$.Public.IbPDebug", 0
ALIGN
]
rm_init_code
DCD wimp_swive_code
rm_init
stmfd sp!, {r0-r4, lr}
; allocate block
mov r0, #OSModule_Alloc
mov r3, #block_size
swi XOS_Module
bvs rm_init_error
str r2, [r12]
mov r12, r2
[ :DEF:DEBUG
; open our debug file
mov r0, #&80
adr r1, debug_file
swi XOS_Find
bvs rm_init_error
str r0, [r12, #block_debug_file]
; now set its filetype to text
mov r0, #18
adr r1, debug_file
mov r2, #&1000
sub r2, r2, #1
swi XOS_File
bvs rm_init_error
; open initial message to check that it's working
DEBUG_MSG "IconbarPatch starting up", 10
]
; init block
; Zero some values
mov r0, #0
str r0, [r12, #block_usage_count]
str r0, [r12, #block_start_flag]
str r0, [r12, #block_x_offset]
str r0, [r12, #block_y_offset]
str r0, [r12, #block_flags]
str r0, [r12, #block_icon_count]
; Initialise lists (beginning entries and entry count)
str r0, [r12, #block_list_begin]
str r0, [r12, #block_list_keep_begin]
str r0, [r12, #block_list_count]
str r0, [r12, #block_list_keep_count]
; Set event list end
add r0, r12, #block_list_begin
str r0, [r12, #block_list_end]
; Set keep list end
add r0, r12, #block_list_keep_begin
str r0, [r12, #block_list_keep_end]
; some sensible defaults
mov r0, #-2
str r0, [r12, #block_window]
mov r0, #-1
str r0, [r12, #block_pointer_icon]
mov r0, #0
str r0, [r12, #block_pointer_task]
; value of r0 is carried through
; zero the iconbar window state block, just in case
; yes, I know this is a lazy way to do it :-)
str r0, [r12, #block_iconbar_state + 0]
str r0, [r12, #block_iconbar_state + 4]
str r0, [r12, #block_iconbar_state + 8]
str r0, [r12, #block_iconbar_state + 12]
str r0, [r12, #block_iconbar_state + 16]
str r0, [r12, #block_iconbar_state + 20]
str r0, [r12, #block_iconbar_state + 24]
str r0, [r12, #block_iconbar_state + 28]
str r0, [r12, #block_iconbar_state + 32]
; constant across all SWI claims
ldr r0, rm_init_code
mov r2, r12
MACRO
claim_pre $swi_name, $routine
mov r1, #($swi_name - Wimp_ChunkNo) :OR: wimp_swive_claim
adrl r3, $routine
mov r4, #0
swi XWimp_RegisterFilter
bvs rm_init_error
MEND
MACRO
claim_post $swi_name, $routine
mov r1, #($swi_name - Wimp_ChunkNo) :OR: wimp_swive_claim
mov r3, #0
adrl r4, $routine
swi XWimp_RegisterFilter
bvs rm_init_error
MEND
claim_pre Wimp_CreateIcon, pre_wimp_createicon
claim_pre Wimp_DeleteIcon, pre_wimp_deleteicon
claim_pre Wimp_CreateMenu, pre_wimp_createmenu
claim_pre Wimp_GetWindowState, pre_wimp_getwindowstate
claim_pre Wimp_GetWindowInfo, pre_wimp_getwindowinfo
claim_pre Wimp_SetIconState, pre_wimp_seticonstate
claim_pre Wimp_GetIconState, pre_wimp_geticonstate
claim_pre Wimp_ForceRedraw, pre_wimp_forceredraw
claim_pre Wimp_WhichIcon, pre_wimp_whichicon
claim_pre Wimp_DragBox, pre_wimp_dragbox
claim_pre Wimp_SendMessage, pre_wimp_sendmessage
claim_pre Wimp_GetWindowOutline, pre_wimp_getwindowoutline
claim_post Wimp_GetPointerInfo, post_wimp_getpointerinfo
claim_pre Wimp_ResizeIcon, pre_wimp_resizeicon
ldmfds sp!, {r0-r4, pc}
rm_init_error
mov r12, r0
ldmfd sp!, {r0-r4, lr}
mov r0, r12
mov pc, lr
; Module finalisation point
rm_final
stmfd sp!, {r0-r4, lr}
ldr r12, [r12]
; constant across all SWI releases
ldr r0, rm_init_code
mov r2, r12
MACRO
release_pre $swi_name, $routine
mov r1, #($swi_name - Wimp_ChunkNo) :OR: wimp_swive_release
adrl r3, $routine
mov r4, #0
swi XWimp_RegisterFilter
bvs rm_final_error
MEND
MACRO
release_post $swi_name, $routine
mov r1, #($swi_name - Wimp_ChunkNo) :OR: wimp_swive_release
mov r3, #0
adrl r4, $routine
swi XWimp_RegisterFilter
bvs rm_final_error
MEND
release_pre Wimp_CreateIcon, pre_wimp_createicon
release_pre Wimp_DeleteIcon, pre_wimp_deleteicon
release_pre Wimp_CreateMenu, pre_wimp_createmenu
release_pre Wimp_GetWindowState, pre_wimp_getwindowstate
release_pre Wimp_GetWindowInfo, pre_wimp_getwindowinfo
release_pre Wimp_SetIconState, pre_wimp_seticonstate
release_pre Wimp_GetIconState, pre_wimp_geticonstate
release_pre Wimp_ForceRedraw, pre_wimp_forceredraw
release_pre Wimp_WhichIcon, pre_wimp_whichicon
release_pre Wimp_DragBox, pre_wimp_dragbox
release_pre Wimp_SendMessage, pre_wimp_sendmessage
release_pre Wimp_GetWindowOutline, pre_wimp_getwindowoutline
release_post Wimp_GetPointerInfo, post_wimp_getpointerinfo
release_pre Wimp_ResizeIcon, pre_wimp_resizeicon
; free both event lists
mov r0, #block_list
bl free_event_list
movvc r0, #block_list_keep
blvc free_event_list
bvs rm_final_error
[ :DEF:DEBUG
; output a closing message
DEBUG_MSG "IconbarPatch finishing", 10
; close our debug file
mov r0, #0
ldr r1, [r12, #block_debug_file]
swi XOS_Find
bvs rm_final_error
]
; free block
mov r0, #OSModule_Free
mov r2, r12
swi XOS_Module
bvs rm_final_error
ldmfd sp!, {r0-r4, pc}
rm_final_error
mov r12, r0
ldmfd sp!, {r0-r4, lr}
mov r0, r12
mov pc, lr
; Free one of the module's lists of events
; r12 is workspace pointer as usual; r0 has offset of list info
free_event_list
stmfd sp!, {r4-r5, lr}
stmfd sp!, {r0-r2}
; r4 contains address of current block
ldr r4, [r12, r0]
free_event_list_loop
cmp r4, #0
beq free_event_list_end
; r4 contains next block; r2 contains block to free
mov r2, r4
ldr r4, [r4, #element_next]
; Free the block (r2 already filled in)
mov r0, #OSModule_Free
swi XOS_Module
bvs free_event_list_end
b free_event_list_loop
free_event_list_end
ldmfd sp!, {r0-r2}
; Tidy up by zeroing the fields (r4 zero from before, r5 write address)
add r5, r12, r0
str r4, [r5], #4
str r4, [r5], #4
str r4, [r5], #4
ldmfd sp!, {r4-r5, pc}
; Service call handler
; We are interested in three service calls:
; Service_StartWimp
; Service_StartedWimp
; Service_Reset
rm_service
; Return quickly if we don't care about this one
teq r1, #Service_StartWimp
teqne r1, #Service_StartedWimp
teqne r1, #Service_Reset
movnes pc, lr
ldr r12, [r12]
; Which service call?
cmp r1, #Service_StartWimp
beq rm_service_start_iconbar
; Otherwise drop through
; Service_StartedWimp or Service_Reset
; Reset the flag to zero so that iconbar can be started
rm_service_desktop_starting
stmfd sp!, {lr}
mov lr, #0
str lr, [r12, #block_start_flag]
ldmfds sp!, {pc}
; Service_StartWimp
; If task not running, return command to start the iconbar task
rm_service_start_iconbar
stmfd sp!, {lr}
; Return if the flag is set
ldr lr, [r12, #block_start_flag]
cmp lr, #0
ldmnefds sp!, {pc}
; Otherwise set the flag to -1
mov lr, #-1
str lr, [r12, #block_start_flag]
; And return with the command
adr r0, iconbar_start_command
mov r1, #0
ldmfds sp!, {pc}
; Iconbar will be started via an alias:
iconbar_start_command
= "Desktop_StartIconbar", 0
ALIGN
END