Jump to content
Sign in to follow this  
Heaven/TQA

Gridrunner - final round Pt. 2

Recommended Posts

just a question... I am just going through the source code and played "my" port with a Competition Pro USB stick instead of keyboard but can not move diagonal?

 

I have no proper VIC emulator here but can someone check if it is possible in the VIC20 version?

 

here is the joystick "overlay" code I am using and this worked since for 20 years for me... ;)

 

check_joystick: lda 632
		tay
		and #1 ;up
		bne not_up
		ldx #1
		bne get_stick_end
not_up		tya
		and #2 ;down
		bne not_down
		ldx #2
		bne get_stick_end
not_down 	tya
		and #4 ;left
		bne not_left
		ldx #4
		bne get_stick_end
not_left 	tya
		and #8 ;right
		bne not_right
		ldx #8
		bne get_stick_end
not_right 	ldx #0
get_stick_end stx $02
;now check fire button
		lda $d010 ;644 ;trigger 0
		beq fire_pressed
		lda 2
		and #$7f
		sta 2
		rts
fire_pressed lda $02
		ora #$80
		sta $02
		rts

Share this post


Link to post
Share on other sites

Seems I can't get it to work in Winvice... just done a Win reinstall so all my settings are defaulted.

 

From what I can remember, you could do diagonal in all the versions (Atari, 64, Vic). It'd be a much harder game if you couldn't.

 

Looking at the code you've got there - it doesn't support diagonals anyway. You branch past everything once one directional hit is made.

 

Maybe just scrap it and use a translation table instead. Or, just EOR #$F and won't you have the value that Vic code expects?

Share this post


Link to post
Share on other sites

ah, sorry... you might be right... ;) I need to pass all checks and then enter the valid codes for VIC into $02... thanks for pointing out...

Share this post


Link to post
Share on other sites

here you go... it was my fault. thx Rybags

 

 

check_joystick: 
		lda #0
		sta $02
		lda 632
		tay
		and #1 ;up
		bne not_up
		lda $02
		ora #1
		sta $02
		bne not_down
		;ldx #1
		;bne get_stick_end
not_up		tya
		and #2 ;down
		bne not_down
		lda $02
		ora #2
		sta $02
		;ldx #2
		;bne get_stick_end
not_down 	tya
		and #4 ;left
		bne not_left
		lda $02
		ora #4
		sta $02
		bne get_stick_end
		;ldx #4
		;bne get_stick_end
not_left 	tya
		and #8 ;right
		bne not_right
		lda $02
		ora #8
		sta $02
		;ldx #8
		;bne get_stick_end
not_right 	;ldx #0
		;lda #0
		;sta $02
get_stick_end ;stx $02
;now check fire button
		lda $d010 ;644 ;trigger 0
		beq fire_pressed
		lda 2
		and #$7f
		sta 2
		rts
fire_pressed lda $02
		ora #$80
		sta $02
		rts

gridrunner.zip

Share this post


Link to post
Share on other sites

here you go... it was my fault. thx Rybags

 

 

check_joystick: 
		lda #0
		sta $02
		lda 632
		tay
		and #1 ;up
		bne not_up
		lda $02
		ora #1
		sta $02
		bne not_down
		;ldx #1
		;bne get_stick_end
not_up		tya
		and #2 ;down
		bne not_down
		lda $02
		ora #2
		sta $02
		;ldx #2
		;bne get_stick_end
not_down 	tya
		and #4 ;left
		bne not_left
		lda $02
		ora #4
		sta $02
		bne get_stick_end
		;ldx #4
		;bne get_stick_end
not_left 	tya
		and #8 ;right
		bne not_right
		lda $02
		ora #8
		sta $02
		;ldx #8
		;bne get_stick_end
not_right 	;ldx #0
		;lda #0
		;sta $02
get_stick_end ;stx $02
;now check fire button
		lda $d010 ;644 ;trigger 0
		beq fire_pressed
		lda 2
		and #$7f
		sta 2
		rts
fire_pressed lda $02
		ora #$80
		sta $02
		rts

 

You can optimize your above joystick/trigger code to:

 

LDA 632

ASL

LSR 53264

Ror

EOR #$8F

STA $02

Share this post


Link to post
Share on other sites

;) Great stuff Karolj, good to see it nearing completion.

 

"only" linking and some sound fx tweaking...

 

maybe I am moving the title msx into the "main" game... as Miker's music plus your G2F title screen is flickering on NTSC...

Share this post


Link to post
Share on other sites

here you go... it was my fault. thx Rybags

 

 

check_joystick: 
		lda #0
		sta $02
		lda 632
		tay
		and #1 ;up
		bne not_up
		lda $02
		ora #1
		sta $02
		bne not_down
		;ldx #1
		;bne get_stick_end
not_up		tya
		and #2 ;down
		bne not_down
		lda $02
		ora #2
		sta $02
		;ldx #2
		;bne get_stick_end
not_down 	tya
		and #4 ;left
		bne not_left
		lda $02
		ora #4
		sta $02
		bne get_stick_end
		;ldx #4
		;bne get_stick_end
not_left 	tya
		and #8 ;right
		bne not_right
		lda $02
		ora #8
		sta $02
		;ldx #8
		;bne get_stick_end
not_right 	;ldx #0
		;lda #0
		;sta $02
get_stick_end ;stx $02
;now check fire button
		lda $d010 ;644 ;trigger 0
		beq fire_pressed
		lda 2
		and #$7f
		sta 2
		rts
fire_pressed lda $02
		ora #$80
		sta $02
		rts

 

You can optimize your above joystick/trigger code to:

 

LDA 632

ASL

LSR 53264

Ror

EOR #$8F

STA $02

 

aehm... if this works... it is far simpler than my one... ;)

 

Jesus... Atariski... your code works perfect... :D just compiled the new build... now this comes into my code snippets archive... ;)

Edited by Heaven/TQA

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...