Jump to content
IGNORED

Stella Stuck


Recommended Posts

Hi.. I'm trying to get this simple paddle routine going, but nothing shows up in Stella. When I hit the debugger, I see only RAM addresses with crazy op codes.

I thought it was my attempt at using a macro that was doing it, but I commented it out and there is no difference. Reset vector looks right, and when I read through from there, I can't see where it goes off track.

 

Any ideas?

 

Thanks for any help!

JS.bin

JS.asm

Link to comment
Share on other sites

And here's the code:

; dasm JS.asm -f3 -v0 -sJS.sym -lJS.lst -oJS.bin

PROCESSOR 6502
 

TIA_BASE_READ_ADDRESS = $30
        include vcs.h
        include macro.h
	
	SEG.U VARS
	ORG $80

Paddle1:      ds 1

        ;MAC READ_PADDLE_1
        ;lda INPT0         ; 3   - always 9
        ;bpl .save         ; 2 3
        ;.byte $2c         ; 4 0
;.save   sty Paddle1       ; 0 3
        ;ENDM

	SEG CODE
	
	org $F000

InitSystem:
	CLEAN_START
	
VerticalBlank:
        lda #$82
        sta WSYNC
        sta VSYNC         ; 3    start vertical sync, D1=1
        sta VBLANK        ; 3  6 start vertical blank and dump paddles to ground
        lda #$2C          ; 2  8 set timer for end of Vertical Blank
        sta TIM64T        ; 4 12
        sta WSYNC         ; 1st line of vertical sync
        sta WSYNC         ; 2nd line of vertical sync
        lda #0
        sta WSYNC         ; 3rd line of vertical sync
        sta VSYNC         ; stop vertical sync, D1=0
        ;ldx #3
  
PosObjectLoop
        lda Paddle1		   ;+4    9
        sta WSYNC
DivideLoop
        sbc #15
        bcs DivideLoop   ;+4   13
        eor #7
        asl
        asl
        asl
        asl         
        sta.wx HMP0  ;+4   17
        sta RESP0      ;+4   23
	
	sta WSYNC
	sta HMOVE

	lda #$0f    ; set color for paddle 1 display
	sta COLUP0
	 
	;ldx Paddles2Read
	lda #153       ; prep paddle results with highest possible value
	sta Paddle1 ;,x  ; our initial paddle results will be 1-153
	;sta Paddle3,x  ; and will be adjusted to 0-152 in overscan
	ldx #0
	
VblankWait
        lda INTIM
        bpl VblankWait
	
	sta WSYNC
	sta HMCLR         ; clear hmoves for next time around
        stx VBLANK        ; turn on video output & remove paddle dump to ground
        ldy #152
ReadLoop
	sta WSYNC
	sty COLUBK
	;READ_PADDLE_1 ; reads the paddles
	    lda INPT0         ; 3   - always 9
        bpl .save         ; 2 3
        .byte $2c         ; 4 0
.save   sty Paddle1       ; 0 3

	dey
	bne ReadLoop
	
; display Paddle 1's value by using Player 0
	sta WSYNC
	lda #$FF
	sta GRP0
	ldy #24
P0loop	
	sta WSYNC
	dey
	bne P0loop
	
	lda #$26   ; prep overscan delay
	sta WSYNC
	sta TIM64T ; set overscan delay
	
	;sty ENAM1
	
OSwait	
	lda INTIM
	bpl OSwait
	jmp VerticalBlank

	
	org $FFFA
        .word InitSystem ; NMI
        .word InitSystem ; RESET
        .word InitSystem ; IRQ
	
Link to comment
Share on other sites

I see you made a listing (always a good idea!). Did you by chance take a look at it? Whenever I encounter something odd I'll open up the listing and search for "error".

First error is on line 3:

JS.asm (3): error: Unknown Mnemonic '6502'.
      3  0000 ????			   PROCESSOR  6502



later on you'll see more errors that tie into it:
JS.asm (112): error: Unknown Mnemonic 'lda'.
    112  f001					      lda	INTIM
JS.asm (113): error: Unknown Mnemonic 'bpl'.
    113  f001					      bpl	OSwait
JS.asm (114): error: Unknown Mnemonic 'jmp'.
    114  f001					      jmp	VerticalBlank




dasm supports a number of processors, if it doesn't know you're coding for a 6502 it won't recognize the opcodes (mnemonics).

This is an instance where whitespace is very important - due to missing whitespace, dasm thinks "processor" is a label in your program.
  • Like 1
Link to comment
Share on other sites

I see you made a listing (always a good idea!). Did you by chance take a look at it? Whenever I encounter something odd I'll open up the listing and search for "error".

 

First error is on line 3:

JS.asm (3): error: Unknown Mnemonic '6502'.
      3  0000 ????			   PROCESSOR  6502


later on you'll see more errors that tie into it:

JS.asm (112): error: Unknown Mnemonic 'lda'.
    112  f001					      lda	INTIM
JS.asm (113): error: Unknown Mnemonic 'bpl'.
    113  f001					      bpl	OSwait
JS.asm (114): error: Unknown Mnemonic 'jmp'.
    114  f001					      jmp	VerticalBlank


 

dasm supports a number of processors, if it doesn't know you're coding for a 6502 it won't recognize the opcodes (mnemonics).

 

This is an instance where whitespace is very important - due to missing whitespace, dasm thinks "processor" is a label in your program.

 

 

 

Oooohhh.. I was convinced it was my syntax somewhere... I looked at that over and over and never picked up on that. Thanks!

 

I've never looked at the list file. I guess I had to learn that hard way. I don't see "error", It shows "????" instead. I can see where it included VCS registers though from include vcs.h

      1  10000 ????						; dasm JS.asm -f3 -v0 -sJS.sym -lJS.lst -oJS.bin
      2  10000 ????
      3  10000 ????				       PROCESSOR	6502
      4  10000 ????						; paddle game
      5  10000 ????						; Jeff Haber
      6  10000 ????						; 27 May 2017
      7  10000 ????
      8  10000 ????						;
      9  10000 ????						;

Link to comment
Share on other sites

Your "PROCESSOR 6502" is missing a tab :P If you inspect your reset vectors in memory, you'll find that they are stored as big endian, not as little endian, which is the reason why Stella shows garbage: it is disassembling at 0x0070 (not 0x7000).

Interesting. Did you use DiStella or something?

Link to comment
Share on other sites

I've never looked at the list file. I guess I had to learn that hard way. I don't see "error", It shows "????" instead.

That's odd - what version of dasm are you using? If you just type dasm it'll be the first thing it outputs:

Darrells-Mac-Pro:~ darrellspice$ dasm
DASM 2.20.11
Copyright (c) 1988-2008 by various authors (see file AUTHORS).
License GPLv2+: GNU GPL version 2 or later (see file COPYING).
DASM is free software: you are free to change and redistribute it.
There is ABSOLUTELY NO WARRANTY, to the extent permitted by law.
...
Link to comment
Share on other sites

Looks the same...

C:\Atari\dasm>dasm
DASM 2.20.11 20140304
Copyright © 1988-2008 by various authors (see file AUTHORS).
License GPLv2+: GNU GPL version 2 or later (see file COPYING).
DASM is free software: you are free to change and redistribute it.
There is ABSOLUTELY NO WARRANTY, to the extent permitted by law.

Link to comment
Share on other sites

Looks the same...

C:\Atari\dasm>dasm

DASM 2.20.11 20140304

Copyright © 1988-2008 by various authors (see file AUTHORS).

License GPLv2+: GNU GPL version 2 or later (see file COPYING).

DASM is free software: you are free to change and redistribute it.

There is ABSOLUTELY NO WARRANTY, to the extent permitted by law.

Slightly different - it's the 20140304 updated version.

 

I have the same version, but I actually do get the "error" line in the listing, if I use your source with the un-indented "PROCESSOR 6502".

Link to comment
Share on other sites

Here it is with v1:

 

------- FILE JS.asm LEVEL 1 PASS 1

1 0000 ???? ; dasm JS.asm -f3 -v0 -sJS.sym -lJS.lst -oJS.bin

2 0000 ????

JS.asm (3): error: Unknown Mnemonic '6502'.

3 0000 ???? PROCESSOR 6502

4 0000 ????

 

 

 

But I did notice the output in the command prompt shows two unknown symbols where v0 just says "Complete"

C:\Atari\dasm>dasm JS.asm -f3 -v0 -sJS.sym -lJS.lst -oJS.bin
Complete.

C:\Atari\dasm>dasm JS.asm -f3 -v1 -sJS.sym -lJS.lst -oJS.bin

START OF PASS: 1

----------------------------------------------------------------------
SEGMENT NAME                 INIT PC  INIT RPC FINAL PC FINAL RPC
CODE                         f000                            f000
VARS                     [u] 0080                            0080
                             0000 ????                       0000 ????
RIOT                     [u] 0280                            0280
TIA_REGISTERS_READ       [u] 0030                            0030
TIA_REGISTERS_WRITE      [u] 0000                            0000
INITIAL CODE SEGMENT         0000 ????                       0000 ????
----------------------------------------------------------------------
2 references to unknown symbols.
0 events requiring another assembler pass.

Complete.
Link to comment
Share on other sites

Interesting. Did you use DiStella or something?

 

I used the 6502.ts debugger at https://6502ts.github.io/dev/stella.html

post-47984-0-66720800-1495974308.png

The dump of the last 6 bytes from 0xFFFA -- 0xFFFF shows your vectors. Also, the CPU state after boot shows that execution indeed starts from 0x00F0.

 

However, you can also use the Stella debugger for this (start with "stella -debug" to begin debugging right away)

post-47984-0-46301700-1495974463.png

post-47984-0-86904000-1495974562.png

The dump shows the vectors, and the CPU state shows the initial value of PC (program counter).

 

You can also just look at your image using a hex editor.

post-47984-0-58913200-1495974685_thumb.png

You can see the vectors at the end of the image, and you can also see that dasm hasn't output anything other than 0xFF ;)

Edited by DirtyHairy
Link to comment
Share on other sites

Sweet.. I'll look into that in a minute.. In the meantime.. I hate to ask because I really am trying to figure it out myself... But can anybody figure out why the player is not moving? I've played with Stella's paddle settings but I get nothing.. and I thought I'd be a little farther along on this at this point in a three day weekend.

JS.bin

JS.asm

Link to comment
Share on other sites

Sweet.. I'll look into that in a minute.. In the meantime.. I hate to ask because I really am trying to figure it out myself... But can anybody figure out why the player is not moving? I've played with Stella's paddle settings but I get nothing.. and I thought I'd be a little farther along on this at this point in a three day weekend.

Works for me. Maybe you're not getting the paddles selected correctly in stella?

Link to comment
Share on other sites

OK thanks.. Reloading ROM seems to work... But.. are you getting smooth movement? Mine is jumping 15 pixels or so.

Look at your object positioning code.

 

sta.wx HMP0

...is the same thing to dasm as this...

sta.w HMP0,x

 

And you've got x=3 heading into the object positioning code, so the fine-positioning/motion is getting set for the wrong object.

Link to comment
Share on other sites

Dang it.. I've been staring at the positioning routine for half an hour because of the fact that it looked like 15 pixel increments. I guess I've forgotten what .wx means. I was thinking it meant "word" and couldn't figure out why it was used here. I'm rusty.. Thanks!

  • Like 1
Link to comment
Share on other sites

This is an instance where whitespace is very important - due to missing whitespace, dasm thinks "processor" is a label in your program.

I've made the same mistake in the past as well, multiple times with different variations in fact, and I profoundly hate how most assemblers (and dasm in particular) require whitespace in certain areas. That's so anachronistic!

 

It's also one of the reasons I started to develop a new 650x assembler of my own which is completely whitespace-agnostic. It's written in C++, and funnily enough I got stuck for almost an hour debugging my Makefile - only to find out that make expects tabs in certain places instead of spaces. Whitespace silliness strikes again... :twisted:

 

It's 2017, for crying out loud! :mad:

  • Like 1
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...