| www.retrosoftware.co.uk http://www.retrosoftware.co.uk/forum/ |
|
| BeebASM and strings http://www.retrosoftware.co.uk/forum/viewtopic.php?f=17&t=818 |
Page 1 of 1 |
| Author: | sweh [ Sun Mar 24, 2013 6:09 pm ] |
| Post subject: | BeebASM and strings |
I'm converting some code from ADE to BeebASM 1.04 (on Linux) and I've got a silly question. Unfortunately "beebasm" is too common in this forum to search on...! In ADE I can do things like Code: date ASET "21 Mar 2013" And then later Code: ASC " (@date)" Is it possible to define strings in this way with BeebASM ? I tried the obvious Code: date = "21 Mar 2103" and this failed... Similarly, in ADE I can do Code: verb ASET 16 DB @verb ASC "0.@verb" A nice mix of integer and strings... can this be done in BeebASM? |
|
| Author: | DaveJ [ Mon Mar 25, 2013 8:01 am ] |
| Post subject: | Re: BeebASM and strings |
I'm sure Rich TW will be along in a second, but if you want to store the sequence of bytes that make up the string with a label pointing to the first character, in BeebASM you use EQUS, the same as you would on a real Beeb. |
|
| Author: | RichTW [ Mon Mar 25, 2013 9:55 am ] |
| Post subject: | Re: BeebASM and strings |
Hello! No, unfortunately this isn't possible in BeebAsm - the only supported type of string is a string literal, i.e. a string in quotes. The closest you could get I guess would be to use a macro to expand to EQUS "yourstring", e.g. Code: MACRO DATE EQUS "21 Mar 2013" ENDMACRO ... .versionstring EQUS "Version 1.00 (" DATE EQUS ")" A little weird perhaps, but it kinda has the same effect. I didn't bother with too much high-level support for strings, as they're not normally so important in assembly language programs, but I hope that's a reasonable enough work-around! By the way, macros only appeared in a more recent version of BeebAsm (I don't think they're in 1.04), so you might have to compile the latest version - hopefully this is not too big a problem though. |
|
| Author: | sweh [ Mon Mar 25, 2013 11:49 am ] |
| Post subject: | Re: BeebASM and strings |
Yeah, once I updated to 1.08 (see crossthread), I ended up with a solution similar to that: Code: include "compile_date" MACRO VERSION_BYTE EQUB 1 ENDMACRO MACRO VERSION_STRING EQUS "0.01.1" COMPILE_DATE ENDMACRO MACRO VERSION_DATE EQUS "21 Mar 2013" ENDMACRO MACRO VERSION_NAME EQUS "MYCODE" ENDMACRO ... JMP Language JMP Service EQUB &82 EQUB Copyright-&8000 VERSION_BYTE VERSION_NAME EQUB 0 VERSION_STRING EQUS " (" VERSION_DATE EQUS ")" .Copyright "compile_date" is basically a "build" number for my internal testing so I can be sure the latest ROM was loaded into SWR to test against Code: compile_date: 6502src.txt
(echo MACRO COMPILE_DATE ; echo " EQUS \":`date +%Y%m%d-%H%M%S`\"" ; echo ENDMACRO ) > compile_date grep EQUS compile_date |
|
| Author: | jgharston [ Fri Mar 29, 2013 10:27 pm ] |
| Post subject: | Re: BeebASM and strings |
sweh wrote: Code: MACRO VERSION_STRING EQUS "0.01.1" COMPILE_DATE ENDMACRO VERSIONSTRING should be a.bc (eg 1.23) so the ROM header's version string is either exactly four characters (eg "1.23") or exactly 18 characters (eg "1.23 (12 Jan 2013)", eg: EQUS "ROM TITLE" EQUB 0 EQUS "1.23 (12 Jan 2013)" .copyrightoffset EQUB 0 EQUS "(C)Author Name" EQUB 0 |
|
| Author: | sweh [ Sun Mar 31, 2013 7:35 pm ] |
| Post subject: | Re: BeebASM and strings |
Colour me confused; where did this requirement come from? I never saw this BITD. Admittedly, about 85% of the ROMs (112 out of 135) I collected BITD follow your spec, but not all. Heh, seem's even Acorn didn't follow that standard all the time Code: 00000000 4C 88 81 4C D5 80 C2 16 L..L....
00000008 01 56 69 65 77 53 74 6F .ViewSto 00000010 72 65 00 31 2E 31 00 28 re.1.1.( 00000018 43 29 20 31 39 38 35 20 C) 1985 00000020 41 63 6F 72 6E 73 6F 66 Acornsof |
|
| Author: | RichTW [ Mon Apr 01, 2013 9:01 am ] |
| Post subject: | Re: BeebASM and strings |
sweh wrote: Colour me confused; where did this requirement come from? I never saw this BITD. Admittedly, about 85% of the ROMs (112 out of 135) I collected BITD follow your spec, but not all. No, I agree this is not an Acorn guideline and certainly not a requirement. Probably it's an attempt to try to retroactively apply some consistency to 'new' sideways ROMs, but, for example, the verbose form which includes the date is very much a RISC OS thing - this was the preferred format for module headers. |
|
| Page 1 of 1 | All times are UTC [ DST ] |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|