Re: [stella] Playfield Basics (newbie question)

Subject: Re: [stella] Playfield Basics (newbie question)
From: "Andrew Davie" <adavie@xxxxxxxxxxxxx>
Date: Sun, 3 Nov 2002 20:08:51 -0600
Since your loop decrements from 7 to 1, and stops at 0, your 0'th line is never drawn.  You're actually only looping 7 times, not 8 :)
You could fix this by changing the BNE to a BPL.
Cheers
A


---------- Original Message ----------------------------------
From: Rico <wrbs@xxxxxxxxxx>
Reply-To: stella@xxxxxxxxxxx
Date: Sun, 03 Nov 2002 20:51:59 -0400

>Hello stella programmers:
>
>Just recently got started with atari 2600 programming,
>and I am learning a lot. Searching through the archives answers
>most of my questions.
>
>I am learning how to draw a playfield. I have read Nick's famous 
>playfield example and tried different variations that have 
>been posted on the list. I have written a small program
>which only purpose is to draw a rectangle repeatedly
>from the top to the bottom of the screen (without worrying about the
>reflected portion of the screen).  I initialized the playflied
>registers to draw something like this:
>
> * * * * * * * * * * * * * * * *
> *                             *
> *                             *
> *                             *
> *                             *
> *                             *
> *                             *
> * * * * * * * * * * * * * * * *
>
>When I run the code, the atari draws the rectangle
>omitting one of the long lines (leaving the rectangle 'open').
>How can I fix this? Let me know what I am doing wrong.
>My guess I am not correctly counting which playfield line to draw.
>
>Thank you for you time.
>
>--Rico Dones
>
>Here is the code:
>
>
>
>; Learning atari playfields
>;
>; Objective: 	Draw a rectangle many times
>;		using the playfield registers.
>;
>
>	processor 6502
>	include eckvcs.h
>	org $F000
>
>START
> SEI
> CLD
> LDX #$FF
> TXS
> LDA #0
>
>CLEARMEM
> STA 0,X
> DEX
> BNE CLEARMEM
> LDA #$00	; SET BACKGROUND BLACK
> STA COLUBK
> LDA #$1E	; SET PLAYFIELD YELLOW
> STA COLUPF
>
>MAINLOOP
> LDA #2		; TURN ON VSYNC
> STA VSYNC
> STA WSYNC
> STA WSYNC
> STA WSYNC
>
> LDA #43
> STA TIM64T
> LDA #0		; TURN OFF VSYNC
> STA VSYNC
>
>VBLANKTIME
> LDA INTIM
> BNE VBLANKTIME
>
> LDX #7		; Use X register to count
>		; eight playfield lines
>		; to draw.
> LDY #191
>
>SCANLOOP
> STA WSYNC	; Accumulator is still 0
> STA VBLANK 
>
> LDA PFData0,X
> STA PF0
> LDA PFData1,X
> STA PF1
> LDA PFData2,X
> STA PF2
>
> DEX		; Decrement X.
> BNE SKIPINITX	; If X != 0 then skip next line
> LDX #7		; Repeat playfield drawing
>		; by setting  X to decimal 7.
>
>SKIPINITX
>
> DEY
> BNE SCANLOOP
> 
> LDX #30
>
>OVERSCAN
> STA WSYNC
> DEX
> BNE OVERSCAN
>
> JMP MAINLOOP
>
> org $FF00 ; GRAPHICS DATA STARTS HERE
>
>; Playfield graphic is supposed to look like this:
>;
>; * * * * * * * * * * * * * * * *
>; *                             *
>; *                             *
>; *                             *
>; *                             *
>; *                             *
>; *                             *
>; * * * * * * * * * * * * * * * *
>;
>
>PFData0       
>	.byte $F0,$10,$10,$10,$10,$10,$10,$F0
>
>PFData1      
>	.byte $FF,$00,$00,$00,$00,$00,$00,$FF
>
>PFData2      
>	.byte $FF,$A0,$A0,$A0,$A0,$A0,$A0,$FF
>
>
>	ORG $FFFC
>	.WORD START
>	.WORD START
>
>
>
>
>
>
>----------------------------------------------------------------------------------------------
>Archives (includes files) at http://www.biglist.com/lists/stella/archives/
>Unsub & more at http://www.biglist.com/lists/stella/
>
>
----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread