100 doors/8086 Assembly: Difference between revisions

Content added Content deleted
(moved from 100 doors)
 
(two less instructions)
Line 111: Line 111:
;two doors and reducing the time needed
;two doors and reducing the time needed
;to do the task.
;to do the task.
and cl,cl ; Set the flags according to cl.


initloop:
initloop:
jz dodoor ; If the counter is zero continue
;to the main loop.
mov [bx],ax ; Close two doors (write a 0000 word).
mov [bx],ax ; Close two doors (write a 0000 word).
inc bx ; Increment the pointer.
inc bx ; Increment the pointer.
inc bx
inc bx
dec cl ; Decrement the counter.
dec cl ; Decrement the counter.
jmp initloop ; Loop.
jnz initloop ; Loop or else fall through.


; ** Main
; ** Main