2 Replies - 846 Views - Last Post: 06 October 2017 - 01:55 AM

#1 aldreezy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-September 17

[TASM] How to limit the number of loops in my program?

Posted 02 October 2017 - 10:11 PM

Hello. I'm tasked to make 8 LEDS blink using TASM through the computer's parallel port. These codes did their job, they(LEDS) actually blinks however the program doesn't even end. I want to know why the code keeps on looping. Is it because of the cx values? I want to set a X number of times the LED will blink. Here is my code:

.model small
.code
org 100h
start:
	main proc
	mov cx,1; how many times to loop
	here:mov al,00000000b
	mov dx,378h
	out dx,al
	call delay
	
	mov al,11111111b
	mov dx,378h
	out dx,al
	call delay
	loop here

	int 20h
	main endp 
	delay proc
		push ax
		mov cx,4095
		delay2:
		push cx
		mov cx,65535
		delay3:
		nop
		nop
		nop
		nop
		nop
		loop delay3
		pop cx
		loop delay2
		pop ax
		ret
	delay endp
end start



THANKS!

Is This A Good Question/Topic? 0
  • +

Replies To: [TASM] How to limit the number of loops in my program?

#2 wonkey_monkey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-October 17

Re: [TASM] How to limit the number of loops in my program?

Posted 06 October 2017 - 01:49 AM

On line 21 you have:

push ax


I think you meant

push cx

Was This Post Helpful? 0
  • +
  • -

#3 wonkey_monkey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-October 17

Re: [TASM] How to limit the number of loops in my program?

Posted 06 October 2017 - 01:55 AM

Also line 35:

pop cx

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1