hap said:Hmm, I think I've gotten somewhat bored with NES, I've hardly worked on it for nearly a month. I'm done with most of the fun stuff, and sound emulation scares me. I'll get back to it later probably, but in the meantime it's time for something new, like perhaps joining the Gameboy emulation programming bandwagon
*edit* or maybe the MSX... well, at least something with a Z80 in it as the main CPU.
Yes, "Super Cars" is such an annoying game to emulate properly.hap said:Fixed mmc1, and mmc2 too (punch out), fixed sprites, added mmc3 without irq. I'm bound to meet 'Error' still many times during progress.
*edit* someone said no NES rom uses the BRK opcode. Well, Dragon Warrior 1 uses it. And it might also be worth noting that the game 'Super Cars' depends on undocumented opcodes.
i give an example: i write to an address in a nes-memory page. this page is mirrored four times, like explaind in the docs. what do i have to do in my MemWrite() procedure now?
if i got right things work like this: the game gives an address higher than 0x10000, the mapper controls that and operates on the respective address in extra cart memory ?!?!?
what are those registers used in emulators like reg8. the cpu regs and the ppu have other names as far i know.
#define bo(x) ((x&1) | \
(x>>3&1)<<1 |\
(x>>6&1)<<2 |\
(x>>9&1)<<3 |\
(x>>12&1)<<4|\
(x>>15&1)<<5|\
(x>>18&1)<<6|\
(x>>21&1)<<7)
#define b(x) bo(0##x)
#include <stdio.h>
int main(void) {
int c=b(11111111);
printf("%d\n", c);
return 0;
}
#include <stdio.h>
#define bo(x) ((x&1) | \
(x>>3&1)<<1 |\
(x>>6&1)<<2 |\
(x>>9&1)<<3 |\
(x>>12&1)<<4|\
(x>>15&1)<<5|\
(x>>18&1)<<6|\
(x>>21&1)<<7)
#define binary8(x) bo(0##x)
#define binary16(x,y) ((bo(0##x)<<8)|(bo(0##y)))
int main(void)
{
printf("binary8(10101010) = %d\r\nbinary16(11001100,11001100) = %d\r\n",
binary8(10101010),
binary16(11110000,11110000));
return 0;
}
# 1 "makebin.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "makebin.c"
# 14 "makebin.c"
int main(void) {
int c=((011111111&1) | (011111111>>3&1)<<1 | (011111111>>6&1)<<2 | (011111111>>9&1)<<3 | (011111111>>12&1)<<4| (011111111>>15&1)<<5| (011111111>>18&1)<<6| (011111111>>21&1)<<7);
printf("%d\n", c);
return 0;
}
.file "makebin.c"
.def ___main; .scl 2; .type 32; .endef
.section .rdata,"dr"
LC0:
.ascii "%d\12\0"
.text
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
pushl %ebp
movl %esp, %ebp
subl $24, %esp
andl $-16, %esp
movl $0, %eax
addl $15, %eax
addl $15, %eax
shrl $4, %eax
sall $4, %eax
movl %eax, -8(%ebp)
movl -8(%ebp), %eax
call __alloca
call ___main
;
;
; it optimizes it quite well even with no -O switch, as we can see
;
;
movl $255, -4(%ebp)
movl -4(%ebp), %eax
movl %eax, 4(%esp)
movl $LC0, (%esp)
call _printf
movl $0, %eax
leave
ret
.def _printf; .scl 3; .type 32; .endef
.file "makebin.c"
.def ___main; .scl 2; .type 32; .endef
.section .rdata,"dr"
LC0:
.ascii "%d\12\0"
.text
.p2align 4,,15
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
pushl %ebp
movl $16, %eax
movl %esp, %ebp
subl $8, %esp
andl $-16, %esp
call __alloca
call ___main
movl $LC0, (%esp)
;
;
; looky, it optimized it into a single MOV of a constant!
;
;
movl $255, %eax
movl %eax, 4(%esp)
call _printf
leave
xorl %eax, %eax
ret
.def _printf; .scl 3; .type 32; .endef
hap said:Hmm, I think I've gotten somewhat bored with NES, I've hardly worked on it for nearly a month. I'm done with most of the fun stuff, and sound emulation scares me. I'll get back to it later probably, but in the meantime it's time for something new, like perhaps joining the Gameboy emulation programming bandwagon
*edit* or maybe the MSX... well, at least something with a Z80 in it as the main CPU.
hap said:The choice was MSX, but without progress that is worth mentioning, since I've gotten a bit interested again in the NES. Current additions (among other small things) are 2 player support, sram (the standard .sav files), and a couple of mappers. I'll mention the release of v1.1 here when it's ready, which should not be an alpha version anymore.
sethmcdoogle: your macro is working nicely in sega li.