|
Post by gauze on Jan 2, 2015 9:20:19 GMT -5
I was messing around with using scale to make an object shrink but it also effects the position on screen, as the scale reduces, the object moves toward 0,0 screen position, what am I doing wrong?
example code: [snip] lda #127 sta count loopy lda count sta $D004 ; VIA t1 cnt lo register. SCALE lda ypos ldb xpos jsr Moveto_d ldx #Shape jsr Draw_VLp
dec count bne loopy
[snip]
|
|
|
Post by christophertumber on Jan 2, 2015 10:20:34 GMT -5
Should be like this:
lda #127 sta count loopy lda #$7F sta $D004 ; VIA t1 cnt lo register. SCALE lda ypos ldb xpos jsr Moveto_d lda count sta $D004 ; VIA t1 cnt lo register. SCALE ldx #Shape jsr Draw_VLp
dec count bne loopy
|
|
|
Post by christophertumber on Jan 2, 2015 10:22:46 GMT -5
Moveto_d also uses the Scale.
So by altering the scale, you're also affecting the initial position of the object.
Either you need to use one of the BIOS routines which ignores scale, or you need to set scale independently prior to both movement and drawing.
|
|
|
Post by gauze on Jan 2, 2015 11:19:12 GMT -5
ah, thanks christopher. I couldn't figure out what was going on even stepping through it :S
|
|
|
Post by christophertumber on Jan 2, 2015 12:04:46 GMT -5
This is actually a good debug example:
"Something I'm doing to variable/function/subroutine A is unexpectedly affecting B."
This kind of situation happens all the time. It generally means there's some resource/variable/data/register shared between A and B that isn't being reset/initialized properly for B. Or A is changing a default/assumed value that B depends on. Or you have some kind of memory conflict or leak (ie; two variables using the same memory location or a temporary variable isn't so temporary or a loop is running too far and changing a list in RAM (etc) it shouldn't).
So that's more or less the checklist you want to go through to solve this kind of problem. What do these two functions have in common? If they're supposed to have nothing in common, where are they crashing into each other?
|
|