Aside from a (minor) problem with your descriptors, I can't think of anything offhand ('course, I haven't slept in days...)... what do your descriptors look like? ie, the actual bytes...
Cheers,
Jeff
char * trouble??
RE:char * trouble??
gdt: dw 0
dw 0
db 0
db 0
db 0
db 0
;Linear data segment
LINEAR_SEL equ $-gdt
dw 0xFFFF
dw 0
db 0
db 0x92
db 0xCF
db 0
;code segment descriptor
SYS_CODE_SEL equ $-gdt
gdt1: dw 0xFFFF
dw 0
db 0
db 0x9A
db 0xCF
db 0
;data segment descriptor
gdt2: dw 0xFFFF
dw 0
db 0
db 0x92
db 0xCF
db 0
That's about it, this is the same code that is found in Alex F.'s pmode
tutorials. And I use the method he uses to set the bases of each
descriptor by placing the value of the current code segment (I think that's
what it does!) in the base field. However his code [ORG 0] and mine
[ORG 0x7c00] so I think setting the bases might be superflous, but, hell I
don't know what I'm doing All I know is when I read the bochs's output
file it has every segment loaded with a selector with a base of 0 and a limit
of fffff, except that the CS is loaded with the code segment.
I was curious that even though I've set SS, I have never set the value of ESP
and I didn't know if that was important. Also if I needed local stack space for
assembly functions. I wouldn't think so because the function works fine if an
actual character is passed to it. But who knows.....Thanks once again everyone.
Carbon get some sleep! ;)
Thanx,
Nicole
dw 0
db 0
db 0
db 0
db 0
;Linear data segment
LINEAR_SEL equ $-gdt
dw 0xFFFF
dw 0
db 0
db 0x92
db 0xCF
db 0
;code segment descriptor
SYS_CODE_SEL equ $-gdt
gdt1: dw 0xFFFF
dw 0
db 0
db 0x9A
db 0xCF
db 0
;data segment descriptor
gdt2: dw 0xFFFF
dw 0
db 0
db 0x92
db 0xCF
db 0
That's about it, this is the same code that is found in Alex F.'s pmode
tutorials. And I use the method he uses to set the bases of each
descriptor by placing the value of the current code segment (I think that's
what it does!) in the base field. However his code [ORG 0] and mine
[ORG 0x7c00] so I think setting the bases might be superflous, but, hell I
don't know what I'm doing All I know is when I read the bochs's output
file it has every segment loaded with a selector with a base of 0 and a limit
of fffff, except that the CS is loaded with the code segment.
I was curious that even though I've set SS, I have never set the value of ESP
and I didn't know if that was important. Also if I needed local stack space for
assembly functions. I wouldn't think so because the function works fine if an
actual character is passed to it. But who knows.....Thanks once again everyone.
Carbon get some sleep! ;)
Thanx,
Nicole
RE:char * trouble??
Hmm... that is truely bizarre... I don't know what to say. You're descriptors are fine... and yes, you're right, there's no need to adjust the base of them. If you're running with an org of 0x7c00, then the real mode base = pmode base = 0x0
You definitly should set esp, though. Who knows where your return pointers are being pushed each time you make a call? I usually set it to a 4kb block in the BSS, however, for simplicity, you could even just set it to 0x90000, or some place you know isn't currently used. That prob'ly won't fix your problem... but... might fix others in the future
Cheers,
Jeff
Oh, and yeah... one of these days I'll get some sleep, I promise
You definitly should set esp, though. Who knows where your return pointers are being pushed each time you make a call? I usually set it to a 4kb block in the BSS, however, for simplicity, you could even just set it to 0x90000, or some place you know isn't currently used. That prob'ly won't fix your problem... but... might fix others in the future
Cheers,
Jeff
Oh, and yeah... one of these days I'll get some sleep, I promise