|
1 | | -7800basic - a Basic Compiler for the Atari 7800 |
2 | | - |
3 | | -Legal Stuff |
4 | | ------------ |
5 | | - |
6 | | - 7800basic is created by Michael Saarna. |
7 | | - 7800basic is derived from the batari Basic compiler for the 2600, |
8 | | - which was created by Fred Quimby. (aka batari) |
9 | | - |
10 | | - Additional code is courtesy... |
11 | | - -Bruce Tomlin (sign7800) |
12 | | - -the zlib/libpng team |
13 | | - -the dasm team |
14 | | - |
15 | | - See the LICENSE.txt file for details on licensing. |
16 | | - |
17 | | ------------------------------------------------------------------------------ |
18 | | - |
19 | | -WHAT IT IS? |
20 | | ------------ |
21 | | - |
22 | | -7800basic is a BASIC-like language for creating Atari 7800 games. It is a |
23 | | -compiled language that runs on a computer, and it creates a binary file that |
24 | | -can be run with an Atari 7800 emulator, or the binary file may be used to |
25 | | -make a cartridge that will operate on a real Atari 7800. |
26 | | - |
27 | | -If you find any bugs, please report them via github. |
28 | | - |
29 | | - |
30 | | -GETTING STARTED |
31 | | ---------------- |
32 | | -Extract the contents of the zip file to a new directory. The name of the |
33 | | -directory doesn't matter. The examples in this guide assume "c:\7800basic" |
34 | | -for Windows, and $HOME/7800basic for Unix. |
35 | | - |
36 | | -Windows: |
37 | | --------- |
38 | | -7800basic is distributed as a single zip file. Download the latest zip |
39 | | -file and unzip to whichever location you desire to use. Make sure your |
40 | | -unzip utility creates the expected subdirectories (/docs, /includes, ...) |
41 | | -rather than sticking all of the files into one directory. |
42 | | - |
43 | | -To point Windows at the 7800basic directory, you should double-click the |
44 | | -provided install_win.bat file, and follow the instructions presented. |
45 | | - |
46 | | -If install_win.bat reports failure, you should manually set the following |
47 | | -variables to point at your 7800basic directory. |
48 | | - |
49 | | -e.g.: set basic7800dir=c:\7800basic |
50 | | - set PATH=%PATH%;c:\7800basic |
51 | | - |
52 | | -This is accomplished differently, depending on your version of Windows. This |
53 | | -info is easily found on the Internet - https://tinyurl.com/yx756dug |
54 | | - |
55 | | -Once the above is done, switch to a folder containing a 7800basic source file |
56 | | -and type: |
57 | | - |
58 | | - 7800bas filename |
59 | | - |
60 | | -where filename is the name of the BASIC source file you wish to compile. The |
61 | | -project folder can be any folder you create to store your files. |
62 | | - |
63 | | -To test your installation, several sample programs are included in the |
64 | | -"samples" folder. Switch to this folder and type: |
65 | | - |
66 | | - 7800bas simple.bas |
67 | | - |
68 | | -If successful, a file called simple.bas.a78 will be generated that you can |
69 | | -run on an emulator, or add to a flash cart. The sample program is not very |
70 | | -interesting, but note how simple it was to write. Open sample.bas in a text |
71 | | -editor and take a look at how it was written. |
72 | | - |
73 | | - |
74 | | -Getting Started with Linux/OS X/other Unixes |
75 | | --------------------------------------------- |
76 | | -This version of 7800basic comes bundled with 32-bit and 64-bit binaries for |
77 | | -both OS X and Linux. If you wish to run 7800basic on another Unix, you'll |
78 | | -need to rebuild the binaries. (refer to the provided COMPILE.txt document) |
79 | | - |
80 | | -The rest of this section assumes you understand what directory you saved |
81 | | -the 7800basic archive to, how to extract the archive file, how to open a |
82 | | -Unix shell, and how to use the "cd" command to move into in directories. |
83 | | - |
84 | | - |
85 | | -7800basic for Unix - the Easy Way |
86 | | ---------------------------------- |
87 | | - 1. download and unzip/untar the 7800basic distribution to your home |
88 | | - directory, ensuring the directory structure is maintained. I.e. there |
89 | | - should be "includes" and "samples" subdirectories. |
90 | | - |
91 | | - 2. open a terminal window, and "cd" to the unzipped 7800basic directory. |
92 | | - |
93 | | - 3. run the installer and follow the instructions: ./install_ux.sh |
94 | | - |
95 | | -7800basic for Unix - Manual_Installation |
96 | | ----------------------------------------- |
97 | | - 1. download and unzip/untar the 7800basic distribution to your home |
98 | | - directory, ensuring the directory structure is maintained. I.e. there |
99 | | - should be "includes" and "samples" subdirectories. |
100 | | - |
101 | | - 2. ensure these two environment variables are set... |
102 | | - |
103 | | - export bas7800dir=$HOME/7800basic |
104 | | - export PATH=$bas7800dir:$PATH |
105 | | - |
106 | | - ...You should substitute the actual location of the unzipped 7800basic |
107 | | - distribution on your system in the first line. |
108 | | - |
109 | | - 3. compile your basic program using the 7800basic.sh script. |
110 | | - |
111 | | - e.g. 7800basic.sh myprogram.bas |
112 | | - |
113 | | - It should produce a binary named after the basic program, but ending |
114 | | - with the file extension ".bin". |
115 | | - |
116 | | - If it doesn't work, ensure you have set the bas7800dir and PATH variables |
117 | | - correctly. |
118 | | - |
119 | | -How It Works |
120 | | ------------- |
121 | | -Not unlike other compilers, 7800 BASIC uses a 4-step compilation process: |
122 | | - |
123 | | -1. Preprocess... |
124 | | - The preprocessor takes your basic code, and reformats and tokenizes it |
125 | | - so the compiler can understand it. Certain errors can be caught at this |
126 | | - stage. |
127 | | - |
128 | | -2. Compile... |
129 | | - The compiler converts your Basic code into assembly language. It will |
130 | | - create a temporary file called 7800.asm. The basic code is preserved as |
131 | | - comments in this file so that those wishing to study assembly language |
132 | | - can learn by studying how the Basic code was converted. |
133 | | - |
134 | | -3. Link... |
135 | | - The linker splits the basic code into sections if needed, then |
136 | | - concatenates them, along with the kernel, modules and compilation |
137 | | - directives into a composite assembly language file. |
138 | | - |
139 | | -[3a. Optimize...] |
140 | | - An optional stage is a peephole optimizer that looks for redundant and |
141 | | - unnecessary code in the composite assembly file. |
142 | | - |
143 | | -4. Assemble... |
144 | | - The assembler converts assembly language to a binary file that contains |
145 | | - machine code that can run in an emulator or on a real Atari 7800. |
146 | | - |
| 1 | +7800basic - a Basic Compiler for the Atari 7800 |
| 2 | +
|
| 3 | +Legal Stuff |
| 4 | +----------- |
| 5 | +
|
| 6 | + 7800basic is created by Michael Saarna. |
| 7 | + 7800basic is derived from the batari Basic compiler for the 2600, |
| 8 | + which was created by Fred Quimby. (aka batari) |
| 9 | +
|
| 10 | + Additional code is courtesy... |
| 11 | + -Bruce Tomlin (sign7800) |
| 12 | + -the zlib/libpng team |
| 13 | + -the dasm team |
| 14 | +
|
| 15 | + See the LICENSE.txt file for details on licensing. |
| 16 | + |
| 17 | +----------------------------------------------------------------------------- |
| 18 | +
|
| 19 | +WHAT IT IS? |
| 20 | +----------- |
| 21 | +
|
| 22 | +7800basic is a BASIC-like language for creating Atari 7800 games. It is a |
| 23 | +compiled language that runs on a computer, and it creates a binary file that |
| 24 | +can be run with an Atari 7800 emulator, or the binary file may be used to |
| 25 | +make a cartridge that will operate on a real Atari 7800. |
| 26 | +
|
| 27 | +If you find any bugs, please report them via github. |
| 28 | +
|
| 29 | +
|
| 30 | +GETTING STARTED |
| 31 | +--------------- |
| 32 | +Extract the contents of the zip file to a new directory. The name of the |
| 33 | +directory doesn't matter. The examples in this guide assume "c:\7800basic" |
| 34 | +for Windows, and $HOME/7800basic for Unix. |
| 35 | +
|
| 36 | +Windows: |
| 37 | +-------- |
| 38 | +7800basic is distributed as a single zip file. Download the latest zip |
| 39 | +file and unzip to whichever location you desire to use. Make sure your |
| 40 | +unzip utility creates the expected subdirectories (/docs, /includes, ...) |
| 41 | +rather than sticking all of the files into one directory. |
| 42 | +
|
| 43 | +To point Windows at the 7800basic directory, you should double-click the |
| 44 | +provided install_win.bat file, and follow the instructions presented. |
| 45 | +
|
| 46 | +If install_win.bat reports failure, you should manually set the following |
| 47 | +variables to point at your 7800basic directory. |
| 48 | +
|
| 49 | +e.g.: set basic7800dir=c:\7800basic |
| 50 | + set PATH=%PATH%;c:\7800basic |
| 51 | +
|
| 52 | +This is accomplished differently, depending on your version of Windows. This |
| 53 | +info is easily found on the Internet - https://tinyurl.com/yx756dug |
| 54 | +
|
| 55 | +Once the above is done, switch to a folder containing a 7800basic source file |
| 56 | +and type: |
| 57 | +
|
| 58 | + 7800bas filename |
| 59 | +
|
| 60 | +where filename is the name of the BASIC source file you wish to compile. The |
| 61 | +project folder can be any folder you create to store your files. |
| 62 | +
|
| 63 | +To test your installation, several sample programs are included in the |
| 64 | +"samples" folder. Switch to this folder and type: |
| 65 | +
|
| 66 | + 7800bas simple.bas |
| 67 | +
|
| 68 | +If successful, a file called simple.bas.a78 will be generated that you can |
| 69 | +run on an emulator, or add to a flash cart. The sample program is not very |
| 70 | +interesting, but note how simple it was to write. Open sample.bas in a text |
| 71 | +editor and take a look at how it was written. |
| 72 | +
|
| 73 | +
|
| 74 | +Getting Started with Linux/OS X/other Unixes |
| 75 | +-------------------------------------------- |
| 76 | +This version of 7800basic comes bundled with 32-bit and 64-bit binaries for |
| 77 | +both OS X and Linux. If you wish to run 7800basic on another Unix, you'll |
| 78 | +need to rebuild the binaries. (refer to the provided COMPILE.txt document) |
| 79 | +
|
| 80 | +The rest of this section assumes you understand what directory you saved |
| 81 | +the 7800basic archive to, how to extract the archive file, how to open a |
| 82 | +Unix shell, and how to use the "cd" command to move into in directories. |
| 83 | +
|
| 84 | +
|
| 85 | +7800basic for Unix - the Easy Way |
| 86 | +--------------------------------- |
| 87 | + 1. download and unzip/untar the 7800basic distribution to your home |
| 88 | + directory, ensuring the directory structure is maintained. I.e. there |
| 89 | + should be "includes" and "samples" subdirectories. |
| 90 | +
|
| 91 | + 2. open a terminal window, and "cd" to the unzipped 7800basic directory. |
| 92 | +
|
| 93 | + 3. run the installer and follow the instructions: ./install_ux.sh |
| 94 | +
|
| 95 | +7800basic for Unix - Manual_Installation |
| 96 | +---------------------------------------- |
| 97 | + 1. download and unzip/untar the 7800basic distribution to your home |
| 98 | + directory, ensuring the directory structure is maintained. I.e. there |
| 99 | + should be "includes" and "samples" subdirectories. |
| 100 | +
|
| 101 | + 2. ensure these two environment variables are set... |
| 102 | +
|
| 103 | + export bas7800dir=$HOME/7800basic |
| 104 | + export PATH=$bas7800dir:$PATH |
| 105 | +
|
| 106 | + ...You should substitute the actual location of the unzipped 7800basic |
| 107 | + distribution on your system in the first line. |
| 108 | +
|
| 109 | + 3. compile your basic program using the 7800basic.sh script. |
| 110 | +
|
| 111 | + e.g. 7800basic.sh myprogram.bas |
| 112 | +
|
| 113 | + It should produce a binary named after the basic program, but ending |
| 114 | + with the file extension ".bin". |
| 115 | +
|
| 116 | + If it doesn't work, ensure you have set the bas7800dir and PATH variables |
| 117 | + correctly. |
| 118 | +
|
| 119 | +How It Works |
| 120 | +------------ |
| 121 | +Not unlike other compilers, 7800 BASIC uses a 4-step compilation process: |
| 122 | +
|
| 123 | +1. Preprocess... |
| 124 | + The preprocessor takes your basic code, and reformats and tokenizes it |
| 125 | + so the compiler can understand it. Certain errors can be caught at this |
| 126 | + stage. |
| 127 | +
|
| 128 | +2. Compile... |
| 129 | + The compiler converts your Basic code into assembly language. It will |
| 130 | + create a temporary file called 7800.asm. The basic code is preserved as |
| 131 | + comments in this file so that those wishing to study assembly language |
| 132 | + can learn by studying how the Basic code was converted. |
| 133 | +
|
| 134 | +3. Link... |
| 135 | + The linker splits the basic code into sections if needed, then |
| 136 | + concatenates them, along with the kernel, modules and compilation |
| 137 | + directives into a composite assembly language file. |
| 138 | +
|
| 139 | +[3a. Optimize...] |
| 140 | + An optional stage is a peephole optimizer that looks for redundant and |
| 141 | + unnecessary code in the composite assembly file. |
| 142 | +
|
| 143 | +4. Assemble... |
| 144 | + The assembler converts assembly language to a binary file that contains |
| 145 | + machine code that can run in an emulator or on a real Atari 7800. |
| 146 | +
|
0 commit comments