Jump to content

tasm symbol painting

- - - - -

  • Please log in to reply
4 replies to this topic

#1
core_st

core_st

    Newbie

  • Members
  • Pip
  • 3 posts
Hi. Need some help. tasm 4.0. i have text string (20 symbol's). And i need display this string charachter by charachter in form of geometry figure: Example: string 'asdfasdfasdfasdfasdf'. :

asdfas

f    d

d    f

s    a

a    s

fdsafd

i wrote a part of program. it display characher by charache. but before display next symbol, i need move cursor to another place:

%TITLE "Lab6"

IDEAL

MODEL small 

STACK 256

DATASEG

 exCode DB 0

Msg DB 'algpembuqwobnzcbtphmdlepgmcuqpbmditkglblsyqitmboaltibnqplmstgaqt',13,10,'$'

CODESEG

Start:

mov ax, @Data

mov ds,ax

mov cx,64

mov di,offset Msg

mov     ah,02h          

print:

mov     dl,[di]

int 21h

inc di

dec cx

;there must be some function's to move cursor

jnz print

Exit:

mov ah,04Ch

mov al,[exCode]

int 21h

END Start


#2
H2010

H2010

    Newbie

  • Members
  • PipPip
  • 21 posts
to move cursor you need to use the function 2 of the INTERRUPT 10H
this example print the letter "A" on the screen in line 12 and column 40

code segment
main proc
assume cs:code

mov   bh,0 ; number of page
mov   dh,12 ; number of row
mov   dl,40 ; number of column
mov   ah,02h
int   10h

mov   dl,'A'
mov   ah,02h
int   21h

mov   ah,4ch
int   21h

main endp
code ends
end main

Edited by dargueta, 09 December 2010 - 04:23 PM.
Fixed formatting


#3
core_st

core_st

    Newbie

  • Members
  • Pip
  • 3 posts
i try such code to display symbols in column...

%TITLE "Lab6"

IDEAL

MODEL small 

STACK 256

DATASEG

 exCode DB 0

Msg DB 'qogndmaprotmbjdlspmkaqwitpui',13,10,'$'

CODESEG

Start:

mov ax, @Data

mov ds,ax

mov cx,28

mov di,offset Msg     

mov bh,0 ; number of page

mov dh,12 ; number of row

mov dl,12 ; number of column

mov ah,02h

int 10h

print:

mov     dl,[di]

int 21h

inc di

dec cx

inc dl

mov ah,02h

int 10h

cmp cx,0

ja print

Exit:

mov ah,04Ch

mov al,[exCode]

int 21h

END Start

but my program give such result:

Posted Image

#4
H2010

H2010

    Newbie

  • Members
  • PipPip
  • 21 posts
try this code ;) but don't forget to looking for how to spiral matrix in GOOGLE

if you have other exercise let me take a look at it

STACK 256

DATASEG

 exCode DB 0

Msg DB 'qogndmaprotmbjdlspmkaqwitpui',13,10,'$'

CODESEG

Start:


mov ax, @Data

mov ds,ax


mov di,offset Msg     

mov ch,12

mov cl,12


mov bh,0 ; number of page

mov dh,ch ; number of row

mov dl,cl ; number of column

mov ah,02h

int 10h

p1:

mov dl,[di]

int 21h

inc di

inc cl 

cmp cl,19;if column=19 

jne p1



p2:

mov bh,0 ; number of page

mov dh,ch ; number of row

mov dl,cl ; number of column

mov ah,02h

int 10h


inc ch

mov dl,[di]

int 21h

inc di

cmp ch,19; 

jne p2         



p3:  

mov bh,0 ; number of page

mov dh,ch ; number of row

mov dl,cl ; number of column

mov ah,02h

int 10h


dec cl

mov dl,[di]

int 21h

inc di

cmp cl,12;

jne p3


p4:  

mov bh,0 ; number of page

mov dh,ch ; number of row

mov dl,cl ; number of column

mov ah,02h

int 10h 


dec ch

mov dl,[di]

int 21h

inc di

cmp ch,12;

jne p4



mov ah,02h

int 10h


Exit:

mov ah,04Ch

mov al,[exCode]

int 21h

END Start

if you want to Minimize the Code put this code in a procedure and call it

mov bh,0 ; number of page

mov dh,ch ; number of row

mov dl,cl ; number of column

mov ah,02h

int 10h  

Edited by H2010, 03 December 2010 - 09:21 AM.


#5
core_st

core_st

    Newbie

  • Members
  • Pip
  • 3 posts
Oh man. Thanks very match. You really save me!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users