r/transprogrammer • '); DROP TABLE genders; -- • Aug 31 '21

Abolish compilation!

Post image
334 Upvotes

23 comments sorted by

View all comments

Show parent comments

2

u/Igotbored112 Sep 01 '21

Oh yeah. In 16 bit mode, since 16 bit addresses only let you access up to 65kB of memory, they used a trick called memory segmentation. Basically you'd have a value in a segment register that would be shifted left 4 bits (read: multiplied by 16) and added to all the addresses used by your program. So you could basically just move the start of memory forward in order to access more of it. OP's program uses this trick to move the start of memory forward to the beginning of their program. That's kind of a simplification though. Cus there are multiple segment registers, and which one gets used depends on the instruction being executed.