Board index » delphi » Ofs & Seg Problem...

Ofs & Seg Problem...

I am trying to perform an interrupt call(AX:= $1100- Load user specified
character patterns). I have made an array to store the pattern in:

CharInfo: Array[0..15, 0..256] of CHAR;

What I am having difficulty in is giving ES the segment of the array and BP the
offset of the array. I used this code:

CharSeg:= Seg(CharInfo[0, 0]); {Both variables are defined as WORD}
CharOfs:= Ofs(CharInfo[0, 0]);

Asm
   MOV AX, $1100
   MOV BX, $1000
   MOV CX, $0100
   MOV DX, $0000
   MOV ES, CharSeg  
   MOV BP, CharOfs  
   INT $10
End;

I have figured out that the problem is in the CharSeg & CharOfs variables
because when I made them equal the address for the default font, it worked
fine. When they are set to the address of CharInfo, the font is garbled.

*Any and all help is appreciated!*
                  C.J.

 

Re:Ofs & Seg Problem...


C1284J schrieb:
Quote

> I am trying to perform an interrupt call(AX:= $1100- Load user specified
> character patterns). I have made an array to store the pattern in:

> CharInfo: Array[0..15, 0..256] of CHAR;

> What I am having difficulty in is giving ES the segment of the array and BP the
> offset of the array. I used this code:

> CharSeg:= Seg(CharInfo[0, 0]); {Both variables are defined as WORD}
> CharOfs:= Ofs(CharInfo[0, 0]);

> Asm
>    MOV AX, $1100
>    MOV BX, $1000
>    MOV CX, $0100
>    MOV DX, $0000
>    MOV ES, CharSeg

There is no instruction to load a segment register with
an immediate value. You must use eg.:
     mov di, seg(xxx)
     mov es,di  {I used DI here because it was free}

Quote
>    MOV BP, CharOfs

It is vital that you save BP (and DS:) with a PUSH and
POP around your procedure!

Quote
>    INT $10
> End;

More ASM stuff in the ASM chapter of the TP-links site:
http://www.geocities.com/SiliconValley/2926/tp.html

Franz Glaser

Re:Ofs & Seg Problem...


I have tried to put the PUSH and POP BP commands into my code( at the beggining
and end of my ASM block...), but have found them to make no difference(although
I think I might still keep them just in case.).  My program still load the font
improperly...

*All help appreciated!*
            C.J.

Re:Ofs & Seg Problem...


In article <1998082120090200.QAA04...@ladder01.news.aol.com>,

Quote
C1284J <c12...@aol.com> wrote:
>I have tried to put the PUSH and POP BP commands into my code( at the beggining
>and end of my ASM block...), but have found them to make no difference(although
>I think I might still keep them just in case.).  My program still load the font
>improperly...

Maybe the problem is somewhere else. You posted so little of your code
that one can only guess.

Osmo

Re:Ofs & Seg Problem...


Quote
C1284J wrote:

> I have tried to put the PUSH and POP BP commands into my code( at the
> beggining
> and end of my ASM block...), but have found them to make no
> difference(although
> I think I might still keep them just in case.).  My program still load
> the font
> improperly...

Found that:
http://sites.inka.de/sites/cyborg/pascal/char/CHAR0007.PAS
on the Pascal site:
http://sites.inka.de/sites/cyborg/pascal.htm
Franz Glaser

Other Threads