Skip to main content
Clarifications. Split up solid block of text into paragraphs for clarity.
Source Link
TonyM
  • 5.3k
  • 1
  • 24
  • 37

Assembly delay function for C64

I've written a delay function that simply counts the times the screen raster line reaches a particular value.

// zero page addresses .const delayFrames = $00fa .const delayCounter = $00fb // ============================================== // Delay n frames // [A,delayFrames,delayCounter] // ============================================== Delay: lda #0 sta delayCounter !: // check if delay done lda delayCounter cmp delayFrames beq !++ // -> done // inc delayCounter inc delayCounter // loop until raster line reached (1 frame) !: lda #200 cmp Screen.RasterLine bne !- jmp !-- // done !: rts 

But it doesn't behave the way I expect. Could anyone help me understand the following behaviour...

  1. With delayFrames set to 50 (1 second) and checking for raster line 0 : I get about 200ms delay

  2. With delayFrames set to 50 (1 second) and checking for raster line 200 : I get about 500ms delay.

So, I don't understand why checking for a different raster line should change anything. Every raster line will be reached once in 1/50th second. Is there something wrong in my code, or is there an issue with reading the raster line? 

The way I understand the raster line system variable (RasterLine = $d012) is that it contains the current y position of the electron raygun as driven by the C64. And if I read it continuously, I would get something like this...:

0,0,0,1,1,2,2,2,3,3,3,3,4,4,4,5,5,6,6,6

or...

0,1,2,3,4,5,6

or...

1,4,9,12,16,18

Somei.e. some readout of the current raster line. 

Presumably it's going pretty fast, but I don't really know how fast, and I might get a few readings for each line. Or one reading, or just one reading every few lines. But I just don't know what the situation is. 

How reliable is the raster line value?

Links: Get exact position of raster beam on C64/C128

Assembly delay function

I've written a delay function that simply counts the times the screen raster line reaches a particular value.

// zero page addresses .const delayFrames = $00fa .const delayCounter = $00fb // ============================================== // Delay n frames // [A,delayFrames,delayCounter] // ============================================== Delay: lda #0 sta delayCounter !: // check if delay done lda delayCounter cmp delayFrames beq !++ // -> done // inc delayCounter inc delayCounter // loop until raster line reached (1 frame) !: lda #200 cmp Screen.RasterLine bne !- jmp !-- // done !: rts 

But it doesn't behave the way I expect. Could anyone help me understand the following behaviour...

  1. With delayFrames set to 50 (1 second) and checking for raster line 0 : I get about 200ms delay

  2. With delayFrames set to 50 (1 second) and checking for raster line 200 : I get about 500ms delay.

So, I don't understand why checking for a different raster line should change anything. Every raster line will be reached once in 1/50th second. Is there something wrong in my code, or is there an issue with reading the raster line? The way I understand the raster line (RasterLine = $d012) is that it contains the current y position of the electron ray as driven by the C64. And if I read it continuously, I would get something like this...

0,0,0,1,1,2,2,2,3,3,3,3,4,4,4,5,5,6,6,6

or...

0,1,2,3,4,5,6

or...

1,4,9,12,16,18

Some readout of the current raster line. Presumably it's going pretty fast, but I don't really know how fast, and I might get a few readings for each line. Or one reading, or just one reading every few lines. But I just don't know what the situation is. How reliable is the raster line value?

Links: Get exact position of raster beam on C64/C128

Assembly delay function for C64

I've written a delay function that simply counts the times the screen raster line reaches a particular value.

// zero page addresses .const delayFrames = $00fa .const delayCounter = $00fb // ============================================== // Delay n frames // [A,delayFrames,delayCounter] // ============================================== Delay: lda #0 sta delayCounter !: // check if delay done lda delayCounter cmp delayFrames beq !++ // -> done // inc delayCounter inc delayCounter // loop until raster line reached (1 frame) !: lda #200 cmp Screen.RasterLine bne !- jmp !-- // done !: rts 

But it doesn't behave the way I expect. Could anyone help me understand the following behaviour...

  1. With delayFrames set to 50 (1 second) and checking for raster line 0 : I get about 200ms delay

  2. With delayFrames set to 50 (1 second) and checking for raster line 200 : I get about 500ms delay.

So, I don't understand why checking for a different raster line should change anything. Every raster line will be reached once in 1/50th second. Is there something wrong in my code, or is there an issue with reading the raster line? 

The way I understand the raster line system variable (RasterLine = $d012) is that it contains the current y position of the electron gun as driven by the C64. And if I read it continuously, I would get something like this:

0,0,0,1,1,2,2,2,3,3,3,3,4,4,4,5,5,6,6,6

or...

0,1,2,3,4,5,6

or...

1,4,9,12,16,18

i.e. some readout of the current raster line. 

Presumably it's going pretty fast, but I don't really know how fast, and I might get a few readings for each line. Or one reading, or just one reading every few lines. But I just don't know what the situation is. 

How reliable is the raster line value?

Links: Get exact position of raster beam on C64/C128

Became Hot Network Question
added 119 characters in body
Source Link

I've written a delay function that simply counts the times the screen raster line reaches a particular value.

// zero page addresses .const delayFrames = $00fa .const delayCounter = $00fb // ============================================== // Delay n frames // [A,delayFrames,delayCounter] // ============================================== Delay: lda #0 sta delayCounter !: // check if delay done lda delayCounter cmp delayFrames beq !++ // -> done // inc delayCounter inc delayCounter // loop until raster line reached (1 frame) !: lda #200 cmp Screen.RasterLine bne !- jmp !-- // done !: rts 

But it doesn't behave the way I expect. Could anyone help me understand the following behaviour...

  1. With delayFrames set to 50 (1 second) and checking for raster line 0 : I get about 200ms delay

  2. With delayFrames set to 50 (1 second) and checking for raster line 200 : I get about 500ms delay.

So, I don't understand why checking for a different raster line should change anything. Every raster line will be reached once in 1/50th second. Is there something wrong in my code, or is there an issue with reading the raster line? The way I understand the raster line (RasterLine = $d012) is that it contains the current y position of the electron ray as driven by the C64. And if I read it continuously, I would get something like this...

0,0,0,1,1,2,2,2,3,3,3,3,4,4,4,5,5,6,6,6

or...

0,1,2,3,4,5,6

or...

1,4,9,12,16,18

Some readout of the current raster line. Presumably it's going pretty fast, but I don't really know how fast, and I might get a few readings for each line. Or one reading, or just one reading every few lines. But I just don't know what the situation is. How reliable is the raster line value?

Links: Get exact position of raster beam on C64/C128

I've written a delay function that simply counts the times the screen raster line reaches a particular value.

// zero page addresses .const delayFrames = $00fa .const delayCounter = $00fb // ============================================== // Delay n frames // [A,delayFrames,delayCounter] // ============================================== Delay: lda #0 sta delayCounter !: // check if delay done lda delayCounter cmp delayFrames beq !++ // -> done // inc delayCounter inc delayCounter // loop until raster line reached (1 frame) !: lda #200 cmp Screen.RasterLine bne !- jmp !-- // done !: rts 

But it doesn't behave the way I expect. Could anyone help me understand the following behaviour...

  1. With delayFrames set to 50 (1 second) and checking for raster line 0 : I get about 200ms delay

  2. With delayFrames set to 50 (1 second) and checking for raster line 200 : I get about 500ms delay.

So, I don't understand why checking for a different raster line should change anything. Every raster line will be reached once in 1/50th second. Is there something wrong in my code, or is there an issue with reading the raster line? The way I understand the raster line (RasterLine = $d012) is that it contains the current y position of the electron ray as driven by the C64. And if I read it continuously, I would get something like this...

0,0,0,1,1,2,2,2,3,3,3,3,4,4,4,5,5,6,6,6

or...

0,1,2,3,4,5,6

or...

1,4,9,12,16,18

Some readout of the current raster line. Presumably it's going pretty fast, but I don't really know how fast, and I might get a few readings for each line. Or one reading, or just one reading every few lines. But I just don't know what the situation is. How reliable is the raster line value?

I've written a delay function that simply counts the times the screen raster line reaches a particular value.

// zero page addresses .const delayFrames = $00fa .const delayCounter = $00fb // ============================================== // Delay n frames // [A,delayFrames,delayCounter] // ============================================== Delay: lda #0 sta delayCounter !: // check if delay done lda delayCounter cmp delayFrames beq !++ // -> done // inc delayCounter inc delayCounter // loop until raster line reached (1 frame) !: lda #200 cmp Screen.RasterLine bne !- jmp !-- // done !: rts 

But it doesn't behave the way I expect. Could anyone help me understand the following behaviour...

  1. With delayFrames set to 50 (1 second) and checking for raster line 0 : I get about 200ms delay

  2. With delayFrames set to 50 (1 second) and checking for raster line 200 : I get about 500ms delay.

So, I don't understand why checking for a different raster line should change anything. Every raster line will be reached once in 1/50th second. Is there something wrong in my code, or is there an issue with reading the raster line? The way I understand the raster line (RasterLine = $d012) is that it contains the current y position of the electron ray as driven by the C64. And if I read it continuously, I would get something like this...

0,0,0,1,1,2,2,2,3,3,3,3,4,4,4,5,5,6,6,6

or...

0,1,2,3,4,5,6

or...

1,4,9,12,16,18

Some readout of the current raster line. Presumably it's going pretty fast, but I don't really know how fast, and I might get a few readings for each line. Or one reading, or just one reading every few lines. But I just don't know what the situation is. How reliable is the raster line value?

Links: Get exact position of raster beam on C64/C128

deleted 113 characters in body
Source Link

I've written a delay function that simply counts the times the screen raster line reaches a particular value.

// zero page addresses .const delayFrames = $00fa .const delayCounter = $00fb // ============================================== // Delay n frames // [A,delayFrames,delayCounter] // ============================================== Delay: lda #0 sta delayCounter !: // check if delay done lda delayCounter cmp delayFrames beq !++ // -> done // inc delayCounter inc delayCounter // loop until raster line reached (1 frame) !: lda #200 cmp Screen.RasterLine bne !- jmp !-- // done !: rts 

But it doesn't behave the way I expect. Could anyone help me understand the following behaviour...

  1. With delayFrames set to 50 (1 second) and checking for raster line 0 : I get about 200ms delay

  2. With delayFrames set to 50 (1 second) and checking for raster line 200 : I get about 500ms delay.

So, I don't understand why checking for a different raster line should change anything. Every raster line will be reached once in 1/50th second. Is there something wrong in my code, or is there an issue with reading the raster line? The way I understand the raster line (RasterLine = $d012) is that it contains the current y position of the electron ray as driven by the C64. And if I read it continuously, I would get something like this...

0,0,0,1,1,2,2,2,3,3,3,3,4,4,4,5,5,6,6,6

or...

0,1,2,3,4,5,6

or...

1,4,9,12,16,18

Some readout of the current raster line. Presumably it's going pretty fast, but I don't really know how fast, and I might get a few readings for each line. SoOr one reading, any function that reads for raster lines should be able to give me at leastor just one reading for every raster line. If it can't and I'm missing rasterfew lines each frame, then the function may be unreliable. But I just don't know what the situation is. How reliable is the raster line value?

I've written a delay function that simply counts the times the screen raster line reaches a particular value.

// zero page addresses .const delayFrames = $00fa .const delayCounter = $00fb // ============================================== // Delay n frames // [A,delayFrames,delayCounter] // ============================================== Delay: lda #0 sta delayCounter !: // check if delay done lda delayCounter cmp delayFrames beq !++ // -> done // inc delayCounter inc delayCounter // loop until raster line reached (1 frame) !: lda #200 cmp Screen.RasterLine bne !- jmp !-- // done !: rts 

But it doesn't behave the way I expect. Could anyone help me understand the following behaviour...

  1. With delayFrames set to 50 (1 second) and checking for raster line 0 : I get about 200ms delay

  2. With delayFrames set to 50 (1 second) and checking for raster line 200 : I get about 500ms delay.

So, I don't understand why checking for a different raster line should change anything. Every raster line will be reached once in 1/50th second. Is there something wrong in my code, or is there an issue with reading the raster line? The way I understand the raster line (RasterLine = $d012) is that it contains the current y position of the electron ray as driven by the C64. And if I read it continuously, I would get something like this...

0,0,0,1,1,2,2,2,3,3,3,3,4,4,4,5,5,6,6,6

or...

0,1,2,3,4,5,6

or...

1,4,9,12,16,18

Some readout of the current raster line. Presumably it's going pretty fast, but I don't really know how fast, and I might get a few readings for each line. So, any function that reads for raster lines should be able to give me at least one reading for every raster line. If it can't and I'm missing raster lines each frame, then the function may be unreliable. But I just don't know what the situation is.

I've written a delay function that simply counts the times the screen raster line reaches a particular value.

// zero page addresses .const delayFrames = $00fa .const delayCounter = $00fb // ============================================== // Delay n frames // [A,delayFrames,delayCounter] // ============================================== Delay: lda #0 sta delayCounter !: // check if delay done lda delayCounter cmp delayFrames beq !++ // -> done // inc delayCounter inc delayCounter // loop until raster line reached (1 frame) !: lda #200 cmp Screen.RasterLine bne !- jmp !-- // done !: rts 

But it doesn't behave the way I expect. Could anyone help me understand the following behaviour...

  1. With delayFrames set to 50 (1 second) and checking for raster line 0 : I get about 200ms delay

  2. With delayFrames set to 50 (1 second) and checking for raster line 200 : I get about 500ms delay.

So, I don't understand why checking for a different raster line should change anything. Every raster line will be reached once in 1/50th second. Is there something wrong in my code, or is there an issue with reading the raster line? The way I understand the raster line (RasterLine = $d012) is that it contains the current y position of the electron ray as driven by the C64. And if I read it continuously, I would get something like this...

0,0,0,1,1,2,2,2,3,3,3,3,4,4,4,5,5,6,6,6

or...

0,1,2,3,4,5,6

or...

1,4,9,12,16,18

Some readout of the current raster line. Presumably it's going pretty fast, but I don't really know how fast, and I might get a few readings for each line. Or one reading, or just one reading every few lines. But I just don't know what the situation is. How reliable is the raster line value?

Source Link
Loading