Skip to content

Commit

Permalink
patch: load bytecode instead of assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Dec 2, 2022
1 parent eea64a6 commit 2945f77
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cli/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
compile,
jacdacDefaultSpecifications,
JacsDiagnostic,
DEVS_ASSEMBLY_FILE,
DEVS_BYTECODE_FILE,
} from "devicescript-compiler"
import { CmdOptions } from "./command"
import { startDevTools } from "./devtools"
Expand Down Expand Up @@ -95,7 +95,7 @@ export async function build(file: string, options: BuildOptions) {
}

async function buildWatch(file: string, options: BuildOptions) {
const bytecodeFile = join(options.outDir, DEVS_ASSEMBLY_FILE)
const bytecodeFile = join(options.outDir, DEVS_BYTECODE_FILE)

// start watch source file
console.log(`watching ${file}...`)
Expand Down
8 changes: 4 additions & 4 deletions cli/src/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import fs from "fs"
const log = console.log
const debug = console.debug
const error = console.error
const dasboardPath = "editors/devicescript"

function fetchProxy(localhost: boolean): Promise<string> {
const protocol = localhost ? http : https
Expand All @@ -31,8 +32,8 @@ function fetchProxy(localhost: boolean): Promise<string> {
body = body.replace(
/https:\/\/microsoft.github.io\/jacdac-docs\/dashboard/g,
localhost
? "http://localhost:8000/devicescript/"
: "https://microsoft.github.io/jacdac-docs/editors/devicescript/"
? `http://localhost:8000/${dasboardPath}/`
: `https://microsoft.github.io/jacdac-docs/${dasboardPath}/`
)
resolve(body)
})
Expand All @@ -54,8 +55,7 @@ export async function startDevTools(
const tcpPort = 8082
const listenHost = internet ? undefined : "127.0.0.1"

log(`start dev tools for ${bytecodeFile}`)
log(` dashboard: http://localhost:${port}`)
log(`starting dev tools at http://localhost:${port}`)
log(` websocket: ws://localhost:${port}`)
log(` tcpsocket: tcp://localhost:${tcpPort}`)

Expand Down
3 changes: 2 additions & 1 deletion compiler/src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const CMD_GET_REG = 0x1000
export const CMD_SET_REG = 0x2000

export const DEVS_ASSEMBLY_FILE = "prog.jasm"
export const DEVS_BYTECODE_FILE = "prog.jacs"

class Cell {
_index: number
Expand Down Expand Up @@ -2803,7 +2804,7 @@ class Program implements TopOpWriter {
globals: this.globals.list.map(r => r.debugInfo()),
source: this._source,
}
this.host.write("prog.jacs", b)
this.host.write(DEVS_BYTECODE_FILE, b)
const progJson = {
text: this._source,
blocks: "",
Expand Down

0 comments on commit 2945f77

Please sign in to comment.