Skip to content

Commit 4e679c0

Browse files
committed
Updated 7800basic to latest release (v0.32)
1 parent 124523c commit 4e679c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+102
-61
lines changed

CHANGELOG.md

+4

README.md

+1-1

out/bin/compilers/7800basic/7800bas.bat

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
@echo off
22
if X"%bas7800dir%" == X goto nobasic
33
:tryanyway
4-
rem 7800preprocess <"%~f1" | 7800basic.exe -i "%bas7800dir%" -b "%1"
5-
7800preprocess.exe <"%~f1" >"%~f1.pre"
6-
7800basic.exe -i "%bas7800dir%" -b "%1" -p "%1.pre"
4+
7800preprocess.exe <"%~f1" >"%~1.pre"
5+
7800basic.exe -i "%bas7800dir%" -b "%~1" -p "%~1.pre"
76
if errorlevel 1 goto basicerror
8-
del "%1.pre"
7+
del "%~1.pre"
98
if X%2 == X-O goto optimize
109
7800postprocess -i "%bas7800dir%" > "%~f1.asm"
1110
goto nooptimize

out/bin/compilers/7800basic/7800bas.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ extern int firstcompress;
5959
extern int dumpgraphics_index;
6060
int maxpasses = 2;
6161

62-
#define BASIC_VERSION_INFO "7800basic v0.31"
62+
#define BASIC_VERSION_INFO "7800basic v0.32"
6363

6464
int main (int argc, char *argv[])
6565
{
-11 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.

out/bin/compilers/7800basic/TODO.txt

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
-bug - banners larger than 128 in 160B don't plot correctly.
2-
-data with trailing comment and comma's don't get the trailing comma stripped
2+
-bug - can't stick compression files into a directory.
3+
-data with trailing comment and commas don't get the trailing comma stripped
34
-horizontal scrolling
45
-vertical scrolling
6+
-resizezone
7+
-incspritemapfile
8+
-can create table of tile indexes (how?)
9+
-can create a table of sprite hi-addresses
10+
-can create a table of sprite lo-addresses
11+
-animatesprites
12+
Run through a specified number of lines of sprites each frame, and
13+
animate. Sprites using palettes 0 and 4 are animated.
14+
-callback: drawline
515

616
======================================================================
717

818
Horizontal Scrolling Notes
919

1020
- uses sprites-as-tiles design
11-
- sprite tiles are always 16 pixels wide
12-
- 11 sprites cover the screen and the one edge.
1321
- if the tiles aren't aligned at 16 pixel boundaries, just do the fine scroll.
1422
- if the tiles are aligned at 16 pixel boundaries, setup the tile greater than 159 at the correct X, depending on scroll direction, with new graphics scroll, then do the fine scroll.
Binary file not shown.
0 Bytes
Binary file not shown.

out/bin/compilers/7800basic/includes/lzsa1compression.asm

+55-31
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
; Changes intruduced by Mike Saarna, 2023:
2828
; -converted to DASM format.
2929
; -generalised memory locations, for easier incorporation into 7800basic
30-
; -removed self-modifying code, for use on rom-based platforms.
30+
; -removed self-modifying code, for execution from rom.
31+
; -added LZSAFASTCOPYBYTE optimisation ; +24 bytes rom, ~10% quicker
3132
;
3233
; get the original unmodified code from:
3334
; https://raw.githubusercontent.com/emmanuel-marty/lzsa
@@ -52,22 +53,22 @@
5253
;
5354

5455
LZSA_SMALL_SIZE = 0
55-
LZSAFASTCOPYBYTE = 1 ; +11 bytes rom
56+
LZSAFASTCOPYBYTE = 1 ; +24 bytes rom, ~10% quicker
5657

5758
; ***************************************************************************
5859
; ***************************************************************************
5960
;
6061
; ZP memory allocations... (temp1-temp9 are 7800basic ZP locations)
61-
LSZA1ZPRAM = temp1
62-
lzsa_winptr = LSZA1ZPRAM ; 1 word.
63-
lzsa_srcptr = LSZA1ZPRAM + 2 ; 1 word.
64-
lzsa_dstptr = LSZA1ZPRAM + 4 ; 1 word.
62+
LSZA1ZPRAM = temp1
63+
lzsa_winptr = LSZA1ZPRAM ; 1 word (temp1+temp2)
64+
lzsa_srcptr = LSZA1ZPRAM + 2 ; 1 word (temp3+temp4)
65+
lzsa_dstptr = LSZA1ZPRAM + 4 ; 1 word (temp5+temp6)
6566

6667
; Doesn't need to be ZP allocations...
6768
LSZA1TEMPRAM = temp7
68-
lzsa_cmdbuf = LSZA1TEMPRAM ; 1 byte.
69-
lzsa_cp_npages = LSZA1TEMPRAM + 1
70-
lzsa_lz_npages = LSZA1TEMPRAM + 2
69+
lzsa_cmdbuf = LSZA1TEMPRAM ; 1 byte (temp7)
70+
lzsa_cp_npages = LSZA1TEMPRAM + 1 ; 1 byte (temp8)
71+
lzsa_lz_npages = LSZA1TEMPRAM + 2 ; 1 byte (temp9)
7172

7273
; Alternate names for previous allocations...
7374
lzsa_offset = lzsa_winptr
@@ -80,6 +81,25 @@ LZSA_DST_HI = lzsa_dstptr+1
8081

8182
lzsa1modulestart
8283

84+
if LZSAFASTCOPYBYTE = 1
85+
.cp_fixpointer
86+
; the optimised pointer adjustment fails if .cp_byte copied a whole page.
87+
; so we deal with it as a special case here, out of the regular .cp_byte flow.
88+
; this seems to happen so rarely that I have as of yet to see it with real data.
89+
inc lzsa_srcptr+1 ; CC
90+
inc lzsa_dstptr+1
91+
bcc .cp_skip3 ; always taken
92+
; each of these happen infrequently (~1 in 256 byte copies)
93+
.cp_fixsrc1
94+
inc lzsa_srcptr+1
95+
clc
96+
bcc .cp_skip1
97+
.cp_fixsrc2
98+
inc lzsa_dstptr+1
99+
clc
100+
bcc .cp_skip2
101+
endif
102+
83103
; ***************************************************************************
84104
; ***************************************************************************
85105
;
@@ -89,6 +109,7 @@ lzsa1modulestart
89109
; Args: lzsa_dstptr = ptr to output buffer
90110
;
91111

112+
92113
DECOMPRESS_LZSA1_FAST
93114
lzsa1_unpack
94115
ldy #0 ; Initialize source index.
@@ -134,7 +155,7 @@ lzsa1_unpack
134155
.cp_got_len
135156
tax ; Lo-byte of length.
136157

137-
ifnconst LZSAFASTCOPYBYTE
158+
if LZSAFASTCOPYBYTE = 0
138159

139160
.cp_byte ; CC throughout the execution of this .cp_page loop.
140161
lda (lzsa_srcptr),y ; 5
@@ -149,41 +170,44 @@ lzsa1_unpack
149170
.cp_skip2
150171
dex ; 2
151172
bne .cp_byte ; 3
152-
; ~29 cycles for X=1
153-
; ~58 cycles for X=2
154-
; ~87 cycles for X=3
173+
; ~29 cycles overall for X=1
174+
; ~58 cycles overall for X=2
175+
; ~87 cycles overall for X=3
176+
; ...
177+
; ~174 cycles overall for X=6
155178

156-
else ; LZSAFASTCOPYBYTE
179+
else ; LZSAFASTCOPYBYTE != 0
157180

158181
; according to 7800heat, this loop is hot. It runs on average ~6x.
159-
.cp_byte ; CC throughout the execution of this .cp_page loop.
160-
lda (lzsa_srcptr),y ; 5
161-
sta (lzsa_dstptr),y ; 5
182+
183+
.cp_byte ; CC throughout the execution of this .cp_page loop.
184+
lda (lzsa_srcptr),y ; 5+
185+
sta (lzsa_dstptr),y ; 5+
162186
iny ; 2
163187
dex ; 2
164-
bne .cp_byte ; 3
165-
; ~17 cycles per iteration
188+
bne .cp_byte ; 3/2
189+
; ~17 cycles each iteration
166190
tya ; 2
191+
beq .cp_fixpointer ; 2 unlikely branch - only if we just copied a full page
167192
adc lzsa_srcptr+0 ; 3
168193
sta lzsa_srcptr+0 ; 3
169-
bcc .cp_skip1 ; 3
170-
inc lzsa_srcptr+1
171-
clc
194+
bcs .cp_fixsrc1 ; 2 (typical)
172195
.cp_skip1
173196
tya ; 2
174197
adc lzsa_dstptr+0 ; 3
175198
sta lzsa_dstptr+0 ; 3
176-
bcc .cp_skip2 ; 3
177-
inc lzsa_dstptr+1
178-
clc
199+
bcs .cp_fixsrc2 ; 2 (typical)
179200
.cp_skip2
180201
ldy #0 ; 2
181-
; ~22 cycles overhead
182-
183-
; ~39 cycles for X=1
184-
; ~56 cycles for X=2 (break-even)
185-
; ~73 cycles for X=3
186-
endif ; LZSAFASTCOPYBYTE
202+
.cp_skip3
203+
; ~24 cycles overhead, typical
204+
205+
; ~41 cycles for X=1 (+12 cycles vs non-optimized)
206+
; ~58 cycles for X=2 ( 0 cycles vs non-optimized)
207+
; ~75 cycles for X=3 (-12 cycles vs non-optimized)
208+
; ...
209+
; ~126 cycles for X=6 (-48 cycles vs non-optimized)
210+
endif ; ! LZSAFASTCOPYBYTE = 0
187211

188212
.cp_npages
189213
lda lzsa_cp_npages ; Any full pages left to copy?
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.31
1+
0.32
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

out/bin/compilers/7800basic/snip.exe

0 Bytes
Binary file not shown.

out/bin/compilers/7800basic/statements.c

+21-18
Original file line numberDiff line numberDiff line change
@@ -11308,26 +11308,29 @@ void set (char **statement)
1130811308
}
1130911309
else if (!strncmp (statement[2], "backupfile", 10))
1131011310
{
11311-
assertminimumargs (statement, "set backupfile", 1);
11312-
// set backupname to statement[3]
11313-
removeCR (statement[3]);
11314-
char *backupstr=statement[3];
11315-
if (*backupstr == '\'')
11316-
backupstr++;
11317-
int t;
11318-
for(t=0;t<SIZEOFSTATEMENT;t++)
11311+
if (!backupflag)
1131911312
{
11320-
if(backupstr[t]==0)
11321-
break;
11322-
if(backupstr[t]=='^')
11323-
backupstr[t]=' ';
11324-
}
11325-
if(backupstr[t-1]=='\'')
11313+
assertminimumargs (statement, "set backupfile", 1);
11314+
// set backupname to statement[3]
11315+
removeCR (statement[3]);
11316+
char *backupstr=statement[3];
11317+
if (*backupstr == '\'')
11318+
backupstr++;
11319+
int t;
11320+
for(t=0;t<SIZEOFSTATEMENT;t++)
11321+
{
11322+
if(backupstr[t]==0)
11323+
break;
11324+
if(backupstr[t]=='^')
11325+
backupstr[t]=' ';
11326+
}
11327+
if(backupstr[t-1]=='\'')
1132611328
backupstr[t-1]=0;
11327-
if(OpenArchive(backupstr)==FALSE)
11328-
prerror ("set backupfile failed - couldn't write to '%s'",backupstr);
11329-
backupflag = TRUE;
11330-
backupthisfile(backupname);
11329+
if(OpenArchive(backupstr)==FALSE)
11330+
prerror ("set backupfile failed - couldn't write to '%s'",backupstr);
11331+
backupflag = TRUE;
11332+
backupthisfile(backupname);
11333+
}
1133111334
}
1133211335
else if (!strncmp (statement[2], "screenheight", 12))
1133311336
{

out/compilers/seventyEightHundredBasicCompiler.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)