🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.lang.asm
Article #375

Re: [tp7-asm] I want to change the DOS font but...BUG

#375
From: R.E.Donais
Date: Sat, 22 Nov 1997 00:00
109 lines
3600 bytes
"Vincent P." <picavetSPAM@worldnet.net> wrote:

>Hello,
>I want to change the dos Ascii font using interrupt 10h fonction 11h
>But this procedure doesn' t work and I don' t know why.
>Could somebody help me ?
>This is TP7 with inline assembly.
>
>------code---------
>...
>font : array[0..255,0..15] of  byte;
>...
>...
>procedure font2dos;
>var
>n : byte;
>ws,s,o: word;
>begin;
>for n:=0 to 255 do begin
>s:=seg(font);o:=ofs(font[n,0]);
>ASM
>mov ws,bp
>mov es,s
>mov bp,o
>mov cx,1
>mov dh,0
>mov dl,n
>mov bl,0
>mov bh,16
>mov ah,11h
>mov al,0
>int 10h
>mov bp,ws
>end;
>end;
>end;
>---------------
>So, if you know why this doesn' t work, I would be happy to know it. Or if
>you know an other way to do what I want, I'm interested too.
>I would like to have an inverse procedure (dos2font) so...

You're not paying attention to detail, Vincent.  You obviously
need to study parts 3 and 4 of the Language Guide.  You would
then realize that local variables like "ws" are referenced via
the BP register!  Naturally when you attempt "mov BP,ws" the
assembled instruction is _not_ what you want.  :-(

Until you get a better handle on BASM, you might consider using
DOS Registers and Intr procedure.  ;-)

In your approach to the problem, you should use the stack.
Replace "mov ws,BP" with "push BP" and "mov BP,ws" with "pop
BP".

OTOH, if you're intent on using BASM, you should learn how to go
all the way.  From your example, we would have --

PROCEDURE Font2Dos; Assembler;
ASM
      push BP
      mov  AX,SEG Font
      mov  ES,AX
      mov  BP,OFFSET Font
      xor  DX,DX

@@1:  push ES
      push BP
      push DX
      mov  cx,1
      mov  BX,$1000  { bl=0, bh=16  }
      mov  AX,$1100  { al=0, ah=11h }
      int  10h
      pop  DX
      pop  BP
      pop  ES
      add  BP,16     { step to next character }
      inc  DL
      jnz  @@1       { continue for all 0..255 characters }

      pop  BP
END;


Then again, wouldn't it be just as easy to do the following?
After all, you are initializing all characters, it's probably
only going to be executed once during program initialization,
the overhead for a one time call is negligible, and you are
protected by a Pascal wrapper ---

PROCEDURE Font2Dos;
VAR Regs: Registers;
BEGIN
    With Regs Do Begin
      ES := Seg(Font); { ES:BP = pointer to user table         }
      BP := Ofs(Font);
      CX := 256;       { Number of character patterns          }
      DX := 0;         { character offset into map 2 block     }
      BL := 0;         { block to load in map 2                }
      BH := 16;        { number of bytes per character pattern }
    End;
    Intr($10, Regs);
END;

    ...red

-- 
Support the anti-Spam amendment
  Join at http://www.cauce.org/
Technical Details
Message-ID: <34770327.219809@news.southeast.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <01bcf696$fd804320$LocalHost@urnord.calvacom.fr>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10261c,884240de3ddf24dc
X-Google-Attributes: gid10261c,public
X-Google-Thread: f7d8d,884240de3ddf24dc
X-Google-Attributes: gidf7d8d,public
X-Google-Thread: 110df7,884240de3ddf24dc
X-Google-Attributes: gid110df7,public
X-Google-Thread: 108ebd,884240de3ddf24dc
X-Google-Attributes: gid108ebd,public
From: rdonais@southeast.net (R.E.Donais)
Subject: Re: [tp7-asm] I want to change the DOS font but...BUG
Date: 1997/11/22
Message-ID: <34770327.219809@news.southeast.net>
X-Deja-AN: 291786955
References: <01bcf696$fd804320$LocalHost@urnord.calvacom.fr>
Organization: Southeast Network Services, Inc.
Newsgroups: alt.lang.asm,borland.public.turbopascal,comp.lang.asm,comp.lang.pascal.misc