;******************************************************************************* ; COPY92 COPYRIGHT Afanasyev Valeri 08.07.1992 ; копировщик файлов на магнитофон для PC Ассистент и Поиск ; вариант для альтернативы с дисководом ;******************************************************************************* cseg segment org 100h assume cs:cseg,ds:cseg,es:cseg,ss:cseg start: jmp begin data0 dd 000000 dat db 11111001b,10011001b,11110000b,0 ;0 db 00100010b,00100010b,00100000b,0 ;1 db 11110001b,11111000b,11110000b,0 ;2 db 11110001b,11110001b,11110000b,0 ;3 db 10011001b,11110001b,00010000b,0 ;4 db 11111000b,11110001b,11110000b,0 ;5 db 11111000b,11111001b,11110000b,0 ;6 db 11110001b,00010001b,00010000b,0 ;7 db 11111001b,11111001b,11110000b,0 ;8 db 11111001b,11110001b,11110000b,0 ;9 data1 db "COPYRIGHT Afanasyev V. 08.07.1992$" data2 db " Load Save Delete$" data4 dw 0000 ;текущий файл (0-99) data5 dw 0002 ;текущий режим плотности записи на магнитофон timer dw ?,? ;сохраняем вектор 1Ch diskr db 0 lw dw 0000 shag dw 0000 lwes dw 0b800h datab db "basic.B$" datap db "basic.P$" datac db "code .M$" overfl db " Out of memory$" dater db "Device I/O error$" xstec db " " begin: cld mov ax,cs mov ds,ax mov ss,ax mov cx,4 lea bx,cs:x99 add bx,608 shr bx,cl add ax,bx mov es,ax lea sp,cs:begin mov bx,es push es sub ax,ax mov es,ax mov bp,ax mov ax,word ptr es:[0413h] mov cl,6 shl ax,cl sub ax,bx mov bx,10h mul bx mov word ptr cs:data0,ax mov word ptr cs:data0[2],dx mov word ptr es:[006ch],offset cs:cntbr mov word ptr es:[006eh],cs mov ax,word ptr es:[0070h] mov word ptr cs:timer,ax mov ax,word ptr es:[0072h] mov word ptr cs:timer[2],ax mov word ptr es:[0070h],offset cs:cntbr mov word ptr es:[0072h],cs mov al,01000000b mov ah,byte ptr es:[0417h] or ah,al mov byte ptr es:[0417h],ah pop es mov ax,1 int 10h mov ah,1 or ch,00100000b int 10h mov dx,0800h call curs lea dx,cs:x99 call fraza sub ah,ah int 16h mov ax,0 int 10h mov ah,1 or ch,00100000b int 10h mov dx,0803h call curs lea dx,cs:x89 call fraza sub ah,ah int 16h cmp al,"2" jnz c3 mov byte ptr cs:diskr,2 jmp short c4 c3: mov byte ptr cs:diskr,1 c4: mov ax,01h int 10h mov ax,0500h int 10h mov ah,1 or ch,00100000b int 10h call sound mov dx,0003h call curs lea dx,cs:data1 call fraza call figur scr2: call showln push es mov di,2aah mov cx,10h mov es,word ptr cs:lwes mov ax,78b1h rep stosw pop es con1: push es sub ax,ax mov es,ax cli mov al,es:[41ah] mov es:[41ch],al sti pop es sub ah,ah int 16h cmp al,"S" jnz x1 mov ax,5 call scrln call sidi cmp byte ptr cs:lw,27 jz scr22 jmp short write x1: cmp al,"L" jnz x2 sub ax,ax call scrln jmp reads x2: cmp al,"D" jnz x10 de: mov ax,10 call scrln call sidi cmp byte ptr cs:lw,27 jz scr22 jmp del scr22: jmp scr2 x10: cmp al,"Q" jnz con1 b7: sub ax,ax mov es,ax mov al,10111111b mov ah,byte ptr es:[0417h] and ah,al mov byte ptr es:[0417h],ah mov ax,word ptr cs:timer mov word ptr es:[0070h],ax mov ax,word ptr cs:timer[2] mov word ptr es:[0072h],ax mov ah,4ch int 21h write: call clsscr dec si ciklb: mov ax,bp cikld: push ax mov dx,ax call curs inc si cmp si,di jbe mitx call sound pop ax jmp scr2 mitx: ;тело цикла записи push es mov bx,si call bxsm mov es,word ptr cs:[bx] mov dx,word ptr cs:[bx+4] mov byte ptr cs:xx5[1],dh mov ax,word ptr cs:[bx+2] shl ax,1 sub dx,dx mov cx,3 div cx mov word ptr cs:xx4[1],ax mov word ptr cs:y47d5[1],ax shr ax,1 mov word ptr cs:xx6[1],ax call dlina push ax mov cx,100h cmp ax,20h jnz cikl mov cx,0c00h cikl: mov ax,0ffh cikl1: dec ax jnz cikl1 loop cikl mov ax,si inc ax call long0 pop cx sub bx,bx mov ah,3 call smolen or cx,cx jz a11 pop es pop ax jmp scr2 a11: pop es ; конец записи pop ax inc ah cmp ah,24 jz b12 jmp cikld b12: inc si cmp si,di jbe oldv call sound jmp scr2 oldv: call scrool push ax mov dx,ax mov ax,si dec si call linam pop ax jmp cikld ewri: jmp scr2 del: mov bx,si call bxsm mov es,word ptr cs:[bx] mov cx,di sub cx,si inc cx mov dx,si cikl9: mov bx,dx call bxsm call dlina call figadd inc dx loop cikl9 push si cikla: push si push di mov bx,si call bxsm mov bp,bx inc di mov bx,di call bxsm mov ax,word ptr cs:[bx+4] mov word ptr cs:[bp+4],ax mov ax,word ptr cs:[bx+2] mov word ptr cs:[bp+2],ax call dlina mov cx,ax mov word ptr cs:[bp],es ken: sub si,si sub di,di push ds mov ds,word ptr cs:[bx] rep movsb pop ds mov cl,4 cmp ax,0fff0h jna c15 mov ax,1000h jmp short c16 c15: shr ax,cl c16: mov dx,es add dx,ax mov es,dx pop di pop si inc si inc di cmp di,word ptr cs:data4 jc cikla dec si sub di,si sub word ptr cs:data4,di mov di,word ptr cs:data4 dec di cmp word ptr cs:data4,0 jnz raa sub di,di raa: mov es,word ptr cs:[bp] pop si or si,si jz rab dec si rab: call clsscr jmp scr2 reads: cmp word ptr cs:data4,0 jz reada mov di,word ptr cs:data4 dec di mov si,di call clsscr reada: sub bp,bp read: cmp word ptr cs:data4,99 jnz a0 jmp scr2 a0: mov bx,0 mov cx,0ffffh a8: mov ah,2 or bp,bp jz metka13 cmp word ptr cs:data0[2],0 jnz a5 cmp word ptr cs:data0,bp jae a5 call ovflow jmp con1 a5: mov cx,bp metka13:call smolen cmp ah,4 jnz a18 jmp scr2 a18: cmp ah,5 jz a8 mov cl,4 or bp,bp jz body1 cmp bp,dx jz body1 jmp error body1: mov bx,word ptr cs:data4 call bxsm mov word ptr cs:[bx],es mov ax,word ptr cs:xx3[2] cmp byte ptr cs:diskr,2 jz b10 cmp ax,08a0h jna c1 mov ax,0de0h jmp short b10 c1: cmp ax,05c0h jna c2 mov ax,06f0h jmp short b10 c2: mov ax,0534h b10: mov word ptr cs:[bx+2],ax cmp byte ptr es:[0],0a5h jnz tro lea si,cs:data1+11 mov di,18 push ds push cs pop ds cmp byte ptr es:[di],"A" jz met52 mov word ptr es:[di+0ch],0 met52: inc word ptr es:[di+0ch] mov cx,12 rep movsb pop ds mov cl,4 mov dx,20h jmp short a30 tro: or bp,bp jnz a3 cmp dx,103h jae k1 jmp reada k1: cmp dx,0ffffh jz a30 sub dl,3 jnz error a30: cmp word ptr cs:data0[2],0 jnz a3 cmp word ptr cs:data0,dx jae a3 call ovflow jmp con1 a3: sub bp,bp mov al,dl shr dx,cl or al,11110000b sub al,11110000b jz a19 inc dx a19: mov ax,es add ax,dx mov es,ax mov word ptr cs:[bx+6],ax call dlina call figsub mov ax,word ptr cs:data5 mov word ptr cs:[bx+4],ax mov ax,word ptr cs:data4 call posnam mov dx,ax mov ax,word ptr cs:data4 call linam inc word ptr cs:data4 jmp read error: mov dx,0803h call curs lea dx,cs:dater bip: call fraza call sound jmp con1 long: push bx push dx mov bx,10000 call show mov bx,1000 call show jmp short lg3 long3: push bx push dx lg3: mov bx,100 call show jmp short lg long0: push bx push dx push ax mov bx,30h mov cx,2 mov ax,0920h int 10h pop ax jmp short lg long1: push bx push dx lg: mov bx,10 call show add al,"0" call sim pop dx pop bx ret show: push di mov dx,0 div bx mov di,dx add al,"0" call sim mov ax,di pop di ret sim: push ax push bx push dx mov ah,0eh mov bh,0 int 10h jmp short pd curs: push ax push bx push dx mov bh,0 mov ah,2 int 10h pd: pop dx pop bx pop ax ret figur: push ax push bx push cx push dx push es push bp mov ax,word ptr cs:data0 mov dx,word ptr cs:data0[2] mov bx,10000 div bx push dx sub dx,dx mov bx,10 div bx mov bx,0 call fig mov bx,10000 mul bx pop bx add ax,bx jnc a4 inc dx a4: mov bx,10000 div bx mov bx,1 call fig mov bx,1000 mov dx,0 div bx mov bx,2 call fig mov bx,100 mov dx,0 div bx mov bx,3 call fig mov bx,10 mov dx,0 div bx mov bx,4 call fig mov bx,5 call fig pop bp pop es jmp rrr fig: push dx mov es,word ptr cs:lwes mov cl,3 mov bh,bl shl bl,cl shl bh,1 add bl,bh sub bh,bh mov cl,2 shl al,cl mov bp,ax met0: mov al,byte ptr dat[bp] mov dx,ax or al,al jz met3 push bp mov bp,2 met2: mov cx,4 cikl0: mov dx,0020h ;пробел rol al,1 jnc met1 mov dx,6820h ;цвет символа met1: mov word ptr es:[170+bx],dx inc bx inc bx loop cikl0 add bx,72 dec bp jnz met2 pop bp inc bp jmp short met0 met3: pop dx mov ax,dx ret figsub: cmp ax,0fff0h ja c11 sub word ptr cs:data0,ax jnc nosub c11: cmp word ptr cs:data0[2],0 jz rsub sub word ptr cs:data0[2],1 nosub: call figur ret rsub: call ovflow figadd: cmp ax,0fff0h ja c10 add word ptr cs:data0,ax jnc short noadd c10: add word ptr cs:data0[2],1 noadd: call figur ret ovflow: mov dx,0803h call curs lea dx,cs:overfl jmp bip fraza: push bp push ax push bx mov bp,dx kod3: mov ax,cs:[bp] mov bh,0 mov ah,0eh cmp al,"$" jz fraend int 10h inc bp jmp short kod3 fraend: pop bx pop ax pop bp ret cntbr: iret posnam: push dx cmp al,13 jbe orp ;не сдвигать экран, если есть место call scrool jmp short oprend orp: add al,10 mov dh,al mov dl,4 call curs xchg ah,al mov al,4 oprend: pop dx ret scrool: push cx push dx push si push di push es push ds mov ax,0b800h mov es,ax mov ds,ax mov di,800 mov si,880 mov cx,560 rep movsw mov ax,1704h mov dx,ax call curs pop ds pop es pop di pop si pop dx pop cx ret linam: push ax push bx push cx push dx push es mov cl,4 mov bx,ax call bxsm inc ax call long1 mov dl,1fh call curs call dlina call long mov dl,25h call curs push dx mov cx,word ptr ds:[bx+2] mov dx,05h mov ax,6b80h div cx call long3 pop dx mov es,word ptr cs:[bx] cmp byte ptr es:[0],0a5h jz line jmp short quitlin line: push bp mov dl,7 call curs mov bp,1 names: mov ah,0eh mov al,es:[bp] mov bh,0 int 10h inc bp cmp bp,9 jnz names mov dl,10h call curs mov ax,es:[9] cmp al,80h push dx jnz bas_p mov dx,offset cs:datab call fraza jmp short binar bas_p: cmp al,0a0h jnz kod mov dx,offset cs:datap call fraza jmp short binar kod: cmp al,1 jnz binar mov dx,offset cs:datac call fraza binar: pop dx pop bp mov dl,19h call curs mov ax,word ptr es:[0ah] mov bp,ax call long quitlin:pop es jmp rrr bxsm: push ax mov ax,bx shl ax,1 shl bx,1 shl bx,1 add bx,ax add bx,offset cs:x99 pop ax ret showsc: push es mov es,word ptr cs:lwes cikl5: movsb mov byte ptr es:[di],30h inc di loop cikl5 pop es ret scrln: push bx push cx push dx push si push di push ax mov dx,0803h call curs mov bx,30H ;цвет фона сообщения mov cx,16 mov ax,0920h int 10h pop ax mov di,646 cmp ax,5 ja sc1 add ax,offset cs:data2 mov si,ax mov cx,5 call showsc jmp scrend sc1: add ax,offset cs:data2 mov si,ax mov cx,7 call showsc scrend: pop di pop si pop dx pop cx pop bx ret dlina: push cx mov cl,4 mov ax,word ptr cs:[bx+6] sub ax,word ptr cs:[bx] shl ax,cl jnc c9 dec ax c9: pop cx ret sidi: cmp word ptr cs:data4,0 jz m1 cmp byte ptr cs:data1[12],"f"; проверка на имя jnz m1 push ax push bx push dx sider: mov dx,080Bh call curs mov si,0ffh mov di,si mov bh,0ffh consol: mov bl,0ah sub ah,ah int 16h cmp al,27 jnz x100 pop dx pop bx pop ax m1: mov byte ptr cs:lw,27;для jmp scr2 ret x100: cmp al,"-" jnz x101 cmp si,0ffh jnz x103 cmp bh,0ffh jnz x107 mov si,1 call sim jmp short consol x107: call x200 mov si,bx mov bh,0ffh jmp short consol x103: cmp bh,0ffh jz consol call x200 mov di,bx jmp xret x101: cmp al,"A" jnz x104 cmp si,0ffh jnz consol cmp bh,0ffh jnz consol mov si,0 mov di,word ptr cs:data4 dec di call sim mov al,"l" call sim call sim mov byte ptr cs:lw,65 jmp fyw x106: cmp bh,0ffh jz x105 call x200 mov di,bx jmp short xret x104: cmp al,13 jnz x102 cmp si,0ffh jnz x106 cmp bh,0ffh jz cons call x200 mov si,bx mov di,si jmp short xret x105: mov di,word ptr cs:data4 jmp short xret x102: cmp al,"0" jb xxx9 cmp al,"9" ja xxx9 call sim sub al,"0" cmp si,0ffh jz xxx1 cmp bh,0ffh jnz xxx3 mov bh,al xxx9: jmp consol xxx1: cmp bh,0ffh jnz xxx2 mov bh,al jmp consol xxx2: xchg al,bh imul bl add al,bh mov si,ax mov bh,0ffh mov al,"-" call sim jmp consol xxx3: xchg al,bh imul bl add al,bh mov di,ax xret: mov byte ptr cs:lw,0 sub di,1 jc cons sub si,1 jc cons cmp di,word ptr cs:data4 jae cons cmp si,word ptr cs:data4 jae cons cmp di,si jae fyw cons: mov dx,080Ah call curs cikl8: mov al," " call sim dec dh jnz cikl8 jmp sider fyw: jmp pd x200: xchg bh,bl sub bh,bh call sim ret clsscr: push ax push bx push cx push dx push es sub bp,bp mov es,word ptr cs:lwes mov bx,800 cikl6: mov word ptr es:[bx],0720h inc bx inc bx cmp bx,2000 jb cikl6 pop es mov dx,0a04h mov cx,14 cmp di,13 ja big0 sub ax,ax cmp word ptr cs:data4,14 ja big1 mov cx,word ptr cs:data4 or cx,cx jz kenu1 jmp short big1 big0: push di sub di,si cmp di,cx jae big2 pop di mov ax,di sub ax,13 jmp short big1 big2: pop di mov ax,si big1: cmp ax,si jz big6 big5: call curs call linam inc ax inc dh loop big1 jmp short kenu big6: mov bp,dx push bp jmp short big5 kenu: pop bp kenu1: jmp rrr showln: push ax push bx push cx push dx push di push si mov ah,3 mov bh,0 int 10h push dx mov dx,0802h call curs mov bx,7 mov cx,35 mov ax,0920h int 10h lea dx,cs:data2 call fraza pop dx call curs pop si pop di rrr: pop dx pop cx pop bx pop ax ret sound: push ax push bx push cx push dx in al,61h and al,0feh mov dx,200 repeat: or al,2 out 61h,al mov cx,100 waiton: loop waiton and al,not 2 out 61h,al mov cx,300 waitoff:loop waitoff dec dx jnz repeat jmp short rrr smolen: push ds push di push es push ax push cx mov ax,40h mov ds,ax and byte ptr ds:[0071h],7fh mov ax,cx mov cl,4 shr ax,cl mov word ptr cs:lw,ax mov word ptr cs:shag,ax mov di,02aah mov cx,10h mov es,word ptr cs:lwes mov ax,78b1h rep stosw mov di,02aah in al,21h or al,01h out 21h,al pop cx pop ax pop es call y4615 test byte ptr ds:[0071h],80h jz a6 mov ah,4 a6: pop di pop ds push ax push dx mov dx,3d9h mov al,0 out dx,al in al,21h and al,0feh out 21h,al pop dx pop ax ret y4615: dec ah dec ah jz y463b dec ah jnz y4628 jmp y474f y4628: mov ah,80h stc ret y462c: in al,61h and al,0f7h y4630: out 61h,al sub ah,ah ret y4635: in al,61h or al,08h jmp y4630 y463b: push bx push cx push si mov si,07h call y4806 y4644: in al,62h and al,10h mov ds:[006bh],al mov dx,03f7ah y464e: test byte ptr ds:[0071h],80h jz y4658 x23: jmp y46e2 y4658: dec dx jnz y465e jmp y46e2 y465e: call y4727 jcxz y464e xx1: mov dx,0378h ;----------------------------------- y0146: mov cx,0200h y466f: test byte ptr ds:[0071h],80h jnz x23 ;y46e2 push cx call y4727 or cx,cx pop cx jz y4644 cmp cx,1c0h;---------- cmc pushf jc y0076 popf cmp dx,bx pushf jnc y0078 y0076: shr bx,1 y0078: mov ax,bx shr ax,1 shr ax,1;4 add bx,ax shr ax,1;8 add bx,ax shr ax,1 shr ax,1;32 add bx,ax add dx,bx shr dx,1 popf jcxz y0095 jnc y0146 loop y466f y0095: jc y466f shl dx,1 mov word ptr cs:xx3[2],dx call y4727 call y46f9 mov byte ptr cs:data5[1],al ;----------------------- push dx mov dx,3d9h mov al,12 out dx,al pop dx pop si pop cx pop bx push cx y4697: mov word ptr ds:[0069h],0ffffh mov dx,0100h y46a0: test byte ptr ds:[0071h],80h jnz y46ca call y46f9 jb y46ca jcxz y46b3 mov es:[bx],al inc bx cmp bx,word ptr cs:lw jc c5 cmp di,2cah jz c5 mov ax,word ptr cs:shag add word ptr cs:lw,ax push es mov ax,0b800h mov es,ax mov ax,5820h stosw c6: pop es c5: dec cx y46b3: dec dx jg y46a0 y0b1e: call y46f9 call y46f9 sub ah,ah cmp word ptr ds:[0069h],1d0fh jnz y46cc jcxz y46ce jmp y4697 y46ca: mov ah,01 y46cc: inc ah y46ce: pop dx sub dx,cx push ax test ah,03 jnz y46ea call y46f9 jmp short y46ea y46dc: dec si jz y46e2 jmp y4644 y46e2: pop si pop cx pop bx sub dx,dx mov ah,05 push ax y46ea: call y4635 pop ax cmp ah,01h cmc ret y46f9: push bx push cx mov cl,08h y46fd: push cx call y4727 jcxz y4723 push bx call y4727 pop ax jcxz y4723 add bx,ax xx3: cmp bx,06f0h ;-------------------------------- cmc lahf pop cx rcl ch,1 sahf call y47f2 dec cl jnz y46fd mov al,ch clc y4720: pop cx pop bx ret y4723: pop cx stc jmp y4720 y4727: mov cx,008ch ;----------------------- mov ah,ds:[006bh] y472e: in al,62h and al,10h cmp al,ah loopz y472e mov ds:[006bh],al mov al,00 out 43h,al in al,40h mov ah,al in al,40h xchg al,ah mov bx,ds:[0067h] sub bx,ax mov ds:[0067h],ax ret y474f: push bx push cx in al,61h and al,0fdh or al,01 out 61h,al mov al,0b6h out 43h,al call y4806 xx4: mov ax,04a0h ;------------------------------------ call y47eb mov cx,0800h y4769: stc call y47d5 loop y4769 clc call y47d5 pop cx pop bx xx5: mov al,16h ;------------------------------ call y47be y477a: mov word ptr ds:[0069h],0ffffh mov dx,0100h y4783: mov al,es:[bx] test byte ptr ds:[0071h],80h jnz a10 call y47be jcxz y478d inc bx cmp bx,word ptr cs:lw jc c7 cmp di,2cah jz c7 mov ax,word ptr cs:shag add word ptr cs:lw,ax push es mov ax,0b800h mov es,ax mov ax,5820h stosw pop es c7: dec cx y478d: dec dx jg y4783 mov ax,ds:[0069h] not ax push ax xchg ah,al call y47be pop ax call y47be or cx,cx jnz y477a push cx mov cx,0020h y47a7: stc call y47d5 loop y47a7 pop cx a10: mov al,0b0h out 43h,al mov ax,0001 call y47eb call y4635 sub ax,ax ret y47be: push cx push ax mov ch,al mov cl,08 y47c4: rcl ch,1 pushf call y47d5 popf call y47f2 dec cl jnz y47c4 pop ax pop cx ret y47d5: mov ax,04a0h ;------------------------------------ jb y47dd xx6: mov ax,0250h ;----------------------------------- y47dd: push ax y47de: in al,62h and al,20h jz y47de y47e4: in al,62h and al,20h jnz y47e4 pop ax y47eb: out 42h,al mov al,ah out 42h,al ret y47f2: mov ax,ds:[0069h] rcr ax,1 rcl ax,1 clc jno y4800 xor ax,0810h stc y4800: rcl ax,1 mov ds:[0069h],ax ret y4806: call y462c mov bl,42h y480b: mov cx,0700h y480e: loop y480e dec bl jnz y480b ret x99 db "▀▀ ▀▀ ▀▀▀ ▀ ▀▀▀ ▀▀ " db "▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀▀▀ ▀▀▀ ▀▀ ▀▀ " db "▀▀ ▀▀ ▀▀ ▀▀▀ ▀▀ ▀▀▀▀▀ ▀▀ ▀▀▀ " db "▀▀▀▀ ▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀ ▀▀ ▀▀ ▀▀ " db "▀▀▀ ▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀▀▀ ▀ ▀▀ ▀▀▀ ▀▀ " db "▀▀ ▀▀ ▀▀ ▀▀▀▀▀▀ ▀▀ ▀▀▀▀▀ ▀▀ ▀▀ " db "▀ ▀▀▀ ▀▀ ▀▀ ▀▀▀▀ ▀▀▀ ▀▀ ▀▀▀$" x89 db "┌─────────────────────────────────┐ │ г.Сeвeродвинск Труда 20 - 76 │ │ программноe обeспeчeниe для │ │ PC Ассистeнт │ └─────────────────────────────────┘" db " 1 - дискретный 2 - аналоговый$" cseg ends end start