Skip to content

Instantly share code, notes, and snippets.

@gucchan22
Last active August 29, 2015 14:09
Show Gist options
  • Save gucchan22/836eb6eb553d1de469e8 to your computer and use it in GitHub Desktop.
Save gucchan22/836eb6eb553d1de469e8 to your computer and use it in GitHub Desktop.
diff -ur litenes/src/fce/cpu.c litenes2/src/fce/cpu.c
--- litenes/src/fce/cpu.c 2014-11-17 23:59:46.283859234 +0900
+++ litenes2/src/fce/cpu.c 2014-11-18 00:01:49.787853728 +0900
@@ -46,7 +46,7 @@
#define cpu_update_zn_flags(value) cpu.P = (cpu.P & ~(zero_flag | negative_flag)) | cpu_zn_flag_table[value]
-#define cpu_branch(flag) if (flag) cpu.PC = op_address;
+#define cpu_branch(flag) if (flag) cpu.PC = op_address; op_cycles += 1;
#define cpu_compare(reg) int result = reg - op_value; \
cpu_modify_flag(carry_bp, result >= 0); \
cpu_modify_flag(zero_bp, result == 0); \
diff -ur litenes/src/fce/ppu.c litenes2/src/fce/ppu.c
--- litenes/src/fce/ppu.c 2014-11-17 23:59:46.283859234 +0900
+++ litenes2/src/fce/ppu.c 2014-11-18 00:02:33.771851767 +0900
@@ -261,9 +261,9 @@
if (ppu.scanline == 241) {
ppu_set_in_vblank(true);
ppu_set_sprite_0_hit(false);
- cpu_interrupt();
- }
- else if (ppu.scanline == 262) {
+ } else if(ppu.scanline == 242) {
+ cpu_interrupt();
+ } else if (ppu.scanline == 262) {
ppu.scanline = -1;
ppu_sprite_hit_occured = false;
ppu_set_in_vblank(false);
#-*- coding:utf-8 -*-
t = [
0x6b6b6b, 0x001084, 0x08008c, 0x42007b, 0x63005a, 0x6b0010, 0x600000, 0x4f3500,
0x314e18, 0x005a21, 0x215a10, 0x085242, 0x003973, 0x000000, 0x000000, 0x000000,
0xa5a5a5, 0x0042c6, 0x4229ce, 0x6b00bd, 0x942994, 0x9c1042, 0x9c3900, 0x845e21,
0x5f7b21, 0x2d8c29, 0x188e10, 0x2e8663, 0x29739c, 0x000000, 0x000000, 0x000000,
0xefefef, 0x5a8cff, 0x7b6bff, 0xa55aff, 0xd64aff, 0xe7639c, 0xde7b52, 0xce9c29,
0xadb531, 0x7bce31, 0x5ace52, 0x4ac694, 0x4ab5ce, 0x525252, 0x000000, 0x000000,
0xefefef, 0xadc6ff, 0xbdbdff, 0xceb5ff, 0xe7b5ff, 0xf9bbdf, 0xf7c6b5, 0xdec69c,
0xd6d694, 0xc6e79c, 0xb5e7ad, 0xade7c6, 0xaddee7, 0xadadad, 0x000000, 0x000000
]
puts "static uint32_t table[64] = {"
64.times do |i|
append = i == 63 ? "," : ""
puts "{ 0x"+(t[i] >> 16).to_s(16)+" , 0x"+((t[i] & 0x00ff00) >> 8).to_s(16)+" , 0x"+(t[i] & 0xff).to_s(16) + "}#{append}"
end
puts "};"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment