Skip to content

Commit cbc8ccf

Browse files
committed
removed debug statements, formatting
1 parent 58d73f5 commit cbc8ccf

File tree

2 files changed

+12
-28
lines changed

2 files changed

+12
-28
lines changed

chip8.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,6 @@ void emulate_cycle(chip8 *chip) {
128128
Y = (opcode & 0x00F0) >> 4;
129129
NN = opcode & 0x00FF;
130130

131-
// debug statement displaying opcode
132-
// printf("Opcode: %x\n", opcode);
133-
134131
// decode and execute opcode in giant opcode switch statement
135132
switch (opcode & 0xF000) {
136133
case 0x0000:
@@ -393,15 +390,4 @@ void emulate_cycle(chip8 *chip) {
393390

394391
// increment program counter if there is no memory address jump
395392
if (!jump) { chip->pctr += 2; }
396-
}
397-
398-
// for debugging purposes only
399-
void draw_screen(chip8 *chip) {
400-
int i, j;
401-
for (i = 0; i < SCREEN_HEIGHT; i++) {
402-
for (j = 0; j < SCREEN_WIDTH; j++) {
403-
printf("%d", chip->display[j][i]);
404-
}
405-
printf("\n");
406-
}
407393
}

chip8.h

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
#ifndef CHIP8_H
33
#define CHIP8_H
44

5-
#define FONTSET_SIZE 80
6-
#define MAX_FILE_SIZE 3584
7-
#define NUM_KEYS 16
8-
#define NUM_REGISTERS 16
9-
#define SCREEN_WIDTH 64
10-
#define SCREEN_HEIGHT 32
11-
#define SPRITE_WIDTH 8
12-
#define STACK_SIZE 16
13-
#define SYSTEM_MEMORY 4096
14-
#define F 15
5+
#define FONTSET_SIZE80
6+
#define MAX_FILE_SIZE3584
7+
#define NUM_KEYS16
8+
#define NUM_REGISTERS16
9+
#define SCREEN_WIDTH64
10+
#define SCREEN_HEIGHT32
11+
#define SPRITE_WIDTH8
12+
#define STACK_SIZE16
13+
#define SYSTEM_MEMORY4096
14+
#define F15
1515

1616
// since C doesn't handle bool, typedef our own
1717
typedef int bool;
18-
#define FALSE 0
19-
#define TRUE 1
18+
#define FALSE0
19+
#define TRUE1
2020

2121
/* SUMMARY:
2222
* Chip 8 Virtual Machine. Can run Pong.
@@ -54,8 +54,6 @@ extern void initialize(chip8 *chip);
5454

5555
extern void emulate_cycle(chip8 *chip);
5656

57-
extern void draw_screen(chip8 *chip);
58-
5957
extern void handle_input(chip8 *chip, unsigned char key);
6058

6159
extern int load_file(char *file_name, unsigned char *buffer);

0 commit comments

Comments
 (0)