burz
Teddy Boy
Posts: 5
|
Post by burz on May 31, 2015 14:30:38 GMT
Hi guys,
I just finished all the sections in the basic SMS programming guide and at the end it says "The next page explains everything going on in this little "program"." but i can't seem to find the next page. Can someone point me in the right direction please.
Loving the site / forums thus far really helpfull stuff here.
All the best Burz
|
|
|
Post by gallos_11 on May 31, 2015 19:56:30 GMT
|
|
burz
Teddy Boy
Posts: 5
|
Post by burz on May 31, 2015 20:20:24 GMT
Yeah that's the one,I should of linking it myself, thanks.
|
|
|
Post by Bock on Jun 12, 2015 22:09:56 GMT
|
|
|
Post by omegamax on Oct 14, 2015 17:26:07 GMT
Hi burz i'm also new to z80 and master system programming but i'm willing to share code if that interests you.I learn by reverse engineering others games,demo's remember i'm a novice when it comes to z80 also although have and lots of experience in 6502,68000.Anyway i'll leave a code snipet so you can decide if my style of commenting is adequate enough for you.
CheckLeftMovementCollision: dec b ;b = b-1 (BruceLeeX-1) call Do_XYTileCollision ;Do_XYTileCollision(); cp BlockedTile ;if(a == BlockedTile) jp z,44c8 cp GroundTile ;if(a = GroundTile) jp z,44c8 ld a,c ;a = c (a = BruceLeeY) add 8 ;a = a+8 (a = BruceLeeY+8) ld c,a ;c = a call Do_XYTileCollision ;Do_XYTileCollision(); cp BlockedTile ;if(a == BlockedTile) jp z,44c8 cp GroundTile ;if(a == GroundTile) jp z,44c8 ld a,c ;a = c (a = BruceLeeY) add 8 ;a = a+8 (a = BruceLeeY+8) ld c,a ;c = a call Do_XYTileCollision ;Do_XYTileCollision(); cp BlockedTile ;if(a == BlockedTile) jp z,44c8 cp GroundTile ;if(a = ClimbableTile) jp z,44c8 ld a,c ;a = c (a = BruceLeeY) add 7 ;a = a+7 (a = BruceLeeY+8) ld c,a ;c = a call Do_XYTileCollision ;Do_XYTileCollision(); cp BlockedTile ;if(a == BlockedTile) jp z,44c8 cp GroundTile ;if(a == GroundTile) jp z,44c8 jp 44ca
44c8: ld a,1 44ca: ret Do_BruceJumpingLeftCont: ld a,(_TileLeftCollision) cp 1 jp z,+ ld a,(_BruceLeeX) cp 0 jp z,+ dec a ld (_BruceLeeX),a +: ld a,(_BruceLeeY) ld hl,BruceLeeMovementJumpLUT ld de,(_BruceLeeJumpIndexOffset) ld d,0 add hl,de add (hl) ld (_BruceLeeY),a ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; BruceLeeMovementJumpLUT: .db $ff,$ff,$ff,$ff .db $ff,$00,$ff,$00 .db $ff,$00,$ff,$00 .db $ff,$00,$00,$00 .db $ff,$00,$00,$00 .db $00,$00,$00,$00 .db $01,$00,$00,$00 .db $01,$00,$00,$00 .db $01,$00,$01,$00 .db $01,$01,$02,$02
|
|
|
Post by Maxim on Oct 15, 2015 10:04:25 GMT
The comments seem to be translating lines of assembly to pseudo-C, which I've done occasionally when disassembling, but it fails the test that the code already says what it's doing, and the comments ought to say *why* it's doing it. I suspect we all do this at the start of our assembly life, but how about this as a suggestion:
CheckLeftMovementCollision: ; Inputs: ; b = x coordinate ; c = y coordinate ; Checks for collision (BlockedTile and GroundTile) at (x-1, y), (x-1, y+8), (x-1, y+16) and (x-1, y+23), to cover the 23-pixel-high bounding box. ; Outputs: ; a = 1 if a there is a collision. ; zero flag = 0 if there is a collision. ; b = input x - 1 ; c = y plus some offset depending on where any collision was found (may be considered undefined) ; (Note that the value in a is undefined (actually it's y+23) if there is no collision. If y can be 233 (offscreen) then y+23 = 1!) ; --x dec b ; Check collision call Do_XYTileCollision cp BlockedTile jp z,_Collided cp GroundTile jp z,_Collided ; repeat at the various y offsets
ld a,c add 8 ld c,a ; Check collision again call Do_XYTileCollision cp BlockedTile jp z,_Collided cp GroundTile jp z,_Collided
ld a,c add 8 ld c,a call Do_XYTileCollision cp BlockedTile jp z,_Collided cp GroundTile jp z,_Collided
ld a,c add 7 ld c,a call Do_XYTileCollision cp BlockedTile jp z,_Collided cp GroundTile jp z,_Collided ; Note: this and the next line could be replaced by a "ret nz" jp _NoCollision
_Collided: ld a,1 _NoCollision: ret
Also, Stan's tutorial is not good. Mine is not as complete as I'd like.
|
|
|
Post by omegamax on Oct 15, 2015 16:51:43 GMT
Thanks for the suggestion Maxim that is much more clear then the way i've commented it.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Oct 26, 2015 22:05:13 GMT
Stan's tutorial have a fool error so basic that i give up in read it. "So all you do when you get to 11 is use A, B for 12, and so on. It's quite easy. Or is it? Let's check out this:" www.smstributes.co.uk/view_page.asp?articleid=188A=10 and B =11.
|
|
|
Post by Maxim on Oct 27, 2015 12:12:59 GMT
That kind of indicates Stan's level of understanding at the time... it's hard to strike the balance between an experienced person teaching newbies (and risking totally misjudging the technical level) and a newbie writing stuff as he goes along (the blind leading the blind)...
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 1, 2015 10:35:20 GMT
Maxim, your tutorial have error too:
"pe Parity Even Last calculation result had an odd number of bits set"
result had na EVEN number... But i consider this problem minimum that can happen in typing quickly.
|
|
|
Post by Maxim on Nov 1, 2015 17:12:17 GMT
Lazy copy paste typing Thanks for letting me know, it's fixed now. I'm sure there's more errors, nobody's perfect...
|
|
|
Post by omegamax on Nov 9, 2015 6:34:08 GMT
|
|
|
Post by Stan on Jan 1, 2016 11:49:05 GMT
Stan's tutorial have a fool error so basic that i give up in read it. "So all you do when you get to 11 is use A, B for 12, and so on. It's quite easy. Or is it? Let's check out this:" www.smstributes.co.uk/view_page.asp?articleid=188A=10 and B =11. That's just a simple typo, man.
|
|
|
Post by Stan on Jan 1, 2016 11:52:58 GMT
That kind of indicates Stan's level of understanding at the time... it's hard to strike the balance between an experienced person teaching newbies (and risking totally misjudging the technical level) and a newbie writing stuff as he goes along (the blind leading the blind)... I wouldn't say that exactly. I'm definitely not as advanced as you, and I've only been able to pick at it these past few years, but I had a little help writing some of that from a programmer. The main issue, which you essentially note, is I was trying to make sure it was written in such a way that someone just learning could pick it up easier without having to read through tons of books and things to make sense out of a more advanced guide that assumes previous knowledge, or at least is quicker to grasp if you have it. When I taught Russian this was always the big question, who's better at understanding the language to teach it, a native speaker or someone who learned it as a second language? In actuality it's the latter, provided they've studied it for long enough, because lacking the intuitive grasp of any language, they can more readily explain to someone just starting out how everything works on THEIR level because they've been there, unlike a native speaker who was simply born into it. That was my goal here, though the analogy isn't spot-on.
|
|
|
Post by Stan on Jan 1, 2016 11:57:06 GMT
See? Obviously if you go through it and don't stop on a typo, like someone above did, you might learn something from it. Combine it with Maxim's knowledge and you've got a good grounding, I'd say, though I do want to finish mine at some point with a basic, workable game. I've been doing some hacking and such just to mess around, but I need more time.
|
|