I try to do a little emulator with the py65emu module https://github.com/docmarionum1/py65emu
In the output console of vscode I reach to this point but I dont know how to do with the IRQ routine. if I have to use a 'thread' for this, if the irq address must be 0x244 ? ( c.interruptAddress = 0x244 ) Are there any other thread necessary ?
█
ORIC Ext.Basic 1.22fr █
1983 Tangerine,2001 █
█
█
1308 bytes free █
█
Ready █
█
█
█
█
█
█
█
█
█
█
█
█
█
█
█
█
█
█
█
Is there one IRQ routine on Oric ? ( timer + keyboard ) ?
my code :
Code: Select all
from py65emu.cpu import CPU
from py65emu.mmu import MMU
import tkinter as tk
from tkinter import font
import os
import threading
import time
import atexit
import sys
import keyboard # ajouter ce module externe : py -m pip install keyboard
import pygame
c = None
m = None
cyclecount = 0
memorybigstep = 10240 #10240
current_keypressed = None
# Fonction pour afficher du texte
def afficher_texte(fenetre, texte, couleur, position):
texte_surface = police.render(texte, True, couleur)
fenetre.blit(texte_surface, position)
def key():
global window
global current_keypressesd
event = keyboard.read_event()
while event!= keyboard is not keyboard.is_pressed('esc'):
if event.event_type == keyboard.KEY_DOWN:
if len(event.name) == 1:
v= ord(event.name)
#print (f"key={v}")
m.write(0x2df,v)
#=current_keypressed
def display():
global m
adr=0xbb80 # start screen address 1rst line
#while runprogram:
i=0
page=""
col=0
for i in range(adr,adr+(40*27)):
r = m.read(i)
if r <32:
r=32
#print(r)
col+=1
if col> 39:
col=0
page=page+"█\n\r"
page=page + chr(r)
os.system('cls')
print(page)
# init Pygame
pygame.init()
largeur_fenetre, hauteur_fenetre = 800, 600
fenetre = pygame.display.set_mode((largeur_fenetre, hauteur_fenetre))
pygame.display.set_caption("Balle qui rebondit")
# Définir les couleurs
noir = (0, 0, 0)
blanc = (255, 255, 255)
rouge = (255, 0, 0)
# Chemin vers le fichier de police Consolas.ttf
chemin_police = r'C:\Windows\Fonts\consola.ttf'
# for pygame : Initialiser la police
police = pygame.font.Font(chemin_police, 12) # Police par défaut, taille 74
# end of init pygame
f = open(os.getcwd()+"\\"+"Bas122fr.rom", "rb")
#f = open(os.getcwd()+"\\"+"Basic11b.rom", "rb")
m = MMU([
(0x00, 0xbfff), # Create RAM with 48k
(0xc000, 0xffff, True, f) # Create ROM starting at 0xc000 with your program.
])
# Create the CPU with the MMU and the starting program counter address
# You can also optionally pass in a value for stack_page, which defaults
# to 1, meaning the stack will be from 0x100-0x1ff. As far as I know this
# is true for all 6502s, but for instance in the 6507 used by the Atari
# 2600 it is in the zero page, stack_page=0.
c = CPU(m,0xf88f)
#c.interruptAddress = 0x244
#cpu->pc = (cpu->read( cpu, 0xfffd )<<8) | cpu->read( cpu, 0xfffc );
c.r.s=0x100 #0100-01FF Stack
# Do this to execute one instruction
#c.step()
# entrance addresse
c.r.pc = 0xf88f
thread_key = threading.Thread(target=key)
thread_key.start()
# c.interruptAddress = 0x244 .
#while cyclecount<921600:
for j in range(0,9):
for i in range(0,memorybigstep):
if (c.r.pc==0xfa3c):
pass
try:
c.step()
except:
pass
#print(c.r.pc,a)
cyclecount+=1
'''
for evenement in pygame.event.get():
if evenement.type == pygame.QUIT:
pygame.quit()
sys.exit()
# Mettre à jour l'affichage
# Afficher le texte
afficher_texte(fenetre, "Bonjour Pygame!", rouge, (50, 50))
pygame.display.flip()
# Limiter la vitesse de la boucle
pygame.time.Clock().tick(60)
'''
current_opcode = c.nextByte()
display()
#print(c.cc)
while True:
c.step()
#m.blocks[0]['memory'][0x02f]=65
display()
#display(oric)