Jump to content
IGNORED

HELP! Need an automated patch for my abbuc game


Recommended Posts

My abbuc entry "Block on Legs: First Steps" has a serious bug that I've now figured out how to fix (literally woke up in the night and figured it) but it's unlikely they will allow an updated version -

 

-luckily it should be a case of replacing two JSR statements with NOPs so I need a disk/file patch that I can send out for people to run. Ideally repace a series of specific bytes on specific sectors. Perhaps some code that I can add the bytes to and assemble myself?

 

Thanks

Jason

Link to comment
Share on other sites

I don't think Windows, even PowerShell, has an easy built in way of doing such patches.  Essentially what you want is to verify data to ensure you're patching the right thing then perform the actual patch.  Likely something such as Perl could handle it but it's not a built in product.

 

Can't you just send out a new version given that the typical ATR zips down to under 50K?

Link to comment
Share on other sites

Hi,

 

   It sounds like you need to write data directly to specific sectors on disk using the 8-bit SIO routines in the OS.

 

I use this code:

 

WRITE_SD_BUFFER_TO_SECTOR	


	LDA	#<SECTOR_BUFFER
	STA	DBUFLO
	LDA	#>SECTOR_BUFFER
	STA	DBUFHI


	LDA #$80
	STA DBYTLO	
	LDA #0
	STA DBYTHI


	LDA	SECTOR_NUMBER		
	STA	DAUX1				
	LDA	SECTOR_NUMBER+1	
	STA DAUX2

	LDA #'P							; would like to update this to write with verify			
	STA DCOMND
	
	LDA #$80
	STA DSTATS

	LDA #$31
	STA DDEVIC

	LDA DESTINATION_DRIVE_NUMBER				; Supplied by user
	STA DUNIT
	
	LDA #20							; NOT SURE
	STA DTIMLO
	
    JSR	SIOV
	
	RTS

;    BMI	ERROR

 

   You just need to define/include the standard SIO DCB equates, and define the other variables (SECTOR_NUM, SECTOR_BUFFER, etc. according to your needs). Your assembler probably has these defined already, or they are somewhere out there on the net, or you can just get them from "Mapping the Atari", etc.

 

   I don't know how the contest disk/images are being distributed, but you might want to try reading the sector that you want to patch, checking the data is what you expect, update the values in memory, then write it back. If you need a READ_SECTOR subroutine, just adjust the one above to use $40 for DSTATS and #'R for DCOMND (If I recall correctly).

 

   I think DUNIT is a binary value, e.g. $01 for drive #1, not ATASCII "1", or maybe the other way round!

 

    I think the rules don't allow distributing a new version after the deadline, but by the same token, I think if you want to write a utility to patch a program, there's nothing forbidding you from doing so.

 

    Hope this helps!

 

P.S. You can also use this code if you want to write the patch utility in Basic: 

 

Edited by E474
  • Like 3
Link to comment
Share on other sites

Hi!

 

I think that the easiest will be distributing a BASIC program, like this (untested):

 

10 GR.0 : ? : ? "TheRealBountyBob Game FIXER" : ?
20 ? "Please, insert original game disk in drive 1" : GOSUB 300
30 TRAP 150: OPEN #2,4,0,"D:MYGAME.COM" : OPEN #3,8,0,"D:NEWGAME.COM"
40 TRAP 80 : READ SKIP, LEN
50 FOR I=1 TO SKIP: GET #2,A: PUT #3,A: NEXT I
60 FOR I=1 TO LEN: GET #2,A: READ A :PUT #3,A : NEXT I
70 GOTO 40
80 TRAP 100 : REM COPY REST OF BYTES
90 GET #2, A: PUT #3, A: GOTO 90
100 CLOSE #2 : CLOSE #3 : ? "Ok, new file created!" : GOSUB 300
110 GR.0 : END
150 ? "ERROR, CAN'T OPEN FILES": ? "VERIFY CORRECT DISK" : ?"AND REMOVE WRITE PROTECCTION"
160 GOSUB 300 : G. 110
300 ? "Press a key"
310 OPEN #1,4,0,"K:" : GET #1, K : CLOSE #1
320 RETURN
390 REM PATCH DATA: # BYTES TO SKIP, # TO REPLACE, VALUES TO REPLACE 
400 DATA 1000, 3, 240, 240, 240
410 DATA 200, 3, 32, 123, 45

The last DATA sections are the number of bytes to read from the original and write to the copy unmodified, then the number of bytes to modify, then the values, and then repeats again.

 

So, if you want to replace bytes 150, 151 and 301 with 10, 11 and 12, the DATA should be "149, 2, 10, 11, 149, 12".

 

Have Fun!

 

  • Like 4
Link to comment
Share on other sites

5 hours ago, Rybags said:

Can't you just send out a new version given that the typical ATR zips down to under 50K?

 

He can and he did - but the deadline for the Abbuc Software Contest is already over (31st July 2019) and thus updates are no longer allowed... and the disk images (including the "buggy-version") have already been made available for download.

 

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