cr equ 10d
lf equ 13d
cseg segment byte
assume cs:cseg, ds:cseg
org 100h
main proc
ini:
mov si, 50
lus:
mov ax, si
call int2strn
mov ah, 40h
mov bx, 1
mov cx, Bot2_Len
mov dx, offset Bot2_Msg
int 21h
mov ax, si
call int2strn
mov ah, 40h
mov bx, 1
mov cx, Bottle_Len
mov dx, offset Bottle_Msg
int 21h
mov ax, si
call int2strn
mov ah, 40h
mov bx, 1
mov cx, Pass_Len
mov dx, offset Pass_Msg
int 21h
sub si, 1
jnz lus
mov ah, 40h
mov bx, 1
mov cx, None_Len
mov dx, offset None_Msg
int 21h
mov ax, 4c00h
int 21h
main endp
int2strn proc near
mov cx,10
xor dx,dx
div cx
or al, al
jz next
push dx
mov dl,al
add dl,30h
mov ah,2
int 21h
pop dx
next:
mov ah,2
add dl,30h
int 21h
ret
int2strn endp
Bottle_Msg db ' bottles of beer on the wall, '
Bottle_Len equ $ - Bottle_Msg
Pass_Msg db ' bottles of beer. Take one down, pass it around.', cr, lf
Pass_Len equ $ - Pass_Msg
Bot2_Msg db ' bottles of beer on the wall.', cr, lf
Bot2_Len equ $ - Bot2_Msg
None_Msg db 'No more bottles of beer on the wall.', cr, lf
None_Len equ $ - None_Msg
cseg ends
end ini