OpenCores
URL https://opencores.org/ocsvn/a-z80/a-z80/trunk

Subversion Repositories a-z80

[/] [a-z80/] [trunk/] [tools/] [dongle/] [neg/] [z80-instruction-test-neg.py] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 gdevic
#!/usr/bin/env python
2
#
3
# This script runs Z80 command 'neg' for all 256 values and prints out
4
# memory access log data. This data is used to feed the simulation
5
# script and verify its algorithm correctness.
6
# It needs:
7
#   1. Arduino Z80 dongle: http://www.baltazarstudios.com
8
# Needs pyserial from https://pypi.python.org/pypi/pyserial
9
#
10
import serial
11
import sys
12
 
13
ser = serial.Serial("\\.\COM9", 115200, timeout=1)
14
 
15
# Flush the serial buffer, removes any command response
16
def serialFlush(ser):
17
    while 1:
18
        indata = ser.readline().rstrip('\n')
19
        if not indata:
20
            break
21
 
22
try:
23
    serialFlush(ser)
24
    # Stop after selected M1 cycle effectively running only that one sequence
25
    ser.write("s 4 5\r")
26
    serialFlush(ser)
27
 
28
    # Loop for all 256 arguments
29
    for x in range(0, 256):
30
    #   3E00            ld      a, 00h
31
    #   ED44            neg
32
    #   F5              push    af
33
        ram = ':10000000' + '3E' + ("%0.2X" % x) + 'ED44F50405060708090A0B0C0D00'
34
 
35
        ser.write(ram + '\r')
36
        indata = ser.readline().rstrip('\n')
37
        ser.write('r\r')
38
 
39
        sys.stderr.write (ram + '\n')
40
 
41
        # Skip initial response from Arduino, includes two empty cycles after the reset
42
        for x in range(1,7):
43
            indata = ser.readline()
44
 
45
        while 1:
46
            indata = ser.readline()
47
            if not indata:
48
                break
49
            if indata[0]!=':':
50
                if "Memory" in indata:
51
                    print (indata.rstrip('\r\n'))
52
 
53
except KeyboardInterrupt:
54
     ser.close()

powered by: WebSVN 2.1.0

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