1

I have problems with the syntax in turbo pascal, this in debug works with no problem, but I can't make it work in Turbo Pascal.

program foo;

begin
asm
    mov ah,06h;
    mov bh,$21;
    mov cx,$0000;
    mov bx,$1950; 
    int 10h;
    mov ah,00h;
    int 16h;  
end;
end.

I don't know what is wrong.

PD: what means the h, the $ and the b in this thing?

Amal Dev
  • 1,938
  • 1
  • 14
  • 26
exsnake
  • 1,767
  • 2
  • 23
  • 44

1 Answers1

8

INT 10h / AH=06h needs also a value in AL:

program foo;

begin
    asm
        mov ah, 06h
        mov bh, $21
        mov cx, $0000
        mov bx, $1950      (* Should it rather be `dx`? *) 
        mov al, 25         (* Scroll up 25 lines *)
        int 10h

        mov ah, 00h
        int 16h
    end;
end.

To clear the entire window you can set AL to zero (mov al, 0 or xor al, al).

The suffix 'h' means that this is a hexadecimal number. The prefix '$' means the same. The first is the Assembly notation, the second is the Pascal notation. Without suffix or prefix it is a decimal number.

rkhb
  • 14,159
  • 7
  • 32
  • 60