| View previous topic :: View next topic |
| Author |
Message |
Lobbo1
Joined: 07 Feb 2005 Posts: 5
|
Posted: Mon Feb 07, 2005 8:19 pm Post subject: Southern Cross Z80 single board computer, assembly help. |
|
|
Hello everyone.
We've been having a quiz type thing at uni and im stuck on a question regarding the Z80 CPU since I have no knowledge of it at all.
Basically I have to produce two programs written using an
assembler language to do the following activities:
Problem 1:
Write a program which will swap the content of memory location 2100
with the contents of memory location 2101.
Problem 2:
Write a program which adds together two 16 bit numbers, obtained from
memory. The result must then be stored back in memory.
The only other issue is that the result must be presented in a table
consisting of the following 4 headings:
Address | Op-code | Mnemonics | Comments.
Example: http://hometown.aol.co.uk/Lobbo1/example.JPG
Im hoping someone out there has heard of the Z80 board and could
possibly help me.
Hope to hear from someone (anyone) soon.
Thanks,
Rob. |
|
| Back to top |
|
 |
ahia123

Joined: 25 May 2003 Posts: 444 Location: Stavanger, Norway
|
Posted: Mon Feb 07, 2005 10:46 pm Post subject: |
|
|
Hello Rob,
Many ways to do this, here are two solutions (one for each problem). Program code starts in location $2000:
2000 2A 00 21 LD HL,($2100) ; Load contents of memory loc. 2100 and 2101 to HL reg.
2003 7D LD A,L ; Copy value of L reg. to A reg.
2004 6C LD L,H ; Copy value of H reg. to L reg.
2005 67 LD H,A ; Copy value of A reg. to H reg.
2006 22 00 21 LD ($2100),HL ; Store swapped H and L back to memory
2000 2A 00 21 LD HL,($2100) ; Load contents of memory loc. 2100 and 2101 to HL reg.
2003 EB EX DE,HL ; Exchange HL with DE (fast copy of HL to DE)
2004 2A 02 21 LD HL,($2102) ; Load contents of memory loc. 2102 and 2103 to HL reg.
2007 19 ADD HL,DE ; Add HL with DE, result in HL
2008 22 04 21 LD ($2104),HL ; Store HL to memory loc. 2104 and 2105
Bjørn |
|
| Back to top |
|
 |
Lobbo1
Joined: 07 Feb 2005 Posts: 5
|
Posted: Tue Feb 08, 2005 8:42 am Post subject: |
|
|
Thanks Bjørn that's great! Exactly what I needed  |
|
| Back to top |
|
 |
Lobbo1
Joined: 07 Feb 2005 Posts: 5
|
Posted: Tue Feb 22, 2005 7:13 pm Post subject: |
|
|
Ok, i didnt realise but i need to show a clear understanding of how the Z80 actually processes the data. To do this I just need to expand on the comments a bit more.
I managed to conquer the first one with some help from a friend at uni but still havent managed the second one.
If anyone knows how to put advanced comments to the second problem any help would be greatly appreciated.
Ex. http://hometown.aol.co.uk/Lobbo1/z80in.JPG
Many thanks. |
|
| Back to top |
|
 |
Lobbo1
Joined: 07 Feb 2005 Posts: 5
|
Posted: Tue Feb 22, 2005 8:20 pm Post subject: |
|
|
Please, please, please...desperate  |
|
| Back to top |
|
 |
|
|
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
Powered by phpBB © 2001 phpBB Group
|