quinnyke
quinnyke

Reputation: 15

Assembly: Multiply with 2 (shl)

Why does the result is space?(32) instead of ◘?(8)

mov    dl, 4        ;dl=00000100=4
shl    dl, 1        ;dl=00001000=8
mov    ah, 2
int    21h

What changes should I make to see the expected result?

Upvotes: 1

Views: 1105

Answers (1)

Fifoernik
Fifoernik

Reputation: 9899

DOS is interpreting the ASCII codes that you provide with this function call. Since the value 8 represents a backspace, that is what DOS will do.

What changes should I make to see the expected result?

Use the video BIOS function 0Ah, WriteCharacterAtCursor.

mov    cx, 1        ; Replication count
mov    bh, 0        ; Display page
mov    al, 8        ; Character code (00000100 << 1 == 00001000)
mov    ah, 0Ah      ; Function number
int    10h          ; Call the video BIOS interrupt

Upvotes: 3

Related Questions