It is currently Mon Oct 20, 2014 4:25 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 104 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
PostPosted: Fri Feb 20, 2009 7:31 am 
Offline
User avatar
 WWW  Profile

Joined: Thu Jan 10, 2008 7:45 pm
Posts: 472
Location: Treddle's Wharf, Chigley
I tried v0.4 this morning. It's really coming on. Completely smooth, no flicker (so better than about 90% of BBC software released commercially before mid-1985), plays really nicely.

My suggestions for the capacious 71 bytes you have left is some nice sound effects, and that tension building noise that used to gradually speed up in the background in space invaders games. I suppose then you'd have to include a sound on/off key. A pause/restart key would be nice too. Other ideas could be a joystick option or a loader program written in Basic that let you define the control keys. So, not much to squeeze into 71 bytes!


Top
 
PostPosted: Fri Feb 20, 2009 9:37 am 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
Hi Neil,

Just in case you're not already doing it, there are other little bits of memory you can use - for example the space between $400...$7FF is free, as is $900...$CFF. Then, of course, you have the whole of $E00...$2FFF to use, the only caveat being that older DFSs on the B/B+ require at least $E00...$10FF for themselves, so you have to load the code to a higher address in memory and relocate it down to its correct place when everything's loaded (see later).

You can also use $D00...$DFF, provided you put an RTI instruction at $D00 (as it is the NMI entry point), and you reset all the vectors to their defaults in the OS with some code which looks a bit like:

Code:
SEI
LDX #0
LDA $FFB7
STA resetvectorloop + 1
LDA $FFB8
STA resetvectorloop + 2
resetvectorloop:
LDA $FFFF,X    ; self modified to the default vector table in the OS
STA $200,X
INX
CPX $FFB6
BNE resetvectorloop
CLI
(see Advanced User Guide P265)

This is because some paged ROMs can claim the vectors for themselves, but they then use a table at $D9F to indicate this (which if you overwrite with code, could potentially screw up calls to OS routines in your game - AUG P326).

In fact quite a lot of games have their code assembled at a low address like $900, but then load at $1900, with their execution address set to a small routine at the end of the executable which selects the tape filing system (to release the DFS workspace at $E00...$10FF), resets the vectors, and relocates the entire code block to its 'real' location in memory.

When you get really desperate, there are also other little bits, e.g.
$880...$8BF
$380...$3DF
and even, the bottom of the stack from $100 upwards (as much as you dare use), provided you set the stack pointer to the top of the stack with
Code:
LDX #255
TXS
first.

I'll check out the latest build before I leave work tonight (no internet at home, the horror!)


Top
 
PostPosted: Fri Feb 20, 2009 11:32 am 
Offline
User avatar
 Profile

Joined: Sat May 10, 2008 12:38 pm
Posts: 110
Location: Northampton
Well, thanks Dave and Rich!

Hmmm good suggestions Dave, they would certainly finish off the invaders, many thanks for your feedback!

Now Rich- you have made me drawl, jezzz there's a heap of memory suddenly free for me!! A whole 1024 bytes starting at 0x300, I can think of uses for that! It's interesting, your note on starting at 0xe00, this I changed to, awhile back as I noted I was lacking memory. When testing recently beebEm wasn't running the invaders when in the basic bbc-b emulation. I seemed to remember reading somewhere that DFS used buffers at 0xe00 - so I updated my org address.
I might create some notes somewhere for myself, so they are all in one place. Haha, we need a "Coder's quick reference book for the BBC B". :lol:
Or, or ... hmmm ... I do!! :D

Right - to work for me,
thanks - Neil


Top
 
PostPosted: Fri Feb 20, 2009 1:12 pm 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
heheh happy to be the bringer of good news :)

just thought I'd add an example of self-relocating code, so you can see how it might work.

As we said, we can't load code from DFS over $D00...$10FF - however, we can load it to a higher address, and then get it to relocate itself down when it's finished loading.

Suppose the code had an ORG of $900. Then we add to the end of the executable:

Code:
ORG $900

;
; the entire game code lives here
;

; now we define the entry point
; assume that the executable will be loaded at $1900
; and it needs to relocate itself down to $900
; This code will be called before the relocation has been done,
; so we need to add $1000 to all absolute addresses we
; assemble.

.align 256  ; or however you align to a particular address boundary
ENTRY_POINT:

; select *TAPE
LDA #140
JSR $FFF4

; reset vector table
SEI
LDX #0
LDA $FFB7
STA resetvectorloop+$1001 ; as it will be running $1000 bytes higher than the ORG address
LDA $FFB8
STA resetvectorloop+$1002
resetvectorloop:
LDA $FFFF,X    ; self modified to the default vector table in the OS
STA $200,X
INX
CPX $FFB6
BNE resetvectorloop
CLI

; self-relocate
LDX #(ENTRY_POINT-$900)/256
LDY #0
relocateloop:
LDA $1900,Y  ; high byte self modified
STA $900,Y  ; high byte self modified
INY
BNE relocateloop
INC relocateloop+$1002
INC relocateloop+$1005
DEX
BNE relocateloop

; now all the code is at the address it was assembled at,
; so we can now call the proper game entry point

JMP game_start


Now you have an executable which is designed to be run from an address of $900, but with an entry point which is designed to be run from an address $1000 higher, and which copies all the code down to its proper location, before calling its start address.

On a beeb, you would modify the load and execution addresses of the file to be $1000 higher, and then this would just work from *RUN automatically.

This kind of trick is done in just about every game I've ever seen!!!

Hope this all makes sense...!


Top
 
PostPosted: Fri Feb 20, 2009 1:42 pm 
Offline
Site Admin
User avatar
 Profile

Joined: Wed Dec 19, 2007 10:41 pm
Posts: 373
Hi Neil, can see you're keen to get this released so in terms of feedback/requests I'll keep it brief ... !

- replace requirement to hit Fire between levels with a delay? (I'd probably lose the "Sparce Invaders" and "A Small Production" text between levels too). On the Final build, I'd probably be tempted to drop the date off the title screen as well.

- thanks for animating the mothership :) though I'm not mad on all the different colours (not "sparse" enough! ;) ). I reckon making the whole thing green (with either red or black eyes) would help it match the style of the other objects.

- allow initials to be entered into high score table?

- sound!

And I'm afraid there's still a bug in there ... I've just played it about five times but on the fourth time, on level 1 the invaders continued past the screen border on the right-hand side and reappeared on the left. Once this had happened the gameplay got kind of screwy i.e. bulletts would go straight through the invaders.

But apart from that, it's looking swell!


Top
 
PostPosted: Fri Feb 20, 2009 4:07 pm 
Offline
User avatar
 Profile

Joined: Sat May 10, 2008 12:38 pm
Posts: 110
Location: Northampton
Aww - loving the feedback ...!

Rich, reference the code snippet: that's a god-send that is - I'll have so much more memory to play with! Why, oh why am I not at home where I can get coding!!

Will definitely need it - with the changes suggested, ( Thanks Dave for your feedback. )...

Hmmm I'm going to have to made a list of changes.

Dave, can I ask if you see that problem again- with the invaders going off the right, can you tell me if it was the start of the level, what level etc ... any detauls would be great, I have to admit, I've played it so many times and never seen that issue, in months!
Also, if you are using beebEm, what are your settings for it?
Thanks in advance Dave!

I'll be honest here, I wasn't going to do any more work on the game, apart from bug fixing, howeer I've just downloaded four other space invaders - from Acornsoft, Bugbyte, Pro and Superior... And I came to the conclusion that, for all it's sins - Sparse Invaders is better for various reasons with all four of the titles I tested. Some were so shocking, but I think the main problem is - TOO MANY INVADERS ... However, looking at my timings I could get quite a few more invaders on screen. But that time will be for the sound, bless!

I was sort of hoping to get it finished for the show in March, but that's coming around a little quickly... oh well!

Right, my boss is approaching my desk, better type quickly and depart! :lol:

thanks all, Neil


Top
 
PostPosted: Sun Feb 22, 2009 1:34 pm 
Offline
User avatar
 Profile

Joined: Tue Mar 25, 2008 4:22 pm
Posts: 129
This looks good and plays well AFAICT - do the aliens change as the game progresses? A few different aliens might really lift the game.


Top
 
PostPosted: Mon Feb 23, 2009 5:25 pm 
Offline
Site Admin
User avatar
 Profile

Joined: Wed Dec 19, 2007 10:46 pm
Posts: 779
DaveM wrote:
NeilB wrote:
And the changes of anyone selling it are very slim, borderline FLAT... 8-)

Ahem! ;)

Actually, ... I would like to be able to offer packaged versions of free downloads should anybody want one (e.g. £0.95p for a tape or £1.50 for a disc).

Would the license still be valid if we did this?

NeilB wrote:
Sure Dave, :lol:

you can sell all the copies you want! I'll be buying one! :D

I am just thinking of bedroom-joe who decides to sell it, or a slightly modified version.

As far as RetroSoftware is concerned, you sell all you want!!

thanks Dave,

Neil

Yep, just to clarify, unless he signed an "exclusive" distribution deal with someone, Neil can release the game under as many licenses as he wants, so even if the GPL did restrict the selling of the games (it doesn't), he could still grant Retro Software a commercial license, separately. However, as discussed, as he's chosen GPL, technically, anyone (including bedroom-joe!) could download it and try to sell it on - however, they'd /have/ to provide the source code to anyone who buys a copy, even tho it can contain significant code modifications to the original. So it would be a bit pointless, as we could then post that new code on Retro Software for anyone else to download! It would be a pretty dumb decision from a business point of view. ;)

Bottom line, there's no legal problems with Retro Software being a commercial publisher of GPL software. :)

Sam.

P.S. And I also think significant kudos to Neil for not only providing us with the game itself, but for all the extra effort he's putting in allowing others to follow in his footsteps. Bringing together these kinds of resources (source code, documentation, pointers to useful resources etc.), is just what the site was built for! :) I have at least one person in my inbox who was asking whether we had any "shell" games with source code they could use to get started. As soon as Neil releases it, I'll be dropping them a link ...


Top
 
PostPosted: Mon Feb 23, 2009 7:01 pm 
Offline
User avatar
 Profile

Joined: Sat May 10, 2008 12:38 pm
Posts: 110
Location: Northampton
Thanks Sam,

That's a lot clearer, all this legal mumbo-jumbo is really important, but for a humble old-coder it's ever-so-slightly-confusing! I want to blame the rock band budgie in 1982, long story! ;-)

Thanks also for your kind comments - I have to admit, 20 old yrs ago - I would of been more protective of my code, ;-) Again I want to blame Budgie!

I certainly don't mind all of this, seems to make sense to allow anyone to download the source and binary. What a waste it would be, write a game - and then archive off the source, basically throwing the key away and that's the life cycle of that! All us coders know we put a little extra something into each project (apart from work! ;-) ) creating a game or app that we feel is good, but more importantly there's the feeling of proud at completing it. I just think it's a crying shame just to lock all that away!
Giving the source to the community keeps the project alive! Also, wouldn't it be fab to think that there might even be one or two more games on RS due to the efforts of not just myself but everyone who's helped on this forum. OH, not forgetting Steve and his great tool SWIFT which makes 6502 development for the Beeb very painless!

Ok, enough of my ramblings,
thanks - Neil


Top
 
PostPosted: Mon Mar 02, 2009 11:13 am 
Offline
User avatar
 Profile

Joined: Fri Jan 11, 2008 12:11 am
Posts: 12
Shaping up nicely! Very smooth. :)


Top
 
PostPosted: Wed Mar 04, 2009 1:03 pm 
Offline
User avatar
 Profile

Joined: Wed Mar 26, 2008 12:58 pm
Posts: 48
Location: Shadow in a Valley of Scotland
nice text in game :o

need some sound to 'jazz' it up ;)

also, change the !boot file to say */MAIN not just *MAIN as this may conflict with any ROMS.

noticed its load/exec is at &E00, try and change to &1100 so it works on a beeb, not just a Master. Or if can get above to say &1D00 (if Mode2 allows), then it will also work on a beeb with ADFS, or even an elk!
if not possible, may need a ram mover proggy to load into &1D00 and move down to &E00

good so far ;)

_________________
Retro Rules! ImageImageImage


Top
 
PostPosted: Wed Mar 04, 2009 1:16 pm 
Offline
User avatar
 Profile

Joined: Sat May 10, 2008 12:38 pm
Posts: 110
Location: Northampton
OK, busy at work - but just a quick question ...

I've added the reloaction code as mentioned by Rich and I've confusion as to how to start the binary from the disk at &1900

Summary: I've got Invaders org'ed at &0900, this has a jump to the relocation code, placed at the end of the project.
I know I have to load the binary and start it at &1900 - I've followed Rich's example as it seems fine to me, however how do I get it running...

Within the !Boot file - I've some stuff to change mode and stop the cursor displaying then it just does "*main"

I can remember, for example "*LOAD MAIN &1900" - BUT, how in the name of all that's holy do I run the blasted thing!!

:lol:

Any help would be great, thanks guys,
Neil


Top
 
PostPosted: Wed Mar 04, 2009 1:18 pm 
Offline
User avatar
 Profile

Joined: Sat May 10, 2008 12:38 pm
Posts: 110
Location: Northampton
CMcDougall wrote:
nice text in game :o

need some sound to 'jazz' it up ;)

also, change the !boot file to say */MAIN not just *MAIN as this may conflict with any ROMS.

noticed its load/exec is at &E00, try and change to &1100 so it works on a beeb, not just a Master. Or if can get above to say &1D00 (if Mode2 allows), then it will also work on a beeb with ADFS, or even an elk!
if not possible, may need a ram mover proggy to load into &1D00 and move down to &E00

good so far ;)



Spooky - I was just replying, saying as much.... Hmmm I need to look into the boot image that's created via swift, but if you can help - and I haven't confused you(!) :lol: ,
that would be magic,

Thanks again!


Top
 
PostPosted: Wed Mar 04, 2009 1:31 pm 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
NeilB wrote:
I know I have to load the binary and start it at &1900 - I've followed Rich's example as it seems fine to me, however how do I get it running...

Within the !Boot file - I've some stuff to change mode and stop the cursor displaying then it just does "*main"

I can remember, for example "*LOAD MAIN &1900" - BUT, how in the name of all that's holy do I run the blasted thing!!


I don't know if Swift has the support to change the reload and execution addresses of the executable it generates... if so, that will be the easiest way...

Otherwise, the best way is to change the load and execution addresses of the executable:

When you have the executable on your disc image, go into BeebEm, *LOAD the file into memory, and then *SAVE it back again with the right addresses. Step by step (using example figures):
Code:
>*INFO MAIN
$.MAIN       000900 002610 002700 002
>*LOAD MAIN 1900
>*SAVE MAIN 1900 +2700 3610

The output of the *INFO is (in order) the load address, the execution address, the length, and the disc sector it starts at. All the above commands are doing is loading it to an address 0x1000 higher than its default load address, and then saving it back with this as its new load address, and adjusting the execution address accordingly. Now this executable will *RUN without problems.


Top
 
PostPosted: Wed Mar 04, 2009 1:43 pm 
Offline
User avatar
 Profile

Joined: Sat May 10, 2008 12:38 pm
Posts: 110
Location: Northampton
Thanks Rich, that's a great help - will try that now!!


Top
 
PostPosted: Thu Mar 05, 2009 3:44 pm 
Offline
 Profile

Joined: Wed Dec 10, 2008 12:45 pm
Posts: 14
Location: Bristol, UK
Hope it worked, but I would've thought the code would need to be directly assembled at &900 (or wherever) rather than simply moved, as not all routines may use relative addresses. Having said that, the only real beeb programming experience I have so far is typing in magazine listings!

As for relocation, there were various utilities around at the time - often handy for getting tape games to work on disk. In the absence of such utils, the following (or something not too dissimilar, depending on my memory) was used, with varying degrees of success:
Code:
*TAPE
FOR I% = 0 TO <len> STEP 4 : I%!<dest> = I%!<load> : NEXT
CALL <exec>

I'm looking forward to reading the discussions about the byte-back show, as I can't make it... All the beeb games are looking just fantastic! Have fun, everyone :-)


Top
 
PostPosted: Thu Mar 05, 2009 4:36 pm 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
See my message up there somewhere ^^^ :)

the idea is that the code is assembled at &900, with an entry point at a piece of relocation code which is assembled as if it were &1000 higher in memory - this copies all the code down to its correct place and runs it.

Then all that's required is to change the load and execution addresses of the executable, as described above.

The little Basic snippet you posted is more or less the same as the relocation code at the entry point of the executable.


Top
 
PostPosted: Fri Mar 06, 2009 9:43 am 
Offline
User avatar
 Profile

Joined: Sat May 10, 2008 12:38 pm
Posts: 110
Location: Northampton
Hi guys,

well, for the record - it works fine! I did have a problem with Swift, that was just a really minor one. Also I think that P65 compiler does have a few 'features' but ... with some fiddling on the roof - it works lovely!

Oh, the code is built at it's destination address (after relocation), and as Rich pointed out - any labels or calls have to be adjusted to allow for this.

I'm mega pleased, as this is an instant 2k of memory for me - even before I stuff the binaries away in the other 'free' areas... loading my gfx's and blocks away will free up another 2k ( or there abouts ) - blimey, getting another 4k ( when the total code is just around 7k ) makes my mouth water!

Hmmm I haven't really had time to work much on Invaders, and also I don't think I'll be making the show... my brother has been ill, so a visit to East Angila might be in order. Shame as I was looking forward to meeting a few 'friends' and BUYING loads of stuff ... Now, I'll have to get a shopping list down - and sort out collection and payment later ... LOL ...

Right - work calls ...

thanks guys, Neil


Top
 
PostPosted: Fri Mar 06, 2009 9:46 am 
Offline
User avatar
 WWW  Profile

Joined: Thu Apr 03, 2008 2:49 pm
Posts: 277
Location: Antarctica
NeilB wrote:
Hmmm I haven't really had time to work much on Invaders, and also I don't think I'll be making the show... my brother has been ill, so a visit to East Angila might be in order. Shame as I was looking forward to meeting a few 'friends' and BUYING loads of stuff ...

Ah, what a shame. Was looking forward to meeting you Neil :(

Sorry to hear about your brother, hope he gets well soon.


Top
 
PostPosted: Mon Mar 09, 2009 1:00 pm 
Offline
User avatar
 Profile

Joined: Wed Jan 09, 2008 7:30 am
Posts: 406
Was looking forward to seeing you Neil, hope all's OK. I did play your game for a while though, really good :) Tom W. had put several games together on one set with a menu.


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 104 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: