Jump to content
IGNORED

Harmony DPC+ ARM programming


Recommended Posts

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.

Link to comment
Share on other sites

@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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...