[A83] Prince of Persia


[Prev][Next][Index][Thread]

[A83] Prince of Persia



I can't remember if I've posted this here already or not, but I'm working on
a Ti-83 version of Prince of Persia.

(If I haven't: it is completely open source, feel free to work on it
yourself, grab my tiles, sprites, maps, routines.. This could become a great
game if someone who is better at programming then I am spends some time at
it.)

I'm having some trouble with a part of my code. The tiles are part
foreground and part background, for which I use a mask. I use a maskbuffer
(792 bytes) for all the tiles currently visible on the screen. I use the
SAVESSCREEN location [8265h] for this. The tiles itself are stored in the
Graphbuffer.

    ex: (bottom part of a piller)
            tile               mask
.db ooo__ooo ,   __oooo__
.db __o__o__ ,   __oooo__
.db __o__o__ ,   __oooo__
.db __o__o__ ,   __oooo__
.db __o__o__ ,   __oooo__
.db _o____o_ ,   _oooooo_
.db _ooooo__ ,   _ooooo__
.db oooooooo ,   oooooooo

The same combination is used for the sprites of the Prince.

DrawPlayerPutByte: ;d=sprite, e=spritemask, (TempW2)=screen location
 ld hl, (TempW2)
  push hl
  push de
 ld de, 8e29h ;  -  locaton of GraphBuffer
 sbc hl, de    ;
 ld de, MaskBuffer ; + location of MaskBuffer (=792 bytes, contains mask of
the current screen)
 add hl, de             ;
  pop de
 ld a, (hl)   ;must keep
 cpl           ; => may be destroyed
 and e       ; may be destroyed AND want to destroy
 ld e, a
 and d
 ld d, a
  pop hl
 ld a, e
 cpl
 and (hl)
 or d
 ld (hl), a   ;save data
 inc hl
 ld (TempW2), hl
 ret


I have also included the complete source + executable, so you can see what
the problem is and check the source if you think there are no errors in the
small part that I've posted.

PS: Please help me !
        Thanks :-)

Stijn Arnauts





Follow-Ups: References: