remote: updates for multiple linked files, c64 samples

This commit is contained in:
Steven Hugg 2023-11-03 22:57:16 -05:00
parent 99f7ff41bb
commit f18365cf9f
10 changed files with 53 additions and 18 deletions

View File

@ -27,7 +27,7 @@ npm run build
To use GitHub integration locally, download the Firebase config file, e.g. https://8bitworkshop.com/v[version]/config.js
### Start Server
### Start Local Web Server
Start a web server on http://localhost:8000/ while TypeScript compiles in the background:
@ -69,6 +69,7 @@ The IDE uses custom forks for many of these, found at https://github.com/sehugg?
* http://www.twitchasylum.com/jsvecx/
* https://github.com/curiousdannii/ifvms.js/
* https://6502ts.github.io/typedoc/stellerator-embedded/
* https://github.com/yhzmr442/jspce
### Compilers

View File

@ -68,7 +68,7 @@
"build": "make prepare",
"test": "npm run test-node",
"tsbuild": "tsc --build tsconfig.json",
"esbuild": "npm run esbuild-worker && npm run esbuild-ui",
"esbuild": "npm run esbuild-worker && npm run esbuild-ui && npm run esbuild-server",
"esbuild-clean": "rm -f ./gen/*.*",
"esbuild-server": "esbuild src/worker/server/server.ts --platform=node --bundle --sourcemap --target=es2020 --outfile=./gen/server/server.js",
"esbuild-worker": "esbuild src/worker/workermain.ts --bundle --sourcemap --target=es2017 --outfile=./gen/worker/bundle.js",

View File

@ -5,10 +5,6 @@ void raster_wait(byte line) {
while (VIC.rasterline < line) ;
}
void wait_vblank(void) {
raster_wait(255);
}
static byte VIC_BANK_PAGE[4] = {
0xc0, 0x80, 0x40, 0x00
};
@ -21,8 +17,10 @@ char* get_screen_memory() {
return ((VIC.addr & 0xf0) << 6) + get_vic_bank_start();
}
#ifdef __CC65__
char __fastcall__ poll_keyboard() {
asm("jmp $f142");
return __A__;
}
#endif

View File

@ -1,14 +1,17 @@
#ifndef _COMMON_H
#define _COMMON_H
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <peekpoke.h>
#include <string.h>
#include <c64.h>
#ifdef __CC65__
#include <conio.h>
#include <joystick.h>
#endif
typedef uint8_t byte; // 8-bit unsigned
typedef int8_t sbyte; // 8-bit signed
@ -74,7 +77,18 @@ char* get_vic_bank_start();
// get current screen memory address
char* get_screen_memory();
#ifdef __CC65__
// return key in buffer, or 0 if none (BIOS call)
char __fastcall__ poll_keyboard();
#endif
#ifndef __CC65__
inline void clrscr() {
__asm__ volatile ("jsr $E544" : : : "a","x","y"); // regs clobbered
}
inline void waitvsync() {
raster_wait(255);
}
#endif
#endif

View File

@ -96,7 +96,7 @@ void iterate_game(void) {
collide_sprites(spr_coll);
}
void main(void) {
int main(void) {
clrscr();
VIC.bordercolor = 0;
@ -117,5 +117,6 @@ void main(void) {
while (1) {
iterate_game();
}
return 0;
}

View File

@ -10,8 +10,8 @@ void sprite_clear(void) {
void sprite_update(byte* screenmem) {
memcpy(screenmem + 0x3f8, sprshad.spr_shapes, 8);
memcpy(VIC.spr_pos, sprshad.spr_pos, 16);
memcpy(VIC.spr_color, sprshad.spr_color, 8);
memcpy((void*)VIC.spr_pos, sprshad.spr_pos, 16);
memcpy((void*)VIC.spr_color, sprshad.spr_color, 8);
VIC.spr_ena = sprshad.spr_ena;
VIC.spr_hi_x = sprshad.spr_hi_x;
VIC.spr_exp_x = sprshad.spr_exp_x;
@ -63,7 +63,6 @@ byte sprite_get_closest_collision(byte i, byte spr_coll) {
}
}
}
} else {
return 0xff;
}
return 0xff;
}

View File

@ -276,7 +276,8 @@ export class CodeProject {
msg.updates.push({path:mainfilename, data:maintext});
this.filename2path[mainfilename] = this.mainPath;
for (var dep of depends) {
if (!dep.link) {
// remote tools send both includes and linked files in one build step
if (!dep.link || this.remoteTool) {
msg.updates.push({path:dep.filename, data:dep.data});
depfiles.push(dep.filename);
}

View File

@ -11,9 +11,9 @@ import { parseObjDumpListing, parseObjDumpSymbolTable } from './clang';
const LLVM_MOS_TOOL: ServerBuildTool = {
name: 'llvm-mos',
version: '',
extensions: ['.c'],
extensions: ['.c', '.cpp', '.s'],
archs: ['6502'],
platforms: ['atari8', 'c64', 'nes'],
platforms: ['atari8', 'c64', 'nes', 'pce', 'vcs'],
platform_configs: {
default: {
binpath: 'llvm-mos/bin',
@ -27,13 +27,19 @@ const LLVM_MOS_TOOL: ServerBuildTool = {
},
c64: {
command: 'mos-c64-clang',
libargs: ['-D', '__C64__']
},
atari8: {
command: 'mos-atari8-clang',
libargs: ['-D', '__ATARI__']
},
nes: {
command: 'mos-nes-nrom-clang', // TODO
libargs: ['-lneslib']
libargs: ['-lneslib', '-lfamitone2']
},
pce: {
command: 'mos-pce-clang', // TODO
libargs: ['-lpce', '-D', '__PCE__']
},
}
}
@ -127,8 +133,11 @@ export class ServerBuildEnv {
let infiles = [];
for (let i = 0; i < step.files.length; i++) {
let f = step.files[i];
if (f.endsWith(this.tool.extensions[0])) {
infiles.push(path.join(this.sessionDir, f));
for (let ext of this.tool.extensions) {
if (f.endsWith(ext)) {
infiles.push(path.join(this.sessionDir, f));
break;
}
}
}
for (let i = 0; i < args.length; i++) {

View File

@ -6,6 +6,17 @@ import cors from 'cors';
import { WorkerBuildStep, WorkerFileUpdate } from '../../common/workertypes';
import { ServerBuildEnv, TOOLS, findBestTool } from './buildenv';
/*
## Tool Server (not yet used)
```sh
npm run server
xattr -dr com.apple.quarantine llvm-mos/bin/* # macOS only
curl http://localhost:3009/test
go to: http://localhost:8000/?platform=c64&file=hello.c&tool=llvm-mos
```
*/
////////////////////
const app = express();

View File

@ -8,6 +8,7 @@ const REMOTE_URL = "http://localhost:3009/build";
// create random UID
const sessionID = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
// TODO: #include links but #link doesnt link
export async function buildRemote(step: BuildStep): Promise<BuildStepResult> {
gatherFiles(step); // TODO?
var binpath = "a.out"; // TODO?