printing - How to print smile emoticon from right to left reverse using assembly -


how print smile emoticon right left in assembler

#make_com#        ; .com org    100h   start:      mov  ah, 0     ; screen 80x25    mov  al, 2     ; character 'smiley face'         int  10h   ; set screen (and clear screen)      mov  dx, 0     ; start position 0,0 (dh dan dl)      mov  cx, 1     ; print 1 character   set_kursor:      mov  ah, 2      int  10h        ; set cursor position      mov  ah, 10      int  10h    ; print character      inc  dh     ; right      inc  dl     ; enter 1 row    cmp  dh, 25         jne  set_kursor ; try    ret             ; finish  end 

the code this

☺  ☺   ☺    ☺     ☺      ☺       ☺ 

what want reverse this

              ☺              ☺             ☺            ☺           ☺          ☺         ☺ 

inc  dh     ; right   inc  dl     ; enter 1 row 

these comments wrong! dl register has column , dh register has row.

to solve question, first put cursor @ position far enough right. chose column 30 , row 0. on each iteration decrement column value in dl register. before increment row value in dh register , exit after processing 25 rows:

#make_com#        ; .com org    100h   start:      mov  ah, 0     ; screen 80x25    mov  al, 3        int  10h       ; set screen (and clear screen)      mov  dx, 30    ; start position 30,0      mov  cx, 1     ; print 1 character    mov  bh, 0     ; display page 0 set_kursor:      mov  ah, 2      int  10h       ; set cursor position      mov  al, 2     ; character 'smiley face'         mov  ah, 10    int  10h       ; print character      dec  dl        ; 1 column left     inc  dh        ; 1 row down    cmp  dh, 25         jne  set_kursor    ret             ; finish  end 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -