Browse Source

Major bugfix and minor bugfix

Alex 6 years ago
parent
commit
0e3c6f8e73
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      main.c

+ 3
- 1
main.c View File

285
 
285
 
286
 			case 0xC000: // random generator
286
 			case 0xC000: // random generator
287
 				reg = (opcode & 0x0F00) >> 8;
287
 				reg = (opcode & 0x0F00) >> 8;
288
-				state.registers[reg] = (rand() % 255) & ((byte) opcode);
288
+				state.registers[reg] = (rand() % 256) & ((byte) opcode);
289
 				if (DEBUG) printf("Storing random in %i (%x)\n", reg, state.registers[reg]);
289
 				if (DEBUG) printf("Storing random in %i (%x)\n", reg, state.registers[reg]);
290
 
290
 
291
 				break;
291
 				break;
292
 
292
 
293
 			case 0xD000: // draw sprite
293
 			case 0xD000: // draw sprite
294
+				state.registers[0xF] = 0;
295
+
294
 				first = (opcode & 0x0F00) >> 8;
296
 				first = (opcode & 0x0F00) >> 8;
295
 				second = (opcode & 0x00F0) >> 4;
297
 				second = (opcode & 0x00F0) >> 4;
296
 
298