I'm having problems with my Schip8 "emulator".
The chip8 games runs fine however the schip8 runs but the "screen" is presented some strange cuts ... look the "pac man" and "ant"
My ant game doesn't show the "land"...
The dragon2 seems to have some issues too...
The I thought this could be a Scroll stuff and I made this test below but the results seems to be correct.
Code:
Processor cpu = new Processor();
int initialAddress = 0x200;
Engine videoMock =new Engine(cpu);
Emulator.setVideo(videoMock);
Emulator.init();
cpu.dataRegister.V[1] = 0x0; //x
cpu.dataRegister.V[2] = 0x0; //y
cpu.addressRegisterI = 0x20A; //initial sprit 16x16
cpu.getMemory().writeAt(initialAddress++, (short)0x00); //setting schip mode
cpu.getMemory().writeAt(initialAddress++, (short)0xFF);
cpu.getMemory().writeAt(initialAddress++, (short)0xD1); //draw 1 2 16x16 from 0x20A
cpu.getMemory().writeAt(initialAddress++, (short)0x20);
cpu.getMemory().writeAt(initialAddress++, (short)0x00); //scroll down 1
cpu.getMemory().writeAt(initialAddress++, (short)0xC1);
cpu.getMemory().writeAt(initialAddress++, (short)0x00); //scroll 4 to rigth
cpu.getMemory().writeAt(initialAddress++, (short)0xFB);
cpu.getMemory().writeAt(initialAddress++, (short)0x00); //scroll 4 to left
cpu.getMemory().writeAt(initialAddress++, (short)0xFC);
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.step(); //set high
cpu.step(); //false draw, just put the 1s and 0s on matrix
print(videoMock.getFrame()); // take a snapshot, 1
cpu.step(); //scroll down 1
print(videoMock.getFrame()); // take a snapshot, 2
cpu.step(); //scroll 4 or 2 for rigth
print(videoMock.getFrame()); // take a snapshot, 3
cpu.step(); //scroll 4 or 2 for left
print(videoMock.getFrame()); // take a snapshot, 4
Snapshot 1 (just draw)
===============================================================================
1|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
1|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
1|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
1|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
1|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
1|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
1|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
1|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
0|0|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0|0|0|0|0|0|0|0|
1|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
1|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
1|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
1|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
1|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
Im my "loggin" system shows...
[VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=132,y=31
[VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=132,y=32
[VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=132,y=30
....
So I think it can be a error of my part make the boundary over 131 (I made 0-127 ==[2*64] ).
You guys mark pixel on this coordinate? (at x=132)
I notice too the ant... starts with:
[VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=132,y=57
[VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=133,y=58
Debugger says me:
[CPU] DEBUG: high
[CPU] DEBUG: old drw 4
[VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=132,y=55
[VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=132,y=57
[VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=133,y=58
[CPU] DEBUG: scl
[CPU] DEBUG: old drw 4
[VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=132,y=55
[VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=132,y=57
[VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=133,y=58
[CPU] DEBUG: scl
[CPU] DEBUG: old drw 4
[VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=132,y=55
[VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=132,y=57
[VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=133,y=58
[CPU] DEBUG: scl
The game plot and give the scroll left 4 pixels...
But why if the resolution is 128x64?
I just solve this changing:
//private int widhtSchip = 128, heigthSchip = 64;
private int widhtSchip = 148, heigthSchip = 84;
The question is why I must have an array bigger than the resolution?
Best regards,