home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 2
/
DATAFILE_PDCD2.iso
/
utilities2
/
_addresses
/
!Addresses
/
MakeCode
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1993-09-22
|
2KB
|
94 lines
>MakeCode
Forms part of !Addresses v1.16 upwards
Thanks to M.T.C.'s book ARM Assembly Language Programming for 'toUpper'
" at line ";
code% 512, buff1% 20, buff2% 20
cr=&0D
strPtr=0
sp=13
link=14
carryBit=&20000000
pass%=0
P%=code%
[opt pass%
.toUpper
% STMFD (sp)!,{R1,strPtr,link}
.toUpLp
LDRB R1, [strPtr], #1
CMP R1, #cr
& LDMEQFD (sp)!, {R1, strPtr, pc}
CMP R1,#
RSBHSS R2,R1,#
SUBHS R1,R1,#&20
STRB R1,[strPtr, #-1]
B toUpLp
MOV pc,link
.sort
.sortlp
LDRB r2,[r0],#1
LDRB r3,[r1],#1
CMP r2,#cr
BEQ lower
CMP r3,#cr
BEQ higher
CMP r2,r3
BEQ sortlp
BLT lower
B higher
.lower
MOV r0,#1
CMP r2,r3
Q r0,#2
MOV pc,link
.higher
MOV r0,#0
CMP r2,r3
Q r0,#2
MOV pc,link
4K$buff1%="Neil Walker":
$buff1%;:A%=buff1%:
toUpper:
" Becomes "$buff1%
5Q$buff1%="NEIL WALKAR":$buff2%="NEIL WALKER":A%=buff1%:B%=buff2%:result%=
result%
7-
$buff1%;" is lower than ";$buff2%
8-
$buff2%;" is lower than ";$buff1%
"Equal"
count%=0
1000
>Fentry$="NEIL WALKER":nextentry$="NEIL WALKAR":ascending%=
:swap%=0
ext%=1
@G char%=(
entry$,ext%)
&5F):nextchar%=(
nextentry$,ext%)
ascending%
B%
char%>nextchar% swap%=
D%
char%<nextchar% swap%=
F
char%=nextchar%
-s%,swap%
swap%=0
count%=0
1000
MQ$buff1%="NEIL WALKAR":$buff2%="NEIL WALKER":A%=buff1%:B%=buff2%:result%=
ascending%
result%=1 swap%=
result%=0 swap%=
-s%,swap%
"SAVE Code "+
~code%+" "+
"SetType Code Data"
"toUpper offset = ";toUpper-code%
"sort offset = ";sort-code%