Jump to content
IGNORED

Scrolling (from memory buffer) and > 256 characters


mksmith

Recommended Posts

I hope you guys well after last scroll.

Today I would like to show you Vertical scroll in direct mode + 16 sprites/objects

Source code in Mads attached

Enjoy

 

@Traxx ok. But first I have to go back to Robbo next week :) 

 

Direct mode Vertical scroll + 16 sprites - link to JS7800

 

most important part of code for this example

 

update_scroll
		lda firstline
		and #$0F
		cmp #$0F	;put zero
		beq @+
		inc firstline	
		dec lastline
;change addres of tiles in last line
		lda firstline
		and #$0F
		ora #$E0			; MSB Maria bank for tiles
	:13 sta line9+2+[#*4]	; hehe don't ask ;) MADS is cool
		and #$0F
		eor #$0F
		sta y_offset		; need for correction spritest Y
		rts
@
		lda #$0F
		sta y_offset		;=0 need for correction spritest Y
		lda #$40			;1 line + Holey DMA
		sta firstline
		lda #$4F
		sta lastline
;copy tile row down
		ldx #$00
@	
		lda line8,x
		sta line9,x
		lda line7,x
		sta line8,x
		lda line6,x
		sta line7,x
		lda line5,x
		sta line6,x
		lda line4,x
		sta line5,x
		lda line3,x
		sta line4,x
		lda line2,x
		sta line3,x
		lda line1,x
		sta line2,x
		lda line0,x
		sta line1,x
		inx
;copy tile colour down as well
		lda line8,x
		sta line9,x
		lda line7,x
		sta line8,x
		lda line6,x
		sta line7,x
		lda line5,x
		sta line6,x
		lda line4,x
		sta line5,x
		lda line3,x
		sta line4,x
		lda line2,x
		sta line3,x
		lda line1,x
		sta line2,x
		lda line0,x
		sta line1,x

		:3 inx			;skip 4 bytes (1+3)
		cpx #13*4		;13 tiles * 4 byte DL
		bne @-		 	
		lda firstline
		and #$0F
		ora #$E0	;MSB Maria bank for tiles
	:13 sta line9+2+[#*4]

;put new tiles row on Top of screen (line0)
		ldx #$00
@		lda Random
		and #$0F		;from 0-15
;multiply x3 because Tiles are 3 bytes width
		sta temp		;=*1
		asl @			;=*2
		clc
		adc temp		;=*3 
		sta Line0,x
;get random pallet for Tile
		lda Random
		and #$E0		;we use only highest 3 bits for pallet
		ora #$1D		;ora width of tile (3 bytes)
		sta Line0+1,x
		:4 inx			;4 times INX
		cpx #13*4
		bne @-
		rts

 

directmodescrollvertical.a78 DirectModeScrollVertical.zip

  • Like 6
  • Thanks 1
Link to comment
Share on other sites

I just got done with your first working code example brother,and learnt a massive amount.What's your first name Eagle,I'm Richard.I'd like to get to know you on a first name basis,I almost gave up on 7800 programming with dasm and lack of programmers sharing but you changed all of that.

Edited by Traxx
  • Like 1
Link to comment
Share on other sites

Just now, Eagle said:

@Traxx I’m happy to help. 
@mksmithsorry for hijack your thread. I will move back to my topic soon :) 
 

Dariusz

No need for apologies mate! Loving what you have contributed to this discussion.  Scrolling has been a real holy grail for the us devs in recent years and you've added considerably to achieving this goal - thank you!! 

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

6 hours ago, Traxx said:

I know a pixel artist from c64 dev scene I can put you in touch with,he is looking for a programmer that want's to code on a platformer,that's you!

 

 

Incorrect thread apologies

All good traxx! If your learning here what's were after in the community!

  • Like 1
Link to comment
Share on other sites

I will add next time Mads listing file to zip.

 

also I will explain some others Mads features (you can't see them in LST file)

 

# (loop counter)

:13 (repeat 13 times)

 

	:13 sta line9+2+[#*4]	

will give you

	 sta line9+2+[0*4]	
	 sta line9+2+[1*4]	
	 sta line9+2+[2*4]	
	 sta line9+2+[3*4]	
	 sta line9+2+[4*4]	
	 sta line9+2+[5*4]	
	 sta line9+2+[6*4]	
	 sta line9+2+[7*4]	
	 sta line9+2+[8*4]	
	 sta line9+2+[9*4]	
	 sta line9+2+[10*4]	
	 sta line9+2+[11*4]	
	 sta line9+2+[12*4]	

 

 

Also Mads has very useful org addr,* to relocate your code

 

		ORG	$1800,*
.local DLLs
	:3	.byte	$0F,>emptyline,<emptyline	;3 empty DLL
firstline		.byte	$4F,>line0,<line0
		.byte	$4F,>line1,<line1
		.byte	$4F,>line2,<line2
		.byte	$4F,>line3,<line3
		.byte	$4F,>line4,<line4
		.byte	$4F,>line5,<line5
		.byte	$4F,>line6,<line6
		.byte	$4F,>line7,<line7
		.byte	$4F,>line8,<line8
lastline		.byte	$4F,>line9,<line9
 
	:7	.byte	$0F,>emptyline,<emptyline	;7 empty DLL

 

will give you after 

 

F000					ORG	$1800,*
   512 1800			.local DLLs
   513 1800 0F 1C ED 0F 1C ED + 	:3	.byte	$0F,>emptyline,<emptyline	;3 empty DLL
   514 1809 4F 18 3D		firstline		.byte	$4F,>line0,<line0
   515 180C 4F 18 B5				.byte	$4F,>line1,<line1
   516 180F 4F 19 2D				.byte	$4F,>line2,<line2
   517 1812 4F 19 A5				.byte	$4F,>line3,<line3
   518 1815 4F 1A 1D				.byte	$4F,>line4,<line4
   519 1818 4F 1A 95				.byte	$4F,>line5,<line5
   520 181B 4F 1B 0D				.byte	$4F,>line6,<line6
   521 181E 4F 1B 85				.byte	$4F,>line7,<line7
   522 1821 4F 1B FD				.byte	$4F,>line8,<line8
   523 1824 4F 1C 75		lastline		.byte	$4F,>line9,<line9

 

DLL will be at $F000 address and you can copy to RAM

Because all labels will be relocated 

firstline = $1809

lastline = $1824

 

Building Display List is much much easier in Mads

directmodescrollvertical.lst

Edited by Eagle
  • Like 1
Link to comment
Share on other sites

Next one :) Joystick and software collision added

Mads source code attached

Enjoy

 

Direct Mode Vertical Scroll with Joystick and software collisions - link to JS7800

 

 

new procedures below

 

main  		
		jsr WaitVBLANK
		mva #$04 BACKGRND	;show CPU usage
		jsr joystick  
		jsr software_collision
		jsr ChangeColourToShowCollision 
		jsr update_scroll
		jsr Clear_all_sprites		;delete all srites from previous Vblank (put $00 in second byte after scroll/background data)
		jsr	put_sprites_on_screen 
		jsr Sinus_path
		mva #$00 BACKGRND
		jmp main

software_collision 
	mva #$00 collision	;clear all collision
	ldx #$0F			;15objects from 1-15 (object 0 is Player 1)
@	jsr detect_collision
	beq	no_collision_detected 
	inc collision
no_collision_detected 
	dex
	bne @-				;BNE instead of BPL - we skip object O 
	rts

ChangeColourToShowCollision 
	lda collision		;any collision?
	bne YesWeHadCollision 
	lda #$24
	sta P1C2			;change colour back when NO collision
	rts
YesWeHadCollision 
	lda #$00
	sta P1C2			;change colour when collision detected
	rts

detect_collision 
	lda x_en,x
	clc
	adc #12
	sbc x_en		;player 1 Xpos
	cmp #12+12-1
	bcs no_collision
	lda y_en,x
	adc #16			;no CLC because we have BCS before ;) 
	sbc y_en		;player 1 Ypos
	cmp #16+16-1
	bcs no_collision
	lda #$01	;you can detect here which object had collision (reg x) play SFX, start animation of explossion, etc.
	rts
no_collision
	lda #$00
	rts


;Tabstick - what you read from SWCHA
;       0000    ;--
;       0001    ;--
;       0010    ;--
;       0011    ;--
;       0100    ;--
;       0101    ;right down
;       0110    ;right up
;       0111    ;right
;       1000    ;----
;       1001    ;left down
;       1010    ;left up
;       1011    ;left
;       1100    ;---
;       1101    ;down
;       1110    ;up
;       1111    ;no move
; simply - bit 0 = 0 - up
;          bit 1 = 0 - down
;          bit 2 = 0 - left
;          bit 3 = 0 - right

x_stick           .byte 0,0,0,0,0,1,1,1,0,$FF,$FF,$FF,0,0,0,0
y_stick           .byte 0,0,0,0,0,1,$FF,0,0,1,$FF,0,0,1,$FF,0            

Joystick 
	lda SWCHA
	:4 lsr @
	tax
	lda	x_stick,x
	clc
	adc x_en
	cmp #$FF
	bne @+			;check left
	lda #$00
	beq @+1
@	cmp #160-12+1	;check right
	bcc	@+
	lda #160-12
@	sta x_en
	lda y_stick,x
	clc
	adc y_en
	bpl @+		;check top
	lda #$00
	beq @+1
@	cmp #$60	;check bottom
	bcc	@+
	lda #$5f
@	sta y_en
	rts

 

directmodescrollverticalcollision.a78 sourcecode_directmodescrollverticalcollision.zip

Edited by Eagle
  • Like 3
  • Thanks 2
Link to comment
Share on other sites

Reverse engineered Jinks scrolling,color palette routine,char animation routine,huge thanks Dariusz,you made this possible for me so quickly by sharing,your contribution is immensely appreciated.

 

I didn't add limits to the scroll yet,put you can try it in JS7800

 

 

scroll.a78

Edited by Traxx
  • Like 2
Link to comment
Share on other sites

On 8/10/2022 at 5:53 AM, Cyprian said:

and actually that was a great feature.

would be cool to have it back

This may not be something I can fix on my end.  Attachments are now stored in a CDN (Content Delivery Network), but I can just manually paste the URL in a new browser window and load it that way without any issues.  I'd need to know more about what's happening on the JS7800 and what type of response they are getting when they attempt to grab the attachment as has been done in the past.

 

 ..Al

Link to comment
Share on other sites

6 hours ago, Traxx said:

Ok ported the c64 karate champ sprites Dariusz,But i'm quite far into mame reverse engineer of KC,going to use arcade code in 7800 version.

Sounds great! Good luck!

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