Skoolkit and ASM labels

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
marenja
Microbot
Posts: 108
Joined: Sun Dec 26, 2021 4:15 pm

Skoolkit and ASM labels

Post by marenja »

I use example files for game hungry horace

My aim is to have result disassembly in text
- with labels L+address for jp, jr, call instructions e.g.
jp L32768
- with the same label at place of usage e.g.
L32768: ld a,1
- no address labels for instructions other than jp, jr, call -- no change for original ld a,(32768) instead of ld a,(L32768)

Example of what is expected

Code: Select all

L25399:
  LD A,(31841)	; use number, not label
...
  CP 1
  JR Z,L25450	; use label instead of address
  CP 2
  JR NZ,L25529	; label instead of address
...
  JP Z,L27166	; label instead of address
  JR L25529
L25450:	; label for every jr, jp, call target
  LD A,90
  LD (31865),A
  LD BC,(28623)
  LD HL,(31851)
  LD A,(31856)
  AND A
  JR Z,L25472	; label
  SBC HL,BC
  JR L25473	; label
25472:
  ADD HL,BC
25473:
  PUSH HL
  LD HL,31849
  LD C,16
  PUSH BC

Result asm file has some default labels like L24576, L24576_0, L25167, L25167_0, L25399, L25399_0, L25399_1 but they have wrong addresses e.g. L25399 is correst but L25399_0, L25399_1 and others have _wrong_ address. And asm file has labels for ld insctuctions like LD A,(L31841)

What settings should i use to get asm file with correct address labels?

Conversion to skool file:

Code: Select all

python sna2skool.py -c hungry_horace.ctl hungry_horace.sna > hungry_horace.skool
Conversion to asm file:

Code: Select all

python skool2asm.py -c hungry_horace.skool > hungry_horace.asm
I get a lot of warnings to output
WARNING: No label for address (31849):
24597 LD HL,31849
WARNING: No label for address (28078):
25029 LD HL,28078
WARNING: No label for address (28078):
25121 LD (28078),HL
WARNING: No label for address (31857):
25126 LD (31857),A

Code: Select all

L25399:
  LD A,(L31841) ; this is unwanted usage of label instead of address
  DEC A
...
  JP Z,L27166
  JR L25399_9 ; this label is incorrect
L25399_0: ; another incorrect label
  LD A,90
  LD (31865),A
  LD BC,(28623)
  LD HL,(31851)
  LD A,(31856)
  AND A
  JR Z,L25399_1
  SBC HL,BC
  JR L25399_2
L25399_1:
  ADD HL,BC
L25399_2:
  PUSH HL
  LD HL,31849
  LD C,16
L25399_3:
  PUSH BC
I get asm file without any labels at all if option -c is not used

Code: Select all

  LD A,(31841)
  DEC A
  LD (31841),A
  RET NZ
  LD A,(31842)
  LD (31841),A
  LD A,(31865)

  JP Z,27166
  JR 25529
  LD A,90
  LD (31865),A
  LD BC,(28623)
  LD HL,(31851)
  LD A,(31856)
  AND A
  JR Z,25472
  SBC HL,BC
  JR 25473
  ADD HL,BC
  PUSH HL
  LD HL,31849
  LD C,16
  PUSH BC
User avatar
SkoolKid
Manic Miner
Posts: 407
Joined: Wed Nov 15, 2017 3:07 pm

Re: Skoolkit and ASM labels

Post by SkoolKid »

HI @marenja. If I understand correctly, I think you need to set the EntryPointLabel configuration parameter for skool2asm.py. For example:

Code: Select all

skool2asm.py -wcI "EntryPointLabel=L{address}" hungry_horace.skool
You can also set EntryPointLabel in the skoolkit.ini configuration file, so you don't need to keep entering it on the command line:

Code: Select all

[skool2asm]
EntryPointLabel=L{address}
See skool2asm.py configuration for more details.
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
marenja
Microbot
Posts: 108
Joined: Sun Dec 26, 2021 4:15 pm

Re: Skoolkit and ASM labels

Post by marenja »

SkoolKid wrote: Thu Sep 14, 2023 5:21 pm You can also set EntryPointLabel in the skoolkit.ini configuration file, so you don't need to keep entering it on the command line:

Code: Select all

[skool2asm]
EntryPointLabel=L{address}
That is exactly what i want.
Muchas gracias.
Post Reply