Разработка программы на Ассемблере
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 @@@ST
@@@ST:
; CD-ROM........
xor bx,bx
mov ax,1500h
int 2fh
print CDROM
cmp bx,0
je @NOCD
add bx,30h
mov baks[0],bl
print baks
jmp @@JKH
@NOCD:
print otsuts
@@JKH:
; APM.... (Advanced Power Manager)
print APM
mov ax,5300h
xor bx,bx
int 15h
cmp ah,86h
je @@@NONE
print est
jmp @@@COOLS
@@@NONE:
print net
jmp @@@PLLL
@@@COOLS:
and cl,08h
cmp cl,08h
je @@@ASD
print APMON
jmp @@@PLLL
@@@ASD:
print APMOFF
@@@PLLL:
; Mouse....
print Mouse
xor ax,ax
int 33h
cmp ax,0FFFFh
je @QWE
print otsuts
jmp @@@Z
@QWE:
print prisuts
@@@Z:
ret
SborSved endp
TestMem proc near
jmp CHG
Testing db '’¥áâ ¯ ¬ï⨠: $'
proid db '¯p®©¤¥',10,13,'$'
no db '¥ $'
CHG:
clrscr
xor dx,dx
movcur
print Testing
mov bp,cs
add bp,128
P:
xor si,si
PP:
mov byte ptr [bp][si],00h
cmp byte ptr [bp][si],00
jne bad
mov byte ptr [bp][si],0ffh
cmp byte ptr [bp][si],0ffh
jne bad
inc si
cmp si,0fh
jne PP
inc bp
cmp bp,0A000h
jne P
jmp good
bad:
print no
print proid
jmp JK
good:
print proid
JK:
ret
TestMem endp
Codes Ends
end Begin