+/* This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
'use strict'
let txtdiv = document.createElement("div")
document.body.appendChild(txtdiv)
write: (readAddr, maxBytes) =>
output.print(String.fromCharCode.apply(
null,
- new Uint16Array(wasmMem.buffer, readAddr, maxBytes)
+ new Uint16Array(wasmMem.buffer, readAddr, maxBytes >> 1)
))
}]
const simstack = []
'CHANNEL!': 35,
'HERE!': 36,
'=?': 37,
+ '.s': 38,
':': 16800,
'MODE': 14336,
'EXECUTE-MODE': 16680,
rinit: () => rstack.length = 0,
rpop: () => rstack.pop(),
rpush: (val) => rstack.push(val),
- sys_write: (channel, fromBuffer) => {
+ sys_write: (channel, addr, u) => {
if (channels[channel] === undefined)
return
- const maxBytes = new DataView(
- wasmMem.buffer,
- fromBuffer,
- 4
- ).getUint32(0,true)
- console.log(`write ch:${channel} addr:${fromBuffer} len:${maxBytes}`)
- channels[channel].write(fromBuffer + 4, maxBytes)
+ console.log(`write ch:${channel} addr:${addr} len:${u}`)
+ channels[channel].write(addr, u)
},
sys_read: (channel, toBuffer) => {
console.log(`read ch:${channel} buf:${toBuffer} current: ${stdin}`)