OpenCores
URL https://opencores.org/ocsvn/tv80/tv80/trunk

Subversion Repositories tv80

[/] [tv80/] [branches/] [s80_env_devel/] [tests/] [tv80_env.h] - Blame information for rev 6

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ghutchis
// Environment library
2
// Creates definitions of the special I/O ports used by the
3
// environment, as well as some utility functions to allow
4
// programs to print out strings in the test log.
5
 
6
#ifndef TV80_ENV_H
7
#define TV80_ENV_H
8
 
9
sfr at 0x80 sim_ctl_port;
10
sfr at 0x81 msg_port;
11
sfr at 0x82 timeout_port;
12
sfr at 0x83 max_timeout_low;
13
sfr at 0x84 max_timeout_high;
14
 
15
#define SC_TEST_PASSED 0x01
16
#define SC_TEST_FAILED 0x02
17
#define SC_DUMPON      0x03
18
#define SC_DUMPOFF     0x04
19
 
20
void print (char *string)
21
{
22
  char *iter;
23
 
24
  timeout_port = 0x02;
25
  timeout_port = 0x01;
26
 
27
  iter = string;
28
  while (*iter != 0) {
29
    msg_port = *iter++;
30
  }
31
}
32
 
33
void print_num (int num)
34
{
35
  int cd = 0;
36
  int i;
37
  char digits[8];
38
 
39
  timeout_port = 0x02;
40
  timeout_port = 0x01;
41
 
42
  while (num > 0) {
43
    digits[cd++] = (num % 10) + '0';
44
    num /= 10;
45
  }
46
  for (i=cd; i>0; i--)
47
    msg_port = digits[i-1];
48
}
49
 
50
void sim_ctl (unsigned char code)
51
{
52
  sim_ctl_port = code;
53
}
54
 
55
void set_timeout (unsigned int max_timeout)
56
{
57
  timeout_port = 0x02;
58
 
59
  max_timeout_low = (max_timeout & 0xFF);
60
  max_timeout_high = (max_timeout >> 8);
61
 
62
  timeout_port = 0x01;
63
}
64
 
65
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.