reverse letters 
Author Message
 reverse letters

I want to write a program which shows all letters upside down (in  D O S
!!).

My question:
How can I figure out the memory adress of the active charset-table?

Thank you.



Wed, 18 Jun 1902 08:00:00 GMT  
 reverse letters

Quote:

>I want to write a program which shows all letters upside down (in  D O S
>!!).

>My question:
>How can I figure out the memory adress of the active charset-table?

it is in $A000:0 but it is not normally visible to the CPU.

The following procedures make the character generator visible and
invisible to the CPU. (Keep it invisible when normally, like when you
write to screen)

Procedure ShowDefs;
Begin
  asm
  cli
  end;

  portw[$3c4]:=$100;
  portw[$3c4]:=$402;
  portw[$3c4]:=$704;
  portw[$3c4]:=$300;

  asm
  sti;
  end;

  portw[$3ce]:=$204;
  portw[$3ce]:=5;
  portw[$3ce]:=6;
End;

Procedure HideDefs;
Begin
  asm
  cli
  end;

  portw[$3c4]:=$100;
  portw[$3c4]:=$302;
  portw[$3c4]:=$304;
  portw[$3c4]:=$300;

  asm
  sti;
  end;

  portw[$3ce]:=$4;
  portw[$3ce]:=$1005;
  portw[$3ce]:=$e06;

  if mem[$40:$49]=7 then portw[$3ce]:=$806;
End;

You could also use

type TChardef=Array[0..15] of byte;
const base=0;

Procedure ReadChar(c:char;var buff:Tchardef);
var p:^Tchardef;
Begin
  p:=ptr(SegA000,Base+32*ord(c));
  ShowDefs;
  buff:=p^;
  HideDefs;
End;

Procedure SetChar(c:char;const buff:Tchardef);
var p:^Tchardef;
Begin
  p:=ptr(SegA000,Base+32*ord(c));
  ShowDefs;
  p^:=buff;
  HideDefs;
End;

Note that each character uses 32 bytes in the display memory no
matter how many lines (normally 16) it uses on the screen.

These require VGA, or at least EGA. Check the display before use.

Function IsVga:boolean; assembler;
         Asm
         mov ax,1a00h
         int 10h
         cmp al,1ah
         mov ax,0


or

Function IsEga:boolean; assembler;
         Asm
         mov ah,12h
         mov bl,10h
         int 10h
         cmp bl,10h
         mov ax,0


The latter returns true also on VGA.

Use at your own risk.

Osmo



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. recursive code to reverse all lines in a file

2. Algebraic -> Reverse Polish Notation

3. Reverse engineering Borland Pascal

4. reversing a longint value

5. parse and reverse a string

6. Reverse compile

7. reversing elements in an array!!

8. Pascal reverse engineering

9. reversing elements in an array using recursion!!

10. Reverse Engineering for Delphi

11. Reverse engineering Borland Pascal

12. How to reverse list?

 

 
Powered by phpBB® Forum Software