I didn't realise the last Stuchat was in May! Oh well, here's some ramble accumulated over the last two weeks or so here in the Towers.

Please note that anything I may say regarding the next major release of Fantasm (5) is not set in stone. There is no definite release date and everything is always subject to change.

Before the holidays

Well, this isn't the StuChat you should be getting, so no timer tasks. Didn't generate much interest anyway so I'll leave it slip for now. I can however tell you that we were challenged to write a basic three-d maze type game in under 2k, which we did. It'll be available as a Fant5 project when we get it out (as an aside the latest Eclipse will also be out as a demo project - lots of goodies there). The 3d maze is in 68k as there was no way we could do it in PPC in under 2k, what with the instructions taking four bytes a go! Anyway..

I have to say this has most probably, no scratch that, it has been, the busiest week of my whole life, no scratch that too, all my previous lives (next time it's a cat for sure, got away with it this time!) and this one put together.

Sound like I'm loosing it? Probably.

You see, it all started a week ago when Rob said "here's the working code (he's pretty famous for that!), here's the email, see you after the holiday's - LNK's". A week later I'm dying. Just for the record, there is no way I could ever run Lightsoft on my own. It's quite easy with two, with just one, forget it! With two, each knows exactly what to do, and when and why. With just one it's too much.

I really tip my hat to guys that do it all on their own. Having said that, if it was just me I don't think I'd be working on 15 different projects simultaneously!

This week just about all hell broke loose at once, what with piling the code in, ensuring manuals track changes, playing with some other stuff, maintaining two email help lines (and fending off all the junk mail that goes to lightsoft@zedworld - it get's loads - after sending "Remove me or suffer!" messages to the first twenty I gave up - surely somebody can do something about these annoying parasites?), doing the orders (all order placed since last Friday have been done and posted), fending off magazines and surviving through a heat wave (it's 35 and s-t-i-c-k-y in here at the moment). It's been a hell of a week. I honestly can't remember when I last slept.

And then of course there was Apple - God knows what's going on. I sure as hell don't. All I know is the stock is up (you did buy when it was 13 didn't you :-)), so things must be going the right way; probably because the board has been replaced - about time too IMO. As I mentioned earlier, I was talking to a well known Mac mag for the masses this afternoon (not the litho and Photoshop variety) and they we're telling me how surprised they were when they started up at how eager the audience were for a general purpose Mac mag - you know, one that covered games and the like. I was also looking at another Mac mag, this time for techie types, studying the demographics and audited circulation figure which is growing all the time, so no worries.

Anyway, I'm off camping now - my turn for hols, although only five days as we are busy.

I'll finish this when I get back


After the holidays

Well that was fun. NOT! Story goes like this.

We leave late last Sunday heading for the west coast of Wales. After we've done about a hundred miles the van, Molly, misses a beat and then starts loosing power. So we get off the motorway into the services.

So, I'm sat there in my shorts, T-shirt and flip flops. I have a toolbox in the back under about 16 tons of baggage and an AA card in my wallet. What do I do? Do I spend ages digging out the toolbox, open the engine bay and get all dirty? Or do I wander over to phone and dial the free phone number? Well, it was difficult but I settled in the end for the phone and cigarette which seemed far more sensible at the time.

Now I've NEVER called the AA in my life, but it was late and Cath was a little upset and I just wanted the situation resolved like yesterday, so we called them. An hour later the nice man arrives and within about ten minutes declares the fault to be lead deposit shorting out the #3 sparkplug which he's cleaned and refitted and it should now be hunky. So we start it up and sure enough back to full power. Cool! I thought we'd be on the big yellow tow truck heading home by now, so totally happy. Off we go and finally hit west Wales a few hours later.

After about three days of torrential rain we decide enough is enough and we'd be better off back home sorting out the decorating (yes, the long saga continues). So we leave Wales. Within three hours of driving the sun is shining and the temperature is back up into the thirties, which is typical. Anyway, we pull off the motorway looking for fuel. I stop at a junction, put my foot down (it has to go down a long way) to move off when "BANG" from the engine bay and Molly sounds like a WWII tank. Hmmm. We stop.

Call AA again. Man arrives. Turns out that #3 sparkplug had decided it really didn't want to live in it's nice aluminium home any more and figured the only way out was to strip all the threads in the head and then wait for some pressure to build up. It's plan came to fruition when I put my foot down to move off at said junction.

Now this AA man assured me that it was complete and utter coincidence that this same very sparkplug was the one refitted by his mate not four days ago and it would definitely not have been cross-threaded. I'm not so sure.

So, big yellow transporter time and the fuel economy for the rest of the trip was fantastic, but that's more than made up for by the fact that I'm now faced with an extortionate bill from some complete and utter "we have you by the balls and we know it, grin" artists for rethreading the head, as naturally "the engine has to come out guv., we can't do that in-situ.". Grrr. Robbing bastards. I just _know_ it'll take them about an hour and I'll get charged a day for it. Life.


Fant 5 chat

Moving swiftly on to more sensible matters...

If you look back at Stuchat19 you'll see I was going on about some Fant5 facilities that would be useful. Well, now I can show you how one would actually code some of that stuff although not using the exact syntax as detailed in that Stuchat as we needed to keep the structure vaguely assembly languagish rather than making it look like straight BASIC :-).

This is how that "move immediate long" macro looks in F5:

**	movei	rx,data
**32 bit move into a register
movei:	macro
		ifne	narg-2
[x$]	str$	narg
		fail	"Wanted 2 params, got [x$]!"
		endif

[x$]	bin$	\2			*32 bit binary string
[y$]	left$	[x$],17	*get hi order 16 bits plus the %char
[z$]	right$	[x$],16
		li	\1,%[z$]		*generate the code - low order 16 bits
		oris	\1,\1,[y$]	*hi order 16 bits
		endm

It's called as "movei rx,number" and is the equivalent of the 68k move.l # instruction.

We've given F5 26 user level string variables identified as [A$] through [Z$] - doing things with strings is extremely flexible - there are seven or eight directives for string manipulation allowing much more complex control code generation than is possible in V4.xx.

My favourite directive has to be dfsin (define float sin) used as follows:

*360 degrees sin table step 0.5
[h$]:	equ$	.5
angle: set 0	*Starting angle is zero degrees
my_sin_table:	data
		repeat
[a$]:	str$	angle
[b$]:	concat$	[a$],[h$]
		dfsin.s	[a$]	*define integer
		dfsin.s	[b$]	*define integer+0.5
angle:	set	angle+1
		until_eq	360-angle


This code defines a sine table with entries from zero to 360 in steps of 0.5 degrees.

There is a double version that reads dfsin.d and support for defining floats as well - df.s and df.d. And before anybody moans at us, there is no dfcos directive as cos(x) is the same as sin(x-90) or maybe the other way round, "maths schmaths" is what I say when it's this humid. Either way it isn't necessary and you know we like to keep things lean and mean.

Just one more "don't moan at me" item; if you want to use the floating directives in Fant5 then you need a PowerMac as all the float directives are implemented native only.

There's also a load of internal variables you can use such as [hours$] - replaces itself with the hours portion of the local time, rssz - returns the current rs counter value, but my favourite is [build$] which returns the current build number as a string. The build number is incremented by 1 for every good build (it's only my fave because it's something I've always wanted, but there you go...).

My favourite, favourite item in Fant5 is the ability to export all global code labels - this makes debugging with Macsbug far easier as Macsbug will show them, viz:

     +00168 0271712C   mtctr      r5                         ; CTR = 0x0009 | 7CA903A6
     +0016C 02717130   stbu       r4,0x0001(r5)                           | 9C850001
     +00170 02717134   bdnz       eclipse_main+0016C         ; 0x02717130 | 4200FFFC
     +00174 02717138   lwz        r3,0x016C(r30)                          | 807E016C
     +00178 0271713C   addi       r3,r3,0x002D                            | 3863002D
     +0017C 02717140   li         r5,0x0008                               | 38A00008
     +00180 02717144   mtctr      r5                         ; CTR = 0x0009 | 7CA903A6
     +00184 02717148   stbu       r4,0x0001(r5)                           | 9C850001
     +00188 0271714C   bdnz       eclipse_main+00184         ; 0x02717148 | 4200FFFC
     +0018C 02717150   li         r3,0x0001                               | 38600001
     +00190 02717154   sth        r3,0x11E0(r30)                          | B07E11E0
     +00194 02717158   bl         do_mission_brief           ; 0x0271C7CC | 48005675
     +00198 0271715C   li         r3,0x0001                               | 38600001
     +0019C 02717160   sth        r3,0x11E8(r30)                          | B07E11E8
     +001A0 02717164   bl         print_with_move+000A8      ; 0x02717A28 | 480008C5
     +001A4 02717168   bl         init_ship                  ; 0x0271B7D4 | 4800466D
     +001A8 0271716C   bl         clear_offscreen            ; 0x0271A024 | 48002EB9
     +001AC 02717170   bl         splat_screen               ; 0x0271A084 | 48002F15
     +001B0 02717174   bl         do_wave                    ; 0x02717874 | 48000701
     +001B4 02717178   lhz        r3,0x0E00(r30)                          | A07E0E00
     +001B8 0271717C   cmpwi      r3,0x0000                               | 2C030000
     +001BC 02717180   beq        game_end+00014             ; 0x02717608 | 41820488

This first made an appearance in V403 which we did as an internal prototype, and some people moaned about it being dropped in 404 onwards. Well it's back, it works, it's cool. You may know this already, but a source level debugger (FantBug. Natch) is on the way, although it won't be ready when Fant 5 get's released. Oh, this also means Fant5 can create shared libs which is also cool for people wanting to accelerate C projects etc. Indeed Fant5 uses it's own little shared lib to provide the floating directives.


What I really, really hate about this next release is the documentation. I'm not sure if it's the coding, or the documentation that's the most time consuming. I think it's probably the documentation. This is where loads of RAM comes in handy. We decided it would be most useful to have a master index document which lists all the other docs contents. Indeed, this is useful, but it's been a bugger to set up. I now truly know the meaning of "cross"-index. A cross is something they crucify people on and that's no lie.

Anyway, as I've said before, we never stop developing Fantasm, and even though we're working on Fant5, we have 5.1 and 6 slated with loads more improvements planned. We still have some work on 5 to do but it's been testing as we go along (we phased development where each phase represents a specific goal) for about the last three months and seems to be settling down nicely.

Lastly, here's my favourite test piece (this is out of the Fant5 user manual), it finds the first space in a string [a$]:

*******************Find the space character in [a$]**********************
[a$]:	equ$	Alittlesearchtest	*Our test string - in this case there is no space to find
error:	set	false				*When we come out of the search loop, we check this
index:	set	0					*Index into [a$]
space_char:	equ	32				*ASCII value of a space
string_end:	len	[a$]			*The physical end of the string, so we can check
								*if we run out of data without getting an error
								*from Fantasm.

		repeat					*Search loop
[b$]:		mid$	[a$],index,1	*Get next character out of [a$]
b:			asc$	[b$]			*Convert the string to an ascii value we can compare
index:		set	index+1				*increment index into [a$]

			ifeq	string_end-index	*Reached end of string?
b:				set	space_char			*yes, so set our terminate condition
error:			set	true				*Set our error flag
			endif
		until_eq	space_char-b		*Space is ASCII 32, so if 32-char is zero then stop
								*else repeat

**Now check if we had an error and do the processing or not as the case may be
		if	error
**Dont do whatever we do if space isn't found
		fail	"There is no space character in [A$]"
		else
**Go ahead, we found the space.
**index contains character position in a$ of the space
**now, in conjunction with the len and right$ directives we could chop out what 
**follows the space, or use the left$ directive to get at what comes before.
		endif

Well I'd better get on with it. Just yesterday the very last CCP (Client Command Processor) call went in for the v1.00 API release. That was a nice feeling. We're still working on the stall and bubbles warnings. This is a lot of work as the only proper way to do it is to provide an emulated CPU that is fed the assembled stream and pops a warning if a stall or bubble has been created in one of the execution units. We call it "R2D2" - bit sad, but that's life. Again, you're going to need a PowerMac to run R2D2 as it takes a lot of horsepower and is native only (as of this time :-)).

Oh, just before I go, a blatant plug. About two weeks ago I got hold of a copy of Bjorn Lynne's latest album called "Decade" celebrating his 10 years in computer based music. On this CD are 12 most excellent tracks (really, no crap tracks as you'd normally find on any album) - in particular I LOVE Hyperride II and Bridge to the universe part 3. Also on the CD is a data track holding hundreds of MOD's - his whole output as a matter of fact including classics such as Space Deliria, 12th Warrior etc. There's also a shed load of MIDI music (OK, MIDI's dreadful) and lots of MP3, samples and generally good stuff. AnvMOD has been churning through these MOD's like a good 'un and I am most impressed with a lot of them.

How much was this colossal compilation - just thirteen UK pounds. Plus it's signed and serial numbered (I got #12). I think it's a complete bargain. If you're at all interested in this kind of music then there's a link to Bjorn's page on Lightsoft's links page, down the bottom somewhere. You can download some of his music in MP3 format there. (You'll need MacAmp from Nullsoft to play these).

 

Till the next time,

Code on!

Stu.


Send mail to Stu



Back to Stu's Page Top Level

Back to Lightsoft Home Page