Board index » delphi » ASM - cursor off routines dont work in pascal

ASM - cursor off routines dont work in pascal

i attempt to use ASM routines to turn off the cursor and i get such
problems.  please help.

----
label cursof, curson, curs
....
asm
          call    cursof
  curson: mov     cx,11                   ;cursor video bios display
  curs:   mov     bh,0                    ;this part
          mov     ah,1                    ;of video
          int     10h                     ;do it
          ret                             ;return to instruction after  
  cursof: mov     cx,0e00h                ;cursor video move out ofsight
          jmp     curs                    ;continue

i get an intergity error...this is true code in ASM, how can i work this
in Pascal, or use pascal to achieve similar results?

 

Re:ASM - cursor off routines dont work in pascal


Quote
Jonathan Weinraub wrote:

> i attempt to use ASM routines to turn off the cursor and i get such
> problems.  please help.

> ----
> label cursof, curson, curs
> ....
> asm
>           call    cursof
>   curson: mov     cx,11                   ;cursor video bios display
>   curs:   mov     bh,0                    ;this part
>           mov     ah,1                    ;of video
>           int     10h                     ;do it
>           ret                             ;return to instruction after
>   cursof: mov     cx,0e00h                ;cursor video move out ofsight
>           jmp     curs                    ;continue

> i get an intergity error...this is true code in ASM, how can i work this
> in Pascal, or use pascal to achieve similar results?

Like this

procedure cursoron;
var
  regs : registers;
begin
  with regs do begin
    cx := 11;
    bh := 0;
    ah := 1;
  end;
  intr ($10, regs);
end;

procedure cursoroff;
var
  regs : registers;
begin
  with regs do begin
    cx := $0e00;
    bh := 0;
    ah := 1;
  end;
  intr ($10, regs);
end;

Please note that I haven't tested this.

--
----------------------------------------------------------------------
Phil Brutsche

"Be of stout heart, Number One.  We've handled the Borg.  We can
certainly handle Admiral Jellico." - Jean-Luc Picard

----------------------------------------------------------------------

Re:ASM - cursor off routines dont work in pascal


Quote
Jonathan Weinraub wrote:
> i attempt to use ASM routines to turn off the cursor and i get such
> problems.  please help.

> ----
> label cursof, curson, curs
> ....
> asm
>           call    cursof
>   curson: mov     cx,11                   ;cursor video bios display
>   curs:   mov     bh,0                    ;this part
>           mov     ah,1                    ;of video
>           int     10h                     ;do it
>           ret                             ;return to instruction after
>   cursof: mov     cx,0e00h                ;cursor video move out ofsight
>           jmp     curs                    ;continue

Frist, you have to rewrite it as procedural Pascal code, with proper context.
Second, that code is lousy, especially when you consider that you can preserve
the state of the cursor when you hide it.  The procedures I use to turn the
cursor on or off:

procedure HideCursor; assembler;

asm
  mov   es,[Seg0040]
  mov   di,0060h
  mov   cx,word ptr es:[di]
  mov   ax,0100h
  or    ch,20h
  int   10h
end;

procedure ShowCursor; assembler;

asm
  mov   es,[Seg0040]
  mov   di,0060h
  mov   cx,word ptr es:[di]
  mov   ax,0100h
  and   ch,0dfh
  int   10h
end;

For TP7.  If you want to use this with TP6, define:

const
  Seg0040 : word = $0040;

Quote
> i get an intergity error...this is true code in ASM, how can i work this
> in Pascal, or use pascal to achieve similar results?

--
Scott Earnest            | SPAM protection in effect. Remove  |
setech@_ix.netcom.com    | "_" as needed for true addresses.  |
earnests@_homenet.lm.com |    UIN:1136443  EFnet:pale_blue    |
sinykal@_{*word*104}space.org  | URL: http://www.netcom.com/~setech |

Other Threads