Jump to content



1

Harmony DPC+ ARM programming


28 replies to this topic

#26 stephena OFFLINE  

stephena

    Stargunner

  • 1,967 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Wed May 11, 2011 5:30 AM

View Postbatari, on Wed May 11, 2011 12:28 AM, said:

View PostScumSoft, on Tue May 10, 2011 10:27 PM, said:

Okay I've figured out why LOW/HI works and yet the demo I posted doesn't.

On the Harmony cart you cannot just update the LOW DataFetcher pointer over and over like I do before updating the HI on Carry set, both have to be written to consecutively in the LOW/HI order.

So to patch this for now, I just rewrite the HI pointer after updating the LOW. This adds cycle overhead to my loops which update the sprites since I have to update the pointers to the next scanline in ScreenRAM space.

But at least this mystery has been solved for now :D

@batari, would this be correctable in a firmware update? I am guessing once DFxLOW is written to, the next write expects the HI value? I would much rather update the LOW pointer a few times and retain the HI pointer values till I need them updated, rather than having to write LOW/HI every time LOW needs updated.
So, looking at DPC+ code, it definitely clears the HI bits when low is written. I don't remember why I did it this way but there must have been a reason at the time.

DPC+ is not in the firmware, but in the binary itself (and for things like this, I'm glad I did it this way.) So, all you need is a new DPC+.arm file to fix any issues. Here's a DPC+.arm that does not clear these bits. Let me know if there are any issues.
Also let me know after the experiment is done if Stella now has the desired functionality.

#27 ScumSoft OFFLINE  

ScumSoft

    Moonsweeper

  • 331 posts
  • Location:Polysorbate 60

Posted Wed May 11, 2011 4:11 PM

@stephena, I believe stella is working the way it should with the DPC+.

The way I store my frameBuffer in bank 6 is in two 1152 byte arrays.
ScreenRAM1 stores Frame1's data which is interwoven each byte with Frame2's data, which is stored in ScreenRAM2.

Depending on which frame is being displayed I update P0pointer to hold the ScreenRAMx offsets which correspond with the players sprite position.
The sprites next scanline position will be offset then by 6 bytes. In order to update the sprite in ScreenRAM space, I add 6 to the DFxLOW pointer and only update the HI pointer once the carry is set.
Because I am constantly writing the DFxLOW pointer a few times before the HI pointer, the HI pointer is getting cleared on each LOW write.

However this works just fine in Stella since it leaves the HI pointer intact like it should.

@batari
Your update doesn't seem to be working, I get the same error on the harmony.
DrawSprite:
    lda P0pointer
    sta DF0LOW
    lda P0pointer+1
    sta DF0HI
    
    ldy #15
.GetByte
    lda (SPRpointer),Y ;SPRite pointer, updated elsewhere to point to current sprite.
    sta DF0WRITE
    ;Update to next Scanline
    ;Add 6 bytes
    lda P0pointer    ;Load current LOW pointer address
    clc
    adc #6           ;Add 6 to this
    sta P0pointer    ;Store new LOW pointer
    sta DF0LOW       ;Set DataFetcher LOW
      ;lda P0pointer+1 ;This was added to work around the HI clear issue
      ;sta DF0HI       ;-
    bcc .NegCarry    ;Carry set?
    inc P0pointer+1  ;Update DataFetcher HI +1
    lda P0pointer+1  ;Load new value
    sta DF0HI        ;Set DataFetcher HI
.NegCarry
    dey
    bpl .GetByte
    rts

Edited by ScumSoft, Wed May 11, 2011 4:32 PM.


#28 batari OFFLINE  

batari

    )66]U('=I;B$*

  • 6,236 posts
  • begin 644 contest

Posted Wed May 11, 2011 8:00 PM

OK, going over my code, it looks like I fixed the write to the low byte of fractional fetchers rather than DFxLO. Here is a new version that fixes both.

Attached Files



#29 ScumSoft OFFLINE  

ScumSoft

    Moonsweeper

  • 331 posts
  • Location:Polysorbate 60

Posted Thu May 12, 2011 1:13 AM

Just got home and gave it a test, everything looks good so far :D thanks for the update.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users