0% found this document useful (0 votes)
85 views3 pages

z80 Assignment

Uploaded by

Emmanime
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views3 pages

z80 Assignment

Uploaded by

Emmanime
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1: //Emma Consuelo O.

Como
2: //APHY 105 Lecture - Assignment
3: //ST-1L
4: //August 2, 2010
5:
6: #include <stdio.h>
7:
8: main() {
9: int i; //counter. It must be noted that i and t are not the same. t=0 started represented by i=1.
10:
11: printf("This program will print numerical version of a specific set of input and output waveforms.\n \n"); //this
12: //actual waveforms, numbers which represent the waveforms will be printed. The numbers were patterned from the in
13: //assignment (pdf)
14:
15: printf("CLOCK: "); //this row will show alternating values of 0 and 1 indicating the low and high states of the cl
16:
17: for (i=1;i<=30;i++){
18: if((i%2)!=0){ //modulo was used to determine whether i is odd or even. This statement says that if i is odd, i
19: //I assigned the first LOW state to be i==1 and the last to be i==30
20: printf(" 0");
21: }
22: else {
23: printf(" 1");
24: }
25: }
26: printf("\n");
27: printf("READ: "); //this goes low for 2 clock cycles starting at t=9 and returns at t=11
28:
29: for (i=1;i<=30;i++){
30: if((i==19)||(i==20)||(i==21)||(i==22)){
31: printf(" 0");
32: }
33: else {
34: printf(" 1");
35: }
36: }
37: printf("\n");
38: printf("WRITE: "); //this goes low for 2 clock cycles starting at t=2 and returns at t=4
39:
40: for (i=1;i<=30;i++){
41: if((i==5)||(i==6)||(i==7)||(i==8)){
42: printf(" 0");
43: }
44: else {
45: printf(" 1");
46: }
47: }
48:
49: printf("\n");
50: printf("A: "); //This is originally at zero but becomes 80H (0x80) at t=1 (i=3) and at t=8 (i=17) for 4 clock
51:
52: for (i=1;i<=30;i++){
53: if((i>=3)&&(i<=10)){
54: printf(" 8"); //8 represents 80H
55: }
56: else if ((i>=17)&&(i<=24)){
57: printf(" 8"); //8 represents 80H
58: }
59: else
60: printf(" 0"); //0 represents 00H
61: }
62:
63: printf("\n");
64: printf("D: "); //This is originally at zero but becomes AAH (0xAA) at t=3 (i=7) and t=10 (i=21) for 2 clock cy
65:
66: for (i=1;i<=30;i++){
67: if((i>=7)&&(i<=10)){
68: printf(" A"); //A represents AAH
69: }
70: else if ((i>=21)&&(i<=24)){
71: printf(" A"); //A represents AAH
72: }
73: else {
74: printf(" 0"); //0 represents 00H
75: }
76: }
77:
78: printf("\n");
79: printf("t: "); //for time t -> this is not part of the signals but can help in understanding.
80:
81: for (i=1;i<=31;i++){
82: if(i==0){
83: printf(" 0");
84: }
85: else if((i%2)!=0){
86: printf(" %d",i/2); //i/2 prints the value of t when i is odd.
87: }
88: else {
89: printf(" "); //space is given when i is even.
90: }
91: }
92:
93: printf("\n");
94: printf("The program is finished.\n");
95: getchar(); //for the purpose of letting the command prompt stay after the values are printed since we are using De
96: }
97:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy