Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame, sys, time
- from random import randint
- from pygame.locals import *
- A = open('','rb')
- Memory = [0] * 0x10000
- PC = 0
- Vi = [0] * 8
- Stack = []
- EX = 0
- IA = 0
- i = 0
- c = 0
- d
- for b in A.read():
- if (c == 0):
- d = b << 8
- c += 1
- if (c == 1):
- Memory[i] = d & b
- c = 0
- i += 1
- def emulateCPU():
- global Memory, PC, Stack, Vi, EX, IA
- a = (Memory[PC] & FC00) >> 10
- if (Memory[PC] & 0x1F) == 0:
- opcode = Memory[PC] & 0x3FF
- SpecialOpcode = True
- else:
- opcode = Memory[PC] & 1F
- SpecialOpcode = False
- b = (Memory[PC] & 3E0) >> 5
- if opcode == 0x01 and not SpecialOpcode:
- if b <= 0x07:
- Vi[b] = a
- if b <= 0x0f:
- Memory[Vi[b & 0x07]] = a
- if b <= 0x17:
- Memory[(Vi[b & 0x07] + Memory[PC+1]) & 0xFFFF] = a
- if b ==
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement