home *** CD-ROM | disk | FTP | other *** search
RISC OS BBC BASIC V Source | 1993-06-19 | 4.3 KB | 132 lines |
- >AppEnsure
- Execute * command if application not active
-
- Cy Booker 1993
- "Source:Constants"
- "Source:MakeUtil"
- $ + " ["+
- )+ "]"
- code_size% = 2*1024
- code% code_size%-1
- debug_AppEnsure =
- _Define_Constants
- _Make_Code("AppEnsure", "AppEnsure", &FF8)
- _Test_AppEnsure
- *********************************************************************
- **************************** AppEnsure **********************************
- *********************************************************************
- _Test_AppEnsure
- debug_AppEnsure
- B% 256
- B $B% = """Debug viewer"" <pd>.Desktop.Utils.!BugView"+
- A% 1024
- '
- ("BreakSet "+
- ~(code%+break))
- code%
- _assemble_AppEnsure
- loop, lp, cmp
- bufsiz% = 512
- argsiz% = 256
- [OPT pass%
- \Cy J Booker
- (/\12.06.1993 - Wrote (as utility --- failed)
- )#\19.06.1993 - as an application
- +>\ Syntax. *AppEnsure [-Title] <title> [-Command] <command>
- ; Note - no stack!
- ADR R12, buffer
- /9 SUB R0, R12, #&8000 - (argsiz% + bufsiz%)
- MVN R1, #0
- 1K SWI "XWimp_SlotSize" ; Ensure buffer exists!
- 2 SWIvc "XOS_GetEnv"
- Bvs error
- 4 LDRB R2, [R0, #0]
- CMP R2, #
- (" ")
- 67 Bls help \ Give help
- MOV R1, R0
- ADR R0, args
- MOV R2, R12
- : MOV R3, #bufsiz%
- ;" SWI "XOS_ReadArgs"
- Bvs help
- MOV R0, #0
- >%.loop ADD R1, R12, #argsiz%
- ? MOV R2, #bufsiz%
- @1 SWI "XTaskManager_EnumerateTasks"
- Bvs error
- B* ADD R3, R12, #argsiz% - 16
- Cd.lp ADD R3, R3, #16 ; pointer to 16-byte word-aligned block for task
- CMP R3, R1
- E$ Bhs enumerated_chunk
- FJ LDR R4, [R3, #4] ; pointer to task name
- GF LDR R5, [R12, #4] ; pointer to title
- H .cmp LDRB R6, [R4], #1
- I LDRB R7, [R5], #1
- CMP R6, #
- Blo endcmp
- TEQ R6, R7
- Beq cmp
- B lp
- .endcmp
- CMP R7, #
- Bhs lp
- .quit MOV R0, #0
- S" LDR R1, value_ABEX
- MOV R2, #0
- SWI "OS_Exit"
- .value_ABEX
- EQUS "ABEX"
- .value_TASK
- EQUS "TASK"
- .enumerated_chunk
- CMP R0, #0
- Bgt loop
- MOV R0, #300
- ADD R0, R0, #10
- _" LDR R1, value_TASK
- ADR R2, title
- a ADR R3, messages
- bH SWI "XWimp_Initialise" ; R1 --> task handle
- Bvs error
- dE LDR R0, [R12, #8] ; Execute command
- e% SWI "XWimp_StartTask"
- MOVvs R2, R0
- MOV R3, pc
- MOV R0, R1
- i" LDR R1, value_TASK
- j% SWI "XWimp_CloseDown"
- MOVvc R0, R2
- TEQvcP R3, #0
- Bvc quit
- n".error LDR R1, value_ABEX
- MOV R2, #1
- SWI "OS_Exit"
- .messages
- EQUD 0
- t#.title EQUS "AppEnsure"+
- u..args EQUS "/a,Title/a,Command/a"+
- ALIGN
- x!.help ADR R0, help_text
- yC MOV R1, #0 \ Use system dictionary
- z! ADR R2, help_name
- {% SWI "XOS_PrettyPrint"
- Bvc quit
- B error
- .help_name
- EQUS "AppEnsure"
- EQUB 0
- .help_text
- V EQUS "*"+ name$+ " will load the Wimp task using the given command if "
- X EQUS "that task is not already loaded. <title> is the name as listed in "
- W EQUS "the task manager window, and <command> is something that will be "
- W EQUS "Wimp_StartTask'ed if necessary (<command is usually the diretory "
- * EQUS "of the application)."
- EQUS nl$
- E EQUS syntax$+ " [-Title] <title> [-Command] <command>"
- EQUS nl$
- EQUB 0
- ALIGN
- .buffer
- ]:= 0
-