Skip to content

Instantly share code, notes, and snippets.

@spiiin
spiiin / adv_island_2_algo.asm
Created October 1, 2012 21:18
Adventure Island 2 [NES] Map movement algorithm
ROM:B676 ; =============== S U B R O U T I N E =======================================
ROM:B676
ROM:B676
ROM:B676 gen_next_level: ; CODE XREF: ROM:B45Ep
ROM:B676 LDA #0
ROM:B678 STA byte_DB ; счетчик переходов по пройденным этапам (до 4х раз)
ROM:B67A LDA byte_D1 ; текущее значение уровня
ROM:B67C STA byte_DA ; DA = текущее смещение в мапе
ROM:B67E
ROM:B67E generate_next: ; CODE XREF: gen_next_level+76j
@spiiin
spiiin / adv_island_2_algo.py
Created October 1, 2012 21:21
Adventure Island 2 [NES] Map movement in python
MAX_INDEX = 0x20
eggWay1 = [-8, -7, -9, 1, -1, 9, 7, 8]
eggWay2 = [-9, -8, -1, -7, 7, 1, 8, 9]
eggWay3 = [-1, -9, 7, -8, 8, -7, 9, 1]
eggWay4 = [7, -1, 8, -9, 9, -8, 1, -7]
eggWay5 = [8, 7, 9, -1, 1, -9, -7, -8]
eggWay6 = [9, 8, 1, 7, -7, -1, -8, -9]
eggWay7 = [1, 9, -7, 8, -8, 7, -9, -1]
eggWay8 = [-7, 1, -8, 9, -9, 8, -1, 7]
@spiiin
spiiin / dwd.lua
Created November 25, 2012 22:37
Darkwing Duck lua script
require("bit")
Y_WEIGHT = 0x550;
Y_FORCE = 0x560;
ANIM_NO = 0x420;
ANIM_PARAM_FRAME_NO = 0x410;
ANIM_PARAM_TIMER = 0x430;
GRAVITY_CONST = 0x40;
@spiiin
spiiin / BestNesRoms.txt
Created March 26, 2013 21:26
best nes roms
8 Eyes (U) [!].nes
Abadox (J).nes
Addams Family, The (E) [!].nes
Adventures in the Magic Kingdom (E) [!].nes
Adventures of Lolo (U) [!].nes
Aladdin 4 (1996) (Unl) [!].nes
Alien 3 (E) [!].nes
Alien Syndrome (J).nes
Antarctic Adventure (J).nes
Astyanax (U) [!].nes
@spiiin
spiiin / duck tales objects
Created May 6, 2013 11:13
duck tales objects
00 горилла
01 змея
02 паук
03 плотоядный цветок
04 метатель копий
05 плотоядный цветок на потолке
06 катушка-пиналка
07 камень
08 сундук с 10K
09 круглый камень
def makeCorruption(inp):
f = open(inp+".nes", "rb")
d = f.read()
f.close()
r = '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./0123456789:;<=>?'
it = 0
for x in xrange(0x10, 0x20010, 64):
cd = d[:x] + r + d[x+64:]
foname= inp+"%04d"%it+".nes"
print foname
def takeScreen(hwnd, scrname):
wDC = win32gui.GetWindowDC(hwnd)
dcObj=win32ui.CreateDCFromHandle(wDC)
cDC=dcObj.CreateCompatibleDC()
dataBitMap = win32ui.CreateBitmap()
dataBitMap.CreateCompatibleBitmap(dcObj, 250, 210) #~=
cDC.SelectObject(dataBitMap)
cDC.BitBlt((0,0),(250, 210) , dcObj, (10,40), win32con.SRCCOPY) #~=
dataBitMap.SaveBitmapFile(cDC, scrname)
import Image
def cutBlock(pp):
im = Image.open(pp)
imCut = im.crop((127,52,127+32,52+32)) #load one screenshot to any graphic editor and calc this coords
imCut.save(pp.replace(".bmp",".png"))
for x in xrange(256):
cutBlock(r"scr\%04d.bmp"%x)
imBig = Image.new("RGB", (32*256,32))
Check dump_000D32.bin True
Check dump_01584C.bin True
Check dump_02088E.bin False
Check dump_020ED2.bin True
Check dump_0216D2.bin True
Check dump_021742.bin True
Check dump_021F40.bin False
Check dump_0224B2.bin True
Check dump_022D98.bin True
Check dump_022DE8.bin True
import os
import subprocess
def test(fname):
#run
p = subprocess.Popen(subprocStringPack%(fname))
p.wait()
p = subprocess.Popen(subprocStringUnpack%fname.replace(".bin",".001.cmp.bin"))
p.wait()
#check