home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / wackytalky_2 / Developer / Examples / PrivateMsg / NiceSRTs! (.txt) < prev    next >
Encoding:
RISC OS BBC BASIC V Source  |  1995-12-15  |  5.8 KB  |  156 lines

  1.   This is the source of 'NiceSTRs'
  2.   for help refer to: Documents.WTModules.NiceSTRs
  3.   Sorry for the lack of comments and for the pure use of GLib
  4.   functions and variables, but this is my style you know and
  5.   I haven't time (= I wasn't in mood) to convert it.
  6.   As always, it wasn't wise to use the new features in this source!
  7.   This is my last source with standard strings and quoted SWIs
  8.   (although I hex SWI numbers myself).
  9. "GLib:GLib":
  10. error
  11. save%   =1
  12. title$  ="NiceSTRs"
  13. file$   =title$
  14. +path$   ="<WTExamples$Dir>.PrivateMsg."
  15. version$="0.04"
  16. help$   =""
  17. help$  +=""
  18. dlrchunk%=&40
  19. pm_word=
  20. id("WT+_0") 
  21. code(50*1024,12)
  22. "WT_Install",code%
  23. save% 
  24. 8,10,path$+file$,&b6f,,code%,O%
  25. !E_________________________________________________________________
  26. mc:[optp%
  27. $,               
  28. wtm_header(last_is_pmh%)
  29. &E_________________________________________________________________
  30. (F.wtsh          teq 1,#
  31. id("WTService_Initialisation"):movnes 15,14
  32. )E__...............................................................
  33.                push 1-4,14
  34. +E               adr 0,needed:mov 1,#1:mov 2,#1:adr 3,help:mov 4,#0
  35. ,5               swi "XWT_Register":strvc 2,[12,#4]
  36.                pop
  37. /5.needed       :="WTDLRs":=0:="*WTDLRs_Install":=0
  38. 00               ="WT+":=0:="WTModules:WT+":=0
  39. 1>               ="PrettyHelp":=0:="WTModules:PrettyHelp":=0
  40.                =0
  41. 3E_________________________________________________________________
  42. 4<.pmh           teq 11,#
  43. num("WT+_Assemble"):movnes 15,14
  44. 5/               teq 0,#
  45. "Z":beq zita_strings
  46. 6+               teq 0,#
  47. "S":movnes 15,14
  48.                push 0-5,14
  49. 9:               *bl WT+_GetBASICStatus:bic 5,5,#&ff<<24
  50.                ldrb 14,[1]
  51.                teq   14,#32
  52. <!                 teqne 14,#34
  53. =#                 teqne 14,#
  54. >#                 teqne 14,#
  55. ?#                 teqne 14,#
  56. @#                 teqne 14,#
  57. A/                 moveq 5,0:beq nice_strings
  58.                  
  59. C                *bl WT+_Align
  60. D,               mov 9,2:mov 10,3:mov 12,0
  61. EJ               mov 0,1:adr 2,_swi:mov 3,#2:*bl WT+_CompareChars:popcs^
  62. F'               *bl WT+_GetCondition
  63. G"               *bl WT_NoSpace0
  64.                ldrb 14,[0]
  65. I.                 teq 14,#34:teqne 14,#
  66. J8                 subne 14,14,#48:cmpne 14,#10:popcc^
  67. K"               mov 11,1,lsl#28
  68. L,               mov 1,0:swi &20039:popvs^
  69. M0               orr 11,11,0:orr 11,11,#&f<<24
  70. N)               add 2,9,#4:add 3,10,#4
  71. O7               tst 12,#4:strne 11,[10]:streq 11,[9]
  72. P)               *bl WT+_SetBASICStatus
  73. Q+               mov 14,#0:str 14,[13,#4]
  74.                pop^
  75. _swi          :="WI"
  76. VI_____________________________________________________________________
  77. .zita_strings  push 0-5,14
  78. X)               *bl WT+_GetBASICStatus
  79.                ldrb 14,[1]
  80.                teq   14,#32
  81. [!                 teqne 14,#34
  82. \#                 teqne 14,#
  83. ]#                 teqne 14,#
  84. ^#                 teqne 14,#
  85. _#                 teqne 14,#
  86. `(                 cmpne 14,#31:popgt^
  87. b!               orr 5,0,#1<<24
  88.                
  89. d#.nice_strings  mov 9,2:mov 10,3
  90. f1               tst 0,#4:movne 12,3:moveq 12,2
  91. gF               *bl WT+_GetMnemonicStart   ; get pointer to source!
  92. h"               *bl WT_NoSpace0
  93. i2               teq 14,#
  94. ".":*bleq WT_JumpWord0
  95. j"               ldrb 14,[0,#1]!
  96. k=               teq 14,#
  97. "%":orreq 5,5,#1<<25:addeq 0,0,#1
  98.                b _wend
  99. n-_while         teq 14,#
  100. "#":beq _a_number
  101. o2               *bl WT+_GetString:bcs _a_number
  102. p<               tst 5,#1<<25:blne compress:bne _after_all
  103. qJ.loop          subs 2,2,#1:ldrgeb 14,[1],#1:strgeb 14,[12],#1:bgt loop
  104.                b _after_all
  105. s!_a_number      bic 5,5,#3<<30
  106.                ldrb 14,[0]
  107. u?                 teq 14,#
  108. "|":orreq 5,5,#1<<30:addeq 0,0,#1
  109. v?                 teq 14,#
  110. "#":orreq 5,5,#3<<30:addeq 0,0,#1
  111. w#               *bl WT+_GetValue
  112. x"               mov 14,5,lsr#30
  113. y/               tst 5,#1<<25:beq _store_loop
  114. z2               tst 5,#4:moveq 12,9:movne 12,10
  115. {*                 add 9,9,14:add 9,9,#1
  116. |.                 add 10,10,14:add 10,10,#1
  117. }O_store_loop    strb 1,[12],#1:subs 14,14,#1:movge 1,1,ror#8:bge _store_loop
  118. ~"_after_all     *bl WT_NoSpace0
  119.                mov 3,0
  120. ,               teq 14,#
  121. ",":addeq 0,0,#1
  122. "_wend          *bl WT_NoSpace0
  123. -               teq 14,#
  124. "@":bne _no_align
  125. .                 add  9, 9,#3:bic  9, 9,#3
  126. .                 add 10,10,#3:bic 10,10,#3
  127. .                 add 12,12,#3:bic 12,12,#3
  128. /                 add 0,0,#1:*bl WT_NoSpace0
  129. @                 teq 14,#
  130. ",":addeq 0,0,#1:*bleq WT_NoSpace0
  131. K_no_align      teq 14,#
  132. ":":teqne 14,#
  133. "\":teqne 14,#
  134. ";":teqne 14,#&f4
  135. *               cmpne 14,#31:bgt _while
  136.                ldrb 14,[3]
  137. #                 teq   14,#
  138. )                 moveq 0,3:beq _while
  139. 8               tst 5,#1<<25:movne 14,#0:bne _get_out
  140. 2               tst 5,#4:moveq 14,9:movne 14,10
  141.                sub 14,12,14
  142. )_get_out       add 2,9,14:add 3,10,14
  143. ,               tst 5,#1<<24:beq _no_zita
  144.                mov 14,#0
  145. 7               tst 5,#4:streqb 14,[2]:strneb 14,[3]
  146. (               add 2,2,#1:add 3,3,#1
  147. H_no_zita       *bl WT+_JumpMnemonic       ; alter pointer in source!
  148. )               *bl WT+_SetBASICStatus
  149. +               mov 14,#0:str 14,[13,#4]
  150.                pop^
  151. I_____________________________________________________________________
  152. .compress      push 0,5,14
  153. S               bic 0,5,#1<<25:mov 2,9:mov 3,10:mov 4,1:mov 5,#0:*bl PH_Compress
  154. #               mov 9,2:mov 10,3
  155.                pop^
  156.