home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
RBBS in a Box Volume 1 #2
/
RBBS_vol1_no2.iso
/
add2
/
suggest.zip
/
SUGGEST.ASM
next >
Wrap
Assembly Source File
|
1986-11-09
|
3KB
|
209 lines
; SUGGEST.ASM. From PC Magazine Vol 5 No 20, November 25, 1986
; by Michael J. Mefford
code segment
assume cs:code,ds:code
org 100h
start: jmp initialize
copy_right db 'Copyright 1986 Ziff-Davis Publishing Co.'
screen_seg dw 0b000h
old_timer dd ?
status_reg dw ?
counter dw 0
time_out dw 1
frequency dw 7387h
freq_constant equ 3276
dura_constant equ 4205
suggest: sti
pushf
push ax
push cx
push dx
push ds
push es
push si
push di
push cs
pop ds
inc word ptr counter
mov dx,counter
cmp dx,frequency
jnz exit
mov word ptr counter,0
mov ax,40h
mov es,ax
mov al,es:[49h]
cmp al,1
jbe exit
cmp al,3
jbe display
cmp al,7
jnz exit
display: mov dx,status_reg
mov ax,screen_seg
push ds
pop es
mov ds,ax
mov si,160*11
mov di,offset screen
cld
call read
push ds
push es
pop ds
pop es
mov si,offset msg
call write
mov cx,time_out
delay: dec cx
jnz delay
mov si,offset screen
call write
exit: pop di
pop si
pop es
pop ds
pop dx
pop cx
pop ax
popf
jmp cs:old_timer
read: mov cx,3*80
horz_ret1: in al,dx
test al,1
jnz horz_ret1
cli
wait1: in al,dx
test al,1
jz wait1
lodsb
sti
stosb
inc si
loop horz_ret1
ret
write: mov di,160*11
mov cx,3*80
put_byte: lodsb
mov ah,al
horz_ret2: in al,dx
test al,1
jnz horz_ret2
cli
wait2: in al,dx
test al,1
jz wait2
mov al,ah
stosb
sti
inc di
loop put_byte
ret
initialize: mov al,32
mov di,offset msg
mov cx,80*3
rep stosb
parse: xor cx,cx
mov si,82h
cmp byte ptr[si-2],1
ja get_msg
int 20h
get_msg: lodsb
inc cx
cmp al,13
jz message
cmp al,'/'
jnz get_msg
get_switch: lodsb
cmp al,13
jz message
and al,5fh
cmp al,'F'
jnz duration
call convert
mov bx,freq_constant
mul bx
sub frequency,ax
jmp short get_switch
duration: cmp al,'D'
jnz get_switch
call convert
mov bx,dura_constant
mul bx
add time_out,ax
jmp short get_switch
message: mov si,82h
mov di,offset msg+80
dec cx
cmp cx,80
jb center
mov cx,80
jmp short store
center: mov bx,80
sub bx,cx
shr bx,1
add di,bx
store: rep movsb
card: mov ax,40h
mov es,ax
mov ax,es:[63h]
add ax,6
mov status_reg,ax
cmp ax,3bah
jz interrupt
add word ptr screen_seg,800h
interrupt: mov ax,351ch
int 21h
mov word ptr old_timer,bx
mov word ptr old_timer[2],es
mov dx,offset suggest
mov ax,251ch
int 21h
mov dx,offset screen+80*3+1
int 27h
convert: xor ah,ah
lodsb
cmp al,'1'
jb ignore
cmp al,'9'
ja ignore
sub al,30h
ret
ignore: mov al,0
ret
msg:
org offset msg+80*3
screen:
code ends
end start