6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 2:03 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Pong in Symon
PostPosted: Sun Apr 29, 2018 9:19 pm 
Offline

Joined: Sun Apr 29, 2018 9:13 pm
Posts: 2
Hi, I am trying to get my code to run in the Symon simulator but it doesn't want to cooperate. I am trying to figure out what I am doing wrong to get it to display to the video output in Symon. I was previously using an online simulator but now I am trying to use something more robust like Symon. I was previously using this assembler http://biged.github.io/6502js/

This is my current code that I am trying to get to run in Symon.

Code:


    .CR 6502             ; Assemble 6502
    .LI on,toff          ; Listing on, no timings included
    .TF winner.prg, BIN ; Object filename and format

paddleIndexL  = $00
paddleIndexH  = $01
paddleOriginL = $03
paddleOriginH = $04
loopCnt       = $02


jsr init
jsr loop



init:
  lda #$00
  sta paddleIndexL
  lda #$02
  sta paddleIndexH
  lda #$00
  sta paddleOriginL
  lda #$02
  sta paddleOriginH
  lda #$00
  sta loopCnt
  rts

loop:
  lda paddleOriginL  ;reset paddle draw indexs
  sta paddleIndexL   
  lda paddleOriginH 
  sta paddleIndexH   
  jsr drawPaddle
  jsr readKeys
  jmp loop


drawPaddle:
  ldy #2
  lda #3       ;set color of player 1
  sta ($00),y  ;write that bit to display

  ldy #29
  lda #4       ;set color of player 2
  sta ($00),y

  lda paddleIndexL
  adc #$20     ;incr to next pixel of paddle
  sta paddleIndexL
  lda #$00
  adc paddleIndexH
  sta paddleIndexH
  ldx loopCnt  ;makes the paddle be 5 pixels long
  inx
  stx loopCnt
  cpx #5
  bne drawPaddle
  lda #$00     ;reset counter for next time
  sta loopCnt
  rts

readKeys:
  lda $ff
  cmp #$77
  beq upKey
  cmp #$73
  beq downKey
  rts

upKey:
  clc
  lda paddleOriginL ;checks if the paddle is near the edge
  adc paddleOriginH
  cmp #$02         
  clc
  beq onEdge

;decrement paddle draw index
  clc
  lda paddleIndexL
  sbc #$1f
  sta paddleIndexL
  lda paddleIndexH
  sbc #$00
  sta paddleIndexH
  clc
;clear previous pixel
  ldy #$02
  lda #$00
  sta ($00),y

  ldy #29
  lda #$00
  sta ($00),y

;decrement paddle origin
  lda paddleOriginL
  sbc #$1f
  sta paddleOriginL
  lda paddleOriginH
  sbc #$00
  sta paddleOriginH
  clc
  lda #$00
  sta $ff
  lda $ff
  rts

downKey:
  clc
  lda $03     ;checks is paddle is at the edge of the screen
  adc $04     
  cmp #$65   
  clc
  beq onEdge
 
  clc
;clear previous pixel when its moved
  ldy #$02
  lda #$00
  sta ($03),y

  ldy #29
  lda #$00
  sta ($03),y

;change the paddle location
  lda #$20
  adc paddleOriginL
  sta paddleOriginL


  lda #$00
  adc paddleOriginH
  sta paddleOriginH

;clear the keyboard buffer
  lda #$00
  sta $ff
  lda $ff
  rts

onEdge:       ;ends the program when the paddle goes off the edge of the screen
  rts         ;the edge of the screen
 
 

gameover:
  brk



Any help or suggestions would be greatly appreciated.
Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: Pong in Symon
PostPosted: Sun Apr 29, 2018 9:28 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Welcome! It looks like your code expects video memory to be at $0200, but according to
https://github.com/sethm/symon
it's at $7000 - if that's so, then you need to adjust your pointers.


Top
 Profile  
Reply with quote  
 Post subject: Re: Pong in Symon
PostPosted: Mon Apr 30, 2018 6:10 am 
Offline

Joined: Sun Jun 29, 2014 5:42 am
Posts: 352
That code does look slightly familiar????
viewtopic.php?f=2&t=2493


Top
 Profile  
Reply with quote  
 Post subject: Re: Pong in Symon
PostPosted: Mon Apr 30, 2018 6:16 am 
Offline

Joined: Sun Apr 29, 2018 9:13 pm
Posts: 2
Yup.

I was using that code as my base but now I'm trying to develop a fully functional game that I can run in Symon rather than a website.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: