home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / i / infobar / !InfoBar / 0_04 (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1994-09-26  |  23KB  |  577 lines

  1.  >InfoBar:0_04
  2.  Display time/date/free memory/mode simple readout
  3.  David G Jones, 1994
  4.  This software is PD, do what you will with it.
  5. $; " (Error code "; 
  6. ); ")": 
  7. SReplaceResource% = 
  8.     :
  9.  Whether we create our own smaller ResourceFiler icon
  10.     MStopWelcome%     = 
  11.     :
  12.  Stop Welcome screen on starting up the desktop
  13. 1prog$ = "InfoBar": vers$="0.04 (25 Sep 1994)"
  14.  Start & Finish external coordinates of the various displays. Order of displays is
  15.  important within the rloop section
  16. (DateX0% =  0 * 16: DateX1% =  7 * 16
  17. (TimeX0% =  8 * 16: TimeX1% = 14 * 16
  18. (ModeX0% = 15 * 16: ModeX1% = 18 * 16
  19. (FreeX0% = 19 * 16: FreeX1% = 26 * 16
  20. command$="Desktop_"+prog$
  21. bl$ = 
  22. cr$ = 
  23. nl% = &0A0D
  24. "Service_Reset            = &27
  25. "Service_StartWimp        = &49
  26. "Service_StartedWimp      = &4A
  27. "Service_MemoryMoved      = &4E
  28. "Service_DesktopWelcome   = &7C
  29. assembly
  30.  "OS_File", 10, prog$, &FFA,, code, O%
  31. assembly
  32.  code 16383
  33.  pass% = 4 
  34. O% = code: P% = 0
  35. [ OPT pass%
  36. (!                equd    start
  37.                 equd    0
  38. *!                equd    final
  39. +'                equd    serviceCall
  40. ,'                equd    titleString
  41. -&                equd    helpString
  42. .$                equd    keyWords
  43.                 equd    0
  44.                 equd    0
  45.                 equd    0
  46.                 equd    0
  47. 4-.titleString    equs    prog$ +bl$: align
  48. 5O.helpString     equs    prog$+
  49. (9)+vers$+"   David G Jones"+bl$: align
  50. .keyWords
  51. 80.startUpName    equs    command$ +bl$: align
  52. 9'                equd    startUpComm
  53.                 equd    0
  54. ;'                equd    startUpHelp
  55. <'                equd    startUpHelp
  56. .keyWords_end   equd    0
  57. .startUpHelp    equs "InfoBar displays a row of useful readouts along the top left of the icon bar; Date, time, mode and free memory.": equw nl%
  58. @T                equs "Do not use *"+command$+", use *Desktop instead.": equw nl%
  59. A4                equs    "Syntax: *"+command$+bl$
  60.                 align
  61. D2.serviceCall    teq     r1, #Service_StartWimp
  62. E4                teqNE   r1, #Service_StartedWimp
  63. F.                teqNE   r1, #Service_Reset
  64. G4                teqNE   r1, #Service_MemoryMoved
  65.  StopWelcome%: [OPT pass%: teqNE r1, #Service_DesktopWelcome:]
  66. I#[ OPT pass%:    movNES  pc, r14
  67. K2                teq     r1, #Service_StartWimp
  68. L%                bEQ     startWimp
  69. M4                teq     r1, #Service_StartedWimp
  70. N'                bEQ     startedWimp
  71. O.                teq     r1, #Service_Reset
  72. P(                bEQ     serviceReset
  73. Q4                teq     r1, #Service_MemoryMoved
  74. R(                strEQ   r1, PollWord
  75.  StopWelcome%:[OPT pass%:teq r1, #Service_DesktopWelcome:]:
  76. T"[ OPTpass%:     movEQ   r1, #0
  77. V#                movS    pc, r14
  78. X+.startWimp      ldr     r12, taskHandle
  79. Y#                teq     r12, #0
  80. Z#                mvnEQ   r12, #0
  81. [+                strEQ   r12, taskHandle
  82. \+                adrEQ   r0, startUpName
  83. ]"                movEQ   r1, #0
  84. ^#                movS    pc, r14
  85. `+.startedWimp    ldr     r12, taskHandle
  86. a#                cmn     r12, #1
  87. b#                movEQ   r12, #0
  88. c+                strEQ   r12, taskHandle
  89. d#                movS    pc, r14
  90. f#.serviceReset   mov     r12, #0
  91. g+                str     r12, taskHandle
  92. h#                movS    pc, r14
  93. j..startUpComm    stmfd   r13!, {r0-r2, r14}
  94. k"                mov     r2, r0
  95. l"                mov     r0, #3
  96. m/                swi     "XWimp_ReadSysInfo"
  97. n/                ldmVSfd r13!, {r0 - r2, pc}
  98. o"                teq     r0, #0
  99. p,                adrEQ   r0, notInDesktop
  100. q.                swiEQ   "OS_GenerateError"
  101. r+                adr     r1, titleString
  102. s"                mov     r0, #2
  103. t(                swi     "XOS_Module"
  104. u-                ldmfd   r13!, {r0-r2, pc}
  105. .notInDesktop   equd    0
  106. x>                equs    "Use *Desktop to start "+prog$+bl$
  107.                 align
  108. .taskHandle     equd    0
  109. }'.wimpError     ldr     r1, PollMask
  110. ~O               tst     r1, #1 << 31            ; Are we still in wimp init?
  111. $               movEQ   r1, #%011
  112. $               movNE   r1, #%010
  113. '               adr     r2, TaskName
  114. -               swi     "Wimp_ReportError"
  115. !               teq     r1, #1
  116. #               bEQ     continue
  117. $               b       closeDown
  118. L.NoTemplate    equd 0: equs "Could not find window template" +bl$: align
  119. :.TemplatesFN   equs    "InfoBar:Templates" +bl$: align
  120. 1.Grabkeys      equs    "grabkeys" +bl$: align
  121. 1.TaskName      equs    "Info Bar" +bl$: align
  122. P.Messages      equd    &400c1: equd &400c2: equd &400c3: equd &400c4: equd 0
  123. W.PollMask      equd    %0010000000001100001110000  
  124.  (1 << 31) ;mark not set up yet
  125. .PollWord      equd    0
  126. P.start         mov     r0, #256                       ; Minimum version 3.10
  127. -               add     r0, r0, #310 - 256
  128. #               ldr     r1, TASK
  129. '               adr     r2, TaskName
  130. '               adr     r3, Messages
  131. -               swi     "XWimp_Initialise"
  132. $               bVS     wimpError
  133. )               str     r1, taskHandle
  134. *               adr     r1, TemplatesFN
  135. /               swi     "XWimp_OpenTemplate"
  136. $               bVS     wimpError
  137. *               
  138. adrl("", 1, WimpBlock)
  139. '               add     r2, r1, #128
  140. %               add     r3, r2, #0
  141. !               mvn     r4, #0
  142. '               adr     r5, Grabkeys
  143. !               mov     r6, #0
  144. /               swi     "XWimp_LoadTemplate"
  145. $               bVS     wimpError
  146. !               teq     r6, #0
  147. )               adrEQ   r0, NoTemplate
  148. $               bEQ     wimpError
  149. &               mvn     r2, #&10000
  150. '               str     r2, [r1, #0]
  151. (               add     r2, r2, #&100
  152. '               str     r2, [r1, #8]
  153. /               swi     "XWimp_CreateWindow"
  154. '               strVC   r0, [r1, #0]
  155. 1               swiVC   "XWimp_GetWindowState"
  156. -               swiVC   "XWimp_OpenWindow"
  157. $               bVS     wimpError
  158. '               add     r2, r1, #128
  159. %               add     r3, r2, #0
  160. K               mvn     r4, #0                         ; No font support
  161. *               adr     r5, titleString
  162. Z               mov     r6, #0                         ; First search for template name
  163. /               swi     "XWimp_LoadTemplate"
  164. $               bVS     wimpError
  165. S               teq     r6, #0                         ; Was the template found?
  166. L               adrEQ   r0, NoTemplate                 ; >No  So complain
  167. ;               bEQ     wimpError                      ;
  168. /               swiVC   "XWimp_CreateWindow"
  169. ,               strVC   r0, InfoBarHandle
  170. Q               movVC   r2, r0                         ; r2 == info bar handle
  171. R               mvnVC   r0, #1                         ; icon bar window handle
  172. '               strVC   r0, [r1, #0]
  173. 1               swiVC   "XWimp_GetWindowState"
  174. V               add     r4, r1, #4                     ; r4 => visible area details
  175. W               ldmia   r4, {r5 - r8}                  ; r5 == min x ... r8 == max y
  176. Q               ldrVC   r3, [r1, #28]                  ; r3 == icon bar behind
  177. S               strVC   r2, [r1, #0]                   ; Ok get info bar details
  178. 1               swiVC   "XWimp_GetWindowState"
  179. G               addVC   r7, r5, # FreeX1%              ; r7 == max x
  180. H               mvnVC   r0, #0                         ; Current mode
  181. F               movVC   r1, #5                         ; YEigFactor
  182. 1               swiVC   "XOS_ReadModeVariable"
  183. W               movVC   r0, #1                         ; vertical space around chars
  184. )               movVC   r0, r0, LSL r2
  185. W               addVC   r0, r0, #32                    ; Static height of characters
  186. G               subVC   r6, r8, r0                     ; r6 == min y
  187. V               stmIA   r4, {r5 - r8}                  ; store visible area details
  188. K               subVC   r1, r4, #4                     ; r1 => WimpBlock
  189. O               strVC   r3, [r1, #28]                  ; open above icon bar
  190. -               swiVC   "XWimp_OpenWindow"
  191. $               bVS     wimpError
  192. 0               swi     "XWimp_CloseTemplate"
  193. $               bVS     wimpError
  194.  ReplaceResource% 
  195. [ OPT pass%
  196. )               mov     r0, #&50000000
  197. ,               
  198. adrl("", 1, RomAppsIcon)
  199. -