Program w ass na z80



Masz problem? Zapytaj na forum elektroda.pl

Poprzedni Następny
Wiadomość
Spis treści
From: "TeS" <muniek241_at_nospam_wp.pl>
Subject: Program w ass na z80
Date: Sun, 5 Jan 2003 09:38:18 +0100


Witam!

W firmowej dokumentacji do procesorka z80 jest przykładowy program do
sortowania liczb. Tylko że mam z nim jeden, mały problem - gdzie (w którym
miejscu) te liczby mają być umieszczone. Aha. I gdzie powiedzieć mu
(programowi) ile tych liczb jest?

Oto ten program :

1 ; standard exchange (bubble) sort routine
2 ;
3 ; at entry: hl contains address of data c contains number of elements to
be sorted (1 <c <256)
4 ;
5 ;
6 ;
7 ; at exit data sorted in ascending order
8 ;
9 ; use of registers
10 ;
11 ; register contents
12 ;
13 ; a temporary storage for calculations
14 ; b counter for data array
15 ; c length of data array
16 ; d first element in comparison
17 ; e second element in comparison
18 ; h flag to indicate exchange
19 ; l unused
20 ; ix pointer into data array
21 ; iy unused
22 ;
23 sort: ld (data), hl ; save data address
24 loop: res flag, h ; initialize exchange flag
25 ld b, c ; initialize length counter
26 dec b ; adjust for testing
27 ld ix, (data) ; initialize array pointer
28 next: ld a, (ix) ; first element in comparison
29 ld d, a ; temporary storage for element
30 ld e, (ix+1) ; second element in comparison
31 sub e ; comparison first to second
32 jr pc, noex-$ ; if first > second, no jump
33 ld (ix), e ; exchange array elements
34 ld (ix+i), d
35 set flag, h ; record exchange occurred
36 noex: inc ix ; point to next data element
37 djnz next-$ ; count number of comparisons
38 ; repeat if more data pairs
39 bit flag, h ; determine if exchange occurred
40 jr nz, loop-$ ; continue if data unsorted
41 ret ; otherwise, exit
42 ;
43 flag: equ 0 ; designation of flag bit
44 data: defs 2 ; storage for data address
45 end


Pozdrawiam



=========
Path: news-archive.icm.edu.pl!news.icm.edu.pl!news.atman.pl!newsfeed.gazeta.pl!newsfeed.tpinternet.pl!news.tpi.pl!not-for-mai

Poprzedni Następny
Wiadomość
Spis treści
From: remick <remick_at_nospam_data.pl.nospam>
Subject: Re: Program w ass na z80
Date: Sun, 5 Jan 2003 09:56:25 +0100


In article <av8r05$g7h$1_at_nospam_absinth.dialog.net.pl>, muniek241_at_nospam_wp.pl
says...
Witam!

W firmowej dokumentacji do procesorka z80 jest przykładowy program do
sortowania liczb. Tylko że mam z nim jeden, mały problem - gdzie (w którym
miejscu) te liczby mają być umieszczone. Aha. I gdzie powiedzieć mu
(programowi) ile tych liczb jest?

Oto ten program :

3 ; at entry: hl contains address of data c contains number of elements to
be sorted (1 <c <256)

hehehehe
przeczytaj powyzsze raz jeszcze dokladnie :-)

--
pozdro,

remick at home
icq: 1532887

=========
Path: news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.silweb.pl!newsfeed.tpinternet.pl!news.dialog.net.pl!not-for-mai

Poprzedni Następny
Wiadomość
Spis treści
From: "Piotrek" <piotrekk5_at_nospam_wp.pl>
Subject: Re: Program w ass na z80
Date: Sun, 5 Jan 2003 12:17:23 +0100



Użytkownik "remick" <remick_at_nospam_data.pl.nospam> napisał w wiadomości
news:MPG.188211a42bef47a1989704_at_nospam_news.tpi.pl...
In article <av8r05$g7h$1_at_nospam_absinth.dialog.net.pl>
says...
Witam!

W firmowej dokumentacji do procesorka z80 jest przykładowy program do
sortowania liczb. Tylko że mam z nim jeden, mały problem - gdzie (w
którym
miejscu) te liczby mają być umieszczone. Aha. I gdzie powiedzieć mu
(programowi) ile tych liczb jest?

Oto ten program :

3 ; at entry: hl contains address of data c contains number of elements
to
be sorted (1 <c <256)

hehehehe
przeczytaj powyzsze raz jeszcze dokladnie :-)

Taaak, już wiem :))) Ale wpadka :)))
Pozdrawiam



=========
Path: news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.ipartners.pl!newsfeed.gazeta.pl!newsfeed.tpinternet.pl!news.tpi.pl!not-for-mai