Jump to content

Photo

Problem trying to create playfield pixels


6 replies to this topic

#1 jbs30000 OFFLINE  

jbs30000

    Moonsweeper

  • 472 posts

Posted Thu May 4, 2017 5:06 PM

To make a long story short, nothing I do seems to work when trying to write code to display pixels.

DASM creates a list file that looks fine, but the bin files doesn't work (Stella displays a black screen & alt-L shows 0 scanlines).

To simplify things I created a program that clears all of the RAM, and then writes a pattern of %10101010 to the PF0, PF1, and PF2 registers.

DASM creates a good list file but the bin is 0 bytes.

At this point I'm frustrated both because I tried a lot of different fixes, and I KNOW the problem is a very small and simple one that I'm overlooking.

So please, tell me what's wrong with this test program, so I can use the knowledge to fix my actual program.  Thanks.

P.S. I got so paranoid I took out all of the comments seeing if that would help :ponder:.  It's pretty simple so you shouldn't need them, but of course I'll answer any questions if something isn't clear.

 

    processor 6502
    include ".\includes\vcs.h"
    include ".\includes\macro.h"
    
    SEG Code
    ORG $F000
    
    ldx #FF
    lda #0

Clear
    STA 0,X
    DEX
    BNE Clear
    
    LDX #$EE
    STX COLUPF
    
Frame_Loop
    LDA #0
    STA VBLANK
    LDA #2
    STA VSYNC
    STA WSYNC
    STA WSYNC
    STA WSYNC
    LDA #0
    STA VSYNC

    ldx #37
VB_Loop
    STA WSYNC
    DEX
    BNE VB_Loop

    LDX #0
DrawLoop
    LDA #%10101010
    STA PF0
    STA PF1
    STA PF2    
    
    STA WSYNC
    INX
    CPX #192
    BNE DrawLoop
    
Overscan
    LDA #%01000010
    STA VBLANK
    LDX #30
Overscan_Loop    
    STA WSYNC
    DEX
    BNE Overscan_Loop
    JMP Frame_Loop


#2 splendidnut OFFLINE  

splendidnut

    Star Raider

  • 68 posts
  • Location:PA/NY Border

Posted Thu May 4, 2017 5:30 PM

That  LDX #FF should probably be LDX #$FF.

 

 

EDIT:

Okay there's something more... let me take a look.


Edited by splendidnut, Thu May 4, 2017 5:31 PM.


#3 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,736 posts
  • Busy bee!
  • Location:North, England

Posted Thu May 4, 2017 5:36 PM

Where is your reset vector?



#4 splendidnut OFFLINE  

splendidnut

    Star Raider

  • 68 posts
  • Location:PA/NY Border

Posted Thu May 4, 2017 5:40 PM

    processor 6502
    include ".\vcs.h"
    include ".\macro.h"
    
    SEG Code
	ORG $F000
    RORG $F000
	
    
Reset
    ldx #$FF
    lda #0

Clear
    STA 0,X
    DEX
    BNE Clear
    
    LDX #$EE
    STX COLUPF
    
Frame_Loop
    LDA #2
    STA VSYNC
    STA WSYNC
    STA WSYNC
    STA WSYNC
    LDA #0
    STA VSYNC
    LDA #0
    STA VBLANK

    ldx #37
VB_Loop
    STA WSYNC
    DEX
    BNE VB_Loop

    LDX #0
DrawLoop
    LDA #%10101010
    STA PF0
    STA PF1
    STA PF2    
    
    STA WSYNC
    INX
    CPX #192
    BNE DrawLoop
    
Overscan
    LDA #%01000010
    STA VBLANK
    LDX #30
Overscan_Loop    
    STA WSYNC
    DEX
    BNE Overscan_Loop
    JMP Frame_Loop
	
	ORG $FFFC
	RORG $FFFC
	.word $F000
	.word $F000

I fixed up the ORG/RORG statements and the RESET/BRK vectors at the end.  NOTE: I had to change your includes to match where my files were located.



#5 splendidnut OFFLINE  

splendidnut

    Star Raider

  • 68 posts
  • Location:PA/NY Border

Posted Thu May 4, 2017 5:42 PM

Also... to compile I used the following command:

 

dasm program.asm -f3 -v5 -oprogram.bin

 

-f3  should always be used...

-v5 to give for more info about assembly issues



#6 jbs30000 OFFLINE  

jbs30000

    Moonsweeper

  • Topic Starter
  • 472 posts

Posted Thu May 4, 2017 9:31 PM

Reset/Brk vectors - Oops, I forgot that bit of code.  Thanks for reminding me.

 

Compiling: I'm actually using 2 IDEs.

 

For jEdit I have dasm $n -f3 -v0 -s$c.sym -l$c.lst -o$c.bin

 

For Crimson Editor I have the arguments: "$(FilePath)" -f3 -o"$(FileTitle).bin" -l"$(FileTitle).lst" -s"$(FileTitle).sym"



#7 jbs30000 OFFLINE  

jbs30000

    Moonsweeper

  • Topic Starter
  • 472 posts

Posted Thu May 4, 2017 9:53 PM

I'm embarrassed to say, I forgot the reset vector in my original program too.

So I put it in....and I have an image!

I knew it was something simple that I goofed up on.  Thank you very much guys.  I really appreciate it.






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users