0

I currently writing a EDID Script to be able to choose custom resolutions in my Fedora25

I found this assembly script to generate the different solutions. I was able to use this as a "template" and my python script works fine generating the CEA Extension Blobs. Now i want to merge the "Head" and my CEA Blobs with the help of the Wikipedia EDID Byte Order Site.

But in the GitHub Skript this (end1-start1) confuses me:

Descriptor2:
start1:     .ascii  "Linux #0"
end1:       .byte   0x0a    /* End marker */
            .fill   12-(end1-start1), 1, 0x20 /* Padded spaces */

How can i do "Linux #0" - 10? (0x0a = 10) When i converte "Linux #0" i get 76 105 110 117 120 32 35 48 what doesnt make sense with the 18 Byte for the Descriptor?

Nico
  • 323
  • 4
  • 14

1 Answers1

1

In assembler, the tokens at the beginning of lines refer to addresses. start1 is the address where the string "Linux #0" starts, end1 is the address where the byte 0x0a starts (or is located because it is a single byte). The term (end1-start1) refers to the difference of the addresses. Since the assembler places the things right after each other into the memory, this is the length of the string "Linux #0", i. e. 8.

The term 12 - (end1-start1) then is the number of padding bytes needed to fill up the thing to 12 bytes. These are then placed behind the .byte 0x0a (.filled with spaces (0x20)).

Alfe
  • 56,346
  • 20
  • 107
  • 159
  • WOW, so thats good to know. Then i have another Questions now: What does assembler do with the `"Linux #0"` string? I would convert it to `76 105 110 117 120 32 35 48` and write it out in python. – Nico Oct 10 '17 at 12:55
  • An assembler creates a binary file. This binary will contain the stuff before your source, then the ASCII characters of `"LINUX #0"`, then a byte `0x0a`, then 4 padding spaces (`0x20`), then the stuff after your source. During assembly time (and only during that!), the address where the `"Linux #0"` is located will be accessible by the name `start1`, etc. So if other parts of the source refer to `start1`, those occurrences will be replaced by this address. – Alfe Oct 10 '17 at 14:14
  • okey, but i think you didn't got me. If assembler create binary files it needs to convert the ascii string `"Linux #0"` to "show" it binary or am i wrong? – Nico Oct 10 '17 at 14:58
  • With `.ascii` you stated to the assembler that it should treat the characters `L`, `i`, etc. as ASCII characters. In ASCII the `L` is the number 0x4c, so the binary will contain a byte of this value, then a byte of the value 0x69 for the `i` etc. Had you used .ebcdic (for instance, and if your assembler is capable of this encoding) the values would have been 0xd3 and 0x89. – Alfe Oct 10 '17 at 15:23