Jump to content
IGNORED

Teaser: sid 2 gumby


ivop

Recommended Posts

A different, but saddistic approach, is to unravel the original code.

Have a look on this thread at the Speedball attachment.

 

ivop, I'm liking your new work on this but struggled with the sid disassembly and scripts to 'roll your own'.

If your play routine is pretty fixed but just has a table for the init and VBI routines then I'm thinking it should be possible to have the same approach where the C64 SID file can be loaded (or linked into the xex) and the addresses extracted. The same issue exists though in that SID register storing needs to be relocated to your routines work area.

Link to comment
Share on other sites

Which OS are you running? I am developing this all under Linux, but it should work with Cygwin or MSYS on Windows too.

 

Here's a short description of what I do. As an example, I am converting "What Have I Done..." by Reyn Oudehand.

  • First, I relocate the tune to $8000. This is not always needed (a lot of Hubbard tunes are already high enough), but I'll do it anyway, as it relocates the zero page locations, too.

$ sidreloc -p 80 -z d0-ef -r 10-1f What_Have_I_Done_To.sid what.sid

What Have I Done To..., Reyn Ouwehand, 1990 Reyn Ouwehand, $1000-$1e5d, 1 subtunes

Relocating from $1000-$1fff to $8000-$8fff

Analysing subtune 1

Verifying relocated subtune 1

Bad pitches: 0, 0%

Bad pulse widths: 0, 0%

Relocation successful.

  • The I disassemble the sid so I can change access to the sid hardware registers to $1000.

$ siddasm2 what.sid >what.dis

  • Remove the equates at the top and replace by:

SIDV1FREQLO = $1000
SIDV1FREQHI = SIDV1FREQLO + $01
SIDV1PWLO   = SIDV1FREQLO + $02
SIDV1PWHI   = SIDV1FREQLO + $03
SIDV1CTRL   = SIDV1FREQLO + $04
SIDV1AD	 = SIDV1FREQLO + $05
SIDV1SR	 = SIDV1FREQLO + $06

SIDV2FREQLO = SIDV1FREQLO + $07
SIDV2FREQHI = SIDV1FREQLO + $08
SIDV2PWLO   = SIDV1FREQLO + $09
SIDV2PWHI   = SIDV1FREQLO + $0a
SIDV2CTRL   = SIDV1FREQLO + $0b
SIDV2AD	 = SIDV1FREQLO + $0c
SIDV2SR	 = SIDV1FREQLO + $0d

SIDV3FREQLO = SIDV1FREQLO + $0e
SIDV3FREQHI = SIDV1FREQLO + $0f
SIDV3PWLO   = SIDV1FREQLO + $10
SIDV3PWHI   = SIDV1FREQLO + $11
SIDV3CTRL   = SIDV1FREQLO + $12
SIDV3AD	 = SIDV1FREQLO + $13
SIDV3SR	 = SIDV1FREQLO + $14

SIDFCLO	 = SIDV1FREQLO + $15
SIDFCHI	 = SIDV1FREQLO + $16
SIDRESFILT  = SIDV1FREQLO + $17
SIDMODEVOL  = SIDV1FREQLO + $18
SIDPOTX	 = SIDV1FREQLO + $19
SIDPOTY	 = SIDV1FREQLO + $1a
SIDOSC3	 = SIDV1FREQLO + $1b
SIDENV3	 = SIDV1FREQLO + $1c

  • siddasm2 sometimes incorrectly disassembles data blocks. Look for 'ill' and remove the line up to the ';' comment marker. There are .byte statements at the end of each line.
  • Try assembling

$ atasm -r what.dis

ATasm 1.06 beta (A mostly Mac65 compatible 6502 cross-assembler)

Pass 1: Success. (0 warnings)

Pass 2:

..........

In what.dis, line 46--

Error: Unknown symbol 'L_1118'

  • sidreloc only relocates code that is actually run. Depending on the song, not every codepath through the player is actually used, so there can be unknown symbols. Replace them by the hexadecimal equivalent (i.e. L_1118 ---> $1118). I use this rudimentary script to fix all at once.

#! /bin/sh

A=1

while test "$A" = "1"; do
B=`atasm -r "$1" 2>&1 | grep "Error: Unknown symbol" | cut -d"'" -f2`
if test -z "$B" ; then
	A=0
	continue
fi

C=`echo "$B" | cut -d_ -f2`
echo $B $C
sed "s/$B/\$$C/g" <"$1" >"$1".tmp
mv "$1".tmp "$1"

done

  • final assembly pass:

ATasm 1.06 beta (A mostly Mac65 compatible 6502 cross-assembler)

Pass 1: Success. (0 warnings)

Pass 2: Success. (0 warnings)

 

Assembly successful

Compiled 3678 bytes (~3k)

Writing raw binary image:

8000-8e5d

 

Compiled to binary file 'what.bin'

 

Now move what.bin to your sid2gumby directory. Edit sid2gumby.sh65 and add a section 'what)' to the case statement at the top. Check the disassembly for the addresses of the init and play routines (0x8000 and 0x8003). Possibly remap the channels to your liking.

 

	what)
	.screen "  What Have I Done To Deserve This	  "
	.screen "  by Reyn Ouwehand					  "
	.screen "  (C) 1990 Reyn Ouwehand				"
	.org 0x8000
	player_init=0x8000
	player_play=0x8003
	.binary what.bin
	CH_LEFT=2 ; CH_MID=1 ; CH_RIGHT=3
	MID_HALF_VOLUME=0
	;;

  • assemble the new sid2gumby binary

$ SONG=what ./shasm65.sh -v -osid2gumby-what.xex sid2gumby.sh65

pass 1:

assembled block: 7800 - 79ef (01f0)

assembled block: 8000 - 8e5d (0e5e)

assembled block: 2000 - 7594 (5595)

assembled block: 02e0 - 02e1 (0002)

pass 2:

assembled block: 7800 - 79ef (01f0)

save block: 7800 - 79ef (01f0)

assembled block: 8000 - 8e5d (0e5e)

save block: 8000 - 8e5d (0e5e)

assembled block: 2000 - 7594 (5595)

save block: 2000 - 7594 (5595)

assembled block: 02e0 - 02e1 (0002)

save block: 02e0 - 02e1 (0002)

done

  • run: atari800 -nobasic -windowed -showspeed -pal -audio16 sid2gumby-what.xex

 

People not wanting to roll their own, but just want to listen to the tune, sid2gumby-what.xex is included in the zip-file.

reyn.zip

Link to comment
Share on other sites

  • 6 years later...

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