1 Star 0 Fork 6

nongdajun/BA4988反编译环境

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.py 3.22 KB
一键复制 编辑 原始数据 按行查看 历史
# -*- coding:utf-8 -*-
import sys
import time
import pygame
from ba4988 import BA4988
def update(ba4988):
striped = ba4988.display
screen = pygame.display.set_mode(striped.shape)
clock = pygame.time.Clock()
while 1:
for event in pygame.event.get():
if event.type == pygame.KEYUP:
if event.key ==pygame.K_ESCAPE:
return
elif event.key == pygame.K_UP:
ba4988.WrMem(0x024E, 0x35+0x80) # _KEYCODE
elif event.key == pygame.K_DOWN:
ba4988.WrMem(0x024E, 0x38+0x80) # _KEYCODE
elif event.key == pygame.K_LEFT:
ba4988.WrMem(0x024E, 0x37+0x80) # _KEYCODE
elif event.key == pygame.K_RIGHT:
ba4988.WrMem(0x024E, 0x39+0x80) # _KEYCODE
elif event.key == pygame.K_PAGEUP:
ba4988.WrMem(0x024E, 0x3A+0x80) # _KEYCODE
elif event.key == pygame.K_PAGEDOWN:
ba4988.WrMem(0x024E, 0xB+0x80) # _KEYCODE
elif event.key == pygame.K_RETURN:
ba4988.WrMem(0x024E, 0x2F+0x80) # _KEYCODE
elif event.key == pygame.K_SPACE:
ba4988.WrMem(0x024E, 0x36+0x80) # _KEYCODE
elif event.key == pygame.K_BREAK:
ba4988.WrMem(0x024E, 0x2C+0x80) # _KEYCODE
elif event.key == pygame.K_1:
ba4988.WrMem(0x024E, 0x08+0x80) # _KEYCODE
elif event.key == pygame.K_2:
ba4988.WrMem(0x024E, 0x09+0x80) # _KEYCODE
elif event.key == pygame.K_3:
ba4988.WrMem(0x024E, 0x0A+0x80) # _KEYCODE
elif event.key == pygame.K_4:
ba4988.WrMem(0x024E, 0x0B+0x80) # _KEYCODE
elif event.key == pygame.K_5:
ba4988.WrMem(0x024E, 0x0C+0x80) # _KEYCODE
elif event.key == pygame.K_6:
ba4988.WrMem(0x024E, 0x0D+0x80) # _KEYCODE
elif event.key == pygame.K_7:
ba4988.WrMem(0x024E, 0x0E+0x80) # _KEYCODE
elif event.key == pygame.K_8:
ba4988.WrMem(0x024E, 0x0F+0x80) # _KEYCODE
elif event.key == pygame.K_9:
ba4988.WrMem(0x024E, 0x30+0x80) # _KEYCODE
elif event.key == pygame.K_0:
ba4988.WrMem(0x024E, 0x31+0x80) # _KEYCODE
else:
print('event.key:', event.key)
continue
ba4988.setIRQ(0x0308)
elif event.type == pygame.QUIT:
return
pygame.surfarray.blit_array(screen, striped)
clock.tick(20)
pygame.display.update()
def main():
pygame.init()
pygame.display.set_caption('BA4988')
ba4988 = BA4988()
# ba4988.x6502.PC = 0x852A # SysPutPixel
# ba4988.x6502.A = 8 # x
# ba4988.memory[0x0C20] = 0x00
# ba4988.flash[0x17AF] = 0 # y
# ba4988.flash[0x17B0] = 1 # data
ba4988.start()
update(ba4988)
ba4988.stop()
print('ba4988 stoped')
# alldone
pygame.quit()
print('pygame quited')
if __name__ == '__main__':
main()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/nongdajun/ba4988-decompile-environment.git
git@gitee.com:nongdajun/ba4988-decompile-environment.git
nongdajun
ba4988-decompile-environment
BA4988反编译环境
master

搜索帮助