Weird Little bug in my code.

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Armature
Member
Member
Posts: 33
Joined: Wed Apr 25, 2018 2:44 pm
Libera.chat IRC: idk

Weird Little bug in my code.

Post by Armature »

Hey guys, so I've been writing my OS on and off for about two years now and I've recently run into this quirky little bug. I have the following code snippet:

Code: Select all

mov ax, 0x0E00
mov ds, ax
jmp 0x0E00:0x0000
Now, this works fine. The code executes, jumps to the memory location and starts executing. Yay, but the following code snippet:

Code: Select all

mov ax, 0x0E00  ;Same as before
mov ds, ax    ;Same as before
mov cs, ax    ; different 
jmp 0x0000 ;once again different
This code however doesn't work. Why? As far as I know the CS segment uses IP as an offset which is what jmp sets to 0x0000, so this should have the same effect as jmp 0x0E00:0x0000 right? When this code is run, nothing happens. I just get the blinking cursor mono screen. Which indicates the code doesn't work as the first segment prints new information to the screen. Anyone know what's happening?
Armature
Member
Member
Posts: 33
Joined: Wed Apr 25, 2018 2:44 pm
Libera.chat IRC: idk

Re: Weird Little bug in my code.

Post by Armature »

ohhhhhhh. Okay I get it now.
Post Reply