home *** CD-ROM | disk | FTP | other *** search
RISC OS BBC BASIC V Source | 1995-12-15 | 5.8 KB | 156 lines |
- This is the source of 'NiceSTRs'
- for help refer to: Documents.WTModules.NiceSTRs
- Sorry for the lack of comments and for the pure use of GLib
- functions and variables, but this is my style you know and
- I haven't time (= I wasn't in mood) to convert it.
- As always, it wasn't wise to use the new features in this source!
- This is my last source with standard strings and quoted SWIs
- (although I hex SWI numbers myself).
- "GLib:GLib":
- error
- save% =1
- title$ ="NiceSTRs"
- file$ =title$
- +path$ ="<WTExamples$Dir>.PrivateMsg."
- version$="0.04"
- help$ =""
- help$ +=""
- dlrchunk%=&40
- pm_word=
- id("WT+_0")
- code(50*1024,12)
- "WT_Install",code%
- save%
- 8,10,path$+file$,&b6f,,code%,O%
- !E_________________________________________________________________
- mc:[optp%
- $,
- wtm_header(last_is_pmh%)
- &E_________________________________________________________________
- (F.wtsh teq 1,#
- id("WTService_Initialisation"):movnes 15,14
- )E__...............................................................
- push 1-4,14
- +E adr 0,needed:mov 1,#1:mov 2,#1:adr 3,help:mov 4,#0
- ,5 swi "XWT_Register":strvc 2,[12,#4]
- pop
- /5.needed :="WTDLRs":=0:="*WTDLRs_Install":=0
- 00 ="WT+":=0:="WTModules:WT+":=0
- 1> ="PrettyHelp":=0:="WTModules:PrettyHelp":=0
- =0
- 3E_________________________________________________________________
- 4<.pmh teq 11,#
- num("WT+_Assemble"):movnes 15,14
- 5/ teq 0,#
- "Z":beq zita_strings
- 6+ teq 0,#
- "S":movnes 15,14
- push 0-5,14
- 9: *bl WT+_GetBASICStatus:bic 5,5,#&ff<<24
- ldrb 14,[1]
- teq 14,#32
- <! teqne 14,#34
- =# teqne 14,#
- ># teqne 14,#
- ?# teqne 14,#
- @# teqne 14,#
- A/ moveq 5,0:beq nice_strings
-
- C *bl WT+_Align
- D, mov 9,2:mov 10,3:mov 12,0
- EJ mov 0,1:adr 2,_swi:mov 3,#2:*bl WT+_CompareChars:popcs^
- F' *bl WT+_GetCondition
- G" *bl WT_NoSpace0
- ldrb 14,[0]
- I. teq 14,#34:teqne 14,#
- J8 subne 14,14,#48:cmpne 14,#10:popcc^
- K" mov 11,1,lsl#28
- L, mov 1,0:swi &20039:popvs^
- M0 orr 11,11,0:orr 11,11,#&f<<24
- N) add 2,9,#4:add 3,10,#4
- O7 tst 12,#4:strne 11,[10]:streq 11,[9]
- P) *bl WT+_SetBASICStatus
- Q+ mov 14,#0:str 14,[13,#4]
- pop^
- _swi :="WI"
- VI_____________________________________________________________________
- .zita_strings push 0-5,14
- X) *bl WT+_GetBASICStatus
- ldrb 14,[1]
- teq 14,#32
- [! teqne 14,#34
- \# teqne 14,#
- ]# teqne 14,#
- ^# teqne 14,#
- _# teqne 14,#
- `( cmpne 14,#31:popgt^
- b! orr 5,0,#1<<24
-
- d#.nice_strings mov 9,2:mov 10,3
- f1 tst 0,#4:movne 12,3:moveq 12,2
- gF *bl WT+_GetMnemonicStart ; get pointer to source!
- h" *bl WT_NoSpace0
- i2 teq 14,#
- ".":*bleq WT_JumpWord0
- j" ldrb 14,[0,#1]!
- k= teq 14,#
- "%":orreq 5,5,#1<<25:addeq 0,0,#1
- b _wend
- n-_while teq 14,#
- "#":beq _a_number
- o2 *bl WT+_GetString:bcs _a_number
- p< tst 5,#1<<25:blne compress:bne _after_all
- qJ.loop subs 2,2,#1:ldrgeb 14,[1],#1:strgeb 14,[12],#1:bgt loop
- b _after_all
- s!_a_number bic 5,5,#3<<30
- ldrb 14,[0]
- u? teq 14,#
- "|":orreq 5,5,#1<<30:addeq 0,0,#1
- v? teq 14,#
- "#":orreq 5,5,#3<<30:addeq 0,0,#1
- w# *bl WT+_GetValue
- x" mov 14,5,lsr#30
- y/ tst 5,#1<<25:beq _store_loop
- z2 tst 5,#4:moveq 12,9:movne 12,10
- {* add 9,9,14:add 9,9,#1
- |. add 10,10,14:add 10,10,#1
- }O_store_loop strb 1,[12],#1:subs 14,14,#1:movge 1,1,ror#8:bge _store_loop
- ~"_after_all *bl WT_NoSpace0
- mov 3,0
- , teq 14,#
- ",":addeq 0,0,#1
- "_wend *bl WT_NoSpace0
- - teq 14,#
- "@":bne _no_align
- . add 9, 9,#3:bic 9, 9,#3
- . add 10,10,#3:bic 10,10,#3
- . add 12,12,#3:bic 12,12,#3
- / add 0,0,#1:*bl WT_NoSpace0
- @ teq 14,#
- ",":addeq 0,0,#1:*bleq WT_NoSpace0
- K_no_align teq 14,#
- ":":teqne 14,#
- "\":teqne 14,#
- ";":teqne 14,#&f4
- * cmpne 14,#31:bgt _while
- ldrb 14,[3]
- # teq 14,#
- ) moveq 0,3:beq _while
- 8 tst 5,#1<<25:movne 14,#0:bne _get_out
- 2 tst 5,#4:moveq 14,9:movne 14,10
- sub 14,12,14
- )_get_out add 2,9,14:add 3,10,14
- , tst 5,#1<<24:beq _no_zita
- mov 14,#0
- 7 tst 5,#4:streqb 14,[2]:strneb 14,[3]
- ( add 2,2,#1:add 3,3,#1
- H_no_zita *bl WT+_JumpMnemonic ; alter pointer in source!
- ) *bl WT+_SetBASICStatus
- + mov 14,#0:str 14,[13,#4]
- pop^
- I_____________________________________________________________________
- .compress push 0,5,14
- S bic 0,5,#1<<25:mov 2,9:mov 3,10:mov 4,1:mov 5,#0:*bl PH_Compress
- # mov 9,2:mov 10,3
- pop^
-