TIP: Click on subject to list as thread! ANSI
echo: z3_pascal
to: PETER RICK
from: ADAM FITZPATRICK
date: 1996-05-17 20:56:00
subject: Cursor routines...

Peter Rick wrote at All:

PR>Hello all,
PR>does anyone know howto move the cursor without using the CRT
PR>units "GotoXY" procedure or using a BIOS call. What im trying to say
PR>is i need to know howto write directy to memory to change the cursor
PR>position. Im working on a ANSI unit but need direct writes to the
PR>screen, i can do characters/colors through memory address $B800, but
PR>cant achive cursor movement. If anyone can help that would be great

To move the cursor, you only have to send the new co-ordinates to the CRTC.
However, if you want the BIOS to recognise the new cursor position you have
to put it into its memory. Assuming you're working in an 80-character wide
text mode, in page 0:

procedure SetXY(x,y:byte); assembler;

asm
  mov ax,$40      {Video BIOS data segment}
  mov es,ax
  mov al,[y]
  mov ch,al       {save y value for BIOS memory}
  mov [es:$51],al
  mov bl,80
  mul bl
  mov cl,[x]      {save x value for BIOS memory}
  add al,cl       {- these two lines do AX=AX+CL}
  adc ah,0        {- without altering CH}
  mov [es:$50],cx {put new cursor position in BIOS memory}
  mov cx,ax
  mov dx,$3D4     {CRTC port}
  mov al,$E       {cursor position high byte}
  mov ah,ch
  out dx,ax
  mov al,$F       {cursor position high byte}
  mov ah,cl
  out dx,ax
end;

Are you sure it's worth avoiding BIOS on this one? I suppose so if you're
in protected mode, in which case you'll need to alter the "mov ax,$40"
to a selector for that segment (is there a Seg0040?).

... Of course it's half eaten. You said you wanted the chef's salad.
--- FMailX 1.02
* Origin: Power BBS - +61-2-858-4114 - Files/Games/Mail (3:711/953)
SEEN-BY: 633/267 270
@PATH: 711/953 410 808 50/99 635/544 727 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.