git @ Cat's Eye Technologies Shelta / 64d22d5
Add doc explaining latest work. Bump version number to 1.2. catseye 9 years ago
4 changed file(s) with 93 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
1515 executable.
1717 For more information, see the files in the `doc` directory of this distribution.
19 Note that the Shelta executables run fine under DOSBox, but have some
20 mysterious problems when running under FreeDOS under both QEMU and v86, and
21 often hang. (Is it possible FreeDOS has some issues with file redirection?)
00 @echo off
2 REM v1.1.2009.0307 (c)1999-2009 Chris Pressey, Cat's-Eye Technologies.
2 REM v1.2-2013.1130 (c)1999-2013 Chris Pressey, Cat's-Eye Technologies.
33 REM A 'make'-like utility for Shelta compilers, as an MS-DOS batchfile.
55 REM -- Change the following lines to tailor what libraries are
0 Another four years, and here I am again.
2 Perhaps it's simply bad luck to name a programming language after a spoken
3 human language. After all, it didn't seem to work too well for the Plain
4 English folks.
6 Well anyway. Lately I've been trying to put my languages and things online.
7 The rationale is straightfoward enough; Javascript and HTML5 are mature
8 enough to make it possible now, and people by their nature are lazy. If, to
9 try something out, you need to install this, that, and the other on your
10 system and configure them, chances are you'll be like, ehh. Don't feel like
11 it right now. But if it's just on a web page, you don't have that obstacle.
13 And my thoughts turned to my DOS stuff, because one of the more burdensome
14 things to ask the user to install is a system emulator.
16 I had come across jpc some time earlier, but I'd really prefer something in
17 Javascript, just because of the poor security track record Java has had
18 lately. (Guys, the whole idea was that you didn't have to trust a Java
19 applet, because it would be running in a virtual machine that didn't allow...
20 yeah, anyway) I looked a bit more and found jslinux, but it isn't open
21 source. So I looked a bit more and eventually found v86. It's not quite
22 as mature as the others, but for simple things it seems to work fine, and
23 as a nice bonus it's BSD-licensed, too.
25 So I started preparing a FreeDOS boot disk image with the Shelta distribution
26 on it. To my surprise, it was flakey. Sometimes the compilers would work,
27 and sometimes they'd hang. Sometimes the bootstrapped compiler seemed to
28 work better than the Nasm one, and sometimes it didn't. The problems
29 persisted after I re-assembled the source with the latest version of Nasm,
30 which did generate slightly different code, but only slightly (only two
31 instructions in were changed, and the code was the same size.)
33 This was all somewhat surprising. The thing is, it worked perfectly in DOSBox
34 (which is probably what I was developing it under in 2009.) And the same
35 flakiness was happening under both QEMU and v86, leading me to believe it was
36 a problem with FreeDOS. I tried FreeDOS version 1.1 as well as 1.0 -- no
37 difference in behaviour. I briefly looked for a web-enabled DOSBox, and it
38 turns out there are two: jdosbox, which is Java, and a gigantic (~4M) jarfile
39 besides, and jsdosbox, which is a GWT hack applied to jdosbox, which is
40 frankly really unappealing.
42 So I turned my attention back to FreeDOS, determined to get Shelta working
43 under it under v86.
45 After some experimentation, I figured it must be INT 21h/ah=07h that FreeDOS
46 was having problems with. It's the legacy DOS function for reading a
47 character from standard input. Shelta uses it because it's significantly
48 fewer instructions than the "normal" DOS input function.
50 Thing is, INT 21h/ah=07h doesn't have a way to indicate EOF. That's why
51 Shelta has traditionally insisted that Shelta source code end with a zero
52 byte (ASCII NUL character,) so that it can tell when the source has ended.
54 If the Shelta compiler wasn't consistently reading that character, that could
55 explain the hanging.
57 But after more experimentation, I couldn't tell what was wrong with
58 FreeDOS'es implementation of this function. I even looked at the FreeDOS
59 source code, but it wasn't too helpful; it seems to be implemented in terms
60 of the "normal" DOS read function.
62 It wasn't until I tried replacing the check for the NUL character with a
63 different character that it worked. Yes -- FreeDOS sometimes has trouble
64 reading NUL characters using this function. I'm not sure why. Since the
65 function is for reading from standard input, and in the absence of redirection
66 standard input means the keyboard, and on the keyboard you can type a NUL
67 (Ctrl+@), and since it works on both MS-DOS whence I originally developed
68 Shelta and DOSBox -- this is probably a bug in FreeDOS. It might be confused
69 about standard input not being open in "binary mode" or something. I'd submit
70 a bug report, but this is possibly the only piece of software on the planet
71 that is affected...
73 Anyway, solving the problem after realizing this was simple. Instead of
74 insisting Shelta programs end with a NUL, we now insist that they end with
75 everybody's favourite ASCII character, the VERTICAL TAB. And we apologize
76 to all those Shelta users who have huge code bases written in Shelta in which
77 vertical tabs are used to critical effect in some way I can't imagine. For
78 the rest of us, the SHELTA.BAT batchfile handles all this for us, so the change
79 is pretty much transparent.
81 The new check for vertical-tab-as-EOF does add a few bytes to the compilers,
82 but the Nasm version is still under 512 bytes.
84 And with those small changes, the Shelta language is now at version 1.2.
86 Happy bootstrapping -- in your browser!
87 Chris Pressey
88 November 30, 2013
89 Vancouver, BC
00 ; shelta86.s
1 ; v1.1.2009.0307
2 ; (c)2009 Chris Pressey, Cat's Eye Technologies.
1 ; v1.2-2013.1130
2 ; (c)2009-2013 Chris Pressey, Cat's Eye Technologies. All rights reserved.
44 ; Implements an assembler/compiler for the Shelta language, in 8086 machine
55 ; language, in the format of the NASM assembler.