Jetpac annotated disassembly released

The place for codemasters or beginners to talk about programming any language for the Spectrum.
mrcook
Drutt
Posts: 46
Joined: Tue Jun 09, 2020 7:31 pm

Re: Jetpac annotated disassembly released

Post by mrcook »

D-Type wrote: Fri Aug 06, 2021 11:34 pm Is the HTML disassembly hosted online anywhere
I never generated the HTML stuff. Except for a few formatting niceties I think opening the .skool file in an editor is more useful, and easy to navigate.

You don't need to install Skoolkit, unless you really want those HTML docs, or need to build a tape file.
User avatar
Joefish
Rick Dangerous
Posts: 2058
Joined: Tue Nov 14, 2017 10:26 am

Re: Jetpac annotated disassembly released

Post by Joefish »

uglifruit wrote: Fri Oct 30, 2020 2:18 pm @mrcook This is very interesting.
How hard would it be to reassemble Jetpac into uncontended memory, I wonder - and would there be an appreciable speed boost.
The cartridge version is effectively running from uncontended memory (the ROM space). I don't know if that appears to run any faster, or has been deliberately slowed down. May be worth comparing the code from the cartridge with that from the cassette version.
mrcook
Drutt
Posts: 46
Joined: Tue Jun 09, 2020 7:31 pm

Re: Jetpac annotated disassembly released

Post by mrcook »

Joefish wrote: Mon Sep 13, 2021 12:52 pm The cartridge version is effectively running from uncontended memory (the ROM space).
The whole game is copied to RAM first. Here's the loader from the start of the ROM:

Code: Select all

$0000 di
$0001 ld a,$3f
$0003 ld i,a
$0005 ld sp,$5cf0
$0008 im 1
$000a ld hl,$2000
$000d ld de,$4000
$0010 ld bc,$1b00
$0013 ldir
$0015 xor a
$0016 out ($fe),a
$0018 out ($fd),a
$001a in a,($fe)
$001c cpl
$001d and $1f
$001f jr z,$c01a
$0021 ld hl,$004d
$0024 ld de,$6000
$0027 ld bc,$2000
$002a ldir
$002c jp $6000
First the splash screen, then the game code.

The game also utilises self-modifiying code (the NewActor routine at address $6971), so needs to live in RAM.
User avatar
Alessandro
Dynamite Dan
Posts: 1910
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: Jetpac annotated disassembly released

Post by Alessandro »

I like these Skoolkit disassemblies when they come as formatted HTML and are available with decimal numerals. Much easier to read and to understand for Assembly semi-literates like yours truly :mrgreen:
User avatar
Lethargeek
Manic Miner
Posts: 743
Joined: Wed Dec 11, 2019 6:47 am

Re: Jetpac annotated disassembly released

Post by Lethargeek »

Alessandro wrote: Mon Sep 13, 2021 3:11 pm I like these Skoolkit disassemblies when they come as formatted HTML and are available with decimal numerals. Much easier to read and to understand for Assembly semi-literates like yours truly :mrgreen:
blasphemer! loathsome decimal heresy (except counters) in z80 disassembly must be eradicated with fire! :evil:
User avatar
popeymon
Drutt
Posts: 11
Joined: Fri Jan 31, 2020 11:28 am

Re: Jetpac annotated disassembly released

Post by popeymon »

I will definitely be looking at this Jetpac disassembly.

If you hadn't done any assembler before, you took on a big challenge!

I am doing a disassembly using SkoolKit of Horace Goes Skiing. The READ_KEYBOARD routine disassembly is https://popeymongames.co.uk/2021/04/23/ ... -at-28234/.

And you've given me an idea to consider using GitHub to publish it. I was just going to put it on my PopeyMon website and add to the above, using some other tools that other SkoolKit users have used.

But GitHub is another option. Not something I've used and I need to weight up the pros and cons of using it, and making it readable for non-coders (sort of).
User avatar
Alessandro
Dynamite Dan
Posts: 1910
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: Jetpac annotated disassembly released

Post by Alessandro »

Lethargeek wrote: Mon Sep 13, 2021 3:29 pm blasphemer! loathsome decimal heresy (except counters) in z80 disassembly must be eradicated with fire! :evil:
Hey! The Taliban are coming! :P
User avatar
Mpk
Dynamite Dan
Posts: 1008
Joined: Tue Feb 09, 2021 8:10 am

Re: Jetpac annotated disassembly released

Post by Mpk »

There's a whole bunch of disassemblies at https://skoolkit.ca/disassemblies/ Speaking as a shameless code voyeur it'd be great to have everyone's disassemblies in one place.

Maybe there's some sort of Spectrum Computing site that could host them all, if skoolkit.ca isn't appropriate.
User avatar
Morkin
Bugaboo
Posts: 3274
Joined: Mon Nov 13, 2017 8:50 am
Location: Bristol, UK

Re: Jetpac annotated disassembly released

Post by Morkin »

Mpk wrote: Mon Sep 13, 2021 6:51 pm There's a whole bunch of disassemblies at https://skoolkit.ca/disassemblies/ Speaking as a shameless code voyeur it'd be great to have everyone's disassemblies in one place.

Maybe there's some sort of Spectrum Computing site that could host them all, if skoolkit.ca isn't appropriate.
I noticed that the one I finished recently for Avalon was automatically put in the game's entry as 'source code - remote link' alongside Steve's Graftgold site link. I guess others may go onto ZXDB as links in the same way?

I've also noticed how people keep their disassemblies in different formats. GitHub seems to be quite popular (I'm not sure how to use it TBH). Others are Skoolkit's standard HTML page output, hosted on people's sites. I guess the main problem is that over the years sites can disappear.

I did add an .asm file for download on request as well - to be honest I wasn't sure what the best format is for a single disassembly file. Is it an .asm file or something else?

Of course, as Alessandro has now mentioned it ;) , there's always the additional discussion about whether it should be in decimal or hex... :lol:
My Speccy site: thirdharmoniser.com
User avatar
Mpk
Dynamite Dan
Posts: 1008
Joined: Tue Feb 09, 2021 8:10 am

Re: Jetpac annotated disassembly released

Post by Mpk »

Morkin wrote: Mon Sep 13, 2021 10:00 pmas now mentioned it ;) , there's always the additional discussion about whether it should be in decimal or hex... :lol:
The skoolkit format ones have a link at the bottom to switch to Hex/Dec, so that solves that issue.

The multiple site problem is why I think it'd be peachy if they could get hosted here somehow, as surely this site will remain forever? And github's just a chore for all involved.
User avatar
Einar Saukas
Bugaboo
Posts: 3118
Joined: Wed Nov 15, 2017 2:48 pm

Re: Jetpac annotated disassembly released

Post by Einar Saukas »

Morkin wrote: Mon Sep 13, 2021 10:00 pm I noticed that the one I finished recently for Avalon was automatically put in the game's entry as 'source code - remote link'
Notice it's also marked as "Source code repository - Disassembled".

Morkin wrote: Mon Sep 13, 2021 10:00 pm I guess others may go onto ZXDB as links in the same way?
All disassemblies are stored in ZXDB this way.

If I missed anything, please let me know!
mrcook
Drutt
Posts: 46
Joined: Tue Jun 09, 2020 7:31 pm

Re: Jetpac annotated disassembly released

Post by mrcook »

Alessandro wrote: Mon Sep 13, 2021 3:11 pm I like these Skoolkit disassemblies when they ... are available with decimal numerals. Much easier to read and to understand for Assembly semi-literates like yours truly
I understand what you mean, I used dcimal numbers for my first forays into disassembly. The thing is, assembly language starts to make way more sense when work in hex numbers. It honestly doesn't take too much time to get your head around it, and your dis/assembly efforts will be rewarded for it.
mrcook
Drutt
Posts: 46
Joined: Tue Jun 09, 2020 7:31 pm

Re: Jetpac annotated disassembly released

Post by mrcook »

Mpk wrote: Mon Sep 13, 2021 6:51 pm Maybe there's some sort of Spectrum Computing site that could host them all, if skoolkit.ca isn't appropriate.
I did bring together a bunch of old disassemblies (some from wayback machine, some I had in my own backups, some existing sites), I converted them to Skoolkit format (some I even reverse engineered from HTML only to .skool files!) and put them on github here: https://github.com/mrcook/zx-spectrum-games

I did think out adding more, but wasn't sure if the owners would be happy with that.

I would personally recommend uploading your disasemblies to a site like Github/Gitlab/etc. Other sites, even personal ones, often disapear or are updated with some new framework (Wordpress, or whatever the latest cool is) and often files like this just disapear. Sure, Github could disappear too, but at this stage it'll probably outlive all of us.

The Skoolkit HTML sites are fine, but anyone serious about understanding how a game works really needs to see the plain ASM/skool source code files.
User avatar
Mpk
Dynamite Dan
Posts: 1008
Joined: Tue Feb 09, 2021 8:10 am

Re: Jetpac annotated disassembly released

Post by Mpk »

This is awesome, I hadn't seen some of these before. I was playing around with AticAtac & skoolkit last night, but I see now it's already been done.
The Skoolkit HTML sites are fine, but anyone serious about understanding how a game works really needs to see the plain ASM/skool source code files.
I'm not sure what is missing from the HTML sites though, compared with the .skool files. Isn't the content the same, just easier to read/browse in the html?
User avatar
SkoolKid
Manic Miner
Posts: 407
Joined: Wed Nov 15, 2017 3:07 pm

Re: Jetpac annotated disassembly released

Post by SkoolKid »

Mpk wrote: Mon Sep 13, 2021 10:11 pm The skoolkit format ones have a link at the bottom to switch to Hex/Dec, so that solves that issue.
Just to clear up a possible misconception: the base-switching links in the page footers is not an automatic feature of SkoolKit - which explains why only the disassemblies I've written and published actually have them. :P

I have now documented how to add base-switching links to your own disassembly, though:

https://skoolkit.readthedocs.io/en/late ... -switching

That 'Base switching' section will be in the manual for 8.6, but the instructions should still work for earlier versions of SkoolKit as well (if you grab bases.ref and bases.py from the GitHub repo).
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
SkoolKid
Manic Miner
Posts: 407
Joined: Wed Nov 15, 2017 3:07 pm

Re: Jetpac annotated disassembly released

Post by SkoolKid »

Mpk wrote: Tue Sep 14, 2021 5:36 pm
mrcook wrote: Tue Sep 14, 2021 3:59 pm The Skoolkit HTML sites are fine, but anyone serious about understanding how a game works really needs to see the plain ASM/skool source code files.
I'm not sure what is missing from the HTML sites though, compared with the .skool files. Isn't the content the same, just easier to read/browse in the html?
That's correct - the content is exactly the same.

Perhaps one advantage of an ASM/skool source file is that it is just one file, so searching for something across the entire disassembly is more convenient. But skool2html.py has the --asm-one-page option if you want the same convenience in the browser via Ctrl-F.
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
D-Type
Drutt
Posts: 3
Joined: Fri Aug 06, 2021 11:14 pm
Location: Zurich, Switzerland

Re: Jetpac annotated disassembly released

Post by D-Type »

mrcook wrote: Mon Sep 13, 2021 12:16 pm
D-Type wrote: Fri Aug 06, 2021 11:34 pm Is the HTML disassembly hosted online anywhere
I never generated the HTML stuff. Except for a few formatting niceties I think opening the .skool file in an editor is more useful, and easy to navigate.

You don't need to install Skoolkit, unless you really want those HTML docs, or need to build a tape file.
Thanks, I didn't realise the .skool file was human readable.
P*h*i*l*l*i*p EEaattoon in real life
User avatar
Bedazzle
Manic Miner
Posts: 305
Joined: Sun Mar 24, 2019 9:03 am

Re: Jetpac annotated disassembly released

Post by Bedazzle »

Einar Saukas wrote: Tue Sep 14, 2021 12:59 am All disassemblies are stored in ZXDB this way.

If I missed anything, please let me know!
https://github.com/Bedazzle/EATF
User avatar
Bedazzle
Manic Miner
Posts: 305
Joined: Sun Mar 24, 2019 9:03 am

Re: Jetpac annotated disassembly released

Post by Bedazzle »

mrcook wrote: Tue Sep 14, 2021 3:47 pm I understand what you mean, I used dcimal numbers for my first forays into disassembly. The thing is, assembly language starts to make way more sense when work in hex numbers.
It depends what number presents. If it is score, or gold, or something people use in real life - it is easier in dec.
If it is memory address - it is much easier to operate in hex.

Example:
16384 vs $4000

1000 vs $03E8
User avatar
D-Type
Drutt
Posts: 3
Joined: Fri Aug 06, 2021 11:14 pm
Location: Zurich, Switzerland

Re: Jetpac annotated disassembly released

Post by D-Type »

Bedazzle wrote: Mon Nov 08, 2021 9:59 pm It depends what number presents. If it is score, or gold, or something people use in real life - it is easier in dec.
If it is memory address - it is much easier to operate in hex.

Example:
16384 vs $4000

1000 vs $03E8
I agree with the above, I use hex exclusively, except for things that are related to human I/O. Once you can add and subtract hex digits in your head, there's no going back to decimal!

I'm using dasmfw/a09 for 6809 disassembly/reassembly and that uses an 'info' file where you can specify comments etc.

It has more advanced disassembly features than skoolkit, but doesn't have the pretty hyperlink HTML output, only plain text.

It does allow you specify ranges of bytes to show as hex/dec/binary/char etc, which produces a really nice source code, IMO.

dasmfw (DisASseMbler FrameWork) was originally based on the f9dasm 6809 disassembler, but re-architected and improved to handle multiple CPU families.

Z80 could be added reasonably easily, but of course without HTML output. If only skoolkit could be made to parse dasmfw 'info' files... :twisted:
P*h*i*l*l*i*p EEaattoon in real life
Post Reply