Jump to content
IGNORED

µSoukoban A7800


Eagle

Recommended Posts

µSoukoban - link JS7800

 

Select - change level

Start - restart level

 

100 levels from https://www.onlinespiele-sammlung.de/sokoban/sokobangames/robsy/ converted by @zbyti

 

I saw his Soukoban versions in MadPascal for the A8 and I decided to do ASM versions for the A7800.
The goal was to keep the code as short as possible :)

 

Source code attached in MADS. GFX by me (I apologize... :D 

 

Below main code

 

restart 
		ldy #20		;wait 20 frames
		jsr DelayVB
		mva #$00 level_complete
		jsr copy_level

main 
		jsr Find_Sokoban	;result in X
		jsr Joystick  		;use X from Find_Sokoban
		jsr Check_level_complete
		jsr Put_on_screen
		jsr Console_Switches  
;
		lda Level_complete
		beq Main
;
		inc Level_number  
		jmp Restart  

joystick 
			lda SWCHA
			and #$F0
			cmp #$F0
			bne joy_used 
			rts
joy_used	ldy #12			;wait 12 frames
			jsr DelayVB
			cmp #%10110000	;left
			bne joy_right
			Test_tile -1,-2
joy_right	cmp #%01110000	;right
			bne joy_up
			Test_tile +1,+2
joy_up 		cmp #%11100000	;up
			bne joy_down 
			Test_tile -8,-16
joy_down 	cmp #%11010000	;down
			bne endjoy
			Test_tile +8,+16
endjoy 	rts

;@ player 
;+ player on deck 
;. deck
;$ crate
;* crate on deck
;  floor
;
;2 bytes patterns
pattern	.byte '+ @ +.@.'
replace .byte '.@ @.+ +'
;3 bytes patterns
pattern3	.byte '+$ @$ +* @* +$.@$.+*.@*.'
replace3	.byte '.@$ @$.+$ +$.@* @*.+* +*'
;
checktiles
	ldy #$00
@	lda tile1
	cmp pattern,y
	bne @+
	lda tile2
	cmp pattern+1,y
	bne @+
	mva replace,y Tile1
	mva replace+1,y Tile2
	rts
@	:2 iny
	cpy #8
	bne @-1
;
	ldy #$00
@	lda tile1
	cmp pattern3,y
	bne @+
	lda tile2
	cmp pattern3+1,y
	bne @+
	lda tile3
	cmp pattern3+2,y
	bne @+
	mva replace3,y Tile1
	mva replace3+1,y Tile2
	mva replace3+2,y Tile3
	rts
@	:3 iny
	cpy #24
	bne @-1
	rts

find_sokoban
		ldx #64-1
@		lda scr,x
		cmp #'@'
		beq	found_sokoban 
		cmp #'+'
		beq found_sokoban 
		dex
		bpl @-
found_sokoban 
		rts		;Z=0 - found, X= where is

check_level_complete  
		ldx #64-1
@		lda scr,x
		cmp #'.'
		beq level_not_finish
		cmp #'+'
		beq level_not_finish
		dex
		bpl @-	
		lda #$01			;level completed
		sta level_complete
level_not_finish
		rts

copy_level
		mwa	#lvl sour
		mwa #scr dest
		mva level_number temp
		mva #$00	temp+1
		:6 mulu2 				
		adw sour temp
		ldy #$00
@		lda	(sour),y
		sta (dest),y
		iny
		cpy #64
		bne @-
		rts

put_on_screen 
		mwa #scr sour
		mwa #buffor dest
		ldy #$00
@		lda (sour),y
		tax
		lda tabscr,x
		asl @
		sta (dest),y
		iny
		cpy #64
		bne @-
		rts

 

uSokoban.a78 uSokobanSourceCode.zip

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

 

@gambler172 I share my code so that everyone can make changes, add music, sfx, change graphics (160B or 320B will cost maybe few lines of code), title screen or end screen. 

Also code is ready for any other formats of levels from other platforms (full screen as well)

If anyone want make changes any feel free to ask.  I’d be happy to help. 

  • Like 3
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...