Jedd Posted April 21, 2004 Author Share Posted April 21, 2004 I just thought, since in most other languages you set up an array, where as in Asm you just put a bunch of bytes one after another. It seems like less of an array than other languages, and that's why I wasnt sure if it was ok. Thanks for clearing that up. -J Quote Link to comment Share on other sites More sharing options...
Jedd Posted April 21, 2004 Author Share Posted April 21, 2004 Ok I'm still really confused why my program doesn't work. It should scroll through the array that I made, with the right side symetrical (but not mirrored) and inverted. From what I can see, the first vertical line of playfeild (which is 10 scanlines high) is working, while the rest are all screwed up. Can anyone tell me what I did wrong? Thanks a bunch! -J It won't let me upload a file that's .asm, so here's the code: processor 6502 include "vcs.h" include "macro.h" Scroll = $80 BlCount = $81 SEG ORG $F000 Reset ldx #0 lda #0 Clear sta 0,x inx bne Clear lda #$84 sta COLUPF lda #$04 sta COLUBK lda #%00000000 sta CTRLPF lda #%11111111 sta PF0 Frame lda #0 sta VBLANK lda #2 sta VSYNC sta WSYNC sta WSYNC sta WSYNC lda #0 sta VSYNC ldx #37 TopBlank sta WSYNC dex bne TopBlank ldx #0 Pic lda #0 sta BlCount Block sta WSYNC ldy Scroll,x lda LData1,y sta PF1 lda LData2,y sta PF2 inc BlCount ldy BlCount Sleep 12 lda LData1,y EOR #$FF sta PF1 lda LData2,y EOR #$FF sta PF2 cpy #10 bne Block inx cpx #20 bne Pic ldy Scroll cpy #180 bne NoReset lda #0 sta Scroll NoReset inc Scroll lda #%01000010 sta VBLANK ldx #30 Overscan sta WSYNC dex bne Overscan jmp Frame LData1 .byte #%00000000 .byte #%00000000 .byte #%00000001 .byte #%00000010 .byte #%00000100 .byte #%00001000 .byte #%00001000 .byte #%00010000 .byte #%00010000 .byte #%00010000 .byte #%00100000 .byte #%00100000 .byte #%00100000 .byte #%00100000 .byte #%00010000 .byte #%00010000 .byte #%00001000 .byte #%00000100 .byte #%00000011 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000001 .byte #%00000001 .byte #%00000010 .byte #%00000010 .byte #%00000100 .byte #%00000100 .byte #%00001000 .byte #%00001000 .byte #%00001000 .byte #%00001000 .byte #%00000100 .byte #%00000100 .byte #%00000010 .byte #%00000001 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000001 .byte #%00000010 .byte #%00000100 .byte #%00001000 .byte #%00010000 .byte #%00010000 .byte #%00100000 .byte #%00100000 .byte #%01000000 .byte #%01000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%01000000 .byte #%01000000 .byte #%01000000 .byte #%00100000 .byte #%00100000 .byte #%00010000 .byte #%00001000 .byte #%00000100 .byte #%00000100 .byte #%00000010 .byte #%00000010 .byte #%00000001 .byte #%00000001 .byte #%00000001 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000001 .byte #%00000001 .byte #%00000001 .byte #%00000010 .byte #%00000010 .byte #%00000010 .byte #%00000100 .byte #%00000100 .byte #%00001000 .byte #%00001000 .byte #%00010000 .byte #%00010000 .byte #%00100000 .byte #%00100000 .byte #%01000000 .byte #%01000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%01000000 .byte #%01000000 .byte #%01000000 .byte #%01000000 .byte #%01000100 .byte #%10001100 .byte #%10011100 .byte #%10011100 .byte #%10111100 .byte #%00111000 .byte #%01111000 .byte #%01111000 .byte #%01111000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11100000 .byte #%11100000 .byte #%11100000 .byte #%11100000 .byte #%11000000 .byte #%11000000 .byte #%11000000 .byte #%11000000 .byte #%01000000 .byte #%01000000 .byte #%01000000 .byte #%00100000 .byte #%00100000 .byte #%00100000 .byte #%11000000 .byte #%11000000 .byte #%11000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%10000000 .byte #%10000000 .byte #%10000000 .byte #%11000000 .byte #%11000000 .byte #%11000000 .byte #%11100000 .byte #%11100000 .byte #%11100000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 .byte #%11110000 LData2 .byte #%00000001 .byte #%00000001 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000011 .byte #%00000100 .byte #%00001000 .byte #%00010000 .byte #%00010000 .byte #%00100000 .byte #%00100000 .byte #%01000000 .byte #%01000000 .byte #%01000000 .byte #%01000000 .byte #%00100000 .byte #%00100000 .byte #%00010000 .byte #%00010000 .byte #%00001000 .byte #%00000100 .byte #%00000010 .byte #%00000001 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000001 .byte #%00000001 .byte #%00000010 .byte #%00000010 .byte #%00000010 .byte #%00000001 .byte #%00000001 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000001 .byte #%00000001 .byte #%00000001 .byte #%00000001 .byte #%00000001 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%10000000 .byte #%11000000 .byte #%11000000 .byte #%11000000 .byte #%11000000 .byte #%11000000 .byte #%10000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 .byte #%00000000 ORG $FFFA .word Reset .word Reset .word Reset END Remember I'm still a newbie, so don't make fun of my crappy code! Quote Link to comment Share on other sites More sharing options...
EricBall Posted April 22, 2004 Share Posted April 22, 2004 As all Real Programmers know, the only useful data structure is the Array. Strings, Lists, Structures, Sets-- these are all special cases of arrays and can be treated that way just as easily without messing up your programming language with all sorts of complications. No, there are no data structures; only data stored in memory. How the program choses to interpret that data is up to the programmer. Of course, you could get even more literal and talk about bits or electrical signals, but some degree of abstraction and equivalence is necessary to stay sane. Quote Link to comment Share on other sites More sharing options...
Jedd Posted April 22, 2004 Author Share Posted April 22, 2004 So does anyone see the error in my source code? I'm still stuck. -J Quote Link to comment Share on other sites More sharing options...
Cybergoth Posted April 22, 2004 Share Posted April 22, 2004 Hi there! So does anyone see the error in my source code? I'm still stuck. Replacing ldy Scroll,x with ldy Scroll might do the trick. Greetings, Manuel Quote Link to comment Share on other sites More sharing options...
Jedd Posted April 22, 2004 Author Share Posted April 22, 2004 That didn't work either. What that line is doing is taking the location of the original starting byte of the playfeild data for that screen, and adds it to the scanline (actually, the vertical pixel) for that screen and loads it into x. Then it looks up the byte at that location for PF1 and PF2. Without the ,x , it would look up the same byte of PF information for each scanline of the screen, making the screen always have vertical lines. I was thinking maybe I have too many 6502 cycles going on, so maybe the lines are falling into the next line, and the data is overlapping the other scanlines. I counted the # of cycles and it looked like it made it, does anyone else see an error there? -J Quote Link to comment Share on other sites More sharing options...
Cybergoth Posted April 22, 2004 Share Posted April 22, 2004 Hi there! What that line is doing is taking the location of the original starting byte of the playfeild data for that screen, and adds it to the scanline (actually, the vertical pixel) for that screen and loads it into x. No. What that line is doing is reading different RAM values into Y, depending on X. First it reads from $80, then from $81 and so on, until with X = $20 you're reading from $A0. Then you're resetting X to zero thus starting all over reading from $80 again. Greetings, Manuel Quote Link to comment Share on other sites More sharing options...
Happy_Dude Posted April 22, 2004 Share Posted April 22, 2004 Also you should load your scroll offset outside of the display loop. But like always I'm brining up a non-critical issue Quote Link to comment Share on other sites More sharing options...
Jedd Posted April 22, 2004 Author Share Posted April 22, 2004 Also you should load your scroll offset outside of the display loop.But like always I'm brining up a non-critical issue So, before sta WSYNC? Because I had it that way before, then I realized I might as well put it in since I'm having the 6502 sleep for a while anyway. I still can't get it to work! I think I'm going to just start over and completely re-write the code. -J Quote Link to comment Share on other sites More sharing options...
Happy_Dude Posted April 22, 2004 Share Posted April 22, 2004 Before Block The Y index isn't changed during the block display loop. It doesn't hurt how it is I guess. Like I said, non-critical Quote Link to comment Share on other sites More sharing options...
Jedd Posted May 10, 2004 Author Share Posted May 10, 2004 I got frustrated and left Atari programming for a few weeks, but today I was bored so I re-coded my scrolling program. Unfortunately it still does not work. Here are the guts of my program: ;192 lines of picture ldx #0 stx Scanline inc Scroll sta WSYNC Pic inc Scanline ldx Scanline ldy Scroll,x lda PFData0,y sta PF0 lda PFData1,y sta PF1 lda PFData2,y sta PF2 ldx #0 stx Skip8 Block sta WSYNC inc Skip8 ldx Skip8 cpx #10 bne Block ldx Scanline cpx #19 bne Pic ;End lines of picture Or you can download the whole thing here. From what I can see it should work. Scroll and Scanline are both increasing the way they should be. Scroll increases once every frame, Scanline increases once every 10 scanlines. But for some reason when they are added together, you get 0. Can anyone pleeeeeease tell me why it doesn't work? -J Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted May 10, 2004 Share Posted May 10, 2004 ldx Scanline ldy Scroll,x Here is your problem. Ldy Scroll,x does not add Scanline and Scroll, but it loads the content of the memory Scroll + Scanline points to into y. What you probably want is: lda Scanline clc adc Scroll tay Quote Link to comment Share on other sites More sharing options...
Jedd Posted May 10, 2004 Author Share Posted May 10, 2004 Awesome thankyou! It scrolls beautifully. Just so I know what is going on, can someone please explain what clc and adc do? -J Quote Link to comment Share on other sites More sharing options...
Sean M. Posted May 10, 2004 Share Posted May 10, 2004 How's it hangin' Jedd? CLC Clears the carry flag. By "clear" I mean "make it zero". ADC Adds the operand to the acc, then adds in the carry flag. So, having a CLC ADC combo does a simple ADD, assuming the 6502 has an ADD instruction, which it doesn't (MOS-Tek were a bunch of cheap SOB's . You really ought to know basic stuff like this... Quote Link to comment Share on other sites More sharing options...
Bruce Tomlin Posted May 10, 2004 Share Posted May 10, 2004 Just for the record here: MOS Technology != MOSTEK MOS Technology were the 6502 creators who were bought out by Commdore in 1976. http://www.antiquetech.com/companies/MOS.htm Quote Link to comment Share on other sites More sharing options...
Jedd Posted May 10, 2004 Author Share Posted May 10, 2004 You really ought to know basic stuff like this... I've been doing this for a little over a month. Thanks for the help! -J Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.