# A Geometric Progression program

Page 1 of 1

## 0 Replies - 1340 Views - Last Post: 30 July 2006 - 04:29 AM

### #1 xenofied

• New D.I.C Head

Reputation: 0
• Posts: 1
• Joined: 30-July 06

# A Geometric Progression program

Posted 30 July 2006 - 04:29 AM

Description: It's a simple geometric progression program: it name says it all.
```;Geometric progression
;Xenofied

title GP
jumps
.286
.model small
.stack 286h
.data
mbuf     db 6 dup(" ")

_print macro nbuf
local more, print
push ax bx cx dx di
mov dx, nbuf
mov cx, 0
lea di, mbuf
more:     push cx
mov ax, dx
mov dx, 0
mov cx, 10
div cx
xchg ax, dx
add al, 30h
mov [di], al
inc di
pop cx
inc cx
cmp dx, 0
jnz more
print:     dec di
mov al, [di]
push dx
mov dl, al
mov ah, 02h
int 21h
pop dx
loop print
pop di dx cx bx ax
endm

_delim macro cbuf
push ax
mov dl, cbuf
mov ah, 02h
int 21h
pop ax
endm

_endl macro
push ax dx
mov dl, 0ah
mov dh, 0dh
mov ah, 02h
int 21h
pop dx ax
endm

_pause macro
push ax
mov al, 00h
mov ah, 07h
int 21h
pop ax
endm
.code
start:
main proc far
mov ax, 8
mov bx, 9
mov cx, 1
loop1:     _print cx
_delim '|'
_print ax
_delim '|'
_print bx
_endl
add ax, bx
add bx, 8
add cx, 1
cmp cx, 100
jbe loop1
_endl
_pause
int 20h
main endp
endp
end start
```

Is This A Good Question/Topic? 0

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }