@8bitscript/bbc 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/package.json +93 -0
- package/src/geometry.8bs +5 -0
- package/src/index.8bs +2 -0
- package/src/input.8bs +50 -0
- package/src/pointer.8bs +15 -0
- package/src/rasterline.8bs +38 -0
- package/src/screen.8bs +48 -0
- package/src/text.8bs +85 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 8BitScript contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@8bitscript/bbc",
|
|
3
|
+
"version": "0.22.1",
|
|
4
|
+
"description": "BBC Micro target support for 8BitScript: the hardware underneath the portable APIs.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/8BitScript/8bitscript.git",
|
|
9
|
+
"directory": "packages/bbc"
|
|
10
|
+
},
|
|
11
|
+
"8bitscript": {
|
|
12
|
+
"title": "BBC Micro",
|
|
13
|
+
"emulator": {
|
|
14
|
+
"binary": "mame",
|
|
15
|
+
"family": "mame",
|
|
16
|
+
"screenshot": "mame",
|
|
17
|
+
"framesUnit": "seconds",
|
|
18
|
+
"defaultFrames": 8,
|
|
19
|
+
"installer": "mame",
|
|
20
|
+
"system": "bbcb",
|
|
21
|
+
"deferred": "MAME needs a ROM set this project does not ship"
|
|
22
|
+
},
|
|
23
|
+
"entry": "./src/index.8bs",
|
|
24
|
+
"exports": {
|
|
25
|
+
"./screen": "./src/screen.8bs",
|
|
26
|
+
"./text": "./src/text.8bs",
|
|
27
|
+
"./input": "./src/input.8bs",
|
|
28
|
+
"./pointer": "./src/pointer.8bs",
|
|
29
|
+
"./rasterline": "./src/rasterline.8bs"
|
|
30
|
+
},
|
|
31
|
+
"hardware": {
|
|
32
|
+
"build": {
|
|
33
|
+
"defsym": {
|
|
34
|
+
"__load_address": 3584,
|
|
35
|
+
"__ram_size": 32
|
|
36
|
+
},
|
|
37
|
+
"output": "bin",
|
|
38
|
+
"mameSystem": "bbcb"
|
|
39
|
+
},
|
|
40
|
+
"facts": {
|
|
41
|
+
"video.columns": 40,
|
|
42
|
+
"video.rows": 25,
|
|
43
|
+
"video.cellWidth": 8,
|
|
44
|
+
"video.cellHeight": 8,
|
|
45
|
+
"video.palette": 8,
|
|
46
|
+
"video.cellColors": 2,
|
|
47
|
+
"video.colorPerCell": false,
|
|
48
|
+
"video.glyphs": 0,
|
|
49
|
+
"video.blockWidth": 0,
|
|
50
|
+
"video.blockHeight": 0,
|
|
51
|
+
"video.bitmap": false,
|
|
52
|
+
"video.layers": 1,
|
|
53
|
+
"video.scroll": false,
|
|
54
|
+
"video.raster": false,
|
|
55
|
+
"video.sprites": 0,
|
|
56
|
+
"video.spritesPerLine": 0,
|
|
57
|
+
"video.spriteWidth": 0,
|
|
58
|
+
"video.spriteHeight": 0,
|
|
59
|
+
"video.spriteColors": 0,
|
|
60
|
+
"video.frameRate": 60,
|
|
61
|
+
"audio.voices": 0,
|
|
62
|
+
"audio.noise": false,
|
|
63
|
+
"audio.envelope": false,
|
|
64
|
+
"audio.filter": false,
|
|
65
|
+
"audio.pcm": false,
|
|
66
|
+
"audio.volume": false,
|
|
67
|
+
"audio.entropy": false,
|
|
68
|
+
"input.keyboard": true,
|
|
69
|
+
"input.joysticks": 0,
|
|
70
|
+
"input.pads": 0,
|
|
71
|
+
"input.controls": [],
|
|
72
|
+
"input.mouse": false,
|
|
73
|
+
"input.paddles": false,
|
|
74
|
+
"storage.save": false,
|
|
75
|
+
"storage.kib": 0,
|
|
76
|
+
"memory.ram": 32768,
|
|
77
|
+
"memory.banked": false,
|
|
78
|
+
"memory.bankedKib": 0
|
|
79
|
+
},
|
|
80
|
+
"options": {},
|
|
81
|
+
"presets": {}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"files": [
|
|
85
|
+
"src"
|
|
86
|
+
],
|
|
87
|
+
"publishConfig": {
|
|
88
|
+
"access": "public"
|
|
89
|
+
},
|
|
90
|
+
"scripts": {
|
|
91
|
+
"test": "node --test"
|
|
92
|
+
}
|
|
93
|
+
}
|
package/src/geometry.8bs
ADDED
package/src/index.8bs
ADDED
package/src/input.8bs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export namespace input {
|
|
2
|
+
function begin(): void {
|
|
3
|
+
input.poll();
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
function poll(): void {
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function left(): bool {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function right(): bool {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function up(): bool {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function down(): bool {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function confirm(): bool {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function cancel(): bool {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function pointer(): bool {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function pointerCell(): usmallint {
|
|
38
|
+
return 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function pointerButton(): bool {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export namespace Input {
|
|
47
|
+
const CONFIRM_LABEL: string = "RETURN";
|
|
48
|
+
const ALT_CONFIRM_LABEL: string = "RETURN";
|
|
49
|
+
const CONFIRM_LABELS: string = "RETURN";
|
|
50
|
+
}
|
package/src/pointer.8bs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export namespace Slot {
|
|
2
|
+
const BORDER: utinyint = 0;
|
|
3
|
+
const BACKGROUND: utinyint = 1;
|
|
4
|
+
const SCROLL_X: utinyint = 2;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export namespace raster {
|
|
8
|
+
const ENTRIES: utinyint = 0;
|
|
9
|
+
const STRIDE: utinyint = 0;
|
|
10
|
+
|
|
11
|
+
function clear(): void {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function at(line: utinyint, slot: utinyint, value: utinyint): bool {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function insert(line: utinyint, slot: utinyint, value: utinyint): bool {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function setValue(entry: utinyint, value: utinyint): bool {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function commit(): void {
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function count(): utinyint {
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function enable(): void {
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function disable(): void {
|
|
37
|
+
}
|
|
38
|
+
}
|
package/src/screen.8bs
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Video } from "./geometry.8bs";
|
|
2
|
+
|
|
3
|
+
export namespace screen {
|
|
4
|
+
function setColors(border: u8, background: u8): void {
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function blank(border: utinyint = BorderColor.BLACK, background: utinyint = BackgroundColor.BLACK): void {
|
|
8
|
+
for (let cell: usmallint = 0; cell < Video.CELL_COUNT; cell++) {
|
|
9
|
+
memory.write(31744 + cell, 32);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function setBackground(background: u8): void {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function setBorder(border: u8): void {
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const RESIZABLE: bool = false;
|
|
20
|
+
|
|
21
|
+
function resized(): bool {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export namespace BorderColor {
|
|
27
|
+
const BLACK: utinyint = 0;
|
|
28
|
+
const WHITE: utinyint = 1;
|
|
29
|
+
const RED: utinyint = 2;
|
|
30
|
+
const CYAN: utinyint = 3;
|
|
31
|
+
const PURPLE: utinyint = 4;
|
|
32
|
+
const GREEN: utinyint = 5;
|
|
33
|
+
const BLUE: utinyint = 6;
|
|
34
|
+
const YELLOW: utinyint = 7;
|
|
35
|
+
const KEEP: utinyint = 255;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export namespace BackgroundColor {
|
|
39
|
+
const BLACK: utinyint = 0;
|
|
40
|
+
const WHITE: utinyint = 1;
|
|
41
|
+
const RED: utinyint = 2;
|
|
42
|
+
const CYAN: utinyint = 3;
|
|
43
|
+
const PURPLE: utinyint = 4;
|
|
44
|
+
const GREEN: utinyint = 5;
|
|
45
|
+
const BLUE: utinyint = 6;
|
|
46
|
+
const YELLOW: utinyint = 7;
|
|
47
|
+
const KEEP: utinyint = 255;
|
|
48
|
+
}
|
package/src/text.8bs
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Video } from "./geometry.8bs";
|
|
2
|
+
|
|
3
|
+
function asciiToScreenCode(code: utinyint): utinyint {
|
|
4
|
+
if (code >= 97 && code < 123) {
|
|
5
|
+
return code - 96;
|
|
6
|
+
}
|
|
7
|
+
return code;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let ink: utinyint = 1;
|
|
11
|
+
|
|
12
|
+
export namespace text {
|
|
13
|
+
const CELL_COUNT: usmallint = Video.CELL_COUNT;
|
|
14
|
+
const COLUMNS: utinyint = Video.COLUMNS;
|
|
15
|
+
const ROWS: utinyint = Video.ROWS;
|
|
16
|
+
|
|
17
|
+
function columns(): utinyint {
|
|
18
|
+
return text.COLUMNS;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function rows(): utinyint {
|
|
22
|
+
return text.ROWS;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function releaseCursor(): void {
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function setReverse(on: bool): void {
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function setColor(color: utinyint): void {
|
|
32
|
+
ink = color;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function putChar(cell: usmallint, code: utinyint): void {
|
|
36
|
+
memory.write(31744 + cell, asciiToScreenCode(code));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function putColor(cell: usmallint, color: utinyint): void {
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function print(cell: usmallint, s: string): void {
|
|
43
|
+
for (let i: utinyint = 0; i < s.length; i++) {
|
|
44
|
+
text.putChar(cell + i, s[i]);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
function fill(cell: usmallint, count: usmallint, code: utinyint): void {
|
|
50
|
+
for (let i: usmallint = 0; i < count; i++) {
|
|
51
|
+
text.putChar(cell + i, code);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function printNumber(cell: usmallint, value: usmallint, width: utinyint): void {
|
|
56
|
+
let n: usmallint = value;
|
|
57
|
+
let i: utinyint = width;
|
|
58
|
+
while (i > 0) {
|
|
59
|
+
i = i - 1;
|
|
60
|
+
let digit: utinyint = 0;
|
|
61
|
+
let place: usmallint = 1;
|
|
62
|
+
let w: utinyint = 0;
|
|
63
|
+
while (w < i) {
|
|
64
|
+
place = place * 10;
|
|
65
|
+
w = w + 1;
|
|
66
|
+
}
|
|
67
|
+
while (n >= place) {
|
|
68
|
+
n = n - place;
|
|
69
|
+
digit = digit + 1;
|
|
70
|
+
}
|
|
71
|
+
text.putChar(cell + i, 48 + digit);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export namespace TextColor {
|
|
77
|
+
const BLACK: utinyint = 0;
|
|
78
|
+
const WHITE: utinyint = 1;
|
|
79
|
+
const RED: utinyint = 2;
|
|
80
|
+
const CYAN: utinyint = 3;
|
|
81
|
+
const PURPLE: utinyint = 4;
|
|
82
|
+
const GREEN: utinyint = 5;
|
|
83
|
+
const BLUE: utinyint = 6;
|
|
84
|
+
const YELLOW: utinyint = 7;
|
|
85
|
+
}
|