Menu

#21 label mix dec and hex

pending
nobody
labels (1)
1
2023-08-13
2023-04-13
Zibri
No

labels are printed mixed hexadecimal and decimal.
(personally I prefer hexadecimal)

for example
*=$500
START:
RTS
.logical $100
somelabel:
RTS

In this case printing labels with " -l - " shows them in hexadecimal
But in this case:

*=$500
TT=256
START:
RTS
.logical ($200-TT)
somelabel:
RTS

somelabel will be printed in decimal.

Discussion

  • Soci/Singular

    Soci/Singular - 2023-04-14
    • status: open --> pending-invalid
     
  • Soci/Singular

    Soci/Singular - 2023-04-14

    Hello!

    The default label file output is meant to be included in other sources and so it preserves the data types. If something is defined as an integer (256) or bit string ($500) then it will be listed like that. Same as character strings like "+" won't become numbers (43) as these might be needed in their original form in another source where the difference would matter.

    Other label listing formats do the same type preservation currently except for the VICE label output. That always represents addresses as hex due to it's intended use. So if you only want to read it through manually to check what is where or parse the addresses in scripts without worrying of various data representations then that might be an option to look at. Personally for manual address checks I usually read the assembly listing instead.

    But why was somelabel 256 and not $100? That's because the address can have various types as well and $200-256 is 256. But it doesn't necessarily have to be 256! If bits($200-256, 16) would be after .logical then somelabel would became $0100 as now the address was set using a (16 bit) bit string.

    If it's a label holding an address then why isn't it just always implicitly hex (bit string)? That's because I tend to use constructs in my sources where the address is actually an offset for which integers make better sense (to me):

        *=$1000
    strings .block    ; $1000
        .logical 0    ; Offsets from strings zero based.
    this .text "this" ;0
    that .text "that" ;4
        .here
        .bend
     ldx #strings.that  ; offset (4)
     lda strings,x
    

    There are also other obscure uses like setting the address to 1,s to define variables on stack using .byte/.word when programming a 65816 which needs this.

     
    👍
    1
    • Zibri

      Zibri - 2023-04-14

      ok.. now I filled all my source with bits(VAR,16)
      it would be nice to have it as a default (perhaps an option) though...

       
  • Soci/Singular

    Soci/Singular - 2023-08-13
    • status: pending-invalid --> pending
    • Group: 1.58.2974 --> Next_Release_(example)
     
  • Soci/Singular

    Soci/Singular - 2023-08-13

    I've added a "--simple-labels" option in r3006 which creates a label file in a style of "label = $xxxx". It's somewhat limited by nature but should make reading of the label file much easier.

     

    Last edit: Soci/Singular 2023-08-13

Log in to post a comment.

MongoDB Logo MongoDB