File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ org 0x0100
2+ start:
3+ mov ax , 0x64 ; Load register AX with 0x64 (100 decimal)
4+ mov cl , 0x21 ; Load register CL with 0x1E (33 decimal)
5+ div cl ; Divide AX by CL, result->AL, remainder->AH
6+
7+ add al , 0x30 ; Convert to ASCII digit
8+ call display_letter
9+
10+ int 0x20
11+
12+ ; Display letter contained in AL (ASCII code)
13+ display_letter:
14+ push ax
15+ push bx
16+ push cx
17+ push dx
18+ push si
19+ push di
20+
21+ mov ah , 0x0E ; Load AH with code for terminal output
22+ mov bx , 0x000F ; Load BH page zero and BL color (graphic mode)
23+ int 0x10 ; Call the BIOS for displaying one letter
24+
25+ pop di
26+ pop si
27+ pop dx
28+ pop cx
29+ pop bx
30+ pop ax
31+ ret ; Return to the caller
Original file line number Diff line number Diff line change 1+ org 0x0100
2+ start:
3+ mov al , 0x32 ; Load register AL with 0x32 (50 decimal)
4+ and al , 0x0F ; Logical AND AL with 0x0F
5+ ; and, or, xor
6+ ; not is a single register
7+ ; neg AL is AL = -AL
8+
9+ add al , 0x30 ; Convert to ASCII digit
10+ call display_letter
11+
12+ int 0x20
13+
14+ ; Display letter contained in AL (ASCII code)
15+ display_letter:
16+ push ax
17+ push bx
18+ push cx
19+ push dx
20+ push si
21+ push di
22+
23+ mov ah , 0x0E ; Load AH with code for terminal output
24+ mov bx , 0x000F ; Load BH page zero and BL color (graphic mode)
25+ int 0x10 ; Call the BIOS for displaying one letter
26+
27+ pop di
28+ pop si
29+ pop dx
30+ pop cx
31+ pop bx
32+ pop ax
33+ ret ; Return to the caller
Original file line number Diff line number Diff line change 1+ org 0x0100
2+ start:
3+ mov al , 0x03 ; Load register AL with 0x03
4+ mov cl , 0x02 ; Load register CL with 0x02
5+ mul cl ; Multiply AL by CL, result into AX
6+
7+ add al , 0x30 ; Convert to ASCII digit
8+ call display_letter
9+
10+ int 0x20
11+
12+ ; Display letter contained in AL (ASCII code)
13+ display_letter:
14+ push ax
15+ push bx
16+ push cx
17+ push dx
18+ push si
19+ push di
20+
21+ mov ah , 0x0E ; Load AH with code for terminal output
22+ mov bx , 0x000F ; Load BH page zero and BL color (graphic mode)
23+ int 0x10 ; Call the BIOS for displaying one letter
24+
25+ pop di
26+ pop si
27+ pop dx
28+ pop cx
29+ pop bx
30+ pop ax
31+ ret ; Return to the caller
Original file line number Diff line number Diff line change 1- all : FIRST.COM SECOND.COM ADD1.COM SUB1.COM
1+ all : FIRST.COM SECOND.COM ADD1.COM SUB1.COM MUL1.COM DIV1.COM SHIFT1.COM LOGICAL1.COM
22
33clean :
4- DEL * .COM
5- DEL * .LST
4+ del * .COM
5+ del * .LST
66
77FIRST.COM : FIRST.ASM
8- NASM -f bin FIRST.ASM -o FIRST.COM -l FIRST.LST
8+ nasm -f bin FIRST.ASM -o FIRST.COM -l FIRST.LST
99
1010SECOND.COM : SECOND.ASM
11- NASM -f bin SECOND.ASM -o SECOND.COM -l SECOND.LST
11+ nasm -f bin SECOND.ASM -o SECOND.COM -l SECOND.LST
1212
1313ADD1.COM : ADD1.ASM
14- NASM -f bin ADD1.ASM -o ADD1.COM -l ADD1.LST
14+ nasm -f bin ADD1.ASM -o ADD1.COM -l ADD1.LST
1515
1616SUB1.COM : SUB1.ASM
17- NASM -f bin SUB1.ASM -o SUB1.COM -l SUB1.LST
17+ nasm -f bin SUB1.ASM -o SUB1.COM -l SUB1.LST
18+
19+ MUL1.COM : MUL1.ASM
20+ nasm -f bin MUL1.ASM -o MUL1.COM -l MUL1.LST
21+
22+ DIV1.COM : DIV1.ASM
23+ nasm -f bin DIV1.ASM -o DIV1.COM -l DIV1.LST
24+
25+ SHIFT1.COM : SHIFT1.ASM
26+ nasm -f bin SHIFT1.ASM -o SHIFT1.COM -l SHIFT1.LST
27+
28+ LOGICAL1.COM : LOGICAL1.ASM
29+ nasm -f bin LOGICAL1.ASM -o LOGICAL1.COM -l LOGICAL1.LST
Original file line number Diff line number Diff line change 1+ org 0x0100
2+ start:
3+ mov al , 0x02 ; Load register AL with 0x02 (2 decimal)
4+ shl al , 1 ; Shift AL left by one bit
5+
6+ add al , 0x30 ; Convert to ASCII digit
7+ call display_letter
8+
9+ int 0x20
10+
11+ ; Display letter contained in AL (ASCII code)
12+ display_letter:
13+ push ax
14+ push bx
15+ push cx
16+ push dx
17+ push si
18+ push di
19+
20+ mov ah , 0x0E ; Load AH with code for terminal output
21+ mov bx , 0x000F ; Load BH page zero and BL color (graphic mode)
22+ int 0x10 ; Call the BIOS for displaying one letter
23+
24+ pop di
25+ pop si
26+ pop dx
27+ pop cx
28+ pop bx
29+ pop ax
30+ ret ; Return to the caller
You can’t perform that action at this time.
0 commit comments