Читайте данную работу прямо на сайте или скачайте

Скачайте в формате документа WORD


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

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,h

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,h

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,Fh

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 @@@P

@@@COOLS:

and cl,08h

cmp cl,08h

je @@@ASD

print APMON

jmp @@@P

@@@ASD:

print APMOFF

@@@P:

; Mouse....

print Mouse

xor ax,ax

int 33h

cmp ax,0h

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,0Ah

jne P

jmp good

bad:

print no

print proid

jmp JK

good:

print proid

JK:

ret

TestMem endp

Codes Ends

end Begin