Okay, after a request for more info on the scripting engine/system I use, I've written up a small description of how it all works. It's not hugely in-depth, but it should give you the jist on how it all works...
So have a look HERE to read through, but feel free to ask questions afterwards. I do intend to write up an API for the script system, and do several examples and tutorials for when I release the code. I've some some small samples and doc's so that Luca and play with it, but I really need to do far more.
Thanks. How deep is the mini stack? Just one entry? Subroutines (just one level) could be useful for cramming more data into the game, but that depends a lot on the attack patterns.
ReplyDeleteI would like to see the inner working of CIRCLE command. I remember you writing about it last year, but that entry didn't go too deep into the details.
DoNextCommand:
ldy #0 ; reset index into command
lda (PathAddress),y ; get command
asl a ; *2 to index table
tay
How about using commands which are *2 already :)
; Move absolute
iny
clc
lda (PathAddress),y ; get move-to "X"
bpl DoAddX
adc SpxLo,x
bcs SkipAddX
dec SpxHi,x
bcc SkipAddX
DoAddX:
adc SpxLo,x
bcc SkipAddX
inc SpxHi,x
SkipAddX:
sta SpxLo,x
iny
clc
lda Spy,x
adc (PathAddress),y
sta Spy,x
jmp DoNextPathAddY
; ...
DoNextPathAddY:
sec
tya
adc PathAddress
sta PathAddress
bcc DoNextPath
inc PathAddress+1
DoNextPath:
Saves some cycles/bytes. If DoNextPath() works like I think, you can add Y+1 to PathAddress and store it directly to PAlo/PAhi table.
--
TNT
Thank you Mike =D
ReplyDeleteKeep up the good work, looking forward for the playable demo.
ciao
I don't actually have a DoNextPath() call in the 6502 source, but I probably would in a higher level langauge.
ReplyDeleteOptimisation is a skill of picking your fights, and aside from the circle command, I dont think the rest of the script system takes up that much - sprite drawing is by far the largest system, followed by scrolling.
Thats not to say I wont look at it.... just not yet :)
I dont use CALL's in XeO3, and only allow 1 deep FOR statements. This is a limitation due to memory and speed. I have done these on faster systems though.
ReplyDeleteSo basically, the mini-stack is only 1 entry deep.