remove other scripts
This commit is contained in:
parent
bdb140c35f
commit
df08c72d1f
71
monitor.py
71
monitor.py
@ -1,71 +0,0 @@
|
|||||||
import RPi.GPIO as GPIO
|
|
||||||
from RPi.GPIO import IN
|
|
||||||
|
|
||||||
# Monitor the 6502 processor
|
|
||||||
gpio_l = [2, 3, 4, 17, 27, 22, 10, 9, 11, 5, 6, 13, 19, 26]
|
|
||||||
gpio_r = [14, 15, 18, 23, 24, 25, 8, 7, 12, 16, 20, 21]
|
|
||||||
#
|
|
||||||
# Defining which 6502 pin goes to which GPIO pin
|
|
||||||
#
|
|
||||||
|
|
||||||
A = gpio_l[0:12]
|
|
||||||
A.reverse() # first 11 address pins, left side of 6502
|
|
||||||
A += [23, 18, 15, 14] # last 4 address pins
|
|
||||||
|
|
||||||
D = gpio_r[-8:] # 8 io pins
|
|
||||||
D.reverse()
|
|
||||||
|
|
||||||
PHI2 = 26
|
|
||||||
RWB = 19
|
|
||||||
|
|
||||||
GPIO.setmode(GPIO.BCM)
|
|
||||||
|
|
||||||
# OUT when writing and IN when reading
|
|
||||||
for pin in [PHI2, RWB]:
|
|
||||||
GPIO.setup(pin, IN)
|
|
||||||
|
|
||||||
for pin in A:
|
|
||||||
GPIO.setup(pin, IN)
|
|
||||||
|
|
||||||
for pin in D:
|
|
||||||
GPIO.setup(pin, IN)
|
|
||||||
|
|
||||||
def print_pins():
|
|
||||||
for i in range(len(A)):
|
|
||||||
print(f"A{i} - {A[i]}")
|
|
||||||
for i in range(len(D)):
|
|
||||||
print(f"D{i} - {D[i]}")
|
|
||||||
print(f"PHI2 - {PHI2}")
|
|
||||||
print(f"RWB - {RWB}")
|
|
||||||
|
|
||||||
def start_monitor():
|
|
||||||
run = True
|
|
||||||
while run:
|
|
||||||
# wait for a rising clock edge before outputting
|
|
||||||
channel = GPIO.wait_for_edge(PHI2, GPIO.FALLING, timeout=1000) # at least every 1 seconds
|
|
||||||
if channel is None:
|
|
||||||
continue
|
|
||||||
address = ""
|
|
||||||
data = ""
|
|
||||||
for i in range(len(A)):
|
|
||||||
address += str(GPIO.input(A[len(A)-1-i]))
|
|
||||||
for i in range(len(D)):
|
|
||||||
data += str(GPIO.input(D[len(D)-1-i]))
|
|
||||||
if GPIO.input(RWB):
|
|
||||||
rwb = "r"
|
|
||||||
else:
|
|
||||||
rwb = "w"
|
|
||||||
line = f"0b{address} - 0b{data}|||0x{format(int(address, 2), '04x')} - 0x{format(int(data, 2), '02x')}|||{rwb} "
|
|
||||||
print(line)
|
|
||||||
|
|
||||||
|
|
||||||
print_pins()
|
|
||||||
try:
|
|
||||||
start_monitor()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
GPIO.cleanup()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
23
opcodes.py
23
opcodes.py
@ -1,23 +0,0 @@
|
|||||||
opcodes_d = {
|
|
||||||
|
|
||||||
# branches
|
|
||||||
0xf0: "beq r",
|
|
||||||
0xd0: "bne r",
|
|
||||||
# jump
|
|
||||||
0x4c: "jmp a",
|
|
||||||
0x20: "jsr s",
|
|
||||||
0x60: "rts s",
|
|
||||||
# load
|
|
||||||
0xad: "lda a",
|
|
||||||
0xa9: "lda #",
|
|
||||||
0xa2: "ldx #",
|
|
||||||
# store
|
|
||||||
0x8d: "sta a",
|
|
||||||
# compare
|
|
||||||
0xc9: "cmp #",
|
|
||||||
# increments
|
|
||||||
0xee: "inc a",
|
|
||||||
0x1a: "inc A",
|
|
||||||
0xe8: "inx i",
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user