Jump to content
IGNORED

NOP and timing


ufosolar

Recommended Posts

Hi there, welcome :)

 

It is important to understand that the TIA continues to do it's thing without instruction from the CPU. The CPU's job is to set the registers in the TIA (at the correct time) to change the picture. The TIA will draw the same line over and over again if the registers are not changed. This is just like what happens when you turn on the console without a cartridge.

 

When you execute a NOP instruction, you are not changing any registers, but you are wasting 2 cycles of CPU time. The TIA will draw 6 pixels in that time (6 'color clocks').

Link to comment
Share on other sites

You can't think of programming the VCS in this way. There is no "drawing something after a nop."

 

You have to think of the TIA and 6507 as being in lock step with each other. You have 76 CPU cycles across each scanline. Whatever CPU cycle *at that moment* along a particular scanline is what is going to determine where on the screen a particular change will take place. The TIA always does what it was last doing until it is told otherwise...the CPU clock cycle timing is what determines just about everything.

Link to comment
Share on other sites

  • 10 months later...
On 10/29/2018 at 1:01 PM, ufosolar said:

Ok maybe I start to understand how it works ... p.s. I noticed that not using the SLEEP macro the first scanline was drawn out of phase with respect to the others, (I went to attempts). Thank you

 

 

post-66390-0-50882700-1540832470_thumb.png

Lda #50 ;load the A register with the value 50. Fyi this should be in hexidecimal form "lda #$50" not #50 range of the register #$00 - #$FF or #0 - #255 but #$50 and #50 are not equivalent.

sta COLUBK ;This stores the value of A register into the TIA's COLUBK register #$09. 

nop  ; for each nop

nop  ; the TIA is drawing

nop  ; two color clocks to the screen

This is the drawing time. 

If other code follows after the line has began to draw each cpu cycle used by the following code will draw two more color clocks to the screen.

See documentation to understand the number of machine cycles used for each instruction.

Link to comment
Share on other sites

10 hours ago, Jmrott said:

Lda #50 ;load the A register with the value 50. Fyi this should be in hexidecimal form "lda #$50" not #50 range of the register #$00 - #$FF or #0 - #255 but #$50 and #50 are not equivalent.

sta COLUBK ;This stores the value of A register into the TIA's COLUBK register #$09. 

nop  ; for each nop

nop  ; the TIA is drawing

nop  ; two color clocks to the screen

This is the drawing time. 

If other code follows after the line has began to draw each cpu cycle used by the following code will draw two more color clocks to the screen.

See documentation to understand the number of machine cycles used for each instruction.

 

I regret this part of the tutorial where I had REPEAT 192. Just so that's out there.

I just want to comment on the above - each "nop" is two CPU cycles, NOT two colour clocks.

Each CPU cycle is 3 colour clocks, so each "nop" is actually 6 colour cycles.
There are 76 CPU cycles per scanline, which is 76*3 = 228 TIA colour clocks.

 

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