license
This commit is contained in:
3
6502.c
Normal file
3
6502.c
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() { printf("Hello, World!\n"); }
|
||||||
24
LICENSE
Normal file
24
LICENSE
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
BSD 2-Clause License
|
||||||
|
|
||||||
|
Copyright (c) 2025, Antoni Piasecki
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
3
build.sh
3
build.sh
@@ -1,3 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -xe
|
set -xe
|
||||||
cc -O3 -o chip8 chip8.c -L/usr/local/lib/libraylib.a -lraylib -lm
|
cc -O3 -o chip8 chip8.c -L/usr/local/lib/libraylib.a -lraylib -lm
|
||||||
|
cc -O3 -o 6502 6502.c
|
||||||
6
chip8.c
6
chip8.c
@@ -1,5 +1,4 @@
|
|||||||
// http://devernay.free.fr/hacks/chip8/C8TECH10.HTM
|
// http://devernay.free.fr/hacks/chip8/C8TECH10.HTM
|
||||||
// TODO: buzzer
|
|
||||||
#include <raylib.h>
|
#include <raylib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -68,10 +67,10 @@ CHIP8 chip8_create() {
|
|||||||
|
|
||||||
void chip8_disassemble(CHIP8 *c, size_t ins_count) {
|
void chip8_disassemble(CHIP8 *c, size_t ins_count) {
|
||||||
for (size_t i = 0; i < ins_count; i++) {
|
for (size_t i = 0; i < ins_count; i++) {
|
||||||
READ_INS();
|
|
||||||
|
|
||||||
printf("0x%x: ", c->pc);
|
printf("0x%x: ", c->pc);
|
||||||
|
|
||||||
|
READ_INS();
|
||||||
|
|
||||||
switch ((ins >> 12) & 0xF) {
|
switch ((ins >> 12) & 0xF) {
|
||||||
case 0x0: {
|
case 0x0: {
|
||||||
switch (nnn) {
|
switch (nnn) {
|
||||||
@@ -212,6 +211,7 @@ void chip8_step(CHIP8 *c) {
|
|||||||
}
|
}
|
||||||
if (c->sound_timer > 0) {
|
if (c->sound_timer > 0) {
|
||||||
c->sound_timer--;
|
c->sound_timer--;
|
||||||
|
// TODO: buzzer
|
||||||
}
|
}
|
||||||
|
|
||||||
READ_INS();
|
READ_INS();
|
||||||
|
|||||||
Reference in New Issue
Block a user