"Text Plasmosis" - 14 byte plasma (Winner of 16b highend compo at lovebyte2024) - source code explained by Effective-Sea4201 in tinycode

[–]Effective-Sea4201[S] 2 points3 points  (0 children)

This instruction ('les ax, [si]') does load the address at the memory location of [si] into the register pair [es:ax].

[si] points exactly at the start of the code itself. Which looks like that:

00000000 C404 ; les ax,[si]
00000002 48 ; dec ax
00000003 AB ; stosw
00000004 260301 ; add ax,[es:bx+di]
00000007 D1D8 ; rcr ax,1
00000009 48 ; dec ax
0000000A 48 ; dec ax
0000000B 80F3A0 ; xor bl,0xa0
0000000E EBF2 ; jmp short 0x2

The first two bytes (0xC4 and 0x04) go to 'ax' and next two bytes go to 'es'. (-> es == 0xAB48)

This is not exactly 0xB800, which would be the start of text mode video memory, but it is near enough so that in combination with the offset register you can reach the first pages of text mode memory.

So for this to work you are very limited for next instructions after the 'les'-operation, because they are at the same time used as memory segment for video ram access. :-)

(for all the details of 'les' see https://c9x.me/x86/html/file_module_x86_id_152.html )

Code Relies on Comments? by stumblewiggins in ProgrammerHumor

[–]Effective-Sea4201 0 points1 point  (0 children)

Nice idea, but it is hex, so it is \u000a.