Thread: Loop

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    74
    Rep Power
    2

    Loop


    hello, can somebody help me? we were ask to print this:

    AE
    BD
    CC
    DB
    EA

    but i cant get it to work, instead i get this:
    A
    B
    C
    D
    E
    E
    D
    C
    B
    A

    Code:
    .model small
    .stack
    .code
    org 100h
    
    start:
    	mov ah, 02h
    	mov cx, 005h
    	mov bl, 41h
    A:	mov dl, bl
    	int 21h
    	mov dl, 0ah
    	int 21h
    	inc bl
    	loop A
    
    	mov ah, 02h
    	mov cx, 005h
    	mov bl, 45h
    B:	mov dl, bl
    	int 21h
    	mov dl, 0ah
    	int 21h
    	inc bl
    	loop B
    end start
    NOTE: strictly TASM syntax please and THANK YOU!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    929
    I'm not sure where you're stuck--from the code you've shown, you know how to print characters and make loops. And the code pretty clearly writes a letter followed by a newline, rather than writing two letters and a newline.

    Maybe if you commented (or at the very least used descriptive labels) what you're doing it would be easier to figure out? Or you could start by writing it in a higher-level language (like C, or whatever you happen to be familiar with) and then translate it to assembler.
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

IMN logo majestic logo threadwatch logo seochat tools logo