mirror of
https://github.com/dschmenk/PLASMA.git
synced 2024-06-01 03:41:34 +00:00
Compare commits
123 Commits
912a865a25
...
8344f18612
Author | SHA1 | Date | |
---|---|---|---|
|
8344f18612 | ||
|
2b9eb6a5fc | ||
|
c23cb6d239 | ||
|
1d099df299 | ||
|
7aeda2d98b | ||
|
d90b7ba69d | ||
|
2eea9e585c | ||
|
0ab16d4877 | ||
|
7d669e97b8 | ||
|
a1c49d2705 | ||
|
578d002b8c | ||
|
7527a5a7d3 | ||
|
b3d1dfed7d | ||
|
0190c2c3cd | ||
|
6f61b4ae8a | ||
|
e02c068706 | ||
|
e7ce06fe62 | ||
|
90cfcd2840 | ||
|
1e368ced63 | ||
|
6e45185cfd | ||
|
db2f9eecc3 | ||
|
5eefe74c6b | ||
|
15b14899f4 | ||
|
d5803ceba9 | ||
|
34624f3162 | ||
|
b1d463f4e4 | ||
|
d3b9fe14a0 | ||
|
6efc2b1a98 | ||
|
a89b1b9b40 | ||
|
9038c7e649 | ||
|
f5c562eafb | ||
|
2f7c1b3e59 | ||
|
631034034c | ||
|
c64843b1e1 | ||
|
88960e6745 | ||
|
b4ab21f80c | ||
|
9e0f0ecd0f | ||
|
a8584753e0 | ||
|
3e91616666 | ||
|
ca95dd356d | ||
|
6211cb31a3 | ||
|
260ea6fe6b | ||
|
a6c94440a2 | ||
|
c6220f389d | ||
|
0743eba40c | ||
|
2e4364f9c6 | ||
|
ab57909099 | ||
|
b4c9c93c2e | ||
|
dbd1f336f4 | ||
|
51daf7e8ff | ||
|
2476b85fa8 | ||
|
974a7d63f6 | ||
|
fbcfae86e0 | ||
|
a818dec4aa | ||
|
29498dc6e7 | ||
|
a587aa477f | ||
|
5d5f60c2d5 | ||
|
1fb7960a1b | ||
|
a08bc126a2 | ||
|
ab3b91ad78 | ||
|
a9b4492504 | ||
|
66d674d494 | ||
|
8c2e3eaa5c | ||
|
e2f29ffb2a | ||
|
a717f15e02 | ||
|
42be6c6f80 | ||
|
7c9e24d332 | ||
|
80c8cd4e6a | ||
|
9b749d6f99 | ||
|
87c261bf3d | ||
|
67960518b0 | ||
|
211ce933b2 | ||
|
13f88a8ad3 | ||
|
f25f4c6dc7 | ||
|
969277f8ae | ||
|
a840f2b2ac | ||
|
cdfb59846f | ||
|
ee5c66e710 | ||
|
c9f081e1b3 | ||
|
b3b92b39c6 | ||
|
734d9a50c6 | ||
|
1a7f7bec62 | ||
|
7cb4534efb | ||
|
30437ce21a | ||
|
016b31a01c | ||
|
350ab5b783 | ||
|
96bac30316 | ||
|
1a3e8eb3da | ||
|
23a5e7840a | ||
|
81fa548f52 | ||
|
153e6f6f8b | ||
|
3dd07beaf8 | ||
|
ed295b0599 | ||
|
ff7c35deb9 | ||
|
b93b4d7c75 | ||
|
c2773d208c | ||
|
a9cadd9fda | ||
|
8d92e854ae | ||
|
f3ac3035ba | ||
|
bfb3eb4672 | ||
|
2434d262c5 | ||
|
547bdcc2ad | ||
|
6c6d6e664d | ||
|
76c85e350c | ||
|
e2163c856e | ||
|
96d4e3eb02 | ||
|
12de12b0b4 | ||
|
d0fc4120c9 | ||
|
3fcbf48665 | ||
|
92be9cd631 | ||
|
2a475a01e2 | ||
|
2578b1a3fb | ||
|
4364319176 | ||
|
da404a8dfa | ||
|
68e31ccc30 | ||
|
da0bf22b2e | ||
|
e14eda8617 | ||
|
3166341e96 | ||
|
c61a787271 | ||
|
637b1d8248 | ||
|
9ff1695012 | ||
|
86ef49cc5e | ||
|
8f3780617b |
15
README.md
15
README.md
|
@ -1,15 +1,10 @@
|
|||
[Get a preview of FORTH coming to PLASMA 2.1](https://github.com/dschmenk/PLASMA/blob/master/doc/PLFORTH.md)
|
||||
# 2/25/2024 PLASMA 2.11 Available!
|
||||
|
||||
# 3/24/2023 PLASMA 2.0 Available!
|
||||
[Download and read the Release Notes](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%202.1.md)
|
||||
|
||||
Only 5 years in the making!
|
||||
[Change List](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%202.1.md#changes-in-plasma-for-211-release)
|
||||
|
||||
[Download and read the Release Notes](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%202.0.md)
|
||||
|
||||
[Change List](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%202.0.md#changes-in-plasma-for-20-release)
|
||||
|
||||
# 4/29/2018 PLASMA 1.2 Available!
|
||||
[Download and read the Release Notes](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%201.2.md)
|
||||
[Get single boot floppy of FORTH for PLASMA 2.11](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLFORTH.PO)
|
||||
|
||||
# The PLASMA Programming Language
|
||||
|
||||
|
@ -28,8 +23,6 @@ Different projects have led to the architecture of PLASMA, most notably Apple Pa
|
|||
|
||||
<!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
|
||||
|
||||
- [3/24/2023 PLASMA 2.0 Available!](#3242023-plasma-20-available)
|
||||
- [4/29/2018 PLASMA 1.2 Available!](#4292018-plasma-12-available)
|
||||
- [The PLASMA Programming Language](#the-plasma-programming-language)
|
||||
- [Contents](#contents)
|
||||
- [Build Environment](#build-environment)
|
||||
|
|
|
@ -13,19 +13,13 @@ There are quite a few missing word that a standard FORTH would have. Mostly due
|
|||
|
||||
## PLFORTH built-in words
|
||||
|
||||
![VLIST](forthwords.png)
|
||||
![WORDS](forthwords.png)
|
||||
|
||||
## PLFORTH specific words
|
||||
|
||||
### Words for looking at internal structures:
|
||||
|
||||
`SHOW xxxx`: Displays the decompiled words making up the definition of `xxxx`
|
||||
|
||||
`SHOWSTACK`: Displays the data stack
|
||||
|
||||
`SHOWRSTACK`: Displays the return stack. Note: PLFORTH uses a software defined return stack, this is not the hardware stack
|
||||
|
||||
`SHOWHASH`: Display the hash table depth counts. Used to debug the efficacy of the hash algorithm
|
||||
`.RS`: Displays the return stack. Note: PLFORTH uses a software defined return stack, this is not the hardware stack
|
||||
|
||||
### Words for tracing and single stepping execution:
|
||||
|
||||
|
@ -63,7 +57,9 @@ While running code, `<CTRL-C>` will break out and return to the interpreter.
|
|||
|
||||
`SRC" ssss"`: Source file `ssss` as input. Can be nested
|
||||
|
||||
`ENDSRC`: End sourcing file as input if stack flag non-zero
|
||||
`?ENDSRC`: End sourcing file as input if stack flag non-zero
|
||||
|
||||
`ENDSRC`: End sourcing file as input
|
||||
|
||||
### Words for compiler modes:
|
||||
|
||||
|
@ -73,19 +69,29 @@ While running code, `<CTRL-C>` will break out and return to the interpreter.
|
|||
|
||||
### Word for converting string to number:
|
||||
|
||||
`?NUM`: Convert string and length to number, returning number and valid flag
|
||||
`NUM?`: Convert string and length to number, returning number and valid flag
|
||||
|
||||
Numbers entered with a preceeding `$` will be interpreted as hex values
|
||||
|
||||
### Words for displaying hex numbers
|
||||
|
||||
`$.`: Display TOS word in hex with leading `$`
|
||||
|
||||
`C$.`: Display TOS byte in hex with leading `$`
|
||||
|
||||
## Debugging vs Performance
|
||||
|
||||
PLFORTH defaults to compiling using ITC (Indirect Threaded Code). This supports a list of inspection and debugging features while developing programs and scripts. However, the compiler can easily switch to PBC (PLASMA Byte Code) to greatly improve performance, but most of the debugging tools are lost. ITC compiled words and PBC compiled words can be intermingled and call each other seemlessly. PLASMA Byte Code is a direct match to many low-level FORTH constructs.
|
||||
|
||||
## Hi-Res Graphics
|
||||
Due to the way the Apple II implements Hi-Res graphics, a stub loader is required to reserve the pages used.
|
||||
## Graphics
|
||||
Due to the way the Apple II implements Hi-Res, Lo-Res and Double Lo-Res graphics, a stub loader is required to reserve the pages used.
|
||||
|
||||
`HRFORTH`: Reserve HGR page 1 before launching PLFORTH
|
||||
|
||||
`HR2FORTH`: Reserve HGR pages 1 and 2 before launching PLFORTH
|
||||
|
||||
`TX2FORTH`: Reserve GR and DGR pages 1 and 2 before launching PLFORTH
|
||||
|
||||
## Scripts
|
||||
|
||||
There are a few useful scripts located in the `scripts` directory. By far the most useful is `plasma.4th`
|
||||
|
@ -102,12 +108,16 @@ There are a few useful scripts located in the `scripts` directory. By far the mo
|
|||
|
||||
`EDIT" ssss"`: Edit file `ssss`
|
||||
|
||||
## Caveats
|
||||
## Command line options
|
||||
|
||||
This is definitely a Work-In-Progress. There are still a few places where I'm unsure about the proper implementation of some words, especially the more esoteric compiler constructs. It also looks suspiciously like an early '80s wordset, as that is what I'm most familiar with.
|
||||
`-F`: Fast flag (like `PCB` as first command)
|
||||
|
||||
`-T`: Trace flag (like `TRON` as first command)
|
||||
|
||||
`SCRIPT NAME`: Soure filename to execute
|
||||
|
||||
## Links
|
||||
|
||||
Here is a (worse than usual) video running through some examples: https://youtu.be/picPyXAk77I?si=Td2En5Z3oxVTzh0z
|
||||
Here is a (worse than usual) video running through some examples. This was a preliminary release so the final is a bit different: https://youtu.be/picPyXAk77I?si=Td2En5Z3oxVTzh0z
|
||||
|
||||
A pre-configures ProDOS floppy image barely able to run PLFORTH is available here: https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLFORTH.PO
|
||||
A pre-configured ProDOS floppy image able to run and a few utilities is available here: https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLFORTH.PO
|
||||
|
|
|
@ -1,34 +1,40 @@
|
|||
# PLASMA Version 2.0
|
||||
# PLASMA Version 2.1
|
||||
|
||||
Welcome to PLASMA: the Grand Unifying Platform for the Apple 1, ][, and ///.
|
||||
|
||||
Download the five disk images:
|
||||
|
||||
[PLASMA 2.0 800K Full System](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2.2mg?raw=true)
|
||||
[PLASMA 2.1 800K Full System](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1.2mg?raw=true)
|
||||
|
||||
[PLASMA 2.0 System and ProDOS Boot](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-SYS.PO?raw=true)
|
||||
[PLASMA 2.1 ProDOS Boot & Install](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-INST.po?raw=true)
|
||||
|
||||
[PLASMA 2.0 Build Tools](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-BLD.PO?raw=true)
|
||||
[PLASMA 2.1 System Libraries](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-SYS.po?raw=true)
|
||||
|
||||
[PLASMA 2.0 Demos](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-DEM.PO?raw=true)
|
||||
[PLASMA 2.1 Build Tools](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-BLD.po?raw=true)
|
||||
|
||||
[PLASMA 2.0 TCP/IP network modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-INET.PO?raw=true)
|
||||
[PLASMA 2.1 Demos](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-DEMOS.po?raw=true)
|
||||
|
||||
[PLASMA 2.0 Apple /// SOS Mame Boot and SANE floating point modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-FPSOS.PO?raw=true)
|
||||
[PLASMA 2.1 TCP/IP network modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-INET.po?raw=true)
|
||||
|
||||
[PLASMA 2.0 Alpha1 Apple /// Mame hard disk image](https://github.com/dschmenk/PLASMA/blob/master/images/apple/apple3.hd?raw=true)
|
||||
[PLASMA 2.1 Apple /// SOS Mame Boot and SANE floating point modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-FPSOS.po?raw=true)
|
||||
|
||||
PLASMA can be run from floppies, System in Drive 1, and Build or Demos in Drive 2. Mass storage is the recommended installation that looks like (replacing HARDISK with your volume name of choice):
|
||||
[PLASMA 2.1 Apple /// SOS Mame Boot](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-A3MAME.PO?raw=true)
|
||||
|
||||
System Files => /HARDISK/PLASMA/
|
||||
[PLASMA 2.1 Apple /// Mame hard disk image](https://github.com/dschmenk/PLASMA/blob/master/images/apple/apple3.hd?raw=true)
|
||||
|
||||
[PLASMA 2.1 PLFORTH stand-alone boot](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLFORTH.PO?raw=true)
|
||||
|
||||
PLASMA now has a ProDOS hard disk install script. Mass storage is the recommended installation that looks like (replacing HARDISK with your volume name of choice) if you want to copy files yourself:
|
||||
|
||||
Boot & System Files => /HARDISK/PLASMA/
|
||||
|
||||
Build Files => /HARDISK/PLASMA/BLD/
|
||||
|
||||
Demo Files => /HARDISK/PLASMA/DEMOS/
|
||||
|
||||
SANE files => /HARDISK/PLASMA/SYS
|
||||
Floating Point SANE Files => /HARDISK/PLASMA/SYS
|
||||
|
||||
INET files => /HARDDISK/PLASMA/SYS
|
||||
INET Files => /HARDDISK/PLASMA/SYS
|
||||
|
||||
Use the System Utilities to copy the floppy images into the above mentioned directories.
|
||||
|
||||
|
@ -46,7 +52,7 @@ PLASMA can utilize the 16 bit features of the 65802 and 65816 processors to impr
|
|||
|
||||
## Apple ///
|
||||
|
||||
The Apple /// gets the environment it always wanted: The ability to navigate the filesystem with a command line interface. The Apple /// always boots from the floppy drive, even if a hard disk is installed. `PLASMA2-FPSOS.PO` is an Apple 3 bootable disk containing the SOS.DRIVER configured for the [Apple 3 Ready-To-Run Mame environment](https://github.com/datajerk/apple3rtr). `apple3.hd` is the pre-installed PLASMA hard disk image set up for [Apple 3 Ready-to-Run](https://github.com/datajerk/apple3rtr). For a physical Apple 3, the PLASMA2-FPSOS.PO floppy should be updated with the SOS.DRIVER configured for the machine. Once booted, type `S /HARDISK/PLASMA` (or your install directory of choice) to change to, and set, the system directory. This can be automated by creating an `AUTORUN` file on the boot floppy with the above command in it.
|
||||
The Apple /// gets the environment it always wanted: The ability to navigate the filesystem with a command line interface. The Apple /// always boots from the floppy drive, even if a hard disk is installed. `PLASMA2-A3MAME.PO` is an Apple 3 bootable disk containing the SOS.DRIVER configured for the [Apple 3 Ready-To-Run Mame environment](https://github.com/datajerk/apple3rtr). `apple3.hd` is the pre-installed PLASMA hard disk image set up for [Apple 3 Ready-to-Run](https://github.com/datajerk/apple3rtr). For a physical Apple 3, the PLASMA2-FPSOS.PO floppy should be updated with the SOS.DRIVER configured for the machine. Once booted, type `S /HARDISK/PLASMA` (or your install directory of choice) to change to, and set, the system directory. This can be automated by creating an `AUTORUN` file on the boot floppy with the above command in it.
|
||||
|
||||
## PLASMA Command Line Shell
|
||||
|
||||
|
|
352
doc/Version 2.1.md
Normal file
352
doc/Version 2.1.md
Normal file
|
@ -0,0 +1,352 @@
|
|||
# PLASMA Version 2.11
|
||||
|
||||
Welcome to PLASMA: the Grand Unifying Platform for the Apple 1, ][, and ///.
|
||||
|
||||
Version 2.11 is a minor update to address the relocating loader for EDASM generated modules with 8 bit fixups. All modules up to now have been generated by PLASM and only use 16 bit fixups. Mostly usefull for future modules built with EDASM. Check out the Assembly Language Toolkit below.
|
||||
|
||||
If you already have 2.1 installed, here are the updated files:
|
||||
|
||||
[PLASMA 2.11 Update](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.11-UPD.po)
|
||||
|
||||
Download the full 2.11 disk image set:
|
||||
|
||||
[PLASMA 2.11 HD Full System](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA2.2mg)
|
||||
|
||||
[PLASMA 2.11 800K Full System](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1.po)
|
||||
|
||||
[PLASMA 2.11 ProDOS Boot & Install](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-INST.po)
|
||||
|
||||
[PLASMA 2.1 System Libraries](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-SYS.po)
|
||||
|
||||
[PLASMA 2.11 Build Tools](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-BLD.po)
|
||||
|
||||
[PLASMA 2.1 Demos](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-DEMOS.po)
|
||||
|
||||
[PLASMA 2.1 TCP/IP network modules](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-INET.po)
|
||||
|
||||
[PLASMA 2.11 Apple /// SOS and SANE floating point modules](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-FPSOS.po)
|
||||
|
||||
[PLASMA 2.11 Apple /// SOS Mame Boot](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA2-A3MAME.PO)
|
||||
|
||||
[PLASMA 2.11 Apple /// Mame hard disk image](https://github.com/dschmenk/PLASMA/raw/master/images/apple/apple3.hd)
|
||||
|
||||
[PLASMA 2.11 PLFORTH stand-alone boot](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLFORTH.PO)
|
||||
|
||||
[PLASMA 2.11 Assembly Language Toolkit](https://github.com/dschmenk/PLASMA/raw/master/images/apple/ASM-TK.po)
|
||||
|
||||
PLASMA now has a ProDOS hard disk install script. Mass storage is the recommended installation that looks like (replacing HARDISK with your volume name of choice) if you want to copy files yourself:
|
||||
|
||||
Boot & System Files => /HARDISK/PLASMA/
|
||||
|
||||
Build Files => /HARDISK/PLASMA/BLD/
|
||||
|
||||
Demo Files => /HARDISK/PLASMA/DEMOS/
|
||||
|
||||
Floating Point SANE Files => /HARDISK/PLASMA/SYS
|
||||
|
||||
INET Files => /HARDDISK/PLASMA/SYS
|
||||
|
||||
Use the System Utilities to copy the floppy images into the above mentioned directories.
|
||||
|
||||
## Apple 1
|
||||
|
||||
The Apple 1 is a very constrained system compared to the ][ and ///. It is required to have the CFFA1 disk adapter installed to provide file storage and a full 32K od RAM. To get the files onto the CF card required the use of [CiderPress](http://a2ciderpress.com) and they must be placed in one directory. Most PLASMA programs won't work on the Apple 1 due to limited filesystem support, video/graphics capabilities, and lack of audio output. It does, however, make a good place to start when porting PLASMA to a new platform.
|
||||
|
||||
## Apple ][
|
||||
|
||||
To boot directly into PLASMA, you will need to put the system files in the root prefix of the boot device and make sure PLASMA.SYSTEM is the first SYSTEM file in the directory. Otherwise, start PLASMA.SYSTEM from your program launcher of choice. All Apple ][ models with 64K and two floppy drives are supported up to a maxed out IIGS with accelerator and hard drive.
|
||||
|
||||
#### 65802/65816 Support
|
||||
|
||||
PLASMA can utilize the 16 bit features of the 65802 and 65816 processors to improve performance of the PLASMA VM operation. This is transparent to the programmer/user and doesn't make any additional memory or capabilities available to PLASMA. PLASMA will automatically run the most optimal VM for your configuration.
|
||||
|
||||
## Apple ///
|
||||
|
||||
The Apple /// gets the environment it always wanted: The ability to navigate the filesystem with a command line interface. The Apple /// always boots from the floppy drive, even if a hard disk is installed. `PLASMA2-A3MAME.PO` is an Apple 3 bootable disk containing the SOS.DRIVER configured for the [Apple 3 Ready-To-Run Mame environment](https://github.com/datajerk/apple3rtr). `apple3.hd` is the pre-installed PLASMA hard disk image set up for [Apple 3 Ready-to-Run](https://github.com/datajerk/apple3rtr). For a physical Apple 3, the PLASMA2-FPSOS.PO floppy should be updated with the SOS.DRIVER configured for the machine. Once booted, type `S /HARDISK/PLASMA` (or your install directory of choice) to change to, and set, the system directory. This can be automated by creating an `AUTORUN` file on the boot floppy with the above command in it.
|
||||
|
||||
## PLASMA Command Line Shell
|
||||
|
||||
PLASMA incorporates a very basic command line shell to facilitate navigating the filesystem and executing both SYSTEM/SOS programs and PLASMA modules. It has a few built-in commands:
|
||||
|
||||
| Command | Operation |
|
||||
|:----------------------------:|-------------------------|
|
||||
| C [PREFIX] | Catalog prefix
|
||||
| P \<PREFIX\> | change to Prefix
|
||||
| / | change to parent prefix
|
||||
| V | show online Volumes
|
||||
| S \<PREFIX\> | set System prefix*
|
||||
| +SOS \<SOS.INTERP\> [PREFIX] | launch SOS interpreter*
|
||||
| -\<SYSTEM PROGRAM\> [PARAMS] | launch SYSTEM program**
|
||||
| +\<PLASMA MODULE\> [PARAMS] | exec PLASMA module
|
||||
```
|
||||
[Optional parameters]
|
||||
<Required parameters>
|
||||
* Apple /// only
|
||||
** Apple ][ only
|
||||
```
|
||||
|
||||
The shell is very brief with error messages. It is meant solely as a way to run programs that accept command line parameters and take up as little memory as possible. It does, however, provide a rich runtime for PLASMA modules.
|
||||
|
||||
## Included Modules
|
||||
|
||||
PLASMA comes with many library modules used by the tools, demos and sample code. The PLASMA system volume must remain in place for the duration of PLASMAs run otherwise it won't be able to find CMD or the system libraries. Probably the most useful included module is the editor. It is used for editing PLASMA source file, assembly source files, or any text file. Execute it with:
|
||||
```
|
||||
+ED [TEXT FILE] [GOTO LINE NUMBER]
|
||||
```
|
||||
The file manipulation utilities to copy, delete, rename, create directories, and change file type and aux type remove the need for external programs to do the same. PLASMA can now be installed with the tools included on the PLASMA2-SYS boot floppy. They are:
|
||||
```
|
||||
+COPY [-R] <SRCPATH>+ <DSTPATH>
|
||||
+DEL [-R] <FILEPATH>
|
||||
+REN <FILENAME> <NEWNAME>
|
||||
+NEWDIR <NEWDIRECTORY>
|
||||
+TYPE <FILENAME> [NEWTYPE [NEWAUX]]
|
||||
+CAT [-R] <FILEPATH]
|
||||
```
|
||||
The ```-R``` option will operate on the directories recursively. Wildcard filenames can be specified with ```'*'``` matching zero or more characters, and ```'?'``` matching any character. When copying files to the current directory, ```=``` can be used as a shortcut.
|
||||
|
||||
## Compiler Modules
|
||||
|
||||
The build disk includes sample source, include files for the system modules, and the PLASMA compiler+optimizer modules. The compiler is invoked with:
|
||||
```
|
||||
+PLASM [-[W][O[2]] <SOURCE FILE> [OUTPUT FILE]
|
||||
```
|
||||
Compiler warnings are enabled with `-W`. The optional optimizer is enabled with `-O` and extra optimizations are enabled with `-O2`. The source code for a few sample programs are included. The big one, `RPNCALC.PLA`, is the sample RPN calculator that uses many of PLASMA's advanced features. The self-hosted compiler is the same compiler as the cross-compiler, just transcribed from C to PLASMA (yes, the self-hosted PLASMA compiler is written in PLASMA). It requires patience when compiling: it is a fairly large and extensive program.
|
||||
|
||||
## Assembly Toolkit
|
||||
|
||||
New for 2.11 is the assembly language toolkit. The PLASMA module was originally architected around the REL file generated by the ProDOS toolkit assembler, EDASM. This minor update fixes the PLASMA relocating loader to handle 8 bit fixups. PLASM generated modules only use 16 bit fixups, so not an issue for existing modules. Download the toolkit that includes the ProDOS EDASM assembler and sample code. Also the 2.11 updates (if you have 2.1 already installed) here:
|
||||
|
||||
[PLASMA 2.11 Assembly Language Toolkit](https://github.com/dschmenk/PLASMA/raw/master/images/apple/ASM-TK.po)
|
||||
|
||||
[PLASMA 2.11 Update](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.11-UPD.po)
|
||||
|
||||
## FORTH Module
|
||||
|
||||
New for version 2.1 is a FORTH language module capable of interpreting script files and interactive programming. Further documentation here: https://github.com/dschmenk/PLASMA/blob/master/doc/PLFORTH.md. Samples scripts are in /HARDISK/BLD/SCRIPTS
|
||||
|
||||
## Demos
|
||||
|
||||
There are some demo programs included for your perusal. Check out `ROGUE` for some diversion. You can find the documentation here: https://github.com/dschmenk/PLASMA/blob/master/doc/Rogue%20Instructions.md. A music sequencer to play through a MockingBoard if it is detected, or the built-in speaker if not. A minimal Web server if you have an Uthernet2 card (required). Try `SPIDERS`for some hires shoot'em-up action. Bug reports appreciated.
|
||||
|
||||
## Source Code
|
||||
|
||||
Most sample source code is included from the project. They build without alteration and should be a good starting point for further explorations. The header files for the included library modules are in the INC directory.
|
||||
|
||||
## Video Playlist
|
||||
|
||||
There is a [YouTube playlist](https://www.youtube.com/playlist?list=PLlPKgUMQbJ79VJvZRfv1CJQf4SP2Gw3yU) created for learning PLASMA.
|
||||
|
||||
## Issues
|
||||
|
||||
- All the modules and runtime are written mostly in PLASMA; the compiler and editor as well. This means that there may be some startup delay as the PLASMA module loader reads in the module dependencies and performs dynamic linking. But a 1 MHz, 8 bit CPU interpreting bytecodes is never going to match a modern computer. As noted earlier, an accelerator and mass storage are your (and PLASMA's) friend.
|
||||
|
||||
- All the project modules are included. They have been lightly tested.
|
||||
|
||||
- The Apple /// may not always report errors properly or at all.
|
||||
|
||||
- The documentation is sparse and incomplete. Yep, could use your help...
|
||||
|
||||
# Changes in PLASMA for 2.11 Release
|
||||
|
||||
1. Minor update to load modules generated by EDASM with 8 bit fixups
|
||||
|
||||
# Changes in PLASMA for 2.1 Release
|
||||
|
||||
1. Lots of small bug fixes in floating point, file copy and graphics libraries
|
||||
|
||||
2. MULT opcode speedup improvements
|
||||
|
||||
3. Overhaul 65802/65814 VM for better speed and compatibility with PLFORTH compilation
|
||||
|
||||
4. Many Apple /// improvements and bug fixes
|
||||
|
||||
5. Low memory fixes and tests
|
||||
|
||||
6. FORTH language support as a PLASMA module. Full accessabilit to PLASMA modules and libraries
|
||||
|
||||
7. Install script for ProDOS mass storage
|
||||
|
||||
# Changes in PLASMA for 2.0 Release
|
||||
|
||||
1. Fix command line buffer overflow
|
||||
|
||||
2. Use VBlank to blink editor cursor so not CPU speed dependent
|
||||
|
||||
3. Add ```=``` for ```+COPY``` current destination
|
||||
|
||||
4. Add //c support for DGRLIB and GRLIB wait-for-VBlank routines
|
||||
|
||||
# Changes in PLASMA for 2.0 Beta
|
||||
|
||||
1. Compilers allows for including self imported defines
|
||||
|
||||
2. Compilers fixed for local constants
|
||||
|
||||
3. Floating point string formatting fixes and improvements
|
||||
|
||||
4. Fiber library exports number of active fibers
|
||||
|
||||
# Changes in PLASMA for 2.0 Alpha 2
|
||||
|
||||
1. Self hosted compiler fixes for invalid array size constants
|
||||
|
||||
2. Ensure IDs in self hosted compiler are 31 characters significant
|
||||
|
||||
3. Fix bug COPY file parsing and move common routine into MATCHFILES
|
||||
|
||||
# Changes in PLASMA for 2.0 Alpha 1
|
||||
|
||||
1. Improved entry/exit for 128K Apple IIe //c
|
||||
|
||||
2. Improved entry for Apple ///
|
||||
|
||||
3. Improved entry and function calls for 16 bit VM
|
||||
|
||||
# Changes in PLASMA for 2.0 DP 4
|
||||
|
||||
1. Improved editor auto-indenting
|
||||
|
||||
2. Compiler fix for terneray operator precedence
|
||||
|
||||
3. Machine check for HGR library
|
||||
|
||||
# Changes in PLASMA for 2.0 DP 3
|
||||
|
||||
1. File manipulation utilities fixed for Apple /// SOS vs ProDOS differences
|
||||
|
||||
2. More optimizations for HiRes graphics libraries
|
||||
|
||||
3. Spiders From Mars hires demo game
|
||||
|
||||
# Changes in PLASMA for 2.0 DP 2
|
||||
|
||||
1. Many file manipulaition utilities (COPY, REName, NEWDIRectory, DELete, CATalog, TYPE)
|
||||
|
||||
2. New and updated libraries for lo-res. double lo-res and hi-res graphics w/ sprites
|
||||
|
||||
3. 32 bit integer library for those times when 16 bits just isn't enough
|
||||
|
||||
4. Apple /// improvements to other SOS.INTERP launching with SOS utility
|
||||
|
||||
5. Apple /// JIT VM for speed and non JIT version to free up global memory
|
||||
|
||||
6. Editor improvements
|
||||
|
||||
7. A couple small compiler optimizations
|
||||
|
||||
8. Needed to break out TCP/IP modules into seperate floppy image
|
||||
|
||||
9. Library changes require full install
|
||||
|
||||
# Changes in PLASMA for 2.0 DP 1z
|
||||
|
||||
1. Many fixes for the value zero - especially in 65802/65816 divide routine
|
||||
|
||||
# Changes in PLASMA for 2.0 DP 1 E+C
|
||||
|
||||
1. Greatly improved code editor and additional compiler stats
|
||||
|
||||
# Changes in PLASMA for 2.0 DP 1a
|
||||
|
||||
1. Fix interaction with JIT compiler and module load/unload
|
||||
|
||||
# Changes in PLASMA for 2.0 DP 1
|
||||
|
||||
1. Expanded bytecode for more efficient size/performance of programs
|
||||
|
||||
2. Just-In-Time Compiler for native code performance (6502 and 65816) for frequently called routines
|
||||
|
||||
3. Automatically identify and run most optimal VM for configuration
|
||||
|
||||
# Changes in PLASMA for 1.2
|
||||
|
||||
1. Add TFTPD TFTP server
|
||||
|
||||
2. Fix Uthernet 1 driver
|
||||
|
||||
3. Add mouse module
|
||||
|
||||
4. Fix IRQ issues for interrupt driven mouse driver
|
||||
|
||||
# Changes in PLASMA for 1.1
|
||||
|
||||
1. All known bugs are fixed
|
||||
|
||||
2. PLASM compiler received a little performance boost with an assembly language helper for ID/keyword lexical scanner
|
||||
|
||||
# Changes in PLASMA for 1.0
|
||||
|
||||
If you have been programming in PLASMA before, the 1.0 version has some major and minor changes that you should be aware of:
|
||||
|
||||
1. Case is no longer significant. Imported symbols were always upper case. Now, all symbols are treated as if they were upper case. You may find that some symbols clash with previously defined symbols of different case. Hey, we didn't need lower case in 1977 and we don't need it now. You kids, get off my lawn!
|
||||
|
||||
2. Modules are now first class citizens. Translation: importing a module adds a symbol with the module name. You can simply refer to a module's address with it's name. This is how a module's API table is accessed (instead of adding a variable of the same name in the IMPORT section).
|
||||
|
||||
3. Bytecode changes means previously compiled modules will crash. Rebuild.
|
||||
|
||||
4. `BYTE` and `WORD` have aliases that may improve readability of the code. `CHAR` (character) and `RES` (reserve) are synonyms for `BYTE`. `VAR` (variable) is a synonym for `WORD`. These aliases add no functionality. They are simply syntactic sugar to add context to the source code, but may cause problems if you've previously used the same names for identifiers.
|
||||
|
||||
5. When declaring variables, a base size can come after the type, and an array size can folllow the identifier. For instance:
|
||||
```
|
||||
res[10] a, b, c
|
||||
```
|
||||
will reserve three variables of 10 bytes each. Additionally:
|
||||
```
|
||||
res[10] v[5], w[3]
|
||||
```
|
||||
will reserve a total of 80 bytes (10 * 5 + 10 * 3). This would be useful when combined with a structure definition. One could:
|
||||
```
|
||||
res[t_record] patients[20]
|
||||
```
|
||||
to reserve an array of 20 patient records.
|
||||
|
||||
6. Ternary operator. Just like C and descendants, `??` and `::` allow for an if-then-else inside an expression:
|
||||
```
|
||||
puts(truth == TRUE ?? "TRUE" :: "FALSE")
|
||||
```
|
||||
|
||||
7. Multiple value assignements. Multiple values can be returned from functions and listed on variable assignments:
|
||||
```
|
||||
def func#3 // Return 3 values
|
||||
return 10, 20, 30
|
||||
end
|
||||
|
||||
a, b, c = 1, 2, 3
|
||||
c, d, f = func()
|
||||
x, y = y, x // Swap x and y
|
||||
```
|
||||
|
||||
8. `DROP` allows for explicit dropping of values. In the above `func()` example, if the middle value was the only one desired, the others can be ignored with:
|
||||
```
|
||||
drop, h, drop = func()
|
||||
```
|
||||
|
||||
9. The compiler tracks parameter and return counts for functions. If the above `func()` were used without assigning all the return values, they would be dropped:
|
||||
```
|
||||
a = func() // Two values silently dropped
|
||||
```
|
||||
To generate compiler warning for this issue, and a few others, use the `-W` option when compiling.
|
||||
|
||||
10. Lambda (Anonymous) Functions. The ability to code a quick function in-line can be very powerful when used properly. Look here, https://en.wikipedia.org/wiki/Anonymous_function, for more information.
|
||||
|
||||
11. SANE (Standard Apple Numerics Environment) Floating Point Library. An extensive library (two, actually) of extended floating point (80 bit IEEE precision) functionality is suported. A wrapper library has been written to greatly simplify the interface to SANE. Look at the `RPNCALC.PLA` source code as an example.
|
||||
|
||||
12. Library Documentation. Preliminary documentation is available on the Wiki: https://github.com/dschmenk/PLASMA/wiki
|
||||
|
||||
13. Significant effort has gone into VM tuning and speeding up module loading/dynamic linking.
|
||||
|
||||
14. The VM zero page usage has changed. If you write assembly language routines, you will need to rebuild.
|
||||
|
||||
# Thanks
|
||||
|
||||
I wish to thank the people who have contributed the the PLASMA project. They have greatly improved the development of the language and documentation:
|
||||
|
||||
- Martin Haye: PLASMA programmer extraordinaire. Mr. Lawless Legends has requested many of the crucial features that set PLASMA apart.
|
||||
- Steve F (ZornsLemma): Has taken the optimizer to new levels and his work on porting PLASMA to the Beeb are amazing: http://stardot.org.uk/forums/viewtopic.php?f=55&t=12306&sid=5a503c593f0698ebc31e590ac61b09fc
|
||||
- Peter Ferrie: Assembly optimizer extraordinaire. He has made significant improvements into the code footprint in PLASMA so all the functionality can exist in just a few bytes.
|
||||
- David Schmidt (DaveX): His help in documentation have made it much more accessible and professional. Of course any errors are all his. Just kidding, they're mine ;-)
|
||||
- Andy Werner (6502.org): Catching the grammatical errors that I ain't no good at.
|
||||
- John Brooks: Apple II Guru par excellence. His insights got 10% performance increase out of the VM.
|
||||
|
||||
Dave Schmenk
|
||||
http://schmenk.is-a-geek.com
|
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 19 KiB |
BIN
images/apple/A1PLASMA.po
Executable file
BIN
images/apple/A1PLASMA.po
Executable file
Binary file not shown.
BIN
images/apple/ASM-TK.po
Executable file
BIN
images/apple/ASM-TK.po
Executable file
Binary file not shown.
BIN
images/apple/DHGR-TK.po
Executable file
BIN
images/apple/DHGR-TK.po
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
images/apple/PLASMA-2.1-INST.po
Normal file
BIN
images/apple/PLASMA-2.1-INST.po
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
images/apple/PLFORTH.PO
Executable file → Normal file
BIN
images/apple/PLFORTH.PO
Executable file → Normal file
Binary file not shown.
Binary file not shown.
|
@ -2,7 +2,7 @@ import cmdsys
|
|||
//
|
||||
// Useful values for everyone
|
||||
//
|
||||
const _SYSVER_ = $0201 // Version built against
|
||||
const _SYSVER_ = $0211 // Version built against
|
||||
const FALSE = 0
|
||||
const TRUE = not FALSE
|
||||
const NULL = 0
|
||||
|
@ -11,7 +11,7 @@ import cmdsys
|
|||
//
|
||||
const MACHID_CLOCK = $01
|
||||
const MACHID_80COL = $02
|
||||
const MACHID_MEM = $03
|
||||
const MACHID_MEM = $30
|
||||
const MACHID_64K = $20
|
||||
const MACHID_128K = $30
|
||||
const MACHID_MODEL = $C8
|
||||
|
@ -54,6 +54,7 @@ import cmdsys
|
|||
byte syserr
|
||||
byte jitcount
|
||||
byte jitsize
|
||||
word sysexec[] // Apple II specific
|
||||
byte refcons // Apple /// specific
|
||||
byte devcons // Apple /// specific
|
||||
word lookupsym
|
||||
|
|
|
@ -13,4 +13,7 @@ import dgrlib
|
|||
predef dgrSwap#0
|
||||
predef dgrDrawBuf(page)#0
|
||||
predef dgrColor(clr)#0
|
||||
const dgrPage1 = 0
|
||||
const dgrPage2 = 1
|
||||
const dgrOff = -1
|
||||
end
|
||||
|
|
11
src/inc/extdefseg.inc
Normal file
11
src/inc/extdefseg.inc
Normal file
|
@ -0,0 +1,11 @@
|
|||
;
|
||||
; BYTECODE DEFS SEGMENT
|
||||
;
|
||||
DB 0 ; PAD BYE
|
||||
DEFSEG EQU *
|
||||
;
|
||||
; INIT CODE RUNS WHEN MODULE LOADED
|
||||
;
|
||||
MODINIT DB $54 ; CALL ASM INIT
|
||||
DW INIT
|
||||
DB $5C ; RET
|
5
src/inc/extheader.inc
Normal file
5
src/inc/extheader.inc
Normal file
|
@ -0,0 +1,5 @@
|
|||
DW $6502
|
||||
DW RESFLAGS ; SYSFLAGS
|
||||
DW DEFSEG ; DEF OFFSET
|
||||
DW 1 ; DEF COUNT (INCLUDING INIT)
|
||||
DW MODINIT ; MOD INIT
|
|
@ -13,4 +13,7 @@ import grlib
|
|||
predef grSwap#0
|
||||
predef grDrawBuf(page)#0
|
||||
predef grColor(clr)#0
|
||||
const grPage1 = 0
|
||||
const grPage2 = 1
|
||||
const grOff = -1
|
||||
end
|
||||
|
|
|
@ -21,4 +21,7 @@ import hgrlib
|
|||
predef hgrSwap#1
|
||||
predef hgrDrawBuf(page)#1
|
||||
predef hgrColor(clr)#0
|
||||
const hgrPage1 = 0
|
||||
const hgrPage2 = 1
|
||||
const hgrOff = -1
|
||||
end
|
||||
|
|
|
@ -5,9 +5,5 @@ import hgrtile
|
|||
predef tileAndDraw(x, y, tileptr)#0
|
||||
predef tileDrawStr(x, y, strptr, strlen, tileset)#0
|
||||
predef tileFromText(txtpage, tileset)#0
|
||||
predef tileMode(mode)#1
|
||||
predef tileClear#0
|
||||
predef tileShow(page)#1
|
||||
predef tileSwap#1
|
||||
predef tileDrawBuf(page)#1
|
||||
end
|
||||
|
|
41
src/inc/plasma.inc
Normal file
41
src/inc/plasma.inc
Normal file
|
@ -0,0 +1,41 @@
|
|||
REL
|
||||
ORG $1000
|
||||
;
|
||||
; USEFUL ZERO PAGE LOCATIONS
|
||||
;
|
||||
SRC EQU $06
|
||||
SRCL EQU SRC
|
||||
SRCH EQU SRC+1
|
||||
DST EQU SRC+2
|
||||
DSTL EQU DST
|
||||
DSTH EQU DST+1
|
||||
TMP EQU $E7
|
||||
TMPL EQU TMP
|
||||
TMPH EQU TMP+1
|
||||
ESTKH EQU $C0
|
||||
ESTKL EQU $D0
|
||||
DROPOP EQU $EF
|
||||
NEXTOP EQU $F0
|
||||
FETCHOP EQU NEXTOP+1
|
||||
;
|
||||
; JUMP TO BYTECODE INTERPRETER ADDRESS
|
||||
;
|
||||
INTERP EQU $03D0
|
||||
;
|
||||
; SYSTEM FLAGS: MEMORY ALLOCATOR SCREEN HOLES
|
||||
;
|
||||
RESTXT1 EQU $0001
|
||||
RESTXT2 EQU $0002
|
||||
RESXTXT1 EQU $0004
|
||||
RESXTXT2 EQU $0008
|
||||
RESHGR1 EQU $0010
|
||||
RESHGR2 EQU $0020
|
||||
RESXHGR1 EQU $0040
|
||||
RESXHGR2 EQU $0080
|
||||
NOJITC EQU $0100
|
||||
;
|
||||
; MODULE FREE FLAGS
|
||||
;
|
||||
MODNOKEEP EQU $0000
|
||||
MODKEEP EQU $2000
|
||||
MODINITKEEP EQU $4000
|
83
src/lib6502/BSDmakefile
Normal file
83
src/lib6502/BSDmakefile
Normal file
|
@ -0,0 +1,83 @@
|
|||
# THIS FILE WAS GENERATED AUTOMATICALLY
|
||||
# EDIT AT YOUR OWN RISK
|
||||
#
|
||||
# Makefile for lib6502, run6502
|
||||
|
||||
# Copyright (c) 2005 Ian Piumarta
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sub-license, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS". USE ENTIRELY AT YOUR OWN RISK.
|
||||
|
||||
# last edited: 2005-11-01 22:48:49 by piumarta on margaux.local
|
||||
|
||||
CFLAGS = -g -O3
|
||||
|
||||
PREFIX = /usr/local
|
||||
BINDIR = $(PREFIX)/bin
|
||||
LIBDIR = $(PREFIX)/lib
|
||||
INCDIR = $(PREFIX)/include
|
||||
DOCDIR = $(PREFIX)/doc/lib6502
|
||||
EGSDIR = $(DOCDIR)/examples
|
||||
MANDIR = $(PREFIX)/man
|
||||
MAN1DIR = $(MANDIR)/man1
|
||||
MAN3DIR = $(MANDIR)/man3
|
||||
|
||||
all : run6502
|
||||
|
||||
run6502 : run6502.o lib6502.a
|
||||
|
||||
lib6502.a : lib6502.o
|
||||
$(AR) -rc $@.new lib6502.o
|
||||
mv $@.new $@
|
||||
-ranlib $@
|
||||
|
||||
clean : .FORCE
|
||||
rm -f run6502 lib1 *~ *.o *.a .gdb* *.img *.log
|
||||
|
||||
.FORCE :
|
||||
|
||||
install : .FORCE
|
||||
install -d $(BINDIR)
|
||||
install -d $(LIBDIR)
|
||||
install -d $(INCDIR)
|
||||
install -d $(MANDIR)
|
||||
install -d $(MAN1DIR)
|
||||
install -d $(MAN3DIR)
|
||||
install -d $(DOCDIR)
|
||||
install -d $(EGSDIR)
|
||||
install -c run6502 $(BINDIR)/run6502
|
||||
install -c lib6502.a $(LIBDIR)/lib6502.a
|
||||
install -c lib6502.h $(INCDIR)/lib6502.h
|
||||
install -c man/run6502.1 $(MAN1DIR)/run6502.1
|
||||
install -c man/lib6502.3 $(MAN3DIR)/lib6502.3
|
||||
install -c man/M6502_delete.3 $(MAN3DIR)/M6502_delete.3
|
||||
install -c man/M6502_disassemble.3 $(MAN3DIR)/M6502_disassemble.3
|
||||
install -c man/M6502_dump.3 $(MAN3DIR)/M6502_dump.3
|
||||
install -c man/M6502_getCallback.3 $(MAN3DIR)/M6502_getCallback.3
|
||||
install -c man/M6502_getVector.3 $(MAN3DIR)/M6502_getVector.3
|
||||
install -c man/M6502_irq.3 $(MAN3DIR)/M6502_irq.3
|
||||
install -c man/M6502_new.3 $(MAN3DIR)/M6502_new.3
|
||||
install -c man/M6502_nmi.3 $(MAN3DIR)/M6502_nmi.3
|
||||
install -c man/M6502_reset.3 $(MAN3DIR)/M6502_reset.3
|
||||
install -c man/M6502_run.3 $(MAN3DIR)/M6502_run.3
|
||||
install -c man/M6502_setCallback.3 $(MAN3DIR)/M6502_setCallback.3
|
||||
install -c man/M6502_setVector.3 $(MAN3DIR)/M6502_setVector.3
|
||||
install -c ChangeLog $(DOCDIR)/ChangeLog
|
||||
install -c COPYING $(DOCDIR)/COPYING
|
||||
install -c README $(DOCDIR)/README
|
||||
install -c examples/README $(EGSDIR)/README
|
||||
install -c examples/lib1.c $(EGSDIR)/lib1.c
|
||||
install -c examples/hex2bin $(EGSDIR)/hex2bin
|
||||
|
||||
uninstall : .FORCE
|
||||
rm -f $(BINDIR)/run6502 $(LIBDIR)/lib6502.a $(INCDIR)/lib6502.h $(MAN1DIR)/run6502.1 $(MAN3DIR)/lib6502.3 $(MAN3DIR)/M6502_delete.3 $(MAN3DIR)/M6502_disassemble.3 $(MAN3DIR)/M6502_dump.3 $(MAN3DIR)/M6502_getCallback.3 $(MAN3DIR)/M6502_getVector.3 $(MAN3DIR)/M6502_irq.3 $(MAN3DIR)/M6502_new.3 $(MAN3DIR)/M6502_nmi.3 $(MAN3DIR)/M6502_reset.3 $(MAN3DIR)/M6502_run.3 $(MAN3DIR)/M6502_setCallback.3 $(MAN3DIR)/M6502_setVector.3 $(DOCDIR)/ChangeLog $(DOCDIR)/COPYING $(DOCDIR)/README $(EGSDIR)/README $(EGSDIR)/lib1.c $(EGSDIR)/hex2bin
|
||||
rmdir $(EGSDIR) $(DOCDIR)
|
26
src/lib6502/COPYING
Normal file
26
src/lib6502/COPYING
Normal file
|
@ -0,0 +1,26 @@
|
|||
Distasteful though it is for me to have to induce from afar any perturbation
|
||||
into your pursuit of happiness, this MIT (X11 flavour) license is at least
|
||||
relatively benign. Investigation into copyright stupidity reveals that it is
|
||||
effectively impossible to dedicate (formally) any software to the public
|
||||
domain (the only sure path to this most enlightened status being to leave the
|
||||
software to expire naturally from its 25-, 50-, 75- or whatever-year copyright
|
||||
rot). I fear this is not going to change before the revolution comes. In the
|
||||
meantime the only way I can *guarantee* you any rights at all to this software
|
||||
would (unfortunately) appear to be...
|
||||
|
||||
Copyright (c) 2005 Ian Piumarta
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the 'Software'), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to
|
||||
do so, provided that the above copyright notice(s) and this permission
|
||||
notice appear in all copies or substantial portions of the Software.
|
||||
|
||||
Inclusion of the above copyright notice(s) and this permission notice in
|
||||
supporting documentation would be appreciated, but is not required.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
|
7
src/lib6502/ChangeLog
Normal file
7
src/lib6502/ChangeLog
Normal file
|
@ -0,0 +1,7 @@
|
|||
2005-11-01 Ian Piumarta <com -dot- gmail -at- piumarta (backwards)>
|
||||
|
||||
* RELEASE 1.0
|
||||
|
||||
2005-10-30 Ian Piumarta <com -dot- gmail -at- piumarta (backwards)>
|
||||
|
||||
* ChangeLog: created.
|
232
src/lib6502/Makefile
Normal file
232
src/lib6502/Makefile
Normal file
|
@ -0,0 +1,232 @@
|
|||
# Makefile for lib6502, run6502
|
||||
|
||||
# Copyright (c) 2005 Ian Piumarta
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
# (the 'Software'), to deal in the Software without restriction,
|
||||
# including without limitation the rights to use, copy, modify, merge,
|
||||
# publish, distribute, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, provided
|
||||
# that the above copyright notice(s) and this permission notice appear
|
||||
# in all copies of the Software and that both the above copyright
|
||||
# notice(s) and this permission notice appear in supporting
|
||||
# documentation.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
|
||||
|
||||
# last edited: 2013-06-08 01:08:02 by piumarta on vps2.piumarta.com
|
||||
|
||||
CFLAGS = -g -O3
|
||||
|
||||
PREFIX = /usr/local
|
||||
BINDIR = $(PREFIX)/bin
|
||||
LIBDIR = $(PREFIX)/lib
|
||||
INCDIR = $(PREFIX)/include
|
||||
DOCDIR = $(PREFIX)/doc/lib6502
|
||||
EGSDIR = $(DOCDIR)/examples
|
||||
MANDIR = $(PREFIX)/man
|
||||
MAN1DIR = $(MANDIR)/man1
|
||||
MAN3DIR = $(MANDIR)/man3
|
||||
|
||||
all : run6502
|
||||
|
||||
run6502 : run6502.o lib6502.a
|
||||
|
||||
lib6502.a : lib6502.o
|
||||
$(AR) -rc $@.new lib6502.o
|
||||
mv $@.new $@
|
||||
-ranlib $@
|
||||
|
||||
clean : .FORCE
|
||||
rm -f run6502 lib1 *~ *.o *.a .gdb* *.img *.log
|
||||
|
||||
.FORCE :
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
INSTALLDIRS = $(BINDIR) $(LIBDIR) $(INCDIR) $(MANDIR) $(MAN1DIR) $(MAN3DIR) $(DOCDIR) $(EGSDIR)
|
||||
|
||||
BINFILES = $(BINDIR)/run6502
|
||||
|
||||
LIBFILES = $(LIBDIR)/lib6502.a
|
||||
|
||||
INCFILES = $(INCDIR)/lib6502.h
|
||||
|
||||
MANFILES = $(MAN1DIR)/run6502.1 \
|
||||
$(MAN3DIR)/lib6502.3 \
|
||||
$(MAN3DIR)/M6502_delete.3 \
|
||||
$(MAN3DIR)/M6502_disassemble.3 \
|
||||
$(MAN3DIR)/M6502_dump.3 \
|
||||
$(MAN3DIR)/M6502_getCallback.3 \
|
||||
$(MAN3DIR)/M6502_getVector.3 \
|
||||
$(MAN3DIR)/M6502_irq.3 \
|
||||
$(MAN3DIR)/M6502_new.3 \
|
||||
$(MAN3DIR)/M6502_nmi.3 \
|
||||
$(MAN3DIR)/M6502_reset.3 \
|
||||
$(MAN3DIR)/M6502_run.3 \
|
||||
$(MAN3DIR)/M6502_setCallback.3 \
|
||||
$(MAN3DIR)/M6502_setVector.3
|
||||
|
||||
DOCFILES = $(DOCDIR)/ChangeLog \
|
||||
$(DOCDIR)/COPYING \
|
||||
$(DOCDIR)/README \
|
||||
$(EGSDIR)/README \
|
||||
$(EGSDIR)/lib1.c \
|
||||
$(EGSDIR)/hex2bin
|
||||
|
||||
MKDIR = install -d
|
||||
RMDIR = rmdir
|
||||
INSTALL = install -c
|
||||
RM = rm -f
|
||||
|
||||
$(BINDIR)/% $(LIBDIR)/% $(INCDIR)/% $(DOCDIR)/% : %
|
||||
$(INSTALL) $< $@
|
||||
|
||||
$(MAN1DIR)/% $(MAN3DIR)/% : man/%
|
||||
$(INSTALL) $< $@
|
||||
|
||||
$(EGSDIR)/% : examples/%
|
||||
$(INSTALL) $< $@
|
||||
|
||||
$(INSTALLDIRS) :
|
||||
$(MKDIR) $@
|
||||
|
||||
install : $(INSTALLDIRS) $(BINFILES) $(LIBFILES) $(INCFILES) $(MANFILES) $(DOCFILES)
|
||||
|
||||
uninstall : .FORCE
|
||||
-$(RM) $(BINFILES) $(LIBFILES) $(INCFILES) $(MANFILES) $(DOCFILES)
|
||||
-$(RMDIR) $(EGSDIR) $(DOCDIR)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
PACKAGE_VERSION = 1.3
|
||||
PACKAGE_TARNAME = lib6502
|
||||
|
||||
TARNAME= $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
|
||||
|
||||
DISTFILES = \
|
||||
$(TARNAME)/ChangeLog \
|
||||
$(TARNAME)/COPYING \
|
||||
$(TARNAME)/README \
|
||||
$(TARNAME)/Makefile \
|
||||
$(TARNAME)/BSDmakefile \
|
||||
$(TARNAME)/config.h \
|
||||
$(TARNAME)/lib6502.h \
|
||||
$(TARNAME)/lib6502.c \
|
||||
$(TARNAME)/run6502.c \
|
||||
$(TARNAME)/test.out \
|
||||
$(TARNAME)/man/run6502.1 \
|
||||
$(TARNAME)/man/lib6502.3 \
|
||||
$(TARNAME)/man/M6502_delete.3 \
|
||||
$(TARNAME)/man/M6502_disassemble.3 \
|
||||
$(TARNAME)/man/M6502_dump.3 \
|
||||
$(TARNAME)/man/M6502_getCallback.3 \
|
||||
$(TARNAME)/man/M6502_getVector.3 \
|
||||
$(TARNAME)/man/M6502_irq.3 \
|
||||
$(TARNAME)/man/M6502_new.3 \
|
||||
$(TARNAME)/man/M6502_nmi.3 \
|
||||
$(TARNAME)/man/M6502_reset.3 \
|
||||
$(TARNAME)/man/M6502_run.3 \
|
||||
$(TARNAME)/man/M6502_setCallback.3 \
|
||||
$(TARNAME)/man/M6502_setVector.3 \
|
||||
$(TARNAME)/examples/hex2bin \
|
||||
$(TARNAME)/examples/lib1.c \
|
||||
$(TARNAME)/examples/README
|
||||
|
||||
dist : .FORCE
|
||||
rm -f $(TARNAME)
|
||||
ln -s . $(TARNAME)
|
||||
tar -cf $(TARNAME).tar $(DISTFILES)
|
||||
gzip -v9 $(TARNAME).tar
|
||||
rm -f $(TARNAME)
|
||||
|
||||
dist-test : .FORCE
|
||||
rm -rf $(TARNAME)
|
||||
tar -xz -f $(TARNAME).tar.gz
|
||||
ln -s ../images $(TARNAME)/images
|
||||
$(MAKE) -C $(TARNAME) test
|
||||
rm -rf $(TARNAME)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
image :
|
||||
./run6502 \
|
||||
-l C000 images/os1.2 \
|
||||
-l 8000 images/basic2 \
|
||||
-s 0000 +10000 image \
|
||||
-x
|
||||
|
||||
newimage : .FORCE
|
||||
rm -f image
|
||||
$(MAKE) image
|
||||
|
||||
test1 : run6502 .FORCE
|
||||
echo a2418a20eeffe8e05bd0f7a90a20eeff0000 | perl -e '$$_=pack"H*",<STDIN>;print' > temp.img
|
||||
./run6502 \
|
||||
-l 1000 temp.img \
|
||||
-d 1000 +11 \
|
||||
-R 1000 \
|
||||
-P FFEE \
|
||||
-X 0
|
||||
|
||||
lib1 : lib6502.a
|
||||
$(CC) -I. -o lib1 examples/lib1.c lib6502.a
|
||||
|
||||
test2 : lib1 .FORCE
|
||||
./lib1
|
||||
|
||||
test3 : run6502 image .FORCE
|
||||
echo 'PRINT:FORA%=1TO10:PRINTA%:NEXT:PRINT"HELLO WORLD"' | ./run6502 image
|
||||
|
||||
test4 : run6502 image .FORCE
|
||||
echo 'P%=&2800:O%=P%:[opt3:ldx#65:.l txa:jsr&FFEE:inx:cpx#91:bnel:lda#13:jsr&FFEE:lda#10:jmp&FFEE:]:CALL&2800' | ./run6502 image
|
||||
|
||||
test : run6502 lib1 image .FORCE
|
||||
@$(MAKE) test1 test2 test3 test4 | grep -v '^make.* directory' | tee test.log
|
||||
cmp test.log test.out
|
||||
@echo
|
||||
@echo SUCCESS
|
||||
@echo
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# I don't know what it is (probably me, who knows?) but every single
|
||||
# time I try to write a Makefile that is compatible with both GNU and
|
||||
# BSD make I spend three hours getting absolutely nowhere. It's
|
||||
# telling when a program consisting of precisely TWO SOURCE FILES and
|
||||
# a few man pages and examples is already TOO COMPLEX to be installed
|
||||
# with BSD make, in the absence of an explicit rule for every single
|
||||
# target, be it installed or intermediate, from a Makefile that won't
|
||||
# also break GNU make. Good Grief Charlie Brown.
|
||||
|
||||
# Yes I know I can compose the sed substitutions into a single script,
|
||||
# but it looks even uglier that way.
|
||||
|
||||
BSDmakefile : .FORCE
|
||||
$(MAKE)
|
||||
rm -rf /tmp/bsd
|
||||
echo '# THIS FILE WAS GENERATED AUTOMATICALLY' > BSDmakefile
|
||||
echo '# EDIT AT YOUR OWN RISK' >> BSDmakefile
|
||||
echo '# ' >> BSDmakefile
|
||||
sed '/# -/,$$d' < Makefile >> BSDmakefile
|
||||
echo 'install : .FORCE' > BSDtemp
|
||||
$(MAKE) install PREFIX=/tmp/bsd >> BSDtemp
|
||||
echo >> BSDtemp
|
||||
echo 'uninstall : .FORCE' >> BSDtemp
|
||||
$(MAKE) uninstall PREFIX=/tmp/bsd >> BSDtemp
|
||||
cat BSDtemp | \
|
||||
sed 's,/tmp/bsd/doc/lib6502/examples,$$(EGSDIR),g' | \
|
||||
sed 's,/tmp/bsd/doc/lib6502,$$(DOCDIR),g' | \
|
||||
sed 's,/tmp/bsd/man/man1,$$(MAN1DIR),g' | \
|
||||
sed 's,/tmp/bsd/man/man3,$$(MAN3DIR),g' | \
|
||||
sed 's,/tmp/bsd/man,$$(MANDIR),g' | \
|
||||
sed 's,/tmp/bsd/include,$$(INCDIR),g' | \
|
||||
sed 's,/tmp/bsd/lib,$$(LIBDIR),g' | \
|
||||
sed 's,/tmp/bsd/lib,$$(LIBDIR),g' | \
|
||||
sed 's,/tmp/bsd/bin,$$(BINDIR),g' | \
|
||||
sed 's,^, ,g' >> BSDmakefile
|
||||
rm -f BSDtemp
|
||||
rm -rf /tmp/bsd
|
131
src/lib6502/README
Executable file
131
src/lib6502/README
Executable file
|
@ -0,0 +1,131 @@
|
|||
lib6502 - 6502 Microprocessor Emulator
|
||||
|
||||
Version: 1.0
|
||||
|
||||
|
||||
WHAT IF I'M TOO LAZY TO READ 'README'S?
|
||||
|
||||
make
|
||||
make install
|
||||
more examples/README
|
||||
|
||||
|
||||
WHAT IS LIB6502?
|
||||
|
||||
lib6502 is a library that emulates the 6502 microprocessor. It
|
||||
comes with a small 'shell', run6502, that can execute 6502 programs
|
||||
from the command line.
|
||||
|
||||
lib6502 is distributed under the MIT license: it is non-infectious
|
||||
and will not make your projects contagious to others the instant you
|
||||
choose to use lib6502 in them. See the file COPYING for details.
|
||||
|
||||
|
||||
WHERE IS THE LATEST SOURCE CODE?
|
||||
|
||||
Source code for lib6502 is available from the author's home page at
|
||||
'http://piumarta.com/software'. You can download the most recent
|
||||
release or use Subversion to get the very latest sources.
|
||||
|
||||
|
||||
WHERE IS THE DOCUMENTATION?
|
||||
|
||||
Manual pages for run6502 and lib6502 (and all the functions it
|
||||
exports) should be available once it is installed. Each includes a
|
||||
short 'examples' section. Use the 'man' command to read them.
|
||||
|
||||
Your best place to start looking for documentation on the 6502
|
||||
itself is 'http://6502.org'. A google search of the web will also
|
||||
turn up vast quantities of information about (and programs for) the
|
||||
6502.
|
||||
|
||||
|
||||
HOW DO I INSTALL IT?
|
||||
|
||||
It's not really big enough to warrant the whole 'configure' thing.
|
||||
Any system with an ANSI compiler and C library should be able to
|
||||
compile it out of the box. After unpacking the archive, just type:
|
||||
|
||||
make
|
||||
|
||||
to build it. If the compiler blows up immediately, edit the
|
||||
Makefile and play with the '-g' and '-O' flags and then try again.
|
||||
If you really can't make the compiler happy you've found a bug (read
|
||||
the next section but one). Otherwise, if you want it put it
|
||||
somewhere more permanent then type:
|
||||
|
||||
make install
|
||||
|
||||
(as root) to install it. It goes into /usr/local by default; if you
|
||||
want it elsewhere then set PREFIX in the make command. For example:
|
||||
|
||||
make install PREFIX=/usr
|
||||
|
||||
will put everything under '/usr'.
|
||||
|
||||
When you get bored with it, go back to the source directory and
|
||||
type:
|
||||
|
||||
make uninstall
|
||||
|
||||
(with the same PREFIX you specified during the install, if
|
||||
necessary.)
|
||||
|
||||
|
||||
WHAT CAN I DO WITH IT?
|
||||
|
||||
See the file EXAMPLES for some suggestions (all of them polite).
|
||||
|
||||
If that leaves you wanting more, read the source for run6502 -- it
|
||||
exercises just about every feature in lib6502.
|
||||
|
||||
|
||||
HOW DO I REPORT PROBLEMS?
|
||||
|
||||
Send e-mail to the author at: firstName (at) lastName (dot) com
|
||||
|
||||
(For suitable values of firstName and lastName, see the last section
|
||||
of this file.)
|
||||
|
||||
If you're still confused, contact him at: http://piumarta.com
|
||||
|
||||
|
||||
HOW CAN I HELP?
|
||||
|
||||
Use it. Find bugs. Fix bugs. Make it faster. Evangelism: spread
|
||||
it to as many other projects as possible, especially those that
|
||||
might be using a slower emulator! Read the manual pages to see
|
||||
what's considered missing, then add it, then send it in.
|
||||
|
||||
(One thing that would be be really handy, and isn't mentioned in the
|
||||
manual pages, is a test suite. Figure out how to test every mode in
|
||||
every instruction with every possible combination of operand values
|
||||
and condition codes and verify the behaviour is correct. Then write
|
||||
it down in the form of a program and send it in. If it's a
|
||||
self-contained program that runs once to completion then we can
|
||||
probably find some real hardware to test against the test suite.)
|
||||
|
||||
If you know how to write software that emulates peripheral hardware
|
||||
devices, google up some details on the popular 6502-based
|
||||
microcomputers (Acorn, Commodore, etc.) and add some serious system
|
||||
emulation to run6502. Make it all pluggable (think dynamic
|
||||
libraries over an 'agnostic' core), so we can change machines at the
|
||||
flip of a (command-line) switch. (The callback mechanism in lib6502
|
||||
was designed with this kind of 'pluggable hardware emulation' in
|
||||
mind.)
|
||||
|
||||
|
||||
WHO WROTE THIS STUFF, AND WHY?
|
||||
|
||||
lib6502 was written by Ian Piumarta.
|
||||
|
||||
While writing ccg (an entirely different project that creates
|
||||
runtime assemblers for dynamic code generators) he decided to
|
||||
include support for an 8-bit microprocessor, just for fun. He chose
|
||||
the 6502 because it was used in the first computer he owned and
|
||||
programmed (an Ohio Scientific Superboard II, when he was 14) as
|
||||
well as the second (an Acorn 'BBC Model B', about four years later).
|
||||
lib6502 started as a 'glorified switch statement' that ran some
|
||||
small test programs spewed into memory by ccg, but rapidly got out
|
||||
of control over the course of a weekend. You're looking at the
|
||||
result.
|
143
src/lib6502/a1cffa.c
Normal file
143
src/lib6502/a1cffa.c
Normal file
|
@ -0,0 +1,143 @@
|
|||
/* run6502.c -- 6502 emulator shell -*- C -*- */
|
||||
|
||||
/* Copyright (c) 2005 Ian Piumarta
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the 'Software'),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, provided that the above copyright notice(s) and this
|
||||
* permission notice appear in all copies of the Software and that both the
|
||||
* above copyright notice(s) and this permission notice appear in supporting
|
||||
* documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
|
||||
*/
|
||||
|
||||
/* Last edited: 2005-11-02 01:18:58 by piumarta on margaux.local
|
||||
*/
|
||||
|
||||
/* Apple 1 + CFFA1 support for PLASMA by resman
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "lib6502.h"
|
||||
|
||||
#define VERSION PACKAGE_NAME " " PACKAGE_VERSION " " PACKAGE_COPYRIGHT
|
||||
|
||||
typedef uint8_t byte;
|
||||
typedef uint16_t word;
|
||||
|
||||
void pfail(const char *msg)
|
||||
{
|
||||
fflush(stdout);
|
||||
perror(msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#define rts \
|
||||
{ \
|
||||
word pc; \
|
||||
pc = mpu->memory[++mpu->registers->s + 0x100]; \
|
||||
pc |= mpu->memory[++mpu->registers->s + 0x100] << 8; \
|
||||
return pc + 1; \
|
||||
}
|
||||
|
||||
int save(M6502 *mpu, word address, unsigned length, const char *path)
|
||||
{
|
||||
FILE *file;
|
||||
int count;
|
||||
if (!(file = fopen(path, "wb")))
|
||||
return 0;
|
||||
while ((count = fwrite(mpu->memory + address, 1, length, file)))
|
||||
{
|
||||
address += count;
|
||||
length -= count;
|
||||
}
|
||||
fclose(file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int load(M6502 *mpu, word address, const char *path)
|
||||
{
|
||||
FILE *file;
|
||||
int count;
|
||||
size_t max = 0x10000 - address;
|
||||
if (!(file = fopen(path, "rb")))
|
||||
return 0;
|
||||
while ((count = fread(mpu->memory + address, 1, max, file)) > 0)
|
||||
{
|
||||
address += count;
|
||||
max -= count;
|
||||
}
|
||||
fclose(file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cffa1(M6502 *mpu, word address, byte data)
|
||||
{
|
||||
switch (mpu->registers->x)
|
||||
{
|
||||
case 0x7A: /* perform keyboard scan */
|
||||
mpu->registers->x= 0x00;
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
char state[64];
|
||||
M6502_dump(mpu, state);
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "\nCFFA1 %s\n", state);
|
||||
fail("ABORT");
|
||||
}
|
||||
break;
|
||||
}
|
||||
rts;
|
||||
}
|
||||
|
||||
int bye(M6502 *mpu, word addr, byte data) { exit(0); return 0; }
|
||||
int cout(M6502 *mpu, word addr, byte data) { putchar(mpu->registers->a); fflush(stdout); rts; }
|
||||
|
||||
int rd6820kbdctl(M6502 *mpu, word addr, byte data) { return 0x80; }
|
||||
int rd6820vidctl(M6502 *mpu, word addr, byte data) { return 0x00; }
|
||||
int rd6820kbd(M6502 *mpu, word addr, byte data) { return getchar(); }
|
||||
int wr6820vid(M6502 *mpu, word addr, byte data) { putchar(data); fflush(stdout); return 0; }
|
||||
|
||||
int setTraps(M6502 *mpu)
|
||||
{
|
||||
/* Apple 1 memory-mapped IO */
|
||||
M6502_setCallback(mpu, read, 0xD010, rd6820kbd);
|
||||
M6502_setCallback(mpu, read, 0xD011, rd6820kbdctl);
|
||||
M6502_setCallback(mpu, write, 0xD012, wr6820vid);
|
||||
M6502_setCallback(mpu, read, 0xD013, rd6820vidctl);
|
||||
/* CFFA1 and ROM calls */
|
||||
M6502_setCallback(mpu, call, 0x9000, bye);
|
||||
M6502_setCallback(mpu, call, 0x900C, cffa1);
|
||||
M6502_setCallback(mpu, call, 0xFFEF, cout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *interpfile = "A1PLASMA";
|
||||
M6502 *mpu = M6502_new(0, 0, 0);
|
||||
|
||||
if (argc == 2)
|
||||
interpfile = argv[1];
|
||||
if (!load(mpu, 0x280, interpfile))
|
||||
pfail(interpfile);
|
||||
setTraps(mpu);
|
||||
M6502_reset(mpu);
|
||||
M6502_run(mpu);
|
||||
M6502_delete(mpu);
|
||||
return 0;
|
||||
}
|
9
src/lib6502/config.h
Normal file
9
src/lib6502/config.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef __config_h
|
||||
#define __config_h
|
||||
|
||||
#define PACKAGE_NAME "lib6502"
|
||||
#define PACKAGE_VERSION "1.0"
|
||||
#define PACKAGE_BUGREPORT "firstName (at) lastName (dot) com"
|
||||
#define PACKAGE_COPYRIGHT "Copyright (c) 2005 Ian Piumarta"
|
||||
|
||||
#endif /* __config_h */
|
893
src/lib6502/lib6502.c
Normal file
893
src/lib6502/lib6502.c
Normal file
|
@ -0,0 +1,893 @@
|
|||
/* lib6502.c -- MOS Technology 6502 emulator -*- C -*- */
|
||||
|
||||
/* Copyright (c) 2005 Ian Piumarta
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the 'Software'),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, provided that the above copyright notice(s) and this
|
||||
* permission notice appear in all copies of the Software and that both the
|
||||
* above copyright notice(s) and this permission notice appear in supporting
|
||||
* documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
|
||||
*/
|
||||
|
||||
/* Last edited: 2013-06-07 23:03:39 by piumarta on emilia.local
|
||||
*
|
||||
* BUGS:
|
||||
* - RTS and RTI do not check the return address for a callback
|
||||
* - the disassembler cannot be configured to read two bytes for BRK
|
||||
* - architectural variations (unimplemented/extended instructions) not implemented
|
||||
* - ANSI versions (from from gcc extensions) of the dispatch macros are missing
|
||||
* - emulator+disassembler in same object file (library is kind of pointless)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lib6502.h"
|
||||
|
||||
typedef uint8_t byte;
|
||||
typedef uint16_t word;
|
||||
|
||||
enum {
|
||||
flagN= (1<<7), /* negative */
|
||||
flagV= (1<<6), /* overflow */
|
||||
flagX= (1<<5), /* unused */
|
||||
flagB= (1<<4), /* irq from brk */
|
||||
flagD= (1<<3), /* decimal mode */
|
||||
flagI= (1<<2), /* irq disable */
|
||||
flagZ= (1<<1), /* zero */
|
||||
flagC= (1<<0) /* carry */
|
||||
};
|
||||
|
||||
#define getN() (P & flagN)
|
||||
#define getV() (P & flagV)
|
||||
#define getB() (P & flagB)
|
||||
#define getD() (P & flagD)
|
||||
#define getI() (P & flagI)
|
||||
#define getZ() (P & flagZ)
|
||||
#define getC() (P & flagC)
|
||||
|
||||
#define setNVZC(N,V,Z,C) (P= (P & ~(flagN | flagV | flagZ | flagC)) | (N) | ((V)<<6) | ((Z)<<1) | (C))
|
||||
#define setNZC(N,Z,C) (P= (P & ~(flagN | flagZ | flagC)) | (N) | ((Z)<<1) | (C))
|
||||
#define setNZ(N,Z) (P= (P & ~(flagN | flagZ )) | (N) | ((Z)<<1) )
|
||||
#define setZ(Z) (P= (P & ~( flagZ )) | ((Z)<<1) )
|
||||
#define setC(C) (P= (P & ~( flagC)) | (C))
|
||||
|
||||
#define NAND(P, Q) (!((P) & (Q)))
|
||||
|
||||
#define tick(n)
|
||||
#define tickIf(p)
|
||||
|
||||
/* memory access (indirect if callback installed) -- ARGUMENTS ARE EVALUATED MORE THAN ONCE! */
|
||||
|
||||
#define putMemory(ADDR, BYTE) \
|
||||
( writeCallback[ADDR] \
|
||||
? writeCallback[ADDR](mpu, ADDR, BYTE) \
|
||||
: (memory[ADDR]= BYTE) )
|
||||
|
||||
#define getMemory(ADDR) \
|
||||
( readCallback[ADDR] \
|
||||
? readCallback[ADDR](mpu, ADDR, 0) \
|
||||
: memory[ADDR] )
|
||||
|
||||
/* stack access (always direct) */
|
||||
|
||||
#define push(BYTE) (memory[0x0100 + S--]= (BYTE))
|
||||
#define pop() (memory[++S + 0x0100])
|
||||
|
||||
/* adressing modes (memory access direct) */
|
||||
|
||||
#define implied(ticks) \
|
||||
tick(ticks);
|
||||
|
||||
#define immediate(ticks) \
|
||||
tick(ticks); \
|
||||
ea= PC++;
|
||||
|
||||
#define abs(ticks) \
|
||||
tick(ticks); \
|
||||
ea= memory[PC] + (memory[PC + 1] << 8); \
|
||||
PC += 2;
|
||||
|
||||
#define relative(ticks) \
|
||||
tick(ticks); \
|
||||
ea= memory[PC++]; \
|
||||
if (ea & 0x80) ea -= 0x100; \
|
||||
tickIf((ea >> 8) != (PC >> 8));
|
||||
|
||||
#define indirect(ticks) \
|
||||
tick(ticks); \
|
||||
{ \
|
||||
word tmp; \
|
||||
tmp= memory[PC] + (memory[PC + 1] << 8); \
|
||||
ea = memory[tmp] + (memory[tmp + 1] << 8); \
|
||||
PC += 2; \
|
||||
}
|
||||
|
||||
#define absx(ticks) \
|
||||
tick(ticks); \
|
||||
ea= memory[PC] + (memory[PC + 1] << 8); \
|
||||
PC += 2; \
|
||||
tickIf((ticks == 4) && ((ea >> 8) != ((ea + X) >> 8))); \
|
||||
ea += X;
|
||||
|
||||
#define absy(ticks) \
|
||||
tick(ticks); \
|
||||
ea= memory[PC] + (memory[PC + 1] << 8); \
|
||||
PC += 2; \
|
||||
tickIf((ticks == 4) && ((ea >> 8) != ((ea + Y) >> 8))); \
|
||||
ea += Y
|
||||
|
||||
#define zp(ticks) \
|
||||
tick(ticks); \
|
||||
ea= memory[PC++];
|
||||
|
||||
#define zpx(ticks) \
|
||||
tick(ticks); \
|
||||
ea= memory[PC++] + X; \
|
||||
ea &= 0x00ff;
|
||||
|
||||
#define zpy(ticks) \
|
||||
tick(ticks); \
|
||||
ea= memory[PC++] + Y; \
|
||||
ea &= 0x00ff;
|
||||
|
||||
#define indx(ticks) \
|
||||
tick(ticks); \
|
||||
{ \
|
||||
byte tmp= memory[PC++] + X; \
|
||||
ea= memory[tmp] + (memory[tmp + 1] << 8); \
|
||||
}
|
||||
|
||||
#define indy(ticks) \
|
||||
tick(ticks); \
|
||||
{ \
|
||||
byte tmp= memory[PC++]; \
|
||||
ea= memory[tmp] + (memory[tmp + 1] << 8); \
|
||||
tickIf((ticks == 5) && ((ea >> 8) != ((ea + Y) >> 8))); \
|
||||
ea += Y; \
|
||||
}
|
||||
|
||||
#define indabsx(ticks) \
|
||||
tick(ticks); \
|
||||
{ \
|
||||
word tmp; \
|
||||
tmp= memory[PC ] + (memory[PC + 1] << 8) + X; \
|
||||
ea = memory[tmp] + (memory[tmp + 1] << 8); \
|
||||
}
|
||||
|
||||
#define indzp(ticks) \
|
||||
tick(ticks); \
|
||||
{ \
|
||||
byte tmp; \
|
||||
tmp= memory[PC++]; \
|
||||
ea = memory[tmp] + (memory[tmp + 1] << 8); \
|
||||
}
|
||||
|
||||
/* insns */
|
||||
|
||||
#define adc(ticks, adrmode) \
|
||||
adrmode(ticks); \
|
||||
{ \
|
||||
byte B= getMemory(ea); \
|
||||
if (!getD()) \
|
||||
{ \
|
||||
int c= A + B + getC(); \
|
||||
int v= (int8_t)A + (int8_t)B + getC(); \
|
||||
fetch(); \
|
||||
A= c; \
|
||||
setNVZC((A & 0x80), (((A & 0x80) > 0) ^ (v < 0)), (A == 0), ((c & 0x100) > 0)); \
|
||||
next(); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
int l, h, s; \
|
||||
/* inelegant & slow, but consistent with the hw for illegal digits */ \
|
||||
l= (A & 0x0F) + (B & 0x0F) + getC(); \
|
||||
h= (A & 0xF0) + (B & 0xF0); \
|
||||
if (l >= 0x0A) { l -= 0x0A; h += 0x10; } \
|
||||
if (h >= 0xA0) { h -= 0xA0; } \
|
||||
fetch(); \
|
||||
s= h | (l & 0x0F); \
|
||||
/* only C is valid on NMOS 6502 */ \
|
||||
setNVZC(s & 0x80, !(((A ^ B) & 0x80) && ((A ^ s) & 0x80)), !s, !!(h & 0x80)); \
|
||||
A= s; \
|
||||
tick(1); \
|
||||
next(); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define sbc(ticks, adrmode) \
|
||||
adrmode(ticks); \
|
||||
{ \
|
||||
byte B= getMemory(ea); \
|
||||
if (!getD()) \
|
||||
{ \
|
||||
int b= 1 - (P &0x01); \
|
||||
int c= A - B - b; \
|
||||
int v= (int8_t)A - (int8_t) B - b; \
|
||||
fetch(); \
|
||||
A= c; \
|
||||
setNVZC(A & 0x80, ((A & 0x80) > 0) ^ ((v & 0x100) != 0), A == 0, c >= 0); \
|
||||
next(); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
/* this is verbatim ADC, with a 10's complemented operand */ \
|
||||
int l, h, s; \
|
||||
B= 0x99 - B; \
|
||||
l= (A & 0x0F) + (B & 0x0F) + getC(); \
|
||||
h= (A & 0xF0) + (B & 0xF0); \
|
||||
if (l >= 0x0A) { l -= 0x0A; h += 0x10; } \
|
||||
if (h >= 0xA0) { h -= 0xA0; } \
|
||||
fetch(); \
|
||||
s= h | (l & 0x0F); \
|
||||
/* only C is valid on NMOS 6502 */ \
|
||||
setNVZC(s & 0x80, !(((A ^ B) & 0x80) && ((A ^ s) & 0x80)), !s, !!(h & 0x80)); \
|
||||
A= s; \
|
||||
tick(1); \
|
||||
next(); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define cmpR(ticks, adrmode, R) \
|
||||
adrmode(ticks); \
|
||||
fetch(); \
|
||||
{ \
|
||||
byte B= getMemory(ea); \
|
||||
byte d= R - B; \
|
||||
setNZC(d & 0x80, !d, R >= B); \
|
||||
} \
|
||||
next();
|
||||
|
||||
#define cmp(ticks, adrmode) cmpR(ticks, adrmode, A)
|
||||
#define cpx(ticks, adrmode) cmpR(ticks, adrmode, X)
|
||||
#define cpy(ticks, adrmode) cmpR(ticks, adrmode, Y)
|
||||
|
||||
#define dec(ticks, adrmode) \
|
||||
adrmode(ticks); \
|
||||
fetch(); \
|
||||
{ \
|
||||
byte B= getMemory(ea); \
|
||||
--B; \
|
||||
putMemory(ea, B); \
|
||||
setNZ(B & 0x80, !B); \
|
||||
} \
|
||||
next();
|
||||
|
||||
#define decR(ticks, adrmode, R) \
|
||||
fetch(); \
|
||||
tick(ticks); \
|
||||
--R; \
|
||||
setNZ(R & 0x80, !R); \
|
||||
next();
|
||||
|
||||
#define dea(ticks, adrmode) decR(ticks, adrmode, A)
|
||||
#define dex(ticks, adrmode) decR(ticks, adrmode, X)
|
||||
#define dey(ticks, adrmode) decR(ticks, adrmode, Y)
|
||||
|
||||
#define inc(ticks, adrmode) \
|
||||
adrmode(ticks); \
|
||||
fetch(); \
|
||||
{ \
|
||||
byte B= getMemory(ea); \
|
||||
++B; \
|
||||
putMemory(ea, B); \
|
||||
setNZ(B & 0x80, !B); \
|
||||
} \
|
||||
next();
|
||||
|
||||
#define incR(ticks, adrmode, R) \
|
||||
fetch(); \
|
||||
tick(ticks); \
|
||||
++R; \
|
||||
setNZ(R & 0x80, !R); \
|
||||
next();
|
||||
|
||||
#define ina(ticks, adrmode) incR(ticks, adrmode, A)
|
||||
#define inx(ticks, adrmode) incR(ticks, adrmode, X)
|
||||
#define iny(ticks, adrmode) incR(ticks, adrmode, Y)
|
||||
|
||||
#define bit(ticks, adrmode) \
|
||||
adrmode(ticks); \
|
||||
fetch(); \
|
||||
{ \
|
||||
byte B= getMemory(ea); \
|
||||
P= (P & ~(flagN | flagV | flagZ)) \
|
||||
| (B & (0xC0)) | (((A & B) == 0) << 1); \
|
||||
} \
|
||||
next();
|
||||
|
||||
#define tsb(ticks, adrmode) \
|
||||
adrmode(ticks); \
|
||||
fetch(); \
|
||||
{ \
|
||||
byte b= getMemory(ea); \
|
||||
b |= A; \
|
||||
putMemory(ea, b); \
|
||||
setZ(!b); \
|
||||
} \
|
||||
next();
|
||||
|
||||
#define trb(ticks, adrmode) \
|
||||
adrmode(ticks); \
|
||||
fetch(); \
|
||||
{ \
|
||||
byte b= getMemory(ea); \
|
||||
b |= (A ^ 0xFF); \
|
||||
putMemory(ea, b); \
|
||||
setZ(!b); \
|
||||
} \
|
||||
next();
|
||||
|
||||
#define bitwise(ticks, adrmode, op) \
|
||||
adrmode(ticks); \
|
||||
fetch(); \
|
||||
A op##= getMemory(ea); \
|
||||
setNZ(A & 0x80, !A); \
|
||||
next();
|
||||
|
||||
#define and(ticks, adrmode) bitwise(ticks, adrmode, &)
|
||||
#define eor(ticks, adrmode) bitwise(ticks, adrmode, ^)
|
||||
#define ora(ticks, adrmode) bitwise(ticks, adrmode, |)
|
||||
|
||||
#define asl(ticks, adrmode) \
|
||||
adrmode(ticks); \
|
||||
{ \
|
||||
unsigned int i= getMemory(ea) << 1; \
|
||||
putMemory(ea, i); \
|
||||
fetch(); \
|
||||
setNZC(i & 0x80, !i, i >> 8); \
|
||||
} \
|
||||
next();
|
||||
|
||||
#define asla(ticks, adrmode) \
|
||||
tick(ticks); \
|
||||
fetch(); \
|
||||
{ \
|
||||
int c= A >> 7; \
|
||||
A <<= 1; \
|
||||
setNZC(A & 0x80, !A, c); \
|
||||
} \
|
||||
next();
|
||||
|
||||
#define lsr(ticks, adrmode) \
|
||||
adrmode(ticks); \
|
||||
{ \
|
||||
byte b= getMemory(ea); \
|
||||
int c= b & 1; \
|
||||
fetch(); \
|
||||
b >>= 1; \
|
||||
putMemory(ea, b); \
|
||||
setNZC(0, !b, c); \
|
||||
} \
|
||||
next();
|
||||
|
||||
#define lsra(ticks, adrmode) \
|
||||
tick(ticks); \
|
||||
fetch(); \
|
||||
{ \
|
||||
int c= A & 1; \
|
||||
A >>= 1; \
|
||||
setNZC(0, !A, c); \
|
||||
} \
|
||||
next();
|
||||
|
||||
#define rol(ticks, adrmode) \
|
||||
adrmode(ticks); \
|
||||
{ \
|
||||
word b= (getMemory(ea) << 1) | getC(); \
|
||||
fetch(); \
|
||||
putMemory(ea, b); \
|
||||
setNZC(b & 0x80, !(b & 0xFF), b >> 8); \
|
||||
} \
|
||||
next();
|
||||
|
||||
#define rola(ticks, adrmode) \
|
||||
tick(ticks); \
|
||||
fetch(); \
|
||||
{ \
|
||||
word b= (A << 1) | getC(); \
|
||||
A= b; \
|
||||
setNZC(A & 0x80, !A, b >> 8); \
|
||||
} \
|
||||
next();
|
||||
|
||||
#define ror(ticks, adrmode) \
|
||||
adrmode(ticks); \
|
||||
{ \
|
||||
int c= getC(); \
|
||||
byte m= getMemory(ea); \
|
||||
byte b= (c << 7) | (m >> 1); \
|
||||
fetch(); \
|
||||
putMemory(ea, b); \
|
||||
setNZC(b & 0x80, !b, m & 1); \
|
||||
} \
|
||||
next();
|
||||
|
||||
#define rora(ticks, adrmode) \
|
||||
adrmode(ticks); \
|
||||
{ \
|
||||
int ci= getC(); \
|
||||
int co= A & 1; \
|
||||
fetch(); \
|
||||
A= (ci << 7) | (A >> 1); \
|
||||
setNZC(A & 0x80, !A, co); \
|
||||
} \
|
||||
next();
|
||||
|
||||
#define tRS(ticks, adrmode, R, S) \
|
||||
fetch(); \
|
||||
tick(ticks); \
|
||||
S= R; \
|
||||
setNZ(S & 0x80, !S); \
|
||||
next();
|
||||
|
||||
#define tax(ticks, adrmode) tRS(ticks, adrmode, A, X)
|
||||
#define txa(ticks, adrmode) tRS(ticks, adrmode, X, A)
|
||||
#define tay(ticks, adrmode) tRS(ticks, adrmode, A, Y)
|
||||
#define tya(ticks, adrmode) tRS(ticks, adrmode, Y, A)
|
||||
#define tsx(ticks, adrmode) tRS(ticks, adrmode, S, X)
|
||||
|
||||
#define txs(ticks, adrmode) \
|
||||
fetch(); \
|
||||
tick(ticks); \
|
||||
S= X; \
|
||||
next();
|
||||
|
||||
#define ldR(ticks, adrmode, R) \
|
||||
adrmode(ticks); \
|
||||
fetch(); \
|
||||
R= getMemory(ea); \
|
||||
setNZ(R & 0x80, !R); \
|
||||
next();
|
||||
|
||||
#define lda(ticks, adrmode) ldR(ticks, adrmode, A)
|
||||
#define ldx(ticks, adrmode) ldR(ticks, adrmode, X)
|
||||
#define ldy(ticks, adrmode) ldR(ticks, adrmode, Y)
|
||||
|
||||
#define stR(ticks, adrmode, R) \
|
||||
adrmode(ticks); \
|
||||
fetch(); \
|
||||
putMemory(ea, R); \
|
||||
next();
|
||||
|
||||
#define sta(ticks, adrmode) stR(ticks, adrmode, A)
|
||||
#define stx(ticks, adrmode) stR(ticks, adrmode, X)
|
||||
#define sty(ticks, adrmode) stR(ticks, adrmode, Y)
|
||||
#define stz(ticks, adrmode) stR(ticks, adrmode, 0)
|
||||
|
||||
#define branch(ticks, adrmode, cond) \
|
||||
if (cond) \
|
||||
{ \
|
||||
adrmode(ticks); \
|
||||
PC += ea; \
|
||||
tick(1); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
tick(ticks); \
|
||||
PC++; \
|
||||
} \
|
||||
fetch(); \
|
||||
next();
|
||||
|
||||
#define bcc(ticks, adrmode) branch(ticks, adrmode, !getC())
|
||||
#define bcs(ticks, adrmode) branch(ticks, adrmode, getC())
|
||||
#define bne(ticks, adrmode) branch(ticks, adrmode, !getZ())
|
||||
#define beq(ticks, adrmode) branch(ticks, adrmode, getZ())
|
||||
#define bpl(ticks, adrmode) branch(ticks, adrmode, !getN())
|
||||
#define bmi(ticks, adrmode) branch(ticks, adrmode, getN())
|
||||
#define bvc(ticks, adrmode) branch(ticks, adrmode, !getV())
|
||||
#define bvs(ticks, adrmode) branch(ticks, adrmode, getV())
|
||||
|
||||
#define bra(ticks, adrmode) \
|
||||
adrmode(ticks); \
|
||||
PC += ea; \
|
||||
fetch(); \
|
||||
tick(1); \
|
||||
next();
|
||||
|
||||
#define jmp(ticks, adrmode) \
|
||||
adrmode(ticks); \
|
||||
PC= ea; \
|
||||
if (mpu->callbacks->call[ea]) \
|
||||
{ \
|
||||
word addr; \
|
||||
externalise(); \
|
||||
if ((addr= mpu->callbacks->call[ea](mpu, ea, 0))) \
|
||||
{ \
|
||||
internalise(); \
|
||||
PC= addr; \
|
||||
} \
|
||||
} \
|
||||
fetch(); \
|
||||
next();
|
||||
|
||||
#define jsr(ticks, adrmode) \
|
||||
PC++; \
|
||||
push(PC >> 8); \
|
||||
push(PC & 0xff); \
|
||||
PC--; \
|
||||
adrmode(ticks); \
|
||||
if (mpu->callbacks->call[ea]) \
|
||||
{ \
|
||||
word addr; \
|
||||
externalise(); \
|
||||
if ((addr= mpu->callbacks->call[ea](mpu, ea, 0))) \
|
||||
{ \
|
||||
internalise(); \
|
||||
PC= addr; \
|
||||
fetch(); \
|
||||
next(); \
|
||||
} \
|
||||
} \
|
||||
PC=ea; \
|
||||
fetch(); \
|
||||
next();
|
||||
|
||||
#define rts(ticks, adrmode) \
|
||||
tick(ticks); \
|
||||
PC = pop(); \
|
||||
PC |= (pop() << 8); \
|
||||
PC++; \
|
||||
fetch(); \
|
||||
next();
|
||||
|
||||
#define brk(ticks, adrmode) \
|
||||
tick(ticks); \
|
||||
PC++; \
|
||||
push(PC >> 8); \
|
||||
push(PC & 0xff); \
|
||||
P |= flagB; \
|
||||
push(P | flagX); \
|
||||
P |= flagI; \
|
||||
{ \
|
||||
word hdlr= getMemory(0xfffe) + (getMemory(0xffff) << 8); \
|
||||
if (mpu->callbacks->call[hdlr]) \
|
||||
{ \
|
||||
word addr; \
|
||||
externalise(); \
|
||||
if ((addr= mpu->callbacks->call[hdlr](mpu, PC - 2, 0))) \
|
||||
{ \
|
||||
internalise(); \
|
||||
hdlr= addr; \
|
||||
} \
|
||||
} \
|
||||
PC= hdlr; \
|
||||
} \
|
||||
fetch(); \
|
||||
next();
|
||||
|
||||
#define rti(ticks, adrmode) \
|
||||
tick(ticks); \
|
||||
P= pop(); \
|
||||
PC= pop(); \
|
||||
PC |= (pop() << 8); \
|
||||
fetch(); \
|
||||
next();
|
||||
|
||||
#define nop(ticks, adrmode) \
|
||||
fetch(); \
|
||||
tick(ticks); \
|
||||
next();
|
||||
|
||||
#define ill(ticks, adrmode) \
|
||||
fetch(); \
|
||||
tick(ticks); \
|
||||
fflush(stdout); \
|
||||
fprintf(stderr, "\nundefined instruction %02X\n", memory[PC-1]); \
|
||||
return;
|
||||
|
||||
#define phR(ticks, adrmode, R) \
|
||||
fetch(); \
|
||||
tick(ticks); \
|
||||
push(R); \
|
||||
next();
|
||||
|
||||
#define pha(ticks, adrmode) phR(ticks, adrmode, A)
|
||||
#define phx(ticks, adrmode) phR(ticks, adrmode, X)
|
||||
#define phy(ticks, adrmode) phR(ticks, adrmode, Y)
|
||||
#define php(ticks, adrmode) phR(ticks, adrmode, P | flagX | flagB)
|
||||
|
||||
#define plR(ticks, adrmode, R) \
|
||||
fetch(); \
|
||||
tick(ticks); \
|
||||
R= pop(); \
|
||||
setNZ(R & 0x80, !R); \
|
||||
next();
|
||||
|
||||
#define pla(ticks, adrmode) plR(ticks, adrmode, A)
|
||||
#define plx(ticks, adrmode) plR(ticks, adrmode, X)
|
||||
#define ply(ticks, adrmode) plR(ticks, adrmode, Y)
|
||||
|
||||
#define plp(ticks, adrmode) \
|
||||
fetch(); \
|
||||
tick(ticks); \
|
||||
P= pop(); \
|
||||
next();
|
||||
|
||||
#define clF(ticks, adrmode, F) \
|
||||
fetch(); \
|
||||
tick(ticks); \
|
||||
P &= ~F; \
|
||||
next();
|
||||
|
||||
#define clc(ticks, adrmode) clF(ticks, adrmode, flagC)
|
||||
#define cld(ticks, adrmode) clF(ticks, adrmode, flagD)
|
||||
#define cli(ticks, adrmode) clF(ticks, adrmode, flagI)
|
||||
#define clv(ticks, adrmode) clF(ticks, adrmode, flagV)
|
||||
|
||||
#define seF(ticks, adrmode, F) \
|
||||
fetch(); \
|
||||
tick(ticks); \
|
||||
P |= F; \
|
||||
next();
|
||||
|
||||
#define sec(ticks, adrmode) seF(ticks, adrmode, flagC)
|
||||
#define sed(ticks, adrmode) seF(ticks, adrmode, flagD)
|
||||
#define sei(ticks, adrmode) seF(ticks, adrmode, flagI)
|
||||
|
||||
#define do_insns(_) \
|
||||
_(00, brk, implied, 7); _(01, ora, indx, 6); _(02, ill, implied, 2); _(03, ill, implied, 2); \
|
||||
_(04, tsb, zp, 3); _(05, ora, zp, 3); _(06, asl, zp, 5); _(07, ill, implied, 2); \
|
||||
_(08, php, implied, 3); _(09, ora, immediate, 3); _(0a, asla,implied, 2); _(0b, ill, implied, 2); \
|
||||
_(0c, tsb, abs, 4); _(0d, ora, abs, 4); _(0e, asl, abs, 6); _(0f, ill, implied, 2); \
|
||||
_(10, bpl, relative, 2); _(11, ora, indy, 5); _(12, ora, indzp, 3); _(13, ill, implied, 2); \
|
||||
_(14, trb, zp, 3); _(15, ora, zpx, 4); _(16, asl, zpx, 6); _(17, ill, implied, 2); \
|
||||
_(18, clc, implied, 2); _(19, ora, absy, 4); _(1a, ina, implied, 2); _(1b, ill, implied, 2); \
|
||||
_(1c, trb, abs, 4); _(1d, ora, absx, 4); _(1e, asl, absx, 7); _(1f, ill, implied, 2); \
|
||||
_(20, jsr, abs, 6); _(21, and, indx, 6); _(22, ill, implied, 2); _(23, ill, implied, 2); \
|
||||
_(24, bit, zp, 3); _(25, and, zp, 3); _(26, rol, zp, 5); _(27, ill, implied, 2); \
|
||||
_(28, plp, implied, 4); _(29, and, immediate, 3); _(2a, rola,implied, 2); _(2b, ill, implied, 2); \
|
||||
_(2c, bit, abs, 4); _(2d, and, abs, 4); _(2e, rol, abs, 6); _(2f, ill, implied, 2); \
|
||||
_(30, bmi, relative, 2); _(31, and, indy, 5); _(32, and, indzp, 3); _(33, ill, implied, 2); \
|
||||
_(34, bit, zpx, 4); _(35, and, zpx, 4); _(36, rol, zpx, 6); _(37, ill, implied, 2); \
|
||||
_(38, sec, implied, 2); _(39, and, absy, 4); _(3a, dea, implied, 2); _(3b, ill, implied, 2); \
|
||||
_(3c, bit, absx, 4); _(3d, and, absx, 4); _(3e, rol, absx, 7); _(3f, ill, implied, 2); \
|
||||
_(40, rti, implied, 6); _(41, eor, indx, 6); _(42, ill, implied, 2); _(43, ill, implied, 2); \
|
||||
_(44, ill, implied, 2); _(45, eor, zp, 3); _(46, lsr, zp, 5); _(47, ill, implied, 2); \
|
||||
_(48, pha, implied, 3); _(49, eor, immediate, 3); _(4a, lsra,implied, 2); _(4b, ill, implied, 2); \
|
||||
_(4c, jmp, abs, 3); _(4d, eor, abs, 4); _(4e, lsr, abs, 6); _(4f, ill, implied, 2); \
|
||||
_(50, bvc, relative, 2); _(51, eor, indy, 5); _(52, eor, indzp, 3); _(53, ill, implied, 2); \
|
||||
_(54, ill, implied, 2); _(55, eor, zpx, 4); _(56, lsr, zpx, 6); _(57, ill, implied, 2); \
|
||||
_(58, cli, implied, 2); _(59, eor, absy, 4); _(5a, phy, implied, 3); _(5b, ill, implied, 2); \
|
||||
_(5c, ill, implied, 2); _(5d, eor, absx, 4); _(5e, lsr, absx, 7); _(5f, ill, implied, 2); \
|
||||
_(60, rts, implied, 6); _(61, adc, indx, 6); _(62, ill, implied, 2); _(63, ill, implied, 2); \
|
||||
_(64, stz, zp, 3); _(65, adc, zp, 3); _(66, ror, zp, 5); _(67, ill, implied, 2); \
|
||||
_(68, pla, implied, 4); _(69, adc, immediate, 3); _(6a, rora,implied, 2); _(6b, ill, implied, 2); \
|
||||
_(6c, jmp, indirect, 5); _(6d, adc, abs, 4); _(6e, ror, abs, 6); _(6f, ill, implied, 2); \
|
||||
_(70, bvs, relative, 2); _(71, adc, indy, 5); _(72, adc, indzp, 3); _(73, ill, implied, 2); \
|
||||
_(74, stz, zpx, 4); _(75, adc, zpx, 4); _(76, ror, zpx, 6); _(77, ill, implied, 2); \
|
||||
_(78, sei, implied, 2); _(79, adc, absy, 4); _(7a, ply, implied, 4); _(7b, ill, implied, 2); \
|
||||
_(7c, jmp, indabsx, 6); _(7d, adc, absx, 4); _(7e, ror, absx, 7); _(7f, ill, implied, 2); \
|
||||
_(80, bra, relative, 2); _(81, sta, indx, 6); _(82, ill, implied, 2); _(83, ill, implied, 2); \
|
||||
_(84, sty, zp, 2); _(85, sta, zp, 2); _(86, stx, zp, 2); _(87, ill, implied, 2); \
|
||||
_(88, dey, implied, 2); _(89, bit, immediate, 2); _(8a, txa, implied, 2); _(8b, ill, implied, 2); \
|
||||
_(8c, sty, abs, 4); _(8d, sta, abs, 4); _(8e, stx, abs, 4); _(8f, ill, implied, 2); \
|
||||
_(90, bcc, relative, 2); _(91, sta, indy, 6); _(92, sta, indzp, 3); _(93, ill, implied, 2); \
|
||||
_(94, sty, zpx, 4); _(95, sta, zpx, 4); _(96, stx, zpy, 4); _(97, ill, implied, 2); \
|
||||
_(98, tya, implied, 2); _(99, sta, absy, 5); _(9a, txs, implied, 2); _(9b, ill, implied, 2); \
|
||||
_(9c, stz, abs, 4); _(9d, sta, absx, 5); _(9e, stz, absx, 5); _(9f, ill, implied, 2); \
|
||||
_(a0, ldy, immediate, 3); _(a1, lda, indx, 6); _(a2, ldx, immediate, 3); _(a3, ill, implied, 2); \
|
||||
_(a4, ldy, zp, 3); _(a5, lda, zp, 3); _(a6, ldx, zp, 3); _(a7, ill, implied, 2); \
|
||||
_(a8, tay, implied, 2); _(a9, lda, immediate, 3); _(aa, tax, implied, 2); _(ab, ill, implied, 2); \
|
||||
_(ac, ldy, abs, 4); _(ad, lda, abs, 4); _(ae, ldx, abs, 4); _(af, ill, implied, 2); \
|
||||
_(b0, bcs, relative, 2); _(b1, lda, indy, 5); _(b2, lda, indzp, 3); _(b3, ill, implied, 2); \
|
||||
_(b4, ldy, zpx, 4); _(b5, lda, zpx, 4); _(b6, ldx, zpy, 4); _(b7, ill, implied, 2); \
|
||||
_(b8, clv, implied, 2); _(b9, lda, absy, 4); _(ba, tsx, implied, 2); _(bb, ill, implied, 2); \
|
||||
_(bc, ldy, absx, 4); _(bd, lda, absx, 4); _(be, ldx, absy, 4); _(bf, ill, implied, 2); \
|
||||
_(c0, cpy, immediate, 3); _(c1, cmp, indx, 6); _(c2, ill, implied, 2); _(c3, ill, implied, 2); \
|
||||
_(c4, cpy, zp, 3); _(c5, cmp, zp, 3); _(c6, dec, zp, 5); _(c7, ill, implied, 2); \
|
||||
_(c8, iny, implied, 2); _(c9, cmp, immediate, 3); _(ca, dex, implied, 2); _(cb, ill, implied, 2); \
|
||||
_(cc, cpy, abs, 4); _(cd, cmp, abs, 4); _(ce, dec, abs, 6); _(cf, ill, implied, 2); \
|
||||
_(d0, bne, relative, 2); _(d1, cmp, indy, 5); _(d2, cmp, indzp, 3); _(d3, ill, implied, 2); \
|
||||
_(d4, ill, implied, 2); _(d5, cmp, zpx, 4); _(d6, dec, zpx, 6); _(d7, ill, implied, 2); \
|
||||
_(d8, cld, implied, 2); _(d9, cmp, absy, 4); _(da, phx, implied, 3); _(db, ill, implied, 2); \
|
||||
_(dc, ill, implied, 2); _(dd, cmp, absx, 4); _(de, dec, absx, 7); _(df, ill, implied, 2); \
|
||||
_(e0, cpx, immediate, 3); _(e1, sbc, indx, 6); _(e2, ill, implied, 2); _(e3, ill, implied, 2); \
|
||||
_(e4, cpx, zp, 3); _(e5, sbc, zp, 3); _(e6, inc, zp, 5); _(e7, ill, implied, 2); \
|
||||
_(e8, inx, implied, 2); _(e9, sbc, immediate, 3); _(ea, nop, implied, 2); _(eb, ill, implied, 2); \
|
||||
_(ec, cpx, abs, 4); _(ed, sbc, abs, 4); _(ee, inc, abs, 6); _(ef, ill, implied, 2); \
|
||||
_(f0, beq, relative, 2); _(f1, sbc, indy, 5); _(f2, sbc, indzp, 3); _(f3, ill, implied, 2); \
|
||||
_(f4, ill, implied, 2); _(f5, sbc, zpx, 4); _(f6, inc, zpx, 6); _(f7, ill, implied, 2); \
|
||||
_(f8, sed, implied, 2); _(f9, sbc, absy, 4); _(fa, plx, implied, 4); _(fb, ill, implied, 2); \
|
||||
_(fc, ill, implied, 2); _(fd, sbc, absx, 4); _(fe, inc, absx, 7); _(ff, ill, implied, 2);
|
||||
|
||||
|
||||
|
||||
void M6502_irq(M6502 *mpu)
|
||||
{
|
||||
if (!(mpu->registers->p & flagI))
|
||||
{
|
||||
mpu->memory[0x0100 + mpu->registers->s--] = (byte)(mpu->registers->pc >> 8);
|
||||
mpu->memory[0x0100 + mpu->registers->s--] = (byte)(mpu->registers->pc & 0xff);
|
||||
mpu->memory[0x0100 + mpu->registers->s--] = mpu->registers->p;
|
||||
mpu->registers->p &= ~flagB;
|
||||
mpu->registers->p |= flagI;
|
||||
mpu->registers->pc = M6502_getVector(mpu, IRQ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void M6502_nmi(M6502 *mpu)
|
||||
{
|
||||
mpu->memory[0x0100 + mpu->registers->s--] = (byte)(mpu->registers->pc >> 8);
|
||||
mpu->memory[0x0100 + mpu->registers->s--] = (byte)(mpu->registers->pc & 0xff);
|
||||
mpu->memory[0x0100 + mpu->registers->s--] = mpu->registers->p;
|
||||
mpu->registers->p &= ~flagB;
|
||||
mpu->registers->p |= flagI;
|
||||
mpu->registers->pc = M6502_getVector(mpu, NMI);
|
||||
}
|
||||
|
||||
|
||||
void M6502_reset(M6502 *mpu)
|
||||
{
|
||||
mpu->registers->p &= ~flagD;
|
||||
mpu->registers->p |= flagI;
|
||||
mpu->registers->pc = M6502_getVector(mpu, RST);
|
||||
}
|
||||
|
||||
|
||||
/* the compiler should elminate all call to this function */
|
||||
|
||||
static void oops(void)
|
||||
{
|
||||
fprintf(stderr, "\noops -- instruction dispatch missing\n");
|
||||
}
|
||||
|
||||
|
||||
void M6502_run(M6502 *mpu)
|
||||
{
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
|
||||
static void *itab[256]= { &&_00, &&_01, &&_02, &&_03, &&_04, &&_05, &&_06, &&_07, &&_08, &&_09, &&_0a, &&_0b, &&_0c, &&_0d, &&_0e, &&_0f,
|
||||
&&_10, &&_11, &&_12, &&_13, &&_14, &&_15, &&_16, &&_17, &&_18, &&_19, &&_1a, &&_1b, &&_1c, &&_1d, &&_1e, &&_1f,
|
||||
&&_20, &&_21, &&_22, &&_23, &&_24, &&_25, &&_26, &&_27, &&_28, &&_29, &&_2a, &&_2b, &&_2c, &&_2d, &&_2e, &&_2f,
|
||||
&&_30, &&_31, &&_32, &&_33, &&_34, &&_35, &&_36, &&_37, &&_38, &&_39, &&_3a, &&_3b, &&_3c, &&_3d, &&_3e, &&_3f,
|
||||
&&_40, &&_41, &&_42, &&_43, &&_44, &&_45, &&_46, &&_47, &&_48, &&_49, &&_4a, &&_4b, &&_4c, &&_4d, &&_4e, &&_4f,
|
||||
&&_50, &&_51, &&_52, &&_53, &&_54, &&_55, &&_56, &&_57, &&_58, &&_59, &&_5a, &&_5b, &&_5c, &&_5d, &&_5e, &&_5f,
|
||||
&&_60, &&_61, &&_62, &&_63, &&_64, &&_65, &&_66, &&_67, &&_68, &&_69, &&_6a, &&_6b, &&_6c, &&_6d, &&_6e, &&_6f,
|
||||
&&_70, &&_71, &&_72, &&_73, &&_74, &&_75, &&_76, &&_77, &&_78, &&_79, &&_7a, &&_7b, &&_7c, &&_7d, &&_7e, &&_7f,
|
||||
&&_80, &&_81, &&_82, &&_83, &&_84, &&_85, &&_86, &&_87, &&_88, &&_89, &&_8a, &&_8b, &&_8c, &&_8d, &&_8e, &&_8f,
|
||||
&&_90, &&_91, &&_92, &&_93, &&_94, &&_95, &&_96, &&_97, &&_98, &&_99, &&_9a, &&_9b, &&_9c, &&_9d, &&_9e, &&_9f,
|
||||
&&_a0, &&_a1, &&_a2, &&_a3, &&_a4, &&_a5, &&_a6, &&_a7, &&_a8, &&_a9, &&_aa, &&_ab, &&_ac, &&_ad, &&_ae, &&_af,
|
||||
&&_b0, &&_b1, &&_b2, &&_b3, &&_b4, &&_b5, &&_b6, &&_b7, &&_b8, &&_b9, &&_ba, &&_bb, &&_bc, &&_bd, &&_be, &&_bf,
|
||||
&&_c0, &&_c1, &&_c2, &&_c3, &&_c4, &&_c5, &&_c6, &&_c7, &&_c8, &&_c9, &&_ca, &&_cb, &&_cc, &&_cd, &&_ce, &&_cf,
|
||||
&&_d0, &&_d1, &&_d2, &&_d3, &&_d4, &&_d5, &&_d6, &&_d7, &&_d8, &&_d9, &&_da, &&_db, &&_dc, &&_dd, &&_de, &&_df,
|
||||
&&_e0, &&_e1, &&_e2, &&_e3, &&_e4, &&_e5, &&_e6, &&_e7, &&_e8, &&_e9, &&_ea, &&_eb, &&_ec, &&_ed, &&_ee, &&_ef,
|
||||
&&_f0, &&_f1, &&_f2, &&_f3, &&_f4, &&_f5, &&_f6, &&_f7, &&_f8, &&_f9, &&_fa, &&_fb, &&_fc, &&_fd, &&_fe, &&_ff };
|
||||
|
||||
register void **itabp= &itab[0];
|
||||
register void *tpc;
|
||||
|
||||
# define begin() fetch(); next()
|
||||
# define fetch() tpc= itabp[memory[PC++]]
|
||||
# define next() goto *tpc
|
||||
# define dispatch(num, name, mode, cycles) _##num: name(cycles, mode) oops(); next()
|
||||
# define end()
|
||||
|
||||
#else /* (!__GNUC__) || (__STRICT_ANSI__) */
|
||||
|
||||
# define begin() for (;;) switch (memory[PC++]) {
|
||||
# define fetch()
|
||||
# define next() break
|
||||
# define dispatch(num, name, mode, cycles) case 0x##num: name(cycles, mode); next()
|
||||
# define end() }
|
||||
|
||||
#endif
|
||||
|
||||
register byte *memory= mpu->memory;
|
||||
register word PC;
|
||||
word ea;
|
||||
byte A, X, Y, P, S;
|
||||
M6502_Callback *readCallback= mpu->callbacks->read;
|
||||
M6502_Callback *writeCallback= mpu->callbacks->write;
|
||||
|
||||
# define internalise() A= mpu->registers->a; X= mpu->registers->x; Y= mpu->registers->y; P= mpu->registers->p; S= mpu->registers->s; PC= mpu->registers->pc
|
||||
# define externalise() mpu->registers->a= A; mpu->registers->x= X; mpu->registers->y= Y; mpu->registers->p= P; mpu->registers->s= S; mpu->registers->pc= PC
|
||||
|
||||
internalise();
|
||||
|
||||
begin();
|
||||
do_insns(dispatch);
|
||||
end();
|
||||
|
||||
# undef begin
|
||||
# undef internalise
|
||||
# undef externalise
|
||||
# undef fetch
|
||||
# undef next
|
||||
# undef dispatch
|
||||
# undef end
|
||||
|
||||
(void)oops;
|
||||
}
|
||||
|
||||
|
||||
int M6502_disassemble(M6502 *mpu, word ip, char buffer[64])
|
||||
{
|
||||
char *s= buffer;
|
||||
byte *b= mpu->memory + ip;
|
||||
|
||||
switch (b[0])
|
||||
{
|
||||
# define _implied return 1;
|
||||
# define _immediate sprintf(s, "#%02X", b[1]); return 2;
|
||||
# define _zp sprintf(s, "%02X", b[1]); return 2;
|
||||
# define _zpx sprintf(s, "%02X,X", b[1]); return 2;
|
||||
# define _zpy sprintf(s, "%02X,Y", b[1]); return 2;
|
||||
# define _abs sprintf(s, "%02X%02X", b[2], b[1]); return 3;
|
||||
# define _absx sprintf(s, "%02X%02X,X", b[2], b[1]); return 3;
|
||||
# define _absy sprintf(s, "%02X%02X,Y", b[2], b[1]); return 3;
|
||||
# define _relative sprintf(s, "%04X", ip + 2 + (int8_t)b[1]); return 2;
|
||||
# define _indirect sprintf(s, "(%02X%02X)", b[2], b[1]); return 3;
|
||||
# define _indzp sprintf(s, "(%02X)", b[1]); return 2;
|
||||
# define _indx sprintf(s, "(%02X,X)", b[1]); return 2;
|
||||
# define _indy sprintf(s, "(%02X),Y", b[1]); return 2;
|
||||
# define _indabsx sprintf(s, "(%02X%02X,X)", b[2], b[1]); return 3;
|
||||
|
||||
# define disassemble(num, name, mode, cycles) case 0x##num: s += sprintf(s, "%s ", #name); _##mode
|
||||
do_insns(disassemble);
|
||||
# undef _do
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void M6502_dump(M6502 *mpu, char buffer[64])
|
||||
{
|
||||
M6502_Registers *r= mpu->registers;
|
||||
uint8_t p= r->p;
|
||||
# define P(N,C) (p & (1 << (N)) ? (C) : '-')
|
||||
sprintf(buffer, "PC=%04X SP=%04X A=%02X X=%02X Y=%02X P=%02X %c%c%c%c%c%c%c%c",
|
||||
r->pc, 0x0100 + r->s,
|
||||
r->a, r->x, r->y, r->p,
|
||||
P(7,'N'), P(6,'V'), P(5,'?'), P(4,'B'), P(3,'D'), P(2,'I'), P(1,'Z'), P(0,'C'));
|
||||
# undef P
|
||||
}
|
||||
|
||||
|
||||
static void outOfMemory(void)
|
||||
{
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "\nout of memory\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
M6502 *M6502_new(M6502_Registers *registers, M6502_Memory memory, M6502_Callbacks *callbacks)
|
||||
{
|
||||
M6502 *mpu= calloc(1, sizeof(M6502));
|
||||
if (!mpu) outOfMemory();
|
||||
|
||||
if (!registers) { registers = (M6502_Registers *)calloc(1, sizeof(M6502_Registers)); mpu->flags |= M6502_RegistersAllocated; }
|
||||
if (!memory ) { memory = (uint8_t *)calloc(1, sizeof(M6502_Memory )); mpu->flags |= M6502_MemoryAllocated; }
|
||||
if (!callbacks) { callbacks = (M6502_Callbacks *)calloc(1, sizeof(M6502_Callbacks)); mpu->flags |= M6502_CallbacksAllocated; }
|
||||
|
||||
if (!registers || !memory || !callbacks) outOfMemory();
|
||||
|
||||
mpu->registers = registers;
|
||||
mpu->memory = memory;
|
||||
mpu->callbacks = callbacks;
|
||||
|
||||
return mpu;
|
||||
}
|
||||
|
||||
|
||||
void M6502_delete(M6502 *mpu)
|
||||
{
|
||||
if (mpu->flags & M6502_CallbacksAllocated) free(mpu->callbacks);
|
||||
if (mpu->flags & M6502_MemoryAllocated ) free(mpu->memory);
|
||||
if (mpu->flags & M6502_RegistersAllocated) free(mpu->registers);
|
||||
|
||||
free(mpu);
|
||||
}
|
75
src/lib6502/lib6502.h
Normal file
75
src/lib6502/lib6502.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
#ifndef __m6502_h
|
||||
#define __m6502_h
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct _M6502 M6502;
|
||||
typedef struct _M6502_Registers M6502_Registers;
|
||||
typedef struct _M6502_Callbacks M6502_Callbacks;
|
||||
|
||||
typedef int (*M6502_Callback)(M6502 *mpu, uint16_t address, uint8_t data);
|
||||
|
||||
typedef M6502_Callback M6502_CallbackTable[0x10000];
|
||||
typedef uint8_t M6502_Memory[0x10000];
|
||||
|
||||
enum {
|
||||
M6502_NMIVector= 0xfffa, M6502_NMIVectorLSB= 0xfffa, M6502_NMIVectorMSB= 0xfffb,
|
||||
M6502_RSTVector= 0xfffc, M6502_RSTVectorLSB= 0xfffc, M6502_RSTVectorMSB= 0xfffd,
|
||||
M6502_IRQVector= 0xfffe, M6502_IRQVectorLSB= 0xfffe, M6502_IRQVectorMSB= 0xffff
|
||||
};
|
||||
|
||||
struct _M6502_Registers
|
||||
{
|
||||
uint8_t a; /* accumulator */
|
||||
uint8_t x; /* X index register */
|
||||
uint8_t y; /* Y index register */
|
||||
uint8_t p; /* processor status register */
|
||||
uint8_t s; /* stack pointer */
|
||||
uint16_t pc; /* program counter */
|
||||
};
|
||||
|
||||
struct _M6502_Callbacks
|
||||
{
|
||||
M6502_CallbackTable read;
|
||||
M6502_CallbackTable write;
|
||||
M6502_CallbackTable call;
|
||||
};
|
||||
|
||||
struct _M6502
|
||||
{
|
||||
M6502_Registers *registers;
|
||||
uint8_t *memory;
|
||||
M6502_Callbacks *callbacks;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
enum {
|
||||
M6502_RegistersAllocated = 1 << 0,
|
||||
M6502_MemoryAllocated = 1 << 1,
|
||||
M6502_CallbacksAllocated = 1 << 2
|
||||
};
|
||||
|
||||
extern M6502 *M6502_new(M6502_Registers *registers, M6502_Memory memory, M6502_Callbacks *callbacks);
|
||||
extern void M6502_reset(M6502 *mpu);
|
||||
extern void M6502_nmi(M6502 *mpu);
|
||||
extern void M6502_irq(M6502 *mpu);
|
||||
extern void M6502_run(M6502 *mpu);
|
||||
extern int M6502_disassemble(M6502 *mpu, uint16_t addr, char buffer[64]);
|
||||
extern void M6502_dump(M6502 *mpu, char buffer[64]);
|
||||
extern void M6502_delete(M6502 *mpu);
|
||||
|
||||
#define M6502_getVector(MPU, VEC) \
|
||||
( ( ((MPU)->memory[M6502_##VEC##VectorLSB]) ) \
|
||||
| ((MPU)->memory[M6502_##VEC##VectorMSB] << 8) )
|
||||
|
||||
#define M6502_setVector(MPU, VEC, ADDR) \
|
||||
( ( ((MPU)->memory[M6502_##VEC##VectorLSB]= ((uint8_t)(ADDR)) & 0xff) ) \
|
||||
, ((MPU)->memory[M6502_##VEC##VectorMSB]= (uint8_t)((ADDR) >> 8)) )
|
||||
|
||||
#define M6502_getCallback(MPU, TYPE, ADDR) ((MPU)->callbacks->TYPE[ADDR])
|
||||
#define M6502_setCallback(MPU, TYPE, ADDR, FN) ((MPU)->callbacks->TYPE[ADDR]= (FN))
|
||||
|
||||
|
||||
#endif __m6502_h
|
1
src/lib6502/man/M6502_delete.3
Normal file
1
src/lib6502/man/M6502_delete.3
Normal file
|
@ -0,0 +1 @@
|
|||
.so man3/lib6502.3
|
1
src/lib6502/man/M6502_disassemble.3
Normal file
1
src/lib6502/man/M6502_disassemble.3
Normal file
|
@ -0,0 +1 @@
|
|||
.so man3/lib6502.3
|
1
src/lib6502/man/M6502_dump.3
Normal file
1
src/lib6502/man/M6502_dump.3
Normal file
|
@ -0,0 +1 @@
|
|||
.so man3/lib6502.3
|
1
src/lib6502/man/M6502_getCallback.3
Normal file
1
src/lib6502/man/M6502_getCallback.3
Normal file
|
@ -0,0 +1 @@
|
|||
.so man3/lib6502.3
|
1
src/lib6502/man/M6502_getVector.3
Normal file
1
src/lib6502/man/M6502_getVector.3
Normal file
|
@ -0,0 +1 @@
|
|||
.so man3/lib6502.3
|
1
src/lib6502/man/M6502_irq.3
Normal file
1
src/lib6502/man/M6502_irq.3
Normal file
|
@ -0,0 +1 @@
|
|||
.so man3/lib6502.3
|
1
src/lib6502/man/M6502_new.3
Normal file
1
src/lib6502/man/M6502_new.3
Normal file
|
@ -0,0 +1 @@
|
|||
.so man3/lib6502.3
|
1
src/lib6502/man/M6502_nmi.3
Normal file
1
src/lib6502/man/M6502_nmi.3
Normal file
|
@ -0,0 +1 @@
|
|||
.so man3/lib6502.3
|
1
src/lib6502/man/M6502_reset.3
Normal file
1
src/lib6502/man/M6502_reset.3
Normal file
|
@ -0,0 +1 @@
|
|||
.so man3/lib6502.3
|
1
src/lib6502/man/M6502_run.3
Normal file
1
src/lib6502/man/M6502_run.3
Normal file
|
@ -0,0 +1 @@
|
|||
.so man3/lib6502.3
|
1
src/lib6502/man/M6502_setCallback.3
Normal file
1
src/lib6502/man/M6502_setCallback.3
Normal file
|
@ -0,0 +1 @@
|
|||
.so man3/lib6502.3
|
1
src/lib6502/man/M6502_setVector.3
Normal file
1
src/lib6502/man/M6502_setVector.3
Normal file
|
@ -0,0 +1 @@
|
|||
.so man3/lib6502.3
|
508
src/lib6502/man/lib6502.3
Normal file
508
src/lib6502/man/lib6502.3
Normal file
|
@ -0,0 +1,508 @@
|
|||
.\" Copyright (c) 2005 Ian Piumarta
|
||||
.\"
|
||||
.\" Permission is hereby granted, free of charge, to any person
|
||||
.\" obtaining a copy of this software and associated documentation
|
||||
.\" files (the 'Software'), to deal in the Software without
|
||||
.\" restriction, including without limitation the rights to use, copy,
|
||||
.\" modify, merge, publish, distribute, and/or sell copies of the
|
||||
.\" Software, and to permit persons to whom the Software is furnished
|
||||
.\" to do so, provided that the above copyright notice(s) and this
|
||||
.\" permission notice appear in all copies of the Software and that
|
||||
.\" both the above copyright notice(s) and this permission notice
|
||||
.\" appear in supporting documentation.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
|
||||
.\"
|
||||
.\" last edited: 2005-11-02 01:18:07 by piumarta on margaux.local
|
||||
.\"
|
||||
.Dd October 31, 2005
|
||||
.Dt LIB6502 3 LOCAL
|
||||
.Os ""
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh NAME
|
||||
.\"
|
||||
.Nm lib6502
|
||||
.Nd 6502 microprocessor emulator
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh SYNOPSIS
|
||||
.\"
|
||||
.In stdint.h
|
||||
.In lib6502.h
|
||||
.Ft M6502 *
|
||||
.Fn M6502_new "M6502_Registers *registers" "M6502_Memory memory" "M6502_Callbacks *callbacks"
|
||||
.Ft void
|
||||
.Fn M6502_reset "M6502 *mpu"
|
||||
.Ft void
|
||||
.Fn M6502_nmi "M6502 *mpu"
|
||||
.Ft void
|
||||
.Fn M6502_irq "M6502 *mpu"
|
||||
.Ft uint16_t
|
||||
.Fn M6502_getVector "M6502 *mpu" "vector"
|
||||
.Ft uint16_t
|
||||
.Fn M6502_setVector "M6502 *mpu" "vector" "uint16_t address"
|
||||
.Ft M6502_Callback
|
||||
.Fn M6502_getCallback "M6502 *mpu" "type" "uint16_t address"
|
||||
.Ft M6502_Callback
|
||||
.Fn M6502_setCallback "M6502 *mpu" "type" "uint16_t address" "M6502_Callback callback"
|
||||
.Ft void
|
||||
.Fn M6502_run "M6502 *mpu"
|
||||
.Ft int
|
||||
.Fn M6502_disassemble "M6502 *mpu" "uint16_t address" "char buffer[64]"
|
||||
.Ft void
|
||||
.Fn M6502_dump "M6502 *mpu" "char buffer[64]"
|
||||
.Ft void
|
||||
.Fn M6502_delete "M6502 *mpu"
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh DESCRIPTION
|
||||
.\"
|
||||
.Fn M6502_new
|
||||
creates an instance of a 6502 microprocessor.
|
||||
.Fn M6502_reset ,
|
||||
.Fn M6502_nmi
|
||||
and
|
||||
.Fn M6502_irq
|
||||
place it into the states associated with the hardware signals for
|
||||
reset, non-maskable interrupt and interrupt request, respectively.
|
||||
The macros
|
||||
.Fn M6502_getVector
|
||||
and
|
||||
.Fn M6502_setVector
|
||||
read and write the vectors through which the processor jumps in
|
||||
response to the above signals. The macros
|
||||
.Fn M6502_getCallback
|
||||
and
|
||||
.Fn M6502_setVector
|
||||
read and write client-supplied functions that intercept accesses to
|
||||
memory.
|
||||
.Fn M6502_run
|
||||
begins emulated execution.
|
||||
.Fn M6502_dump
|
||||
and
|
||||
.Fn M6502_disassemble
|
||||
create human-readable representations of processor or memory state.
|
||||
.Fn M6502_delete
|
||||
frees all resources associated with a processor instance. Each of
|
||||
these functions and macros is described in more detail below.
|
||||
.Pp
|
||||
.Fn M6502_new
|
||||
returns a pointer to a
|
||||
.Fa M6502
|
||||
structure containing at least the following members:
|
||||
.Bd -literal
|
||||
struct _M6502
|
||||
{
|
||||
M6502_Registers *registers; /* processor state */
|
||||
uint8_t *memory; /* memory image */
|
||||
M6502_Callbacks *callbacks; /* r/w/x callbacks */
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
These members are initialised according to the supplied
|
||||
.Fa registers ,
|
||||
.Fa memory
|
||||
and
|
||||
.Fa callbacks
|
||||
arguments. If a given argument is NULL, the corresponding member is
|
||||
initialised automatically with a suitable (non-NULL) value.
|
||||
.Pp
|
||||
The members of
|
||||
.Fa M6502
|
||||
are as follows:
|
||||
.Bl -tag -width ".Fa callbacks"
|
||||
.It Fa registers
|
||||
the processor state, containing all registers and condition codes.
|
||||
.It Fa memory
|
||||
a block of at least 64 kilobytes of storage containing the processor's
|
||||
memory. (An array type
|
||||
.Vt M6502_Memory,
|
||||
suitable for defining values to pass as the
|
||||
.Fa memory
|
||||
argument, is defined in the
|
||||
.In lib6502.h
|
||||
include file.)
|
||||
.It Fa callbacks
|
||||
a structure mapping processor memory accesses to client callback
|
||||
functions.
|
||||
.El
|
||||
.Pp
|
||||
Access to the contents of the
|
||||
.Fa registers
|
||||
and
|
||||
.Fa memory
|
||||
members can be made directly.
|
||||
The
|
||||
.Fa registers
|
||||
member is a
|
||||
.Vt M6502_Registers
|
||||
containing the following members:
|
||||
.Bd -literal
|
||||
struct _M6502_Registers
|
||||
{
|
||||
uint8_t a; /* accumulator */
|
||||
uint8_t x; /* X index register */
|
||||
uint8_t y; /* Y index register */
|
||||
uint8_t p; /* processor status register */
|
||||
uint8_t s; /* stack pointer */
|
||||
uint16_t pc; /* program counter */
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
The
|
||||
.Fa memory
|
||||
member is an array of
|
||||
.Vt unsigned char
|
||||
and can be indexed directly. In addition, two convenience macros
|
||||
.Fn M6502_getVector
|
||||
and
|
||||
.Fn M6502_setVector
|
||||
provide access to the reset and interrupt vectors within
|
||||
.Fa memory .
|
||||
.Fn M6502_getVector
|
||||
returns the address stored in the named
|
||||
.Fa vector
|
||||
which must be precisely one of the following:
|
||||
.Bl -tag -width ".Dv RST" -offset indent
|
||||
.It Dv RST
|
||||
the reset vector.
|
||||
.It Dv NMI
|
||||
the non-maskable interrupt vector.
|
||||
.It Dv IRQ
|
||||
the interrupt request vector.
|
||||
.El
|
||||
.Pp
|
||||
.Fn M6502_setVector
|
||||
stores its
|
||||
.Fa address
|
||||
argument in the named
|
||||
.Fa vector
|
||||
and returns the new value.
|
||||
.Pp
|
||||
The
|
||||
.Fa callbacks
|
||||
member contains an opaque structure mapping processor memory accesses
|
||||
to client callback functions. Whenever the processor performs an
|
||||
access for which a corresponding entry exists in the the
|
||||
.Fa callbacks
|
||||
structure, the emulator suspends execution and invokes the callback to
|
||||
complete the operation. Each callback function should have a
|
||||
signature equivalent to:
|
||||
.Bd -ragged -offset indent
|
||||
int
|
||||
.Va callback
|
||||
(M6502 *mpu, uint16_t address, uint8_t data);
|
||||
.Ed
|
||||
.Pp
|
||||
The macros
|
||||
.Fn M6502_getCallback
|
||||
and
|
||||
.Fn M6502_setCallback
|
||||
read and write entries in the
|
||||
.Fa callbacks
|
||||
structure. These macros identify a unique memory access operation
|
||||
from the specified
|
||||
.Fa address
|
||||
on which it operates and
|
||||
.Fa type
|
||||
of access involved. The
|
||||
.Fa type
|
||||
argument must be one of the following:
|
||||
.Bl -tag -width ".Dv write"
|
||||
.It Dv read
|
||||
the
|
||||
.Fa callback
|
||||
is invoked when the processor attempts to read from the
|
||||
given address. The emulator passes the effective address of the
|
||||
operation to the callback in its
|
||||
.Fa address
|
||||
argument. (The
|
||||
.Fa data
|
||||
argument is undefined.) The value returned by the callback will be
|
||||
used by the emulator as the result of the read operation.
|
||||
.It Dv write
|
||||
the
|
||||
.Fa callback
|
||||
is invoked when the processor attempts to write to the
|
||||
given address. The emulator passes the effective address of the
|
||||
operation to the callback in its
|
||||
.Fa address
|
||||
argument and the byte being written in the
|
||||
.Fa data
|
||||
argument. The emulator will not perform the write operation before
|
||||
invoking the callback; if the write should complete, the callback must
|
||||
modify the processor's
|
||||
.Fa memory
|
||||
explicitly. The valued returned from the callback is ignored.
|
||||
.It Dv call
|
||||
the
|
||||
.Fa callback
|
||||
is invoked when the processor attempts to transfer control to the
|
||||
given address by any instruction other than a relative branch. The
|
||||
emulator passes the destination address to the callback in its
|
||||
.Fa address
|
||||
argument and the instruction that initiated the control transfer in
|
||||
its
|
||||
.Fa data
|
||||
argument (one of JMP, JSR, BRK, RTS or RTI). If the callback returns
|
||||
zero (the callback refuses to handle the operation) the emulator will
|
||||
allow the operation to complete as normal. If the callback returns a
|
||||
non-zero address (indicating that the callback has handled the
|
||||
operation internally) the emulator will transfer control to that
|
||||
address.
|
||||
.El
|
||||
.Pp
|
||||
.Fn M6502_getCallback
|
||||
returns zero if there is no callback associated with the given
|
||||
.Fa type
|
||||
and
|
||||
.Fa address .
|
||||
Passing zero as the
|
||||
.Fa callback
|
||||
argument of
|
||||
.Fn M6502_setCallback
|
||||
removes any callback that might have been associated with
|
||||
.Fa type
|
||||
and
|
||||
.Fa address .
|
||||
.Pp
|
||||
.Fn M6502_run
|
||||
emulates processor execution in the given
|
||||
.Fa mpu
|
||||
by repeatedly fetching the instruction addressed by
|
||||
.Fa pc
|
||||
and dispatching to it. This function normally never returns.
|
||||
.Pp
|
||||
.Fn M6502_dump
|
||||
writes a (NUL-terminated) symbolic representation of the processor's
|
||||
internal state into the supplied
|
||||
.Fa buffer .
|
||||
Typical output resembles:
|
||||
.Bd -literal -offset indent
|
||||
PC=1010 SP=01FE A=0A X=5B Y=00 P=D1 NV-B---C
|
||||
.Ed
|
||||
.Pp
|
||||
.Fn M6502_disassemble
|
||||
writes a (NUL-terminated) symbolic representation of the instruction
|
||||
in the processor's memory at the given
|
||||
.Fa address
|
||||
into the supplied
|
||||
.Fa buffer .
|
||||
It returns the size (in bytes) of the instruction. (In other words,
|
||||
the amount by which
|
||||
.Fa address
|
||||
should be incremented to arrive at the next instruction.)
|
||||
Typical output resembles:
|
||||
.Bd -literal -offset indent
|
||||
1009 cpx #5B
|
||||
.Ed
|
||||
.Pp
|
||||
(The
|
||||
.Fa buffer
|
||||
arguments are oversized to allow for future expansion.)
|
||||
.Pp
|
||||
.Fn M6502_delete
|
||||
frees the resources associated with the given
|
||||
.Fa mpu.
|
||||
Any members that were allocated implicitly (passed as NULL to
|
||||
.Fn M6502_new )
|
||||
are deallocated. Members that were initialised from non-NULL
|
||||
arguments are not deallocated.
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
.\"
|
||||
You can share the
|
||||
.Fa memory
|
||||
and
|
||||
.Fa callbacks
|
||||
members of
|
||||
.Vt M6502
|
||||
between multiple instances to simulate multiprocessor hardware.
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh RETURN VALUES
|
||||
.\"
|
||||
.Fn M6502_new
|
||||
returns a pointer to a
|
||||
.Vt M6502
|
||||
structure.
|
||||
.Fn M6502_getVector
|
||||
and
|
||||
.Fn M6502_setVector
|
||||
return the contents of the given
|
||||
.Fa vector .
|
||||
.Fn M6502_getCallback
|
||||
and
|
||||
.Fn M6502_setCallback
|
||||
return the
|
||||
.Vt M6502_Callback
|
||||
function associated with the given
|
||||
.Fa address
|
||||
and access
|
||||
.Fa type .
|
||||
.Fn M6502_disassemble
|
||||
returns the size (in bytes) of the instruction at the given
|
||||
.Fa address .
|
||||
.Fn M6502_reset ,
|
||||
.Fn M6502_nmi ,
|
||||
.Fn M6502_irq ,
|
||||
.Fn M6502_run ,
|
||||
.Fn M6502_dump
|
||||
and
|
||||
.Fn M6502_delete
|
||||
don't return anything (unless you forgot to include
|
||||
.In lib6502.h ) .
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh EXAMPLES
|
||||
.\"
|
||||
The following program creates a 6502 processor, sets up callbacks for
|
||||
printing characters and halting after a BRK instruction, stores a
|
||||
program into memory that prints the alphabet, disassembles the program
|
||||
on stdout, and then executes the program.
|
||||
.Bd -literal -offset indent -compact
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lib6502.h"
|
||||
|
||||
#define WRCH 0xFFEE
|
||||
|
||||
int wrch(M6502 *mpu, uint16_t address, uint8_t data)
|
||||
{
|
||||
int pc;
|
||||
putchar(mpu->registers->a);
|
||||
pc = mpu->memory[++mpu->registers->s + 0x100];
|
||||
pc |= mpu->memory[++mpu->registers->s + 0x100] << 8;
|
||||
return pc + 1; /* JSR pushes next insn addr - 1 */
|
||||
}
|
||||
|
||||
int done(M6502 *mpu, uint16_t address, uint8_t data)
|
||||
{
|
||||
char buffer[64];
|
||||
M6502_dump(mpu, buffer);
|
||||
printf("\\nBRK instruction\\n%s\\n", buffer);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
M6502 *mpu = M6502_new(0, 0, 0);
|
||||
unsigned pc = 0x1000;
|
||||
|
||||
mpu->callbacks->call[WRCH] = wrch; /* write character */
|
||||
mpu->callbacks->call[0000] = done; /* reached after BRK */
|
||||
|
||||
# define gen1(X) (mpu->memory[pc++] = (uint8_t)(X))
|
||||
# define gen2(X,Y) gen1(X); gen1(Y)
|
||||
# define gen3(X,Y,Z) gen1(X); gen2(Y,Z)
|
||||
|
||||
gen2(0xA2, 'A' ); /* LDX #'A' */
|
||||
gen1(0x8A ); /* TXA */
|
||||
gen3(0x20,0xEE,0xFF); /* JSR FFEE */
|
||||
gen1(0xE8 ); /* INX */
|
||||
gen2(0xE0, 'Z'+1 ); /* CPX #'Z'+1 */
|
||||
gen2(0xD0, -9 ); /* BNE 1002 */
|
||||
gen2(0xA9, '\\n' ); /* LDA #'\\n' */
|
||||
gen3(0x20,0xEE,0xFF); /* JSR FFEE */
|
||||
gen2(0x00,0x00 ); /* BRK */
|
||||
|
||||
{
|
||||
uint16_t ip = 0x1000;
|
||||
while (ip < pc)
|
||||
{
|
||||
char insn[64];
|
||||
ip += M6502_disassemble(mpu, ip, insn);
|
||||
printf("%04X %s\\n", ip, insn);
|
||||
}
|
||||
}
|
||||
|
||||
M6502_setVector(mpu, RST, 0x1000);
|
||||
|
||||
M6502_reset(mpu);
|
||||
M6502_run(mpu);
|
||||
M6502_delete(mpu);
|
||||
|
||||
return 0;
|
||||
}
|
||||
.Ed
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh DIAGNOSTICS
|
||||
.\"
|
||||
If
|
||||
.Fn M6502_new
|
||||
cannot allocate sufficient memory it prints "out of memory" to stderr
|
||||
and exits with a non-zero status.
|
||||
.Pp
|
||||
If
|
||||
.Fn M6502_run
|
||||
encounters an illegal or undefined instruction, it prints "undefined
|
||||
instruction" and the processor's state to stderr, then exits with a
|
||||
non-zero status.
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh COMPATIBILITY
|
||||
.\"
|
||||
M6502 is a generic name. The initial letter is mandated by C naming
|
||||
conventions and chosen in deference to MOS Technology, the original
|
||||
designers of the processor. To the best of my knowledge the 'M'
|
||||
prefix was never stamped on a physical 6502.
|
||||
.Pp
|
||||
The emulator implements the CMOS version of the processor (NMOS bugs
|
||||
in effective address calculations involving page boundaries are
|
||||
corrected) but does not tolerate the execution of undefined
|
||||
instructions (which were all no-ops in the first-generation CMOS
|
||||
hardware). It would be nice to support the several alternative
|
||||
instruction sets (model-specific undocumented instructions in NMOS
|
||||
models, and various documented extensions in the later CMOS models)
|
||||
but there are currently no plans to do so.
|
||||
.Pp
|
||||
The emulated 6502 will run much faster than real hardware on any
|
||||
modern computer. The fastest 6502 hardware available at the time of
|
||||
writing has a clock speed of 14 MHz. On a 2 GHz PowerPC, the emulated
|
||||
6502 runs at almost 300 MHz.
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh SEE ALSO
|
||||
.\"
|
||||
.Xr run6502 1
|
||||
.Pp
|
||||
For development tools, documentation and source code:
|
||||
.Pa http://6502.org
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh AUTHORS
|
||||
.\"
|
||||
The software and manual pages were written by Ian Piumarta.
|
||||
.Pp
|
||||
The software is provided as-is, with absolutely no warranty, in the
|
||||
hope that you will enjoy and benefit from it. You may use (entirely
|
||||
at your own risk) and redistribute it under the terms of a very
|
||||
liberal license that does not seek to restrict your rights in any way
|
||||
(unlike certain so-called 'open source' licenses that significantly
|
||||
limit your freedom in the name of 'free' software that is, ultimately,
|
||||
anything but free). See the file COPYING for details.
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh BUGS
|
||||
.\"
|
||||
.Fn M6502_getVector
|
||||
and
|
||||
.Fn M6502_setVector
|
||||
evaluate their arguments more than once.
|
||||
.Pp
|
||||
The out-of-memory condition and attempted execution of
|
||||
illegal/undefined instructions should not be fatal errors.
|
||||
.Pp
|
||||
There is no way to limit the duration of execution within
|
||||
.Fn M6502_run
|
||||
to a certain number of instructions or cycles.
|
||||
.Pp
|
||||
The emulator should support some means of implicit interrupt
|
||||
generation, either by polling or in response to (Unix) signals.
|
||||
.Pp
|
||||
The
|
||||
.Sx COMPATIBILITY
|
||||
section in this manual page has been diverted from its legitimate
|
||||
purpose.
|
||||
.Pp
|
||||
The plural of 'callback' really aught to be 'callsback'.
|
||||
.Pp
|
||||
Please send bug reports (and feature requests) to the author at:
|
||||
firstName (at) lastName (dot) com. (See
|
||||
.Sx AUTHORS
|
||||
above for suitable values of firstName and lastName.)
|
380
src/lib6502/man/run6502.1
Normal file
380
src/lib6502/man/run6502.1
Normal file
|
@ -0,0 +1,380 @@
|
|||
.\" Copyright (c) 2005 Ian Piumarta
|
||||
.\"
|
||||
.\" Permission is hereby granted, free of charge, to any person
|
||||
.\" obtaining a copy of this software and associated documentation
|
||||
.\" files (the 'Software'), to deal in the Software without
|
||||
.\" restriction, including without limitation the rights to use, copy,
|
||||
.\" modify, merge, publish, distribute, and/or sell copies of the
|
||||
.\" Software, and to permit persons to whom the Software is furnished
|
||||
.\" to do so, provided that the above copyright notice(s) and this
|
||||
.\" permission notice appear in all copies of the Software and that
|
||||
.\" both the above copyright notice(s) and this permission notice
|
||||
.\" appear in supporting documentation.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
|
||||
.\"
|
||||
.\" last edited: 2005-11-02 01:18:22 by piumarta on margaux.local
|
||||
.\"
|
||||
.Dd October 31, 2005
|
||||
.Dt RUN6502 1 LOCAL
|
||||
.Os ""
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh NAME
|
||||
.\"
|
||||
.Nm run6502
|
||||
.Nd execute a 6502 microprocessor program
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh SYNOPSIS
|
||||
.\"
|
||||
.Nm run6502
|
||||
.Op Ar option ...
|
||||
.Nm run6502
|
||||
.Op Ar option ...
|
||||
.Fl B
|
||||
.Op Ar
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm run6502
|
||||
command emulates the execution of a 6502 microprocessor. It creates a
|
||||
memory image from the contents of one or more files on the command
|
||||
line and then simulates a power-on hardware reset to begin execution.
|
||||
.Pp
|
||||
In its first form,
|
||||
.Nm run6502
|
||||
emulates an embedded 6502 processor with 64 kilobytes of RAM, no
|
||||
memory-mapped hardware, and no input-output capabilities. Limited
|
||||
interaction with the machine is possible only through the
|
||||
.Fl G , M
|
||||
and
|
||||
.Fl P
|
||||
options.
|
||||
.Pp
|
||||
In its second form (with the
|
||||
.Fl B
|
||||
option)
|
||||
.Nm run6502
|
||||
provides minimal emulation of Acorn 'BBC Model B' hardware with 32
|
||||
kilobytes of RAM, 16 kilobytes of paged language ROMs, and 16
|
||||
kilobytes of operating system ROM. A few MOS calls are intercepted to
|
||||
provide keyboard input and screen output via stdin and stdout.
|
||||
Switching between the sixteen paged read-only memory banks is also
|
||||
supported by the usual memory-mapped control register. Any
|
||||
.Ar file
|
||||
arguments after the
|
||||
.Fl B
|
||||
are loaded into successive paged ROM banks (starting at 15 and working
|
||||
down towards 0) before execution begins.
|
||||
.\" ----------------------------------------------------------------
|
||||
.Ss Options
|
||||
.\"
|
||||
.Bl -tag -width indent
|
||||
.It Fl B
|
||||
enable minimal Acorn 'BBC Model B' hardware emulation:
|
||||
.Bl -bullet
|
||||
.It
|
||||
the contents of memory between addresses 0x8000 and 0xBFFF are copied
|
||||
into paged ROM number 0;
|
||||
.It
|
||||
memory between 0x8000 and 0xBFFF becomes bank-switchable between
|
||||
sixteen different ROM images;
|
||||
.It
|
||||
the memory-mapped pages ('FRED', 'JIM' and 'SHEILA') between 0xFC00
|
||||
and 0xFEFF are initialised to harmless values;
|
||||
.It
|
||||
the upper half of the address space is write-protected; and
|
||||
.It
|
||||
callbacks are installed on several OS entry points to provide
|
||||
input-output via stdin and stdout.
|
||||
.El
|
||||
.Pp
|
||||
Any remaining non-option arguments on the command line will name files
|
||||
to be loaded successively into paged ROMs, starting at 15 and working
|
||||
downwards towards 0.
|
||||
.It Fl d Ar addr Ar end
|
||||
dump memory from the address
|
||||
.Ar addr
|
||||
(given in hexadecimal) up to (but not including)
|
||||
.Ar end .
|
||||
The
|
||||
.Ar end
|
||||
argument is either an absolute address or a relative address specified
|
||||
as a '+' character followed by the number (in hexadecimal) of bytes to
|
||||
dump. In other words, the following two options dump the same region
|
||||
of memory:
|
||||
.Bd -ragged -offset indent
|
||||
.Fl d
|
||||
8000 C000
|
||||
.Ed
|
||||
.Bd -ragged -offset indent -compact
|
||||
.Fl d
|
||||
8000 +4000
|
||||
.Ed
|
||||
.Pp
|
||||
The format of the dump cannot currently be modified and consists of
|
||||
the current address followed by one, two or three hexadecimal bytes,
|
||||
and a symbolic representation of the instruction at that address.
|
||||
.It Fl G Ar addr
|
||||
arrange that subroutine calls to
|
||||
.Ar addr
|
||||
will behave as if there were an implementation of
|
||||
.Xr getchar 3
|
||||
at that address, reading a character from stdin and returning it in
|
||||
the accumulator.
|
||||
.It Fl h
|
||||
print a summary of the available options and then exit.
|
||||
.It Fl I Ar addr
|
||||
set the IRQ (interrupt request) vector (the address to which the
|
||||
processor will transfer control upon execution of a BRK instruction).
|
||||
Setting this address to zero will cause execution to halt (and the
|
||||
emulator to exit) when a BRK instruction is encountered.
|
||||
.It Fl i Ar addr Ar file
|
||||
Load
|
||||
.Ar file
|
||||
into the memory image at the address
|
||||
.Ar addr
|
||||
(in hexadecimal), skipping over any initial '#!' interpreter line.
|
||||
.It Fl l Ar addr Ar file
|
||||
Load
|
||||
.Ar file
|
||||
into the memory image at the address
|
||||
.Ar addr
|
||||
(in hexadecimal).
|
||||
.It Fl M Ar addrio
|
||||
arrange that memory reads from address
|
||||
.Ar addrio
|
||||
will return the next character on stdin (blocking if necessary), and
|
||||
memory writes to
|
||||
.Ar addrio
|
||||
will send the value written to stdout.
|
||||
.It Fl N Ar addr
|
||||
set the NMI (non-maskable interrupt) vector to
|
||||
.Ar addr .
|
||||
.It Fl P Ar addr
|
||||
arrange that subroutine calls to
|
||||
.Ar addr
|
||||
will behave as if there were an implementation of
|
||||
.Xr putchar 3
|
||||
at that address, writing the contents of the accumulator to stdout.
|
||||
.It Fl R Ar addr
|
||||
set the RST (hardware reset) vector. The processor will transfer
|
||||
control to this address when emulated execution begins.
|
||||
.It Fl s Ar addr Ar end Ar file
|
||||
save the contents of memory from the address
|
||||
.Ar addr
|
||||
up to
|
||||
.Ar end
|
||||
(exclusive) to the given
|
||||
.Ar file .
|
||||
As with the
|
||||
.Fl d
|
||||
option,
|
||||
.Ar end
|
||||
can be absolute or '+' followed by a byte count.
|
||||
.It Fl v
|
||||
print version information and then exit.
|
||||
.It Fl X Ar addr
|
||||
arrange that any transfer of control to the address
|
||||
.Ar addr
|
||||
will cause an immediate exit with zero exit status.
|
||||
.It Fl x
|
||||
exit immediately. (Useful after
|
||||
.Fl d
|
||||
or when
|
||||
.Nm run6502
|
||||
is being used as a trivial 'image editor', with several
|
||||
.Fl l
|
||||
options followed by
|
||||
.Fl s
|
||||
and
|
||||
.Fl x . )
|
||||
.It Ar
|
||||
following a
|
||||
.Fl B
|
||||
option, load one or more ROM image
|
||||
files
|
||||
into successive paged ROM slots. Other than the paging aspect, this
|
||||
is equivalent to:
|
||||
.Bd -ragged -offset indent
|
||||
.Fl l Ar 8000 Ar image
|
||||
.Ed
|
||||
.El
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh EXAMPLES
|
||||
.\"
|
||||
.Ss A Very Simple Program
|
||||
The
|
||||
.Xr perl 1
|
||||
command can be used to create a binary file from hexadecimal input:
|
||||
.Bd -literal
|
||||
echo a2418a20eeffe8e05bd0f7a90a20eeff00 |
|
||||
perl -e 'print pack "H*",<STDIN>' > temp.img
|
||||
.Ed
|
||||
.Pp
|
||||
The file can be loaded and executed with:
|
||||
.Bd -literal
|
||||
run6502 -l 1000 temp.img -R 1000 -P FFEE -X 0
|
||||
.Ed
|
||||
.Pp
|
||||
The contents of the file can be inspected symbolically with:
|
||||
.Bd -literal
|
||||
run6502 -l 1000 temp.img -d 1000 +12
|
||||
.Ed
|
||||
.Pp
|
||||
The options passed to
|
||||
.Nm run6502
|
||||
in the above examples have the following effects:
|
||||
.Bl -tag -width offset
|
||||
.It \-l 1000 temp.img
|
||||
loads the file
|
||||
.Pa temp.img
|
||||
into memory at address 0x8000.
|
||||
.It \-R 1000
|
||||
sets the reset vector (the address of first instruction to be executed
|
||||
after 'power on') to 0x1000.
|
||||
.It \-P FFEE
|
||||
arranges for calls to address 0xFFEE to behave as if there were an
|
||||
implementation of
|
||||
.Xr putchar 3
|
||||
at that address.
|
||||
.It \-X 0
|
||||
arranges for transfers of control to address 0 to exit from the
|
||||
emulator. This works in the above example because the final 'BRK'
|
||||
instruction causes an implicit subroutine call through an
|
||||
uninitialised interrupt vector to location 0. To see this
|
||||
instruction...
|
||||
.It \-d 1000 +12
|
||||
disassembles 18 bytes of memory at address 0x8000.
|
||||
.El
|
||||
.Ss Standalone Images
|
||||
The
|
||||
.Fl i
|
||||
option is designed for use in the 'interpreter command' appearing on
|
||||
the first line of an executable script. Adding the line
|
||||
.Bd -literal
|
||||
#!run6502 -R 1000 -P FFEE -X 0 -i 1000
|
||||
.Ed
|
||||
.Pp
|
||||
(with no leading spaces and a single trailing newline character)
|
||||
to the
|
||||
.Pa temp.img
|
||||
file from the first example turns it into a script. If the file is
|
||||
made executable with
|
||||
.Bd -literal
|
||||
chmod +x temp.img
|
||||
.Ed
|
||||
.Pp
|
||||
it can be run like a standalone program:
|
||||
.Bd -literal
|
||||
./temp.img
|
||||
.Ed
|
||||
.Ss A Very Complex Program
|
||||
Consider a pair of files named
|
||||
.Pa os1.2
|
||||
and
|
||||
.Pa basic2
|
||||
containing (legally-acquired, of course) ROM images of Acorn MOS 1.2
|
||||
and BBC Basic 2. The following command loads each of the images into
|
||||
memory at the appropriate address, cleans up the regions of memory
|
||||
containing memory-mapped i/o on the BBC computer, saves a snapshot of
|
||||
the entire memory to the file
|
||||
.Pa image
|
||||
and then exits:
|
||||
.Bd -literal
|
||||
run6502 -l C000 os1.2 -l 8000 basic2 -B -s0 +10000 image -x
|
||||
.Ed
|
||||
.Pp
|
||||
Running the generated image with
|
||||
.Bd -literal
|
||||
run6502 image
|
||||
.Ed
|
||||
.Pp
|
||||
will cold-start the emulated hardware, run the OS for a while, and
|
||||
then drop into the language ROM. Basic programs can then be entered,
|
||||
edited and run from the terminal.
|
||||
.Pp
|
||||
More details are given in the
|
||||
.Pa README
|
||||
file available in the
|
||||
.Pa examples
|
||||
directory of the distribution.
|
||||
.Ss Exercises
|
||||
Create a standalone image (one that can be run as a program, with
|
||||
a '#!' interpreter line at the beginning) that contains Basic2 and
|
||||
OS1.2 (as described above). This image should be no larger than 32K
|
||||
(memory below 0x8000, which would be full of zeroes, should not appear
|
||||
in the image file).
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh DIAGNOSTICS
|
||||
.\"
|
||||
If nothing goes wrong, none. Otherwise lots. They should be
|
||||
self-explanatory. I'm too lazy to enumerate them.
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh COMPATIBILITY
|
||||
.\"
|
||||
See
|
||||
.Xr lib6502 3
|
||||
for a discussion of the emulated instruction set.
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh SEE ALSO
|
||||
.\"
|
||||
.Xr lib6502 3
|
||||
.Pp
|
||||
The file
|
||||
.Pa examples/README
|
||||
in the lib6502 distribution. (Depending on your system this may be
|
||||
installed in
|
||||
.Pa /usr/doc/lib6502 ,
|
||||
.Pa /usr/local/doc/lib6502 ,
|
||||
.Pa /usr/share/doc/lib6502 ,
|
||||
or similar.)
|
||||
.Pp
|
||||
.Pa http://piumarta.com/software/lib6502
|
||||
for updates and documentation.
|
||||
.Pp
|
||||
.Pa http://6502.org
|
||||
for lots of 6502-related resources.
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh AUTHORS
|
||||
.\"
|
||||
The software and manual pages were written by
|
||||
.An "Ian Piumarta" .
|
||||
.Pp
|
||||
The software is provided as-is, with absolutely no warranty, in the
|
||||
hope that you will enjoy and benefit from it. You may use (entirely
|
||||
at your own risk) and redistribute it under the terms of a very
|
||||
liberal license that does not seek to restrict your rights in any way
|
||||
(unlike certain so-called 'open source' licenses that significantly
|
||||
limit your freedom in the name of 'free' software that is, ultimately,
|
||||
anything but free). See the file COPYING for details.
|
||||
.\" ----------------------------------------------------------------
|
||||
.Sh BUGS
|
||||
.\"
|
||||
.Bl -bullet
|
||||
.It
|
||||
Options must appear one at a time.
|
||||
.It
|
||||
Any attempt (in a load or save operation) to transfer data beyond
|
||||
0xFFFF is silently truncated at the end of memory.
|
||||
.It
|
||||
There is no way to specify the slot into which a ROM image should be
|
||||
loaded, other than implicitly according to the order of arguments on
|
||||
the command line.
|
||||
.It
|
||||
Execution can only be started via the emulated power-up reset. There
|
||||
is no support for 'warm-starting' execution in an image at an
|
||||
arbitrary address.
|
||||
.It
|
||||
Even though the emulator fully supports them, there is no way to
|
||||
artificially generate a hardware interrupt request, non-maskable
|
||||
interrupt, or reset condition. If you need these, read
|
||||
.Xr lib6502 3
|
||||
and write your own shell.
|
||||
.It
|
||||
The Acorn 'BBC Model B' hardware emulation is totally lame.
|
||||
.El
|
||||
.Pp
|
||||
Please send bug reports (and feature requests) to the author at:
|
||||
firstName (at) lastName (dot) com. (See
|
||||
.Sx AUTHORS
|
||||
above for suitable values of firstName and lastName.)
|
520
src/lib6502/run6502.c
Normal file
520
src/lib6502/run6502.c
Normal file
|
@ -0,0 +1,520 @@
|
|||
/* run6502.c -- 6502 emulator shell -*- C -*- */
|
||||
|
||||
/* Copyright (c) 2005 Ian Piumarta
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the 'Software'),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, provided that the above copyright notice(s) and this
|
||||
* permission notice appear in all copies of the Software and that both the
|
||||
* above copyright notice(s) and this permission notice appear in supporting
|
||||
* documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
|
||||
*/
|
||||
|
||||
/* Last edited: 2005-11-02 01:18:58 by piumarta on margaux.local
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "lib6502.h"
|
||||
|
||||
#define VERSION PACKAGE_NAME " " PACKAGE_VERSION " " PACKAGE_COPYRIGHT
|
||||
|
||||
typedef uint8_t byte;
|
||||
typedef uint16_t word;
|
||||
|
||||
static char *program= 0;
|
||||
|
||||
static byte bank[0x10][0x4000];
|
||||
|
||||
|
||||
void fail(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
fflush(stdout);
|
||||
va_start(ap, fmt);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
fprintf(stderr, "\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
void pfail(const char *msg)
|
||||
{
|
||||
fflush(stdout);
|
||||
perror(msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
#define rts \
|
||||
{ \
|
||||
word pc; \
|
||||
pc = mpu->memory[++mpu->registers->s + 0x100]; \
|
||||
pc |= mpu->memory[++mpu->registers->s + 0x100] << 8; \
|
||||
return pc + 1; \
|
||||
}
|
||||
|
||||
|
||||
int osword(M6502 *mpu, word address, byte data)
|
||||
{
|
||||
byte *params= mpu->memory + mpu->registers->x + (mpu->registers->y << 8);
|
||||
|
||||
switch (mpu->registers->a)
|
||||
{
|
||||
case 0x00: /* input line */
|
||||
/* On entry: XY+0,1=>string area,
|
||||
* XY+2=maximum line length,
|
||||
* XY+3=minimum acceptable ASCII value,
|
||||
* XY+4=maximum acceptable ASCII value.
|
||||
* On exit: Y is the line length (excluding CR),
|
||||
* C is set if Escape terminated input.
|
||||
*/
|
||||
{
|
||||
word offset= params[0] + (params[1] << 8);
|
||||
byte *buffer= mpu->memory + offset;
|
||||
byte length= params[2], minVal= params[3], maxVal= params[4], b= 0;
|
||||
if (!fgets(buffer, length, stdin))
|
||||
{
|
||||
putchar('\n');
|
||||
exit(0);
|
||||
}
|
||||
for (b= 0; b < length; ++b)
|
||||
if ((buffer[b] < minVal) || (buffer[b] > maxVal) || ('\n' == buffer[b]))
|
||||
break;
|
||||
buffer[b]= 13;
|
||||
mpu->registers->y= b;
|
||||
mpu->registers->p &= 0xFE;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
char state[64];
|
||||
M6502_dump(mpu, state);
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "\nOSWORD %s\n", state);
|
||||
fail("ABORT");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
rts;
|
||||
}
|
||||
|
||||
|
||||
int osbyte(M6502 *mpu, word address, byte data)
|
||||
{
|
||||
switch (mpu->registers->a)
|
||||
{
|
||||
case 0x7A: /* perform keyboard scan */
|
||||
mpu->registers->x= 0x00;
|
||||
break;
|
||||
|
||||
case 0x7E: /* acknowledge detection of escape condition */
|
||||
return 1;
|
||||
break;
|
||||
|
||||
case 0x82: /* read machine higher order address */
|
||||
mpu->registers->y= 0x00;
|
||||
mpu->registers->x= 0x00;
|
||||
break;
|
||||
|
||||
case 0x83: /* read top of OS ram address (OSHWM) */
|
||||
mpu->registers->y= 0x0E;
|
||||
mpu->registers->x= 0x00;
|
||||
break;
|
||||
|
||||
case 0x84: /* read bottom of display ram address */
|
||||
mpu->registers->y= 0x80;
|
||||
mpu->registers->x= 0x00;
|
||||
break;
|
||||
|
||||
case 0x89: /* motor control */
|
||||
break;
|
||||
|
||||
case 0xDA: /* read/write number of items in vdu queue (stored at 0x026A) */
|
||||
return 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
char state[64];
|
||||
M6502_dump(mpu, state);
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "\nOSBYTE %s\n", state);
|
||||
fail("ABORT");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
rts;
|
||||
}
|
||||
|
||||
|
||||
int oscli(M6502 *mpu, word address, byte data)
|
||||
{
|
||||
byte *params= mpu->memory + mpu->registers->x + (mpu->registers->y << 8);
|
||||
char command[1024], *ptr= command;
|
||||
while (('*' == *params) || (' ' == *params))
|
||||
++params;
|
||||
while (13 != *params)
|
||||
*ptr++= *params++;
|
||||
*ptr= '\0';
|
||||
system(command);
|
||||
rts;
|
||||
}
|
||||
|
||||
|
||||
int oswrch(M6502 *mpu, word address, byte data)
|
||||
{
|
||||
switch (mpu->registers->a)
|
||||
{
|
||||
case 0x0C:
|
||||
fputs("\033[2J\033[H", stdout);
|
||||
break;
|
||||
|
||||
default:
|
||||
putchar(mpu->registers->a);
|
||||
break;
|
||||
}
|
||||
fflush(stdout);
|
||||
rts;
|
||||
}
|
||||
|
||||
|
||||
static int writeROM(M6502 *mpu, word address, byte value)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int bankSelect(M6502 *mpu, word address, byte value)
|
||||
{
|
||||
memcpy(mpu->memory + 0x8000, bank[value & 0x0F], 0x4000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int doBtraps(int argc, char **argv, M6502 *mpu)
|
||||
{
|
||||
unsigned addr;
|
||||
|
||||
/* Acorn Model B ROM and memory-mapped IO */
|
||||
|
||||
for (addr= 0x8000; addr <= 0xFBFF; ++addr) mpu->callbacks->write[addr]= writeROM;
|
||||
for (addr= 0xFC00; addr <= 0xFEFF; ++addr) mpu->memory[addr]= 0xFF;
|
||||
for (addr= 0xFE30; addr <= 0xFE33; ++addr) mpu->callbacks->write[addr]= bankSelect;
|
||||
for (addr= 0xFE40; addr <= 0xFE4F; ++addr) mpu->memory[addr]= 0x00;
|
||||
for (addr= 0xFF00; addr <= 0xFFFF; ++addr) mpu->callbacks->write[addr]= writeROM;
|
||||
|
||||
/* anything already loaded at 0x8000 appears in bank 0 */
|
||||
|
||||
memcpy(bank[0x00], mpu->memory + 0x8000, 0x4000);
|
||||
|
||||
/* fake a few interesting OS calls */
|
||||
|
||||
# define trap(vec, addr, func) mpu->callbacks->call[addr]= (func)
|
||||
trap(0x020C, 0xFFF1, osword);
|
||||
trap(0x020A, 0xFFF4, osbyte);
|
||||
//trap(0x0208, 0xFFF7, oscli ); /* enable this to send '*COMMAND's to system(3) :-) */
|
||||
trap(0x020E, 0xFFEE, oswrch);
|
||||
trap(0x020E, 0xE0A4, oswrch); /* NVWRCH */
|
||||
#undef trap
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void usage(int status)
|
||||
{
|
||||
FILE *stream= status ? stderr : stdout;
|
||||
fprintf(stream, VERSION"\n");
|
||||
fprintf(stream, "please send bug reports to: %s\n", PACKAGE_BUGREPORT);
|
||||
fprintf(stream, "\n");
|
||||
fprintf(stream, "usage: %s [option ...]\n", program);
|
||||
fprintf(stream, " %s [option ...] -B [image ...]\n", program);
|
||||
fprintf(stream, " -B -- minimal Acorn 'BBC Model B' compatibility\n");
|
||||
fprintf(stream, " -d addr last -- dump memory between addr and last\n");
|
||||
fprintf(stream, " -G addr -- emulate getchar(3) at addr\n");
|
||||
fprintf(stream, " -h -- help (print this message)\n");
|
||||
fprintf(stream, " -I addr -- set IRQ vector\n");
|
||||
fprintf(stream, " -l addr file -- load file at addr\n");
|
||||
fprintf(stream, " -M addr -- emulate memory-mapped stdio at addr\n");
|
||||
fprintf(stream, " -N addr -- set NMI vector\n");
|
||||
fprintf(stream, " -P addr -- emulate putchar(3) at addr\n");
|
||||
fprintf(stream, " -R addr -- set RST vector\n");
|
||||
fprintf(stream, " -s addr last file -- save memory from addr to last in file\n");
|
||||
fprintf(stream, " -v -- print version number then exit\n");
|
||||
fprintf(stream, " -X addr -- terminate emulation if PC reaches addr\n");
|
||||
fprintf(stream, " -x -- exit wihout further ado\n");
|
||||
fprintf(stream, " image -- '-l 8000 image' in available ROM slot\n");
|
||||
fprintf(stream, "\n");
|
||||
fprintf(stream, "'last' can be an address (non-inclusive) or '+size' (in bytes)\n");
|
||||
exit(status);
|
||||
}
|
||||
|
||||
|
||||
static int doHelp(int argc, char **argv, M6502 *mpu)
|
||||
{
|
||||
usage(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int doVersion(int argc, char **argv, M6502 *mpu)
|
||||
{
|
||||
puts(VERSION);
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static unsigned long htol(char *hex)
|
||||
{
|
||||
char *end;
|
||||
unsigned long l= strtol(hex, &end, 16);
|
||||
if (*end) fail("bad hex number: %s", hex);
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
static int loadInterpreter(M6502 *mpu, word start, const char *path)
|
||||
{
|
||||
FILE *file= 0;
|
||||
int count= 0;
|
||||
byte *memory= mpu->memory + start;
|
||||
size_t max= 0x10000 - start;
|
||||
int c= 0;
|
||||
|
||||
if ((!(file= fopen(path, "r"))) || ('#' != fgetc(file)) || ('!' != fgetc(file)))
|
||||
return 0;
|
||||
while ((c= fgetc(file)) >= ' ')
|
||||
;
|
||||
while ((count= fread(memory, 1, max, file)) > 0)
|
||||
{
|
||||
memory += count;
|
||||
max -= count;
|
||||
}
|
||||
fclose(file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int save(M6502 *mpu, word address, unsigned length, const char *path)
|
||||
{
|
||||
FILE *file= 0;
|
||||
int count= 0;
|
||||
if (!(file= fopen(path, "w")))
|
||||
return 0;
|
||||
while ((count= fwrite(mpu->memory + address, 1, length, file)))
|
||||
{
|
||||
address += count;
|
||||
length -= count;
|
||||
}
|
||||
fclose(file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int load(M6502 *mpu, word address, const char *path)
|
||||
{
|
||||
FILE *file= 0;
|
||||
int count= 0;
|
||||
size_t max= 0x10000 - address;
|
||||
if (!(file= fopen(path, "r")))
|
||||
return 0;
|
||||
while ((count= fread(mpu->memory + address, 1, max, file)) > 0)
|
||||
{
|
||||
address += count;
|
||||
max -= count;
|
||||
}
|
||||
fclose(file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int doLoadInterpreter(int argc, char **argv, M6502 *mpu)
|
||||
{
|
||||
if (argc < 3) usage(1);
|
||||
if (!loadInterpreter(mpu, htol(argv[1]), argv[2])) pfail(argv[2]);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
static int doLoad(int argc, char **argv, M6502 *mpu) /* -l addr file */
|
||||
{
|
||||
if (argc < 3) usage(1);
|
||||
if (!load(mpu, htol(argv[1]), argv[2])) pfail(argv[2]);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
static int doSave(int argc, char **argv, M6502 *mpu) /* -l addr size file */
|
||||
{
|
||||
if (argc < 4) usage(1);
|
||||
if (!save(mpu, htol(argv[1]), htol(argv[2]), argv[3])) pfail(argv[3]);
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
#define doVEC(VEC) \
|
||||
static int do##VEC(int argc, char **argv, M6502 *mpu) \
|
||||
{ \
|
||||
unsigned addr= 0; \
|
||||
if (argc < 2) usage(1); \
|
||||
addr= htol(argv[1]); \
|
||||
M6502_setVector(mpu, VEC, addr); \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
doVEC(IRQ);
|
||||
doVEC(NMI);
|
||||
doVEC(RST);
|
||||
|
||||
#undef doVEC
|
||||
|
||||
|
||||
static int gTrap(M6502 *mpu, word addr, byte data) { mpu->registers->a= getchar(); rts; }
|
||||
static int pTrap(M6502 *mpu, word addr, byte data) { putchar(mpu->registers->a); rts; }
|
||||
|
||||
static int doGtrap(int argc, char **argv, M6502 *mpu)
|
||||
{
|
||||
unsigned addr;
|
||||
if (argc < 2) usage(1);
|
||||
addr= htol(argv[1]);
|
||||
M6502_setCallback(mpu, call, addr, gTrap);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int doPtrap(int argc, char **argv, M6502 *mpu)
|
||||
{
|
||||
unsigned addr;
|
||||
if (argc < 2) usage(1);
|
||||
addr= htol(argv[1]);
|
||||
M6502_setCallback(mpu, call, addr, pTrap);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int mTrapRead(M6502 *mpu, word addr, byte data) { return getchar(); }
|
||||
static int mTrapWrite(M6502 *mpu, word addr, byte data) { return putchar(data); }
|
||||
|
||||
static int doMtrap(int argc, char **argv, M6502 *mpu)
|
||||
{
|
||||
unsigned addr= 0;
|
||||
if (argc < 2) usage(1);
|
||||
addr= htol(argv[1]);
|
||||
M6502_setCallback(mpu, read, addr, mTrapRead);
|
||||
M6502_setCallback(mpu, write, addr, mTrapWrite);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int xTrap(M6502 *mpu, word addr, byte data) { exit(0); return 0; }
|
||||
|
||||
static int doXtrap(int argc, char **argv, M6502 *mpu)
|
||||
{
|
||||
unsigned addr= 0;
|
||||
if (argc < 2) usage(1);
|
||||
addr= htol(argv[1]);
|
||||
M6502_setCallback(mpu, call, addr, xTrap);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int doDisassemble(int argc, char **argv, M6502 *mpu)
|
||||
{
|
||||
unsigned addr= 0, last= 0;
|
||||
if (argc < 3) usage(1);
|
||||
addr= htol(argv[1]);
|
||||
last= ('+' == *argv[2]) ? addr + htol(1 + argv[2]) : htol(argv[2]);
|
||||
while (addr < last)
|
||||
{
|
||||
char insn[64];
|
||||
int i= 0, size= M6502_disassemble(mpu, addr, insn);
|
||||
printf("%04X ", addr);
|
||||
while (i++ < size) printf("%02X", mpu->memory[addr + i - 1]);
|
||||
while (i++ < 4) printf(" ");
|
||||
putchar(' ');
|
||||
i= 0;
|
||||
while (i++ < size) putchar(isgraph(mpu->memory[addr + i - 1]) ? mpu->memory[addr + i - 1] : ' ');
|
||||
while (i++ < 4) putchar(' ');
|
||||
printf(" %s\n", insn);
|
||||
addr += size;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
M6502 *mpu= M6502_new(0, 0, 0);
|
||||
int bTraps= 0;
|
||||
|
||||
program= argv[0];
|
||||
|
||||
if ((2 == argc) && ('-' != *argv[1]))
|
||||
{
|
||||
if ((!loadInterpreter(mpu, 0, argv[1])) && (!load(mpu, 0, argv[1])))
|
||||
pfail(argv[1]);
|
||||
doBtraps(0, 0, mpu);
|
||||
}
|
||||
else
|
||||
while (++argv, --argc > 0)
|
||||
{
|
||||
int n= 0;
|
||||
if (!strcmp(*argv, "-B")) bTraps= 1;
|
||||
else if (!strcmp(*argv, "-d")) n= doDisassemble(argc, argv, mpu);
|
||||
else if (!strcmp(*argv, "-G")) n= doGtrap(argc, argv, mpu);
|
||||
else if (!strcmp(*argv, "-h")) n= doHelp(argc, argv, mpu);
|
||||
else if (!strcmp(*argv, "-i")) n= doLoadInterpreter(argc, argv, mpu);
|
||||
else if (!strcmp(*argv, "-I")) n= doIRQ(argc, argv, mpu);
|
||||
else if (!strcmp(*argv, "-l")) n= doLoad(argc, argv, mpu);
|
||||
else if (!strcmp(*argv, "-M")) n= doMtrap(argc, argv, mpu);
|
||||
else if (!strcmp(*argv, "-N")) n= doNMI(argc, argv, mpu);
|
||||
else if (!strcmp(*argv, "-P")) n= doPtrap(argc, argv, mpu);
|
||||
else if (!strcmp(*argv, "-R")) n= doRST(argc, argv, mpu);
|
||||
else if (!strcmp(*argv, "-s")) n= doSave(argc, argv, mpu);
|
||||
else if (!strcmp(*argv, "-v")) n= doVersion(argc, argv, mpu);
|
||||
else if (!strcmp(*argv, "-X")) n= doXtrap(argc, argv, mpu);
|
||||
else if (!strcmp(*argv, "-x")) exit(0);
|
||||
else if ('-' == **argv) usage(1);
|
||||
else
|
||||
{
|
||||
/* doBtraps() left 0x8000+0x4000 in bank 0, so load */
|
||||
/* additional images starting at 15 and work down */
|
||||
static int bankSel= 0x0F;
|
||||
if (!bTraps) usage(1);
|
||||
if (bankSel < 0) fail("too many images");
|
||||
if (!load(mpu, 0x8000, argv[0])) pfail(argv[0]);
|
||||
memcpy(bank[bankSel--],
|
||||
0x8000 + mpu->memory,
|
||||
0x4000);
|
||||
n= 1;
|
||||
}
|
||||
argc -= n;
|
||||
argv += n;
|
||||
}
|
||||
|
||||
if (bTraps)
|
||||
doBtraps(0, 0, mpu);
|
||||
|
||||
M6502_reset(mpu);
|
||||
M6502_run(mpu);
|
||||
M6502_delete(mpu);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -228,7 +228,7 @@ def a2viewport(left, top, width, height)
|
|||
^$20 = left
|
||||
^$21 = width
|
||||
^$22 = top
|
||||
^$23 = height + top - 1
|
||||
^$23 = height + top
|
||||
return a2gotoxy(0, 0)
|
||||
end
|
||||
def a2texttype(type)
|
||||
|
|
|
@ -520,7 +520,8 @@ export def dgrClear(clr)#0
|
|||
dgrFill(0, 0, @clrtile)
|
||||
end
|
||||
export def dgrMode(mode)#1
|
||||
if mode
|
||||
when mode
|
||||
is page1
|
||||
//
|
||||
// Set double lores graphics, return draw buffer
|
||||
//
|
||||
|
@ -531,10 +532,24 @@ export def dgrMode(mode)#1
|
|||
^ena80 = 0
|
||||
^show80 = 0
|
||||
^an3on
|
||||
drawpage = 1
|
||||
drawbuff = dgrbuff[1]
|
||||
return 1
|
||||
fin
|
||||
drawpage = page2
|
||||
drawbuff = dgrbuff[page2]
|
||||
break
|
||||
is page2
|
||||
//
|
||||
// Set double lores graphics, return draw buffer
|
||||
//
|
||||
^showlores
|
||||
^showfull
|
||||
^showgraphics
|
||||
^showpage1
|
||||
^ena80 = 0
|
||||
^show80 = 0
|
||||
^an3on
|
||||
drawpage = page1
|
||||
drawbuff = dgrbuff[page1]
|
||||
break
|
||||
otherwise
|
||||
//
|
||||
// Set text mode
|
||||
//
|
||||
|
@ -545,7 +560,8 @@ export def dgrMode(mode)#1
|
|||
^mapmain = 0
|
||||
^an3off
|
||||
call($FC58, 0, 0, 0, 0) // home()
|
||||
return 0
|
||||
wend
|
||||
return mode
|
||||
end
|
||||
//
|
||||
// Set display page, return other page
|
||||
|
|
277
src/libsrc/apple/dhgrlib.pla
Normal file
277
src/libsrc/apple/dhgrlib.pla
Normal file
|
@ -0,0 +1,277 @@
|
|||
include "inc/cmdsys.plh"
|
||||
include "inc/lines.plh"
|
||||
|
||||
sysflags resxtxt1|reshgr1|resxhgr1
|
||||
|
||||
//
|
||||
// Apple II graphics soft switches
|
||||
//
|
||||
const store80dis = $C000
|
||||
const store80ena = $C001
|
||||
const show40col = $C00C
|
||||
const show80col = $C00D
|
||||
const showgraphics = $C050
|
||||
const showtext = $C051
|
||||
const showfull = $C052
|
||||
const showmix = $C053
|
||||
const page1m = $C054
|
||||
const page1x = $C055
|
||||
const showhires = $C057
|
||||
const dhresena = $C05E
|
||||
const dhresdis = $C05F
|
||||
const IOUdis = $C07E
|
||||
const IOUena = $C07F
|
||||
//
|
||||
// HiRes scanline addresses
|
||||
//
|
||||
word hgrscan[] = $2000,$2400,$2800,$2C00,$3000,$3400,$3800,$3C00
|
||||
word = $2080,$2480,$2880,$2C80,$3080,$3480,$3880,$3C80
|
||||
word = $2100,$2500,$2900,$2D00,$3100,$3500,$3900,$3D00
|
||||
word = $2180,$2580,$2980,$2D80,$3180,$3580,$3980,$3D80
|
||||
word = $2200,$2600,$2A00,$2E00,$3200,$3600,$3A00,$3E00
|
||||
word = $2280,$2680,$2A80,$2E80,$3280,$3680,$3A80,$3E80
|
||||
word = $2300,$2700,$2B00,$2F00,$3300,$3700,$3B00,$3F00
|
||||
word = $2380,$2780,$2B80,$2F80,$3380,$3780,$3B80,$3F80
|
||||
word = $2028,$2428,$2828,$2C28,$3028,$3428,$3828,$3C28
|
||||
word = $20A8,$24A8,$28A8,$2CA8,$30A8,$34A8,$38A8,$3CA8
|
||||
word = $2128,$2528,$2928,$2D28,$3128,$3528,$3928,$3D28
|
||||
word = $21A8,$25A8,$29A8,$2DA8,$31A8,$35A8,$39A8,$3DA8
|
||||
word = $2228,$2628,$2A28,$2E28,$3228,$3628,$3A28,$3E28
|
||||
word = $22A8,$26A8,$2AA8,$2EA8,$32A8,$36A8,$3AA8,$3EA8
|
||||
word = $2328,$2728,$2B28,$2F28,$3328,$3728,$3B28,$3F28
|
||||
word = $23A8,$27A8,$2BA8,$2FA8,$33A8,$37A8,$3BA8,$3FA8
|
||||
word = $2050,$2450,$2850,$2C50,$3050,$3450,$3850,$3C50
|
||||
word = $20D0,$24D0,$28D0,$2CD0,$30D0,$34D0,$38D0,$3CD0
|
||||
word = $2150,$2550,$2950,$2D50,$3150,$3550,$3950,$3D50
|
||||
word = $21D0,$25D0,$29D0,$2DD0,$31D0,$35D0,$39D0,$3DD0
|
||||
word = $2250,$2650,$2A50,$2E50,$3250,$3650,$3A50,$3E50
|
||||
word = $22D0,$26D0,$2AD0,$2ED0,$32D0,$36D0,$3AD0,$3ED0
|
||||
word = $2350,$2750,$2B50,$2F50,$3350,$3750,$3B50,$3F50
|
||||
word = $23D0,$27D0,$2BD0,$2FD0,$33D0,$37D0,$3BD0,$3FD0
|
||||
//
|
||||
// Pixel masks for 7 contiguous pixels
|
||||
//
|
||||
word auxmask[] = $000F
|
||||
word = $0070
|
||||
word = $0000
|
||||
word = $0300
|
||||
word = $3C00
|
||||
word = $4000
|
||||
word = $0000
|
||||
word memmask[] = $0000
|
||||
word = $0001
|
||||
word = $001E
|
||||
word = $0060
|
||||
word = $0000
|
||||
word = $0700
|
||||
word = $7800
|
||||
//
|
||||
// Solid colors
|
||||
//
|
||||
word auxclrs[] = $0000 // black
|
||||
word = $2208 // magenta
|
||||
word = $1144 // brown
|
||||
word = $334C // orange
|
||||
word = $0822 // dark green
|
||||
word = $2A2A // gray 1
|
||||
word = $1966 // green
|
||||
word = $3B6E // yellow
|
||||
word = $4411 // dark blue
|
||||
word = $6619 // purple
|
||||
word = $5555 // gray 2
|
||||
word = $775D // pink
|
||||
word = $4C33 // medium blue
|
||||
word = $6E3B // light blue
|
||||
word = $5D77 // aqua
|
||||
word = $7F7F // white
|
||||
word memclrs[] = $0000 // black
|
||||
word = $4411 // magenta
|
||||
word = $2208 // brown
|
||||
word = $6619 // orange
|
||||
word = $1144 // dark green
|
||||
word = $5555 // gray 1
|
||||
word = $334C // green
|
||||
word = $775D // yellow
|
||||
word = $0822 // dark blue
|
||||
word = $4C33 // purple
|
||||
word = $2A2A // gray 2
|
||||
word = $6E3B // pink
|
||||
word = $1966 // medium blue
|
||||
word = $5D77 // light blue
|
||||
word = $3B6E // aqua
|
||||
word = $7F7F // white
|
||||
word auxclr, memclr
|
||||
//
|
||||
// Modulo 7
|
||||
//
|
||||
byte mod7[] = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
byte = 0, 1, 2, 3, 4, 5, 6
|
||||
//
|
||||
// Divide 7
|
||||
//
|
||||
byte div7x2[] = 0, 0, 0, 0, 0, 0, 0
|
||||
byte = 2, 2, 2, 2, 2, 2, 2
|
||||
byte = 4, 4, 4, 4, 4, 4, 4
|
||||
byte = 6, 6, 6, 6, 6, 6, 6
|
||||
byte = 8, 8, 8, 8, 8, 8, 8
|
||||
byte =10,10,10,10,10,10,10
|
||||
byte =12,12,12,12,12,12,12
|
||||
byte =14,14,14,14,14,14,14
|
||||
byte =16,16,16,16,16,16,16
|
||||
byte =18,18,18,18,18,18,18
|
||||
byte =20,20,20,20,20,20,20
|
||||
byte =22,22,22,22,22,22,22
|
||||
byte =24,24,24,24,24,24,24
|
||||
byte =26,26,26,26,26,26,26
|
||||
byte =28,28,28,28,28,28,28
|
||||
byte =30,30,30,30,30,30,30
|
||||
byte =32,32,32,32,32,32,32
|
||||
byte =34,34,34,34,34,34,34
|
||||
byte =36,36,36,36,36,36,36
|
||||
byte =38,38,38,38,38,38,38
|
||||
|
||||
def dhgrColor(c)#0
|
||||
auxclr = auxclrs[c & $0F]
|
||||
memclr = memclrs[c & $0F]
|
||||
end
|
||||
def dhgrPlot(x, y)#0
|
||||
byte pix7
|
||||
word pix7addr, mask
|
||||
|
||||
pix7addr = hgrscan[y] + div7x2[x]
|
||||
pix7 = mod7[x]
|
||||
mask = auxmask[pix7]
|
||||
if mask
|
||||
^page1x
|
||||
*pix7addr = (*pix7addr & ~mask) | (mask & auxclr)
|
||||
fin
|
||||
mask = memmask[pix7]
|
||||
if mask
|
||||
^page1m
|
||||
*pix7addr = (*pix7addr & ~mask) | (mask & memclr)
|
||||
fin
|
||||
end
|
||||
def dhgrTile(x7, y8, tileptr)#0
|
||||
word tileaddr
|
||||
byte scan
|
||||
|
||||
tileaddr = hgrscan[y8 * 8] + x7 * 2
|
||||
for scan = 0 to 7
|
||||
^page1x
|
||||
*tileaddr = *tileptr
|
||||
tileptr = tileptr + 2
|
||||
^page1m
|
||||
*tileaddr = *tileptr
|
||||
tileptr = tileptr + 2
|
||||
tileaddr = tileaddr + $0400
|
||||
next
|
||||
end
|
||||
def dhgrDst(x7, y, w7, h, dstptr)#0
|
||||
word pix7addr
|
||||
byte scan, b
|
||||
|
||||
for scan = y to y+h-1
|
||||
pix7addr = hgrscan[scan] + x7 * 2
|
||||
for b = 1 to w7
|
||||
^page1x
|
||||
*dstptr = *pix7addr
|
||||
dstptr = dstptr + 2
|
||||
^page1m
|
||||
*dstptr = *pix7addr
|
||||
dstptr = dstptr + 2
|
||||
pix7addr = pix7addr + 2
|
||||
next
|
||||
next
|
||||
end
|
||||
def dhgrSrc(x7, y, w7, h, srcptr)#0
|
||||
word pix7addr
|
||||
byte scan, b
|
||||
|
||||
for scan = y to y+h-1
|
||||
pix7addr = hgrscan[scan] + x7 * 2
|
||||
for b = 1 to w7
|
||||
^page1x
|
||||
*pix7addr = *srcptr
|
||||
srcptr = srcptr + 2
|
||||
^page1m
|
||||
*pix7addr = *srcptr
|
||||
srcptr = srcptr + 2
|
||||
pix7addr = pix7addr + 2
|
||||
next
|
||||
next
|
||||
end
|
||||
def dhgrMode(mode)
|
||||
if mode == 0
|
||||
^page1m
|
||||
^showfull
|
||||
^showhires
|
||||
^showgraphics
|
||||
^IOUdis = 0
|
||||
^show80col = 0
|
||||
^dhresena
|
||||
^store80ena = 0
|
||||
^page1m
|
||||
memset($2000, 0, $2000)
|
||||
^page1x
|
||||
memset($2000, 0, $2000)
|
||||
else
|
||||
^store80dis = 0
|
||||
^dhresdis
|
||||
^show40col = 0
|
||||
^showtext
|
||||
^page1m
|
||||
fin
|
||||
return mode
|
||||
end
|
||||
|
||||
def dhgrTest#0
|
||||
byte i, j
|
||||
word pixblk
|
||||
|
||||
setlineplot(@dhgrPlot)
|
||||
for i = 0 to 191 step 4
|
||||
dhgrColor(i)
|
||||
line(0, 0, 139, i)
|
||||
next
|
||||
for i = 139 downto 0 step 4
|
||||
dhgrColor(i)
|
||||
line(0, 0, i, 191)
|
||||
next
|
||||
pixblk = heapalloc(16/2*20)
|
||||
dhgrDst(0, 0, 2, 20, pixblk)
|
||||
for i = 1 to 170
|
||||
dhgrSrc(0, i, 2, 20, pixblk)
|
||||
next
|
||||
dhgrDst(0, 0, 1, 8, pixblk) // Create tile
|
||||
for j = 0 to 19
|
||||
for i = 0 to 19
|
||||
dhgrTile(i, j, pixblk)
|
||||
next
|
||||
next
|
||||
while ^$C000 < 128
|
||||
loop
|
||||
^$C010
|
||||
end
|
||||
|
||||
dhgrmode(0)
|
||||
dhgrtest
|
||||
dhgrmode(-1)
|
||||
done
|
|
@ -2,6 +2,7 @@ include "inc/cmdsys.plh"
|
|||
|
||||
byte gfxref, gfxseg
|
||||
byte params[8], cmd[16]
|
||||
byte textmode[] = 16, 0, 15
|
||||
|
||||
export def pencolor(clr)#0
|
||||
params:4 = 2
|
||||
|
@ -112,44 +113,7 @@ export def drawmode(mode)#0
|
|||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
export def setmode(mode)#0
|
||||
if mode < 0
|
||||
//
|
||||
// Free driver
|
||||
//
|
||||
params.0 = 1
|
||||
params.1 = gfxref
|
||||
syscall($CC, @params)
|
||||
gfxref = 0
|
||||
//
|
||||
// Deaalocate bank 0
|
||||
//
|
||||
params.0 = 1
|
||||
params.1 = gfxseg
|
||||
syscall($45, @params)
|
||||
^$1907 = $00 // Unset graphics pages allocated
|
||||
fin
|
||||
if not gfxref
|
||||
return
|
||||
fin
|
||||
params.0 = 3
|
||||
params.1 = gfxref
|
||||
params:2 = @cmd
|
||||
params:4 = 8
|
||||
cmd.0 = 16 // Set mode
|
||||
cmd.1 = mode
|
||||
cmd.2 = 19 // Pen color
|
||||
cmd.3 = 0
|
||||
cmd.4 = 1 // Reset viewport
|
||||
cmd.5 = 28 // Clear viewport
|
||||
cmd.7 = 15 // Turn on screen
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
if MACHID <> $F2
|
||||
puts("Apple /// only.\n")
|
||||
return -1
|
||||
fin
|
||||
def gfxopen#1
|
||||
//
|
||||
// Allocate bank 0
|
||||
//
|
||||
|
@ -171,8 +135,53 @@ params:4 = 0
|
|||
params.6 = 0
|
||||
syscall($C8, @params)
|
||||
gfxref = params.3
|
||||
return gfxref <> 0
|
||||
end
|
||||
|
||||
export def setmode(mode)#0
|
||||
if mode < 0
|
||||
//
|
||||
// Free driver
|
||||
//
|
||||
params.0 = 1
|
||||
params.1 = gfxref
|
||||
syscall($CC, @params)
|
||||
gfxref = 0
|
||||
//
|
||||
// Deallocate bank 0
|
||||
//
|
||||
params.0 = 1
|
||||
params.1 = gfxseg
|
||||
syscall($45, @params)
|
||||
^$1907 = $00 // Unset graphics pages allocated
|
||||
//
|
||||
// Reset textmode
|
||||
//
|
||||
cmdsys:syswrite(cmdsys.refcons, @textmode, 3)
|
||||
return
|
||||
elsif not gfxref
|
||||
gfxopen
|
||||
fin
|
||||
params.0 = 3
|
||||
params.1 = gfxref
|
||||
params:2 = @cmd
|
||||
params:4 = 8
|
||||
cmd.0 = 16 // Set mode
|
||||
cmd.1 = mode
|
||||
cmd.2 = 19 // Pen color
|
||||
cmd.3 = 0
|
||||
cmd.4 = 1 // Reset viewport
|
||||
cmd.5 = 28 // Clear viewport
|
||||
cmd.7 = 15 // Turn on screen
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
if MACHID <> $F2
|
||||
puts("Apple /// only.\n")
|
||||
return -1
|
||||
fin
|
||||
//
|
||||
// Keep module in memory
|
||||
//
|
||||
return modkeep
|
||||
return gfxopen ?? modkeep :: -1
|
||||
done
|
||||
|
|
|
@ -443,7 +443,8 @@ end
|
|||
// Set lores graphics, return draw buffer
|
||||
//
|
||||
export def grMode(mode)#1
|
||||
if mode
|
||||
when mode
|
||||
is page1
|
||||
//
|
||||
// Set GR mode
|
||||
//
|
||||
|
@ -455,10 +456,25 @@ export def grMode(mode)#1
|
|||
^show40 = 0
|
||||
^mapmain = 0
|
||||
^an3off
|
||||
drawpage = 1
|
||||
drawbuff = grbuff[1]
|
||||
return 1
|
||||
fin
|
||||
drawpage = page2
|
||||
drawbuff = grbuff[page2]
|
||||
break
|
||||
is page2
|
||||
//
|
||||
// Set GR mode
|
||||
//
|
||||
^showlores
|
||||
^showfull
|
||||
^showgraphics
|
||||
^showpage2
|
||||
^ena80 = 0
|
||||
^show40 = 0
|
||||
^mapmain = 0
|
||||
^an3off
|
||||
drawpage = page1
|
||||
drawbuff = grbuff[page1]
|
||||
break
|
||||
otherwise
|
||||
//
|
||||
// Set text mode
|
||||
//
|
||||
|
@ -469,7 +485,8 @@ export def grMode(mode)#1
|
|||
^mapmain = 0
|
||||
^an3off
|
||||
call($FC58, 0, 0, 0, 0) // home()
|
||||
return 0
|
||||
wend
|
||||
return mode
|
||||
end
|
||||
//
|
||||
// Set display page, return other page
|
||||
|
|
|
@ -1157,14 +1157,7 @@ export def hgrBLT(x, y, w, h, srcptr)#0
|
|||
end
|
||||
export def hgrMode(mode)#1
|
||||
when mode
|
||||
is 0
|
||||
//
|
||||
// Show text mode
|
||||
//
|
||||
^showpage1
|
||||
^showtext
|
||||
break
|
||||
is 1
|
||||
is page1
|
||||
//
|
||||
// Set HGR1 mode
|
||||
//
|
||||
|
@ -1173,21 +1166,27 @@ export def hgrMode(mode)#1
|
|||
^showfull
|
||||
^showhires
|
||||
^showgraphics
|
||||
drawpage = 1
|
||||
drawbuff = hgrbuff[1]
|
||||
drawpage = page2
|
||||
drawbuff = hgrbuff[page2]
|
||||
break
|
||||
is 2
|
||||
is page2
|
||||
//
|
||||
// Set HGR2 mode
|
||||
//
|
||||
memset(hgr2, 0, $2000) // Clear HGR2
|
||||
^showpage1
|
||||
^showpage2
|
||||
^showfull
|
||||
^showhires
|
||||
^showgraphics
|
||||
drawpage = 1
|
||||
drawbuff = hgrbuff[1]
|
||||
drawpage = page1
|
||||
drawbuff = hgrbuff[page1]
|
||||
break
|
||||
otherwise
|
||||
//
|
||||
// Show text mode
|
||||
//
|
||||
^showpage1
|
||||
^showtext
|
||||
wend
|
||||
return mode
|
||||
end
|
||||
|
|
|
@ -353,44 +353,9 @@ export def tileFromText(txtpage, tileset)#0
|
|||
tileDrawStr(0, y, rowaddr[y] | txtptr, 40, tileset)
|
||||
next
|
||||
end
|
||||
export def tileMode(mode)#1
|
||||
if mode
|
||||
//
|
||||
// Set HGR mode
|
||||
// Set draw buffer
|
||||
//
|
||||
memset(hgr1, 0, $2000) // Clear HGR page 1
|
||||
^showpage1
|
||||
^showfull
|
||||
^showhires
|
||||
^showgraphics
|
||||
drawpage = 0
|
||||
drawbuff = hgr1
|
||||
return 0
|
||||
fin
|
||||
//
|
||||
// Show text mode
|
||||
//
|
||||
^showpage1
|
||||
^showtext
|
||||
return 0
|
||||
end
|
||||
export def tileClear#0
|
||||
memset(drawbuff, $0000, drawbuff) // Clear current HGR page
|
||||
end
|
||||
//
|
||||
// Set display page, return other page
|
||||
//
|
||||
export def tileShow(page)#1
|
||||
page = page & 1
|
||||
^(showpage1 + page)
|
||||
return page ^ 1
|
||||
end
|
||||
export def tileSwap#1
|
||||
^(showpage1 + drawpage)
|
||||
drawpage = drawpage ^ 1
|
||||
drawbuff = hgrbuff[drawpage]
|
||||
return drawpage
|
||||
end
|
||||
export def tileDrawBuf(page)#1
|
||||
drawpage = page & 1
|
||||
drawbuff = hgrbuff[drawpage]
|
||||
|
|
|
@ -60,10 +60,11 @@ export asm throw(env, retval)
|
|||
DEC DST+1
|
||||
LDX TMPL
|
||||
TXS
|
||||
LDY TMPL
|
||||
LDY #$FE
|
||||
- LDA (DST),Y
|
||||
STA $0100,Y
|
||||
INY
|
||||
DEY
|
||||
CPY TMPL
|
||||
BNE -
|
||||
LDX ESP
|
||||
LDA SRC
|
||||
|
|
|
@ -839,10 +839,8 @@ def fpInit()
|
|||
fpzpsave = heapalloc($0034*2)
|
||||
(@fixupXS)=>1 = fpzpsave+$34
|
||||
(@fixupXR)=>1 = fpzpsave+$34
|
||||
zpSaveX // Clear XBYTEs
|
||||
heaprelease(fpzpsave)
|
||||
sane[9] = @zpNopSave//zpSaveX
|
||||
sane[10] = @zpNopRestore//zpRestoreX
|
||||
sane[9] = @zpSaveX
|
||||
sane[10] = @zpRestoreX
|
||||
else // Apple II
|
||||
fpzpsave = heapalloc($0034)
|
||||
sane[9] = @zpSave
|
||||
|
|
22
src/makefile
22
src/makefile
|
@ -60,6 +60,7 @@ DHCP = rel/DHCP\#FE1000
|
|||
HTTPD = rel/HTTPD\#FE1000
|
||||
TFTPD = rel/TFTPD\#FE1000
|
||||
HGRLIB = rel/apple/HGRLIB\#FE1000
|
||||
DHGRLIB = rel/apple/DHGRLIB\#FE1000
|
||||
GRLIB = rel/apple/GRLIB\#FE1000
|
||||
DGRLIB = rel/apple/DGRLIB\#FE1000
|
||||
HGRSPRITE = rel/apple/HGRSPRITE\#FE1000
|
||||
|
@ -76,7 +77,7 @@ ROGUE = rel/ROGUE\#FE1000
|
|||
ROGUEMAP = rel/ROGUEMAP\#FE1000
|
||||
ROGUECOMBAT= rel/ROGUECOMBAT\#FE1000
|
||||
MON = rel/apple/MON\#FE1000
|
||||
CONIOTST = rel/apple/CONIOTST\#FE1000
|
||||
CONIOTEST = rel/apple/CONIOTEST\#FE1000
|
||||
TILETEST = rel/apple/TILETEST\#FE1000
|
||||
HGRTEST = rel/apple/HGRTEST\#FE1000
|
||||
GRTEST = rel/apple/GRTEST\#FE1000
|
||||
|
@ -95,6 +96,7 @@ CODEOPT = rel/CODEOPT\#FE1000
|
|||
PLFORTH = rel/PLFORTH\#FE1000
|
||||
HRFORTH = rel/HRFORTH\#FE1000
|
||||
HR2FORTH = rel/HR2FORTH\#FE1000
|
||||
TX2FORTH = rel/TX2FORTH\#FE1000
|
||||
INCS = toolsrc/plasm.h toolsrc/tokens.h toolsrc/symbols.h toolsrc/lex.h toolsrc/parse.h toolsrc/codegen.h
|
||||
OBJS = toolsrc/plasm.c toolsrc/parse.c toolsrc/lex.c toolsrc/codegen.c
|
||||
#
|
||||
|
@ -113,7 +115,7 @@ TXTTYPE = .TXT
|
|||
#SYSTYPE = \#FF2000
|
||||
#TXTTYPE = \#040000
|
||||
|
||||
apple: $(PLVMZP_APL) $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVMJIT) $(PLVM802) $(PLVM03) $(PLVMJIT03) $(CMD) $(CMDJIT) $(JIT) $(JIT16) $(JITUNE) $(SOSCMD) $(SOSCMDJIT) $(PLASMAPLASM) $(CODEOPT) $(PLFORTH) $(HRFORTH) $(HR2FORTH) $(ZIPCHIP) $(MATCHFILES) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(COPY) $(DEL) $(REN) $(CAT) $(NEWDIR) $(TYPE) $(SOS) $(ROD) $(SIEVE) $(PRIMEGAP) $(MOUSE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(TFTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(SFM) $(SFMSPRT) $(GRAFIX) $(GFXDEMO) $(LINES) $(HGRTILE) $(HGRFONT) $(HGRSPRITE) $(HGRLIB) $(TILETEST) $(HGRTEST) $(GRLIB) $(DGRLIB) $(GRTEST) $(DGRTEST) $(HGRTEST) $(FILEIO_APL) $(CONIO_APL) $(JOYBUZZ) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(INT32) $(INT32TEST) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(LZ4) $(LZ4CAT) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ) $(CONIOTST)
|
||||
apple: $(PLVMZP_APL) $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVMJIT) $(PLVM802) $(PLVM03) $(PLVMJIT03) $(CMD) $(CMDJIT) $(JIT) $(JIT16) $(JITUNE) $(SOSCMD) $(SOSCMDJIT) $(PLASMAPLASM) $(CODEOPT) $(PLFORTH) $(HRFORTH) $(HR2FORTH) $(TX2FORTH) $(ZIPCHIP) $(MATCHFILES) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(COPY) $(DEL) $(REN) $(CAT) $(NEWDIR) $(TYPE) $(SOS) $(ROD) $(SIEVE) $(PRIMEGAP) $(MOUSE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(TFTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(SFM) $(SFMSPRT) $(GRAFIX) $(GFXDEMO) $(LINES) $(HGRTILE) $(HGRFONT) $(HGRSPRITE) $(HGRLIB) $(TILETEST) $(HGRTEST) $(DHGRLIB) $(GRLIB) $(DGRLIB) $(GRTEST) $(DGRTEST) $(HGRTEST) $(FILEIO_APL) $(CONIO_APL) $(JOYBUZZ) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(INT32) $(INT32TEST) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(LZ4) $(LZ4CAT) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ) $(CONIOTEST)
|
||||
|
||||
-rm vmsrc/plvmzp.inc
|
||||
|
||||
|
@ -161,6 +163,10 @@ $(HR2FORTH): toolsrc/hr2forth.pla
|
|||
./$(PLASM) -AMOW toolsrc/hr2forth.pla
|
||||
acme --setpc 4094 -o $(HR2FORTH) toolsrc/hr2forth.a
|
||||
|
||||
$(TX2FORTH): toolsrc/tx2forth.pla
|
||||
./$(PLASM) -AMOW toolsrc/tx2forth.pla
|
||||
acme --setpc 4094 -o $(TX2FORTH) toolsrc/tx2forth.a
|
||||
|
||||
$(PLFORTH): toolsrc/plforth.pla
|
||||
./$(PLASM) -AMOW toolsrc/plforth.pla
|
||||
acme --setpc 4094 -o $(PLFORTH) toolsrc/plforth.a
|
||||
|
@ -186,7 +192,7 @@ $(PLVMZP_C64): FORCE
|
|||
FORCE:
|
||||
|
||||
vmsrc/c64/cmd.a: vmsrc/c64/cmd.pla $(PLASM)
|
||||
./$(PLASM) -AOW < vmsrc/c64/cmd.pla > vmsrc/c64/cmd.a
|
||||
./$(PLASM) -AOW vmsrc/c64/cmd.pla
|
||||
|
||||
$(PLVMC64): vmsrc/c64/plvmc64.s vmsrc/c64/cmd.a
|
||||
acme -f cbm -o $(PLVMC64) -l vmsrc/c64/plvmc64.sym vmsrc/c64/plvmc64.s
|
||||
|
@ -304,9 +310,9 @@ hello: samplesrc/hello.pla $(PLVM) $(PLASM)
|
|||
acme --setpc 4094 -o $(HELLO) samplesrc/hello.a
|
||||
./$(PLVM) HELLO
|
||||
|
||||
$(CONIOTST): samplesrc/coniotst.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW samplesrc/coniotst.pla
|
||||
acme --setpc 4094 -o $(CONIOTST) samplesrc/coniotst.a
|
||||
$(CONIOTEST): samplesrc/coniotest.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW samplesrc/coniotest.pla
|
||||
acme --setpc 4094 -o $(CONIOTEST) samplesrc/coniotest.a
|
||||
|
||||
$(ROD): samplesrc/rod.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW samplesrc/rod.pla
|
||||
|
@ -460,6 +466,10 @@ $(HGRLIB): libsrc/apple/hgrlib.pla $(PLVM02) $(PLASM)
|
|||
./$(PLASM) -AMOW libsrc/apple/hgrlib.pla
|
||||
acme --setpc 4094 -o $(HGRLIB) libsrc/apple/hgrlib.a
|
||||
|
||||
$(DHGRLIB): libsrc/apple/dhgrlib.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW libsrc/apple/dhgrlib.pla
|
||||
acme --setpc 4094 -o $(DHGRLIB) libsrc/apple/dhgrlib.a
|
||||
|
||||
$(GRLIB): libsrc/apple/grlib.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW libsrc/apple/grlib.pla
|
||||
acme --setpc 4094 -o $(GRLIB) libsrc/apple/grlib.a
|
||||
|
|
526
src/makefile.hgr
526
src/makefile.hgr
|
@ -1,526 +0,0 @@
|
|||
.SUFFIXES =
|
||||
AFLAGS = -o $@
|
||||
PLVM = plvm
|
||||
PLVMZP_APL = vmsrc/apple/plvmzp.inc
|
||||
PLVM01 = rel/apple/A1PLASMA\#060280
|
||||
PLVM02 = rel/apple/PLASMA.SYSTEM\#FF2000
|
||||
PLVMJIT = rel/apple/PLVM.128\#FF2000
|
||||
PLVM802 = rel/apple/PLVM16\#FF2000
|
||||
PLVM03 = rel/apple/SOS.INTERP\#050000
|
||||
PLVMJIT03 = rel/apple/SOS.INTERPJIT\#050000
|
||||
SOSCMD = rel/apple/SOS.CMD\#FE1000
|
||||
SOSCMDJIT = rel/apple/SOS.CMDJIT\#FE1000
|
||||
CMD = rel/apple/CMD\#061000
|
||||
CMDJIT = rel/apple/CMD128\#061000
|
||||
PLVMZP_C64 = vmsrc/c64/plvmzp.inc
|
||||
PLVMC64 = rel/c64/PLASMA
|
||||
ED = rel/ED\#FE1000
|
||||
ZIP = rel/apple/ZIP\#FE1000
|
||||
JIT = rel/apple/JIT\#FE1000
|
||||
JIT16 = rel/apple/JIT16\#FE1000
|
||||
JITUNE = rel/apple/JITUNE\#FE1000
|
||||
SOS = rel/apple/SOS\#FE1000
|
||||
ROD = rel/apple/ROD\#FE1000
|
||||
COPY = rel/apple/COPY\#FE1000
|
||||
DEL = rel/apple/DEL\#FE1000
|
||||
REN = rel/apple/REN\#FE1000
|
||||
CAT = rel/apple/CAT\#FE1000
|
||||
NEWDIR = rel/apple/NEWDIR\#FE1000
|
||||
TYPE = rel/apple/TYPE\#FE1000
|
||||
SIEVE = rel/SIEVE\#FE1000
|
||||
PRIMEGAP = rel/PRIMEGAP\#FE1000
|
||||
ARGS = rel/ARGS\#FE1000
|
||||
MATCHFILES = rel/apple/MATCHFILES\#FE1000
|
||||
SPIPORT = rel/apple/SPIPORT\#FE1000
|
||||
SDFAT = rel/apple/SDFAT\#FE1000
|
||||
FATCAT = rel/apple/FATCAT\#FE1000
|
||||
FATGET = rel/apple/FATGET\#FE1000
|
||||
FATPUT = rel/apple/FATPUT\#FE1000
|
||||
FATWDSK = rel/apple/FATWRITEDSK\#FE1000
|
||||
FATRDSK = rel/apple/FATREADDSK\#FE1000
|
||||
FILEIO_APL = rel/apple/FILEIO\#FE1000
|
||||
CONIO_APL = rel/apple/CONIO\#FE1000
|
||||
INT32 = rel/INT32\#FE1000
|
||||
INT32TEST = rel/INT32TEST\#FE1000
|
||||
SANE = rel/SANE\#FE1000
|
||||
FPSTR = rel/FPSTR\#FE1000
|
||||
FPU = rel/FPU\#FE1000
|
||||
SNDSEQ = rel/apple/SNDSEQ\#FE1000
|
||||
PLAYSEQ = rel/apple/PLAYSEQ\#FE1000
|
||||
SANITY = rel/SANITY\#FE1000
|
||||
RPNCALC = rel/RPNCALC\#FE1000
|
||||
LZ4 = rel/LZ4\#FE1000
|
||||
LZ4CAT = rel/LZ4CAT\#FE1000
|
||||
MOUSE = rel/apple/MOUSE\#FE1000
|
||||
UTHERNET2 = rel/apple/UTHERNET2\#FE1000
|
||||
UTHERNET = rel/apple/UTHERNET\#FE1000
|
||||
ETHERIP = rel/ETHERIP\#FE1000
|
||||
INET = rel/INET\#FE1000
|
||||
DHCP = rel/DHCP\#FE1000
|
||||
HTTPD = rel/HTTPD\#FE1000
|
||||
TFTPD = rel/TFTPD\#FE1000
|
||||
HGRLIB = rel/apple/HGRLIB\#FE1000
|
||||
GRLIB = rel/apple/GRLIB\#FE1000
|
||||
DGRLIB = rel/apple/DGRLIB\#FE1000
|
||||
HGRSPRITE = rel/apple/HGRSPRITE\#FE1000
|
||||
HGRTILE = rel/apple/HGRTILE\#FE1000
|
||||
HGRFONT = rel/apple/HGRFONT\#FE1000
|
||||
LINES = rel/LINES\#FE1000
|
||||
GRAFIX = rel/apple/GRAFIX\#FE1000
|
||||
SFM = rel/apple/SFM\#FE1000
|
||||
SFMSPRT = rel/apple/SFMSPRT\#FE1000
|
||||
GFXDEMO = rel/apple/GFXDEMO\#FE1000
|
||||
JOYBUZZ = rel/apple/JOYBUZZ\#FE1000
|
||||
PORTIO = rel/apple/PORTIO\#FE1000
|
||||
ROGUE = rel/ROGUE\#FE1000
|
||||
ROGUEMAP = rel/ROGUEMAP\#FE1000
|
||||
ROGUECOMBAT= rel/ROGUECOMBAT\#FE1000
|
||||
MON = rel/apple/MON\#FE1000
|
||||
TILETEST = rel/apple/TILETEST\#FE1000
|
||||
HGRTEST = rel/apple/HGRTEST\#FE1000
|
||||
GRTEST = rel/apple/GRTEST\#FE1000
|
||||
DGRTEST = rel/apple/DGRTEST\#FE1000
|
||||
MEMMGR = rel/MEMMGR\#FE1000
|
||||
MEMTEST = rel/MEMTEST\#FE1000
|
||||
FIBERTEST = rel/FIBERTEST\#FE1000
|
||||
FIBER = rel/FIBER\#FE1000
|
||||
LONGJMP = rel/LONGJMP\#FE1000
|
||||
HELLO = HELLO\#FE1000
|
||||
TEST = TEST\#FE1000
|
||||
TESTLIB = TESTLIB\#FE1000
|
||||
PLASM = plasm
|
||||
PLASMAPLASM = rel/PLASM\#FE1000
|
||||
CODEOPT = rel/CODEOPT\#FE1000
|
||||
INCS = toolsrc/plasm.h toolsrc/tokens.h toolsrc/symbols.h toolsrc/lex.h toolsrc/parse.h toolsrc/codegen.h
|
||||
OBJS = toolsrc/plasm.c toolsrc/parse.c toolsrc/lex.c toolsrc/codegen.c
|
||||
#
|
||||
# Image filetypes for Virtual ][
|
||||
#
|
||||
PLATYPE = .\$$ED
|
||||
BINTYPE = .BIN
|
||||
SYSTYPE = .SYS
|
||||
TXTTYPE = .TXT
|
||||
#
|
||||
# Image filetypes for CiderPress
|
||||
#
|
||||
#RELTYPE = \#FE1000
|
||||
#INTERPTYPE = \#050000
|
||||
#BINTYPE = \#060000
|
||||
#SYSTYPE = \#FF2000
|
||||
#TXTTYPE = \#040000
|
||||
|
||||
apple: $(PLVMZP_APL) $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVMJIT) $(PLVM802) $(PLVM03) $(PLVMJIT03) $(CMD) $(CMDJIT) $(JIT) $(JIT16) $(JITUNE) $(SOSCMD) $(SOSCMDJIT) $(PLASMAPLASM) $(CODEOPT) $(ZIP) $(MATCHFILES) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(COPY) $(DEL) $(REN) $(CAT) $(NEWDIR) $(TYPE) $(SOS) $(ROD) $(SIEVE) $(PRIMEGAP) $(MOUSE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(TFTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(SFM) $(SFMSPRT) $(GRAFIX) $(GFXDEMO) $(LINES) $(HGRTILE) $(HGRFONT) $(HGRSPRITE) $(HGRLIB) $(TILETEST) $(HGRTEST) $(GRLIB) $(DGRLIB) $(GRTEST) $(DGRTEST) $(HGRTEST) $(FILEIO_APL) $(CONIO_APL) $(JOYBUZZ) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(INT32) $(INT32TEST) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(LZ4) $(LZ4CAT) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ)
|
||||
|
||||
-rm vmsrc/plvmzp.inc
|
||||
|
||||
c64: $(PLVMZP_C64) $(PLASM) $(PLVM) $(PLVMC64)
|
||||
-rm vmsrc/plvmzp.inc
|
||||
|
||||
all: apple c64
|
||||
|
||||
clean:
|
||||
-rm *FE1000 *FF2000 $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVMJIT) $(PLVM03)
|
||||
-rm -rf rel
|
||||
-rm samplesrc/*.o samplesrc/*~ samplesrc/*.a
|
||||
-rm toolsrc/*.o toolsrc/*~ toolsrc/*.a
|
||||
-rm toolsrc/apple/*.o toolsrc/apple/*~ toolsrc/apple/*.a
|
||||
-rm toolsrc/c64/*.o toolsrc/c64/*~ toolsrc/c64/*.a
|
||||
-rm vmsrc/*.o vmsrc/*~ vmsrc/*.a vmsrc/*.sym
|
||||
-rm vmsrc/apple/*.o vmsrc/apple/*~ vmsrc/apple/*.a vmsrc/apple/*.sym
|
||||
-rm vmsrc/c64/*.o vmsrc/c64/*~ vmsrc/c64/*.a vmsrc/c64/*.sym
|
||||
-rm libsrc/*.o libsrc/*~ libsrc/*.a
|
||||
-rm libsrc/apple/*.o libsrc/apple/*~ libsrc/apple/*.a
|
||||
-rm libsrc/c64/*.o libsrc/c64/*~ libsrc/c64/*.a
|
||||
-rm utilsrc/*.o utilsrc/*~ utilsrc/*.a
|
||||
-rm utilsrc/apple/*.o utilsrc/apple/*~ utilsrc/apple/*.a
|
||||
-rm utilsrc/c64/*.o utilsrc/c64/*~ utilsrc/c64/*.a
|
||||
|
||||
#
|
||||
# PLASMA compiler: plasm
|
||||
#
|
||||
$(PLASM): $(OBJS) $(INCS)
|
||||
cc $(OBJS) -o $(PLASM)
|
||||
|
||||
$(PLASMAPLASM): toolsrc/plasm.pla toolsrc/lex.pla toolsrc/parse.pla toolsrc/codegen.pla toolsrc/codeseq.plh
|
||||
./$(PLASM) -AMOW < toolsrc/plasm.pla > toolsrc/plasm.a
|
||||
acme --setpc 4094 -o $(PLASMAPLASM) toolsrc/plasm.a
|
||||
|
||||
$(CODEOPT): toolsrc/codeopt.pla toolsrc/codeseq.plh
|
||||
./$(PLASM) -AMOW < toolsrc/codeopt.pla > toolsrc/codeopt.a
|
||||
acme --setpc 4094 -o $(CODEOPT) toolsrc/codeopt.a
|
||||
|
||||
#
|
||||
# PLASMA VMs
|
||||
#
|
||||
$(PLVM): vmsrc/plvm.c
|
||||
cc vmsrc/plvm.c -o $(PLVM)
|
||||
|
||||
$(PLVMZP_APL): FORCE
|
||||
-mkdir -p rel
|
||||
-mkdir -p rel/apple
|
||||
-rm -f vmsrc/plvmzp.inc
|
||||
-ln -s apple/plvmzp.inc vmsrc/plvmzp.inc
|
||||
|
||||
$(PLVMZP_C64): FORCE
|
||||
-mkdir -p rel
|
||||
-mkdir -p rel/c64
|
||||
-rm -f vmsrc/plvmzp.inc
|
||||
-ln -s c64/plvmzp.inc vmsrc/plvmzp.inc
|
||||
|
||||
FORCE:
|
||||
|
||||
vmsrc/c64/cmd.a: vmsrc/c64/cmd.pla $(PLASM)
|
||||
./$(PLASM) -AOW < vmsrc/c64/cmd.pla > vmsrc/c64/cmd.a
|
||||
|
||||
$(PLVMC64): vmsrc/c64/plvmc64.s vmsrc/c64/cmd.a
|
||||
acme -f cbm -o $(PLVMC64) -l vmsrc/c64/plvmc64.sym vmsrc/c64/plvmc64.s
|
||||
|
||||
vmsrc/apple/a1cmd.a: vmsrc/apple/a1cmd.pla $(PLASM)
|
||||
./$(PLASM) -AOW < vmsrc/apple/a1cmd.pla > vmsrc/apple/a1cmd.a
|
||||
|
||||
$(PLVM01): vmsrc/apple/plvm01.s vmsrc/apple/a1cmd.a
|
||||
acme -o $(PLVM01) -l vmsrc/apple/plvm01.sym vmsrc/apple/plvm01.s
|
||||
|
||||
$(CMD): vmsrc/apple/cmd.pla vmsrc/apple/cmdstub.s $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AOW < vmsrc/apple/cmd.pla > vmsrc/apple/cmd.a
|
||||
acme --setpc 8192 -o $(CMD) vmsrc/apple/cmdstub.s
|
||||
|
||||
$(CMDJIT): vmsrc/apple/cmdjit.pla vmsrc/apple/cmdjitstub.s $(PLVMJIT) $(PLASM)
|
||||
./$(PLASM) -AOW < vmsrc/apple/cmdjit.pla > vmsrc/apple/cmdjit.a
|
||||
acme --setpc 8192 -o $(CMDJIT) vmsrc/apple/cmdjitstub.s
|
||||
|
||||
$(SOSCMD): vmsrc/apple/soscmd.pla $(PLVM03) $(PLASM)
|
||||
./$(PLASM) -AMOW < vmsrc/apple/soscmd.pla > vmsrc/apple/soscmd.a
|
||||
acme --setpc 4094 -o $(SOSCMD) vmsrc/apple/soscmd.a
|
||||
|
||||
$(SOSCMDJIT): vmsrc/apple/soscmdjit.pla libsrc/jitcore.pla $(PLVMJIT03) $(PLASM)
|
||||
./$(PLASM) -AMOW < vmsrc/apple/soscmdjit.pla > vmsrc/apple/soscmdjit.a
|
||||
acme --setpc 4094 -o $(SOSCMDJIT) vmsrc/apple/soscmdjit.a
|
||||
|
||||
$(PLVM02): vmsrc/apple/plvm02.s
|
||||
acme -o $(PLVM02) -l vmsrc/apple/plvm02.sym vmsrc/apple/plvm02.s
|
||||
|
||||
$(PLVMJIT): vmsrc/apple/plvmjit02.s
|
||||
acme -o $(PLVMJIT) -l vmsrc/apple/plvmjit02.sym vmsrc/apple/plvmjit02.s
|
||||
|
||||
$(PLVM802): vmsrc/apple/plvm802.s
|
||||
acme -o $(PLVM802) -l vmsrc/apple/plvm802.sym vmsrc/apple/plvm802.s
|
||||
|
||||
vmsrc/apple/sossys.a: vmsrc/apple/sossys.pla $(PLASM)
|
||||
./$(PLASM) -AOW < vmsrc/apple/sossys.pla > vmsrc/apple/sossys.a
|
||||
|
||||
$(PLVM03): vmsrc/apple/plvm03.s vmsrc/apple/sossys.a
|
||||
acme -o $(PLVM03) -l vmsrc/apple/plvm03.sym vmsrc/apple/plvm03.s
|
||||
|
||||
vmsrc/apple/sossysjit.a: vmsrc/apple/sossysjit.pla $(PLASM)
|
||||
./$(PLASM) -AOW < vmsrc/apple/sossysjit.pla > vmsrc/apple/sossysjit.a
|
||||
|
||||
$(PLVMJIT03): vmsrc/apple/plvmjit03.s vmsrc/apple/sossysjit.a
|
||||
acme -o $(PLVMJIT03) -l vmsrc/apple/plvmjit03.sym vmsrc/apple/plvmjit03.s
|
||||
#
|
||||
# Sample code
|
||||
#
|
||||
test: samplesrc/test.pla samplesrc/testlib.pla $(PLVM) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/test.pla > samplesrc/test.a
|
||||
acme --setpc 4094 -o $(TEST) samplesrc/test.a
|
||||
./$(PLASM) -AMOW < samplesrc/testlib.pla > samplesrc/testlib.a
|
||||
acme --setpc 4094 -o $(TESTLIB) samplesrc/testlib.a
|
||||
./$(PLVM) TEST
|
||||
|
||||
$(ED): toolsrc/ed.pla $(PLVM02) $(PLASM) toolsrc/ed.pla
|
||||
./$(PLASM) -AMOW < toolsrc/ed.pla > toolsrc/ed.a
|
||||
acme --setpc 4094 -o $(ED) toolsrc/ed.a
|
||||
|
||||
$(MATCHFILES): libsrc/apple/matchfiles.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/matchfiles.pla > libsrc/apple/matchfiles.a
|
||||
acme --setpc 4094 -o $(MATCHFILES) libsrc/apple/matchfiles.a
|
||||
|
||||
$(ARGS): libsrc/args.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/args.pla > libsrc/args.a
|
||||
acme --setpc 4094 -o $(ARGS) libsrc/args.a
|
||||
|
||||
$(MEMMGR): libsrc/memmgr.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/memmgr.pla > libsrc/memmgr.a
|
||||
acme --setpc 4094 -o $(MEMMGR) libsrc/memmgr.a
|
||||
|
||||
$(MEMTEST): samplesrc/memtest.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/memtest.pla > samplesrc/memtest.a
|
||||
acme --setpc 4094 -o $(MEMTEST) samplesrc/memtest.a
|
||||
|
||||
$(FIBER): libsrc/fiber.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/fiber.pla > libsrc/fiber.a
|
||||
acme --setpc 4094 -o $(FIBER) libsrc/fiber.a
|
||||
|
||||
$(LINES): libsrc/lines.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/lines.pla > libsrc/lines.a
|
||||
acme --setpc 4094 -o $(LINES) libsrc/lines.a
|
||||
|
||||
$(FIBERTEST): samplesrc/fibertest.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/fibertest.pla > samplesrc/fibertest.a
|
||||
acme --setpc 4094 -o $(FIBERTEST) samplesrc/fibertest.a
|
||||
|
||||
$(LONGJMP): libsrc/longjmp.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/longjmp.pla > libsrc/longjmp.a
|
||||
acme --setpc 4094 -o $(LONGJMP) libsrc/longjmp.a
|
||||
|
||||
$(SFM): samplesrc/sfm.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/sfm.pla > samplesrc/sfm.a
|
||||
acme --setpc 4094 -o $(SFM) samplesrc/sfm.a
|
||||
|
||||
$(SFMSPRT): samplesrc/sfmsprt.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/sfmsprt.pla > samplesrc/sfmsprt.a
|
||||
acme --setpc 4094 -o $(SFMSPRT) samplesrc/sfmsprt.a
|
||||
|
||||
$(ROGUE): samplesrc/hgrogue.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/hgrogue.pla > samplesrc/hgrogue.a
|
||||
acme --setpc 4094 -o $(ROGUE) samplesrc/hgrogue.a
|
||||
|
||||
$(ROGUECOMBAT): samplesrc/hgrogue.combat.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/hgrogue.combat.pla > samplesrc/hgrogue.combat.a
|
||||
acme --setpc 4094 -o $(ROGUECOMBAT) samplesrc/hgrogue.combat.a
|
||||
|
||||
$(ROGUEMAP): samplesrc/hgrogue.map.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/hgrogue.map.pla > samplesrc/hgrogue.map.a
|
||||
acme --setpc 4094 -o $(ROGUEMAP) samplesrc/hgrogue.map.a
|
||||
|
||||
hello: samplesrc/hello.pla $(PLVM) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/hello.pla > samplesrc/hello.a
|
||||
acme --setpc 4094 -o $(HELLO) samplesrc/hello.a
|
||||
./$(PLVM) HELLO
|
||||
$(ROD): samplesrc/rod.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/rod.pla > samplesrc/rod.a
|
||||
acme --setpc 4094 -o $(ROD) samplesrc/rod.a
|
||||
|
||||
$(SIEVE): samplesrc/sieve.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMW < samplesrc/sieve.pla > samplesrc/sieve.a
|
||||
acme --setpc 4094 -o $(SIEVE) samplesrc/sieve.a
|
||||
|
||||
$(PRIMEGAP): samplesrc/primegap.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMW < samplesrc/primegap.pla > samplesrc/primegap.a
|
||||
acme --setpc 4094 -o $(PRIMEGAP) samplesrc/primegap.a
|
||||
|
||||
$(INT32): libsrc/int32.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/int32.pla > libsrc/int32.a
|
||||
acme --setpc 4094 -o $(INT32) libsrc/int32.a
|
||||
|
||||
$(INT32TEST): samplesrc/int32test.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/int32test.pla > samplesrc/int32test.a
|
||||
acme --setpc 4094 -o $(INT32TEST) samplesrc/int32test.a
|
||||
|
||||
$(SANE): libsrc/sane.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/sane.pla > libsrc/sane.a
|
||||
acme --setpc 4094 -o $(SANE) libsrc/sane.a
|
||||
|
||||
$(FPSTR): libsrc/fpstr.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/fpstr.pla > libsrc/fpstr.a
|
||||
acme --setpc 4094 -o $(FPSTR) libsrc/fpstr.a
|
||||
|
||||
$(FPU): libsrc/fpu.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/fpu.pla > libsrc/fpu.a
|
||||
acme --setpc 4094 -o $(FPU) libsrc/fpu.a
|
||||
|
||||
$(SANITY): samplesrc/sanity.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/sanity.pla > samplesrc/sanity.a
|
||||
acme --setpc 4094 -o $(SANITY) samplesrc/sanity.a
|
||||
|
||||
$(LZ4): libsrc/lz4.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/lz4.pla > libsrc/lz4.a
|
||||
acme --setpc 4094 -o $(LZ4) libsrc/lz4.a
|
||||
|
||||
$(LZ4CAT): samplesrc/lz4cat.pla inc/lz4.plh $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/lz4cat.pla > samplesrc/lz4cat.a
|
||||
acme --setpc 4094 -o $(LZ4CAT) samplesrc/lz4cat.a
|
||||
|
||||
$(RPNCALC): samplesrc/rpncalc.pla libsrc/fpu.pla inc/fpu.plh libsrc/fpstr.pla inc/fpstr.plh inc/conio.plh $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/rpncalc.pla > samplesrc/rpncalc.a
|
||||
acme --setpc 4094 -o $(RPNCALC) samplesrc/rpncalc.a
|
||||
|
||||
$(ETHERIP): libsrc/etherip.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/etherip.pla > libsrc/etherip.a
|
||||
acme --setpc 4094 -o $(ETHERIP) libsrc/etherip.a
|
||||
|
||||
$(INET): libsrc/inet.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/inet.pla > libsrc/inet.a
|
||||
acme --setpc 4094 -o $(INET) libsrc/inet.a
|
||||
|
||||
$(DHCP): libsrc/dhcp.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/dhcp.pla > libsrc/dhcp.a
|
||||
acme --setpc 4094 -o $(DHCP) libsrc/dhcp.a
|
||||
|
||||
$(HTTPD): samplesrc/httpd.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/httpd.pla > samplesrc/httpd.a
|
||||
acme --setpc 4094 -o $(HTTPD) samplesrc/httpd.a
|
||||
|
||||
$(TFTPD): utilsrc/tftpd.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < utilsrc/tftpd.pla > utilsrc/tftpd.a
|
||||
acme --setpc 4094 -o $(TFTPD) utilsrc/tftpd.a
|
||||
|
||||
$(MOUSE): libsrc/apple/mouse.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/mouse.pla > libsrc/apple/mouse.a
|
||||
acme --setpc 4094 -o $(MOUSE) libsrc/apple/mouse.a
|
||||
|
||||
$(UTHERNET): libsrc/apple/uthernet.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/uthernet.pla > libsrc/apple/uthernet.a
|
||||
acme --setpc 4094 -o $(UTHERNET) libsrc/apple/uthernet.a
|
||||
|
||||
$(UTHERNET2): libsrc/apple/uthernet2.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/uthernet2.pla > libsrc/apple/uthernet2.a
|
||||
acme --setpc 4094 -o $(UTHERNET2) libsrc/apple/uthernet2.a
|
||||
|
||||
$(FILEIO_APL): libsrc/apple/fileio.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/fileio.pla > libsrc/apple/fileio.a
|
||||
acme --setpc 4094 -o $(FILEIO_APL) libsrc/apple/fileio.a
|
||||
|
||||
$(CONIO_APL): libsrc/apple/conio.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/conio.pla > libsrc/apple/conio.a
|
||||
acme --setpc 4094 -o $(CONIO_APL) libsrc/apple/conio.a
|
||||
|
||||
$(FILEIO_C64): libsrc/c64/fileio.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/c64/fileio.pla > libsrc/c64/fileio.a
|
||||
acme --setpc 4094 -o $(FILEIO_C64) libsrc/c64/fileio.a
|
||||
|
||||
$(CONIO_C64): libsrc/c64/conio.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/c64/conio.pla > libsrc/c64/conio.a
|
||||
acme --setpc 4094 -o $(CONIO_C64) libsrc/c64/conio.a
|
||||
|
||||
$(SNDSEQ): libsrc/apple/sndseq.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/sndseq.pla > libsrc/apple/sndseq.a
|
||||
acme --setpc 4094 -o $(SNDSEQ) libsrc/apple/sndseq.a
|
||||
|
||||
$(PLAYSEQ): samplesrc/playseq.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/playseq.pla > samplesrc/playseq.a
|
||||
acme --setpc 4094 -o $(PLAYSEQ) samplesrc/playseq.a
|
||||
|
||||
$(GRAFIX): libsrc/apple/grafix.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/grafix.pla > libsrc/apple/grafix.a
|
||||
acme --setpc 4094 -o $(GRAFIX) libsrc/apple/grafix.a
|
||||
|
||||
$(GFXDEMO): samplesrc/gfxdemo.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/gfxdemo.pla > samplesrc/gfxdemo.a
|
||||
acme --setpc 4094 -o $(GFXDEMO) samplesrc/gfxdemo.a
|
||||
|
||||
$(FATCAT): samplesrc/fatcat.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/fatcat.pla > samplesrc/fatcat.a
|
||||
acme --setpc 4094 -o $(FATCAT) samplesrc/fatcat.a
|
||||
|
||||
$(FATGET): samplesrc/fatget.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/fatget.pla > samplesrc/fatget.a
|
||||
acme --setpc 4094 -o $(FATGET) samplesrc/fatget.a
|
||||
|
||||
$(FATPUT): samplesrc/fatput.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/fatput.pla > samplesrc/fatput.a
|
||||
acme --setpc 4094 -o $(FATPUT) samplesrc/fatput.a
|
||||
|
||||
$(FATWDSK): samplesrc/fatwritedsk.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/fatwritedsk.pla > samplesrc/fatwritedsk.a
|
||||
acme --setpc 4094 -o $(FATWDSK) samplesrc/fatwritedsk.a
|
||||
|
||||
$(FATRDSK): samplesrc/fatreaddsk.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/fatreaddsk.pla > samplesrc/fatreaddsk.a
|
||||
acme --setpc 4094 -o $(FATRDSK) samplesrc/fatreaddsk.a
|
||||
|
||||
$(SDFAT): libsrc/apple/sdfat.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/sdfat.pla > libsrc/apple/sdfat.a
|
||||
acme --setpc 4094 -o $(SDFAT) libsrc/apple/sdfat.a
|
||||
|
||||
$(SPIPORT): libsrc/apple/spiport.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/spiport.pla > libsrc/apple/spiport.a
|
||||
acme --setpc 4094 -o $(SPIPORT) libsrc/apple/spiport.a
|
||||
|
||||
$(JOYBUZZ): libsrc/apple/joybuzz.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/joybuzz.pla > libsrc/apple/joybuzz.a
|
||||
acme --setpc 4094 -o $(JOYBUZZ) libsrc/apple/joybuzz.a
|
||||
|
||||
$(PORTIO): libsrc/apple/portio.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/portio.pla > libsrc/apple/portio.a
|
||||
acme --setpc 4094 -o $(PORTIO) libsrc/apple/portio.a
|
||||
|
||||
$(HGRLIB): libsrc/apple/hgrlib.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/hgrlib.pla > libsrc/apple/hgrlib.a
|
||||
acme --setpc 4094 -o $(HGRLIB) libsrc/apple/hgrlib.a
|
||||
|
||||
$(GRLIB): libsrc/apple/grlib.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/grlib.pla > libsrc/apple/grlib.a
|
||||
acme --setpc 4094 -o $(GRLIB) libsrc/apple/grlib.a
|
||||
|
||||
$(DGRLIB): libsrc/apple/dgrlib.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/dgrlib.pla > libsrc/apple/dgrlib.a
|
||||
acme --setpc 4094 -o $(DGRLIB) libsrc/apple/dgrlib.a
|
||||
|
||||
$(TILETEST): samplesrc/tiletest.pla $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/tiletest.pla > samplesrc/tiletest.a
|
||||
acme --setpc 4094 -o $(TILETEST) samplesrc/tiletest.a
|
||||
|
||||
$(HGRTILE): libsrc/apple/hgrtile.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/hgrtile.pla > libsrc/apple/hgrtile.a
|
||||
acme --setpc 4094 -o $(HGRTILE) libsrc/apple/hgrtile.a
|
||||
|
||||
$(HGRFONT): libsrc/apple/hgrfont.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/hgrfont.pla > libsrc/apple/hgrfont.a
|
||||
acme --setpc 4094 -o $(HGRFONT) libsrc/apple/hgrfont.a
|
||||
|
||||
$(HGRSPRITE): libsrc/apple/hgrsprite.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/hgrsprite.pla > libsrc/apple/hgrsprite.a
|
||||
acme --setpc 4094 -o $(HGRSPRITE) libsrc/apple/hgrsprite.a
|
||||
|
||||
$(HGRTEST): samplesrc/hgrtest.pla $(HGRLIB) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/hgrtest.pla > samplesrc/hgrtest.a
|
||||
acme --setpc 4094 -o $(HGRTEST) samplesrc/hgrtest.a
|
||||
|
||||
$(GRTEST): samplesrc/grtest.pla $(GRLIB) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/grtest.pla > samplesrc/grtest.a
|
||||
acme --setpc 4094 -o $(GRTEST) samplesrc/grtest.a
|
||||
|
||||
$(DGRTEST): samplesrc/dgrtest.pla $(DGRLIB) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/dgrtest.pla > samplesrc/dgrtest.a
|
||||
acme --setpc 4094 -o $(DGRTEST) samplesrc/dgrtest.a
|
||||
|
||||
$(MON): utilsrc/apple/mon.pla $(PLASM)
|
||||
./$(PLASM) -AMOW < utilsrc/apple/mon.pla > utilsrc/apple/mon.a
|
||||
acme --setpc 4094 -o $(MON) utilsrc/apple/mon.a
|
||||
|
||||
$(COPY): utilsrc/apple/copy.pla $(PLASM)
|
||||
./$(PLASM) -AMOW < utilsrc/apple/copy.pla > utilsrc/apple/copy.a
|
||||
acme --setpc 4094 -o $(COPY) utilsrc/apple/copy.a
|
||||
|
||||
$(DEL): utilsrc/apple/del.pla $(PLASM)
|
||||
./$(PLASM) -AMOW < utilsrc/apple/del.pla > utilsrc/apple/del.a
|
||||
acme --setpc 4094 -o $(DEL) utilsrc/apple/del.a
|
||||
|
||||
$(REN): utilsrc/apple/ren.pla $(PLASM)
|
||||
./$(PLASM) -AMOW < utilsrc/apple/ren.pla > utilsrc/apple/ren.a
|
||||
acme --setpc 4094 -o $(REN) utilsrc/apple/ren.a
|
||||
|
||||
$(CAT): utilsrc/apple/cat.pla $(PLASM)
|
||||
./$(PLASM) -AMOW < utilsrc/apple/cat.pla > utilsrc/apple/cat.a
|
||||
acme --setpc 4094 -o $(CAT) utilsrc/apple/cat.a
|
||||
|
||||
$(NEWDIR): utilsrc/apple/newdir.pla $(PLASM)
|
||||
./$(PLASM) -AMOW < utilsrc/apple/newdir.pla > utilsrc/apple/newdir.a
|
||||
acme --setpc 4094 -o $(NEWDIR) utilsrc/apple/newdir.a
|
||||
|
||||
$(TYPE): utilsrc/apple/type.pla $(PLASM)
|
||||
./$(PLASM) -AMOW < utilsrc/apple/type.pla > utilsrc/apple/type.a
|
||||
acme --setpc 4094 -o $(TYPE) utilsrc/apple/type.a
|
||||
|
||||
$(SOS): utilsrc/apple/sos.pla $(PLVM03) $(PLASM)
|
||||
./$(PLASM) -AMOW < utilsrc/apple/sos.pla > utilsrc/apple/sos.a
|
||||
acme --setpc 4094 -o $(SOS) utilsrc/apple/sos.a
|
||||
|
||||
$(ZIP): utilsrc/apple/zip.pla $(PLASM)
|
||||
./$(PLASM) -AMOW < utilsrc/apple/zip.pla > utilsrc/apple/zip.a
|
||||
acme --setpc 4094 -o $(ZIP) utilsrc/apple/zip.a
|
||||
|
||||
$(JIT): libsrc/apple/jit.pla libsrc/jitcore.pla $(PLVMJIT) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/jit.pla > libsrc/apple/jit.a
|
||||
acme --setpc 4094 -o $(JIT) libsrc/apple/jit.a
|
||||
|
||||
$(JIT16): libsrc/apple/jit16.pla libsrc/jit16core.pla $(PLVMJIT) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/apple/jit16.pla > libsrc/apple/jit16.a
|
||||
acme --setpc 4094 -o $(JIT16) libsrc/apple/jit16.a
|
||||
|
||||
$(JITUNE): utilsrc/apple/jitune.pla $(PLVMJIT) $(PLASM)
|
||||
./$(PLASM) -AMOW < utilsrc/apple/jitune.pla > utilsrc/apple/jitune.a
|
||||
acme --setpc 4094 -o $(JITUNE) utilsrc/apple/jitune.a
|
||||
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
./mkrel
|
||||
|
||||
./mkinst
|
||||
./mksys
|
||||
./mk4th
|
||||
./mkfpsos
|
||||
./mkbld
|
||||
./mkinet
|
||||
|
|
64
src/mk4th
64
src/mk4th
|
@ -1,15 +1,49 @@
|
|||
cp ../sysfiles/BLANK140.po PLASMA-2.1-4TH.po
|
||||
./ac.jar -n PLASMA-2.1-4TH.po PLASMA.4TH
|
||||
cat rel/HRFORTH#FE1000 | ./ac.jar -p PLASMA-2.1-4TH.po sys/HRFORTH REL
|
||||
cat rel/HR2FORTH#FE1000 | ./ac.jar -p PLASMA-2.1-4TH.po sys/HR2FORTH REL
|
||||
cat rel/PLFORTH#FE1000 | ./ac.jar -p PLASMA-2.1-4TH.po sys/PLFORTH REL
|
||||
cat scripts/plasma.4th | ./ac.jar -ptx PLASMA-2.1-4TH.po sys/scripts/PLASMA.4TH TXT
|
||||
cat scripts/conio.4th | ./ac.jar -ptx PLASMA-2.1-4TH.po sys/scripts/CONIO.4TH TXT
|
||||
cat scripts/fileio.4th | ./ac.jar -ptx PLASMA-2.1-4TH.po sys/scripts/FILEIO.4TH TXT
|
||||
cat scripts/grlib.4th | ./ac.jar -ptx PLASMA-2.1-4TH.po sys/scripts/GRLIB.4TH TXT
|
||||
cat scripts/hgrlib.4th | ./ac.jar -ptx PLASMA-2.1-4TH.po sys/scripts/HGRLIB.4TH TXT
|
||||
cat scripts/int32.4th | ./ac.jar -ptx PLASMA-2.1-4TH.po sys/scripts/INT32.4TH TXT
|
||||
cat scripts/fpu.4th | ./ac.jar -ptx PLASMA-2.1-4TH.po sys/scripts/FPU.4TH TXT
|
||||
cat scripts/rod.4th | ./ac.jar -ptx PLASMA-2.1-4TH.po bld/scripts/ROD.4TH TXT
|
||||
cat scripts/bounce.4th | ./ac.jar -ptx PLASMA-2.1-4TH.po bld/scripts/BOUNCE.4TH TXT
|
||||
cat scripts/hrbounce.4th | ./ac.jar -ptx PLASMA-2.1-4TH.po bld/scripts/HRBOUNCE.4TH TXT
|
||||
cp ../sysfiles/BLANK140.po PLFORTH.PO
|
||||
./ac.jar -n PLFORTH.PO PLFORTH
|
||||
cat ../sysfiles/PRODOS#FF0000 | ./ac.jar -p PLFORTH.PO PRODOS SYS
|
||||
cat rel/apple/CMD#061000 | ./ac.jar -p PLFORTH.PO CMD BIN $1000
|
||||
cat rel/apple/PLASMA.SYSTEM#FF2000 | ./ac.jar -p PLFORTH.PO PLASMA.SYSTEM SYS
|
||||
cat rel/apple/FILEIO#FE1000 | ./ac.jar -p PLFORTH.PO sys/FILEIO REL
|
||||
cat rel/apple/CONIO#FE1000 | ./ac.jar -p PLFORTH.PO sys/CONIO REL
|
||||
cat rel/ARGS#FE1000 | ./ac.jar -p PLFORTH.PO sys/ARGS REL
|
||||
cat rel/LONGJMP#FE1000 | ./ac.jar -p PLFORTH.PO sys/LONGJMP REL
|
||||
cat rel/HRFORTH#FE1000 | ./ac.jar -p PLFORTH.PO sys/HRFORTH REL
|
||||
cat rel/HR2FORTH#FE1000 | ./ac.jar -p PLFORTH.PO sys/HR2FORTH REL
|
||||
cat rel/TX2FORTH#FE1000 | ./ac.jar -p PLFORTH.PO sys/TX2FORTH REL
|
||||
cat rel/PLFORTH#FE1000 | ./ac.jar -p PLFORTH.PO sys/PLFORTH REL
|
||||
cat rel/apple/COPY#FE1000 | ./ac.jar -p PLFORTH.PO sys/COPY REL
|
||||
cat rel/apple/DEL#FE1000 | ./ac.jar -p PLFORTH.PO sys/DEL REL
|
||||
cat rel/apple/REN#FE1000 | ./ac.jar -p PLFORTH.PO sys/REN REL
|
||||
cat rel/apple/CAT#FE1000 | ./ac.jar -p PLFORTH.PO sys/CAT REL
|
||||
#cat rel/apple/TYPE#FE1000 | ./ac.jar -p PLFORTH.PO sys/TYPE REL
|
||||
#cat rel/apple/NEWDIR#FE1000 | ./ac.jar -p PLFORTH.PO sys/NEWDIR REL
|
||||
cat rel/apple/MATCHFILES#FE1000 | ./ac.jar -p PLFORTH.PO sys/MATCHFILES REL
|
||||
cat rel/INT32#FE1000 | ./ac.jar -p PLFORTH.PO sys/INT32 REL
|
||||
#cat rel/FPSTR#FE1000 | ./ac.jar -p PLFORTH.PO sys/FPSTR REL
|
||||
#cat rel/FPU#FE1000 | ./ac.jar -p PLFORTH.PO sys/FPU REL
|
||||
#cat rel/SANE#FE1000 | ./ac.jar -p PLFORTH.PO sys/SANE REL
|
||||
#cat ../sysfiles/FP6502.CODE#060000 | ./ac.jar -p PLFORTH.PO sys/FP6502.CODE BIN
|
||||
#cat ../sysfiles/ELEMS.CODE#060000 | ./ac.jar -p PLFORTH.PO sys/ELEMS.CODE BIN
|
||||
cat rel/ED#FE1000 | ./ac.jar -p PLFORTH.PO sys/ED REL
|
||||
cat rel/LINES#FE1000 | ./ac.jar -p PLFORTH.PO sys/LINES REL
|
||||
cat rel/apple/HGRFONT#FE1000 | ./ac.jar -p PLFORTH.PO sys/HGRFONT REL
|
||||
cat rel/apple/HGRTILE#FE1000 | ./ac.jar -p PLFORTH.PO sys/HGRTILE REL
|
||||
cat rel/apple/HGRSPRITE#FE1000 | ./ac.jar -p PLFORTH.PO sys/HGRSPRITE REL
|
||||
cat rel/apple/HGRLIB#FE1000 | ./ac.jar -p PLFORTH.PO sys/HGRLIB REL
|
||||
cat rel/apple/GRLIB#FE1000 | ./ac.jar -p PLFORTH.PO sys/GRLIB REL
|
||||
cat rel/apple/DGRLIB#FE1000 | ./ac.jar -p PLFORTH.PO sys/DGRLIB REL
|
||||
cat scripts/plasma.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/PLASMA.4TH TXT
|
||||
cat scripts/machid.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/MACHID.4TH TXT
|
||||
cat scripts/conio.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/CONIO.4TH TXT
|
||||
cat scripts/fileio.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/FILEIO.4TH TXT
|
||||
cat scripts/grlib.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/GRLIB.4TH TXT
|
||||
cat scripts/dgrlib.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/DGRLIB.4TH TXT
|
||||
cat scripts/hgrlib.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/HGRLIB.4TH TXT
|
||||
cat scripts/int32.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/INT32.4TH TXT
|
||||
#cat scripts/fpu.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/FPU.4TH TXT
|
||||
cat scripts/rod.4th | ./ac.jar -ptx PLFORTH.PO scripts/ROD.4TH TXT
|
||||
cat scripts/bounce.4th | ./ac.jar -ptx PLFORTH.PO scripts/BOUNCE.4TH TXT
|
||||
cat scripts/dbounce.4th | ./ac.jar -ptx PLFORTH.PO scripts/DBOUNCE.4TH TXT
|
||||
cat scripts/hrbounce.4th | ./ac.jar -ptx PLFORTH.PO scripts/HRBOUNCE.4TH TXT
|
||||
#cat scripts/hrplot.4th | ./ac.jar -ptx PLFORTH.PO scripts/HRPLOT.4TH TXT
|
||||
echo "+PLFORTH PLASMA.4TH" | ./ac.jar -ptx PLFORTH.PO AUTORUN TXT
|
||||
|
|
13
src/mk800
13
src/mk800
|
@ -57,13 +57,17 @@ cat rel/apple/SOS#FE1000 | ./ac.jar -p PLASMA-2.1.po sys/SOS REL
|
|||
cat rel/apple/GRAFIX#FE1000 | ./ac.jar -p PLASMA-2.1.po sys/GRAFIX REL
|
||||
cat rel/HRFORTH#FE1000 | ./ac.jar -p PLASMA-2.1.po sys/HRFORTH REL
|
||||
cat rel/HR2FORTH#FE1000 | ./ac.jar -p PLASMA-2.1.po sys/HR2FORTH REL
|
||||
cat rel/TX2FORTH#FE1000 | ./ac.jar -p PLASMA-2.1.po sys/TX2FORTH REL
|
||||
cat rel/PLFORTH#FE1000 | ./ac.jar -p PLASMA-2.1.po sys/PLFORTH REL
|
||||
|
||||
#mkdir sys/scripts
|
||||
cat scripts/hdinstall.4th | ./ac.jar -ptx PLASMA-2.1.po HDINSTALL.4TH TXT
|
||||
cat scripts/plasma.4th | ./ac.jar -ptx PLASMA-2.1.po sys/scripts/PLASMA.4TH TXT
|
||||
cat scripts/machid.4th | ./ac.jar -ptx PLASMA-2.1.po sys/scripts/MACHID.4TH TXT
|
||||
cat scripts/conio.4th | ./ac.jar -ptx PLASMA-2.1.po sys/scripts/CONIO.4TH TXT
|
||||
cat scripts/fileio.4th | ./ac.jar -ptx PLASMA-2.1.po sys/scripts/FILEIO.4TH TXT
|
||||
cat scripts/grlib.4th | ./ac.jar -ptx PLASMA-2.1.po sys/scripts/GRLIB.4TH TXT
|
||||
cat scripts/dgrlib.4th | ./ac.jar -ptx PLASMA-2.1.po sys/scripts/DGRLIB.4TH TXT
|
||||
cat scripts/hgrlib.4th | ./ac.jar -ptx PLASMA-2.1.po sys/scripts/HGRLIB.4TH TXT
|
||||
cat scripts/int32.4th | ./ac.jar -ptx PLASMA-2.1.po sys/scripts/INT32.4TH TXT
|
||||
cat scripts/fpu.4th | ./ac.jar -ptx PLASMA-2.1.po sys/scripts/FPU.4TH TXT
|
||||
|
@ -158,7 +162,7 @@ cat scripts/fpu.4th | ./ac.jar -ptx PLASMA-2.1.po sys/scripts/FPU.4TH T
|
|||
#rm -rf demos
|
||||
#mkdir demos
|
||||
cat rel/INT32TEST#FE1000 | ./ac.jar -p PLASMA-2.1.po demos/INT32TEST REL
|
||||
cat rel/apple/CONIOTST#FE1000 | ./ac.jar -p PLASMA-2.1.po demos/CONIOTST REL
|
||||
cat rel/apple/CONIOTEST#FE1000 | ./ac.jar -p PLASMA-2.1.po demos/CONIOTEST REL
|
||||
cat rel/apple/ROD#FE1000 | ./ac.jar -p PLASMA-2.1.po demos/ROD REL
|
||||
cat rel/RPNCALC#FE1000 | ./ac.jar -p PLASMA-2.1.po demos/RPNCALC REL
|
||||
cat rel/LZ4CAT#FE1000 | ./ac.jar -p PLASMA-2.1.po demos/LZ4CAT REL
|
||||
|
@ -212,7 +216,7 @@ cat rel/CODEOPT#FE1000 | ./ac.jar -p PLASMA-2.1.po bld/CODEOPT REL
|
|||
#mkdir bld/samples
|
||||
cat samplesrc/hello.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/HELLO.PLA TXT
|
||||
cat samplesrc/int32test.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/INT32TEST.PLA TXT
|
||||
cat samplesrc/coniotst.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/CONIOTST.PLA TXT
|
||||
cat samplesrc/coniotest.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/CONIOTEST.PLA TXT
|
||||
cat samplesrc/grtest.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/GRTEST.PLA TXT
|
||||
cat samplesrc/dgrtest.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/DGRTEST.PLA TXT
|
||||
cat samplesrc/hgrtest.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/HGRTEST.PLA TXT
|
||||
|
@ -227,7 +231,7 @@ cat samplesrc/testlib.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/TESTLIB.PL
|
|||
cat samplesrc/playseq.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/PLAYSEQ.PLA TXT
|
||||
cat samplesrc/rpncalc.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/RPNCALC.PLA TXT
|
||||
cat samplesrc/fatcat.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/FATCAT.PLA TXT
|
||||
cat samplesrc/gfxdemo.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/GFXDEMO.PLA TXT
|
||||
#cat samplesrc/gfxdemo.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/GFXDEMO.PLA TXT
|
||||
cat samplesrc/lz4cat.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/LZ4CAT.PLA TXT
|
||||
cat samplesrc/sfm.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/SFM.PLA TXT
|
||||
cat samplesrc/sfmsprt.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/SFMSPRT.PLA TXT
|
||||
|
@ -238,7 +242,10 @@ cat utilsrc/apple/zipchip.pla | ./ac.jar -ptx PLASMA-2.1.po bld/samples/ZIPCHIP.
|
|||
#mkdir bld/scripts
|
||||
cat scripts/rod.4th | ./ac.jar -ptx PLASMA-2.1.po bld/scripts/ROD.4TH TXT
|
||||
cat scripts/bounce.4th | ./ac.jar -ptx PLASMA-2.1.po bld/scripts/BOUNCE.4TH TXT
|
||||
cat scripts/dbounce.4th | ./ac.jar -ptx PLASMA-2.1.po bld/scripts/DBOUNCE.4TH TXT
|
||||
cat scripts/hrbounce.4th | ./ac.jar -ptx PLASMA-2.1.po bld/scripts/HRBOUNCE.4TH TXT
|
||||
cat scripts/plot.4th | ./ac.jar -ptx PLASMA-2.1.po bld/scripts/PLOT.4TH TXT
|
||||
cat scripts/hrplot.4th | ./ac.jar -ptx PLASMA-2.1.po bld/scripts/HRPLOT.4TH TXT
|
||||
|
||||
#mkdir bld/examples
|
||||
#cat samplesrc/examples/ex.1.pla bld/examples/EX.1.PLA TXT
|
||||
|
|
58
src/mkbld
58
src/mkbld
|
@ -2,30 +2,6 @@ cp ../sysfiles/BLANK140.po PLASMA-2.1-BLD.po
|
|||
./ac.jar -n PLASMA-2.1-BLD.po PLASMA.BLD
|
||||
cat rel/PLASM#FE1000 | ./ac.jar -p PLASMA-2.1-BLD.po bld/PLASM REL
|
||||
cat rel/CODEOPT#FE1000 | ./ac.jar -p PLASMA-2.1-BLD.po bld/CODEOPT REL
|
||||
cat samplesrc/hello.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/HELLO.PLA TXT
|
||||
cat samplesrc/int32test.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/INT32TEST.PLA TXT
|
||||
cat samplesrc/coniotst.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/CONIOTST.PLA TXT
|
||||
cat samplesrc/grtest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/GRTEST.PLA TXT
|
||||
cat samplesrc/dgrtest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/DGRTEST.PLA TXT
|
||||
cat samplesrc/hgrtest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/HGRTEST.PLA TXT
|
||||
cat samplesrc/tiletest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/TILETEST.PLA TXT
|
||||
cat samplesrc/fibertest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/FIBERTEST.PLA TXT
|
||||
cat samplesrc/mousetest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/MOUSETEST.PLA TXT
|
||||
cat samplesrc/memtest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/MEMTEST.PLA TXT
|
||||
cat samplesrc/rod.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/ROD.PLA TXT
|
||||
#cat samplesrc/sieve.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/SIEVE.PLA TXT
|
||||
#cat samplesrc/test.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/TEST.PLA TXT
|
||||
#cat samplesrc/testlib.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/TESTLIB.PLA TXT
|
||||
cat samplesrc/playseq.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/PLAYSEQ.PLA TXT
|
||||
cat samplesrc/rpncalc.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/RPNCALC.PLA TXT
|
||||
cat samplesrc/fatcat.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/FATCAT.PLA TXT
|
||||
cat samplesrc/gfxdemo.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/GFXDEMO.PLA TXT
|
||||
cat samplesrc/lz4cat.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/LZ4CAT.PLA TXT
|
||||
cat samplesrc/sfm.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/SFM.PLA TXT
|
||||
cat samplesrc/sfmsprt.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/SFMSPRT.PLA TXT
|
||||
cat samplesrc/fppow.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/FPPOW.PLA TXT
|
||||
cat utilsrc/apple/mon.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/MON.PLA TXT
|
||||
cat utilsrc/apple/zipchip.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/ZIPCHIP.PLA TXT
|
||||
cat inc/args.plh | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/inc/ARGS.PLH TXT
|
||||
cat inc/matchfiles.plh | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/inc/MATCHFILES.PLH TXT
|
||||
cat inc/cmdsys.plh | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/inc/CMDSYS.PLH TXT
|
||||
|
@ -53,6 +29,38 @@ cat inc/sdfat.plh | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/inc/SDFAT.PLH T
|
|||
cat inc/sndseq.plh | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/inc/SNDSEQ.PLH TXT
|
||||
cat inc/spiport.plh | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/inc/SPIPORT.PLH TXT
|
||||
cat inc/testlib.plh | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/inc/TESTLIB.PLH TXT
|
||||
cat inc/grafix.plh | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/inc/GRAFIX.PLH TXT
|
||||
#cat inc/grafix.plh | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/inc/GRAFIX.PLH TXT
|
||||
cat inc/lz4.plh | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/inc/LZ4.PLH TXT
|
||||
cat vmsrc/apple/plvmzp.inc | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/inc/PLVMZP.INC TXT
|
||||
|
||||
cat samplesrc/hello.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/HELLO.PLA TXT
|
||||
cat samplesrc/int32test.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/INT32TEST.PLA TXT
|
||||
cat samplesrc/coniotest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/CONIOTEST.PLA TXT
|
||||
cat samplesrc/grtest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/GRTEST.PLA TXT
|
||||
cat samplesrc/dgrtest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/DGRTEST.PLA TXT
|
||||
cat samplesrc/hgrtest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/HGRTEST.PLA TXT
|
||||
cat samplesrc/tiletest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/TILETEST.PLA TXT
|
||||
cat samplesrc/fibertest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/FIBERTEST.PLA TXT
|
||||
cat samplesrc/mousetest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/MOUSETEST.PLA TXT
|
||||
cat samplesrc/memtest.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/MEMTEST.PLA TXT
|
||||
cat samplesrc/rod.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/ROD.PLA TXT
|
||||
#cat samplesrc/sieve.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/SIEVE.PLA TXT
|
||||
#cat samplesrc/test.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/TEST.PLA TXT
|
||||
#cat samplesrc/testlib.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/TESTLIB.PLA TXT
|
||||
cat samplesrc/playseq.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/PLAYSEQ.PLA TXT
|
||||
cat samplesrc/rpncalc.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/RPNCALC.PLA TXT
|
||||
#cat samplesrc/fatcat.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/FATCAT.PLA TXT
|
||||
#cat samplesrc/gfxdemo.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/GFXDEMO.PLA TXT
|
||||
cat samplesrc/lz4cat.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/LZ4CAT.PLA TXT
|
||||
cat samplesrc/sfm.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/SFM.PLA TXT
|
||||
cat samplesrc/sfmsprt.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/SFMSPRT.PLA TXT
|
||||
#cat samplesrc/fppow.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/FPPOW.PLA TXT
|
||||
cat utilsrc/apple/mon.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/MON.PLA TXT
|
||||
#cat utilsrc/apple/zipchip.pla | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/samples/ZIPCHIP.PLA TXT
|
||||
|
||||
cat scripts/rod.4th | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/scripts/ROD.4TH TXT
|
||||
cat scripts/bounce.4th | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/scripts/BOUNCE.4TH TXT
|
||||
cat scripts/dbounce.4th | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/scripts/DBOUNCE.4TH TXT
|
||||
cat scripts/hrbounce.4th | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/scripts/HRBOUNCE.4TH TXT
|
||||
cat scripts/plot.4th | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/scripts/PLOT.4TH TXT
|
||||
cat scripts/hrplot.4th | ./ac.jar -ptx PLASMA-2.1-BLD.po bld/scripts/HRPLOT.4TH TXT
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
cp ../sysfiles/BLANK140.po PLASMA-2.1-DEMOS.po
|
||||
./ac.jar -n PLASMA-2.1-INET.po PLASMA.DEMOS
|
||||
./ac.jar -n PLASMA-2.1-DEMOS.po PLASMA.DEMOS
|
||||
cat rel/INT32TEST#FE1000 | ./ac.jar -p PLASMA-2.1-DEMOS.po demos/INT32TEST REL
|
||||
cat rel/apple/CONIOTST#FE1000 | ./ac.jar -p PLASMA-2.1-DEMOS.po demos/CONIOTST REL
|
||||
cat rel/apple/CONIOTEST#FE1000 | ./ac.jar -p PLASMA-2.1-DEMOS.po demos/CONIOTEST REL
|
||||
cat rel/apple/ROD#FE1000 | ./ac.jar -p PLASMA-2.1-DEMOS.po demos/ROD REL
|
||||
cat rel/RPNCALC#FE1000 | ./ac.jar -p PLASMA-2.1-DEMOS.po demos/RPNCALC REL
|
||||
cat rel/LZ4CAT#FE1000 | ./ac.jar -p PLASMA-2.1-DEMOS.po demos/LZ4CAT REL
|
||||
|
@ -30,5 +30,3 @@ cat rel/apple/FATGET#FE1000 | ./ac.jar -p PLASMA-2.1-DEMOS.po demos/apple
|
|||
cat rel/apple/FATPUT#FE1000 | ./ac.jar -p PLASMA-2.1-DEMOS.po demos/apple2/sdutils/FATPUT REL
|
||||
cat rel/apple/FATREADDSK#FE1000 | ./ac.jar -p PLASMA-2.1-DEMOS.po demos/apple2/sdutils/FATREADDSK REL
|
||||
cat rel/apple/FATWRITEDSK#FE1000 | ./ac.jar -p PLASMA-2.1-DEMOS.po demos/apple2/sdutils/FATWRITEDSK REL
|
||||
cat rel/apple/GFXDEMO#FE1000 | ./ac.jar -p PLASMA-2.1-DEMOS.po demos/apple3/GFXDEMO REL
|
||||
cat samplesrc/APPLE3.PIX#060000 | ./ac.jar -p PLASMA-2.1-DEMOS.po demos/apple3/APPLE3.PIX BIN
|
||||
|
|
|
@ -13,3 +13,9 @@ cat rel/FPU#FE1000 | ./ac.jar -p PLASMA-2.1-FPSOS.po sys/FPU R
|
|||
cat rel/SANE#FE1000 | ./ac.jar -p PLASMA-2.1-FPSOS.po sys/SANE REL
|
||||
cat ../sysfiles/FP6502.CODE#060000 | ./ac.jar -p PLASMA-2.1-FPSOS.po sys/FP6502.CODE BIN
|
||||
cat ../sysfiles/ELEMS.CODE#060000 | ./ac.jar -p PLASMA-2.1-FPSOS.po sys/ELEMS.CODE BIN
|
||||
cat inc/grafix.plh | ./ac.jar -ptx PLASMA-2.1-FPSOS.po bld/inc/GRAFIX.PLH TXT
|
||||
cat samplesrc/gfxdemo.pla | ./ac.jar -ptx PLASMA-2.1-FPSOS.po bld/samples/GFXDEMO.PLA TXT
|
||||
cat scripts/grafix.4th | ./ac.jar -ptx PLASMA-2.1-FPSOS.po sys/scripts/GRAFIX.4TH TXT
|
||||
cat scripts/gfxplot.4th | ./ac.jar -ptx PLASMA-2.1-FPSOS.po bld/scripts/GFXPLOT.4TH TXT
|
||||
cat rel/apple/GFXDEMO#FE1000 | ./ac.jar -p PLASMA-2.1-FPSOS.po demos/apple3/GFXDEMO REL
|
||||
cat samplesrc/APPLE3.PIX#060000 | ./ac.jar -p PLASMA-2.1-FPSOS.po demos/apple3/APPLE3.PIX BIN
|
||||
|
|
38
src/mkinst
Executable file
38
src/mkinst
Executable file
|
@ -0,0 +1,38 @@
|
|||
cp ../sysfiles/BLANK140.po PLASMA-2.1-INST.po
|
||||
./ac.jar -n PLASMA-2.1-INST.po PLASMA.INST
|
||||
cat ../sysfiles/PRODOS#FF0000 | ./ac.jar -p PLASMA-2.1-INST.po PRODOS SYS
|
||||
cat rel/apple/CMD#061000 | ./ac.jar -p PLASMA-2.1-INST.po CMD BIN $1000
|
||||
cat rel/apple/CMD128#061000 | ./ac.jar -p PLASMA-2.1-INST.po CMD128 BIN $1000
|
||||
cat rel/apple/PLASMA.SYSTEM#FF2000 | ./ac.jar -p PLASMA-2.1-INST.po PLASMA.SYSTEM SYS
|
||||
cat rel/apple/PLVM.128#FF2000 | ./ac.jar -p PLASMA-2.1-INST.po PLVM.128 SYS
|
||||
cat rel/apple/PLVM16#FF2000 | ./ac.jar -p PLASMA-2.1-INST.po PLVM16 SYS
|
||||
cat rel/apple/JIT#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/JIT REL
|
||||
cat rel/apple/JIT16#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/JIT16 REL
|
||||
cat rel/apple/FILEIO#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/FILEIO REL
|
||||
cat rel/apple/CONIO#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/CONIO REL
|
||||
cat rel/apple/COPY#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/COPY REL
|
||||
cat rel/apple/DEL#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/DEL REL
|
||||
cat rel/apple/REN#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/REN REL
|
||||
cat rel/apple/CAT#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/CAT REL
|
||||
cat rel/apple/TYPE#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/TYPE REL
|
||||
cat rel/apple/NEWDIR#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/NEWDIR REL
|
||||
cat rel/apple/MATCHFILES#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/MATCHFILES REL
|
||||
cat rel/ARGS#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/ARGS REL
|
||||
cat rel/LONGJMP#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/LONGJMP REL
|
||||
cat rel/INT32#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/INT32 REL
|
||||
cat rel/HRFORTH#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/HRFORTH REL
|
||||
cat rel/HR2FORTH#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/HR2FORTH REL
|
||||
cat rel/TX2FORTH#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/TX2FORTH REL
|
||||
cat rel/PLFORTH#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/PLFORTH REL
|
||||
cat scripts/plasma.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/PLASMA.4TH TXT
|
||||
cat scripts/machid.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/MACHID.4TH TXT
|
||||
cat scripts/conio.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/CONIO.4TH TXT
|
||||
cat scripts/fileio.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/FILEIO.4TH TXT
|
||||
cat scripts/grlib.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/GRLIB.4TH TXT
|
||||
cat scripts/dgrlib.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/DGRLIB.4TH TXT
|
||||
cat scripts/hgrlib.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/HGRLIB.4TH TXT
|
||||
cat scripts/int32.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/INT32.4TH TXT
|
||||
cat scripts/fpu.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/FPU.4TH TXT
|
||||
cat scripts/hdinstall1.4th | ./ac.jar -ptx PLASMA-2.1-INST.po HDINSTALL.4TH TXT
|
||||
cat scripts/hdinstall2.4th | ./ac.jar -ptx PLASMA-2.1-INST.po HDINSTALL2.4TH TXT
|
||||
echo "+PLFORTH HDINSTALL.4TH" | ./ac.jar -ptx PLASMA-2.1-INST.po AUTORUN TXT
|
115
src/mkrel
115
src/mkrel
|
@ -57,108 +57,25 @@ cp rel/apple/SOS#FE1000 prodos/sys/SOS.REL
|
|||
cp rel/apple/GRAFIX#FE1000 prodos/sys/GRAFIX.REL
|
||||
cp rel/HRFORTH#FE1000 prodos/sys/HRFORTH.REL
|
||||
cp rel/HR2FORTH#FE1000 prodos/sys/HR2FORTH.REL
|
||||
cp rel/TX2FORTH#FE1000 prodos/sys/TX2FORTH.REL
|
||||
cp rel/PLFORTH#FE1000 prodos/sys/PLFORTH.REL
|
||||
|
||||
mkdir prodos/sys/scripts
|
||||
cp scripts/plasma.4th prodos/sys/scripts/PLASMA.4TH.TXT
|
||||
cp scripts/machid.4th prodos/sys/scripts/MACHID.4TH.TXT
|
||||
cp scripts/conio.4th prodos/sys/scripts/CONIO.4TH.TXT
|
||||
cp scripts/fileio.4th prodos/sys/scripts/FILEIO.4TH.TXT
|
||||
cp scripts/grlib.4th prodos/sys/scripts/GRLIB.4TH.TXT
|
||||
cp scripts/dgrlib.4th prodos/sys/scripts/DGRLIB.4TH.TXT
|
||||
cp scripts/hgrlib.4th prodos/sys/scripts/HGRLIB.4TH.TXT
|
||||
cp scripts/grafix.4th prodos/sys/scripts/GRAFIX.4TH.TXT
|
||||
cp scripts/int32.4th prodos/sys/scripts/INT32.4TH.TXT
|
||||
cp scripts/fpu.4th prodos/sys/scripts/FPU.4TH.TXT
|
||||
|
||||
rm -rf prodos/syspro
|
||||
mkdir prodos/syspro
|
||||
cp ../sysfiles/PRODOS#FF0000 prodos/syspro/PRODOS.SYS
|
||||
cp rel/apple/CMD#061000 prodos/syspro/CMD.BIN
|
||||
cp rel/apple/CMD128#061000 prodos/syspro/CMD128.BIN
|
||||
cp rel/apple/PLASMA.SYSTEM#FF2000 prodos/syspro/PLASMA.SYSTEM.SYS
|
||||
cp rel/apple/PLVM.128#FF2000 prodos/syspro/PLVM.128.SYS
|
||||
cp rel/apple/PLVM16#FF2000 prodos/syspro/PLVM16.SYS
|
||||
cp ../doc/Editor.md prodos/syspro/EDITOR.README.TXT
|
||||
|
||||
mkdir prodos/syspro/sys
|
||||
cp rel/apple/FILEIO#FE1000 prodos/syspro/sys/FILEIO.REL
|
||||
cp rel/apple/CONIO#FE1000 prodos/syspro/sys/CONIO.REL
|
||||
cp rel/LINES#FE1000 prodos/syspro/sys/LINES.REL
|
||||
cp rel/apple/HGRFONT#FE1000 prodos/syspro/sys/HGRFONT.REL
|
||||
cp rel/apple/HGRTILE#FE1000 prodos/syspro/sys/HGRTILE.REL
|
||||
cp rel/apple/HGRSPRITE#FE1000 prodos/syspro/sys/HGRSPRITE.REL
|
||||
cp rel/apple/HGRLIB#FE1000 prodos/syspro/sys/HGRLIB.REL
|
||||
cp rel/apple/GRLIB#FE1000 prodos/syspro/sys/GRLIB.REL
|
||||
cp rel/apple/DGRLIB#FE1000 prodos/syspro/sys/DGRLIB.REL
|
||||
cp rel/apple/COPY#FE1000 prodos/syspro/sys/COPY.REL
|
||||
cp rel/apple/DEL#FE1000 prodos/syspro/sys/DEL.REL
|
||||
cp rel/apple/REN#FE1000 prodos/syspro/sys/REN.REL
|
||||
cp rel/apple/CAT#FE1000 prodos/syspro/sys/CAT.REL
|
||||
cp rel/apple/NEWDIR#FE1000 prodos/syspro/sys/NEWDIR.REL
|
||||
cp rel/apple/TYPE#FE1000 prodos/syspro/sys/TYPE.REL
|
||||
cp rel/apple/MATCHFILES#FE1000 prodos/syspro/sys/MATCHFILES.REL
|
||||
cp rel/ARGS#FE1000 prodos/syspro/sys/ARGS.REL
|
||||
cp rel/ED#FE1000 prodos/syspro/sys/ED.REL
|
||||
cp rel/FIBER#FE1000 prodos/syspro/sys/FIBER.REL
|
||||
cp rel/LONGJMP#FE1000 prodos/syspro/sys/LONGJMP.REL
|
||||
cp rel/MEMMGR#FE1000 prodos/syspro/sys/MEMMGR.REL
|
||||
cp rel/apple/MOUSE#FE1000 prodos/syspro/sys/MOUSE.REL
|
||||
cp rel/apple/PORTIO#FE1000 prodos/syspro/sys/PORTIO.REL
|
||||
cp rel/apple/JOYBUZZ#FE1000 prodos/syspro/sys/JOYBUZZ.REL
|
||||
cp rel/apple/SNDSEQ#FE1000 prodos/syspro/sys/SNDSEQ.REL
|
||||
cp rel/apple/JIT#FE1000 prodos/syspro/sys/JIT.REL
|
||||
cp rel/apple/JIT16#FE1000 prodos/syspro/sys/JIT16.REL
|
||||
cp rel/apple/JITUNE#FE1000 prodos/syspro/sys/JITUNE.REL
|
||||
cp rel/apple/ZIPCHIP#FE1000 prodos/syspro/sys/ZIPCHIP.REL
|
||||
cp rel/LZ4#FE1000 prodos/syspro/sys/LZ4.REL
|
||||
cp rel/INT32#FE1000 prodos/syspro/sys/INT32.REL
|
||||
|
||||
rm -rf prodos/sysforth
|
||||
mkdir prodos/sysforth
|
||||
mkdir prodos/sysforth/sys
|
||||
cp rel/HRFORTH#FE1000 prodos/sysforth/sys/HRFORTH.REL
|
||||
cp rel/HR2FORTH#FE1000 prodos/sysforth/sys/HR2FORTH.REL
|
||||
cp rel/PLFORTH#FE1000 prodos/sysforth/sys/PLFORTH.REL
|
||||
|
||||
mkdir prodos/sysforth/sys/scripts
|
||||
cp scripts/plasma.4th prodos/sysforth/sys/scripts/PLASMA.4TH.TXT
|
||||
cp scripts/conio.4th prodos/sysforth/sys/scripts/CONIO.4TH.TXT
|
||||
cp scripts/fileio.4th prodos/sysforth/sys/scripts/FILEIO.4TH.TXT
|
||||
cp scripts/grlib.4th prodos/sysforth/sys/scripts/GRLIB.4TH.TXT
|
||||
cp scripts/hgrlib.4th prodos/sysforth/sys/scripts/HGRLIB.4TH.TXT
|
||||
cp scripts/int32.4th prodos/sysforth/sys/scripts/INT32.4TH.TXT
|
||||
cp scripts/fpu.4th prodos/sysforth/sys/scripts/FPU.4TH.TXT
|
||||
|
||||
rm -rf prodos/sysinet
|
||||
mkdir prodos/sysinet
|
||||
mkdir prodos/sysinet/sys
|
||||
cp rel/INET#FE1000 prodos/sysinet/sys/INET.REL
|
||||
cp rel/DHCP#FE1000 prodos/sysinet/sys/DHCP.REL
|
||||
cp rel/ETHERIP#FE1000 prodos/sysinet/sys/ETHERIP.REL
|
||||
cp rel/apple/UTHERNET2#FE1000 prodos/sysinet/sys/UTHERNET2.REL
|
||||
cp rel/apple/UTHERNET#FE1000 prodos/sysinet/sys/UTHERNET.REL
|
||||
cp rel/TFTPD#FE1000 prodos/sysinet/sys/TFTPD.REL
|
||||
|
||||
rm -rf prodos/fpsos
|
||||
mkdir prodos/fpsos
|
||||
cp ../sysfiles/SOS.KERNEL#0C0000 prodos/fpsos/SOS.KERNEL.\$0C
|
||||
cp ../sysfiles/SOS.DRIVER#0C0000 prodos/fpsos/SOS.DRIVER.\$0C
|
||||
cp rel/apple/SOS.INTERP#050000 prodos/fpsos/SOS.INTERP.\$05
|
||||
cp rel/apple/SOS.CMD#FE1000 prodos/fpsos/SOS.CMD.REL
|
||||
cp rel/apple/SOS.INTERPJIT#050000 prodos/fpsos/SOS.INTERPJIT.\$05
|
||||
cp rel/apple/SOS.CMDJIT#FE1000 prodos/fpsos/SOS.CMDJIT.REL
|
||||
|
||||
mkdir prodos/fpsos/sys
|
||||
cp rel/apple/SOS#FE1000 prodos/fpsos/sys/SOS.REL
|
||||
cp rel/apple/GRAFIX#FE1000 prodos/fpsos/sys/GRAFIX.REL
|
||||
cp rel/FPSTR#FE1000 prodos/fpsos/sys/FPSTR.REL
|
||||
cp rel/FPU#FE1000 prodos/fpsos/sys/FPU.REL
|
||||
cp rel/SANE#FE1000 prodos/fpsos/sys/SANE.REL
|
||||
cp ../sysfiles/FP6502.CODE#060000 prodos/fpsos/sys/FP6502.CODE.BIN
|
||||
cp ../sysfiles/ELEMS.CODE#060000 prodos/fpsos/sys/ELEMS.CODE.BIN
|
||||
|
||||
rm -rf prodos/demos
|
||||
mkdir prodos/demos
|
||||
cp rel/INT32TEST#FE1000 prodos/demos/INT32TEST.REL
|
||||
cp rel/apple/CONIOTST#FE1000 prodos/demos/CONIOTST.REL
|
||||
cp rel/apple/CONIOTEST#FE1000 prodos/demos/CONIOTEST.REL
|
||||
cp rel/apple/ROD#FE1000 prodos/demos/ROD.REL
|
||||
cp rel/RPNCALC#FE1000 prodos/demos/RPNCALC.REL
|
||||
cp rel/LZ4CAT#FE1000 prodos/demos/LZ4CAT.REL
|
||||
|
@ -208,11 +125,15 @@ rm -rf prodos/bld
|
|||
mkdir prodos/bld
|
||||
cp rel/PLASM#FE1000 prodos/bld/PLASM.REL
|
||||
cp rel/CODEOPT#FE1000 prodos/bld/CODEOPT.REL
|
||||
cp ../sysfiles/EDASM#FF2000 prodos/bld/EDASM.SYS
|
||||
cp ../sysfiles/EDASM.ASM#063000 prodos/bld/EDASM.ASM.BIN
|
||||
cp ../sysfiles/EDASM.ED#063000 prodos/bld/EDASM.ED.BIN
|
||||
cp ../sysfiles/EDASM.SWAP#062000 prodos/bld/EDASM.SWAP.BIN
|
||||
|
||||
mkdir prodos/bld/samples
|
||||
cp samplesrc/hello.pla prodos/bld/samples/HELLO.PLA.TXT
|
||||
cp samplesrc/int32test.pla prodos/bld/samples/INT32TEST.PLA.TXT
|
||||
cp samplesrc/coniotst.pla prodos/bld/samples/CONIOTST.PLA.TXT
|
||||
cp samplesrc/coniotest.pla prodos/bld/samples/CONIOTEST.PLA.TXT
|
||||
cp samplesrc/grtest.pla prodos/bld/samples/GRTEST.PLA.TXT
|
||||
cp samplesrc/dgrtest.pla prodos/bld/samples/DGRTEST.PLA.TXT
|
||||
cp samplesrc/hgrtest.pla prodos/bld/samples/HGRTEST.PLA.TXT
|
||||
|
@ -235,10 +156,22 @@ cp samplesrc/fppow.pla prodos/bld/samples/FPPOW.PLA.TXT
|
|||
cp utilsrc/apple/mon.pla prodos/bld/samples/MON.PLA.TXT
|
||||
cp utilsrc/apple/zipchip.pla prodos/bld/samples/ZIPCHIP.PLA.TXT
|
||||
|
||||
cp libsrc/apple/dhgrlib.pla prodos/bld/samples/DHGR.PLA.TXT
|
||||
cp samplesrc/testrel.asm prodos/bld/samples/TESTREL.ASM.TXT
|
||||
cp samplesrc/testext.asm prodos/bld/samples/TESTEXT.ASM.TXT
|
||||
cp samplesrc/testasm.pla prodos/bld/samples/TESTASM.PLA.TXT
|
||||
|
||||
mkdir prodos/bld/scripts
|
||||
cp scripts/rod.4th prodos/bld/scripts/ROD.4TH.TXT
|
||||
cp scripts/bounce.4th prodos/bld/scripts/BOUNCE.4TH.TXT
|
||||
cp scripts/dbounce.4th prodos/bld/scripts/DBOUNCE.4TH.TXT
|
||||
cp scripts/hrbounce.4th prodos/bld/scripts/HRBOUNCE.4TH.TXT
|
||||
cp scripts/plot.4th prodos/bld/scripts/PLOT.4TH.TXT
|
||||
cp scripts/hrplot.4th prodos/bld/scripts/HRPLOT.4TH.TXT
|
||||
cp scripts/gfxplot.4th prodos/bld/scripts/GFXPLOT.4TH.TXT
|
||||
cp scripts/hdinstall.4th prodos/bld/scripts/HDINSTALL.4TH.TXT
|
||||
cp scripts/hdinstall1.4th prodos/bld/scripts/HDINSTALL1.4TH.TXT
|
||||
cp scripts/hdinstall2.4th prodos/bld/scripts/HDINSTALL2.4TH.TXT
|
||||
|
||||
#mkdir prodos/bld/examples
|
||||
#cp samplesrc/examples/ex.1.pla prodos/bld/examples/EX.1.PLA.TXT
|
||||
|
@ -289,4 +222,6 @@ cp inc/spiport.plh prodos/bld/inc/SPIPORT.PLH.TXT
|
|||
cp inc/testlib.plh prodos/bld/inc/TESTLIB.PLH.TXT
|
||||
cp inc/grafix.plh prodos/bld/inc/GRAFIX.PLH.TXT
|
||||
cp inc/lz4.plh prodos/bld/inc/LZ4.PLH.TXT
|
||||
cp vmsrc/apple/plvmzp.inc prodos/bld/inc/PLVMZP.INC.TXT
|
||||
cp inc/plasma.inc prodos/bld/inc/PLASMA.INC.TXT
|
||||
cp inc/extheader.inc prodos/bld/inc/EXTHEADER.INC.TXT
|
||||
cp inc/extdefseg.inc prodos/bld/inc/EXTDEFSEG.INC.TXT
|
||||
|
|
38
src/mksys
38
src/mksys
|
@ -1,14 +1,14 @@
|
|||
cp ../sysfiles/BLANK140.po PLASMA-2.1-SYS.po
|
||||
./ac.jar -n PLASMA-2.1-SYS.po PLASMA.SYS
|
||||
#cat ../sysfiles/PRODOS#FF0000 | ./ac.jar -p PLASMA-2.1-SYS.po PRODOS SYS
|
||||
cat rel/apple/CMD#061000 | ./ac.jar -p PLASMA-2.1-SYS.po CMD BIN $1000
|
||||
cat rel/apple/CMD128#061000 | ./ac.jar -p PLASMA-2.1-SYS.po CMD128 BIN $1000
|
||||
cat rel/apple/PLASMA.SYSTEM#FF2000 | ./ac.jar -p PLASMA-2.1-SYS.po PLASMA.SYSTEM SYS
|
||||
cat rel/apple/PLVM.128#FF2000 | ./ac.jar -p PLASMA-2.1-SYS.po PLVM.128 SYS
|
||||
cat rel/apple/PLVM16#FF2000 | ./ac.jar -p PLASMA-2.1-SYS.po PLVM16 SYS
|
||||
#cat rel/apple/CMD#061000 | ./ac.jar -p PLASMA-2.1-SYS.po CMD BIN $1000
|
||||
#cat rel/apple/CMD128#061000 | ./ac.jar -p PLASMA-2.1-SYS.po CMD128 BIN $1000
|
||||
#cat rel/apple/PLASMA.SYSTEM#FF2000 | ./ac.jar -p PLASMA-2.1-SYS.po PLASMA.SYSTEM SYS
|
||||
#cat rel/apple/PLVM.128#FF2000 | ./ac.jar -p PLASMA-2.1-SYS.po PLVM.128 SYS
|
||||
#cat rel/apple/PLVM16#FF2000 | ./ac.jar -p PLASMA-2.1-SYS.po PLVM16 SYS
|
||||
cat ../doc/Editor.md | ./ac.jar -ptx PLASMA-2.1-SYS.po EDITOR.README TXT
|
||||
cat rel/apple/FILEIO#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/FILEIO REL
|
||||
cat rel/apple/CONIO#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/CONIO REL
|
||||
#cat rel/apple/FILEIO#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/FILEIO REL
|
||||
#cat rel/apple/CONIO#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/CONIO REL
|
||||
cat rel/LINES#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/LINES REL
|
||||
cat rel/apple/HGRFONT#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/HGRFONT REL
|
||||
cat rel/apple/HGRTILE#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/HGRTILE REL
|
||||
|
@ -16,25 +16,25 @@ cat rel/apple/HGRSPRITE#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/HGRSPRI
|
|||
cat rel/apple/HGRLIB#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/HGRLIB REL
|
||||
cat rel/apple/GRLIB#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/GRLIB REL
|
||||
cat rel/apple/DGRLIB#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/DGRLIB REL
|
||||
cat rel/apple/COPY#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/COPY REL
|
||||
cat rel/apple/DEL#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/DEL REL
|
||||
cat rel/apple/REN#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/REN REL
|
||||
cat rel/apple/CAT#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/CAT REL
|
||||
cat rel/apple/NEWDIR#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/NEWDIR REL
|
||||
cat rel/apple/TYPE#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/TYPE REL
|
||||
cat rel/apple/MATCHFILES#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/MATCHFILES REL
|
||||
cat rel/ARGS#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/ARGS REL
|
||||
#cat rel/apple/COPY#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/COPY REL
|
||||
#cat rel/apple/DEL#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/DEL REL
|
||||
#cat rel/apple/REN#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/REN REL
|
||||
#cat rel/apple/CAT#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/CAT REL
|
||||
#cat rel/apple/NEWDIR#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/NEWDIR REL
|
||||
#cat rel/apple/TYPE#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/TYPE REL
|
||||
#cat rel/apple/MATCHFILES#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/MATCHFILES REL
|
||||
#cat rel/ARGS#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/ARGS REL
|
||||
cat rel/ED#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/ED REL
|
||||
cat rel/FIBER#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/FIBER REL
|
||||
cat rel/LONGJMP#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/LONGJMP REL
|
||||
#cat rel/LONGJMP#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/LONGJMP REL
|
||||
cat rel/MEMMGR#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/MEMMGR REL
|
||||
cat rel/apple/MOUSE#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/MOUSE REL
|
||||
cat rel/apple/PORTIO#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/PORTIO REL
|
||||
cat rel/apple/JOYBUZZ#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/JOYBUZZ REL
|
||||
cat rel/apple/SNDSEQ#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/SNDSEQ REL
|
||||
cat rel/apple/JIT#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/JIT REL
|
||||
cat rel/apple/JIT16#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/JIT16 REL
|
||||
#cat rel/apple/JIT#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/JIT REL
|
||||
#cat rel/apple/JIT16#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/JIT16 REL
|
||||
cat rel/apple/JITUNE#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/JITUNE REL
|
||||
cat rel/apple/ZIPCHIP#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/ZIPCHIP REL
|
||||
cat rel/LZ4#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/LZ4 REL
|
||||
cat rel/INT32#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/INT32 REL
|
||||
#cat rel/INT32#FE1000 | ./ac.jar -p PLASMA-2.1-SYS.po sys/INT32 REL
|
||||
|
|
|
@ -24,8 +24,8 @@ def dgrTest#0
|
|||
byte b, l, k
|
||||
word i, j, ii, ij
|
||||
|
||||
b = dgrMode(TRUE)
|
||||
dgrDrawBuf(0)
|
||||
b = dgrMode(dgrPage1)
|
||||
dgrDrawBuf(dgrPage1)
|
||||
for k = 15 downto 0
|
||||
dgrClear(k)
|
||||
next
|
||||
|
@ -43,7 +43,7 @@ def dgrTest#0
|
|||
i = 40
|
||||
j = 10
|
||||
^$C010
|
||||
dgrDrawBuf(1)
|
||||
dgrDrawBuf(dgrPage2)
|
||||
while ^$C000 < 128
|
||||
dgrFill(k, k, @tile1)
|
||||
dgrBLT(i, j, 8, 8, @sprite1)
|
||||
|
@ -59,7 +59,7 @@ def dgrTest#0
|
|||
fin
|
||||
loop
|
||||
^$C010
|
||||
dgrMode(FALSE)
|
||||
dgrMode(dgrOff)
|
||||
end
|
||||
|
||||
dgrTest
|
||||
|
|
|
@ -24,8 +24,8 @@ def grTest#0
|
|||
byte b, l, k
|
||||
word i, j, ii, ij
|
||||
|
||||
b = grMode(TRUE)
|
||||
grDrawBuf(0)
|
||||
b = grMode(grPage1)
|
||||
grDrawBuf(grPage1)
|
||||
for k = 15 downto 0
|
||||
grClear(k)
|
||||
next
|
||||
|
@ -43,7 +43,7 @@ def grTest#0
|
|||
i = 20
|
||||
j = 10
|
||||
^$C010
|
||||
grDrawBuf(1)
|
||||
grDrawBuf(grPage2)
|
||||
while ^$C000 < 128
|
||||
grFill(k, k, @tile1)
|
||||
grBLT(i, j, 8, 8, @sprite1)
|
||||
|
@ -59,7 +59,7 @@ def grTest#0
|
|||
fin
|
||||
loop
|
||||
^$C010
|
||||
grMode(FALSE)
|
||||
grMode(grOff)
|
||||
end
|
||||
|
||||
grTest
|
||||
|
|
|
@ -65,16 +65,16 @@ def testblt(sprtnum)#0
|
|||
loop
|
||||
end
|
||||
|
||||
hgrMode(TRUE)
|
||||
spriteDrawBuf(hgrDrawBuf(0)) // So we can see the compile process
|
||||
hgrMode(hgrPage1)
|
||||
spriteDrawBuf(hgrDrawBuf(hgrPage1)) // So we can see the compile process
|
||||
sprtBall = spriteCompile(10, 10, 5, 5, @ball)
|
||||
hgrColor(0)
|
||||
hgrClear()
|
||||
testline
|
||||
memcpy($4000, $2000, $2000) // Copy to both buffers
|
||||
spriteDrawBuf(hgrDrawBuf(1))
|
||||
spriteDrawBuf(hgrDrawBuf(hgrPage2))
|
||||
spriteAdd(0, sprtBall)
|
||||
testblt(16)
|
||||
getc
|
||||
hgrMode(FALSE)
|
||||
hgrMode(hgrOff)
|
||||
done
|
||||
|
|
|
@ -24,7 +24,7 @@ def rod#0
|
|||
conio:grplot(i, fmk)
|
||||
conio:grplot(fmk, i)
|
||||
if conio:keypressed()
|
||||
getc
|
||||
conio:getkey()
|
||||
return
|
||||
fin
|
||||
next
|
||||
|
|
|
@ -575,8 +575,8 @@ next
|
|||
heapstart = heapmark()
|
||||
//puts("\nBeginning available memory: "); puti(heapavail()); putln
|
||||
repeat
|
||||
hgrMode(TRUE)
|
||||
spriteDrawBuf(hgrDrawBuf(0)) // Single buffered
|
||||
hgrMode(hgrPage1)
|
||||
spriteDrawBuf(hgrDrawBuf(hgrPage1)) // Single buffered
|
||||
spriteAdd(SHIP_SPRTNUM, sprtShip)
|
||||
spriteAdd(SPIDER_SPRTEBASE, sprtEgg3)
|
||||
//
|
||||
|
@ -617,7 +617,8 @@ repeat
|
|||
puts("\nEarth has been overrun")
|
||||
puts("\nby the Spiders from Mars\n")
|
||||
fin
|
||||
hgrMode(FALSE)
|
||||
hgrMode(hgrOFF)
|
||||
//hgrDrawBuf(hgrPage1)
|
||||
//
|
||||
// Clear sprite lists
|
||||
//
|
||||
|
|
|
@ -169,8 +169,8 @@ var sprtSplat1, sprtSplat2
|
|||
var sprtWeb1, sprtWeb2, sprtWeb3
|
||||
var sprtShip, sprtMissle, sprtDummy
|
||||
|
||||
hgrMode(TRUE)
|
||||
spriteDrawBuf(hgrDrawBuf(0)) // So we can see the compile process
|
||||
hgrMode(hgrPage1)
|
||||
spriteDrawBuf(hgrDrawBuf(hgrPage1)) // So we can see the compile process
|
||||
sprtShip = spriteCompile(14, 14, 7, 13, @ship)
|
||||
sprtMissle = spriteCompile( 6, 8, 3, 0, @missle)
|
||||
sprtEgg3 = spriteCompile(14, 12, 7, 6, @egg3)
|
||||
|
@ -185,7 +185,7 @@ sprtWeb3 = spriteCompile(20, 8, 10, 0, @web3)
|
|||
sprtSplat1 = spriteCompile(20, 13, 10, 6, @splat1)
|
||||
sprtSplat2 = spriteCompile(24, 17, 12, 8, @splat2)
|
||||
sprtDummy = spriteCompile( 7, 8, 0, 0, @dummy)
|
||||
hgrMode(FALSE)
|
||||
hgrMode(hgrOff)
|
||||
spriteSave("SHIP", sprtShip)
|
||||
spriteSave("MISSLE", sprtMissle)
|
||||
spriteSave("EGG3", sprtEgg3)
|
||||
|
|
7
src/samplesrc/testasm.pla
Normal file
7
src/samplesrc/testasm.pla
Normal file
|
@ -0,0 +1,7 @@
|
|||
import test
|
||||
predef hello#0
|
||||
predef goodbye#0
|
||||
end
|
||||
|
||||
goodbye
|
||||
done
|
61
src/samplesrc/testext.asm
Normal file
61
src/samplesrc/testext.asm
Normal file
|
@ -0,0 +1,61 @@
|
|||
;
|
||||
; EXTENDED REL MODULE WITH DEPENDENCIES, BYTECODE SEGMENT, AND INIT
|
||||
;
|
||||
INCLUDE INC/PLASMA.INC
|
||||
;
|
||||
; EXT REL HEADER
|
||||
;
|
||||
RESFLAGS EQU 0
|
||||
INCLUDE INC/EXTHEADER.INC
|
||||
;
|
||||
; ADD MODULE DEPENDENCIES
|
||||
; (DCI BACKWARDS HI/LO BIT FROM REL FILE)
|
||||
;
|
||||
MSB ON
|
||||
ASC "CMDSY"
|
||||
MSB OFF
|
||||
ASC "S"
|
||||
;
|
||||
; EXTERNALS USED FROM CMDSYS
|
||||
;
|
||||
EXTRN PUTS
|
||||
EXTRN PUTLN
|
||||
;
|
||||
; TERMINATE DEPENDENCY LIST WITH ZERO
|
||||
;
|
||||
DB 0
|
||||
;
|
||||
; DATA AND 6502 CODE SEGMENT
|
||||
;
|
||||
HIMSG STR "Hello"
|
||||
HELLO DEF HELLO ; CALLABLE FROM EXTERNAL MODULES
|
||||
LDA #>HIMSG
|
||||
LDY #<HIMSG
|
||||
DEX
|
||||
STA ESTKL,X
|
||||
STY ESTKH,X
|
||||
JSR PUTS
|
||||
JMP PUTLN
|
||||
BYEMSG STR "Goodbye"
|
||||
GOODBYE DEF GOODBYE ; CALLABLE FROM EXTERNAL MODULES
|
||||
LDA #>BYEMSG
|
||||
LDY #<BYEMSG
|
||||
DEX
|
||||
STA ESTKL,X
|
||||
STY ESTKH,X
|
||||
JSR PUTS
|
||||
JMP PUTLN
|
||||
;
|
||||
; INITIALIZE MODULE AND RETURN MOD KEEP STATUS
|
||||
;
|
||||
INIT JSR HELLO
|
||||
LDA #>MODKEEP
|
||||
LDY #<MODKEEP
|
||||
DEX
|
||||
STA ESTKL,X
|
||||
STY ESTKH,X
|
||||
RTS
|
||||
;
|
||||
; EXT REL DEFSEG
|
||||
;
|
||||
INCLUDE INC/EXTDEFSEG.INC
|
30
src/samplesrc/testrel.asm
Normal file
30
src/samplesrc/testrel.asm
Normal file
|
@ -0,0 +1,30 @@
|
|||
;
|
||||
; SIMPLE REL FILE - NO DEPENDENCIES, NO INIT CODE
|
||||
;
|
||||
INCLUDE INC/PLASMA.INC
|
||||
;
|
||||
; EXTERNALS USED BY THIS MODULE
|
||||
;
|
||||
EXTRN PUTS
|
||||
EXTRN PUTLN
|
||||
;
|
||||
; DATA AND MACHINE CODE FOR THIS REL MODULE
|
||||
;
|
||||
HIMSG STR "Hello"
|
||||
HELLO DEF HELLO
|
||||
LDA #>HIMSG
|
||||
LDY #<HIMSG
|
||||
DEX
|
||||
STA ESTKL,X
|
||||
STY ESTKH,X
|
||||
JSR PUTS
|
||||
JMP PUTLN
|
||||
BYEMSG STR "Goodbye"
|
||||
GOODBYE DEF GOODBYE
|
||||
LDA #>BYEMSG
|
||||
LDY #<BYEMSG
|
||||
DEX
|
||||
STA ESTKL,X
|
||||
STY ESTKH,X
|
||||
JSR PUTS
|
||||
JMP PUTLN
|
|
@ -1,13 +1,15 @@
|
|||
include "inc/cmdsys.plh"
|
||||
include "inc/hgrlib.plh"
|
||||
include "inc/hgrtile.plh"
|
||||
include "inc/hgrfont.plh"
|
||||
sysflags reshgr1 // Reserve HGR page 1
|
||||
|
||||
tileMode(TRUE)
|
||||
hgrMode(hgrPage1)
|
||||
tileDrawBuf(hgrPage1)
|
||||
hgrPutStr(5, 1, "Hello HiRes Tile Demo")
|
||||
getc
|
||||
tileFromText(0, @hgrFont)
|
||||
getc
|
||||
tileMode(FALSE)
|
||||
hgrMode(hgrOff)
|
||||
done
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@ SRC" GRLIB.4TH"
|
|||
5 VARIABLE BALLCLR
|
||||
10 VARIABLE BALLX
|
||||
20 VARIABLE BALLY
|
||||
10 VARIABLE OLDX
|
||||
20 VARIABLE OLDY
|
||||
1 VARIABLE INCX
|
||||
1 VARIABLE INCY
|
||||
|
||||
|
@ -21,24 +19,23 @@ SRC" GRLIB.4TH"
|
|||
BALLY @ 47 = IF INCY @ NEGATE INCY ! BOOP THEN
|
||||
INCX @ BALLX +!
|
||||
INCY @ BALLY +!
|
||||
BALLCLR @ GRCOLOR
|
||||
BALLX @ BALLY @ GRPLOT
|
||||
0 GRCOLOR
|
||||
OLDX @ OLDY @ GRPLOT
|
||||
BALLX @ OLDX !
|
||||
BALLY @ OLDY !
|
||||
1 BALLCLR DUP @ GRCOLOR +!
|
||||
0 0 BALLX @ BALLY @ GRLINE
|
||||
39 47 BALLX @ BALLY @ GRLINE
|
||||
0 47 BALLX @ BALLY @ GRLINE
|
||||
39 0 BALLX @ BALLY @ GRLINE
|
||||
;
|
||||
|
||||
: BOUNCE
|
||||
1 GRMODE DROP
|
||||
0 GRMODE DROP
|
||||
0 GRDRAWBUF
|
||||
0 GRCLEAR
|
||||
BEGIN
|
||||
MOVEBALL
|
||||
?TERMINAL
|
||||
KEY?
|
||||
UNTIL
|
||||
KEY DROP
|
||||
0 GRMODE DROP
|
||||
-1 GRMODE DROP
|
||||
;
|
||||
|
||||
BOUNCE
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
' CONIOAPI ENDSRC
|
||||
' CONIOAPI ?ENDSRC
|
||||
LOOKUP CONIO CONSTANT CONIOAPI
|
||||
CONIOAPI 3 IFACE PLASMA _HOME : HOME _HOME DROP ;
|
||||
CONIOAPI 4 IFACE PLASMA _GOTOXY : GOTOXY _GOTOXY DROP ;
|
||||
|
|
43
src/scripts/dbounce.4th
Normal file
43
src/scripts/dbounce.4th
Normal file
|
@ -0,0 +1,43 @@
|
|||
LOOKUP TX2FORTH NOT ?ABORT" Must run with TX2FORTH."
|
||||
|
||||
SRC" PLASMA.4TH"
|
||||
SRC" CONIO.4TH"
|
||||
SRC" DGRLIB.4TH"
|
||||
|
||||
5 VARIABLE BALLCLR
|
||||
10 VARIABLE BALLX
|
||||
20 VARIABLE BALLY
|
||||
1 VARIABLE INCX
|
||||
1 VARIABLE INCY
|
||||
|
||||
: BEEP 30 10 TONE ;
|
||||
|
||||
: BOOP 10 30 TONE ;
|
||||
|
||||
: MOVEBALL
|
||||
BALLX @ 0= IF INCX @ NEGATE INCX ! BEEP THEN
|
||||
BALLX @ 79 = IF INCX @ NEGATE INCX ! BEEP THEN
|
||||
BALLY @ 0= IF INCY @ NEGATE INCY ! BOOP THEN
|
||||
BALLY @ 47 = IF INCY @ NEGATE INCY ! BOOP THEN
|
||||
INCX @ BALLX +!
|
||||
INCY @ BALLY +!
|
||||
1 BALLCLR DUP @ DGRCOLOR +!
|
||||
0 0 BALLX @ BALLY @ DGRLINE
|
||||
79 47 BALLX @ BALLY @ DGRLINE
|
||||
0 47 BALLX @ BALLY @ DGRLINE
|
||||
79 0 BALLX @ BALLY @ DGRLINE
|
||||
;
|
||||
|
||||
: BOUNCE
|
||||
0 DGRMODE DROP
|
||||
0 DGRDRAWBUF
|
||||
0 DGRCLEAR
|
||||
BEGIN
|
||||
MOVEBALL
|
||||
KEY?
|
||||
UNTIL
|
||||
KEY DROP
|
||||
-1 DGRMODE DROP
|
||||
;
|
||||
|
||||
BOUNCE
|
20
src/scripts/dgrlib.4th
Normal file
20
src/scripts/dgrlib.4th
Normal file
|
@ -0,0 +1,20 @@
|
|||
' DGRMODE ?ENDSRC ( Avoid multiple loads )
|
||||
" DGRLIB" LOADMOD" "
|
||||
" LINES" LOADMOD" "
|
||||
LOOKUP DGRPLOT PLASMA DGRPLOT
|
||||
LOOKUP DGRHLIN PLASMA DGRHLIN
|
||||
LOOKUP DGRVLIN PLASMA DGRVLIN
|
||||
LOOKUP DGRBLT PLASMA DGRBLT
|
||||
LOOKUP DGRTILE PLASMA DGRTILE
|
||||
LOOKUP DGRTILESTR PLASMA DGRTILESTR
|
||||
LOOKUP DGRFILL PLASMA DGRFILL
|
||||
LOOKUP DGRVLB PLASMA DGRVLB
|
||||
LOOKUP DGRCLEAR PLASMA DGRCLEAR
|
||||
LOOKUP DGRMODE PLASMA DGRMODE
|
||||
LOOKUP DGRSHOW PLASMA DGRSHOW
|
||||
LOOKUP DGRSWAP PLASMA DGRSWAP
|
||||
LOOKUP DGRDRAWBUF PLASMA DGRDRAWBUF
|
||||
LOOKUP DGRCOLOR PLASMA DGRCOLOR
|
||||
LOOKUP SETLINESPANS PLASMA SETLINESPANS
|
||||
LOOKUP LINESPANS PLASMA DGRLINE
|
||||
LOOKUP DGRHLIN LOOKUP DGRVLIN SETLINESPANS
|
|
@ -1,4 +1,4 @@
|
|||
' FILEIOAPI ENDSRC
|
||||
' FILEIOAPI ?ENDSRC
|
||||
LOOKUP PERR CONSTANT PERR
|
||||
LOOKUP FILEIO CONSTANT FILEIOAPI
|
||||
FILEIOAPI 2 IFACE PLASMA GETFILEINFO
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
' FPULIB ENDSRC
|
||||
' FPULIB ?ENDSRC
|
||||
" SANE" LOADMOD" "
|
||||
" FPSTR" LOADMOD" "
|
||||
" FPU" LOADMOD" "
|
||||
|
@ -79,6 +79,8 @@ FPULIB 68 IFACE PLASMA _FPRANDNUM : FPRANDNUM _FPRANDNUM FPERR ! ;
|
|||
2 CONSTANT FPSTR.STRIP
|
||||
4 CONSTANT FPSTR.EXP
|
||||
8 CONSTANT FPSTR.FLEX
|
||||
: FP. HERE 10 4 FPSTR.FLEX FPSTR! HERE (.") ;
|
||||
: >FPINT PAD ! PAD FPINT@ ;
|
||||
: FPINT> PAD FPINT! PAD @ ;
|
||||
: FP. PAD 10 4 FPSTR.FLEX FPSTR! PAD (.") ;
|
||||
: FPEXT CREATE 10 ALLOT ;
|
||||
FPRESET
|
40
src/scripts/gfxplot.4th
Normal file
40
src/scripts/gfxplot.4th
Normal file
|
@ -0,0 +1,40 @@
|
|||
SRC" PLASMA.4TH"
|
||||
SRC" CONIO.4TH"
|
||||
SRC" GRAFIX.4TH"
|
||||
SRC" FPU.4TH"
|
||||
|
||||
: DRAWAXIS
|
||||
3 GFXSETMODE
|
||||
6 GFXPENCOLOR
|
||||
0 96 139 96 GFXLINE
|
||||
70 0 70 191 GFXLINE
|
||||
;
|
||||
|
||||
: PLOTDONE
|
||||
KEY DROP
|
||||
-1 GFXSETMODE
|
||||
;
|
||||
|
||||
FPEXT XSCALE
|
||||
FPCONSTPI 69 >FPINT FP/ XSCALE FPEXT!
|
||||
|
||||
FPEXT YSCALE
|
||||
95 >FPINT YSCALE FPEXT!
|
||||
|
||||
DEFER FUNC
|
||||
|
||||
: PLOTFUNC
|
||||
15 GFXPENCOLOR
|
||||
140 0 DO
|
||||
I DUP 69 - >FPINT XSCALE FPEXT@ FP*
|
||||
FUNC
|
||||
YSCALE FPEXT@ FP* FPINT> 95 +
|
||||
GFXPLOT
|
||||
LOOP
|
||||
;
|
||||
|
||||
' FPSIN IS FUNC
|
||||
DRAWAXIS PLOTFUNC PLOTDONE
|
||||
|
||||
' FPCOS IS FUNC
|
||||
DRAWAXIS PLOTFUNC PLOTDONE
|
14
src/scripts/grafix.4th
Normal file
14
src/scripts/grafix.4th
Normal file
|
@ -0,0 +1,14 @@
|
|||
' GRAFIX ?ENDSRC
|
||||
" GRAFIX" LOADMOD" "
|
||||
LOOKUP PENCOLOR PLASMA GFXPENCOLOR
|
||||
LOOKUP FILLCOLOR PLASMA GFXFILLCOLOR
|
||||
LOOKUP FILLSCREEN PLASMA GFXFILLSCREEN
|
||||
LOOKUP PENMOVE PLASMA GFXPENMOVE
|
||||
LOOKUP PLOT PLASMA GFXPLOT
|
||||
LOOKUP LINE PLASMA GFXLINE
|
||||
LOOKUP LINETO PLASMA GFXLINETO
|
||||
LOOKUP RECT PLASMA GFXRECT
|
||||
LOOKUP FILLRECT PLASMA GFXFILLRECT
|
||||
LOOKUP BITBLT PLASMA GFXBITBLT
|
||||
LOOKUP DRAWMODE PLASMA GFXDRAWMODE
|
||||
LOOKUP SETMODE PLASMA GFXSETMODE
|
|
@ -1,5 +1,6 @@
|
|||
' GRMODE ENDSRC ( Avoid multiple loads )
|
||||
' GRMODE ?ENDSRC ( Avoid multiple loads )
|
||||
" GRLIB" LOADMOD" "
|
||||
" LINES" LOADMOD" "
|
||||
LOOKUP GRPLOT PLASMA GRPLOT
|
||||
LOOKUP GRHLIN PLASMA GRHLIN
|
||||
LOOKUP GRVLIN PLASMA GRVLIN
|
||||
|
@ -14,3 +15,6 @@ LOOKUP GRSHOW PLASMA GRSHOW
|
|||
LOOKUP GRSWAP PLASMA GRSWAP
|
||||
LOOKUP GRDRAWBUF PLASMA GRDRAWBUF
|
||||
LOOKUP GRCOLOR PLASMA GRCOLOR
|
||||
LOOKUP SETLINESPANS PLASMA SETLINESPANS
|
||||
LOOKUP LINESPANS PLASMA GRLINE
|
||||
LOOKUP GRHLIN LOOKUP GRVLIN SETLINESPANS
|
86
src/scripts/hdinstall.4th
Normal file
86
src/scripts/hdinstall.4th
Normal file
|
@ -0,0 +1,86 @@
|
|||
SRC" plasma.4th"
|
||||
SRC" conio.4th"
|
||||
|
||||
: [THEN] ; IMMEDIATE ( PLACE HOLDER TO RESUME EXECUTION )
|
||||
DEFER [ELSE] ( SKIP UNTIL [THEN] IF EXECUTED )
|
||||
: [IF] ( F -- )
|
||||
NOT IF ( SKIP CODE IN BETWEEN [ELSE] OR [THEN] )
|
||||
[COMPILE] [ELSE]
|
||||
THEN
|
||||
; IMMEDIATE
|
||||
:NONAME ( [ELSE] )
|
||||
1 >R
|
||||
BEGIN
|
||||
BL WORD FIND IF
|
||||
CASE
|
||||
' [ELSE] OF
|
||||
R@ 1 = IF ( RESUME EXECUTING AT MATCHING [ELSE] )
|
||||
R> DROP DROP EXIT
|
||||
THEN
|
||||
ENDOF
|
||||
' [THEN] OF
|
||||
R> 1- ?DUP 0= IF ( EXIT AT FINAL [THEN] )
|
||||
DROP EXIT
|
||||
THEN
|
||||
>R
|
||||
ENDOF
|
||||
' [IF] OF ( CHECK FOR NESTED [IF] )
|
||||
R> 1+ >R
|
||||
ENDOF
|
||||
ENDCASE
|
||||
ELSE
|
||||
DROP
|
||||
THEN
|
||||
AGAIN
|
||||
; IMMEDIATE IS [ELSE]
|
||||
|
||||
: STRINPUT ( STR -- )
|
||||
DUP 1+ 255 ACCEPT -TRAILING SWAP C!
|
||||
;
|
||||
: STRING CREATE 256 ALLOT DOES> ; ( JUST ALLOCATE THE BIGGEST STRING POSSIBLE )
|
||||
|
||||
: CONFIRM" ( -- F )
|
||||
COMPILE ."
|
||||
." (Y/N)"
|
||||
KEY CR TOUPPER CHAR Y =
|
||||
;
|
||||
|
||||
STRING DEST
|
||||
STRING FILELIST
|
||||
|
||||
0 0 40 24 VIEWPORT
|
||||
HOME
|
||||
12 SPACES INVERSETEXT
|
||||
." PLASMA HD INSTALL"
|
||||
NORMALTEXT CR CR
|
||||
0 1 40 23 VIEWPORT
|
||||
." Enter destination " DEST STRINPUT
|
||||
DEST C@ 0= ?ABORT" Destination required"
|
||||
." Copying system files to " DEST (.") CR
|
||||
FILELIST " -R EDITOR.README PL* CMD* SYS " STRCPY DEST STRCAT
|
||||
" COPY" SWAP LOADMOD
|
||||
|
||||
CONFIRM" Copy demos?" [IF]
|
||||
FILELIST " -R DEMOS " STRCPY DEST STRCAT
|
||||
" COPY" SWAP LOADMOD
|
||||
[THEN]
|
||||
|
||||
CONFIRM" Copy build tools?" [IF]
|
||||
DEST " /BLD" STRCAT DROP
|
||||
" NEWDIR" DEST LOADMOD
|
||||
FILELIST " BLD/PLASM BLD/CODEOPT " STRCPY
|
||||
DEST STRCAT
|
||||
" COPY" SWAP LOADMOD
|
||||
FILELIST " -R BLD/INC " STRCPY DEST STRCAT
|
||||
" COPY" SWAP LOADMOD
|
||||
|
||||
CONFIRM" Copy sample code?" [IF]
|
||||
FILELIST " -R BLD/SAMPLES " STRCPY DEST STRCAT
|
||||
" COPY" SWAP LOADMOD
|
||||
[THEN]
|
||||
|
||||
[THEN]
|
||||
|
||||
." Done" CR
|
||||
0 0 40 24 VIEWPORT
|
||||
BYE
|
32
src/scripts/hdinstall1.4th
Normal file
32
src/scripts/hdinstall1.4th
Normal file
|
@ -0,0 +1,32 @@
|
|||
SRC" plasma.4th"
|
||||
SRC" conio.4th"
|
||||
SRC" machid.4th"
|
||||
LOOKUP CMDSYS 19 + @ PLASMA EXECSYS
|
||||
|
||||
: STRINPUT ( STR -- )
|
||||
DUP 1+ 255 ACCEPT -TRAILING SWAP C!
|
||||
;
|
||||
: STRING CREATE 256 ALLOT DOES> ; ( JUST ALLOCATE THE BIGGEST STRING POSSIBLE )
|
||||
|
||||
STRING DEST
|
||||
STRING FILELIST
|
||||
|
||||
0 0 40 24 VIEWPORT
|
||||
HOME
|
||||
12 SPACES INVERSETEXT
|
||||
." PLASMA HD INSTALL"
|
||||
NORMALTEXT CR CR
|
||||
0 1 40 23 VIEWPORT
|
||||
." Enter destination " DEST STRINPUT
|
||||
DEST C@ 0= ?ABORT" Destination required"
|
||||
." Copying install files to " DEST (.") CR
|
||||
FILELIST " -R PL* CMD* SYS AUTORUN " STRCPY DEST STRCAT
|
||||
" COPY" SWAP LOADMOD
|
||||
FILELIST " HDINSTALL2.4TH " STRCPY DEST STRCAT " /HDINSTALL.4TH" STRCAT
|
||||
" COPY" SWAP LOADMOD
|
||||
|
||||
." Stage 2..." CR
|
||||
0 0 40 24 VIEWPORT
|
||||
|
||||
DEST SETPFX DROP
|
||||
" PLASMA.SYSTEM" EXECSYS
|
111
src/scripts/hdinstall2.4th
Normal file
111
src/scripts/hdinstall2.4th
Normal file
|
@ -0,0 +1,111 @@
|
|||
SRC" plasma.4th"
|
||||
SRC" conio.4th"
|
||||
|
||||
: [THEN] ; IMMEDIATE ( PLACE HOLDER TO RESUME EXECUTION )
|
||||
DEFER [ELSE] ( SKIP UNTIL [THEN] IF EXECUTED )
|
||||
: [IF] ( F -- )
|
||||
NOT IF ( SKIP CODE IN BETWEEN [ELSE] OR [THEN] )
|
||||
POSTPONE [ELSE]
|
||||
THEN
|
||||
; IMMEDIATE
|
||||
:NONAME ( [ELSE] )
|
||||
1 >R
|
||||
BEGIN
|
||||
BL WORD FIND IF
|
||||
CASE
|
||||
' [ELSE] OF
|
||||
R@ 1 = IF ( RESUME EXECUTING AT MATCHING [ELSE] )
|
||||
R> DROP DROP EXIT
|
||||
THEN
|
||||
ENDOF
|
||||
' [THEN] OF
|
||||
R> 1- ?DUP 0= IF ( EXIT AT FINAL [THEN] )
|
||||
DROP EXIT
|
||||
THEN
|
||||
>R
|
||||
ENDOF
|
||||
' [IF] OF ( CHECK FOR NESTED [IF] )
|
||||
R> 1+ >R
|
||||
ENDOF
|
||||
ENDCASE
|
||||
ELSE
|
||||
DROP
|
||||
THEN
|
||||
AGAIN
|
||||
; IMMEDIATE IS [ELSE]
|
||||
: STRING CREATE 256 ALLOT DOES> ; ( JUST ALLOCATE THE BIGGEST STRING POSSIBLE )
|
||||
|
||||
: CONFIRM" ( -- F )
|
||||
POSTPONE ."
|
||||
." (Y/N)"
|
||||
KEY CR TOUPPER CHAR Y =
|
||||
;
|
||||
|
||||
: INSERT.FLOPPY"
|
||||
." Insert "
|
||||
POSTPONE ."
|
||||
." into floppy drive" CR
|
||||
." Press any key to continue" KEY DROP CR
|
||||
;
|
||||
|
||||
STRING DEST
|
||||
STRING FILELIST
|
||||
|
||||
0 0 40 24 VIEWPORT
|
||||
HOME
|
||||
8 SPACES INVERSETEXT
|
||||
." PLASMA HD INSTALL STAGE 2"
|
||||
NORMALTEXT CR CR
|
||||
0 1 40 23 VIEWPORT
|
||||
|
||||
DEST GETPFX DROP
|
||||
|
||||
INSERT.FLOPPY" PLASMA.SYS"
|
||||
FILELIST " -R /PLASMA.SYS/* " STRCPY DEST STRCAT
|
||||
" COPY" SWAP LOADMOD
|
||||
|
||||
CONFIRM" Copy demos?" [IF]
|
||||
INSERT.FLOPPY" PLASMA.DEMOS"
|
||||
FILELIST " -R /PLASMA.DEMOS/DEMOS " STRCPY DEST STRCAT
|
||||
" COPY" SWAP LOADMOD
|
||||
[THEN]
|
||||
|
||||
CONFIRM" Copy floating point libraries?" [IF]
|
||||
INSERT.FLOPPY" PLASMA.FPSOS"
|
||||
FILELIST " -R /PLASMA.FPSOS/SYS " STRCPY DEST STRCAT
|
||||
" COPY" SWAP LOADMOD
|
||||
[THEN]
|
||||
|
||||
CONFIRM" Copy networking libraries?" [IF]
|
||||
INSERT.FLOPPY" PLASMA.INET"
|
||||
FILELIST " -R /PLASMA.INET/* " STRCPY DEST STRCAT
|
||||
" COPY" SWAP LOADMOD
|
||||
[THEN]
|
||||
|
||||
CONFIRM" Copy build tools?" [IF]
|
||||
DEST " BLD" STRCAT
|
||||
" NEWDIR" SWAP LOADMOD
|
||||
INSERT.FLOPPY" PLASMA.BLD"
|
||||
FILELIST " -R /PLASMA.BLD/BLD/PLASM /PLASMA.BLD/BLD/CODEOPT " STRCPY
|
||||
" /PLASMA.BLD/BLD/INC " STRCAT DEST STRCAT
|
||||
" COPY" SWAP LOADMOD
|
||||
|
||||
CONFIRM" Copy sample PLASMA code?" [IF]
|
||||
FILELIST " -R /PLASMA.BLD/BLD/SAMPLES " STRCPY DEST STRCAT
|
||||
" COPY" SWAP LOADMOD
|
||||
[THEN]
|
||||
|
||||
CONFIRM" Copy sample FORTH scripts?" [IF]
|
||||
FILELIST " -R /PLASMA.BLD/BLD/SCRIPTS " STRCPY DEST STRCAT
|
||||
" COPY" SWAP LOADMOD
|
||||
[THEN]
|
||||
|
||||
[THEN]
|
||||
|
||||
FILELIST " AUTORUN HDINSTALL.4TH" STRCPY
|
||||
" DEL" SWAP LOADMOD
|
||||
|
||||
0 0 40 24 VIEWPORT
|
||||
HOME
|
||||
." Done" CR
|
||||
BYE
|
|
@ -1,5 +1,8 @@
|
|||
' HGRMODE ENDSRC
|
||||
' HGRMODE ?ENDSRC
|
||||
" HGRLIB" LOADMOD" "
|
||||
" LINES" LOADMOD" "
|
||||
" HGRTILE" LOADMOD" "
|
||||
" HGRFONT" LOADMOD" "
|
||||
LOOKUP HGRPLOT PLASMA HGRPLOT
|
||||
LOOKUP HGRORPLOT PLASMA HGRORPLOT
|
||||
LOOKUP HGRXORPLOT PLASMA HGRXORPLOT
|
||||
|
@ -21,3 +24,14 @@ LOOKUP HGRSHOW PLASMA HGRSHOW
|
|||
LOOKUP HGRSWAP PLASMA HGRSWAP
|
||||
LOOKUP HGRDRAWBUF PLASMA HGRDRAWBUF
|
||||
LOOKUP HGRCOLOR PLASMA HGRCOLOR
|
||||
LOOKUP HGRPUTSTR PLASMA HGRPUTSTR
|
||||
LOOKUP SETLINESPANS PLASMA SETLINESPANS
|
||||
LOOKUP LINESPANS PLASMA HGRLINE
|
||||
LOOKUP HGRHLIN LOOKUP HGRVLIN SETLINESPANS
|
||||
LOOKUP TILEDRAW PLASMA TILEDRAW
|
||||
LOOKUP TILEXORDRAW PLASMA TILEXORDRAW
|
||||
LOOKUP TILEORDRAW PLASMA TILEORDRAW
|
||||
LOOKUP TILEANDDRAW PLASMA TILEANDDRAW
|
||||
LOOKUP TILEDRAWSTR PLASMA TILEDRAWSTR
|
||||
LOOKUP TILEFROMTEXT PLASMA TILEFROMTEXT
|
||||
LOOKUP TILEDRAWBUF PLASMA TILEDRAWBUF
|
|
@ -1,6 +1,6 @@
|
|||
LOOKUP HRFORTH ( HGR page 1 reserved )
|
||||
LOOKUP HR2FORTH ( HGR page 1 and 2 reserved )
|
||||
OR NOT ABORT" Must run with HRFORTH."
|
||||
OR NOT ?ABORT" Must run with HRFORTH."
|
||||
|
||||
SRC" PLASMA.4TH"
|
||||
SRC" CONIO.4TH"
|
||||
|
@ -25,24 +25,42 @@ SRC" HGRLIB.4TH"
|
|||
BALLY @ 191 = IF INCY @ NEGATE INCY ! BOOP THEN
|
||||
INCX @ BALLX +!
|
||||
INCY @ BALLY +!
|
||||
BALLCLR @ HGRCOLOR
|
||||
BALLX @ BALLY @ HGRPLOT
|
||||
0 HGRCOLOR
|
||||
OLDX @ OLDY @ HGRPLOT
|
||||
BALLX @ BALLY @ HGRXORPLOT
|
||||
OLDX @ OLDY @ HGRXORPLOT
|
||||
BALLX @ OLDX !
|
||||
BALLY @ OLDY !
|
||||
;
|
||||
|
||||
0 VARIABLE TOP
|
||||
0 VARIABLE BOTTOM
|
||||
0 VARIABLE LEFT
|
||||
0 VARIABLE RIGHT
|
||||
: RECT ( left top right bottom -- )
|
||||
BOTTOM !
|
||||
RIGHT !
|
||||
TOP !
|
||||
LEFT !
|
||||
LEFT @ TOP @ RIGHT @ TOP @ HGRLINE
|
||||
LEFT @ BOTTOM @ RIGHT @ BOTTOM @ HGRLINE
|
||||
LEFT @ TOP @ LEFT @ BOTTOM @ HGRLINE
|
||||
RIGHT @ TOP @ RIGHT @ BOTTOM @ HGRLINE
|
||||
;
|
||||
|
||||
: BOUNCE
|
||||
1 HGRMODE DROP
|
||||
0 HGRMODE DROP
|
||||
0 HGRDRAWBUF DROP
|
||||
0 TILEDRAWBUF DROP
|
||||
0 HGRSHOW DROP
|
||||
10 12 " Hello from PLFORTH!" HGRPUTSTR
|
||||
1 HGRCOLOR
|
||||
61 90 209 107 RECT
|
||||
BALLCLR @ HGRCOLOR
|
||||
BEGIN
|
||||
MOVEBALL
|
||||
?TERMINAL
|
||||
KEY?
|
||||
UNTIL
|
||||
KEY DROP
|
||||
0 HGRMODE DROP
|
||||
-1 HGRMODE DROP
|
||||
;
|
||||
|
||||
BOUNCE
|
||||
|
|
49
src/scripts/hrplot.4th
Normal file
49
src/scripts/hrplot.4th
Normal file
|
@ -0,0 +1,49 @@
|
|||
LOOKUP HRFORTH ( HGR page 1 reserved )
|
||||
NOT ?ABORT" Must run with HRFORTH."
|
||||
|
||||
SRC" MACHID.4TH"
|
||||
MACHID MACHID.MEM AND MACHID.128K
|
||||
<> ?ABORT" 128K required."
|
||||
FORGET MACHID
|
||||
|
||||
SRC" PLASMA.4TH"
|
||||
SRC" CONIO.4TH"
|
||||
SRC" HGRLIB.4TH"
|
||||
SRC" FPU.4TH"
|
||||
|
||||
: DRAWAXIS
|
||||
0 HGRMODE HGRDRAWBUF TILEDRAWBUF DROP
|
||||
1 HGRCOLOR
|
||||
0 96 279 96 HGRLINE
|
||||
139 0 139 191 HGRLINE
|
||||
140 0 140 191 HGRLINE
|
||||
;
|
||||
|
||||
: PLOTDONE
|
||||
KEY DROP
|
||||
-1 HGRMODE DROP
|
||||
;
|
||||
|
||||
FPEXT XSCALE
|
||||
FPCONSTPI 139 >FPINT FP/ XSCALE FPEXT!
|
||||
|
||||
FPEXT YSCALE
|
||||
-95 >FPINT YSCALE FPEXT!
|
||||
|
||||
DEFER FUNC
|
||||
|
||||
: PLOTFUNC
|
||||
3 HGRCOLOR
|
||||
279 0 DO
|
||||
I DUP 139 - >FPINT XSCALE FPEXT@ FP*
|
||||
FUNC
|
||||
YSCALE FPEXT@ FP* FPINT> 95 +
|
||||
OVER 1+ OVER HGRPLOT HGRPLOT
|
||||
LOOP
|
||||
;
|
||||
|
||||
' FPSIN IS FUNC
|
||||
DRAWAXIS PLOTFUNC PLOTDONE
|
||||
|
||||
' FPCOS IS FUNC
|
||||
DRAWAXIS PLOTFUNC PLOTDONE
|
|
@ -1,4 +1,4 @@
|
|||
' DVAR ENDSRC
|
||||
' DVAR ?ENDSRC
|
||||
" INT32" LOADMOD" "
|
||||
LOOKUP ZERO32 PLASMA ZERO32
|
||||
LOOKUP ZEXT16TO32 PLASMA ZEXT32
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user