📄 taskwin2.html
字号:
<!doctype html public "-//W3C//DTD HTML 3.2//EN"><html><head><title>An even better TaskWindow</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><meta http-equiv="content-language" content="en" /><meta name="resource-type" content="document"><meta name="copyright" content="This document copyright 2002 by Richard Murray, code copyright Chris Manning. Use for non-profit and education purposes explicitly granted."><meta name="author" content="Richard Murray"><meta name="rating" content="general"></head><!-- /assembler/taskwin2.html --><!-- --><!-- (C) Copyright 2002 Richard Murray --><!-- Code by Chris Manning (C) 2002 --><!-- Designed by Richard Murray --><!-- rmurray@heyrick.co.uk --><!-- --><body bgcolor="#f0f0f0" text="#000000" link="#0022dd" vlink="#002288"><table border = "0" width="100%"> <tr> <td align=center width=100> <img src="arm3.gif" width=79 height=78 align = middle> </td> <td> <h1 align="center"><font color="#800080">An even better TaskWindow</font></h1> </td> <td align=center width=100> <img src="arm3.gif" width=79 height=78 align = middle> </td></table><p> <p>Following the aforementioned TaskWindow speed-ups, Chris Manning decided to go one better andimplement a variable poll-rate method.<p>Please note that this code is for, I think, the TaskWindow module part of RISC OS 4. It does notwork here, with RISC OS 3.70. I suspect the offset is wrong but I've not looked into it. Acrashed TaskWindow needs lots of TaskKilling (five or six times, twice), so be sure you have atask killer module ready...<br>For those of you with the correct TaskWindow module, Chris is using it on his system and itseems quite happy.<p> <p>The changes to the TaskWindow module are:<pre> 00000320 : 03A03034 : MOVEQ R3,#&34 00000330 : 7A000896 : BVC &00002590 0000141C : E59B0004 : LDR R0,[R11,#4] 00001420 : E590302C : LDR R3,[R0,#&02C] 00001424 : EB00045E : BL &000025A4 00002590 : E3A0E00F : MOV R14,#&0F 00002594 : E58CE02C : STR R14,[R12,#&02C] 00002598 : E58CE030 : STR R14,[R12,#&030] 0000259C : E3A0E000 : MOV R14,#0 000025A0 : EAFFF763 : B &00000334 000025A4 : E2533001 : SUBS R3,R3,#1 000025A8 : 05903030 : LDREQ R3,[R0,#&030] 000025AC : E580302C : STR R3,[R0,#&02C] 000025B0 : E3A00000 : MOV R0,#0 000025B4 : E3A03000 : MOV R3,#0 000025B8 : 11A0F00E : MOVNE PC,R14 000025BC : EAFFFDC8 : B &00001CE4</pre><p> <p>This is backed up by the following code. It creates a file (in WimpScrap) which can be used toview or set the TaskWindow polling rate. The default rate is 15.<pre> REM >Source:Util.TaskWindowPollRate ON ERROR ON ERROR OFF: PROCerror: END buf_size%=4096 DIM buf% buf_size%-1 : name$="TaskWindowPollRate" filename$=name$ : bufsize%=256 mininterval%=1 maxinterval%=255 defaultinterval%=15 : FlagF%=1<<26 FlagI%=1<<27 FlagV%=1<<28 FlagC%=1<<29 FlagZ%=1<<30 FlagN%=1<<31 : L%=buf%+buf_size% FOR opt%=12 TO 15 STEP 3 P%=0 O%=buf% [ OPT opt% ; ; r0 -> command line ; r1 -> command tail ; r12 -> workspace (1kB) ; r13 -> stack ; STMFD r13!,{r14} LDRB r0,[r1] ; First character of parameter CMP r0,#ASC(" ") ; No param means the current MVNLE r6,#0 ; value is to be displayed BLE _findmodule% TEQ r0,#ASC("*") ; An asterisk means the MOVEQ r6,#defaultinterval% ; default value is to be used BEQ _findmodule% MOV r0,r1 ; -> parameter MOV r1,r12 ; -> buffer MOV r2,#bufsize% ; Length of buffer SWI "XOS_GSTrans" LDMVSFD r13!,{pc} MOV r0,r12 ; -> Translated string MOV r1,#0 ; Return result in r2 SWI "XOS_EvaluateExpression" LDMVSFD r13!,{pc} CMP r2,#mininterval% ; Check number is in range BLT _toosmall% CMP r2,#maxinterval% BGT _toobig% MOV r6,r2 ; r6 == poll interval ; ; ._findmodule% MOV r0,#18 ; Extract module info ADR r1,_taskwindow% SWI "XOS_Module" LDMVSFD r13!,{pc} ; LDR r0,[r4,#-4] ; Size of work area CMP r0,#48 ; Patched TaskWindow has LDMLEFD r13!,{pc} ; larger workarea CMP r6,#0 ; -ve interval means 'display' STRPL r6,[r4,#44] ; Remainder of this interval STRPL r6,[r4,#48] ; New interval LDMPLFD r13!,{pc}^ ; LDR r0,[r4,#48] ; Active poll interval ADR r1,_currentnum% MOV r2,#_currentnumL% SWI "XOS_ConvertCardinal4" ; Convert to a string LDMVSFD r13!,{pc} ADR r0,_current% SWI "XOS_Write0" ; Display value SWIVC "XOS_NewLine" LDMFD r13!,{pc} ; ; ._compare% LDRB r7,[r3],#1 ; Byte from first string LDRB r8,[r5],#1 ; Byte from second string TEQ r7,r8 ; Compare bytes MOVNE pc,r14 ; Return NE if different TEQ r7,#0 ; Check for end BNE _compare% ; Look at next byte MOV pc,r14 ; Return EQ if identical ; ._toosmall% ADR r0,_smallerror% ; -> Error block B _toobig0% ._toobig% ADR r0,_bigerror% ; -> Error block ._toobig0% LDMFD r13!,{r14} ; Return address ORRS pc,r14,#FlagV% ; Set V flag and return ._smallerror% EQUD &16C EQUS "Number too small"+CHR$(0) ALIGN ._bigerror% EQUD &16C EQUS "Number too big"+CHR$(0) ._taskwindow% EQUS "TaskWindow"+CHR$(0) ._current% EQUS "Current poll rate is " ._currentnum% EQUS STRING$(10,"*")+CHR$(0) FNEqu("_currentnumL%","P%-_currentnum%") ] NEXT opt% OSCLI("Save <Wimp$ScrapDir>."+filename$+" "+STR$~(buf%)+" +"+STR$~(P%)) OSCLI("SetType <Wimp$ScrapDir>."+filename$+" Utility") END : DEF PROCerror REPORT IF ERR<>17 PRINT " at line "; ERL ", location counter=&"; ~P% ENDPROC : : DEF FNEqu(variable$, value$) =EVAL("FNMakeVar("+variable$+","+value$+")") : : DEF FNMakeVar(RETURN var%, value%) var%=value% =0</pre><hr size = 3><a href="index.html#14">Return to assembler index</a><hr size = 3><address>Copyright © 2002 Richard Murray, code by Chris Manning</address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -