MemoryError: memory allocation failed, allocating 65536 bytes #14472
Unanswered
carlostmgps
asked this question in
ESP32
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
#work with python 3
import ubinascii
import os
import micropython as mp
mp.mem_info()
MEM = bytearray(0x10000) # Main address space
FirstROMPage = None
ROM = bytearray(512) # populate later
ROMbank = 1
ROMbankoffset = (ROMbank - 1) * 0x4000
cartRAM = bytearray(0x8000) # some carts have up to 128K of RAM?
RAMbank = 0
RAMbankoffset = RAMbank * 0x2000 - 0xA000
RAMenabled = False
MBCRamMode = 0 # for MBC1
bootCode = "31 FE FF AF 21 FF 9F 32 CB 7C 20 FB 21 26 FF 0E 11 3E 80 32 E2 0C 3E F3 E2 32 3E 77 77 3E FC E0 47 11 04 01 21 10 80 1A CD 95 00 CD 96 00 13 7B FE 34 20 F3 11 D8 00 06 08 1A 13 22 23 05 20 F9 3E 19 EA 10 99 21 2F 99 0E 0C 3D 28 08 32 0D 20 F9 2E 0F 18 F3 67 3E 64 57 E0 42 3E 91 E0 40 04 1E 02 0E 0C F0 44 FE 90 20 FA 0D 20 F7 1D 20 F2 0E 13 24 7C 1E 83 FE 62 28 06 1E C1 FE 64 20 06 7B E2 0C 3E 87 E2 F0 42 90 E0 42 15 20 D2 05 20 4F 16 20 18 CB 4F 06 04 C5 CB 11 17 C1 CB 11 17 05 20 F5 22 23 22 23 C9 CE ED 66 66 CC 0D 00 0B 03 73 00 83 00 0C 00 0D 00 08 11 1F 88 89 00 0E DC CC 6E E6 DD DD D9 99 BB BB 67 63 6E 0E EC CC DD DC 99 9F BB B9 33 3E 3C 42 B9 A5 B9 A5 42 3C 21 04 01 11 A8 00 1A 13 BE 20 FE 23 7D FE 34 20 F5 06 19 78 86 23 05 20 FB 86 20 FE 3E 01 E0 50"
bootCode = bootCode.split(" ")
bootCode = [int(x, 16) for x in bootCode]
def readMem(addr):
global ROM , ROMbankoffset , cartRAM , RAMbankoffset
if addr <= 0x3fff:
return ROM[addr]
if addr <= 0x7fff:
return ROM[addr + ROMbankoffset]
def readMem16(addr):
# just presuming that some peripherals will need to hook on 16 bits
return [readMem(addr + 1), readMem(addr)]
def writeMem(addr, data):
global cartRAM , RAMbankoffset , RAMenabled , MEM
if addr <= 0x7fff:
doMBC(addr, data)
return
if addr >= 0xA000 and addr <= 0xBFFF and RAMenabled:
cartRAM[addr + RAMbankoffset] = data
return
MEM[addr] = data
def writeMem16(addr, dataH, dataL):
writeMem(addr, dataL)
writeMem(addr + 1, dataH)
def doMBC(addr, data):
global RAMenabled, ROMbank, ROMbankoffset, RAMbank, RAMbankoffset
def save_sram(file_name, cart_ram, rom):
def load_sram(file_path):
def open_file(file_path):
global ROM, FirstROMPage, MEM, ROMbank, ROMbankoffset, RAMbank, RAMbankoffset, RAMenabled, MBCRamMode
is my code to emulate a gameboy rom,i am using lolin d32 board and i thought that there are 512kb ram?
terminal:
%Run -c $EDITOR_CONTENT
MPY: soft reboot
stack: 1344 out of 15360
GC: total: 56000, used: 5936, free: 50064, max new split: 110592
No. of 1-blocks: 33, 2-blocks: 8, max blk sz: 48, max free sz: 2488
stack: 720 out of 15360
GC: total: 121984, used: 107984, free: 14000, max new split: 45056
No. of 1-blocks: 51, 2-blocks: 12, max blk sz: 4096, max free sz: 212
Traceback (most recent call last):
File "", line 20, in
MemoryError: memory allocation failed, allocating 65536 bytes
Beta Was this translation helpful? Give feedback.
All reactions