Commit 19799dae authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Change text formatting to be a single right justified (internationalised) icon.

Delete Doc.doc duplication.
Delete Template2D.
Excess headers removed.
Out of range SWIs returned error 0.
Some symbolic names from ModHand, HighFSI, WimpSpace used.
Fix corrupt error message in set_text due to misplaced Pull.
Uses k for thousands not Kelvins.

Version 0.40. Tagged as 'Free-0_40'
parent e497af90
......@@ -12,7 +12,7 @@
| See the License for the specific language governing permissions and
| limitations under the License.
|
RMLoad <Obey$Dir>.RM.Free
RMLoad <Obey$Dir>.RM.<Machine>.Free
RMreinit sharefs
RMreinit Filer
WimpTask Desktop
;
; This file is automatically maintained by srccommit, do not edit manually.
; Last processed by srccommit version: 1.68.
; Last processed by srccommit version: 1.1.
;
GBLS Module_MajorVersion
GBLA Module_Version
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.39"
Module_Version SETA 39
Module_MajorVersion SETS "0.40"
Module_Version SETA 40
Module_MinorVersion SETS ""
Module_Date SETS "26 Nov 2002"
Module_ApplicationDate SETS "26-Nov-02"
Module_Date SETS "28 Nov 2011"
Module_ApplicationDate SETS "28-Nov-11"
Module_ComponentName SETS "Free"
Module_ComponentPath SETS "RiscOS/Sources/Desktop/Free"
Module_FullVersion SETS "0.39"
Module_HelpVersion SETS "0.39 (26 Nov 2002)"
Module_ComponentPath SETS "castle/RiscOS/Sources/Desktop/Free"
Module_FullVersion SETS "0.40"
Module_HelpVersion SETS "0.40 (28 Nov 2011)"
END
/* (0.39)
/* (0.40)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.68.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.39
#define Module_MajorVersion_CMHG 0.40
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 26 Nov 2002
#define Module_Date_CMHG 28 Nov 2011
#define Module_MajorVersion "0.39"
#define Module_Version 39
#define Module_MajorVersion "0.40"
#define Module_Version 40
#define Module_MinorVersion ""
#define Module_Date "26 Nov 2002"
#define Module_Date "28 Nov 2011"
#define Module_ApplicationDate "26-Nov-02"
#define Module_ApplicationDate "28-Nov-11"
#define Module_ComponentName "Free"
#define Module_ComponentPath "RiscOS/Sources/Desktop/Free"
#define Module_ComponentPath "castle/RiscOS/Sources/Desktop/Free"
#define Module_FullVersion "0.39"
#define Module_HelpVersion "0.39 (26 Nov 2002)"
#define Module_LibraryVersionInfo "0:39"
#define Module_FullVersion "0.40"
#define Module_HelpVersion "0.40 (28 Nov 2011)"
#define Module_LibraryVersionInfo "0:40"
......@@ -58,29 +58,22 @@ Module_BaseAddr
GET Hdr:System
GET Hdr:ModHand
GET Hdr:Services
GET Hdr:VduExt
GET Hdr:FSNumbers
GET Hdr:HighFSI
GET Hdr:NewErrors
GET Hdr:Variables
GET Hdr:Proc
GET Hdr:Sprite
GET Hdr:Wimp
GET Hdr:WimpSpace
GET Hdr:Messages
GET Hdr:FilerAct
GET Hdr:Machine.<Machine>
GET Hdr:CMOS
GET Hdr:MsgTrans
GET Hdr:MsgMenus
GET Hdr:ResourceFS
GET Hdr:ColourTran
GET Hdr:Hourglass
GET Hdr:ADFS
GET Hdr:RamFS
GET Hdr:SCSIFS
GET Hdr:Econet
GET Hdr:PCCardFS ;PCMCIA Support
GET Hdr:PCCardFS
GET Hdr:UpCall
GET Hdr:HostFS
GET Hdr:NdrDebug
......@@ -93,34 +86,24 @@ Module_BaseAddr
standalone SETL {FALSE}
]
; General tracing
GBLL debugxx
GBLL hostvdu
debug SETL {FALSE}
debugxx SETL {FALSE}
hostvdu SETL {TRUE}
debug SETL false
debugxx SETL false ; General tracing.
hostvdu SETL true
; options switches
; Options switches
GBLL fix_silly_sizes
fix_silly_sizes SETL true ; checks for free > size
fix_silly_sizes SETL {TRUE} ; checks for free > size
; ----------------------------------------------------------------------------------------------------------------------
MACRO
$label ALIGNHASH $o,$m
[ ((@-$o):AND:($m-1))<>0
$label # $m-((@-$o):AND:($m-1))
|
$label # 0
]
MEND
;-----------------------------------------------------------------------------------------------------------------------
; Local macros
MACRO
CMPSTR $a,$b
Push "r0,r1,LR"
MOV r0,$a
MOV r1,$b
BL cmpstr
BL stricmp
Pull "r0,r1,LR"
MEND
......@@ -159,10 +142,7 @@ fs_block_size * (@-fs_next)
; Workspace layout
indirected_space * 512
workspace RN R12
^ 0,workspace
^ 0, R12
wsorigin # 0
mytaskhandle # 4 ; put here so we know where it is
......@@ -174,11 +154,12 @@ disc_name # 4 ; Disc name for filecore
disc_desc # 64 ; Disc descriptor for filecore
message_fblock # 16 ; MessageTrans file descriptor block
message_fopen # 4 ; Message file open flag
message_bytes # 16 ; Lookup of international 'bytes'
indirected_data_offset * (@-wsorigin)
indirected_data # indirected_space ; Data area for indirected data from the template file
indirected_data # 512 ; Data area for indirected data from the template file
ALIGNHASH wsorigin,16
AlignSpace 16
dataarea # &100 ; wimp data block
windowarea # &300 ; Place to store window template.
......@@ -186,14 +167,14 @@ stackbot # &200 ; stack at most 512 bytes long
stacktop # 0
max_running_work * (@-wsorigin)
; ---------------------------------------------------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; Icon values in template
icon_Size * 8
icon_SizeBar * 5
icon_Free * 7
icon_FreeBar * 6
icon_Used * 1
icon_UsedBar * 4
; ----------------------------------------------------------------------------------------------------------------------
icon_Free * 2
icon_FreeBar * 4
icon_Used * 6
icon_UsedBar * 8
icon_Size * 10
icon_SizeBar * 12
; -----------------------------------------------------------------------------
LNK ModHead.s
......@@ -14,6 +14,7 @@
;
; > s.Messages
; ----------------------------------------------------------------------------------------------------------------------
; Received a recorded message
message_received_ack
; ----------------------------------------------------------------------------------------------------------------------
......@@ -25,31 +26,19 @@ message_received
BEQ quit_routine
Pull "PC"
LTORG
; ----------------------------------------------------------------------------------------------------------------------
copy_r0r4_null
01
LDRB r6, [r4], #1
STRB r6, [r0], #1
CMP r6, #0
BNE %BT01
SUB r0, r0, #1
MOV PC, LR
; ----------------------------------------------------------------------------------------------------------------------
; CLose all icons windows
quit_routine
ADR r2, windows_ptr
BL free_list
LDR r1, task_storev2
LDR r1, taskidentifier
LDR r0, mytaskhandle
SWI XWimp_CloseDown
MOV r0, #0
STR r0, mytaskhandle
SWI OS_Exit
task_storev2
DCB "TASK"
; ----------------------------------------------------------------------------------------------------------------------
LNK s.ADFS
......@@ -146,7 +146,7 @@ ShowFree_Code
LDR r1,[r2] ; Pointer to FS name.
DebugS xx,"FSName is ",r1
MOV r2,#0
MOV r0,#13
MOV r0,#FSControl_LookupFS
SWI XOS_FSControl ; Get filing system number.
CMP r2,#0
......@@ -192,7 +192,7 @@ create_window ; Window not found, create new window bl
MOV r3,#window_block_size
ADD r3,r3,r5 ; Plus length of name.
MOV r0,#6
MOV r0,#ModHandReason_Claim
SWI XOS_Module ; Claim block.
Pull "PC",VS
......@@ -234,7 +234,7 @@ Init Entry
CMP r2, #0 ; clears V
BNE %FT01
MOV r0, #6
MOV r0, #ModHandReason_Claim
MOV r3, #max_running_work
SWI XOS_Module
EXIT VS
......
......@@ -105,26 +105,26 @@ NFS_GetSpace64
NFS_ComparePath
Push "r0-r9"
Push "r0-r9"
Debug xx,"NFS compare path"
Debug xx,"NFS compare path"
ADD r2,r2,#1
ADD r2,r2,#1
ADR r1,dataarea
ADR r1,dataarea
01
LDRB r0,[r2],#1
CMP r0,#"."
Debug xx,"Copy ",r0
MOVEQ r0,#0
STRB r0,[r1],#1
CMP r0,#0
BNE %BT01 ; Copy to first "."
LDRB r0,[r2],#1
CMP r0,#"."
Debug xx,"Copy ",r0
MOVEQ r0,#0
STRB r0,[r1],#1
CMP r0,#0
BNE %BT01 ; Copy to first "."
ADR r2,dataarea
ADR r2,dataarea
CMPSTR r2,r3
CMPSTR r2,r3
Pull "r0-r9,PC"
Pull "r0-r9,PC"
LNK PCCardFS.s
LNK PCCardFS.s
......@@ -23,8 +23,8 @@ Free_SWIdecode
WritePSRc SVC_mode,R10,,R9 ; re-enable interrupts
CMP R11,#1
BNE SWIFree_Register
BL RemoveEntry
BNE SWIFree_Register ; Free_Register
BL RemoveEntry ; Free_DeRegister
swireturn
STRVS r0, [sp]
ORRVS r9, r9, #V_bit
......@@ -32,15 +32,12 @@ swireturn
Pull "R0-R2,R9,PC"
badswi
ADD sp, sp, #4
ADR R0,ErrorBlock_BadSWI
ADR R0,ErrorBlock_ModuleBadSWI
ADRL R1, Title
BL LookupError
Pull "R1-R2,R9,PC"
ErrorBlock_BadSWI
DCD 0
DCB "BadSWI", 0
ALIGN
MakeErrorBlock ModuleBadSWI
;;Free_Register
;;In:
......@@ -48,17 +45,13 @@ ErrorBlock_BadSWI
;; R1 = Address to call
;; R2 = R12 value.
;;
;;
;;
SWIFree_Register ROUT
MOV r1,r0
LDR r0,[sp,#1*4]
BL AddEntry
B swireturn
MOV r1,r0
LDR r0,[sp,#1*4]
BL AddEntry
B swireturn
LNK s.Tail
LNK s.Tail
......@@ -14,12 +14,12 @@
;
; > s.StartLoop
; ----------------------------------------------------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; Application title and 'TASK' word store
taskidentifier DCB "TASK"
tasktitle DCB "Title",0
ALIGN
; ----------------------------------------------------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; Set up error blocks
MakeInternatErrorBlock WimpNotPresent,,NoWimp ; "Window Manager not present"
......@@ -42,24 +42,21 @@ CloseWimp
SWI XWimp_CloseDown
EXITS
; ----------------------------------------------------------------------------------------------------------------------
template_filename
DCB "Free:Templates",0
ALIGN
window_name
DCB "Free",0
ALIGN
; -----------------------------------------------------------------------------
template_file DCB "Free:Templates",0
ALIGN
window_name DCB "Free",0
ALIGN
task_token DCB "Title",0
ALIGN
title_prefix DCB "FSP",0
ALIGN
ADFSFree DCB "Alias$ADFS_Free"
DCB 0
FreeString DCB "ShowFree -FS ADFS %*0"
DCB 0
ALIGN
units_token DCB "bytes",0
ALIGN
MessagesList DCD Message_Quit
DCD 0
; ----------------------------------------------------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; Start up the wimp task for Free
Start
LDR r12, [r12] ; get workspace pointer
......@@ -79,7 +76,15 @@ Start
ADRL sp, stacktop ; STACK IS NOW VALID!
ADRL r0,tasktitle
ADR r0, units_token
BL Lookup_InPlace
MOVVC r4, r0
ADRVS r4, units_token ; the token happens to be the english default too
ADR r0, message_bytes
MOV r3, #?message_bytes-1
BL copy_r0r4r3_space ; cache the 'bytes' suffix
ADR r0,task_token
BL Lookup_InPlace
SWIVS OS_GenerateError
MOV r2,r0
......@@ -95,7 +100,7 @@ Start
STR r1, mytaskhandle ; Store task handle
ADR r1, template_filename ; Load in the templates
ADR r1, template_file ; Load in the templates
SWI XWimp_OpenTemplate
BLVS CloseWimp
SWIVS OS_GenerateError
......@@ -103,7 +108,7 @@ Start
ADR r1, windowarea ; Get template for window into memory.
LDR r2, =indirected_data_offset
ADD r2,r2,r12
ADD r3, r2, #indirected_space
ADD r3, r2, #?indirected_data
MOV r4, #-1 ; No font array
ADR r5, window_name ; Name of window.
MOV r6, #0 ; Search from first template.
......@@ -129,12 +134,12 @@ Start
MOV r0,#0
STR r0,poll_word
; ----------------------------------------------------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; Wimp polling routine
repollwimp
BVC %FT01
Push "r0"
ADRL R0,tasktitle
ADRL R0,task_token
MOV r2,r0 ; Just in case !
BL Lookup_InPlace
ADDVS sp,sp,#4
......@@ -172,7 +177,7 @@ jptable
MOV PC,LR ; 10
MOV PC,LR ; 11
MOV PC,LR ; 12
B update_windows ; 13 poll word non-zero
B update_windows ; 13 poll word non-zero
MOV PC,LR ; 14
MOV PC,LR ; 15
MOV PC,LR ; 16
......@@ -181,12 +186,12 @@ jptable
MOV PC,LR ; 19
endjptable
; ----------------------------------------------------------------------------------------------------------------------
; -----------------------------------------------------------------------------
open_window
SWI Wimp_OpenWindow
MOV PC,LR
SWI Wimp_OpenWindow
MOV PC,LR
; ----------------------------------------------------------------------------------------------------------------------
; -----------------------------------------------------------------------------
close_window_from_block
EntryS "r1-r5"
......@@ -222,25 +227,26 @@ int_close_window
MOV r5,r0
LDR r2,[r0,#window_discname]
MOV r0,#7
MOV r0,#ModHandReason_Free
SWI XOS_Module
EXIT VS
Debug xx,"Freed space"
MOV r0,#7
MOV r0,#ModHandReason_Free
MOV r2,r5
SWI XOS_Module
EXIT
EXIT VS
Debug xx,"Freed block."
EXITS
; ----------------------------------------------------------------------------------------------------------------------
; This is called when the poll word is non-zero, it scans the window list to find out which windows
; are to be updated, and updates them.
; -----------------------------------------------------------------------------
; This is called when the poll word is non-zero, it scans the window list
; to find out which windows are to be updated, and updates them.
;
FreeReason_Noop * 0
FreeReason_GetName * 1
FreeReason_GetSpace * 2
FreeReason_ComparePath * 3
......@@ -280,7 +286,7 @@ updatelp1
ADD r3,r0,#60 ; Get length
ADD r3,r3,#&100
MOV r0,#6
MOV r0,#ModHandReason_Claim
SWI XOS_Module ; Claim space to hold name. + 3 sizes.
Pull "PC",VS
......@@ -315,7 +321,7 @@ updatelp1
STR r0,[r5,#window_free_hi]
STR r0,[r5,#window_used_hi]
[ fix_silly_sizes
MOV r0,#"?" << 24
MOV r0,#'?' :SHL: 24
STR r0,[r5,#used_ascii]
STR r0,[r5,#free_ascii]
STR r0,[r5,#size_ascii]
......@@ -441,16 +447,16 @@ just_update ; Window has changed, update it.
09
[ fix_silly_sizes
; R0, R1, R6, R7 Corruptable
; R0, R1, R6, R7 Corruptable
LDMIA r2, {r0,r1,r6,r7} ; r0=size.l, r1=size.h, r6=free.l, r7=free.h
; check free size
; check free size
CMP r7,r1
CMPEQ r6,r0 ; Free > Size ::= fault
MOVHI r7,#-1
STRHI r7,[r2,#12]
STRHI r7,[r2,#8]
; check used size
; check used size
ADD r6,r2,#16
LDMIA r6, {r6,r7} ; r6=used.l, r6=used.h
CMP r7,r1
......@@ -603,13 +609,13 @@ just_update ; Window has changed, update it.
TEQ r0,#0
BEQ %FT02
;we do need to check, round, and then update the ascii fields
; we do need to check, round, and then update the ascii fields
;(check the three values are all of the same magnitude, if so, apply rounding)
;then call modified set_text for each one...
; (check the three values are all of the same magnitude, if so, apply rounding)
; then call modified set_text for each one...
;check whether all three are the same units
; check whether all three are the same units
LDR r0,[r5,#used_ascii]
LDR r1,[r5,#free_ascii]
LDR r2,[r5,#size_ascii]
......@@ -619,16 +625,16 @@ just_update ; Window has changed, update it.
CMPEQ lr,r2,LSR #24
BNE %FT02
;ok, same units, replace free with size-used
; When all the same units, include a safety check in case it doesn't
; add up due to rounding errors, most notably when used+free=size-1
; Errors of >1 of the unit are assumed to be deliberate (eg user free space
; being less than available free space on whole disc etc)
SUB r1,r2,r0
ORR r1,r1,lr,LSL #24
;and include a safety check in case it doesn't add up for a reason
;errors of >1 of the unit are assumed to be deliberate (eg user free space
;being less than available free space on whole disc etc)
LDR r0,[r5,#free_ascii]
SUB r0,r1,r0 ; classic error is that used+free = size - 1 due to rounding error
SUB r0,r1,r0 ; r0 := size-used-free
CMP r0,#2
STRLT r1,[r5,#free_ascii]
STRLT r1,[r5,#free_ascii] ; out by one so override
02
LDR r0,[r5,#used_ascii]
MOV r3,#icon_Used
......@@ -644,7 +650,7 @@ just_update ; Window has changed, update it.
02
B updatelp
;--------------------------------------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; Entry r0 = value (low)
; r1 = value (high)
;
......@@ -652,61 +658,40 @@ just_update ; Window has changed, update it.
; the size in those units.
; r1 = corrupted
create_size_word
STMFD r13!,{lr}
create_size_word ROUT
[ fix_silly_sizes
CMP r0,#-1
CMPEQ r1,#-1
MOVEQ r0,#"?":SHL:24
BEQ %FT04 ; it's a silly size, mark as such
MOVEQ pc, lr ; it's a silly size, mark as such
]
TEQ r1,#0
BNE %FT01 ;value is M, G or TBytes
MOV lr,#" "
CMP r0,#&1000
MOVCS lr,#"K"
MOVCSS r0,r0,LSR #10
ADC r0,r0,#0
CMP r0,#&1000
MOVCS lr,#"M"
MOVCSS r0,r0,LSR #10
ADC r0,r0,#0
B %FT02
Push "r10,lr"
MOV r10, #0 ; SI unit index
20
CMP r1, #1
CMPCC r0, #4096 ; Keep dividing until < 4096
BCC %FT30
MOV r14, r1, LSL #22
MOV r1, r1, LSR #10
MOVS r0, r0, LSR #10
ORR r0, r14, r0
ADCS r0, r0, #0 ; Round up lost bit
ADC r1, r1, #0
ADD r10, r10, #1 ; Next 10^3 up
B %BT20
30
ADR r14,create_prefixes
LDRB r14,[r14,r10]