Coder Social home page Coder Social logo

chip8-emulator's People

Contributors

cj1128 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

chip8-emulator's Issues

提交bug

在chip8.c里的指令集,比如250和251行,应该先比较写入VF后,再相减
因为VF是标记有没有借位,先相减后再比较,意义就完全错了

Error in test program

Hi, I wrote a simple chip8 emulator on a platform called lowres.nx and I'm trying to test it with your test roms. I got everything ok with test_opcode.ch8, but one error with BC_test.ch8 (Error "E05").
According to http://devernay.free.fr/hacks/chip8/C8TECH10.HTM#8xy5, this instruction is:

8xy5 - SUB Vx, Vy
Set Vx = Vx - Vy, set VF = NOT borrow.

If Vx > Vy, then VF is set to 1, otherwise 0. Then Vy is subtracted from Vx, and the results stored in Vx.

So after verification it seems that my code is ok ($FF - $EF does not borrow hence VF=1 => Error).

ReadFile是一个Win32 API的名字, 建议修改

参考: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile
在交叉编译的时候会报错.

$ make
x86_64-w64-mingw32-gcc -Wall -c -std=c11 -I/home/origami/code/sdl_learn/mingw-sdk/x86_64-w64-mingw32/include  main.c -o main.o
main.c: In function ‘SDL_main’:
main.c:282:9: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration]
  282 |   srand(time(0));
      |         ^~~~
x86_64-w64-mingw32-gcc -Wall -c -std=c11 -I/home/origami/code/sdl_learn/mingw-sdk/x86_64-w64-mingw32/include  chip8.c -o chip8.o
x86_64-w64-mingw32-gcc main.o chip8.o -L/opt/local/x86_64-w64-mingw32/lib -lmingw32 -L/home/origami/code/sdl_learn/mingw-sdk/x86_64-w64-mingw32/lib -lSDL2main -lSDL2 -lSDL2_image -mwindows -Wl,--no-undefined -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid  -static-libgcc -static -o main.exe
/usr/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld: /usr/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libkernel32.a(dpeqbs01169.o):(.text+0x0): multiple definition of `ReadFile'; main.o:main.c:(.text+0xaf): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:25: main.exe] Error 1

使用的Makefile

# Cross build for windows from WSL. 

CXX = x86_64-w64-mingw32-gcc

SDL_ROOT = /home/origami/code/sdl_learn/mingw-sdk


SDL_INCLUDE = -I$(SDL_ROOT)/x86_64-w64-mingw32/include

CXXFLAGS = -Wall -c -std=c11 $(SDL_INCLUDE) 


SDL_LIB = -L$(SDL_ROOT)/x86_64-w64-mingw32/lib -lSDL2main -lSDL2 -lSDL2_image
MINGW_LIB = -L/opt/local/x86_64-w64-mingw32/lib -lmingw32
OTHER_LD_FLAGS = -mwindows -Wl,--no-undefined -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid 

LDFLAGS = $(MINGW_LIB) $(SDL_LIB) $(OTHER_LD_FLAGS) -static-libgcc -static


EXE = main.exe

all: $(EXE)

$(EXE): main.o chip8.o
		$(CXX) main.o chip8.o $(LDFLAGS) -o $@

main.o: main.c
	$(CXX) $(CXXFLAGS) $< -o $@

chip8.o: chip8.c
	$(CXX) $(CXXFLAGS) $< -o $@

clean:
	rm *.o $(EXE)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.