Reputation: 378
I want to make 3 for loops using assembly language all I can do is 2 for loops one in the internal and one external. here is what i tried
name "loops"
org 100h
mov bx, 0 ; total step counter
mov cx, 5
k1: add bx, 1
mov al, '1'
mov ah, 0eh
int 10h
push cx
mov cx, 5
k2: add bx, 1
mov al, '2'
mov ah, 0eh
int 10h
push cx
mov cx, 5
k3: add bx, 1
mov al, '3'
mov ah, 0eh
int 10h
loop k3 ; internal in internal loop.
pop cx
loop k2 ; internal loop.
pop cx
loop k1 ; external loop.
; wait any key...
mov ah, 1
int 21h
ret
I created this simple code out of an example.
Upvotes: 0
Views: 331
Reputation: 18503
I just ran your program under MS-DOS 6.22 in a VMWare virtual machine and it ran absolutely perfectly!
So it is probable that your BIOS, DOS or DOS Emulator has a problem with "int 10h". "int 10h" is nothing that a special variant of "call" so it depends on the BIOS or operating system what "int 10h" really does.
Maybe the version you are using is modifying the CX register.
MS-DOS 6.22 and the BIOS used by VMWare however will execute your program without problems!
Upvotes: 1