Jump to content
IGNORED

Need a tutorial on HMOVE... in the form of these questions


Recommended Posts

First, thanks to everyone on the forum - you guys are rockin' the helpful. Hopefully someday soon I can start to help some of you out in return.

 

I thought I understood HMOVE but not so. First, in an effort to avoid the black side bars - I timed the HMOVE to occur on either cycle 73 or 74 as suggested by various sources. I found that didn't work too well. I thought I had licked the problem by simply having the HMOVE occur several lines ahead of when I needed it but well after WSYNC (having this luxury in my design). That seemed to fix it, but no - after moding the code - the blank lines reappear, even though HMOVE is at least a full scan line separated from the sprites. So in the course of exploring, I have codified these questions:

 

- do the HMPx reset automatically after each frame? I was not zeroing them with HMCLR and yet I see no motion despite having an HMPx / HMOVE offset on some sprites. I know the offset is working, because when I take it out, the sprites shift back to the 'regular' positions set by RESPx. I am not resetting the HMPx to zero after/before each frame.

 

- does setting position with RESPx nullify any HMOVE changes, or will newly reset positions still be displayed offset by the same HMPx parameters?

 

- this is another way of asking the same thing; for a given combo of RESPx and HMPx/HMOVE does the order in which the two are applied affect the final position?

 

Let me describe one situation. I was setting my position with RESPx after first setting HMPx to 0 followed by HMOVE. Then, I would try to tweak position using mods to the HMPx line. I would find things like setting 0001 to nudge once to the left would do nothing. Then I tried 0010. nothing. Then I stepped by one to the maximum left shift of 0111 (I only needed to shift one pixel left) and finally the shift kicks in at TWO pixels - not 7. Next I chose a different RESPx position (HMPx = 0) - by inserting a couple of NOPs - then when I start to left shift, the behaviour is normal: 0001 shifts one, 0010 shifts two, etc.

 

I so confused! Obviously I am missing something fundamental. Any input would be very appreciated!!!

Edited by TheDickChuck
Link to comment
Share on other sites

I cant type alot on my phone here, but just know the constants for hmxx are different for early hmoves. They should be posted somewhere. I made some user constants to use for early hmoves but i dont have them here. With early hmoves hmclr will not be no motion. You need to use $80 for no motion. If you are seeing hmove bars you are not hitting hmove on correct cycle. Instruction starts at 70 or 71 and ends at 73 or 74.

 

Finally make sure you dont update hmxx registers too soon after hmove. Its a pitfall.

Link to comment
Share on other sites

Here are some constants:

;HMPx
LEFT_7               = $70
LEFT_6               = $60
LEFT_5               = $50
LEFT_4               = $40
LEFT_3               = $30
LEFT_2               = $20
LEFT_1               = $10
NO_MOTION            = $00
RIGHT_1              = $F0
RIGHT_2              = $E0
RIGHT_3              = $D0
RIGHT_4              = $C0
RIGHT_5              = $B0
RIGHT_6              = $A0
RIGHT_7              = $90
RIGHT_8              = $80

;73/74 cycle HMxx
LEFT74_15            = $70
LEFT74_14            = $60
LEFT74_13            = $50
LEFT74_12            = $40
LEFT74_11            = $30
LEFT74_10            = $20
LEFT74_9             = $10
LEFT74_8             = $00
LEFT74_7             = $F0
LEFT74_6             = $E0
LEFT74_5             = $D0
LEFT74_4             = $C0
LEFT74_3             = $B0
LEFT74_2             = $A0
LEFT74_1             = $90
NO_MO_74             = $80

Just be aware that some consoles don't like early HMOVE's. I found this out while doing the Dr. Who Berzerk hack. There I'm doing a similar routine as Darrell's where you need to reposition quickly, so you indirectly jump into a pre-determined section of code with RESPx at a certain cycle, and finish with a cycle 73 or 74 Hmove. Here's an excerpt... the HMP1 register is loaded on a different line of code, but'll you'll get the idea:

 

BerzerkEx.asm

 

The way you described you game (7 sprites per row and 7 rows?) you shouldn't need to HMOVE to reposition between rows. The routine I posted can have P0 and P1 set outside of the kernel as long as it's the first thing drawn. If you do position P0 outside of the kernel then you can change this:

    ldy    #KERNEL_LINES+1       ;2  @41
    lax    (scorePtrs+10),Y      ;5  @46
    txs                          ;2  @48
    dey                          ;2  @50
    dec    $2E                   ;5  @55
    dec    $2E                   ;5  @60
    dec    $2E                   ;5  @65
    dec    $2E                   ;5  @70
    sta    RESP0                 ;3  @73
    nop    $EA                   ;3  @76
;---------------------------------------

.loopKernel:
    lda    (scorePtrs),Y         ;5  @5 

To this:

    ldy    #KERNEL_LINES+1       ;2  @41
    lax    (scorePtrs+10),Y      ;5  @46
    txs                          ;2  @48
    dey                          ;2  @50

    sta    WSYNC                 ;3  @76
;---------------------------------------

.loopKernel:
    lda    (scorePtrs),Y         ;5  @5 

Or you can leave it as is, and just have to handle positioning P1 outside of the kernel.

 

Link to comment
Share on other sites

Thanks for the input fellas. I still need a little clearing up... let me see if I have this much straight:

- If I use HMOVE immediately after WSYNC I can expect the black bars to appear. I even see the bars if the HMOVE is pretty close to the scan line start but not right after WSYNC; but unpredictably if I recall. In that case, the move will take place on THAT SAME LINE.

- If I use the HMOVE on cycle 70 or 71 of the previous line, then no bars - and all of the shifting will be to the left side- but the effect will show up on the following line.

 

Still unsure about the fact that I have used HMOVE before at times like ~50ish cycles, and I still don't see black bars. And the HMPx registers still have some sort of effects (sometimes?). Is the point that using it at any other time than immediately AFTER wsync or on cycle 70 gives unpredictable (from case to case) results? Are those the only two options one should use?

 

Also, I thought HMOVE was a relative and recursive movement - meaning that if I use HMOVE to offset +1 over and over, then I would expect to see the sprite move. I don't see that, and I don't want to - it stays off of the "natural" position +1. I don't ever call HMCLR either. Is it because my HMOVE always comes right before a new RESPx setting?

 

I haven't had a chance to study your demo yet SpiceWare.

 

Thank you, thank you, thank you.

Link to comment
Share on other sites

It's not unpredictable. Back in 1998 Brad Mott, originator of the emulator Stella, was trying to figure out why part of the He-man's title screen was displayed incorrectly. He wrote a program so he could figure out what was happening and posted the results in the old Stella mailing list (that's a searchable archive).

 

The results post are linked to on the Tricks page at MiniDig.

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...