1 Replies - 657 Views - Last Post: 19 April 2019 - 06:24 AM

#1 Taetae   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 09-April 19

Nested loop

Posted 09 April 2019 - 09:20 AM

I've done the nested loop star triangle but i don't know how to make a triangle with number from 1-9! I have been trying but it's not working! I'm just a beginner! Please help!

.model small
.stack 100h
.code
main proc
      mov ah,2
      mov bl,5
      mov cl,0
      mov ch,1
top:
      inc cl
      mov dl,42
      int 21h

      cmp cl,ch
      jne top

      mov dl,10
      int 21h

      mov cl,0
      inc ch
      dec bl
      cmp bl,0
      jne top

      mov ah,4ch
      int 21h
main endp
end main
:code:/>

This post has been edited by modi123_1: 09 April 2019 - 09:23 AM
Reason for edit:: In the future, please use the [code] tag button in the editor.


Is This A Good Question/Topic? 0
  • +

Replies To: Nested loop

#2 turboscrew   User is offline

  • D.I.C Lover
  • member icon

Reputation: 171
  • View blog
  • Posts: 1,109
  • Joined: 03-April 12

Re: Nested loop

Posted 19 April 2019 - 06:24 AM

So what's the problem?
I quickly browsed the code and it looked fine - at least on Linux, where linefeed character is a newline.
It should print a 5-line high right-angled triangle.

Do you mean getting command line parameters?
If, then it depends on the system and compilation.
I don't know how to handle that on Windows, but on Linux/Unix it depends on whether you assemble using GCC or GAS.
GCC creates C-program parameters, GAS doesn't.

If compiled with GCC, the "prologue" makes the argument pointer array, and pushes a pointer to it in stack, and then pushes the argument count to the stack before calling the assembly main. If compiled with GAS, there is no such "prologue" and the basic Linux convention is used - pointer to null-terminated argument list in stack.

This post has been edited by turboscrew: 19 April 2019 - 06:34 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1