Page 6 of 19
Re: ZXSimulator
Posted: Sun Mar 29, 2020 11:28 am
by dilwyn
NormanDunbar wrote:Thanks Dilwyn, you've saved me lots of time. I was creating a zx-81 font from the actual font data in the zx-81 ROM which I found on-line.
Stay safe.
Cheers,
Norm.
It would do no harm to compare this against the ROM fonts in case I made some mistakes.
I did the font manually in my FontEd program, from diagrams online. But the diagrams weren't good enough quality to verify that I got each character in the right place in the 8x8 grid. Apart from the block characters (which are 8x8) and wide letters with odd numbers of horizontal pixels such as Y and T, most other characters are on a 6x8 grid with other pixels being spacers. I couldn't work out from the diagrams if the 6x8 glyphs are on the left of the 8x8 grid, or central.
If anyone has similar ZX80 and ZX Spectrum fonts for a QL, I'd be glad to add them to the collection.
Re: ZXSimulator
Posted: Sun Mar 29, 2020 11:53 am
by pjw
In the DP collection theres a fount called ZX_1. I dont know if thats any good.
Re: ZXSimulator
Posted: Sun Mar 29, 2020 3:34 pm
by NormanDunbar
Hi Per,
there are no files with "ZX" in their names in my DP Collection I'm afraid.

These are mine:
Code: Select all
DP_QL1
0/1440 sectors.
BIBLE1_zip 150133 04/01/95 18:45:52 v1
BIBLE2_zip 156049 04/01/95 18:46:02 v1
BIBLE3_zip 160554 04/01/95 18:46:11 v1
BIBLE4_zip 24077 04/01/95 18:46:13 v1
BOOT 294 04/01/95 18:46:13 v1
BOOT2 13442 04/01/95 18:46:15 v1
HPDRIVER_zip 1299 04/01/95 18:46:15 v1
MAILMANUAL_zip 6589 04/01/95 18:46:16 v1
PUBTOOLBOX2MANUAL_zip 3367 04/01/95 18:46:16 v1
SUCCESS_zip 66191 04/01/95 18:46:21 v1
SUCCESSMANUAL_zip 17715 04/01/95 18:46:22 v1
UNZIP E 62196 04/01/95 18:46:26 v1 37110
XREFMANUAL_zip 7532 04/01/95 18:46:27 v1
XTRAS 6872 04/01/95 18:46:28 v1
XTRAS2 2012 04/01/95 18:46:28 v1
XTRAS3 1268 04/01/95 18:46:29 v0
ZZIP_zip 41965 04/01/95 18:46:32 v1
DP_QL2
0/1440 sectors.
ACT_zip 328448 01/12/94 00:13:36 v1
PERFPLUSSE_zip 398340 01/12/94 00:13:37 v1
QFLICKMANUAL_zip 5287 01/12/94 00:13:37 v1
DP_QL3
0/1440 sectors.
ARCHDEVMANUAL_zip 3182 01/12/94 00:31:33 v1
CPORT_zip 285684 01/12/94 00:31:34 v1
PERFPLUSSEMANUAL_zip 148202 01/12/94 00:31:34 v1
QM1_zip 292401 01/12/94 00:31:34 v1
DP_QL4
0/1440 sectors.
DBANAL_zip 1740 01/12/94 00:07:55 v1
PP_zip 228466 01/12/94 00:07:55 v1
PUBTOOLBOX1_zip 141448 01/12/94 00:07:55 v1
PUBTOOLBOX2_zip 184137 01/12/94 00:07:55 v1
PUBTOOLBOX3CUT_zip 174580 01/12/94 00:07:56 v1
DP_QL5
0/1440 sectors.
CT_zip 124320 01/12/94 00:26:24 v1
QM2_zip 118331 01/12/94 00:26:24 v1
QM2ABA_zip 130035 01/12/94 00:26:24 v1
TURBO_zip 111650 01/12/94 00:26:24 v1
TURBOMANUAL_zip 129611 01/12/94 00:26:25 v1
TURBO2MANUAL_zip 116197 01/12/94 00:26:25 v1
DP_QL6
0/1440 sectors.
3DP_zip 99382 01/12/94 01:05:35 v1
ACTMANUAL_zip 99867 01/12/94 01:05:35 v1
GAMES_zip 96107 01/12/94 01:05:35 v1
LNGSE_zip 106983 01/12/94 01:05:35 v1
PAMANUAL_zip 96177 01/12/94 01:05:35 v1
PPMANUAL_zip 94363 01/12/94 01:05:36 v1
PUBTOOLBOX1MANUAL_zip 2391 01/12/94 01:05:36 v1
QM2MANUAL_zip 23814 01/12/94 01:05:36 v1
SPEDMANUAL_zip 107915 01/12/94 01:05:36 v1
DP_QL7
0/1440 sectors.
ARCHDEV_zip 68829 01/12/94 00:29:56 v1
COMP_zip 10898 01/12/94 00:29:56 v1
CONQMANUAL_zip 77156 01/12/94 00:29:56 v1
GRAFIX_zip 81325 01/12/94 00:29:56 v1
MB_zip 66565 01/12/94 00:29:56 v1
MMSE_zip 66580 01/12/94 00:29:56 v1
NAMES_zip 61346 01/12/94 00:29:56 v1
QLQL_zip 82078 01/12/94 00:29:56 v1
QM1MANUAL_zip 63541 01/12/94 00:29:57 v1
SPC_zip 65449 01/12/94 00:29:57 v1
SPED_zip 82015 01/12/94 00:29:57 v1
DP_QL8
0/1440 sectors.
ARCHTUT_zip 47635 01/12/94 00:32:54 v1
CONQSE_zip 54455 01/12/94 00:32:55 v1
CONQ_zip 45886 01/12/94 00:32:55 v1
DATAPP_zip 55560 01/12/94 00:32:55 v1
DTQD_zip 57742 01/12/94 00:32:55 v1
HB_zip 47754 01/12/94 00:32:55 v1
LNGSEMANUAL_zip 52133 01/12/94 00:32:55 v1
MBMANUAL_zip 52681 01/12/94 00:32:55 v1
MMSEMANUAL_zip 58082 01/12/94 00:32:55 v1
PAYROLL_zip 39333 01/12/94 00:32:55 v1
PEDITMANUAL_zip 673 01/12/94 00:32:55 v1
PPT_zip 56681 01/12/94 00:32:55 v1
QFLICK_zip 52741 01/12/94 00:32:55 v1
SPCMANUAL_zip 48876 01/12/94 00:32:55 v1
UP_zip 53558 01/12/94 00:32:56 v1
DP_QL9
0/1440 sectors.
3DPMANUAL_zip 30802 01/12/94 00:37:41 v1
ARCHTUTMANUAL_zip 3021 01/12/94 00:37:41 v1
BB_zip 18216 01/12/94 00:37:41 v1
COMPMANUAL_zip 2985 01/12/94 00:37:41 v1
CONQSEMANUAL_zip 11430 01/12/94 00:37:41 v1
COPYMANUAL_zip 3322 01/12/94 00:37:41 v1
COPY_zip 10887 01/12/94 00:37:41 v1
CPORTMANUAL_zip 14590 01/12/94 00:37:41 v1
CTMANUAL_zip 44445 01/12/94 00:37:41 v1
DATAPPMANUAL_zip 10232 01/12/94 00:37:41 v1
DBANALMANUAL_zip 6814 01/12/94 00:37:41 v1
DTQDMANUAL_zip 6196 01/12/94 00:37:41 v1
EYEQMANUAL_zip 8793 01/12/94 00:37:41 v1
EYEQ_zip 42232 01/12/94 00:37:41 v1
FEMANUAL_zip 8777 01/12/94 00:37:41 v1
FE_zip 20601 01/12/94 00:37:41 v1
HBMANUAL_zip 23173 01/12/94 00:37:41 v1
HEX_zip 9333 01/12/94 00:37:41 v1
MAIL_zip 9376 01/12/94 00:37:41 v1
NAMESMANUAL_zip 8881 01/12/94 00:37:41 v1
PAYROLLMANUAL_zip 21362 01/12/94 00:37:41 v1
PEDIT_zip 11139 01/12/94 00:37:41 v1
PPTMANUAL_zip 21339 01/12/94 00:37:41 v1
PUBTOOLBOX3_zip 29214 01/12/94 00:37:41 v1
QKICKMANUAL_zip 8187 01/12/94 00:37:41 v1
QKICK_zip 19880 01/12/94 00:37:41 v1
QLQLMANUAL_zip 12922 01/12/94 00:37:41 v1
QMON2MANUAL_zip 20430 01/12/94 00:37:41 v1
RECOVERMANUAL_zip 9802 01/12/94 00:37:41 v1
RECOVER_zip 12583 01/12/94 00:37:41 v1
SBMONMANUAL_zip 4331 01/12/94 00:37:41 v1
SBMON_zip 6958 01/12/94 00:37:41 v1
SEDITSPMANUAL_zip 11719 01/12/94 00:37:42 v1
SEDITSP_zip 22583 01/12/94 00:37:42 v1
SF_zip 22597 01/12/94 00:37:42 v1
SPIDISMANUAL_zip 10345 01/12/94 00:37:42 v1
SPIDIS_zip 32979 01/12/94 00:37:42 v1
SSGMANUAL_zip 7816 01/12/94 00:37:42 v1
SSG_zip 30355 01/12/94 00:37:42 v1
TFRSEMANUAL_zip 8537 01/12/94 00:37:42 v1
TFRSE_zip 15939 01/12/94 00:37:42 v1
TK3MANUAL_zip 15529 01/12/94 00:37:42 v1
TK3_zip 19525 01/12/94 00:37:42 v1
UPMANUAL_zip 11701 01/12/94 00:37:42 v1
XREF_zip 14774 01/12/94 00:37:42 v1
DP_QL10
0/1440 sectors.
DICS_zip 507077 01/12/94 01:52:24 v1
PA_zip 197231 01/12/94 01:52:24 v1
QMON2_zip 27176 01/12/94 01:52:24 v1
Cheers,
Norm.
Re: ZXSimulator
Posted: Sun Mar 29, 2020 4:55 pm
by dilwyn
The font was in a larger collection of fonts included with later versions of Lightning. I've found the font for Spectrum, I'll post it on my site later today.
Re: ZXSimulator
Posted: Sun Mar 29, 2020 6:23 pm
by pjw
As I said, I dont know if its any good. But here it is.
- zxfnt.zip
- ZX_1_fnt
- (562 Bytes) Downloaded 214 times
Re: ZXSimulator
Posted: Sun Mar 29, 2020 8:03 pm
by bwinkel67
So I was reading the old ZX81 manual last night (bringing back fond memories since that is how I learned BASIC). I either missed it or forgot about it but it allows variable names with spaces in it:
Code: Select all
let a b c = 10
print a b c
print abc
Hmmm...don't really like that. Easy (but annoying) to implement as you basically just skip spaces and store the variable as a traditional one. Still, weird implementation.
Oh, and as for the special character set of the zxtools variety...grrr that they added \" which creates a pain of a case in my code. I'd rather they used a 3rd special character instead since the way I tried to be efficient in code is to always look for 2 characters following a \ and only one following a % when using cursor keys. I may change it to \"" internally (and the ZX81 shows it as "" on the keyboard) and convert it to-and-from when reading and writing files since that may add the least code.
This is a function to figure out how many ZX81 characters I have as an example (using my 90's coding style):
Code: Select all
len = 0;
for (i=0; lstr[i]!='\0'; i++)
{ switch(lstr[i]) { case '\\': i++; case '%': i++; default: len++; } }
BTW, here is another beauty. If my students ever saw this they'd frown since I spend a good amount of time teaching good programming techniques. But I'm trying to save bytes to not have the executable grow too fast. Here I'm avoiding additional assignments since a goto is cheaper. I will revisit this to see if I can do it more properly. Maybe use a strcp function instead but that may add a speed tradeoff which is ok in non-critical code. This code tries to figure out how many spaces to add before line numbers so they all align when LISTing the code:
Code: Select all
if (j == 0) /* start of a new line of BASIC */
{
if (fstr[i+1] == ' ')
{ lstr[j++] = ' '; goto in2; } /* reduce code to indent 3 */
else if (fstr[i+2] == ' ')
{ in2: lstr[j++] = ' '; goto in3; } /* reduce code to indent 2 */
else if (fstr[i+3] == ' ')
{ in3: lstr[j++] = ' '; }
}
As I told Norm, there are things in the code I like but there are many things I don't. I was much younger when I wrote this and one of the principles I'm applying is one that I've taught my students which is, when working in a foreign code-base (and after almost 30 years this sure feels foreign) try and abide by existing conventions instead of creating a mess and doing your own thing. So today I don't do some of the formatting I did in the 90's, etc, but am sticking with it. Plus, 3 space indents...ugh...I keep it as 4 now mostly.
Re: ZXSimulator
Posted: Sun Mar 29, 2020 8:20 pm
by bwinkel67
BTW, one thing I may take out is the variable memory allocation for reading in BASIC. It tries to increment memory usage by some BLKLEN (64 bytes presently which is small) to keep the internal storage as low as possible. But that also means it requires twice that free memory since it takes the old current and creates a new current with BLKLEN added to it and does a copy. Since the ZX81 should max out to at least 16KB I can predefine this size to something that works. It may not be 16KB depending on how large the final ZXSimulator code grows.
Also, it will actually need to be larger than 16KB to house a 16KB program since the ZX81 tokenized everything on entry and the ZXSimulator keeps it as plain old text (so keywords take up more memory in mine). In the end, I may need to figure out how much free memory is available when starting up and choose a memory model based on that since it would be nice if the ZXSimulator ran reasonable on an unexpanded QL but also ran on an expanded QL with more memory. So I'll need to figure that out as I go. Maybe a trap call to show free memory?
Re: ZXSimulator
Posted: Mon Mar 30, 2020 12:01 am
by bwinkel67
A program I wrote in ZXSimulator. I must say, it wasn't as easy as I hoped. I have to fix the auto-listing that it does to better match the ZX81 as right now it lists the entire program, with multiple screens flashing by, and its useless. Ideally it should list either the line inserted to the lines that follow, or maybe center them on screen.
Code: Select all
5 REM BOUNCING BALL
10 PRINT "ENTER SPEED (1-10)";
15 INPUT SPEED
20 CLS
25 FOR I=0 TO 20
30 LET Y=I
35 LET X=I
40 GOSUB 1000
45 PRINT AT Y,X;" "
50 NEXT I
55 FOR I=21 TO 31
60 LET Y=42-I
65 LET X=I
70 GOSUB 1000
75 PRINT AT Y,X;" "
80 NEXT I
85 FOR I=30 TO 19 STEP -1
90 LET Y=I-19
95 LET X=I
100 GOSUB 1000
105 PRINT AT Y,X;" "
110 NEXT I
115 FOR I=19 TO 0 STEP -1
120 LET Y=19-I
125 LET X=I
130 GOSUB 1000
135 PRINT AT Y,X;" "
140 NEXT I
145 FOR I=20 TO 21
150 LET Y=I
155 LET X=I-19
160 GOSUB 1000
165 PRINT AT Y,X;" "
170 NEXT I
175 FOR I=20 TO 0 STEP -1
180 LET Y=I
185 LET X=23-I
190 GOSUB 1000
195 PRINT AT Y,X;" "
200 NEXT I
205 FOR I=1 TO 8
210 LET Y=I
215 LET X=23+I
220 GOSUB 1000
225 PRINT AT Y,X;" "
230 NEXT I
235 FOR I=8 TO 21
240 LET Y=I
245 LET X=38-I
250 GOSUB 1000
255 PRINT AT Y,X;" "
260 NEXT I
265 FOR I=20 TO 4 STEP -1
270 LET Y=I
275 LET X=I-4
280 GOSUB 1000
285 PRINT AT Y,X;" "
290 NEXT I
295 FOR I=4 TO 1 STEP -1
300 LET Y=I
305 LET X=0
310 GOSUB 1000
315 PRINT AT Y,X;" "
320 NEXT I
325 GOTO 25
500 STOP
1000 REM SPINNIG BALL
1005 FOR J=1 TO SPEED
1010 PRINT AT Y,X;"\. "
1015 PRINT AT Y,X;"\: "
1020 PRINT AT Y,X;"\''"
1025 PRINT AT Y,X;"\ :"
1030 PRINT AT Y,X;"\.."
1035 PRINT AT Y,X;"\: "
1040 PRINT AT Y,X;"\''"
1045 PRINT AT Y,X;"\ :"
1050 PRINT AT Y,X;"\.."
1055 NEXT J
1060 RETURN
Next is to convert it into a .p file and see if I can read it into EightyOne and check that it works the same way...it should as far as I can see.
"Next" was actually pretty easy using zxtext2p.exe and it worked on the EightOne emulator! Simply type:
...and out comes: out.p
The zip file below if for a Windows system, not a QL system:
Re: ZXSimulator
Posted: Tue Mar 31, 2020 9:34 am
by bwinkel67
Latest version:
- zx.zip
- (21.75 KiB) Downloaded 162 times
It's actually about 2% slower but unavoidable as I was trying to get the screen to behave like a ZX81. So I need to check when I print to see if I'm at the end of the screen and if so return an error. Before I was just clearing the screen which was faster when staying within the bounds, since print just assumed things were fine and didn't have to ask if they were. This can chew up time if you are in a loop with lots of prints and for each character this is checked so in the Banner demo I lost 2 seconds on two full screens (plain and inverted) -- up to 1:44
Other changes:
- LIST now works more like ZX81 though still a bit unique to how editing is done with ZXSimulator. Now stops when screen is full.
- EDIT works like in QL, by giving a line number and screen refreshes and highlights new entry with inverted '>'
- adding new lines works same way, by just adding new line (this had been working but now the screen shows new line with '>' in center of screen)
- just hitting return on command line LISTs top of program (like in ZX81)
- added "" which is saved in standard zxtext2p/zxtools format though you enter on command line by typing \"" (i.e. two double-quotes)
- also now creates lowercase filenames since all uppercase was annoying
- changed stopping key combo to Ctl-S since Space, Ctl-Space, and Ctl-C interfered with normal QL operation since QL uses those for OS operation
Included are the "banner.bas" and "ball.bas" programs to show off its ZX81 graphics.
Re: ZXSimulator
Posted: Sat Apr 04, 2020 1:27 am
by bwinkel67
New version:
- zx.zip
- (22 KiB) Downloaded 157 times
This now implements PLOT, UNPLOT, and SCROLL. Note that PLOT/UNPLOT has one issue shown in the picture below:
This will not be easy to fix. On a ZX81 a plot will clear out all 4 plot areas but a second plot does not clear out the first plot. You see on mine that when I do plot over the "V" letter it keeps parts of it there. If I clear out the entire character square I would also clear out any other plot squares which is wrong. No idea how to fix it without having to keep around lots of info I don't want like where each character is printed on the screen.
This is the code:
Code: Select all
5 PRINT "ABCDEFGHIJKLMNOPQRSTUVWXYZ012345"
10 FOR I=0 TO 50
20 PLOT I,I
30 NEXT I
Interestingly, when I change it to this:
Code: Select all
5 PRINT "ABCDEFGHIJKLMNOPQRSTU\'.WXYZ012345"
10 FOR I=0 TO 50
20 PLOT I,I
30 NEXT I
It does not wipe that character away, so it knows the difference between graphics characters and text. So maybe I can find a way to peek a screen location to see if any part of it has something in it but it's not in some block pattern.