project basic setup

This commit is contained in:
Jairinho 2022-02-23 12:20:57 -03:00
commit 09acb8875a
No known key found for this signature in database
GPG Key ID: 954589B18A21D5B6
11 changed files with 319 additions and 0 deletions

39
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,39 @@
on: [push, pull_request]
name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.16.x, 1.17.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Cache control
uses: actions/cache@v2
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test
run: go test -v -race ./chip8

222
.gitignore vendored Normal file
View File

@ -0,0 +1,222 @@
# Created by https://www.toptal.com/developers/gitignore/api/osx,windows,linux,vim,visualstudiocode,go,goland
# Edit at https://www.toptal.com/developers/gitignore?templates=osx,windows,linux,vim,visualstudiocode,go,goland
### Go ###
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
# Go workspace file
go.work
### Go Patch ###
/vendor/
/Godeps/
### Goland ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm, Rider and Goland
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Ignores the whole .idea folder and all .iml files
.idea/
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### OSX ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Vim ###
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
# Support for Project snippet scope
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.toptal.com/developers/gitignore/api/osx,windows,linux,vim,visualstudiocode,go,goland

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "libretro/libretro-common"]
path = libretro/libretro-common
url = https://github.com/libretro/libretro-common.git

16
Makefile Normal file
View File

@ -0,0 +1,16 @@
TARGET=chip8_libretro
LIBRETRO_CORE=$(TARGET).so
LIBRETRO_HEADER=$(TARGET).h
# run: $(LIBRETRO_CORE)
# retroarch -v -L $(LIBRETRO_CORE) roms/test_opcode.ch8
$(LIBRETRO_CORE):
go build -buildmode=c-shared -o $@ ./libretro
test:
go test -v -race ./chip8
clean:
rm $(LIBRETRO_CORE) $(LIBRETRO_HEADER)

1
README.md Normal file
View File

@ -0,0 +1 @@
# Chip8 Emulator

1
chip8/chip8.go Normal file
View File

@ -0,0 +1 @@
package chip8

1
chip8/chip8_test.go Normal file
View File

@ -0,0 +1 @@
package chip8_test

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module github.com/tangzero/chip8-emulator
go 1.17

@ -0,0 +1 @@
Subproject commit 716bb5e7b761a3b4d44e069c84491d906d32aba0

32
libretro/libretro.go Normal file
View File

@ -0,0 +1,32 @@
package main
/*
#cgo CFLAGS: -I./libretro-common/include
#include "libretro.h"
typedef struct retro_system_info retro_system_info;
typedef struct retro_system_av_info retro_system_av_info;
*/
import "C"
import (
"fmt"
)
const RetroAPIVersion = 1
//export retro_init
func retro_init() {
fmt.Println("loading chip8 core...")
}
//export retro_deinit
func retro_deinit() {
fmt.Println("unloading chip8 core...")
}
//export retro_api_version
func retro_api_version() uint32 {
return RetroAPIVersion
}
func main() {}

BIN
roms/test_opcode.ch8 Normal file

Binary file not shown.