1 ; The program must be keyed in exactly as is given here.
2
3
4 org 0x100
5 bits 16
6 00000000 E90900 jmp start ; Start program execution
7 00000003 42524F574E20464F58 char: db 'BROWN FOX' ; Please key in exactly as shown,
8 ; with a space between BROWN and FOX
9
10 start:
11
12 0000000C 31D2 xor dx,dx
13 0000000E B8C90B mov ax,3017
14 00000011 BB0300 mov bx,03h
15 00000014 F7F3 div bx
16 00000016 0D7777 or ax,7777h
17
18 ; test
19 00000019 A821 test al,21h
20 0000001B B402 mov ah,02h
21 0000001D 8A16[0900] mov dl,[char+6]
22
23 jmp_:
24 00000021 7502 jnz output
25 00000023 B234 mov dl,34h
26
27 output:
28 00000025 CD21 int 21h
29
30 end:
31 00000027 CD20 int 20h
32
33 ; The end


Which ASCII character will be displayed if mov dl,[char+6] is displayed?

The character in memory position 109h = F

Hello

Well done !

Do you know how to prove it?


-- tesu

Yes, by running it manually.

For example what is the result in dx:ax after execution of 00000014 ?

13 0000000E B8C90B mov ax,3017
14 00000011 BB0300 mov bx,03h
15 00000014 F7F3 div bx

3017 divided by 3 makes 1005 remainder 2
1005 is in ax, remainder in dx
(1005D = 03EDH)

Now it's your turn to carry out these three steps:

16 00000016 0D7777 or ax,7777h
17
18 ; test
19 00000019 A821 test al,21h
20 0000001B B402 mov ah,02h

Hint: for the boolean instruction (test is and AND operation, al AND 21h) you have to write down the binary representation of the operands first. You can shorten the calculations for only 8 bits are significant ;)

-- tesu

This question has already been answered. Start a new discussion instead.