4 ; Setting up useful variables for BAS
6 ; © 1994-1998 Straylight
9 ;----- Licensing note -------------------------------------------------------
11 ; This file is part of Straylight's BASIC Assembler Supplement.
13 ; BAS is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
18 ; BAS is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ; GNU General Public License for more details.
23 ; You should have received a copy of the GNU General Public License
24 ; along with BAS. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ;----- Standard header ------------------------------------------------------
34 ;----- External dependencies ------------------------------------------------
39 ;----- Main code ------------------------------------------------------------
41 AREA |BAS$$Code|,CODE,READONLY
43 ; --- vars__setAscending ---
45 ; On entry: R3 == pointer to a name table
47 ; On exit: R3 points past the table
49 ; Use: Sets the variables named in the given table to have integer
50 ; values from 0 upwards. The table contains null-terminated
51 ; strings and is terminated by a null string.
53 vars__setAscending ROUT
55 STMFD R13!,{R0-R2,R4,R14} ;Save some registers
56 MOV R4,#0 ;Start counting at 0
57 00 MOV R0,R3 ;Point at the string
58 MOV R2,R4 ;Get the next value to set
59 LDRB R14,[R3],#1 ;Load first byte from string
60 CMP R14,#0 ;Is it the end of the table?
61 LDMEQFD R13!,{R0-R2,R4,PC}^ ;Yes -- we've finished then
62 ADD R4,R4,#1 ;Increment the counter
63 10 LDRB R14,[R3],#1 ;Load next byte from string
64 CMP R14,#1 ;Alternative name?
65 SUBEQ R4,R4,#1 ;Yes -- don't bump counter
66 CMPNE R14,#0 ;Is it the end yet?
67 BNE %10vars__setAscending ;No -- go round for more
68 BL bTalk_create ;Create the variable
69 BL bTalk_store ;Store the value away
70 B %00vars__setAscending ;Set the next variable
80 ; Use: Sets up variable names for registers (normal and APCS) and
81 ; also for condition codes.
86 STMFD R13!,{R0,R14} ;Save some registers
87 ADR R3,vars__names ;Point to big name table
88 BL vars__setAscending ;Standard registers
89 BL vars__setAscending ;APCS registers
90 BL vars__setAscending ;Standard condition names
91 LDMFD R13!,{R0,PC}^ ;And return to caller
93 vars__names DCB "R0",1,"r0",0
106 DCB "R13",1,"SP",1,"r13",1,"sp",0
107 DCB "R14",1,"LR",1,"LK",1,"r14",1,"lr",1,"lk",0
108 DCB "R15",1,"PC",1,"r15",1,"pc",0
129 DCB "EQ",1,"eq",1,"ZS",1,"zs",0
130 DCB "NE",1,"ne",1,"ZC",1,"zc",0
131 DCB "CS",1,"cs",1,"HS",1,"hs",0
132 DCB "CC",1,"cc",1,"LO",1,"lo",0
133 DCB "MI",1,"mi",1,"NS",1,"ns",0
134 DCB "PL",1,"pl",1,"NC",1,"nc",0
149 ;----- That's all, folks ----------------------------------------------------