Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Karateka to files?

442 views
Skip to first unread message

Steve Nickolas

unread,
Apr 5, 2013, 3:12:36 AM4/5/13
to
So far I've figured out very little about Karateka's loader code.

All I seem to be able to tell is that on disk reads traffic goes through a
function at 3B3, with A carrying a varying amount, prolly a "file" number?

-uso.

Antoine Vignau

unread,
Apr 5, 2013, 5:22:35 AM4/5/13
to
Hum... Did you work from a cracked version on asimov or mine?
The code at $200++ is used in the early boot stages. The final one used by the program is at $5000.

Please read http://www.hackzapple.com/phpBB2/viewtopic.php?t=420

Antoine

Steve Nickolas

unread,
Apr 5, 2013, 10:56:35 AM4/5/13
to
The version I keep around is yours, since your cracks tend to be
"minimally invasive". =P

I admit to being not very good at understanding other people's code. :P
But if I could somehow get this to work it might have advantages for the
future.

-uso.

qkumba

unread,
Apr 5, 2013, 1:18:02 PM4/5/13
to
> I admit to being not very good at understanding other people's code. :P
> But if I could somehow get this to work it might have advantages for the
> future.

It's certainly possible. The disk layout is very sparse, plenty of room for DOS and VTOC.

Steve Nickolas

unread,
Apr 5, 2013, 1:24:27 PM4/5/13
to
Disk layout isn't so much the big deal as MEMORY layout. Granted, maybe
it's possible to get info from The Man Himself =P.

Anyway, when I file crack to multiple files, I usually target ProDOS
because of its greater device independence, but the less RWTS is used the
harder such a port is.

-uso.

Steve Nickolas

unread,
Apr 6, 2013, 12:53:18 AM4/6/13
to
Another reply on a previous post...

On Fri, 5 Apr 2013, Antoine Vignau wrote:

> The code at $200++ is used in the early boot stages. The final one used
> by the program is at $5000.
>
> Please read http://www.hackzapple.com/phpBB2/viewtopic.php?t=420

I'm slooooooooooooooooooooowly starting to see how the pieces fit, but
it's not entirely coming together in my mind.

It looks like there's some sort of miniloader at 4000 that loads a more
complete loader at 5000-57FF? Or am I completely out in left field?

I'm just trying to figure out what code I need to replace, and where it
gets its data - from there I should be set.

-uso.

qkumba

unread,
May 8, 2013, 7:13:42 PM5/8/13
to
I meant to reply to this sooner.
The real loader is at $5500. It accepts values in A and Y.
A is the starting track, Y is the starting index ($00, $30, or $70) into the read-address table (at $5400).
The table contains three 00-terminated lists of addresses. You can see that it uses most of the memory.
You'll need some trickery in order to preserve $BF00-BFFF, but the game runs in 48kb, so the ProDOS code in $D000-FFFF is safe.

Steve Nickolas

unread,
May 8, 2013, 9:57:54 PM5/8/13
to
Hm. That's a start, certainly.

For Rocky's Boots I found a block of 256 bytes that wasn't used and held
the ProDOS page there.

-uso.

Steve Nickolas

unread,
May 9, 2013, 1:50:11 AM5/9/13
to
I'm not in my most lucid mode right now as I've had several fansubbing and
video encoding projects occupying my mind lately, but I've started to
think. Maybe a 64K ProDOS Karateka would be difficult, but perhaps I
*could* do a 128K Karateka - if the disk data is small enough to cache it
on the auxiliary 48K. This is what I did with Lode Runner.

-uso.

Steve Nickolas

unread,
May 16, 2013, 12:56:16 PM5/16/13
to
On Wed, 8 May 2013, qkumba wrote:

If Y is always one of those 3 values, is A also fixed to one of 3 values?

5400- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
5410- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
5420- 40 40 40 40 00 00 00 00 00 00 00 00 00 00 00 00
5430- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
5440- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
5450- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
5460- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
5470- 08 09 0A 0B 0C 0D 0E 0F 60 61 62 63 64 65 66 67
5480- 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77
5490- 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87
54A0- 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97
54B0- 98 99 9A 9B 9C 9D 9E 9F 00 00 00 00 00 00 00 00

...I wonder why it would load consecutive sectors at the same address...

-uso.
Message has been deleted

qkumba

unread,
May 16, 2013, 2:06:46 PM5/16/13
to
> If Y is always one of those 3 values, is A also fixed to one of 3 values?

Yes, the starting track is constant for those three regions, but I don't have the actual numbers in front of me right now.

> ...I wonder why it would load consecutive sectors at the same address...

The first three are throw-away reads, to satisfy the loader which reads all 12 sectors per track in one pass. The last read to $4000 is valid.

Steve Nickolas

unread,
May 17, 2013, 5:06:51 AM5/17/13
to
Well, I think I found my free page: $02. (This is the same page I used
when porting Rocky's Boots.)

This MIGHT be enough to enable me to port, once I figure the read table
out, the game to ProDOS.

-uso.

Steve Nickolas

unread,
May 17, 2013, 5:34:57 AM5/17/13
to
I'm thinking further.

If I can rejig things so that beyond IPL, 5000-53FF isn't needed - and in
the crack in question, very little is - I can use that for ProDOS' 1K
buffer, perhaps?

-uso.

qkumba

unread,
May 17, 2013, 10:26:53 AM5/17/13
to
> If I can rejig things so that beyond IPL, 5000-53FF isn't needed - and in
> the crack in question, very little is - I can use that for ProDOS' 1K
> buffer, perhaps?

You'll have to swap it in and out, just like the game does, because it's used to hold the graphics, too.

Steve Nickolas

unread,
May 17, 2013, 11:32:58 AM5/17/13
to
Naturally.

Hopefully I can free up some of the other space though - so ProDOS doesn't
get too ticked. Plus, I'll need to write the IPL (.system file) of
course.

Moving stuff off text memory would, at least, allow me to use 2000-3FFF
as a temporary buffer - the size of a temp buffer is important when
A000-BFFF gets repeatedly blasted.

-uso.

Steve Nickolas

unread,
May 18, 2013, 3:14:30 AM5/18/13
to
Now that I've had some time to think, the hardest part would be finding
the exact point (and my clue here is "JSR $5500; A and Y registers") at
which a block is needed, where it is on disk, where it needs to go in RAM
and how big it is.

That, once figured out, will probably suffice me to roll the ProDOS
wedge(s).

-uso.

Steve Nickolas

unread,
May 19, 2013, 3:26:36 AM5/19/13
to
So far, I've found 4 pseudofiles - because if A is neither negative nor
$10 when it hits 5005, ... well, it's hard to ascertain what might be
possible, since AppleWin won't throttle down when you got a breakpoint. I
need an infinite life cheat. :(

-uso.

qkumba

unread,
May 19, 2013, 8:22:37 PM5/19/13
to
> I need an infinite life cheat. :(

No problem.
Infinite life:
search for a5 b6 f0 0c
replace f0 with 10

One-hit kill:
search for c6 b7 d0 04
replace c6 with 85

However, if you fall off the cliff, or walk through the falling gate, or run right into someone (except the princess - you have to run to her), you'll still die. So don't do that.

Steve Nickolas

unread,
May 19, 2013, 8:43:59 PM5/19/13
to
Thanks, that's useful.

:)

So hm. 0BC3:10
0BDA:85
0C30:85
6FC6:85

-uso.

Steve Nickolas

unread,
May 19, 2013, 9:49:23 PM5/19/13
to
I *think* I now have the data extracted...

I've still got to mull this over a bit before I can make anything further
of it.

-uso.

Steve Nickolas

unread,
May 20, 2013, 2:05:31 AM5/20/13
to
It's a LOOOOOOOOOOONG road, and I've only taken the first step.

This disk image has a playable level 1. I haven't done any deep memory
analysis to see if I can save space and replace any of the code here. I
figured just this much would be a sign that I was at least off the ground.
xD

http://1.buric.co/karateka/karademA.dsk.gz

I'll eventually figure out a way to get the whole game working complete
with multistage, but this will do for now.

The current patches add up to "restart level on die or advance".

0200 = advance.
0203 = game over.

-uso.

Steve Nickolas

unread,
May 20, 2013, 7:45:04 AM5/20/13
to
Looks like the code I need to understand starts in 0200 and 0203.

It may be possible for me to figure something out after poring over
http://www.hackzapple.com/phpBB2/viewtopic.php?t=420 for awhile...

-uso.

Steve Nickolas

unread,
May 20, 2013, 12:17:43 PM5/20/13
to
http://1.buric.co/karateka/karademC.dsk.gz

I have to decipher the code to handle the exit conditions, but at this
point all four levels are in fact playable. I haven't gotten the attract
mode to work yet, nor the loader, and these are buggy but they work.

The demos of levels 2-4 are trained - they have the hacks mentioned
earlier.

-uso.

Steve Nickolas

unread,
May 21, 2013, 6:43:59 AM5/21/13
to
http://1.buric.co/karateka/karademE.dsk.gz

This is a LOT buggier than the last demo, but the chain loading from level
to level is now working.

The disk contains Nosys and Selextra, so you'll be dumped off in the
Selector directly. Accept the prefix, and you'll find a file called CAT
which does...what you expect, and several other files. The most important
file here is KARADRV, which starts the game.

-uso.

BLuRry

unread,
May 21, 2013, 1:41:38 PM5/21/13
to
Swwwwwweeeeeeeeeeeeeetttttttttttttttttttttttt

Thanks for all the hard work on this! Very exciting!

-B

Steve Nickolas

unread,
May 21, 2013, 1:45:58 PM5/21/13
to
On Tue, 21 May 2013, BLuRry wrote:

> Swwwwwweeeeeeeeeeeeeetttttttttttttttttttttttt
>
> Thanks for all the hard work on this! Very exciting!
>
> -B

*^^*

Still gotta figure out why I can't get the attract mode running outside
the game, why the ProDOS version doesn't have music outside of the
endgame, and what's wrong with the hawk sprite in level 2. (It might have
something to do with my loader.)

-uso.

Steve Nickolas

unread,
May 21, 2013, 2:02:33 PM5/21/13
to
http://1.buric.co/karateka/karademF.dsk.gz

Fixed a bug that happens upon death.

Still to find:

1. Why does the hawk leave a blue trail on the ground?
2. Why doesn't the music work? It works in the individual level tests so
I may have forgotten something.
3. What's up with the power meter after killing the hawk?
4. Is there somewhere I can shoehorn the code to display "the end" upon
death before trying to load a level 0?
5. I still have no idea what kinds of protection checks or such the
attract mode may be doing, which is why it is missing from my version.

A possible gotcha: The loader uses ZP 3C-3F+42-43 to save precious memory
(it goes up to 3CF now... I'd rather not have it go up any higher though I
could prolly push up to 3F1...)

-uso.

Steve Nickolas

unread,
May 24, 2013, 11:06:03 AM5/24/13
to
http://1.buric.co/karateka/karademG.dsk.gz

Still haven't fixed the bugs but it's "freestanding" now, it doesn't have
to be launched from Selextra. The debug trainer is removed.

-uso.

Steve Nickolas

unread,
May 27, 2013, 12:41:11 PM5/27/13
to
http://1.buric.co/karateka/karattr.dsk.gz

This test contains just the attract mode. Its exit condition is trapped
and turned to JMP $FF59.

And my keyboard bit the dust, so I bought a cheap wireless one that's
absolute torture to type with. >_<

-uso.

Steve Nickolas

unread,
Jun 3, 2013, 8:44:40 PM6/3/13
to
Progress.

While I'll have to rerender the files, my new loader contains the code for
"the end" and I've figured out how to initiate the sound on the first
screen after starting the game.

I might be able to get Demo J up sometime this week. Hopefully the music
problem will be fixed too.

-uso.

bry...@yahoo.com

unread,
Jun 6, 2013, 1:32:14 AM6/6/13
to
Once you finish side 1, then you can start on side 2 (upside down)

Steve Nickolas

unread,
Jun 6, 2013, 6:33:16 AM6/6/13
to
On Wed, 5 Jun 2013, bry...@yahoo.com wrote:

> Once you finish side 1, then you can start on side 2 (upside down)
>

Of course. xD

-uso.

Steve Nickolas

unread,
Jun 8, 2013, 1:59:05 PM6/8/13
to
*SIGH*

Regression city with the current version, and the biggest problem is as I
believe the attract mode.

If the attract mode could just be reworked not to need 400-7FF...

-uso.

mdj

unread,
Jun 13, 2013, 9:36:23 PM6/13/13
to
On Sunday, 9 June 2013 03:59:05 UTC+10, Steve Nickolas wrote:

> If the attract mode could just be reworked not to need 400-7FF...

Why is that an issue, Steve ?

Steve Nickolas

unread,
Jun 14, 2013, 3:28:06 AM6/14/13
to
Because memory is very tight, and I think my reuse of 200-3FF is causing
some of the bugs.

-uso.
0 new messages