代码拉取完成,页面将自动刷新
同步操作将从 BA4988/BA4988反编译环境 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# -*- 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()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。