chip8

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.vgx.fr/chip8
Log | Files | Refs

commit aef1b8f0a13635a0a33963aaae46671a720f150d
parent 3b13ad3e93cdee896f7e7a06218a763ffe367f3b
Author: Léo Villeveygoux <l@vgx.fr>
Date:   Fri, 10 May 2019 18:59:03 +0200

Move display() definition before step()

Diffstat:
Mchip8.c | 17+++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/chip8.c b/chip8.c @@ -137,7 +137,13 @@ char char_sprites[80] = { #define I_X(instr) ((instr)[0]&15u) #define I_Y(instr) ((instr)[1]>>4u) -void display(); +static void display(){ + for(int y=0 ; y<32 ; y++){ + for(int x=0 ; x<64 ; x++){ + draw(x, y, SCREEN[y*8+x/8]&1<<(7-x%8) ? 1:0); + } + } +} void step(){ unsigned char instr[2] = {RAM[PC], RAM[PC+1]}; @@ -332,16 +338,7 @@ void step(){ } -void display(){ - for(int y=0 ; y<32 ; y++){ - for(int x=0 ; x<64 ; x++){ - draw(x, y, SCREEN[y*8+x/8]&1<<(7-x%8) ? 1:0); - } - } -} - int main(int argc, char **argv){ - /* Set up char sprites */ memcpy(RAM+CHAR_SPRITES_OFFSET, char_sprites, sizeof(char_sprites));