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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Tue May 20, 2014 10:07 am 
Offline
User avatar
 Profile

Joined: Thu Feb 02, 2012 4:24 am
Posts: 68
...In fact I've been thinking about it for a while and working on it since Dec 2013! Progress has been slow so I've not really said much about it other than cries for help when I've been stuck writing some routines.

The game will be a clone /based on the plane dogfight game "BiPlane" on the Commodore Amiga. I think it was a public domain game given away on magazine cover disks BITD.
http://www.youtube.com/watch?v=VOfG04NFt0E

I think the original 2 player biplane dogfight type game was the Atari 2600 release "Atari Combat" . This was 2 player only, and had multiple game options - you could choose between tanks or biplanes.
http://www.youtube.com/watch?v=yfwj1fe3QEY

There were a couple of attempts on the Beeb BITD ("Bandits - Dogfight" by Micropower and "Dogfight" by Opus) but they're a bit slow and unsatisfying to play. Also I don't think there was a 1 player option on the Beeb efforts either.

Last night, I finally found a bug in my sprite movement routine (which was causing uneven movement) that I've been trying to fix for months. I'm really chuffed as I can now move the plane around the screen..so I have something to show now! I was holding back from a dev diary until this was the case otherwise it would've made for a bit of a dull read.

My goal is to have a better dogfight game than the original Beeb releases and for it to have a 1 player option - i.e game AI which will be a real challenge for me.

Cheers,
jbnbeeb
[edited for links and names of the original Beeb dogfight games]


Last edited by jbnbeeb on Tue May 20, 2014 8:42 pm, edited 1 time in total.

Top
 
PostPosted: Tue May 20, 2014 7:08 pm 
Offline
User avatar
 Profile

Joined: Sat Mar 26, 2011 3:01 pm
Posts: 263
Location: Kings Langley
What was the bug and how did you find it?


Top
 
PostPosted: Tue May 20, 2014 8:25 pm 
Offline
User avatar
 Profile

Joined: Thu Feb 02, 2012 4:24 am
Posts: 68
tricky wrote:
What was the bug and how did you find it?


Good question. I was using the wrong branch instruction in the y axis part of the sprite movement routine. I used BCS instead of BCC when determining whether I needed to move down the screen to the next char row (snippet below).

I tracked it by using debugger in B-Em + pencil and paper. Previously, I had been trying to use just the debugger on mylaptop whilst on my commute to work..kept running out of time and forgetting what I was doing each time I tried to carry on!

At home, by scribbling notes and referring to the Mode 5 screen layout in Adv user guide, plus the debug output I could see what was happening.

I put a Break at the start of the MoveSprite routine and Watched for writes of updates to the screen address the routine was outputting to the Sprite structure. By checking the addr of the PC register from the Watch output, I was able to see where the writes were occurring and work it out from there.

..I should say also that I redirected the verbose B-Em assembled output to a text file which gives the memory address of each instruction.

Speaking of verbose .. above is a bit waffly but maybe it will be of use to others. Might even be a useful little tutorial in it perhaps!.


Code:
ldy #SS_CurrScrAddr
               lda (SprStructPtr), Y
               clc
               adc tmp
               sta tmp2 ; addr + y move amount
               and #&7   ;
               cmp #&8
               bcc posyWithinChar  ; changed from incorrect bcs to bcc on 19th may.. we need to be checking that 3 lsbs are <=7 (<8)  as each char row is 8 pixels deep. so if we are the 8th pixel down in a char row, and we want to go one pixel lower, we need to cross in to the next char row - thus increment hi byte of scr addr, and then decrement by 8 pixels


Top
 
PostPosted: Wed May 21, 2014 8:40 am 
Offline
User avatar
 Profile

Joined: Sat Mar 26, 2011 3:01 pm
Posts: 263
Location: Kings Langley
I've made similar mistakes with the carry being a borrow.
CMP is the only instruction that I have anything other than cycle counts for when programming!
I know it is the same as SBC, but never trust my memory for which way round it is ;)


Top
 
PostPosted: Fri May 23, 2014 9:05 am 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
jbnbeeb wrote:
Code:
ldy #SS_CurrScrAddr
               lda (SprStructPtr), Y
               clc
               adc tmp
               sta tmp2 ; addr + y move amount
               and #&7   ;
               cmp #&8
               bcc posyWithinChar  ; changed from incorrect bcs to bcc on 19th may.. we need to be checking that 3 lsbs are <=7 (<8)  as each char row is 8 pixels deep. so if we are the 8th pixel down in a char row, and we want to go one pixel lower, we need to cross in to the next char row - thus increment hi byte of scr addr, and then decrement by 8 pixels

Just looking at that code snippet, the bcc will always be taken as ANDing with 7 ensures that the result will always be less than 8. Another bug?


Top
 
PostPosted: Fri May 30, 2014 6:35 pm 
Offline
User avatar
 Profile

Joined: Thu Feb 02, 2012 4:24 am
Posts: 68
:oops:
Good spot Rich, thanks for that!
I've now amended to:
Code:
;sta tmp ; ymov amount
               ldy #SS_CurrScrAddr
               lda (SprStructPtr), Y
               and #7
               clc
               adc tmp
               ;sta tmp2 ; addr + y move amount
               ;and #&7   ;
               cmp #&8
               bcc posyWithinChar  ; changed from incorrect bcs to bcc on 19th may.. we need to be checking that 3 lsbs are <=7 (<8)  as each char row is 8 pixels deep. so if we are the 8th pixel down in a char row, and we want to go one pixel lower, we need to cross in to the next char row - thus increment hi byte of scr addr, and then decrement by 8 pixels 





RichTW wrote:
jbnbeeb wrote:
Code:
ldy #SS_CurrScrAddr
               lda (SprStructPtr), Y
               clc
               adc tmp
               sta tmp2 ; addr + y move amount
               and #&7   ;
               cmp #&8
               bcc posyWithinChar  ; changed from incorrect bcs to bcc on 19th may.. we need to be checking that 3 lsbs are <=7 (<8)  as each char row is 8 pixels deep. so if we are the 8th pixel down in a char row, and we want to go one pixel lower, we need to cross in to the next char row - thus increment hi byte of scr addr, and then decrement by 8 pixels

Just looking at that code snippet, the bcc will always be taken as ANDing with 7 ensures that the result will always be less than 8. Another bug?


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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:  
cron