Wrong DS address
Posted: Sat Oct 19, 2013 7:13 pm
Hey,
My kernel looks like that:
My problem is to get myText when in protected mode, probably becouse (for sure...) org 0x8000 it makes 0x8000+tekst to create address when I want to acces it.
I can acces it by [ds:offset_for_myTxt] where offset_for_myTxt = myTxt - endprog but its not ok to access it that way in my opinion. How to deal with it ? How to access myTxt by normal way like
mov si, myTxt
mov byte al, [myTxt]
to get first letter for example ?
Hot to do this ?
Ps. I use tiny memory model.
My kernel looks like that:
Code: Select all
[org 0x8000]
prog:
mov ax, cs
mov ds, ax
; load gdt and enter PM mode code here
db 0eah
dw con
dw 08h
con:
mov ax, 10h
mov ds, ax
endprog dq $-prog
data:
myTxt db 'Here is my sample text'
enddata dq $-data
I can acces it by [ds:offset_for_myTxt] where offset_for_myTxt = myTxt - endprog but its not ok to access it that way in my opinion. How to deal with it ? How to access myTxt by normal way like
mov si, myTxt
mov byte al, [myTxt]
to get first letter for example ?
Hot to do this ?
Ps. I use tiny memory model.