Closed FitDavid closed 3 years ago
it works like this:
mov ax, 0x10
mov ds, ax
now it compiles, although the OS still don't work, it just freezes.
@FitDavid, yes, that is how that is supposed to work. Just as you cannot directly assign memory to a value, but must move it to a general register, and then to memory, so you cannot directly assign special registers, but must treat them like memory. However, I do not know why the OS would freeze. My guess would be that the error is somewhere else, since this (limited) snippet is completely correct. A good project for another time would be to create entire working examples that showcase these snippets from the book being used correctly, but, unfortunately, I do not have the ability to take that on.
Thanks for bringing the snippet to my attention. I will fix that as soon as I am able.
PS. It's another issue, but if I understand well the selector bits, to select the 3rd element in GDT, the selector should be 0x80 instead of 0x10 because there are type bits and RPL bits after offset bits . Or am I wrong?
I would open another issue to deal with that (and offer some clarification on exactly how you got there, since I don't quite understand where that number came from).
hi :) In chapter 5.3 Loading the GDT there's this code snippet:
which produces invalid combination of opcode and operands error. What's the solution?
PS. It's another issue, but if I understand well the selector bits, to select the 3rd element in GDT, the selector should be 0x80 instead of 0x10 because there are type bits and RPL bits after offset bits . Or am I wrong?