Jump to content
Sign in to follow this  
jbs30000

Problem trying to create playfield pixels

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

 

 

EDIT:

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

Edited by splendidnut

Share this post


Link to post
Share on other sites
    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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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"

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...