Hi, I've just started using Skoolkit to help understand what the Multiprint ROM is actually doing and how it interacts with the hardware. It's great and I wished I had started using it a while ago.
I'm working at creating the control file as I would like all the comments and interpretation in a single .CTL file - and then I just recreate the .skool file each time I make a batch of edits. This seems easier than commenting the .skool file directly.
I've stuck on how to do a couple of things to get the a more readable output for the .skool file. I'm wondering if it's possible to get routine labels in the .skool file. For example, if $0551 is the pageout routine, can I define this once in the .ctl file and then, whenever a call or jump to $0551 is made it gives both the address and a comment/definition it's jumping to the pageout routine in the .skool file ?
A similar thing would be useful for specific instructions - e.g. whenever a RST x30 or IN A command occurs in the listing is it possible to add a default comment ? Similarly for a DEFB sequence - e.g. defb 14, 00 for print codes.
And finally, how to bring in a set of definitions for system vars - e.g. so 23613/4 is replaced/commented as ERR-SP.
This seems to work if a HTML file is created from the .skool but I'm wondering if it can be done in the .skool output and, if so, how. I suspect I'm missing something obvious. Any ideas would be appreciated.
Thanks.
Skoolkit help
Re: Skoolkit help
No, there's no way to automatically generate instruction-level comments for specific types of instruction or instructions that refer to specific addresses (if that's what you're asking). I think the best way to add such comments is to open the skool file in a decent text editor and do some search-and-replace operations, e.g. to replace "IN A,($FE) ;" with "IN A,($FE) ; Read the keyboard" (or whatever). Then you can get these comments into the control file by using skool2ctl.py.Kiwi wrote: ↑Sun May 19, 2024 2:04 am I'm wondering if it's possible to get routine labels in the .skool file. For example, if $0551 is the pageout routine, can I define this once in the .ctl file and then, whenever a call or jump to $0551 is made it gives both the address and a comment/definition it's jumping to the pageout routine in the .skool file ?
A similar thing would be useful for specific instructions - e.g. whenever a RST x30 or IN A command occurs in the listing is it possible to add a default comment ? Similarly for a DEFB sequence - e.g. defb 14, 00 for print codes.
And finally, how to bring in a set of definitions for system vars - e.g. so 23613/4 is replaced/commented as ERR-SP.
I might be mistaken, but I think @pobtastic has developed some scripts that automatically generate annotations for skool files or control files. Perhaps with some tweaking they would do some or all of what you're looking for.
If you're referring to the fact that the HTML can be generated with (hyperlinked) labels in it, I'm wondering why you'd want to do the same with the skool file. The skool file is an intermediate format between the control file and either HTML or assembly language source. If you replace addresses with labels in the skool file, things will probably break. If you prefer reading code with labels in place of addresses, then you can look at the output of either skool2html.py or skool2asm.py.Kiwi wrote:This seems to work if a HTML file is created from the .skool but I'm wondering if it can be done in the .skool output and, if so, how.
Re: Skoolkit help
My feeling too!
Maybe I'm misunderstanding, but I use https://skoolkit.ca/docs/skoolkit/skool-macros.html#d for this. This expands to be the title of the referenced address.Kiwi wrote: ↑Sun May 19, 2024 2:04 am I've stuck on how to do a couple of things to get the a more readable output for the .skool file. I'm wondering if it's possible to get routine labels in the .skool file. For example, if $0551 is the pageout routine, can I define this once in the .ctl file and then, whenever a call or jump to $0551 is made it gives both the address and a comment/definition it's jumping to the pageout routine in the .skool file ?
Kiwi wrote: ↑Sun May 19, 2024 2:04 am A similar thing would be useful for specific instructions - e.g. whenever a RST x30 or IN A command occurs in the listing is it possible to add a default comment ? Similarly for a DEFB sequence - e.g. defb 14, 00 for print codes.
And finally, how to bring in a set of definitions for system vars - e.g. so 23613/4 is replaced/commented as ERR-SP.
Sooooo ... I have made like a "general" disassembly script, that is true. It's very simplistic though, I mainly use it for like a preliminary "once-over" which I then go through and manually edit (for grouping stuff together, and properly naming things.
It's this kind of thing...
Code: Select all
...
INC = {
0x03: "#REGbc",
0x04: "#REGb",
0x0C: "#REGc",
0x13: "#REGde",
0x14: "#REGd",
0x1C: "#REGe",
0x23: "#REGhl",
0x24: "#REGh",
0x2C: "#REGl",
0x33: "#REGsp",
0x34: "*#REGhl",
0x3C: "#REGa",
}
...
POP = {
0xC1: "#REGbc",
0xD1: "#REGde",
0xE1: "#REGhl",
0xF1: "#REGaf",
}
PUSH = {
0xC5: "#REGbc",
0xD5: "#REGde",
0xE5: "#REGhl",
0xF5: "#REGaf",
}
...
def evaluate_inc(self, cmd):
count = 0x00
while self.snapshot[self.pc + count] == cmd:
count += 0x01
self.lines.append(' ${:X},${:02X} Increment {} by {}.'
.format(self.pc, count, INC[cmd], num2words(count)))
self._pc += count
def evaluate_pop(self):
registers = []
count = 0x00
while self.snapshot[self.pc + count] in POP:
registers.append(POP[self.snapshot[self.pc + count]])
count += 0x01
self.lines.append(' ${:X},${:02X} Restore {} from the stack.'
.format(self.pc, count, ' and '
.join(filter(None, [', '.join(registers[:-1])] + registers[-1:])), count))
self._pc += count
def evaluate_push(self):
registers = []
count = 0x00
while self.snapshot[self.pc + count] in PUSH:
registers.append(PUSH[self.snapshot[self.pc + count]])
count += 0x01
self.lines.append(' ${:X},${:02X} Stash {} on the stack.'
.format(self.pc, count, ' and '
.join(filter(None, [', '.join(registers[:-1])] + registers[-1:])), count))
self._pc += count
...
I will say that for my earlier stuff, I did a LOT of the disassembling by hand - which in the case of like, The Hobbit, is ultra tedious... Take a leaf out of Richard's book and make custom snippet generation scripts:
https://github.com/skoolkid/jetsetwilly ... w2skool.py
https://github.com/pobtastic/booty/blob ... y2skool.py
https://github.com/pobtastic/wheelie/bl ... e2skool.py