Разработка программы на Ассемблере

Codes SEGMENT para 'code'
org 100h
assume cs:Codes,ds:Codes,ss:Codes

movcur macro
mov ah,02h
mov bh,0
int 10h
endm


print macro x
mov ah,09h
mov dx,offset x
int 21h
endm

press macro
print pressanykey
xor ax,ax
int 16h
endm

clrscr macro
mov ax,0700h
mov bx,0700h
xor cx,cx
mov dx,184fh
int 10h
endm

Begin proc far
jmp StartMe

input label byte
maxln db 2
realln db ?
inparg db ?
pressanykey db 10,13,10,13,'H ¦¬ЁвҐ «оЎго Є« ўЁиг ¤«п Їp®¤®«¦Ґ­Ёп...$'
ann db 10,13,' ЂHHЋ’Ђ–?џ',10,13,' „ ­­ п Їp®Јp ¬¬  ®бгйҐбвў«пҐв ¤Ё Ј­®бвЁЄг ®Ў®p㤮ў ­Ёп ЏЉ:',10,13,' - ‘Ў®p ᢥ¤Ґ­Ё© - ­ ў®¤Ёв бЇp ўЄЁ ®Ў гбв ­®ў«Ґ­­®¬ ­  ЏЉ ®Ў®p㤮ў ­ЁЁ',10,13,'$'
ann1 db ' - ’Ґбв Ї ¬пвЁ - ®бгйҐбвў«пҐв Їp®ўҐpЄг Ї ¬пвЁ ­  p Ў®в®бЇ®б®Ў­®бвм',10,13,'$'
ann2 db ' ђ §¤Ґ« "‘Ў®p ᢥ¤Ґ­Ё©" б®ЎЁp Ґв Ё­д®p¬ жЁо ® б«Ґ¤гойЁе гбвp®©бвў е:',10,13,' - ® COM-Ї®pв е,',10,13,'$'
ann3 db ' - ® ¬ в. б®Їp®жҐбб®pҐ,',10,13,' - ® ¤ЁбЄ®ў®¤ е,',10,13,' - ® LPT - Ї®pв е,',10,13,' - ® CD-ROM ЇpЁў®¤ е,',10,13,' - ® ђ биЁpҐ­­®¬ гЇp ў«Ґ­ЁЁ н«ҐЄвp®ЇЁв ­ЁҐ¬,',10,13,' - ® ¬ ­ЁЇг«пв®pҐ "¬лим"$'
StartMe:
;*************** MAIN ROUTINE *************
clrscr
xor dx,dx
movcur
print ann
print ann1
print ann2
print ann3
press


Start:
call ShowQuestion

mov ah,0Ah
mov dx,offset input
int 21h

mov al,inparg

cmp al,31h
je Sved

cmp al,32h
je TestComp

cmp al,33h
je StopProgramm
jmp Start

StopProgramm:
mov ah,4ch
int 21h
Sved:
call SborSved
press
jmp Start
TestComp:
call TestMem
press
jmp start
Begin endp


;**************** SUBROUTINES *************



ShowQuestion proc near
jmp l1
system db '1 - ‘ўҐ¤Ґ­Ёп ® бЁб⥬Ґ',10,13,'$'
tst db '2 - ’Ґбв Ї ¬пвЁ',10,13,'$'
quit db '3 - ‚л室$',10,13,'$'
Choice db '‚ и ўлЎ®p ? : $'
l1:
clrscr
mov dx,0418h
movcur
print system
mov dx,0518h
movcur
print tst
mov dx,0618h
movcur
print quit
mov dx,0A18h
movcur
print Choice
ret
ShowQuestion endp




SborSved proc near
jmp @@MD
MathProc db 'Њ вҐ¬ вЁзҐбЄЁ© б®Їp®жҐбб®p : $'
prisuts db 'ЏpЁбгвбўгҐв',10,13,'$'
otsuts db 'ЋвбгвбўгҐв',10,13,'$'
comports db 'Њ бЄЁ¬ «м­®Ґ Є®«ЁзҐбвў® Ї®¤Є«оз Ґ¬ле COM-Ї®pв®ў : $'
kolvocomports db 'Љ®«ЁзҐбвў® Ї®¤Є«о祭­ле COM - Ї®pв®ў : $'
kolvolptports db 'Љ®«ЁзҐбвў® Ї®¤Є«о祭­ле LPT - Ї®pв®ў : $'
drive1 db 'ЏҐpўл© ¤ЁбЄ®ў®¤ : $'
drive2 db '‚в®p®© ¤ЁбЄ®ў®¤ : $'
k360 db '360Kb',10,13,'$'
k720 db '720Kb',10,13,'$'
m12 db '1.2Mb',10,13,'$'
m144 db '1.44Mb',10,13,'$'
CDROM db 'Љ®«ЁзҐбвў® гбв ­®ў«Ґ­­ле CD-ROM ЇpЁў®¤®ў : $'
APM db 'ђ биЁpҐ­­®Ґ гЇp ў«Ґ­ЁҐ н«ҐЄвp®ЇЁв ­ЁҐ¬ (ATX) : $'
APMON db ',ўЄ«о祭®' ,10,13,'$'
APMOFF db ',ўлЄ«о祭®',10,13,'$'
est db 'ЏpЁбгвбвўгҐв$'
net db 'ЋвбгвбвўгҐв$'
baks db ' ',10,13,'$'
mouse db 'Њ ­ЁЇг«пв®p ¬лим : $'
@@MD:

; ‘®Їp®жҐбб®p......
clrscr
xor dx,dx
movcur
print MathProc
int 11h
mov bx,ax
and al,02h
cmp al,02h
je have
print otsuts
jmp @next
have:
print Prisuts
@next:
and ah,0Eh
shr ah,1
add ah,30h
mov baks[0],ah
print comports
print baks

mov cx,4
xor bl,bl
xor si,si
xor dx,dx

mov ax,0040h ; ?­жЁ «Ё§ жЁп
mov es,ax ; ᥣ¬Ґ­в­®Ј® pҐЈЁбвp  ES ­   ¤pҐб ®Ў« бвЁ BIOS

@@MF:
mov ax,[es]:[si]
cmp ax,0000h
je @@L
inc bl
@@L:
inc si
inc si
loop @@MF

add bl,30h
print kolvocomports
mov baks[0],bl
print baks


;LPT - Џ®pвл.....

xor bl,bl
mov cx,3
@@@MF:
mov ax,[es]:[si]
cmp ax,0000h
je @@@L
inc bl
@@@L:
inc si
inc si
loop @@@MF

add bl,30h
print kolvolptports
mov baks[0],bl
print baks

; „ЁбЄ®ў®¤л .....

print drive1
mov al,10h
out 70h,al
jmp $+2
in al,71h
and al,00F0h
shr al,4
cmp al,01h
je @k360
cmp al,02h
je @m12
cmp al,03h
je @k720
cmp al,04h
je @m144
print otsuts
jmp @@ST
@k360:
print k360
jmp @@ST
@m12:
print m12
jmp @@ST
@m144:
print m144
jmp @@ST
@k720:
print k720
jmp @@ST
@@ST:


print drive2
mov al,10h
out 70h,al
jmp $+2
in al,71h
and al,000Fh


cmp al,01h
je @@k360
cmp al,02h
je @@m12
cmp al,03h
je @@k720
cmp al,04h
je @@m144
print otsuts
jmp @@@ST
@@k360:
print k360
jmp @@@ST
@@m12:
print m12
jmp @@@ST
@@m144:
print m144
jmp @@@ST
@@k720:
print k720
jmp