1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2026-03-12 01:41:40 +00:00

508 Commits

Author SHA1 Message Date
David Schmenk
c16fc8a1d1 Update docs for Alpha 1 2020-07-04 17:29:42 -07:00
David Schmenk
954c1b185c Update images to Alpha1 2020-07-04 17:20:11 -07:00
David Schmenk
70a6458fc5 Update images to Alpha1 2020-07-04 14:41:32 -07:00
David Schmenk
2799083bcf Update images to Alpha1 2020-07-04 13:49:40 -07:00
Dave Schmenk
54d36ce12e Alpha1 2020-07-01 17:50:39 -07:00
David Schmenk
f0dc042dad Alpha1 2020-07-01 09:56:44 -07:00
David Schmenk
713a6c6cbe Alpha1 2020-07-01 09:55:58 -07:00
David Schmenk
3adb41921c Alpha1 2020-07-01 09:55:00 -07:00
David Schmenk
ca1b40a68b Alpha1 2020-07-01 09:54:29 -07:00
David Schmenk
5b5e8aa0de Alpha1 2020-07-01 09:53:20 -07:00
David Schmenk
29c5f9c53f Alpha1 2020-07-01 09:52:33 -07:00
David Schmenk
2141520023 Update a1cmd.pla 2020-07-01 09:51:26 -07:00
Dave Schmenk
c652200248 JIT profiler intrypoint improvements 2020-07-01 09:07:40 -07:00
David Schmenk
6609aadaaf Loose debug noise 2020-06-30 16:28:13 -07:00
Dave Schmenk
0e87fcf4f0 Lose debug noise 2020-06-30 16:07:09 -07:00
Dave Schmenk
21f926a763 Clean-up around call/return 2020-06-30 15:16:21 -07:00
David Schmenk
337c6557e2 Introduced bug :-( 2020-06-30 12:41:51 -07:00
David Schmenk
45f32cc5db Clean up stack<->zp copy 2020-06-30 11:50:01 -07:00
Dave Schmenk
20a6655c0f Clean up frame allocate calc 2020-06-30 08:25:17 -07:00
Dave Schmenk
e7e475faa7 Better PSR handling when AUX mem enabled/IRQ disabled 2020-06-29 16:14:12 -07:00
David Schmenk
6f90d25eeb Merge branch 'master' of https://github.com/dschmenk/PLASMA 2020-06-10 18:50:59 -07:00
David Schmenk
ef4edf74f1 Clean up frame allocate calc 2020-06-10 18:50:23 -07:00
David Schmenk
954af7716b Make LICENSE Markdown format 2020-02-11 08:09:46 -08:00
David Schmenk
308774a2b0 Merge branch 'master' of https://github.com/dschmenk/PLASMA 2020-02-09 19:53:29 -08:00
David Schmenk
2ec923cf3b License change to LGPL3 2020-02-09 19:53:09 -08:00
David Schmenk
24c1a09f91 Update README.md 2020-01-31 12:14:17 -08:00
David Schmenk
8bdc1d6c56 DP4 release 2020-01-31 12:10:14 -08:00
David Schmenk
46000e7af1 Update images with latest editor 2020-01-31 12:06:49 -08:00
Dave Schmenk
447cde1692 Forth->PLASMA transpiler 2020-01-25 14:03:22 -08:00
David Schmenk
c74af19505 Improve indenting on mis-aligned lines 2020-01-21 08:39:26 -08:00
David Schmenk
5581bfb052 Update images 2020-01-20 12:09:09 -08:00
David Schmenk
1a208ef30a Make sure ternary op has lower precedence than AND and OR 2020-01-20 11:39:58 -08:00
Dave Schmenk
e0d688a45a SHR library 2020-01-19 13:11:09 -08:00
David Schmenk
642b4cbbb4 Forgot MATCHFILES for floppy image 2020-01-19 08:38:25 -08:00
David Schmenk
233e0299dc Update images 2020-01-17 13:24:23 -08:00
Dave Schmenk
ff023f65d2 Fix long standing bug in catalog code 2020-01-17 12:51:19 -08:00
Dave Schmenk
6045b260db Machine check for HGRLIB and slightly smaller catalog code 2020-01-17 12:22:18 -08:00
Dave Schmenk
b5f02ea7c5 Fiz ZIP chip utility to turn ANN3 off (fix hires colors) 2020-01-16 20:47:10 -08:00
David Schmenk
c9477238fa Clean up images 2020-01-15 13:33:46 -08:00
David Schmenk
59a35068bf Clean up the images 2020-01-15 13:24:05 -08:00
David Schmenk
348bc4eaf5 Update README.md 2020-01-11 12:27:41 -08:00
David Schmenk
05f5729adc Update Version 2.0.md 2020-01-10 22:34:47 -08:00
David Schmenk
06f12e5607 Update Version 2.0.md 2020-01-10 22:33:45 -08:00
David Schmenk
1aee6c4523 Update Version 2.0.md 2020-01-10 22:30:36 -08:00
David Schmenk
c8015091a5 Update SOS fix in images 2020-01-10 18:54:28 -08:00
Dave Schmenk
c83ed2c494 Fix another SOS-ism 2020-01-10 18:50:54 -08:00
David Schmenk
5c8fbfdcf4 Forgot to update editor version 2020-01-10 17:59:27 -08:00
David Schmenk
ea3c73ac15 2.0 DP3 release 2020-01-10 17:25:32 -08:00
Dave Schmenk
1f42523014 Fix some Apple /// differences 2020-01-10 13:55:05 -08:00
David Schmenk
6b1123a95b Update images 2020-01-10 11:57:39 -08:00
David Schmenk
fb3a4964c8 Match patterns with ending wildcard 2020-01-10 11:23:25 -08:00
David Schmenk
12f8cf8053 Tile blitter improvements from Brendan (BluRry) 2020-01-09 16:45:17 -08:00
David Schmenk
5e0053569e Formatting (which editor keeps messing up the tabs vs spaces?) 2020-01-08 17:27:08 -08:00
Dave Schmenk
d92d5dd6cd A wee'er bit faster 2020-01-08 14:33:49 -08:00
Dave Schmenk
206e7ae3f4 A wee bit faster and smaller 2020-01-08 14:30:37 -08:00
David Schmenk
8d9a0889a6 HGR tile and font libraries 2020-01-08 12:11:55 -08:00
David Schmenk
31f4fbfbec Slight API change 2020-01-08 05:51:19 -08:00
David Schmenk
6f620e194d Add JIT compiler to image 2020-01-08 05:43:26 -08:00
David Schmenk
4ee7c8c049 Auto-play Spiders from Mars 2020-01-07 18:51:06 -08:00
Dave Schmenk
9e31fbd1da Replay game 2020-01-07 18:18:18 -08:00
Dave Schmenk
1da0bdf610 Tweak 2020-01-07 17:22:44 -08:00
Dave Schmenk
360be4c709 Tweak sprite update and laser hit 2020-01-07 17:07:26 -08:00
David Schmenk
b13fb204a2 Spider sprite compiler 2020-01-07 16:12:40 -08:00
David Schmenk
0c57570d4a Pre-compile sprites and more animations and audio 2020-01-07 16:08:48 -08:00
David Schmenk
09d861e5a5 Quick updates 2020-01-06 22:15:59 -08:00
David Schmenk
f5416c2d82 Fix hgrHLin colors and tidy up game locations 2020-01-06 20:18:40 -08:00
Dave Schmenk
10cc631b0a More or less operational game 2020-01-06 16:09:25 -08:00
David Schmenk
e9a1311764 Shooting spiderwebs 2020-01-05 20:30:02 -08:00
David Schmenk
42888ed95a When spiders attack 2020-01-05 14:43:58 -08:00
David Schmenk
1fe6191343 More pixmaps 2020-01-04 19:51:39 -08:00
Dave Schmenk
b006e18d26 Fun with the graphics libraries 2020-01-04 16:58:51 -08:00
Dave Schmenk
69733fd37f Fix XORing of BLT with ORing. Better COPY message and add ZIP Chip
utility
2020-01-04 12:52:31 -08:00
Dave Schmenk
c1b6741cfd Fix commented out data and rect parameters 2020-01-04 09:36:54 -08:00
Dave Schmenk
41071de12f New HGR sprite shoot-em up demo 2020-01-04 08:45:23 -08:00
David Schmenk
b6a7b72fe1 Set inituial mask to WHITE(7) instead of WHITE(3) to reduce artifacting in blank areas 2020-01-04 07:45:39 -08:00
Dave Schmenk
426b662481 Lose examples from TFTP BLD 2020-01-03 14:24:41 -08:00
Dave Schmenk
18543c8363 Fix copy directory destination 2020-01-03 14:19:38 -08:00
David Schmenk
b2eaa867eb Add explicit undrawList calls 2020-01-03 07:57:26 -08:00
David Schmenk
d74ccc22fb Merge pull request #56 from peterferrie/master
notes on IIc VBL
2020-01-02 21:34:24 -08:00
Dave Schmenk
c4c3f4d9b3 Avoid infinite copy recursion 2020-01-02 20:49:32 -08:00
Dave Schmenk
ecb61ccddd Fix too many buffers allocated 2020-01-02 19:49:18 -08:00
David Schmenk
7c3dfe2b2e Wildcard names for file utilities 2020-01-01 13:50:57 -08:00
Dave Schmenk
438ab01254 Wildcard filename matching 2019-12-31 17:20:20 -08:00
Peter Ferrie
397dbdbb99 cut some bytes 2019-12-31 13:21:14 -08:00
Peter Ferrie
8b0a35e453 notes on IIc VBL 2019-12-31 13:19:42 -08:00
David Schmenk
81ad97e0bd Fix HGRTEST.PLA sample 2019-12-31 08:04:48 -08:00
David Schmenk
484aefb08c More error reporting when writing files 2019-12-31 07:53:41 -08:00
David Schmenk
c743ace42b Trying to track down file write corruption 2019-12-30 22:34:35 -08:00
David Schmenk
de29742841 Missed JIT16 dependency 2019-12-29 22:04:04 -08:00
David Schmenk
835b90e636 Update README.md 2019-12-29 08:44:32 -08:00
David Schmenk
c86d3349df Update Version 2.0.md 2019-12-29 08:43:24 -08:00
David Schmenk
3bb038b1d5 Update README.md 2019-12-29 06:39:33 -08:00
David Schmenk
74f00b9764 Direct link to change list for DP2 2019-12-29 06:39:17 -08:00
David Schmenk
3caa4b909c More DP2 change description 2019-12-29 06:37:54 -08:00
David Schmenk
80a6b2d4b7 Developer Preview 2 Release 2019-12-28 20:39:43 -08:00
David Schmenk
262a799a9d Update SOS images 2019-12-28 18:52:58 -08:00
Dave Schmenk
eb076459e9 Fix all remaining NOJIT issues (defentry size discrepancy) 2019-12-28 18:48:15 -08:00
David Schmenk
f5b0fb86b4 Not loading NOJIT interpreter correctly 2019-12-28 17:36:34 -08:00
David Schmenk
64f4f56379 Add Apple /// non-jit default to free up a little memory and update images to DP2 2019-12-28 16:18:51 -08:00
Dave Schmenk
8c885a6b8b Remove old pixmap data 2019-12-28 13:40:04 -08:00
David Schmenk
c09b15f377 A little re-org and assembly-izing 2019-12-28 12:03:59 -08:00
David Schmenk
4a4468cc22 Fix divmod7 for negative numbers 2019-12-28 09:47:24 -08:00
David Schmenk
322546a0b1 Add sprite center 2019-12-28 08:19:31 -08:00
David Schmenk
b5f832b0b2 Fix simple line plot routine 2019-12-27 19:01:01 -08:00
David Schmenk
c7c69fe0d5 Update line spacing 2019-12-27 18:37:21 -08:00
David Schmenk
8a960f018b Fix lines in all directions 2019-12-27 17:51:31 -08:00
David Schmenk
a056e00e93 Clean up some build problems 2019-12-27 15:17:53 -08:00
David Schmenk
efead509ad Assembly-ize many things and clip sprites 2019-12-27 14:46:10 -08:00
Dave Schmenk
bc532f4458 Load/Save sprites to a file 2019-12-26 22:37:07 -08:00
David Schmenk
cec1252ff6 Copy sprite library over TFTP 2019-12-26 21:17:57 -08:00
David Schmenk
4186c5170d Break out sprite library 2019-12-26 21:13:46 -08:00
David Schmenk
f829682876 Assembly-ize mahorline 2019-12-26 19:21:04 -08:00
David Schmenk
755c4b424a Assembly-ize some rotuines 2019-12-26 16:01:38 -08:00
David Schmenk
e258131e71 Assemly-ize some routines 2019-12-26 11:46:11 -08:00
David Schmenk
8aae1077ee Sprite list test 2019-12-25 12:25:28 -08:00
David Schmenk
dd721f5a75 HGR sprite library WIP 2019-12-25 10:23:50 -08:00
Dave Schmenk
1f94b7331a export divmod7 2019-12-24 16:00:49 -08:00
Dave Schmenk
7ba288d2d6 HGR lib WIP 2019-12-24 15:58:19 -08:00
David Schmenk
a77c50c90a Add 32 bit integer librbary just to print out file sizes in CAT 2019-12-24 12:02:56 -08:00
David Schmenk
5f8f6f0a97 int32 WIP 2019-12-23 17:16:03 -08:00
David Schmenk
2197286604 int32 WIP 2019-12-22 21:41:53 -08:00
Dave Schmenk
5ca96095cf New 32 bit integer library 2019-12-22 18:44:58 -08:00
David Schmenk
4aa8c8da1f Add utils source and reorg 2019-12-21 08:30:04 -08:00
Dave Schmenk
48a33a4432 Break out the utils 2019-12-20 17:52:03 -08:00
David Schmenk
91a1b16807 show & change af files type and aux 2019-12-20 17:50:10 -08:00
Dave Schmenk
ea6656d05b Basic file managing utilites 2019-12-20 16:26:10 -08:00
David Schmenk
3161692d4a Fix line edit changed flag 2019-12-20 10:20:09 -08:00
David Schmenk
3d91e4175b editine c;eanip. still loses ctrl-d once in awhile 2019-12-20 03:36:03 -08:00
David Schmenk
15b4551b2a Editor write file change to identify very rare write corruption 2019-12-20 00:49:12 -08:00
David Schmenk
8df7cea4a0 Add optional goto line number to command line load filename 2019-12-19 20:42:37 -08:00
David Schmenk
af90f40f32 in-line simple line routine 2019-12-19 19:38:26 -08:00
David Schmenk
44c8bf9a13 Premature GRLIB checking 2019-12-19 18:48:14 -08:00
David Schmenk
ae5e5b4237 GRLIB WIP 2019-12-19 18:30:22 -08:00
Dave Schmenk
1cd9156d8d First lores graphics library add 2019-12-19 18:13:59 -08:00
Dave Schmenk
0f1a15fb4a SOS.INTERP launcher fix and graphics libs WIP 2019-12-19 18:11:59 -08:00
Dave Schmenk
b9c5a8cb23 More WIP for the graphics libraries 2019-12-19 14:27:08 -08:00
David Schmenk
72f7dea67f Clean up DGRlib 2019-12-19 10:22:26 -08:00
Dave Schmenk
04139858fc WIP for graphics libraries 2019-12-18 21:48:52 -08:00
Dave Schmenk
0b750d46c5 Back to fun HGR stuff 2019-12-18 18:59:24 -08:00
David Schmenk
7a9123b261 Fixes and optimizations for the value of zero, my hero. 2019-12-17 21:43:05 -08:00
Dave Schmenk
10a98d5392 Seriously broken dividing zero by anything 2019-12-17 21:20:09 -08:00
Dave Schmenk
ff3d3c0b87 Simple 65C02 opts I didn't do before. 2019-12-17 16:51:33 -08:00
Dave Schmenk
60e556cc63 more low hanging opts (and fix previous cross compiler opt) 2019-12-17 14:52:35 -08:00
Dave Schmenk
b81e911857 Snag a few more easy optimizations 2019-12-17 13:30:09 -08:00
Dave Schmenk
ae5ea36e87 Remove #$%&! TAB characters 2019-12-17 11:01:05 -08:00
Dave Schmenk
1afb559849 Remove extraneous OK printouts 2019-12-17 10:59:06 -08:00
David Schmenk
3ce76f7308 simplify indent/undent code 2019-12-17 08:11:07 -08:00
David Schmenk
f937e8265e Update images with edit tab/detab fixes 2019-12-16 10:09:56 -08:00
Dave Schmenk
e1e16ef36d Better blank line detab 2019-12-16 10:05:07 -08:00
Dave Schmenk
6cabe160c4 Fix empty line TABbing 2019-12-16 09:03:34 -08:00
David Schmenk
454ecb29a8 Improve indent/undent and toggle gutter view. Additional compiler stats 2019-12-16 08:25:58 -08:00
Dave Schmenk
9011b1cc64 Add more compiler stats 2019-12-15 16:33:09 -08:00
David Schmenk
bc45a9263c Fix some editor redraw issues 2019-12-15 13:24:26 -08:00
David Schmenk
72ddf025e3 Update editor docs 2019-12-14 19:25:01 -08:00
David Schmenk
a902bc4c97 DP 1ED (editor!) release 2019-12-14 18:42:56 -08:00
Dave Schmenk
c7f48765b2 Return to editor when toggling lower-case chip support 2019-12-14 17:58:35 -08:00
Dave Schmenk
d3c1b8881a Merge branch 'master' of https://github.com/dschmenk/PLASMA 2019-12-14 17:43:29 -08:00
Dave Schmenk
27129fe152 Upgrade editor to programmers editor 2019-12-14 17:42:39 -08:00
David Schmenk
203b88a979 Edit with auto-indent 2019-12-13 19:48:11 -08:00
Dave Schmenk
f67e58011a Auto-indent for editor 2019-12-13 13:30:54 -08:00
Dave Schmenk
18102a319a Botched filename 2019-12-12 11:24:00 -08:00
Dave Schmenk
bbf0a0f666 Make image names a little more sensical 2019-12-12 11:22:46 -08:00
David Schmenk
8e124ca05b Update docs for DP 1a 2019-12-12 09:59:41 -08:00
David Schmenk
f90e339b01 Update Apple /// JIT and images to DP 1a 2019-12-12 09:56:05 -08:00
Dave Schmenk
8364f5c631 Fix premature restore of jitcodeptr in modexec 2019-12-12 01:13:05 -08:00
Dave Schmenk
f5236f2a1d More profiling? 2019-12-08 17:13:43 -08:00
Dave Schmenk
d91ca59b52 Additional jit16 tuning 2019-12-08 17:06:20 -08:00
Dave Schmenk
0981cae313 Merge branch 'master' of https://github.com/dschmenk/PLASMA 2019-12-08 16:51:01 -08:00
Dave Schmenk
fb989e22e4 profile jit16 default values 2019-12-08 16:48:23 -08:00
David Schmenk
1a230ab165 typo 2019-12-08 14:23:12 -08:00
David Schmenk
987a546bf6 Add SANE floating point file copy directions 2019-12-08 13:37:47 -08:00
Dave Schmenk
5088e67de5 Update image name for 800K full install 2019-12-08 12:33:52 -08:00
David Schmenk
6305c74b65 Update issues 2019-12-07 19:59:55 -08:00
David Schmenk
df77781c17 Automatic configuration 2019-12-07 19:56:14 -08:00
David Schmenk
9fc8ee56a7 Update documentation 2019-12-07 19:49:03 -08:00
David Schmenk
30cdd22211 Update images 2019-12-07 19:34:12 -08:00
David Schmenk
dfbc296311 Make mkrel and tftprel consistent 2019-12-07 18:00:12 -08:00
Dave Schmenk
0df8f864e7 Add autorun TFTPD floppy image 2019-12-07 17:06:54 -08:00
Dave Schmenk
517b60d86f TFTP full release to physical Apple II 2019-12-07 17:03:31 -08:00
Dave Schmenk
e2d1fb3ba4 Add online volume call and more tftp scripts 2019-12-07 13:42:03 -08:00
Dave Schmenk
1dc0d252f8 Fix is_hw test for 16 bit JIT 2019-12-06 18:14:08 -08:00
Dave Schmenk
7f6f9e7bbd Fix directory creation ops 2019-12-06 10:23:38 -08:00
Dave Schmenk
1a9ab9629b Copy FP modules 2019-12-01 15:48:41 -08:00
David Schmenk
db6bc55df3 Back out DINTRP opt as ENTER needs Y to bee zero 2019-12-01 15:39:21 -08:00
David Schmenk
8f85445700 Back out DINTRP opt as ENTER requires Y being zero 2019-12-01 15:36:48 -08:00
Dave Schmenk
1242b53824 Back out some of the DINTRP optimizations. Dependecy on Y being szero in ENTER 2019-12-01 15:24:18 -08:00
David Schmenk
2fe4b9ed52 Simpler DINTERP entry 2019-11-28 13:28:04 -08:00
David Schmenk
50f2ac669c Simpler DINTERP entry 2019-11-28 13:27:11 -08:00
David Schmenk
acf2aaacfe Simpler INTERP entry 2019-11-28 13:23:53 -08:00
David Schmenk
27eca20a04 Simpler DINTERP entry 2019-11-28 13:22:06 -08:00
David Schmenk
02b3b88862 Simpler INTERP entry 2019-11-28 13:21:23 -08:00
David Schmenk
cfe2fc4a98 Simpler INTERP entry 2019-11-28 13:20:43 -08:00
David Schmenk
49188358af Replace gets() with fgets() 2018-12-17 13:24:15 -08:00
David Schmenk
abb89438ef Merge pull request #52 from iflan/lex-cleanup
Remove duplicate 'res' token declarations
2018-11-25 11:13:05 -08:00
Ian Flanigan
9a5bf76b71 Remove duplicate token declaration from plasm.pla
Before this change, there were two declarations for the 'res' token.
Now there is only one.
2018-11-25 17:46:26 +01:00
Ian Flanigan
a8629a4f9a Remove duplicate token declaration from lex.c
Before this change, there were two declarations for the 'res' token.
Now there is only one.
2018-11-25 17:04:21 +01:00
David Schmenk
522703b278 Merge pull request #51 from iflan/addressing
Prefer pointer types in prefix operator parsing
2018-11-18 07:53:08 -08:00
Ian Flanigan
ce0b92bf8c Prefer pointer types in prefix operator parsing
This fixes issue #49 in the simplest way. Before, if the
dereferenced variable was a byte type, the result of the word
pointer dereference operator, `*`, would be a byte type. This
caused `*@a` to return a byte if `a` was a byte type. Now the
pointer type is used instead, causing `*@a` to return a word.

Prefix operator parsing allows some nonsensical constructions,
like `@*x`, but these were already possible before.

Before the output from:
```
include "inc/cmdsys.plh"

byte a
byte b
word x

a = 5
b = 6
x = $55FF
puti(*@a) // 5
putln()
puti(*(@a)) // 1541
putln()
puti(@*a) // 5
putln()
puti(^@x) // 255
putln()
puti(^(@x)) // 255
putln()
puti(@^x) // 255
putln()
done
```
was:
```
5
1541
5
255
255
255
```
now it is:
```
1541
1541
1541
255
255
255
```
2018-11-18 12:15:14 +00:00
David Schmenk
4b03b371b6 Merge pull request #50 from iflan/master
Implement puth in plvm
2018-11-16 16:49:37 -08:00
Ian Flanigan
76d010392a Implement puth in plvm
This change adds a simple implementation of puth() that is just
printf("%04X", i). This corresponds with the native implementations
for both Apple and C64.
2018-11-14 20:25:12 +00:00
David Schmenk
7a5578277f Fix over optimization of immediate opcodes 2018-10-01 16:24:01 -07:00
David Schmenk
3f23acf49c Clean up when/is evaluation 2018-09-26 15:51:35 -07:00
David Schmenk
2d8f2b9b22 Fix JIT16 SEC bug 2018-07-26 16:21:49 -07:00
David Schmenk
34c8a2efa3 Fix Uthernet2 MAC address (doesn't like non-zero MSB) 2018-07-26 11:53:38 -07:00
David Schmenk
fe6742d33e Set retry count back to 4 with longer delay - add debug print to uthernet2 2018-07-22 19:25:28 -07:00
David Schmenk
c789c3249e cleanup formatting 2018-07-21 18:55:25 -07:00
David Schmenk
b5098afbce Merge branch 'master' of https://github.com/dschmenk/PLASMA 2018-07-21 15:57:49 -07:00
David Schmenk
1527eaac24 increse DHCP timeout and add consts for 16 bit JIT ZP values 2018-07-21 15:56:49 -07:00
David Schmenk
0b2caa6931 Clean up directory structure 2018-07-14 08:57:00 -07:00
David Schmenk
5ca23ee898 Add 800K disk image of PLASMA install 2018-07-13 09:49:22 -07:00
David Schmenk
0185e4e5f5 Add new benchmark 2018-07-03 12:03:22 -07:00
David Schmenk
4039c6a3ad Set theme jekyll-theme-hacker 2018-05-28 11:44:18 -07:00
David Schmenk
72533c9ad9 Refix ProDOS clock input buffer 2018-05-27 20:12:26 -07:00
David Schmenk
22f22a382b Fix comments for FETCHOP 2018-05-27 08:13:26 -07:00
David Schmenk
6f8d5810d5 Forgot to bring in fix for ProDOS clock from 1.x 2018-05-26 17:42:06 -07:00
David Schmenk
67829d96cd Make sure prefix is set for AUTORUN 2018-05-26 08:31:05 -07:00
David Schmenk
6320ff0d65 Merge pull request #47 from ZornsLemma/jit-zp-constants-2
Use constants for zero page addresses in JIT
2018-05-16 20:48:09 -07:00
Steven Flintham
872d3d40f9 Use constants for zero page addresses in JIT 2018-05-16 21:31:37 +01:00
Steven Flintham
f59401f767 Use constants for zero page addresses in JIT 2018-05-16 21:28:36 +01:00
David Schmenk
7b2d5df99d Let fileio get JITted again 2018-05-13 06:18:06 -07:00
David Schmenk
52baa5c016 Update README.md 2018-05-08 07:10:13 -07:00
David Schmenk
e6c81e8c8d Fix unhandled IRQ on IIGS 2018-05-07 10:22:28 -07:00
ZornsLemma
660334fd84 Merge pull request #13 from dschmenk/master
Merge latest upstream changes
2018-05-04 23:02:30 +01:00
David Schmenk
92300ab18a update images 2018-05-02 18:31:48 -07:00
David Schmenk
4628eacb78 Update test to use VLB INT 2018-05-02 18:28:39 -07:00
David Schmenk
b34eed7de0 Stop continuous events when mouse button pressed 2018-05-02 13:27:08 -07:00
David Schmenk
fcfb971df3 Generate mouse event when button status changes 2018-05-02 13:13:58 -07:00
David Schmenk
09246e0e40 Update images 2018-05-01 07:36:11 -07:00
David Schmenk
ac021d2120 Merge branch 'master' of https://github.com/dschmenk/PLASMA 2018-05-01 07:33:55 -07:00
David Schmenk
cdc51a5ba8 Rework disk images 2018-05-01 07:33:33 -07:00
David Schmenk
c04c57487e Update Version 1.2.md 2018-04-29 19:24:01 -07:00
David Schmenk
a3223e8eac Merge branch 'master' of https://github.com/dschmenk/PLASMA 2018-04-29 19:21:31 -07:00
David Schmenk
bd3d3dbb6f Update version 2018-04-29 19:21:08 -07:00
David Schmenk
7d076e809f Update README.md 2018-04-29 19:20:13 -07:00
David Schmenk
20756214e2 Update portable VM to current VM ops 2018-04-29 16:52:05 -07:00
David Schmenk
d7e0873c10 Change text file EOL strategy 2018-04-29 14:47:44 -07:00
David Schmenk
1ced9b1a1a fix paths and execute bits for batchfiles 2018-04-29 08:07:35 -07:00
David Schmenk
b1143a2b7e Fix writing xlated data to disk 2018-04-29 07:19:48 -07:00
David Schmenk
2f5bb106bd Break out TFTP copies 2018-04-29 07:15:56 -07:00
David Schmenk
d539ff5b49 Add more files to tftp release batch file 2018-04-28 19:44:43 -07:00
David Schmenk
3d44c8533b Functional mouse API 2018-04-28 18:43:57 -07:00
David Schmenk
78a068e6d2 fix addres of int counters 2018-04-28 17:11:12 -07:00
David Schmenk
3db676c5dd Mouse API test 2018-04-28 13:34:05 -07:00
David Schmenk
67d0762272 Prepare for event manager 2018-04-28 08:00:10 -07:00
David Schmenk
d5f812d878 check for mouse/VBL events 2018-04-28 07:15:56 -07:00
David Schmenk
0f2a76dd55 Fix infunc for asm defs 2018-04-27 19:47:23 -07:00
David Schmenk
d52bf07344 Clen mouse init up 2018-04-27 19:36:01 -07:00
David Schmenk
3eb62ead0d Clean mouse init up 2018-04-27 19:35:26 -07:00
Dave Schmenk
1783aaef7a Fix resetmemfiles, use heap for catalog/volumes, and free CMD init code 2018-04-27 13:06:49 -07:00
David Schmenk
5ab6d915b3 track down mouse int corrption 2018-04-26 20:00:15 -07:00
David Schmenk
d0d328227a Mouse updates 2018-04-25 21:28:05 -07:00
David Schmenk
6ec3ce3b91 Import VM02 mouse driver 2018-04-25 11:25:41 -07:00
Dave Schmenk
b576ea8b85 update images 2018-04-24 20:42:07 -07:00
David Schmenk
1299cbc48b Fix UTHERNET autodetect and code cleanup 2018-04-24 18:56:35 -07:00
David Schmenk
d3a19cccbf Remove xheap from 64K cmdsys. Rework init message 2018-04-24 10:26:48 -07:00
David Schmenk
e6fc45a798 Network error messages and code cleanp 2018-04-23 13:29:54 -07:00
David Schmenk
ea542905b7 Better Uthernet card detection 2018-04-23 12:02:58 -07:00
David Schmenk
fb1f08bcc9 Fix UDP header len for UTHERNET 2018-04-22 14:26:12 -07:00
David Schmenk
8c0e66daf8 Update image 2018-04-21 22:31:59 -07:00
David Schmenk
be9465cd02 Try different fixes 2018-04-21 19:05:37 -07:00
David Schmenk
881c017ac7 update images 2018-04-21 17:54:29 -07:00
David Schmenk
a9607e7476 update images 2018-04-21 17:37:27 -07:00
David Schmenk
4db8271a25 TFTP server and fix FOR/NEXT in module init bug 2018-04-21 16:35:31 -07:00
Dave Schmenk
0a1f497d6c Smaller startup message 2018-04-20 10:05:53 -07:00
Dave Schmenk
ddd5e28fd4 Update startup message 2018-04-20 09:42:01 -07:00
David Schmenk
8d7ed176c5 update images 2018-04-19 16:35:32 -07:00
David Schmenk
912a4526fe LZ4 unpack library and sample lz4cat 2018-04-19 13:41:14 -07:00
David Schmenk
6cf47da936 LZ4 decompressor 2018-04-19 06:59:39 -07:00
David Schmenk
430b70f931 Update memmgr library 2018-04-17 16:15:50 -07:00
David Schmenk
d0eb8a5897 update images with FOR/NEXT changes 2018-04-17 11:11:11 -07:00
David Schmenk
c1d849946f BIG change so FOR/NEXT exits with proper terminal value in variable 2018-04-17 10:39:05 -07:00
David Schmenk
1c63d4832e Update C64 VM 2018-04-16 11:10:51 -07:00
David Schmenk
bef66ae6c0 Fix buggered 65802 JIT optimization 2018-04-15 15:28:20 -07:00
David Schmenk
f32349b849 Buggered that optimization up 2018-04-15 15:25:00 -07:00
David Schmenk
8d119d3d8c Check for H/W/ access on BYTE loads 2018-04-15 14:47:14 -07:00
David Schmenk
bbac311c4f John Brooks Optiizations 2018-04-15 14:34:45 -07:00
David Schmenk
174ff0b7a2 update image` 2018-04-14 13:32:38 -07:00
David Schmenk
45b3560040 Fix compiler allocations for 64K machine 2018-04-14 12:48:12 -07:00
David Schmenk
ed280b3584 Update README.md 2018-04-13 21:47:12 -07:00
David Schmenk
c88d5cabcb update images 2018-04-13 16:14:40 -07:00
David Schmenk
97e2c48098 Fix 64K VM 2018-04-13 16:13:12 -07:00
David Schmenk
0925945d2e Fix VM filename in VMLOAD 2018-04-13 13:34:10 -07:00
David Schmenk
b5c30d524e update images 2018-04-13 12:21:04 -07:00
David Schmenk
3a6c77a4eb Simplify VM configurations and auto-load alternative VMs 2018-04-13 12:09:14 -07:00
David Schmenk
795d56c2a7 Fix SEL JIT16 compiler 2018-04-12 17:15:16 -07:00
David Schmenk
2bb9f73448 Fix INCBRLE and JIT cleanup 2018-04-12 14:20:02 -07:00
David Schmenk
23aaef442d Cleanup 2018-04-11 22:16:30 -07:00
David Schmenk
7f46144911 Working 65802 JIT compiler 2018-04-11 14:48:21 -07:00
David Schmenk
3e4d0bcedf Build jit16 for real 2018-04-11 10:06:57 -07:00
Dave Schmenk
177c951a2d Update images 2018-04-11 07:49:19 -07:00
David Schmenk
11ee2feed5 JIT16 WIP 2018-04-10 21:02:48 -07:00
David Schmenk
07733cc5a6 JIT 65802 WIP 2018-04-10 18:11:35 -07:00
David Schmenk
ce27807cd9 update image 2018-04-09 10:17:29 -07:00
David Schmenk
7fae43e216 Update image 2018-04-09 09:16:02 -07:00
David Schmenk
758f6eb499 Merge branch 'master' of https://github.com/dschmenk/PLASMA 2018-04-09 09:14:05 -07:00
David Schmenk
daf25e990a Running out of disk image space 2018-04-09 09:13:17 -07:00
David Schmenk
f884034786 Update image with SOS.DRIVERS for Mame Apple /// 2018-04-09 08:51:00 -07:00
David Schmenk
8ee09363f0 New Acronym 2018-04-09 08:15:15 -07:00
David Schmenk
f097361b83 Update Version 1.1.md 2018-04-09 07:16:07 -07:00
David Schmenk
b33856ee28 Get 65802 to sort-of run JIT 2018-04-08 14:59:45 -07:00
ZornsLemma
87d43d74ce Merge pull request #12 from dschmenk/master
Merge latest upstream
2018-04-08 15:18:23 +01:00
David Schmenk
61eaeef9c1 Disable JITC on certain modules. 2018-04-07 10:48:11 -07:00
David Schmenk
2241c0c65f Somehow this got lost in the merge 2018-04-07 09:33:22 -07:00
David Schmenk
bc7e38ee17 Merge branch 'devel' 2018-04-07 09:27:21 -07:00
David Schmenk
dad0f4b4d5 Add NO-JITC flag to module SYSFLAGS 2018-04-06 17:53:51 -07:00
David Schmenk
fd641bef8f JIT specific module loading 2018-04-06 14:22:39 -07:00
David Schmenk
11dc4abcda 65802 JITC placeholders 2018-04-06 12:45:34 -07:00
David Schmenk
82a4b57c43 65802 requires 128K and JITC 2018-04-06 12:42:48 -07:00
David Schmenk
2a015d98cf Update images 2018-04-06 09:13:55 -07:00
David Schmenk
625ce2704e Sync cleanjit with jitcore 2018-04-06 08:25:42 -07:00
David Schmenk
f35f0b3bba Fix OBO in branch calc loop and free up bytes to re-enable LLA opt 2018-04-06 08:05:23 -07:00
David Schmenk
e3606f3f64 Fix byte variable used in negative FOR/NEXT 2018-04-05 11:51:53 -07:00
David Schmenk
558290100c Clear MSB for DLB/DAB 2018-04-05 11:20:43 -07:00
David Schmenk
5285f99a03 Merge branch 'devel' of https://github.com/dschmenk/PLASMA into devel 2018-04-04 20:20:16 -07:00
David Schmenk
6c6dca3348 re-arrange a few things 2018-04-04 20:19:35 -07:00
David Schmenk
87a0b24d7a image update 2018-04-04 17:44:52 -07:00
David Schmenk
8b649b0d48 fix opcode skip for CS in branch detection 2018-04-04 13:25:13 -07:00
David Schmenk
9a82e3b5fb Looking for one more JITC bug 2018-04-03 13:56:55 -07:00
David Schmenk
3e0d81d09d Put buffer at beginning of SBANK 2018-04-03 10:10:41 -07:00
Dave Schmenk
763cbd6986 Full 4K JIT codebuffer 2018-04-02 21:46:53 -07:00
David Schmenk
347aa5329d Leave buffer for maxcode and assembly defcpy 2018-04-02 15:41:41 -07:00
David Schmenk
9e4f9936af Cleanup 2018-04-02 13:51:04 -07:00
David Schmenk
d0215eb7e1 Allocate proper size for defentries 2018-04-02 12:36:44 -07:00
David Schmenk
58eb615176 Remove JITC puts from JIT module 2018-04-02 10:17:33 -07:00
David Schmenk
e5e43f58b7 Save/Restore JIT code ptr 2018-04-02 10:02:17 -07:00
David Schmenk
77ca9b2813 Re-org some JIT <-> CMDSYS <-> VM connections 2018-04-02 09:17:18 -07:00
David Schmenk
d4f15e3a90 Apple /// JITC 2018-04-02 08:47:16 -07:00
David Schmenk
574911e389 Apple /// JIT WIP 2018-04-01 18:53:56 -07:00
David Schmenk
46b24b077a Break out cor JIT for all platforms 2018-04-01 15:29:57 -07:00
David Schmenk
46b9f073d5 New JIT defaults 2018-03-31 17:15:18 -07:00
David Schmenk
630ccd88fa Improve LLA opts a little 2018-03-31 15:13:13 -07:00
David Schmenk
53a992debb Update images 2018-03-30 13:23:52 -07:00
David Schmenk
51ba2df618 Move JIT compiler to top of AUX memory 2018-03-30 13:12:39 -07:00
David Schmenk
cccfdbb9a7 Combine similar opcodes to shring module size to ~8K (keep clean version) 2018-03-30 09:52:35 -07:00
David Schmenk
f11a1470f0 Allocate seq buffer on heap and keep ints disabled durin aux memory move 2018-03-29 21:44:40 -07:00
David Schmenk
43a03d2882 Make sure all buffers on heap are allocated 2018-03-29 21:07:08 -07:00
David Schmenk
3fe85c5835 Make sure to always allocate data on heap - it can get overwritten by JIT 2018-03-29 20:00:06 -07:00
David Schmenk
f7b1d6c3fb Tracking Y register WIP 2018-03-29 17:14:27 -07:00
David Schmenk
b5885dfe8f Better tracking of Y register WIP 2018-03-29 12:19:49 -07:00
David Schmenk
148031d192 Make SIEVE JITable 2018-03-29 07:58:31 -07:00
David Schmenk
3968f82625 Lose the JIT warmup count 2018-03-28 17:02:26 -07:00
David Schmenk
208be4da1f Update images 2018-03-28 16:30:18 -07:00
David Schmenk
b72e592c9a Fix SEL tests 2018-03-28 11:51:04 -07:00
Dave Schmenk
5e049ebe8e Fix CS destination jump 2018-03-27 22:13:58 -07:00
David Schmenk
7cd9c00706 Fix SELect default branch 2018-03-27 20:00:49 -07:00
David Schmenk
369e9731f4 Source cleanup 2018-03-27 19:21:27 -07:00
David Schmenk
1e05ab789e Finished updating ops $B0-$BE 2018-03-27 14:02:09 -07:00
David Schmenk
169d347754 Make sure A_IS_TOSL is cleared at opt fence 2018-03-27 10:12:13 -07:00
David Schmenk
818a2b14ea Update ops $A0-$AE 2018-03-26 16:51:09 -07:00
David Schmenk
15c779d63b Update ops $90-$9E 2018-03-26 11:04:45 -07:00
David Schmenk
4717e01862 Fix SUB typo 2018-03-26 06:58:44 -07:00
David Schmenk
9922127a41 Updates ops $80-$8E 2018-03-25 23:03:29 -07:00
David Schmenk
26a03d8e0b Update ops $70-$7E 2018-03-25 20:20:19 -07:00
David Schmenk
8f5d4647bf Update ops $60-$6E 2018-03-25 17:31:07 -07:00
David Schmenk
08e41bf472 Update ops $50-$5E 2018-03-25 13:53:53 -07:00
David Schmenk
23779176d2 Update ops $40-$4E 2018-03-24 21:37:52 -07:00
David Schmenk
2c9373c962 WIP opcodes $40-$4E 2018-03-24 17:17:06 -07:00
David Schmenk
6cfb957df4 Rework ops $30-$3E 2018-03-24 17:04:21 -07:00
David Schmenk
1bf3c7043f Fix LLA 2018-03-24 16:37:47 -07:00
David Schmenk
8adc03d640 Rework ops $20-$2E 2018-03-24 15:47:05 -07:00
David Schmenk
27a2d8d0b7 Start more efficient coding for writing native code to buffer 2018-03-24 10:02:14 -07:00
David Schmenk
efd1ff58e3 Fix ISLE 2018-03-23 17:13:42 -07:00
David Schmenk
8b1ca4bf1e Fix DLW TOSL_DIRTY 2018-03-23 16:05:39 -07:00
David Schmenk
3c72bb9df3 Better TOSL cache checks 2018-03-23 12:31:17 -07:00
David Schmenk
36c2506a24 Move max code buffer down a smidge 2018-03-23 11:33:01 -07:00
David Schmenk
72a7996871 Fix optimization fences and BROR/BRAND/DUP/DLW 2018-03-23 11:26:25 -07:00
Dave Schmenk
56f6d783e2 JIT optimizations fixes 2018-03-22 21:53:49 -07:00
David Schmenk
9be1bd5eb8 Change sense of test to take advantage of Y=0 2018-03-22 16:50:18 -07:00
David Schmenk
a7ecdc7edc Save a few bytes so we can test JIT 2018-03-22 16:38:05 -07:00
David Schmenk
7b201b4392 Optimizing JIT WIP 2018-03-22 16:11:06 -07:00
David Schmenk
cdb0dac92f Fix SEL and SUBI 2018-03-22 12:23:25 -07:00
Dave Schmenk
81574a8a62 JIT tuning parameters 2018-03-21 22:31:06 -07:00
David Schmenk
8c18a28e49 JIT WIP 2018-03-21 20:54:16 -07:00
David Schmenk
71d17a99e4 Fix immediate value loads 2018-03-21 18:24:15 -07:00
David Schmenk
cb7f86a911 Order DFD by address 2018-03-21 16:23:32 -07:00
David Schmenk
fa71ec3948 Fix ENTER/LEAVE 2018-03-21 14:01:17 -07:00
David Schmenk
e16f45f59b First pass at JIT 2018-03-21 13:00:23 -07:00
David Schmenk
3afd11fd03 New code translations 2018-03-20 21:01:59 -07:00
David Schmenk
3fc34fe028 Parsing bytecode to compile 2018-03-20 16:54:44 -07:00
David Schmenk
9701c00d1e Merge branch 'devel' of https://github.com/dschmenk/PLASMA into devel 2018-03-20 14:19:42 -07:00
David Schmenk
4dcc033ed0 Invokable JIT compiler version 2018-03-20 14:19:17 -07:00
David Schmenk
d392cbca9c Slight improvement to return address calc for ICAL/CALL 2018-03-19 15:21:15 -07:00
David Schmenk
4577983799 Update images 2018-03-18 16:26:09 -07:00
David Schmenk
b3c05c9797 Case-ify more of the editor if/ifelse/else 2018-03-18 15:49:55 -07:00
David Schmenk
571e8d8eb0 All out speed CFFB 2018-03-18 14:31:36 -07:00
David Schmenk
1a8f3048b5 Verify REL module tyoe before loading 2018-03-18 13:47:14 -07:00
David Schmenk
5a0d9e5751 VerifyREL module filetype before trying to load 2018-03-18 13:38:13 -07:00
David Schmenk
309f5d45b0 Shuffle routines around based on available INTERP mem 2018-03-18 13:23:39 -07:00
David Schmenk
6d2336a343 Update image 2018-03-17 19:14:42 -07:00
David Schmenk
caebedc1e5 Working Apple 3 again 2018-03-17 19:07:36 -07:00
David Schmenk
773e0d0af0 update images 2018-03-17 17:14:21 -07:00
David Schmenk
f7cf0be03e more cmdsys rearrangement 2018-03-17 16:51:00 -07:00
David Schmenk
0d1b2d5db9 Update images 2018-03-17 15:58:41 -07:00
David Schmenk
a9237f58cc Sync cmd exported sysroutines 2018-03-17 15:52:15 -07:00
David Schmenk
3356cdd036 Break out cmd into module 2018-03-17 15:06:31 -07:00
David Schmenk
95e15e4b86 Better CASE END 2018-03-17 09:46:13 -07:00
David Schmenk
3975e54c29 Update image 2018-03-17 08:48:51 -07:00
David Schmenk
d379cefe2a 6502 caseblock early exit test 2018-03-17 08:44:02 -07:00
Dave Schmenk
c02bcd413d BYTE size variables 2018-03-16 22:42:57 -07:00
David Schmenk
463db3c170 Fix 65802 caseblock early exit 2018-03-16 20:44:09 -07:00
David Schmenk
68479c1606 Fix Y adjust on cse early exit 2018-03-16 19:08:13 -07:00
David Schmenk
5c9bc34844 Fix check for duplicate CASE and updates images 2018-03-16 16:57:42 -07:00
David Schmenk
423ca66fc0 No need for SANDBOX anymore. Tests for codeblock on 65802 2018-03-16 16:36:39 -07:00
David Schmenk
010750efed Early exit caseblock if value less than ordered list 2018-03-16 15:14:58 -07:00
David Schmenk
ec0fdde747 Order caseblock values in ascending order 2018-03-16 14:52:27 -07:00
ZornsLemma
55711af895 Merge pull request #11 from dschmenk/master
Merge latest upstream changes
2018-03-16 21:36:05 +00:00
David Schmenk
bbbe2d0d38 opcode statistics 2018-03-16 09:57:01 -07:00
David Schmenk
4af5c37dea Update images 2018-03-16 07:41:17 -07:00
David Schmenk
d165509293 Allow CONST/PREDEF before IMPORT 2018-03-16 07:39:42 -07:00
David Schmenk
d485654d0e Update images 2018-03-16 07:06:17 -07:00
David Schmenk
f9a007398f CASE checking and limit to 64 cases on self-hosted compiler 2018-03-16 07:00:22 -07:00
Dave Schmenk
b987b927d3 Merge branch 'devel' of https://github.com/dschmenk/PLASMA into devel 2018-03-15 21:54:32 -07:00
Dave Schmenk
5fc2807ace BREQ/BRNE optimizations 2018-03-15 21:54:11 -07:00
David Schmenk
7ffe5a6767 Update images 2018-03-15 11:24:35 -07:00
David Schmenk
b8714745dd Add BRGT/BRLT FOR/NEXT optimization 2018-03-15 11:16:58 -07:00
David Schmenk
c07bc8172c Shrink a few bytes to fit 2018-03-15 07:59:16 -07:00
David Schmenk
3d84a2192c BREQ and BRNE ops 2018-03-14 21:34:55 -07:00
David Schmenk
934b04ae56 Update images 2018-03-14 19:19:01 -07:00
David Schmenk
53c832da58 Fix ADDx ops 2018-03-14 18:43:21 -07:00
David Schmenk
b145f82a9d Faster ADDx ops 2018-03-14 17:22:12 -07:00
David Schmenk
852b5b7268 Update images 2018-03-14 12:30:51 -07:00
David Schmenk
0045d0eabb Remove debug prints 2018-03-14 11:59:39 -07:00
David Schmenk
518b4e2680 local and absolute address ADDs 2018-03-14 11:56:16 -07:00
David Schmenk
c2ee311517 Merge branch 'master' of https://github.com/dschmenk/PLASMA 2018-03-13 18:09:49 -07:00
David Schmenk
28571b4a35 Fix #%$&^! optimizer bug 2018-03-13 18:09:14 -07:00
David Schmenk
c3f9ee0911 Save a few more bytes in the VM 2018-03-13 16:02:08 -07:00
David Schmenk
8b6f54e956 Update README.md 2018-03-13 11:24:27 -07:00
David Schmenk
46b0c2c041 Version 1.1 2018-03-13 11:22:10 -07:00
Dave Schmenk
ba1734dd25 Update images 2018-03-13 10:30:59 -07:00
Dave Schmenk
d515ab5969 Update images 2018-03-13 10:28:04 -07:00
Dave Schmenk
2da878889b Reduce makefile noise for OSX too 2018-03-13 10:23:01 -07:00
Dave Schmenk
28d1ad252a Fix for makefile noise for OSX 2018-03-13 09:41:58 -07:00
Dave Schmenk
19bacbc7ea Reduce noise doesn't work on OSX 2018-03-13 09:39:46 -07:00
Dave Schmenk
6f75211e7e Reduce makefile noise 2018-03-13 09:29:51 -07:00
David Schmenk
e280ae190b Merge pull request #39 from ZornsLemma/quieter-makefile
Reduce makefile noise
2018-03-13 16:27:40 +00:00
Dave Schmenk
af44d7ee9a Fix sign of divmod 2018-03-13 09:22:17 -07:00
Dave Schmenk
5d531f53b1 Fix sign of mod and divmod 2018-03-13 09:19:18 -07:00
David Schmenk
35539e8f6e Update test case, portable VM WIP 2018-03-13 08:16:01 -07:00
David Schmenk
8730e2ff9a Update test cases and portable VM 2018-03-13 07:48:34 -07:00
David Schmenk
6bbc5b6381 Fix mod sign 2018-03-12 20:47:07 -07:00
David Schmenk
e77aceb4ea Assembly helper function for lex scanner ID/keyword match 2018-03-12 15:21:36 -07:00
David Schmenk
f5a94313f2 Add assembly helper for lexical scanner ID/Keyword match 2018-03-12 15:13:35 -07:00
David Schmenk
76fd2328d9 Compiler bugfixes 2018-03-10 19:00:01 -08:00
David Schmenk
214f9c163d Update images 2018-03-10 18:55:24 -08:00
David Schmenk
4f11cad955 Update XBYTE in SELect 2018-03-10 15:45:01 -08:00
David Schmenk
20790d2dbb Make sure sequnce opcode is invalidated for gen_ctag 2018-03-10 15:38:57 -08:00
David Schmenk
023030831c Sync all VMs and update images 2018-03-10 08:30:39 -08:00
Dave Schmenk
9dbb1671a4 Update images 2018-03-09 20:40:50 -08:00
David Schmenk
ce29a7c361 65802 bug fixes 2018-03-09 19:50:31 -08:00
David Schmenk
b0a9cb3e0e Update images 2018-03-07 20:05:17 -08:00
Dave Schmenk
3d9c54adbf 65802 VM updates 2018-03-06 22:24:42 -08:00
David Schmenk
25599c00c8 Apple 3 VM updates 2018-03-06 19:20:59 -08:00
Dave Schmenk
2e952bfde3 New FOR/NEXT changes for terminal variable value 2018-03-05 22:14:49 -08:00
David Schmenk
a8553cfdb7 re-arrange some ops 2018-03-05 15:40:43 -08:00
David Schmenk
f3ef1b4820 Enable 65C02 ConstantNybble 2018-03-05 12:19:47 -08:00
David Schmenk
334bf1ec4d Nybble constants encoded in opcode 2018-03-05 11:38:16 -08:00
David Schmenk
eff01c5f12 Short circuit AND/OR 2018-03-05 10:55:19 -08:00
David Schmenk
6de120ec89 New WHEN/IS for hosted compiler 2018-03-05 08:58:21 -08:00
David Schmenk
3ee19e86f6 SWITCH/CASE table optimization 2018-03-04 21:36:23 -08:00
David Schmenk
e1090c012c Better WHILE/LOOP 2018-03-04 15:00:40 -08:00
David Schmenk
18301b6ce9 Adjust to new for/next 2018-03-04 14:21:40 -08:00
David Schmenk
5b41fd07c4 More work on for/next 2018-03-04 13:15:02 -08:00
Dave Schmenk
2b2e464c9b More immidiate ops, add/sub next branches 2018-03-04 10:18:31 -08:00
Dave Schmenk
793b1760a0 Constant op codes 2018-03-03 18:55:39 -08:00
Steven Flintham
f633944e48 Tweak makefile to avoid noisy no-op builds
Without this, typing 'make' when there's nothing to do generates
slightly scary-looking output.
2018-03-03 15:47:00 +00:00
ZornsLemma
70eb667db9 Merge pull request #10 from dschmenk/master
Merge latest upstream
2018-03-03 15:45:34 +00:00
Dave Schmenk
28f6e11606 Don't over-copy 65C02 routines 2018-03-02 21:54:03 -08:00
Dave Schmenk
40c3dcd197 Better FOR/NEXT ops 2018-03-02 21:43:09 -08:00
Dave Schmenk
8f408c8bbb more robust MB check 2018-02-26 19:32:20 -08:00
David Schmenk
8ebe11621a Better MockingBoard detection 2018-02-26 11:31:59 -08:00
David Schmenk
b96c08fb59 Update Version 1.0.md 2018-02-26 06:41:03 -08:00
David Schmenk
0b37080b64 Update Version 1.0.md 2018-02-26 06:40:42 -08:00
David Schmenk
86408f5157 First Commodore 64 version! 2018-02-24 18:11:06 -08:00
David Schmenk
c5d4d7d35f Update images for Apple 3 sound sequencer 2018-02-24 12:29:47 -08:00
David Schmenk
b6bb431ac2 Remove apple II-isms from sndseq 2018-02-24 10:28:52 -08:00
David Schmenk
e79d17c14a Update images 2018-02-23 18:25:16 -08:00
David Schmenk
47217c0d93 Add some useful links 2018-02-23 17:47:32 -08:00
David Schmenk
03923a9825 Uthernet II found! Fix HTTPD! 2018-02-23 17:11:55 -08:00
David Schmenk
6eb842e472 More precision for axis 2018-02-23 15:23:42 -08:00
David Schmenk
ea5bdccb82 Joystick dual axis read + buzz in constant time 2018-02-23 09:29:22 -08:00
David Schmenk
44e307325c Create rel directories 2018-02-22 08:09:37 -08:00
Dave Schmenk
e241719ea5 Update line drawer with new PLASMA-isms 2018-02-21 09:53:11 -08:00
David Schmenk
4204d47d3c formatting 2018-02-21 09:44:59 -08:00
Dave Schmenk
56c033fe58 Clean up samplesrc 2018-02-21 07:31:52 -08:00
Dave Schmenk
da8fce2f96 Don't want built binaries in repo 2018-02-21 07:27:00 -08:00
Dave Schmenk
ac78dad38f Seed Commodore 64 code 2018-02-21 07:25:22 -08:00
Dave Schmenk
eb4bb099f1 Get proper link for plvmzp.inc established 2018-02-20 22:56:55 -08:00
Dave Schmenk
3a448329d0 opy ED from rel 2018-02-20 22:38:46 -08:00
Dave Schmenk
3fbf2e4fbd Support multiple architecture ports 2018-02-20 17:27:44 -08:00
Dave Schmenk
a2c83dfdc0 Update images 2018-02-19 16:22:40 -08:00
David Schmenk
efe08f8ea7 Save a couple bytes and sync label names 2018-02-17 10:34:09 -08:00
David Schmenk
f266f1c035 Apple 3 graphics demo 2018-02-12 12:12:16 -08:00
David Schmenk
c9a5b25194 Apple /// graphics library 2018-02-11 21:46:21 -08:00
David Schmenk
5c56020c2b Apple /// graphics libary 2018-02-11 21:45:31 -08:00
David Schmenk
02760f1038 Thanks SteveF! 2018-02-10 19:33:48 -08:00
ZornsLemma
5b9212be82 Merge pull request #9 from dschmenk/master
Merge latest upstream changes
2018-02-10 23:40:04 +00:00
David Schmenk
dd4ecb77b3 Apple /// and ][ editor tweaks 2018-02-10 10:39:30 -08:00
David Schmenk
1fce2f5916 Apple /// and ][ editor keyboard tweaks 2018-02-10 10:09:33 -08:00
David Schmenk
9ee760007a PLASM patch #2 2018-02-09 20:39:05 -08:00
David Schmenk
474f0a9017 PLASM type override bug :-( 2018-02-09 20:17:13 -08:00
David Schmenk
c786d4aaf8 Merge branch 'master' of https://github.com/dschmenk/PLASMA 2018-02-09 14:17:07 -08:00
David Schmenk
ebff3ebc07 Allocate all interp bank. Check path during set_pfx 2018-02-09 14:16:06 -08:00
David Schmenk
3d1d82d8fc Update image 2018-02-08 18:49:23 -08:00
David Schmenk
7af5d53fbb Allow Apple3 heap allocator to skip graphics memory 2018-02-08 18:46:50 -08:00
David Schmenk
b986e1da38 PLASM compiler patch #1 2018-02-07 12:01:55 -08:00
ZornsLemma
5a48384daa Merge pull request #8 from dschmenk/master
Merge latest upstream changes
2018-01-27 20:52:50 +00:00
ZornsLemma
9174cfef2a Merge pull request #7 from dschmenk/master
Merge latest upstream changes
2018-01-16 20:53:39 +00:00
ZornsLemma
aef3daccb5 Merge pull request #6 from dschmenk/master
Merge latest upstream changes
2017-12-17 17:50:50 +00:00
168 changed files with 34695 additions and 6115 deletions

157
LICENSE.md Normal file
View File

@@ -0,0 +1,157 @@
### GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
<https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates the
terms and conditions of version 3 of the GNU General Public License,
supplemented by the additional permissions listed below.
#### 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the
GNU General Public License.
"The Library" refers to a covered work governed by this License, other
than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
#### 1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
#### 2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
- a) under this License, provided that you make a good faith effort
to ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
- b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
#### 3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from a
header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
- a) Give prominent notice with each copy of the object code that
the Library is used in it and that the Library and its use are
covered by this License.
- b) Accompany the object code with a copy of the GNU GPL and this
license document.
#### 4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken
together, effectively do not restrict modification of the portions of
the Library contained in the Combined Work and reverse engineering for
debugging such modifications, if you also do each of the following:
- a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
- b) Accompany the Combined Work with a copy of the GNU GPL and this
license document.
- c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
- d) Do one of the following:
- 0) Convey the Minimal Corresponding Source under the terms of
this License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
- 1) Use a suitable shared library mechanism for linking with
the Library. A suitable mechanism is one that (a) uses at run
time a copy of the Library already present on the user's
computer system, and (b) will operate properly with a modified
version of the Library that is interface-compatible with the
Linked Version.
- e) Provide Installation Information, but only if you would
otherwise be required to provide such information under section 6
of the GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the Application
with a modified version of the Linked Version. (If you use option
4d0, the Installation Information must accompany the Minimal
Corresponding Source and Corresponding Application Code. If you
use option 4d1, you must provide the Installation Information in
the manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.)
#### 5. Combined Libraries.
You may place library facilities that are a work based on the Library
side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
- a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities, conveyed under the terms of this License.
- b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
#### 6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
as you received it specifies that a certain numbered version of the
GNU Lesser General Public License "or any later version" applies to
it, you have the option of following the terms and conditions either
of that published version or of any later version published by the
Free Software Foundation. If the Library as you received it does not
specify a version number of the GNU Lesser General Public License, you
may choose any version of the GNU Lesser General Public License ever
published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

Binary file not shown.

Binary file not shown.

Binary file not shown.

113
README.md
View File

@@ -1,12 +1,17 @@
# 2/6/2018 PLASMA 1.0 Available!
[Download and read the Release Notes](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%201.0.md)
# 7/4/2020 PLASMA 2.0 Alpha 1 Available!
[Download and read the Release Notes](https://github.com/dschmenk/PLASMA/releases)
[Change List](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%202.0.md#changes-in-plasma-for-20-alpha-1)
# 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)
# The PLASMA Programming Language
![Luc Viatour](https://upload.wikimedia.org/wikipedia/commons/thumb/2/26/Plasma-lamp_2.jpg/1200px-Plasma-lamp_2.jpg)
image credit: Luc Viatour / www.Lucnix.be
PLASMA: **P**roto **L**anguage **A**s**S**e**M**bler for **A**pple
PLASMA: **P**roto **L**anguage **A**s**S**e**M**bler for **A**ll
PLASMA is a medium level programming language targeting the 8-bit 6502 processor. Historically, there were simple languages developed in the early years of computers that improved on the tedium of assembly language programming while still being low level enough for system coding. Languages like B, FORTH, and PLASMA fall into this category.
@@ -94,7 +99,7 @@ Different projects have led to the architecture of PLASMA, most notably Apple Pa
- [Call Stack](#call-stack)
- [Local Frame Stack](#local-frame-stack)
- [Local String Pool](#local-string-pool)
- [The Bytecodes](#the-bytecodes)
- [The Bytecodes](https://github.com/dschmenk/PLASMA/wiki/PLASMA-Byte-Codes)
- [Apple 1 PLASMA](#apple-1-plasma)
- [Apple II PLASMA](#apple-ii-plasma)
- [Apple /// PLASMA](#apple--plasma)
@@ -106,7 +111,7 @@ Different projects have led to the architecture of PLASMA, most notably Apple Pa
## PLASMA Cross-Compiler
The first step in writing PLASMA code is to get a build environment working. If you have Unix-like environment, then this is a fairly easy exercise. Windows users may want to install the [Cygwin](https://www.cygwin.com/) environment to replicate a Unix-like environment under Windows. When installing Cygwin, make sure **gcc-core**, **make**, and **git** are installed under the **Devel** packages. Mac OS X users may have to install the **Xcode** from the App Store.
The first step in writing PLASMA code is to get a build environment working. If you have Unix-like environment, then this is a fairly easy exercise. Windows users may want to install the [Linux Subsystem for Windows](https://docs.microsoft.com/en-us/windows/wsl/install-win10) or the [Cygwin](https://www.cygwin.com/) environment to replicate a Unix-like environment under Windows. When installing Cygwin, make sure **gcc-core**, **make**, and **git** are installed under the **Devel** packages. Mac OS X users may have to install the **Xcode** from the App Store. Linux users should make sure the development packages are installed.
Launch the command-line/terminal application for your environment to download and build PLASMA. Create a source code directory and change the working directory to it, something like:
@@ -518,7 +523,7 @@ else
fin
```
The `when`/`is`/`otherwise`/`wend` statement is similar to the `if`/`elsif`/`else`/`fin` construct except that it is more efficient. It selects one path based on the evaluated expressions, then merges the code path back together at the end. Only the `when` value is compared against a list of expressions. The expressions do not need to be constants, they can be any valid expression. The list of expressions is evaluated in order, so for efficiency sake, place the most common cases earlier in the list. Just as in C programs, a `break` statement is required to keep one clause from falling through to the next. Falling through from one clause to the next can have its uses, so this behavior has been added to PLASMA.
The `when`/`is`/`otherwise`/`wend` statement is similar to the `if`/`elsif`/`else`/`fin` construct except that it is more efficient. It selects one path based on the evaluated expressions, then merges the code path back together at the end. Only the `when` value is compared against a list of constant. Just as in C programs, a `break` statement is required to keep one clause from falling through to the next. Falling through from one clause to the next can have its uses, so this behavior has been added to PLASMA.
```
when keypressed
@@ -1139,7 +1144,7 @@ The common `if` test can have optional `elsif` and/or `else` clauses. Any expres
#### WHEN/IS/[OTHERWISE]/WEND
The complex test case is handled with `when`. Basically an `if`, `elsif`, `else` list of comparisons, it is generally more efficient. The `is` value can be any expression. It is evaluated and tested for equality to the `when` value.
The complex test case is handled with `when`. Basically an `if`, `elsif`, `else` list of comparisons, it is generally more efficient. The `is` value must be a constant.
```
when key
@@ -1162,26 +1167,6 @@ when key
wend
```
With a little "Yoda-Speak", some fairly complex test can be made:
```
const FALSE = 0
const TRUE = NOT FALSE
byte a
when TRUE
is (a <= 10)
// 10 or less
break
is (a > 10) AND (a < 20)
// between 10 and 20
break
is (a >= 20)
// 20 or greater
wend
```
A `when` clause can fall-through to the following clause, just like C `switch` statements by leaving out the `break`.
#### FOR \<TO,DOWNTO\> [STEP]/NEXT
@@ -1313,80 +1298,6 @@ One of the biggest problems to overcome with the 6502 is its very small hardware
Any function that uses in-line strings may have those strings copied to the local string pool for usage. This allows string literals to exist in the same memory as the bytecode and only copied to main memory when used. The string pool is deallocated along with the local frame stack when the function exits.
### The Opcodes
The compact code representation comes through the use of opcodes closely matched to the PLASMA compiler. They are:
| OPCODE | Name | Description
|:------:|:------:|-----------------------------------
| $00 | ZERO | push zero on the stack
| $02 | ADD | add top two values, leave result on top
| $04 | SUB | subtract next from top from top, leave result on top
| $06 | MUL | multiply two topmost stack values, leave result on top
| $08 | DIV | divide next from top by top, leave result on top
| $0A | MOD | divide next from top by top, leave remainder on top
| $0C | INCR | increment top of stack
| $0E | DECR | decrement top of stack
| $10 | NEG | negate top of stack
| $12 | COMP | compliment top of stack
| $14 | AND | bit wise AND top two values, leave result on top
| $16 | IOR | bit wise inclusive OR top two values, leave result on top
| $18 | XOR | bit wise exclusive OR top two values, leave result on top
| $1A | SHL | shift left next from top by top, leave result on top
| $1C | SHR | shift right next from top by top, leave result on top
| $02 | IDXB | add top of stack to next from top, leave result on top (ADD)
| $1E | IDXW | add 2X top of stack to next from top, leave result on top
| $20 | NOT | logical NOT of top of stack
| $22 | LOR | logical OR top two values, leave result on top
| $24 | LAND | logical AND top two values, leave result on top
| $26 | LA | load address
| $28 | LLA | load local address from frame offset
| $2A | CB | constant byte
| $2C | CW | constant word
| $2E | CS | constant string
| $30 | DROP | drop top stack value
| $32 | DUP | duplicate top stack value
| $34 | NOP |
| $36 | DIVMOD | divide next from to by top, leave result and remainder on stack
| $38 | BRGT | branch next from top greater than top
| $3A | BRLT | branch next from top less than top
| $3C | BREQ | branch next from top equal to top
| $3E | BRNE | branch next from top not equal to top
| $40 | ISEQ | if next from top is equal to top, set top true
| $42 | ISNE | if next from top is not equal to top, set top true
| $44 | ISGT | if next from top is greater than top, set top true
| $46 | ISLT | if next from top is less than top, set top true
| $48 | ISGE | if next from top is greater than or equal to top, set top true
| $4A | ISLE | if next from top is less than or equal to top, set top true
| $4C | BRFLS | branch if top of stack is zero
| $4E | BRTRU | branch if top of stack is non-zero
| $50 | BRNCH | branch to address
| $52 | IBRNCH | branch to address on stack top
| $54 | CALL | sub routine call with stack parameters
| $56 | ICAL | sub routine call to address on stack top with stack parameters
| $58 | ENTER | allocate frame size and copy stack parameters to local frame
| $5A | LEAVE | deallocate frame and return from sub routine call
| $5C | RET | return from sub routine call
| $5E | CFFB | constant with $FF MSB
| $60 | LB | load byte from top of stack address
| $62 | LW | load word from top of stack address
| $64 | LLB | load byte from frame offset
| $66 | LLW | load word from frame offset
| $68 | LAB | load byte from absolute address
| $6A | LAW | load word from absolute address
| $6C | DLB | duplicate top of stack into local byte at frame offset
| $6E | DLW | duplicate top of stack into local word at frame offset
| $70 | SB | store next from top of stack byte into top address
| $72 | SW | store next from top of stack word into top address
| $74 | SLB | store top of stack into local byte at frame offset
| $76 | SLW | store top of stack into local word at frame offset
| $78 | SAB | store top of stack into byte at absolute address
| $7A | SAW | store top of stack into word at absolute address
| $7C | DAB | duplicate top of stack into byte at absolute address
| $7E | DAW | duplicate top of stack into word at absolute address
The opcodes were developed over time by starting with a very basic set of operations and slowly adding opcodes when the PLASMA compiler could improve code density or performance.
## Apple 1 PLASMA
Obviously the Apple 1 is a little more constrained than most machines PLASMA is targeting. But, with the required addition of the CFFA1 (http://dreher.net/?s=projects/CFforApple1&c=projects/CFforApple1/main.php), the Apple 1 gets 32K of RAM and a mass storage device. Enough to run PLASMA and load/execute modules.

Binary file not shown.

View File

@@ -2,8 +2,8 @@ WELCOME TO THE PLASMA EDITOR!
=============================
FIRST THINGS FIRST:
TO NAVIGATE, USE THE ARROW KEYS. ON THE
APPLE ][:
TO NAVIGATE, USE THE ARROW KEYS. ON
THE APPLE ][:
CTRL-K = UP
CTRL-J = DOWN.
@@ -18,80 +18,125 @@ TO JUMP AROUND THE TEXT FILE USE:
CTRL-Q = JUMP BEGINNING
CTRL-E = JUMP END
THE 'ESCAPE' KEY WILL PUT YOU IN COMMAND
MODE. FROM THERE YOU CAN EXIT BY
ENTERING 'Q' AND 'RETURN'. YOU CAN ALSO
RETURN TO THE EDITOR BY JUST PRESSING
'RETURN'.
THE 'ESCAPE' KEY WILL PUT YOU IN
COMMAND MODE. FROM THERE YOU CAN
EXIT BY ENTERING 'Q' AND 'RETURN'.
YOU CAN ALSO RETURN TO THE EDITOR BY
JUST PRESSING 'RETURN'.
-------
THE PLASMA EDITOR IS A SIMPLE TEXT
EDITOR FOR ENTERING AND MANIPULATING
TEXT AND SOURCE CODE FILES. THE EDITOR
ONLY SUPPORTS 40 COLUMN TEXT ALTHOUGH
LINES CAN BE UP TO 79 CHARACTERS LONG.
THE SCREEN WILL SCROLL HORIZONTALLY
AS THE CURSOR MOVES. THERE IS 16K OF
MEMORY FOR THE TEXT BUFFER.
TEXT AND SOURCE CODE FILES. THE
EDITOR ONLY SUPPORTS 40 COLUMN TEXT
ALTHOUGH LINES CAN BE UP TO 79
CHARACTERS LONG. THE SCREEN WILL
SCROLL HORIZONTALLY AS THE CURSOR
MOVES. THERE IS 16K OF MEMORY FOR
THE TEXT BUFFER.
IT HAS TWO MODES, COMMAND AND EDIT.
EDIT COMMANDS:
EDIT COMMANDS:
LEFT ARROW = MOVE CHAR LEFT
RIGHT ARROW = MOVE CHAR RIGHT
UP ARROW = MOVE LINE UP
DOWN ARROW = MOVE LINE DOWN
CTRL-K = MOVE LINE UP
CTRL-J = MOVE LINE DOWN
CTRL-A = JUMP LEFT
CTRL-S = JUMP RIGHT
CTRL-W = JUMP UP
CTRL-Z = JUMP DOWN
CTRL-Q = JUMP BEGIN
CTRL-E = JUMP END
CTRL-D = DELETE CHAR
CTRL-X = DELETE LINE
CTRL-V = COPY DELETED LINE
CTRL-O = OPEN NEW LINE
CTRL-F = OPEN A FOLLOWING NEW LINE
CTRL-T = JOIN LINES
CTRL-I = TOGGLE INSERT/OVERWRITE
ESCAPE = SWITCH TO COMMAND MODE
LEFT ARROW = MOVE CHAR LEFT
RIGHT ARROW = MOVE CHAR RIGHT
UP ARROW = MOVE LINE UP
DOWN ARROW = MOVE LINE DOWN
CTRL-K = MOVE LINE UP
CTRL-J = MOVE LINE DOWN
CTRL-A = JUMP LEFT
CTRL-S = JUMP RIGHT
CTRL-W = JUMP UP
CTRL-Z = JUMP DOWN
CTRL-Q = JUMP BEGIN
CTRL-E = JUMP END
CTRL-D = DELETE CHAR
CTRL-B = BEGIN SELECTION
CTRL-C = COPY SELECTION INTO CLIPBOARD
CTRL-X = CUT SELECTION INTO CLIPBOARD
CTRL-V = PASTE CLIPBOARD
CTRL-O = OPEN NEW LINE
CTRL-F = OPEN A FOLLOWING NEW LINE
CTRL-T = JOIN LINES
CTRL-Y = TOGGLE INSERT/OVERWRITE
TAB/CTRL-I = INSERT SPACES TO NEXT TAB
= INDENT SELECTION IF INSERT MODE
= UNDENT SELECTION IF OVERWITE MODE
ESCAPE = SWITCH TO COMMAND MODE
DELETE = DELETE CHAR LEFT
APPLE ][ FEATURES:
------------------
SHIFT-M = ]
CTRL-N = [
CTRL-P = _
CTRL-B = |
CTRL-Y = ~
CTRL-L = SHIFT LOCK
SHIFT-M = ]
CTRL-N = [
SHIFT-CTRL-N = ~
CTRL-P = \
SHIFT-CTRL-P = |
CTRL-G = _
CTRL-L = SHIFT LOCK
SHIFT-LEFT ARROW = DELETE (SHIFT-MOD)
WITH THE SHIFT-KEY MOD ON AN
APPLE ][, UPPER AND LOWER CASE
ENTRY WORKS AS EXPECTED.
CTRL-C = FORCE LOWER-CASE CHARS
ESC T C = FORCE LOWER-CASE CHARS
IF YOU HAVE A LOWER-CASE CHARACTER
GENERATOR INSTALLED, YOU CAN FORCE
LOWER-CASE DISPLAY. OTHERWISE,
UPPER CASE WILL BE DISPLAYED NORMALLY
BUT lower-case will be displayed in
If you have a lower-case character
generator installed, you can force
lower-case display. Otherwise,
upper case will be displayed normally
but lower-case will be displayed in
inverse. This is the default.
Apple //e AND //c FEATURES:
---------------------------
THE 'CLOSED-APPLE' KEY WILL MODIFY
THE ARROW KEYS INTO THEIR JUMP
EQUIVALENTS. IT WILL ALSO MODIFY
THE 'RETURN' KEY TO OPEN UP A LINE,
JUST LIKE CTRL-F.
The 'SOLID-APPLE' key will modify
theese keys:
COMMAND MODE:
SA-RETURN = OPEN FOLLOWING LINE
SA-LEFT ARROW = JUMP LEFT
SA-RIGHT ARROW = JUMP RIGHT
SA-UP ARROR = JUMP UP
SA-DOWN ARROW = JUMP DOWN
SA-TAB = DETAB
Apple /// FEATURES:
-------------------
The 'OPEN-APPLE' key will modify
these keys:
OA-\ = DELETE CHAR LEFT
OA-RETURN = OPEN FOLLOWING LINE
OA-LEFT ARROW = JUMP LEFT
OA-RIGHT ARROW = JUMP RIGHT
OA-UP ARROR = JUMP UP
OA-DOWN ARROW = JUMP DOWN
OA-TAB = DETAB
On the keypad, 'OPEN-APPLE' allows
the keys for navigation and misc:
OA-4 = MOVE CHAR LEFT
OA-6 = MOVE CHAR RIGHT
OA-8 = MOVE LINE UP
OA-2 = MOVE LINE DOWN
OA-9 = JUMP UP
OA-3 = JUMP DOWN
OA-7 = JUMP BEGIN
OA-1 = JUMP END
OA-5 = DELETE CHAR
OA-- = CUT SELECTION INTO CLIPBOARD
OA-0 = PASTE CLIPBOARD
OA-ENTER = OPEN FOLLOWING LINE
OA-. = TOGGLE INSERT/OVERWRITE
COMMAND MODE:
<REQUIRED PARAMETER>
[OPTIONAL PARAMETER]
@@ -104,5 +149,9 @@ IT HAS TWO MODES, COMMAND AND EDIT.
P <PREFIX> = SET PREFIX
H [SLOT] = HARDCOPY TO DEVICE IN SLOT (DEFAULT 1)
N = CLEAR TEXT IN MEMORY
T G = TOGGLE GUTTER VIEW
T C = TOGGLE LOWER-CASE SUPPORT (APPLE ][)
G <LINE> = GO TO LINE #
F [STRING] = FIND STRING
E = EDIT MODE
'RETURN' = EDIT MODE

View File

@@ -1,16 +1,16 @@
# PLASMA Version 1.0
# PLASMA Version 1.2
Welcome to PLASMA: the Grand Unifying Platform for the Apple 1, ][, and ///.
Download the four disk images (three if you don't plan to boot an Apple ///):
[PLASMA 1.0 System](https://github.com/dschmenk/PLASMA/blob/master/PLASMA-SYS1.PO?raw=true)
[PLASMA 1.2 System and ProDOS Boot](https://github.com/dschmenk/PLASMA/blob/ver-1/PLASMA-SYS1.PO?raw=true)
[PLASMA 1.0 Build Tools](https://github.com/dschmenk/PLASMA/blob/master/PLASMA-BLD1.PO?raw=true)
[PLASMA 1.2 Build Tools](https://github.com/dschmenk/PLASMA/blob/ver-1/PLASMA-BLD1.PO?raw=true)
[PLASMA 1.0 Demos](https://github.com/dschmenk/PLASMA/blob/master/PLASMA-DEM1.PO?raw=true)
[PLASMA 1.2 Demos](https://github.com/dschmenk/PLASMA/blob/ver-1/PLASMA-DEM1.PO?raw=true)
[PLASMA 1.0 Apple /// SOS Boot ](https://github.com/dschmenk/PLASMA/blob/master/PLASMA-SOS1.PO?raw=true)
[PLASMA 1.2 Apple /// SOS Boot ](https://github.com/dschmenk/PLASMA/blob/ver-1/PLASMA-SOS1.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):
@@ -98,6 +98,22 @@ There is a [YouTube playlist](https://www.youtube.com/playlist?list=PLlPKgUMQbJ7
- The documentation is sparse and incomplete. Yep, could use your help...
# 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:

276
doc/Version 2.0.md Normal file
View File

@@ -0,0 +1,276 @@
# PLASMA Version 2.0 Alpha 1
Welcome to PLASMA: the Grand Unifying Platform for the Apple 1, ][, and ///.
Download the five disk images:
[PLASMA 2.0 Alpha1 800K Full System](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2.2mg?raw=true)
[PLASMA 2.0 Alpha1 System and ProDOS Boot](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-SYS.PO?raw=true)
[PLASMA 2.0 Alpha1 Build Tools](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-BLD.PO?raw=true)
[PLASMA 2.0 Alpha1 Demos](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-DEM.PO?raw=true)
[PLASMA 2.0 Alpha1 TCP/IP network modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-INET.PO?raw=true)
[PLASMA 2.0 Alpha1 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.0 Alpha1 Apple /// Mame hard disk image](https://github.com/dschmenk/PLASMA/blob/master/images/apple/apple3.hd?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):
System Files => /HARDISK/PLASMA/
Build Files => /HARDISK/PLASMA/BLD/
Demo Files => /HARDISK/PLASMA/DEMOS/
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. The PLASMA.SOS floppy should be updated with the SOS.DRIVER configured for your machine. It contains the SOS.DRIVER configured for the Apple 3 Ready-To-Run Mame environment. 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]
```
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.
## 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.
## 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. It is a WIP, with updates every week or so
## 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.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

BIN
images/apple/PLASMA2-BLD.PO Normal file

Binary file not shown.

BIN
images/apple/PLASMA2-DEM.PO Normal file

Binary file not shown.

Binary file not shown.

BIN
images/apple/PLASMA2-SYS.PO Executable file

Binary file not shown.

BIN
images/apple/PLASMA2.2mg Normal file

Binary file not shown.

BIN
images/apple/SFM.PO Normal file

Binary file not shown.

BIN
images/apple/TFTPD.PO Normal file

Binary file not shown.

BIN
images/apple/apple3.hd Normal file

Binary file not shown.

BIN
images/c64/PLASMA.D64 Normal file

Binary file not shown.

View File

@@ -1 +0,0 @@
CONST FALSE = 0

View File

@@ -2,7 +2,7 @@ import cmdsys
//
// Useful values for everyone
//
const _SYSVER_ = $0100 // Version built against
const _SYSVER_ = $0200 // Version built against
const FALSE = 0
const TRUE = not FALSE
const NULL = 0
@@ -33,6 +33,7 @@ import cmdsys
const reshgr2 = $0020
const resxhgr1 = $0040
const resxhgr2 = $0080
const nojitc = $0100
//
// Module don't free memory
//
@@ -46,8 +47,15 @@ import cmdsys
word syspath
word cmdline
word modexec
byte refcons
byte devcons
word sysopen
word sysclose
word sysread
word syswrite
byte syserr
byte jitcount
byte jitsize
byte refcons // Apple /// specific
byte devcons // Apple /// specific
end
//
// CMD exported functions

View File

@@ -1,16 +0,0 @@
import dgr
word[] dgrbuff
predef dgrPlot(buff, x, y)#0
predef dgrHLin(buff, x1, x2, y)#0
predef dgrVLin(buff, x, y1, y2)#0
predef dgrBLT(buff, x, y, width, height, src)#0
predef dgrTile(buff, x, y, src)#0
predef dgrTileStr(buff, x, y, tilestr, strlen, tilebuff)#0
predef dgrFill(buff, x, y, tile)#0
predef dgrMode#1
predef txtMode#0
predef dgrShow(page)#1
predef dgrColor(clr)#0
predef dgrLine(buff, x1, y1, x2, y2)#0
predef dgrClear(buff, clr)#0
end

15
src/inc/dgrlib.plh Normal file
View File

@@ -0,0 +1,15 @@
import dgrlib
predef dgrPlot(x, y)#0
predef dgrHLin(x1, x2, y)#0
predef dgrVLin(y1, y2, x)#0
predef dgrBLT(x, y, width, height, src)#0
predef dgrTile(x, y, src)#0
predef dgrTileStr(x, y, tilestr, strlen, tilebuff)#0
predef dgrFill(x, y, tile)#0
predef dgrClear(clr)#0
predef dgrMode(mode)#1
predef dgrShow(page)#1
predef dgrSwap#0
predef dgrDrawBuf(page)#0
predef dgrColor(clr)#0
end

View File

@@ -18,7 +18,27 @@ import fileio
const FILE_ERR_INT_TBL_FULL = $25
const FILE_ERR_IO = $27
//
// File entry struc
//
struc t_fileentry
byte store_namelen
byte entry_name[15]
byte entry_type
word entry_keyptr
word entry_blocks
word entry_EOFL
byte entry_EOFH
word entry_create[2]
byte entry_version
byte entry_minver
byte entry_access
word entry_aux
word entry_mod[2]
word entry_headptr
end
//
// File info struc
//
struc t_fileinfo
byte file_access
byte file_type
@@ -37,7 +57,9 @@ import fileio
word getpfx
word setpfx
word getfileinfo
word setfileinfo
word geteof
word seteof
word iobufalloc
word open
word close
@@ -45,7 +67,9 @@ import fileio
word write
word create
word destroy
word rename
word newline
word online
word readblock
word writeblock
end

14
src/inc/grafix.plh Normal file
View File

@@ -0,0 +1,14 @@
import grafix
predef pencolor(clr)#0
predef fillcolor(clr)#0
predef fillscreen()#0
predef penmove(x, y)#0
predef plot(x, y)#0
predef line(x1, y1, x2, y2)#0
predef lineto(x, y)#0
predef rect(x1, y1, x2, y2)#0
predef fillrect(x1, y1, x2, y2)#0
predef bitblt(blk, pitch, x, y, width, height)#0
predef drawmode(mode)#0
predef setmode(mode)#0
end

15
src/inc/grlib.plh Normal file
View File

@@ -0,0 +1,15 @@
import grlib
predef grPlot(x, y)#0
predef grHLin(x1, x2, y)#0
predef grVLin(y1, y2, x)#0
predef grBLT(x, y, width, height, src)#0
predef grTile(x, y, src)#0
predef grTileStr(x, y, tilestr, strlen, tilebuff)#0
predef grFill(x, y, tile)#0
predef grClear(clr)#0
predef grMode(mode)#1
predef grShow(page)#1
predef grSwap#0
predef grDrawBuf(page)#0
predef grColor(clr)#0
end

3
src/inc/hgrfont.plh Normal file
View File

@@ -0,0 +1,3 @@
import hgrfont
predef hgrPutStr(x, y, strptr)#0
end

24
src/inc/hgrlib.plh Normal file
View File

@@ -0,0 +1,24 @@
import hgrlib
predef divmod7(x)#2
predef hgrPlot(x, y)#0
predef hgrOrPlot(x, y)#0
predef hgrXorPlot(x, y)#0
predef hgrHLin(x1, x2, y)#0
predef hgrVLin(y1, y2, x)#0
predef hgrXorHLin(x1, x2, y)#0
predef hgrXorVLin(y1, y2, x)#0
predef hgrRect(x1, y1, x2, y2)#0
predef hgrXorRect(x1, y1, x2, y2)#0
predef hgrBLT(x, y, width, height, srcptr)#0
predef hgrCopySrc(ofst, y, w, h, srcptr)#0
predef hgrAndSrc(ofst, y, w, h, srcptr)#0
predef hgrXorSrc(ofst, y, w, h, srcptr)#0
predef hgrOrSrc(ofst, y, w, h, srcptr)#0
predef hgrCopyDst(ofst, y, w, h, dstptr)#0
predef hgrMode(mode)#1
predef hgrClear#0
predef hgrShow(page)#1
predef hgrSwap#1
predef hgrDrawBuf(page)#1
predef hgrColor(clr)#0
end

19
src/inc/hgrsprite.plh Normal file
View File

@@ -0,0 +1,19 @@
import hgrsprite
predef spriteCompile(w, h, xcenter, ycenter, srcptr)#1
predef spriteDup(sprtsrc)#1
predef spriteRead(filestr)#1
predef spriteSave(filestr, sprtptr)#1
predef spriteDraw(sprtptr)#0
predef spriteDrawXor(sprtptr)#0
predef spriteUnDraw(sprtptr)#0
predef spriteUnDrawXor(sprtptr)#0
predef spritePos(x, y, sprtptr)#0
predef spritePosIndex(x, y, i)#0
predef spriteUnDrawList#0
predef spriteUnDrawXorList#0
predef spriteDrawList#0
predef spriteDrawXorList#0
predef spriteAdd(i, sprtptr)#1
predef spriteDel(i)#1
predef spriteDrawBuf(page)#1
end

13
src/inc/hgrtile.plh Normal file
View File

@@ -0,0 +1,13 @@
import hgrtile
predef tileDraw(x, y, tileptr)#0
predef tileXorDraw(x, y, tileptr)#0
predef tileOrDraw(x, y, tileptr)#0
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

32
src/inc/int32.plh Normal file
View File

@@ -0,0 +1,32 @@
import int32
const t_i32 = 4
predef zero32#0
predef zext16to32#0
predef neg32#0
predef load32(i32ptr)#0
predef loadi16(imm16)#0
predef store32(i32ptr)#0
predef add32(i32ptr)#0
predef addi16(imm16)#0
predef sub32(i32ptr)#0
predef subi16(imm16)#0
predef shl32(imm8)#0
predef shr32(imm8)#0
predef mul32(i32ptr)#0
predef muli16(imm16)#0
predef div32(i32ptr)#2
predef divi16(imm16)#2
predef iseq32(i32ptr)#1
predef iseqi16(imm16)#1
predef isge32(i32ptr)#1
predef isgei16(imm16)#1
predef isle32(i32ptr)#1
predef islei16(imm16)#1
predef isgt32(i32ptr)#1
predef isgti16(imm16)#1
predef islt32(i32ptr)#1
predef islti16(imm16)#1
predef i32tos(i32ptr, strptr)#1
predef puti32(i32ptr)#0
end

4
src/inc/joybuzz.plh Normal file
View File

@@ -0,0 +1,4 @@
import joybuzz
const MAX_JOY = 79
predef joypos(buzz)#4
end

6
src/inc/lines.plh Normal file
View File

@@ -0,0 +1,6 @@
import lines
predef setlinespans(h, v)#0
predef linespans(x1, y1, x2, y2)#0
predef setlineplot(p)#0
predef line(x1, y1, x2, y2)#0
end

3
src/inc/lz4.plh Normal file
View File

@@ -0,0 +1,3 @@
import lz4
predef lz4Unpack(seq, seqend, buff, buffend)
end

5
src/inc/matchfiles.plh Normal file
View File

@@ -0,0 +1,5 @@
import matchfiles
predef matchName(src, exp)#1
predef matchList(pathptr, exp)#2
predef isWildName(exp)#1
end

32
src/inc/mouse.plh Normal file
View File

@@ -0,0 +1,32 @@
import mouse
//
// Status bits
//
const BUTTON_DOWN = $80
const BUTTON_LAST_DOWN = $40
const MOUSE_MOVED = $20
const VBL_INT = $08
const BUTTON_INT = $04
const MOVE_INT = $02
//
// Mode bits
//
const VBL_INT_ENABLE = $08
const BUTTON_INT_ENABLE= $04
const MOVE_INT_ENABLE = $02
const MOUSE_ENABLE = $01
//
// Mouse API
//
struc t_mouse
word chkVBL
word chkMouse
word readMouse // readMouse()#3
word setMouse // setMouse(mode)
word clearMouse
word posMouse // posMouse(x, y)
word clampMouse // clampMouse(xMin, xMax, yMin, yMax)
word homeMouse
word detachMouse
end
end

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,5 @@
include "inc/cmdsys.plh"
sysflags nojitc // Keep tone() from compiling and sounding different
//
// Handy constants.
//

View File

@@ -1,5 +1,4 @@
include "inc/cmdsys.plh"
sysflags restxt1|restxt2|resxtxt1|resxtxt2 // Reserve all text pages
//
// Apple II hardware constants.
//
@@ -24,13 +23,15 @@ const page2 = 1
//
// Screen row address arrays.
//
word[] dgr1rows = $0400,$0480,$0500,$0580,$0600,$0680,$0700,$0780
word = $0428,$04A8,$0528,$05A8,$0628,$06A8,$0728,$07A8
word = $0450,$04D0,$0550,$05D0,$0650,$06D0,$0750,$07D0
word[] dgr2rows = $0800,$0880,$0900,$0980,$0A00,$0A80,$0B00,$0B80
word = $0828,$08A8,$0928,$09A8,$0A28,$0AA8,$0B28,$0BA8
word = $0850,$08D0,$0950,$09D0,$0A50,$0AD0,$0B50,$0BD0
export word[] dgrbuff = @dgr1rows, @dgr2rows
word[] dgr1row = $0400,$0480,$0500,$0580,$0600,$0680,$0700,$0780
word = $0428,$04A8,$0528,$05A8,$0628,$06A8,$0728,$07A8
word = $0450,$04D0,$0550,$05D0,$0650,$06D0,$0750,$07D0
word[] dgr2row = $0800,$0880,$0900,$0980,$0A00,$0A80,$0B00,$0B80
word = $0828,$08A8,$0928,$09A8,$0A28,$0AA8,$0B28,$0BA8
word = $0850,$08D0,$0950,$09D0,$0A50,$0AD0,$0B50,$0BD0
word[] dgrbuff = @dgr1row, @dgr2row
word drawbuff
byte drawpage
//
// Color mapping.
//
@@ -49,13 +50,13 @@ end
//
// Plot pixel
//
export asm dgrPlot(buff, x, y)#0
; GET BUFFER ADDRESS
STX ESP
LDA ESTKL+2,X
export asm dgrPlot(x, y)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
STA SRCL
LDA ESTKH+2,X
STA SRCH
LDA $3001
STA SRCH
STX ESP
LDA ESTKL,X ; Y COORD
AND #$FE
TAY
@@ -76,22 +77,21 @@ asm _dgrPlotPix
LDX ESP
INX
INX
INX
RTS
end
//
// Plot horizontal row of pixels
//
export asm dgrHLin(buff, x1, x2, y)#0
; GET BUFFER ADDRESS
STX ESP
LDA ESTKL+3,X
export asm dgrHLin(x1, x2, y)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
STA SRCL
LDA ESTKH+3,X
STA SRCH
LDA $3001
STA SRCH
STX ESP
LDA ESTKL+1,X ; X2 COORD
STA TMPH
LDA ESTKL,X ; Y COORD
LDA ESTKL+0,X ; Y COORD
AND #$FE
TAY
LDA (SRC),Y
@@ -102,7 +102,7 @@ export asm dgrHLin(buff, x1, x2, y)#0
LDY ESTKL+2,X ; X1 COORD
PHP
SEI
- LDA ESTKL,X
- LDA ESTKL+0,X ; Y COORD
LSR
TYA
LDX GCLR ; COLOR
@@ -119,20 +119,19 @@ asm _dgrHLinPix
INX
INX
INX
INX
RTS
end
//
// Plot horizontal row of pixels
//
export asm dgrVLin(buff, x, y1, y2)#0
; GET BUFFER ADDRESS
STX ESP
LDA ESTKL+3,X
export asm dgrVLin(y1, y2, x)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
STA SRCL
LDA ESTKH+3,X
STA SRCH
LDA ESTKL+1,X ; Y1 COORD
LDA $3001
STA SRCH
STX ESP
LDA ESTKL+2,X ; Y1 COORD
PHP
SEI
- AND #$FE
@@ -142,38 +141,38 @@ export asm dgrVLin(buff, x, y1, y2)#0
INY
LDA (SRC),Y
STA GBASH
LDA ESTKL+1,X
LDA ESTKL+2,X
LSR
LDA ESTKL+2,X ; X COORD
LDA ESTKL+0,X ; X COORD
LDX GCLR ; COLOR
end
asm _dgrVLinPix
JSR $3000 ; _dgrSetPix
LDX ESP
INC ESTKL+1,X ; Y1 COORD
LDA ESTKL+1,X
CMP ESTKL,X ; Y2 COORD
INC ESTKL+2,X ; Y1 COORD
LDA ESTKL+2,X
CMP ESTKL+1,X ; Y2 COORD
BCC -
BEQ -
PLP
INX
INX
INX
INX
RTS
end
//
// Draw sprite
//
export asm dgrBLT(buff, x, y, width, height, src)#0
export asm dgrBLT(x, y, width, height, src)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
STA DSTL
LDA $3001
STA DSTH
LDA ESTKL,X ; SPRITE
STA SRCL
LDA ESTKH,X
STA SRCH
LDA ESTKL+5,X
STA DSTL
LDA ESTKH+5,X
STA DSTH
LDA ESTKL+4,X ; X1 COORD
CMP #80
BPL ++++
@@ -197,9 +196,8 @@ export asm dgrBLT(buff, x, y, width, height, src)#0
CLC
ADC ESTKL+2,X ; WIDTH
STA SRCL
LDA SRCH
ADC #$00
STA SRCH
BCC +++
INC SRCH
BNE +++
+ AND #$FE
TAY
@@ -245,7 +243,6 @@ asm _dgrBLTPix
INX
INX
INX
INX
RTS
end
//
@@ -326,16 +323,17 @@ end
//
// Draw 8x8 tile (forced to 2x2 block address)
//
export asm dgrTile(buff, x, y, src)#0
export asm dgrTile(x, y, src)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
STA DSTL
LDA $3001
STA DSTH
STX ESP
LDA ESTKL,X ; TILE
STA SRCL
LDA ESTKH,X
STA SRCH
LDA ESTKL+3,X
STA DSTL
LDA ESTKH+3,X
STA DSTH
LDA ESTKL+2,X ; X1 COORD
CMP #80
BPL ++++
@@ -357,9 +355,8 @@ export asm dgrTile(buff, x, y, src)#0
LDA SRCL ; SKIP TO NEXT ROW
ADC #$07 ; CARRY = 1
STA SRCL
LDA SRCH
ADC #$00
STA SRCH
BCC +++
INC SRCH
BNE +++
+ AND #$FE
TAY
@@ -392,9 +389,9 @@ export asm dgrTile(buff, x, y, src)#0
STA (GBASE),Y
++ INC TMPH ; X COORD
INC TMPH ; X COORD
LDX ESP
LDA TMPH
BMI --
LDX ESP
CMP ESTKH+2,X ; X2 COORD
BCC --
PLP
@@ -405,7 +402,6 @@ export asm dgrTile(buff, x, y, src)#0
CMP ESTKH+1,X ; Y2 COORD
BCC -
++++ INX
INX
INX
INX
RTS
@@ -413,22 +409,17 @@ end
//
// Draw a string of tiles
//
export asm dgrTileStr(buff, x, y, tilestr, strlen, tilebuff)#0
export asm dgrTileStr(x, y, tilestr, strlen, tilebuff)#0
- DEX
DEX
DEX
DEX
LDA ESTKL+9,X ; BUFF
STA ESTKL+3,X
LDA ESTKH+9,X
STA ESTKH+3,X
LDA ESTKL+8,X ; X COORD
LDA ESTKL+7,X ; X COORD
STA ESTKL+2,X
LDA ESTKL+7,X ; Y COORD
LDA ESTKL+6,X ; Y COORD
STA ESTKL+1,X
LDA ESTKL+4,X ; TILE
LDA ESTKL+3,X ; TILE
STA ESTKL,X
LDA ESTKH+4,X ; TILE
LDA ESTKH+3,X ; TILE
STA ESTKH,X
end
asm _dgrTileTile
@@ -441,16 +432,17 @@ asm _dgrTileTile
STA ESTKL+4,X
DEC ESTKL+1,X ; DEC STRLEN
BNE -
+ TXA
CLC
ADC #6
TAX
+ INX
INX
INX
INX
INX
RTS
end
//
// Fill a buffer with tiles
//
export asm dgrFill(buff, x, y, tile)#0
export asm dgrFill(x, y, tile)#0
LDA ESTKL+2,X
AND #$0F
STA ESTKL+2,X
@@ -469,18 +461,13 @@ export asm dgrFill(buff, x, y, tile)#0
- DEX
DEX
DEX
DEX
LDA ESTKL+7,X ; BUFF
STA ESTKL+3,X
LDA ESTKH+7,X
STA ESTKH+3,X
LDA ESTKL+6,X ; X COORD
LDA ESTKL+5,X ; X COORD
STA ESTKL+2,X
LDA ESTKL+5,X ; Y COORD
LDA ESTKL+4,X ; Y COORD
STA ESTKL+1,X
LDA ESTKL+4,X ; TILE
LDA ESTKL+3,X ; TILE
STA ESTKL,X
LDA ESTKH+4,X ; TILE
LDA ESTKH+3,X ; TILE
STA ESTKH,X
end
asm _dgrFillTile
@@ -502,11 +489,10 @@ asm _dgrFillTile
INX
INX
INX
INX
RTS
end
//
// Wait for VLB - Doens't work on //c
// Wait for VLB - Only IIe/IIGS.
//
asm vlbWait#0
- LDA $C019
@@ -515,24 +501,59 @@ asm vlbWait#0
BPL -
RTS
end
// Wait for VBL on IIc is entirely different from others.
// Setup, one-time *only* if polling will be used exclusively.
// Otherwise requires restoring the mode on exit,
// and setting up per-use instead.
// [php]
// sei ; otherwise interrupt is still raised
// sta $C07F ; enable access to VBL register
// sta $C05B ; enable VBL polling
// sta $C07E ; disable access to VBL register
//
// Set double lores graphics, return draw buffer
// wait for VBL:
// - bit $C019
// bpl -
// lda $C070 ; $c019 bit 7 is sticky, reset it
//
export def dgrMode#1
^showlores
^showfull
^showgraphics
^showpage1
^ena80 = 0
^show80 = 0
// ^mapaux = 0
^an3on
return 1
// To allow other methods of VBL, restore access:
// - bit $C019
// bpl -
// lda $C070 ; $c019 bit 7 is sticky, reset it
// sta $C07F ; enable access to VBL register
// sta $C05A ; disable VBL polling
// sta $C07E ; disable access to VBL register
// [plp]
//
// Clear the buffer
//
export def dgrClear(clr)#0
byte[32] clrtile
clr = evnclr[clr&$0F] | (oddclr[clr&$0F] << 8)
memset(@clrtile, clr, 32)
dgrFill(0, 0, @clrtile)
end
//
// Set text mode
//
export def txtMode#0
export def dgrMode(mode)#1
if mode
//
// Set double lores graphics, return draw buffer
//
^showlores
^showfull
^showgraphics
^showpage1
^ena80 = 0
^show80 = 0
^an3on
drawpage = 1
drawbuff = dgrbuff[1]
return 1
fin
//
// Set text mode
//
^showtext
^showpage1
^ena80 = 0
@@ -540,6 +561,7 @@ export def txtMode#0
^mapmain = 0
^an3off
call($FC58, 0, 0, 0, 0) // home()
return 0
end
//
// Set display page, return other page
@@ -549,6 +571,15 @@ export def dgrShow(page)#1
^(showpage1 + page)
return page ^ 1
end
export def dgrSwap#0
^(showpage1 + drawpage)
drawpage = drawpage ^ 1
drawbuff = dgrbuff[drawpage]
end
export def dgrDrawBuf(page)#0
drawpage = page
drawbuff = dgrbuff[drawpage]
end
//
// Set color for clear & plot routines
//
@@ -556,101 +587,6 @@ export def dgrColor(clr)#0
^$30 = clr & $0F
end
//
// Draw line
//
export def dgrLine(buff, x1, y1, x2, y2)#0
byte dx, dy, dx2, dy2, pp
word sx, sy, err, dd2
if x1 < x2
sx = 1
dx = x2 - x1
else
sx = -1
dx = x1 - x2
fin
if y1 < y2
sy = 1
dy = y2 - y1
else
sy = -1
dy = y1 - y2
fin
dx2 = dx << 1
dy2 = dy << 1
if dx >= dy
// Horizontal line
if sx < 0
pp = x1
x1 = x2
x2 = pp
pp = y1
y1 = y2
y2 = pp
sy = -sy
fin
dd2 = dx2 - dy2
err = dx - dy2
sx = 1
while dy
if err < 0
dgrHLin(buff, x1, x1 + sx - 1, y1)
x1 = x1 + sx
y1 = y1 + sy
sx = 1
dy--
err = err + dd2
else
sx++
err = err - dy2
fin
loop
if y2 == y1
dgrHLin(buff, x1, x2, y1)
fin
else
// Vertical line
if sy < 0
pp = x1
x1 = x2
x2 = pp
pp = y1
y1 = y2
y2 = pp
sx = -sx
fin
dd2 = dy2 - dx2
err = dy - dx2
sy = 1
while dx
if err < 0
dgrVLin(buff, x1, y1, y1 + sy - 1)
x1 = x1 + sx
y1 = y1 + sy
sy = 1
dx--
err = err + dd2
else
sy++
err = err - dx2
fin
loop
if x2 == x1
dgrVLin(buff, x1, y1, y2)
fin
fin
end
//
// Clear the buffer
//
export def dgrClear(buff, clr)#0
byte[32] clrtile
clr = evnclr[clr&$0F] | (oddclr[clr&$0F] << 8)
memset(@clrtile, clr, 32)
dgrFill(buff, 0, 0, @clrtile)
end
//
// Make sure we are a 128K //e or //c
//
if MACHID & $F0 <> $B0
@@ -672,6 +608,19 @@ _dgrSetEvnEvn:1 = @evnclr
_dgrSetEvnOdd:1 = @oddclr
_dgrSetOddEvn:1 = @evnclr
_dgrSetOddOdd:1 = @oddclr
//
// Fixups for drawbuff
//
dgrPlot:1 = @drawbuff
dgrPlot:6 = @drawbuff+1
dgrHLin:1 = @drawbuff
dgrHLin:6 = @drawbuff+1
dgrVLin:1 = @drawbuff
dgrVLin:6 = @drawbuff+1
dgrBLT:1 = @drawbuff
dgrBLT:6 = @drawbuff+1
dgrTile:1 = @drawbuff
dgrTile:6 = @drawbuff+1
// Put read AUX mem routine in scary location
memcpy($0100, @auxRead, 9)
done

View File

@@ -26,7 +26,9 @@ struc t_fileio
word getpfx
word setpfx
word getfileinfo
word setfileinfo
word geteof
word seteof
word iobufalloc
word open
word close
@@ -34,20 +36,22 @@ struc t_fileio
word write
word create
word destroy
word rename
word newline
word online
word readblock
word writeblock
end
predef a2getpfx(path), a23setpfx(path), a2getfileinfo(path, fileinfo), a23geteof(refnum), a2iobufs(iobufs), a2open(path), a2close(refnum)
predef a23read(refnum, buf, len), a2write(refnum, buf, len), a2create(path, type, aux), a23destroy(path)
predef a2newline(refnum, emask, nlchar), a2readblock(unit, buf, block), a2writeblock(unit, buf, block)
predef a2getpfx(path), a23setpfx(path), a2getfileinfo(path, fileinfo), a2setfileinfo(path, fileinfo), a23geteof(refnum)#2, a23seteof(refnum, eofl, eofh), a2iobufs(iobufs), a2open(path), a2close(refnum)
predef a23read(refnum, buf, len), a2write(refnum, buf, len), a2create(path, type, aux), a23destroy(path), a23rename(path, newpath)
predef a2newline(refnum, emask, nlchar), a2online(unit, buf), a2readblock(unit, buf, block), a2writeblock(unit, buf, block)
//
// Exported function table.
//
word fileio[]
word = @a2getpfx, @a23setpfx, @a2getfileinfo, @a23geteof, @a2iobufs, @a2open, @a2close
word = @a23read, @a2write, @a2create, @a23destroy
word = @a2newline, @a2readblock, @a2writeblock
word = @a2getpfx, @a23setpfx, @a2getfileinfo, @a2setfileinfo, @a23geteof, @a23seteof, @a2iobufs, @a2open, @a2close
word = @a23read, @a2write, @a2create, @a23destroy, @a23rename
word = @a2newline, @a2online, @a2readblock, @a2writeblock
//
// SOS/ProDOS error code
//
@@ -117,17 +121,53 @@ def a3getfileinfo(path, fileinfo)
perr = syscall($C4, @params)
return perr
end
def a1geteof(refnum)
return 0
def a1setfileinfo(path, fileinfo)
perr = $01
return perr
end
def a23geteof(refnum)
def a2setfileinfo(path, fileinfo)
byte params[14]
params.0 = 7
params:1 = path
memcpy(@params + 3, fileinfo, 11)
perr = syscall($C3, @params)
return perr
end
def a3setfileinfo(path, fileinfo)
byte params[6]
params.0 = 3
params:1 = path
params:3 = fileinfo
params.5 = 15
perr = syscall($C3, @params)
return perr
end
def a1geteof(refnum)#2
return 0, 0
end
def a23geteof(refnum)#2
byte params[5]
params.0 = 2
params.1 = refnum
params:2 = 0
params:4 = 0
params.4 = 0
syscall($D1, @params)
return params:2, params.4
end
def a1seteof(refnum, eofl, eofh)
return 0
end
def a23seteof(refnum, eofl, eofh)
byte params[5]
params.0 = 2
params.1 = refnum
params:2 = eofl
params.4 = eofh
syscall($D0, @params)
return params:2
end
def a1open(path)
@@ -258,7 +298,7 @@ def a3write(refnum, buff, len)
params:2 = buff
params:4 = len
perr = syscall($CB, @params)
return perr
return perr ?? 0 :: len
end
def a1create(path, type, aux)
return perr
@@ -271,7 +311,7 @@ def a2create(path, type, aux)
params.3 = $C3
params.4 = type
params:5 = aux
params.7 = $1
params.7 = type == $0F ?? $0D :: $01
params:8 = 0
params:10 = 0
perr = syscall($C0, @params)
@@ -284,13 +324,15 @@ def a3create(path, type, aux)
params.0 = 3
params:1 = path
params:3 = @options
params.5 = 3
params.5 = 4
options.0 = type
options:1 = aux
options.3 = type == $0F ?? $0D :: $01
perr = syscall($C0, @params)
return perr
end
def a1destroy(path)
perr = $01
return perr
end
def a23destroy(path)
@@ -301,6 +343,19 @@ def a23destroy(path)
perr = syscall($C1, @params)
return perr
end
def a1rename(oldpath, newpath)
perr = $01
return perr
end
def a23rename(path, newpath)
byte params[5]
params.0 = 2
params:1 = path
params:3 = newpath
perr = syscall($C2, @params)
return perr
end
def a1newline(refnum, emask, nlchar)
return perr
end
@@ -324,6 +379,57 @@ def a3newline(refnum, emask, nlchar)
perr = syscall($C9, @params)
return perr
end
def a1online(unit, buf)
perr = $27 // IOERR
return perr
end
def a2online(unit, buf)
byte params[4]
params.0 = 2
params.1 = unit
params:2 = buf
perr = syscall($C5, @params)
return perr
end
def a3volume(unit, volname)
byte devname[17]
byte info[11]
byte params[9]
^volname = 0
params.0 = 4
params.1 = unit
params:2 = @devname
params:4 = @info
params.6 = 11
if syscall($85, @params) == 0
params.0 = 4
params:1 = @devname
params:3 = volname
params:5 = 0
params:7 = 0
return syscall($C5, @params)
fin
return -1
end
def a3online(unit, buf)
byte info[11]
byte volname[17]
byte i
if unit == 0
for i = $01 to $0F
if a3volume(i, buf) == 0
^buf = ^buf | (i << 4)
fin
buf = buf + 16
next
else
return a3volume(unit, buf)
fin
return 0
end
def a13readblock(unit, buf, block)
perr = $27 // IOERR
return perr
@@ -359,12 +465,14 @@ when MACHID & MACHID_MODEL
is MACHID_III
fileio:getpfx = @a3getpfx
fileio:getfileinfo = @a3getfileinfo
fileio:setfileinfo = @a3setfileinfo
fileio:iobufalloc = @a13iobufs
fileio:open = @a3open
fileio:close = @a3close
fileio:write = @a3write
fileio:create = @a3create
fileio:newline = @a3newline
fileio:online = @a3online
fileio:readblock = @a13readblock
fileio:writeblock = @a13writeblock
break
@@ -372,7 +480,9 @@ when MACHID & MACHID_MODEL
fileio:getpfx = @a1getpfx
fileio:setpfx = @a1setpfx
fileio:getfileinfo = @a1getfileinfo
fileio:setfileinfo = @a1setfileinfo
fileio:geteof = @a1geteof
fileio:seteof = @a1seteof
fileio:iobufalloc = @a13iobufs
fileio:open = @a1open
fileio:close = @a1close
@@ -380,7 +490,9 @@ when MACHID & MACHID_MODEL
fileio:write = @a1write
fileio:create = @a1create
fileio:destroy = @a1destroy
fileio:rename = @a1rename
fileio:newline = @a1newline
fileio:online = @a1online
fileio:readblock = @a13readblock
fileio:writeblock = @a13writeblock
break

174
src/libsrc/apple/grafix.pla Normal file
View File

@@ -0,0 +1,174 @@
include "inc/cmdsys.plh"
byte gfxref, gfxseg
byte params[8], cmd[16]
export def pencolor(clr)#0
params:4 = 2
cmd.0 = 19 // Pen color
cmd.1 = clr
syscall($CB, @params)
end
export def fillcolor(clr)#0
params:4 = 2
cmd.0 = 20 // Fill color
cmd.1 = clr
syscall($CB, @params)
end
export def fillscreen()#0
params:4 = 1
cmd.9 = 28 // Clear viewport
syscall($CB, @params)
end
export def penmove(x, y)#0
params:4 = 5
cmd.0 = 26 // Move pen
cmd:1 = x
cmd:3 = y
syscall($CB, @params)
end
export def plot(x, y)#0
params:4 = 5
cmd.0 = 25 // Plot
cmd:1 = x
cmd:3 = y
syscall($CB, @params)
end
export def line(x1, y1, x2, y2)#0
params:4 = 10
cmd.0 = 26 // Move pen
cmd:1 = x1
cmd:3 = y1
cmd.5 = 24 // Line
cmd:6 = x2
cmd:8 = y2
syscall($CB, @params)
end
export def lineto(x, y)#0
params:4 = 5
cmd.0 = 24 // Line
cmd:1 = x
cmd:3 = y
syscall($CB, @params)
end
export def rect(x1, y1, x2, y2)#0
params:4 = 10
cmd.0 = 26 // Move pen
cmd:1 = x1
cmd:3 = y1
cmd.5 = 24 // Line
cmd:6 = x2
cmd:8 = y1
syscall($CB, @params)
params:4 = 15
cmd.0 = 24 // Line
cmd:1 = x2
cmd:3 = y2
cmd.5 = 24 // Line
cmd:6 = x1
cmd:8 = y2
cmd.10 = 24 // Line
cmd:11 = x1
cmd:13 = y1
syscall($CB, @params)
end
export def fillrect(x1, y1, x2, y2)#0
params:4 = 11
cmd.0 = 2 // Set viewport
cmd:1 = x1
cmd:3 = x2
cmd:5 = y1
cmd:7 = y2
cmd.9 = 28 // Clear viewport
cmd.10 = 1 // Reset viewport
syscall($CB, @params)
end
export def bitblt(bits, pitch, x, y, width, height)#0
params:4 = 14
cmd.0 = 4 // Draw block
cmd:1 = bits
cmd.3 = ^$FFED & $8F
cmd:4 = pitch
cmd:6 = x
cmd:8 = y
cmd:10 = width
cmd:12 = height
syscall($CB, @params)
end
export def drawmode(mode)#0
params:4 = 2
cmd.0 = 21 // Transfer mode
cmd.1 = mode
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
//
// Allocate bank 0
//
params.0 = 4
params:1 = $2000
params:3 = $9F00
params.5 = $10
params.6 = $00
syscall($40, @params)
gfxseg = params.6
^$1907 = $80 // Set graphics pages allocated
//
// Open graphics driver
//
params.0 = 4
params:1 = ".GRAFIX"
params.3 = 0
params:4 = 0
params.6 = 0
syscall($C8, @params)
gfxref = params.3
done

493
src/libsrc/apple/grlib.pla Normal file
View File

@@ -0,0 +1,493 @@
include "inc/cmdsys.plh"
//
// Apple II hardware constants.
//
const showgraphics = $C050
const showtext = $C051
const showfull = $C052
const showmix = $C053
const showpage1 = $C054
const showpage2 = $C055
const showlores = $C056
const showhires = $C057
const show40 = $C00C
const show80 = $C00D
const mapmain = $C000
const mapaux = $C001
const an3on = $C05E
const an3off = $C05F
const ena80 = $C07E
const dis80 = $C07F
const page1 = 0
const page2 = 1
//
// Screen row address arrays.
//
word[] gr1row = $0400,$0480,$0500,$0580,$0600,$0680,$0700,$0780
word = $0428,$04A8,$0528,$05A8,$0628,$06A8,$0728,$07A8
word = $0450,$04D0,$0550,$05D0,$0650,$06D0,$0750,$07D0
word[] gr2row = $0800,$0880,$0900,$0980,$0A00,$0A80,$0B00,$0B80
word = $0828,$08A8,$0928,$09A8,$0A28,$0AA8,$0B28,$0BA8
word = $0850,$08D0,$0950,$09D0,$0A50,$0AD0,$0B50,$0BD0
word[] grbuff = @gr1row, @gr2row
word drawbuff
byte drawpage
asm grInc(buff)
!SOURCE "vmsrc/plvmzp.inc"
GBASL = $26
GBASH = $27
GBASE = GBASL
GCLR = $30
end
//
// Plot pixel
//
export asm grPlot(x, y)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
STA SRCL
LDA $3001
STA SRCH
LDA ESTKL,X ; Y COORD
AND #$FE
TAY
LDA (SRC),Y
STA GBASL
INY
LDA (SRC),Y
STA GBASH
LDY ESTKL+1,X ; X COORD
LSR ESTKL,X
LDA GCLR ; COLOR
EOR (GBASE),Y
BCS +
; EVEN ROW
AND #$0F
BCC ++
; ODD ROW
+ AND #$F0
++ EOR (GBASE),Y
STA (GBASE),Y
INX
INX
RTS
end
//
// Plot horizontal row of pixels
//
export asm grHLin(x1, x2, y)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
STA SRCL
LDA $3001
STA SRCH
LDA ESTKL+1,X ; X2 COORD
STA TMPH
LDA ESTKL+0,X ; Y COORD
AND #$FE
TAY
LDA (SRC),Y
STA GBASL
INY
LDA (SRC),Y
STA GBASH
LDY ESTKL+2,X ; X1 COORD
- LDA ESTKL+0,X ; Y COORD
LSR
LDA GCLR ; COLOR
; EVEN ROW
EOR (GBASE),Y
BCS +
AND #$0F
BCC ++
; ODD ROW
+ AND #$F0
++ EOR (GBASE),Y
STA (GBASE),Y
INC ESTKL+2,X ; X1 COORD
LDY ESTKL+2,X
CPY TMPH ; X2 COORD
BCC -
BEQ -
INX
INX
INX
RTS
end
//
// Plot horizontal row of pixels
//
export asm grVLin(y1, y2, x)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
STA SRCL
LDA $3001
STA SRCH
LDA ESTKL+2,X ; Y1 COORD
- AND #$FE
TAY
LDA (SRC),Y
STA GBASL
INY
LDA (SRC),Y
STA GBASH
LDA ESTKL+2,X
LSR
LDY ESTKL+0,X ; X COORD
LDA GCLR ; COLOR
; EVEN ROW
EOR (GBASE),Y
BCS +
AND #$0F
BCC ++
; ODD ROW
+ AND #$F0
++ EOR (GBASE),Y
STA (GBASE),Y
INC ESTKL+2,X ; Y1 COORD
LDA ESTKL+2,X
CMP ESTKL+1,X ; Y2 COORD
BCC -
BEQ -
INX
INX
INX
RTS
end
//
// Draw sprite
//
export asm grBLT(x, y, width, height, src)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
STA DSTL
LDA $3001
STA DSTH
LDA ESTKL,X ; SPRITE
STA SRCL
LDA ESTKH,X
STA SRCH
LDA ESTKL+4,X ; X1 COORD
CMP #40
BPL ++++
CLC
ADC ESTKL+2,X
BMI ++++
STA ESTKH+2,X ; X2 COORD
LDA ESTKL+3,X ; Y1 COORD
CMP #48
BPL ++++
STA ESTKH+3,X ; Y COORD
CLC
ADC ESTKL+1,X
BMI ++++
STA ESTKH+1,X ; Y2 COORD
STX ESP
LDA ESTKH+3,X
- CMP #48
BCC +
LDA SRCL ; SKIP TO NEXT ROW
CLC
ADC ESTKL+2,X ; WIDTH
STA SRCL
LDA SRCH
ADC #$00
STA SRCH
BNE +++
+ AND #$FE
TAY
LDA (DST),Y
STA GBASL
INY
LDA (DST),Y
STA GBASH
LDA ESTKL+4,X ; X1 COORD
STA ESTKH+4,X ; X COORD
-- CMP #40
BCS ++
STA TMP
LDA ESTKH+3,X ; Y COORD
LSR
LDY #$00
LDA (SRC),Y
BMI ++
LDY TMP
BCS oddBLT
; EVEN ROW
EOR (GBASE),Y
AND #$0F
BCC evnBLT
; ODD ROW
oddBLT ASL
ASL
ASL
ASL
EOR (GBASE),Y
AND #$F0
evnBLT EOR (GBASE),Y
STA (GBASE),Y
++ INC SRCL
BNE +
INC SRCH
+ INC ESTKH+4,X ; X COORD
LDA ESTKH+4,X
BMI --
CMP ESTKH+2,X ; X2 COORD
BCC --
+++ INC ESTKH+3,X ; Y COORD
LDA ESTKH+3,X
BMI -
CMP ESTKH+1,X ; Y2 COORD
BCC -
++++ INX
INX
INX
INX
INX
RTS
end
//
// Draw 8x8 tile (forced to 1x2 block address)
//
export asm grTile(x, y, src)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
STA DSTL
LDA $3001
STA DSTH
STX ESP
LDA ESTKL,X ; TILE
STA SRCL
LDA ESTKH,X
STA SRCH
LDA ESTKL+2,X ; X1 COORD
CMP #40
BPL ++++
CLC
ADC #$08
BMI ++++
STA ESTKH+2,X ; X2 COORD
LDA ESTKL+1,X ; Y1 COORD
CMP #48
BPL ++++
STA TMPL ; Y COORD
CLC
ADC #$08
BMI ++++
STA ESTKH+1,X ; Y2 COORD
LDA TMPL ; Y COORD
- CMP #48
BCC +
LDA SRCL ; SKIP TO NEXT ROW
ADC #$07 ; CARRY = 1
STA SRCL
LDA SRCH
ADC #$00
STA SRCH
BNE +++
+ AND #$FE
TAY
LDA (DST),Y
STA GBASL
INY
LDA (DST),Y
STA GBASH
LDA ESTKL+2,X ; X1 COORD
STA TMPH ; X COORD
-- TAY
CMP #40
LDX #$00
LDA (SRC,X)
INC SRCL
BNE +
INC SRCH
+ BCS ++
STA (GBASE),Y
++ INC TMPH ; X COORD
LDA TMPH
BMI --
LDX ESP
CMP ESTKH+2,X ; X2 COORD
BCC --
+++ INC TMPL ; Y COORD
INC TMPL ; Y COORD
LDA TMPL
BMI -
CMP ESTKH+1,X ; Y2 COORD
BCC -
++++ INX
INX
INX
RTS
end
//
// Draw a string of tiles
//
export asm grTileStr(x, y, tilestr, strlen, tilebuff)#0
- DEX
DEX
DEX
LDA ESTKL+7,X ; X COORD
STA ESTKL+2,X
LDA ESTKL+6,X ; Y COORD
STA ESTKL+1,X
LDA ESTKL+3,X ; TILE
STA ESTKL,X
LDA ESTKH+3,X ; TILE
STA ESTKH,X
end
asm _grTileTile
JSR $5000
LDA ESTKL+4,X ; UPDATE X COORD
CLC
ADC #$08
CMP #40 ; OFF RIGHT SIDE
BPL +
STA ESTKL+4,X
DEC ESTKL+1,X ; DEC STRLEN
BNE -
+ INX
INX
INX
INX
INX
RTS
end
//
// Fill a buffer with tiles
//
export asm grFill(x, y, tile)#0
LDA ESTKL+2,X
AND #$0F
STA ESTKL+2,X
LDA ESTKL+1,X
AND #$0F
STA ESTKL+1,X
LDA #$00
SEC
SBC ESTKL+2,X ; ORIGINAL X
STA ESTKL+2,X
STA ESTKH+2,X
LDA #$00
SEC
SBC ESTKL+1,X
STA ESTKL+1,X
- DEX
DEX
DEX
LDA ESTKL+5,X ; X COORD
STA ESTKL+2,X
LDA ESTKL+4,X ; Y COORD
STA ESTKL+1,X
LDA ESTKL+3,X ; TILE
STA ESTKL,X
LDA ESTKH+3,X ; TILE
STA ESTKH,X
end
asm _grFillTile
JSR $5000
LDA ESTKL+2,X ; UPDATE X COORD
CLC
ADC #$08
STA ESTKL+2,X
CMP #40 ; OFF RIGHT SIDE?
BMI -
LDA ESTKH+2,X ; RESTORE X COORD
STA ESTKL+2,X
LDA ESTKL+1,X ; UPDATE Y COORD
CLC
ADC #$08
STA ESTKL+1,X
CMP #48 ; OFF BOTTOM?
BMI -
INX
INX
INX
RTS
end
//
// Clear the buffer
//
export def grClear(clr)#0
byte[32] clrtile
clr = (clr & $0F) | (clr << 4)
clr = (clr & $FF) | (clr << 8)
memset(@clrtile, clr, 32)
grFill(0, 0, @clrtile)
end
//
// Set lores graphics, return draw buffer
//
export def grMode(mode)#1
if mode
//
// Set GR mode
//
^showlores
^showfull
^showgraphics
^showpage1
^ena80 = 0
^show40 = 0
^mapmain = 0
^an3off
drawpage = 1
drawbuff = grbuff[1]
return 1
fin
//
// Set text mode
//
^showtext
^showpage1
^ena80 = 0
^show40 = 0
^mapmain = 0
^an3off
call($FC58, 0, 0, 0, 0) // home()
return 0
end
//
// Set display page, return other page
//
export def grShow(page)#1
page = page & 1
^(showpage1 + page)
return page ^ 1
end
export def grSwap#0
^(showpage1 + drawpage)
drawpage = drawpage ^ 1
drawbuff = grbuff[drawpage]
end
export def grDrawBuf(page)#0
drawpage = page
drawbuff = grbuff[drawpage]
end
//
// Set color for clear & plot routines
//
export def grColor(clr)#0
^$30 = (clr & $0F) | (clr << 4)
end
//
// Assembly fixups
//
_grTileTile:1 = @grTile
_grFillTile:1 = @grTile
//
// Fixups for drawbuff
//
grPlot:1 = @drawbuff
grPlot:6 = @drawbuff+1
grHLin:1 = @drawbuff
grHLin:6 = @drawbuff+1
grVLin:1 = @drawbuff
grVLin:6 = @drawbuff+1
grBLT:1 = @drawbuff
grBLT:6 = @drawbuff+1
grTile:1 = @drawbuff
grTile:6 = @drawbuff+1
done

View File

@@ -0,0 +1,140 @@
include "inc/hgrtile.plh"
//
// Apple //e hires character font
//
byte hgrFont[]
byte = $1C,$22,$2A,$3A,$1A,$02,$3C,$00,$08,$14,$22,$22,$3E,$22,$22,$00
byte = $1E,$22,$22,$1E,$22,$22,$1E,$00,$1C,$22,$02,$02,$02,$22,$1C,$00
byte = $1E,$22,$22,$22,$22,$22,$1E,$00,$3E,$02,$02,$1E,$02,$02,$3E,$00
byte = $3E,$02,$02,$1E,$02,$02,$02,$00,$3C,$02,$02,$02,$32,$22,$3C,$00
byte = $22,$22,$22,$3E,$22,$22,$22,$00,$1C,$08,$08,$08,$08,$08,$1C,$00
byte = $20,$20,$20,$20,$20,$22,$1C,$00,$22,$12,$0A,$06,$0A,$12,$22,$00
byte = $02,$02,$02,$02,$02,$02,$3E,$00,$22,$36,$2A,$2A,$22,$22,$22,$00
byte = $22,$22,$26,$2A,$32,$22,$22,$00,$1C,$22,$22,$22,$22,$22,$1C,$00
byte = $1E,$22,$22,$1E,$02,$02,$02,$00,$1C,$22,$22,$22,$2A,$12,$2C,$00
byte = $1E,$22,$22,$1E,$0A,$12,$22,$00,$1C,$22,$02,$1C,$20,$22,$1C,$00
byte = $3E,$08,$08,$08,$08,$08,$08,$00,$22,$22,$22,$22,$22,$22,$1C,$00
byte = $22,$22,$22,$22,$22,$14,$08,$00,$22,$22,$22,$2A,$2A,$36,$22,$00
byte = $22,$22,$14,$08,$14,$22,$22,$00,$22,$22,$14,$08,$08,$08,$08,$00
byte = $3E,$20,$10,$08,$04,$02,$3E,$00,$3E,$06,$06,$06,$06,$06,$3E,$00
byte = $00,$02,$04,$08,$10,$20,$00,$00,$3E,$30,$30,$30,$30,$30,$3E,$00
byte = $00,$00,$08,$14,$22,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$7F
byte = $00,$00,$00,$00,$00,$00,$00,$00,$08,$08,$08,$08,$08,$00,$08,$00
byte = $14,$14,$14,$00,$00,$00,$00,$00,$14,$14,$3E,$14,$3E,$14,$14,$00
byte = $08,$3C,$0A,$1C,$28,$1E,$08,$00,$06,$26,$10,$08,$04,$32,$30,$00
byte = $04,$0A,$0A,$04,$2A,$12,$2C,$00,$08,$08,$08,$00,$00,$00,$00,$00
byte = $08,$04,$02,$02,$02,$04,$08,$00,$08,$10,$20,$20,$20,$10,$08,$00
byte = $08,$2A,$1C,$08,$1C,$2A,$08,$00,$00,$08,$08,$3E,$08,$08,$00,$00
byte = $00,$00,$00,$00,$08,$08,$04,$00,$00,$00,$00,$3E,$00,$00,$00,$00
byte = $00,$00,$00,$00,$00,$00,$08,$00,$00,$20,$10,$08,$04,$02,$00,$00
byte = $1C,$22,$32,$2A,$26,$22,$1C,$00,$08,$0C,$08,$08,$08,$08,$1C,$00
byte = $1C,$22,$20,$18,$04,$02,$3E,$00,$3E,$20,$10,$18,$20,$22,$1C,$00
byte = $10,$18,$14,$12,$3E,$10,$10,$00,$3E,$02,$1E,$20,$20,$22,$1C,$00
byte = $38,$04,$02,$1E,$22,$22,$1C,$00,$3E,$20,$10,$08,$04,$04,$04,$00
byte = $1C,$22,$22,$1C,$22,$22,$1C,$00,$1C,$22,$22,$3C,$20,$10,$0E,$00
byte = $00,$00,$08,$00,$08,$00,$00,$00,$00,$00,$08,$00,$08,$08,$04,$00
byte = $10,$08,$04,$02,$04,$08,$10,$00,$00,$00,$3E,$00,$3E,$00,$00,$00
byte = $04,$08,$10,$20,$10,$08,$04,$00,$1C,$22,$10,$08,$08,$00,$08,$00
byte = $1C,$22,$2A,$3A,$1A,$02,$3C,$00,$08,$14,$22,$22,$3E,$22,$22,$00
byte = $1E,$22,$22,$1E,$22,$22,$1E,$00,$1C,$22,$02,$02,$02,$22,$1C,$00
byte = $1E,$22,$22,$22,$22,$22,$1E,$00,$3E,$02,$02,$1E,$02,$02,$3E,$00
byte = $3E,$02,$02,$1E,$02,$02,$02,$00,$3C,$02,$02,$02,$32,$22,$3C,$00
byte = $22,$22,$22,$3E,$22,$22,$22,$00,$1C,$08,$08,$08,$08,$08,$1C,$00
byte = $20,$20,$20,$20,$20,$22,$1C,$00,$22,$12,$0A,$06,$0A,$12,$22,$00
byte = $02,$02,$02,$02,$02,$02,$3E,$00,$22,$36,$2A,$2A,$22,$22,$22,$00
byte = $22,$22,$26,$2A,$32,$22,$22,$00,$1C,$22,$22,$22,$22,$22,$1C,$00
byte = $1E,$22,$22,$1E,$02,$02,$02,$00,$1C,$22,$22,$22,$2A,$12,$2C,$00
byte = $1E,$22,$22,$1E,$0A,$12,$22,$00,$1C,$22,$02,$1C,$20,$22,$1C,$00
byte = $3E,$08,$08,$08,$08,$08,$08,$00,$22,$22,$22,$22,$22,$22,$1C,$00
byte = $22,$22,$22,$22,$22,$14,$08,$00,$22,$22,$22,$2A,$2A,$36,$22,$00
byte = $22,$22,$14,$08,$14,$22,$22,$00,$22,$22,$14,$08,$08,$08,$08,$00
byte = $3E,$20,$10,$08,$04,$02,$3E,$00,$3E,$06,$06,$06,$06,$06,$3E,$00
byte = $00,$02,$04,$08,$10,$20,$00,$00,$3E,$30,$30,$30,$30,$30,$3E,$00
byte = $00,$00,$08,$14,$22,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$7F
byte = $00,$00,$00,$00,$00,$00,$00,$00,$08,$08,$08,$08,$08,$00,$08,$00
byte = $14,$14,$14,$00,$00,$00,$00,$00,$14,$14,$3E,$14,$3E,$14,$14,$00
byte = $08,$3C,$0A,$1C,$28,$1E,$08,$00,$06,$26,$10,$08,$04,$32,$30,$00
byte = $04,$0A,$0A,$04,$2A,$12,$2C,$00,$08,$08,$08,$00,$00,$00,$00,$00
byte = $08,$04,$02,$02,$02,$04,$08,$00,$08,$10,$20,$20,$20,$10,$08,$00
byte = $08,$2A,$1C,$08,$1C,$2A,$08,$00,$00,$08,$08,$3E,$08,$08,$00,$00
byte = $00,$00,$00,$00,$08,$08,$04,$00,$00,$00,$00,$3E,$00,$00,$00,$00
byte = $00,$00,$00,$00,$00,$00,$08,$00,$00,$20,$10,$08,$04,$02,$00,$00
byte = $1C,$22,$32,$2A,$26,$22,$1C,$00,$08,$0C,$08,$08,$08,$08,$1C,$00
byte = $1C,$22,$20,$18,$04,$02,$3E,$00,$3E,$20,$10,$18,$20,$22,$1C,$00
byte = $10,$18,$14,$12,$3E,$10,$10,$00,$3E,$02,$1E,$20,$20,$22,$1C,$00
byte = $38,$04,$02,$1E,$22,$22,$1C,$00,$3E,$20,$10,$08,$04,$04,$04,$00
byte = $1C,$22,$22,$1C,$22,$22,$1C,$00,$1C,$22,$22,$3C,$20,$10,$0E,$00
byte = $00,$00,$08,$00,$08,$00,$00,$00,$00,$00,$08,$00,$08,$08,$04,$00
byte = $10,$08,$04,$02,$04,$08,$10,$00,$00,$00,$3E,$00,$3E,$00,$00,$00
byte = $04,$08,$10,$20,$10,$08,$04,$00,$1C,$22,$10,$08,$08,$00,$08,$00
byte = $1C,$22,$2A,$3A,$1A,$02,$3C,$00,$08,$14,$22,$22,$3E,$22,$22,$00
byte = $1E,$22,$22,$1E,$22,$22,$1E,$00,$1C,$22,$02,$02,$02,$22,$1C,$00
byte = $1E,$22,$22,$22,$22,$22,$1E,$00,$3E,$02,$02,$1E,$02,$02,$3E,$00
byte = $3E,$02,$02,$1E,$02,$02,$02,$00,$3C,$02,$02,$02,$32,$22,$3C,$00
byte = $22,$22,$22,$3E,$22,$22,$22,$00,$1C,$08,$08,$08,$08,$08,$1C,$00
byte = $20,$20,$20,$20,$20,$22,$1C,$00,$22,$12,$0A,$06,$0A,$12,$22,$00
byte = $02,$02,$02,$02,$02,$02,$3E,$00,$22,$36,$2A,$2A,$22,$22,$22,$00
byte = $22,$22,$26,$2A,$32,$22,$22,$00,$1C,$22,$22,$22,$22,$22,$1C,$00
byte = $1E,$22,$22,$1E,$02,$02,$02,$00,$1C,$22,$22,$22,$2A,$12,$2C,$00
byte = $1E,$22,$22,$1E,$0A,$12,$22,$00,$1C,$22,$02,$1C,$20,$22,$1C,$00
byte = $3E,$08,$08,$08,$08,$08,$08,$00,$22,$22,$22,$22,$22,$22,$1C,$00
byte = $22,$22,$22,$22,$22,$14,$08,$00,$22,$22,$22,$2A,$2A,$36,$22,$00
byte = $22,$22,$14,$08,$14,$22,$22,$00,$22,$22,$14,$08,$08,$08,$08,$00
byte = $3E,$20,$10,$08,$04,$02,$3E,$00,$3E,$06,$06,$06,$06,$06,$3E,$00
byte = $00,$02,$04,$08,$10,$20,$00,$00,$3E,$30,$30,$30,$30,$30,$3E,$00
byte = $00,$00,$08,$14,$22,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$7F
byte = $00,$00,$00,$00,$00,$00,$00,$00,$08,$08,$08,$08,$08,$00,$08,$00
byte = $14,$14,$14,$00,$00,$00,$00,$00,$14,$14,$3E,$14,$3E,$14,$14,$00
byte = $08,$3C,$0A,$1C,$28,$1E,$08,$00,$06,$26,$10,$08,$04,$32,$30,$00
byte = $04,$0A,$0A,$04,$2A,$12,$2C,$00,$08,$08,$08,$00,$00,$00,$00,$00
byte = $08,$04,$02,$02,$02,$04,$08,$00,$08,$10,$20,$20,$20,$10,$08,$00
byte = $08,$2A,$1C,$08,$1C,$2A,$08,$00,$00,$08,$08,$3E,$08,$08,$00,$00
byte = $00,$00,$00,$00,$08,$08,$04,$00,$00,$00,$00,$3E,$00,$00,$00,$00
byte = $00,$00,$00,$00,$00,$00,$08,$00,$00,$20,$10,$08,$04,$02,$00,$00
byte = $1C,$22,$32,$2A,$26,$22,$1C,$00,$08,$0C,$08,$08,$08,$08,$1C,$00
byte = $1C,$22,$20,$18,$04,$02,$3E,$00,$3E,$20,$10,$18,$20,$22,$1C,$00
byte = $10,$18,$14,$12,$3E,$10,$10,$00,$3E,$02,$1E,$20,$20,$22,$1C,$00
byte = $38,$04,$02,$1E,$22,$22,$1C,$00,$3E,$20,$10,$08,$04,$04,$04,$00
byte = $1C,$22,$22,$1C,$22,$22,$1C,$00,$1C,$22,$22,$3C,$20,$10,$0E,$00
byte = $00,$00,$08,$00,$08,$00,$00,$00,$00,$00,$08,$00,$08,$08,$04,$00
byte = $10,$08,$04,$02,$04,$08,$10,$00,$00,$00,$3E,$00,$3E,$00,$00,$00
byte = $04,$08,$10,$20,$10,$08,$04,$00,$1C,$22,$10,$08,$08,$00,$08,$00
byte = $1C,$22,$2A,$3A,$1A,$02,$3C,$00,$08,$14,$22,$22,$3E,$22,$22,$00
byte = $1E,$22,$22,$1E,$22,$22,$1E,$00,$1C,$22,$02,$02,$02,$22,$1C,$00
byte = $1E,$22,$22,$22,$22,$22,$1E,$00,$3E,$02,$02,$1E,$02,$02,$3E,$00
byte = $3E,$02,$02,$1E,$02,$02,$02,$00,$3C,$02,$02,$02,$32,$22,$3C,$00
byte = $22,$22,$22,$3E,$22,$22,$22,$00,$1C,$08,$08,$08,$08,$08,$1C,$00
byte = $20,$20,$20,$20,$20,$22,$1C,$00,$22,$12,$0A,$06,$0A,$12,$22,$00
byte = $02,$02,$02,$02,$02,$02,$3E,$00,$22,$36,$2A,$2A,$22,$22,$22,$00
byte = $22,$22,$26,$2A,$32,$22,$22,$00,$1C,$22,$22,$22,$22,$22,$1C,$00
byte = $1E,$22,$22,$1E,$02,$02,$02,$00,$1C,$22,$22,$22,$2A,$12,$2C,$00
byte = $1E,$22,$22,$1E,$0A,$12,$22,$00,$1C,$22,$02,$1C,$20,$22,$1C,$00
byte = $3E,$08,$08,$08,$08,$08,$08,$00,$22,$22,$22,$22,$22,$22,$1C,$00
byte = $22,$22,$22,$22,$22,$14,$08,$00,$22,$22,$22,$2A,$2A,$36,$22,$00
byte = $22,$22,$14,$08,$14,$22,$22,$00,$22,$22,$14,$08,$08,$08,$08,$00
byte = $3E,$20,$10,$08,$04,$02,$3E,$00,$3E,$06,$06,$06,$06,$06,$3E,$00
byte = $00,$02,$04,$08,$10,$20,$00,$00,$3E,$30,$30,$30,$30,$30,$3E,$00
byte = $00,$00,$08,$14,$22,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$7F
byte = $04,$08,$10,$00,$00,$00,$00,$00,$00,$00,$1C,$20,$3C,$22,$3C,$00
byte = $02,$02,$1E,$22,$22,$22,$1E,$00,$00,$00,$3C,$02,$02,$02,$3C,$00
byte = $20,$20,$3C,$22,$22,$22,$3C,$00,$00,$00,$1C,$22,$3E,$02,$3C,$00
byte = $18,$24,$04,$1E,$04,$04,$04,$00,$00,$00,$1C,$22,$22,$3C,$20,$1C
byte = $02,$02,$1E,$22,$22,$22,$22,$00,$08,$00,$0C,$08,$08,$08,$1C,$00
byte = $10,$00,$18,$10,$10,$10,$12,$0C,$02,$02,$22,$12,$0E,$12,$22,$00
byte = $0C,$08,$08,$08,$08,$08,$1C,$00,$00,$00,$36,$2A,$2A,$22,$22,$00
byte = $00,$00,$1E,$22,$22,$22,$22,$00,$00,$00,$1C,$22,$22,$22,$1C,$00
byte = $00,$00,$1E,$22,$22,$1E,$02,$02,$00,$00,$3C,$22,$22,$3C,$20,$20
byte = $00,$00,$3A,$06,$02,$02,$02,$00,$00,$00,$3C,$02,$1C,$20,$1E,$00
byte = $04,$04,$1E,$04,$04,$24,$18,$00,$00,$00,$22,$22,$22,$32,$2C,$00
byte = $00,$00,$22,$22,$22,$14,$08,$00,$00,$00,$22,$22,$2A,$2A,$36,$00
byte = $00,$00,$22,$14,$08,$14,$22,$00,$00,$00,$22,$22,$22,$3C,$20,$1C
byte = $00,$00,$3E,$10,$08,$04,$3E,$00,$38,$0C,$0C,$06,$0C,$0C,$38,$00
byte = $08,$08,$08,$08,$08,$08,$08,$08,$0E,$18,$18,$30,$18,$18,$0E,$00
byte = $00,$2C,$1A,$00,$00,$00,$00,$00,$00,$2A,$14,$2A,$14,$2A,$00,$00
//
// Print string with HGR tile library
//
export def hgrPutStr(x, y, strptr)#0
tileDrawStr(x, y, strptr + 1, ^strptr, @hgrFont + 1024) // Offset into regular char
end
done

1295
src/libsrc/apple/hgrlib.pla Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,365 @@
include "inc/cmdsys.plh"
include "inc/hgrlib.plh"
include "inc/fileio.plh"
struc t_sprite
var s_xpos
var s_ypos
var s_undery[2]
var s_underofst[2]
byte s_undermap[2]
byte s_xcenter
byte s_ycenter
byte s_pitch
byte s_height
var s_size
var s_mask[14]
var s_map[14]
var s_under[14]
end
var drawList[16]
var undrawList0[16]
var undrawList1[16]
var undrawList[2] = @undrawList0, @undrawList1
byte drawpage
//
// Sprite routines
//
asm scanMask(x, y, w, srcptr)#0
!SOURCE "vmsrc/plvmzp.inc"
LDA ESTKL+0,X ; SRC PTR
STA SRCL
LDA ESTKH+0,X
STA SRCH
LDA #$00
- PHA
LSR
TAY
LDA (SRC),Y
AND #$80
BEQ +
LDA #$03
+ DEX
STA ESTKL+0,X
end
asm _scanMaskA
JSR $C000 ; HCOLOR
DEX
DEX
LDA ESTKL+5,X ; X COORDL
STA ESTKL+1,X
LDA ESTKH+5,X ; X COORDH
STA ESTKH+1,X
LDA ESTKL+4,X ; Y COORDL
STA ESTKL+0,X
LDA ESTKH+4,X ; Y COORDH
STA ESTKH+0,X
end
asm _scanMaskB
JSR $D000 ; HPLOT
INC ESTKL+3,X ; X COORDL
BNE +
INC ESTKH+3,X ; X COORDH
+ PLA
CLC
ADC #$01
CMP ESTKL+1,X ; WIDTH
BEQ BLTDONE
PHA
LSR
TAY
LDA (SRC),Y
AND #$08
BEQ +
LDA #$03
+ DEX
STA ESTKL+0,X
end
asm _scanMaskC
JSR $C000 ; HCOLOR
DEX
DEX
LDA ESTKL+5,X ; X COORDL
STA ESTKL+1,X
LDA ESTKH+5,X ; X COORDH
STA ESTKH+1,X
LDA ESTKL+4,X ; Y COORDL
STA ESTKL+0,X
LDA ESTKH+4,X ; Y COORDH
STA ESTKH+0,X
end
asm _scanMaskD
JSR $D000 ; HPLOT
INC ESTKL+3,X ; X COORDL
BNE +
INC ESTKH+3,X ; X COORDH
+ PLA
CLC
ADC #$01
CMP ESTKL+1,X ; WIDTH
BNE -
BLTDONE INX
INX
INX
INX
RTS
end
def spriteBLTMask(x, y, w, h, srcptr)#0
word i, j
byte pitch
byte c
pitch = (w + 1) / 2
for j = y to y + h - 1
scanMask(x, j, w, srcptr)
// for i = 0 to w - 1
// c = srcptr->[i >> 1]
// if i & 1
// hgrColor(c & $08 ?? 3 :: 0)
// else
// hgrColor(c & $80 ?? 3 :: 0)
// fin
// hgrPlot(x + i, j)
// next
srcptr = srcptr + pitch
next
end
export def spriteCompile(w, h, xcenter, ycenter, srcptr)#1
var sprtptr, bytewidth, spritesize, i
sprtptr = heapalloc(t_sprite)
if not sprtptr; return 0; fin
bytewidth = (w + 13) / 7
sprtptr->s_pitch = bytewidth
spritesize = bytewidth * h
sprtptr=>s_size = spritesize
sprtptr->s_height = h
sprtptr->s_xcenter = xcenter
sprtptr->s_ycenter = ycenter
sprtptr=>s_under[0] = 0
sprtptr=>s_under[1] = 0
for i = 0 to 13
sprtptr=>s_map[i] = heapalloc(spritesize)
sprtptr=>s_mask[i] = heapalloc(spritesize)
if not sprtptr=>s_map[i] or not sprtptr=>s_mask[i]
heaprelease(sprtptr)
return 0
fin
hgrColor(7)
hgrRect(0, 0, w + 21, h - 1)
spriteBLTMask(i, 0, w, h, srcptr)
hgrCopyDst(i > 6 ?? 1 :: 0, 0, bytewidth, h, sprtptr=>s_mask[i])
hgrColor(0)
hgrRect(0, h, w + 21, h * 2 - 1)
hgrBLT(i, h, w, h, srcptr)
hgrCopyDst(i > 6 ?? 1 :: 0, h, bytewidth, h, sprtptr=>s_map[i])
next
return sprtptr
end
export def spriteDup(sprtsrc)#1
var sprtdup
byte i
sprtdup = heapalloc(t_sprite)
if not sprtdup; return 0; fin
memcpy(sprtdup, sprtsrc, t_sprite)
sprtdup=>s_under[0] = 0
sprtdup=>s_under[1] = 0
return sprtdup
end
export def spriteRead(filestr)#1
var sprtptr, spritesize
byte refnum, i
sprtptr = heapalloc(t_sprite)
if not sprtptr; return 0; fin
refnum = fileio:open(filestr)
if refnum
if fileio:read(refnum, sprtptr, t_sprite) == t_sprite
spritesize = sprtptr=>s_size
sprtptr=>s_under[0] = 0
sprtptr=>s_under[1] = 0
for i = 0 to 13
sprtptr=>s_map[i] = heapalloc(spritesize)
sprtptr=>s_mask[i] = heapalloc(spritesize)
if not sprtptr=>s_map[i] or not sprtptr=>s_mask[i]
heaprelease(sprtptr)
fileio:close(refnum)
return 0
fin
fileio:read(refnum, sprtptr=>s_map[i], spritesize)
fileio:read(refnum, sprtptr=>s_mask[i], spritesize)
next
else
heaprelease(sprtptr)
sprtptr = 0
fin
fileio:close(refnum)
else
heaprelease(sprtptr)
sprtptr = 0
fin
return sprtptr
end
export def spriteSave(filestr, sprtptr)#1
var spritesize
byte refnum, i
fileio:destroy(filestr)
if fileio:create(filestr, $06, $0000) == FILE_ERR_OK
refnum = fileio:open(filestr)
if refnum
if fileio:write(refnum, sprtptr, t_sprite) == t_sprite
spritesize = sprtptr=>s_size
for i = 0 to 13
fileio:write(refnum, sprtptr=>s_map[i], spritesize)
fileio:write(refnum, sprtptr=>s_mask[i], spritesize)
next
fin
fileio:close(refnum)
return 0
fin
fin
return -1
end
export def spriteDraw(sprtptr)#0
byte map, pitch, height
var ofst, y
y = sprtptr=>s_ypos
ofst, map = divmod7(sprtptr=>s_xpos)
if ofst & 1
map = map + 7
fin
sprtptr=>s_underofst[drawpage] = ofst
sprtptr=>s_undery[drawpage] = y
pitch = sprtptr->s_pitch
height = sprtptr->s_height
if not sprtptr=>s_under[drawpage]
sprtptr=>s_under[drawpage] = heapalloc(sprtptr=>s_size)
if not sprtptr=>s_under[drawpage]; return; fin
fin
hgrCopyDst(ofst, y, pitch, height, sprtptr=>s_under[drawpage])
hgrAndSrc( ofst, y, pitch, height, sprtptr=>s_mask[map])
hgrXorSrc( ofst, y, pitch, height, sprtptr=>s_map[map])
end
export def spriteUnDraw(sprtptr)#0
if sprtptr=>s_under[drawpage]
hgrCopySrc(sprtptr=>s_underofst[drawpage], sprtptr=>s_undery[drawpage], sprtptr->s_pitch, sprtptr->s_height, sprtptr=>s_under[drawpage])
fin
end
export def spriteDrawXor(sprtptr)#0
byte map, pitch, height
var ofst, y
y = sprtptr=>s_ypos
ofst, map = divmod7(sprtptr=>s_xpos)
if ofst & 1
map = map + 7
fin
sprtptr->s_undermap[drawpage] = map
sprtptr=>s_underofst[drawpage] = ofst
sprtptr=>s_undery[drawpage] = y
pitch = sprtptr->s_pitch
height = sprtptr->s_height
hgrXorSrc( ofst, y, pitch, height, sprtptr=>s_map[map])
end
export def spriteUnDrawXor(sprtptr)#0
hgrXorSrc(sprtptr=>s_underofst[drawpage], sprtptr=>s_undery[drawpage], sprtptr->s_pitch, sprtptr->s_height, sprtptr=>s_map[sprtptr->s_undermap[drawpage]])
end
export def spritePos(x, y, sprtptr)#0
sprtptr=>s_ypos = y - sprtptr->s_ycenter
sprtptr=>s_xpos = x - sprtptr->s_xcenter
end
export def spritePosIndex(x, y, i)#0
i = i & 15
if drawList[i]
drawList[i]=>s_ypos = y - drawList[i]->s_ycenter
drawList[i]=>s_xpos = x - drawList[i]->s_xcenter
fin
end
export def spriteUnDrawList#0
byte i
var undrawptr
undrawptr = undrawList[drawpage]
for i = 15 downto 0
if undrawptr=>[i]
spriteUnDraw(undrawptr=>[i])
undrawptr=>[i] = 0
fin
next
end
export def spriteDrawList#0
byte i
var undrawptr
undrawptr = undrawList[drawpage]
for i = 15 downto 0
if undrawptr=>[i]
spriteUnDraw(undrawptr=>[i])
fin
next
for i = 0 to 15
if drawList[i]
spriteDraw(drawList[i])
fin
next
memcpy(undrawptr, @drawList, 16*2)
end
export def spriteUnDrawXorList#0
byte i
var undrawptr
undrawptr = undrawList[drawpage]
for i = 0 to 15
if undrawptr=>[i]
spriteUnDrawXor(undrawptr=>[i])
undrawptr=>[i] = 0
fin
next
end
export def spriteDrawXorList#0
byte i
var undrawptr
undrawptr = undrawList[drawpage]
for i = 0 to 15
if undrawptr=>[i]
spriteUnDrawXor(undrawptr=>[i])
fin
if drawList[i]
spriteDrawXor(drawList[i])
fin
next
memcpy(undrawptr, @drawList, 16*2)
end
export def spriteAdd(i, sprtptr)#1
var sprtprev
i = i & 15
sprtprev = drawList[i]
drawList[i] = sprtptr
return sprtprev
end
export def spriteDel(i)#1
var sprtprev
i = i & 15
sprtprev = drawList[i]
drawList[i] = 0
return sprtprev
end
export def spriteDrawBuf(page)#1
drawpage = page & 1
return drawpage
end
//
// Assembly fixups
//
_scanMaskA:1 = @hgrColor
_scanMaskB:1 = @hgrPlot
_scanMaskC:1 = @hgrColor
_scanMaskD:1 = @hgrPlot
done

View File

@@ -0,0 +1,435 @@
include "inc/cmdsys.plh"
//
// Hardware addresses
//
const showgraphics = $C050
const showtext = $C051
const showfull = $C052
const showmix = $C053
const showpage1 = $C054
const showpage2 = $C055
const showlores = $C056
const showhires = $C057
const keyboard = $C000
const keystrobe = $C010
const txt1 = $0400
const txt2 = $0800
const hgr1 = $2000
const hgr2 = $4000
const page1 = 0
const page2 = 1
word txtbuff[] = txt1, txt2
word hgrbuff[] = hgr1, hgr2
//
// Screen tile scanline addresses.
//
word[] rowaddr = $0000,$0080,$0100,$0180,$0200,$0280,$0300,$0380
word = $0028,$00A8,$0128,$01A8,$0228,$02A8,$0328,$03A8
word = $0050,$00D0,$0150,$01D0,$0250,$02D0,$0350,$03D0
byte[] scanbttml = $00,$80,$00,$80,$00,$80,$00,$80
byte = $28,$A8,$28,$A8,$28,$A8,$28,$A8
byte = $50,$D0,$50,$D0,$50,$D0,$50,$D0
byte[] scanbttmh = $1C,$1C,$1D,$1D,$1E,$1E,$1F,$1F
byte = $1C,$1C,$1D,$1D,$1E,$1E,$1F,$1F
byte = $1C,$1C,$1D,$1D,$1E,$1E,$1F,$1F
byte hbmask = $81,$82,$84,$88,$90,$A0,$C0
word hcolor[] = $0000,$552A,$2A55,$7F7F,$8080,$D5AA,$AAD5,$FFFF
byte drawpage = 0
word drawbuff = hgr1
asm tileInc#0
!SOURCE "vmsrc/plvmzp.inc"
CURSH = $24
CURSV = $25
GBASL = $26
GBASH = $27
GBASE = GBASL
TBASL = $28
TBASH = $29
TBASE = TBASL
TBAS2L = $2A
TBAS2H = $2B
TBAS2E = TBAS2L
end
//export def tileDraw(x, y, tileptr)#0
// var scrnptr
//
// scrnptr = (scanaddr[y] | drawbuff) + x
// scrnptr->[$1C00] = tileptr->[7]
// scrnptr->[$1800] = tileptr->[6]
// scrnptr->[$1400] = tileptr->[5]
// scrnptr->[$1000] = tileptr->[4]
// scrnptr->[$0C00] = tileptr->[3]
// scrnptr->[$0800] = tileptr->[2]
// scrnptr->[$0400] = tileptr->[1]
// scrnptr->[$0000] = tileptr->[0]
//end
export asm tileDraw(x, y, tileptr)#0
LDA ESTKL+0,X ; TILEPTRL
STA SRCL
LDA ESTKH+0,X ; TILEPTRH
STA SRCH
LDY ESTKL+1,X ; Y COORD
LDA ESTKL+2,X ; X COORD
CLC
end
asm _tileDraw
ADC $1000,Y ; SCANBTTML
STA ESTKL+0,X ; USE ESTK AS POINTER
LDA $3001 ; DRAWBUFFH
ADC $2000,Y ; SCANBTTMH
STA ESTKL+1,X
LDY #$07 ; DRAW BOTTOM UP
SEC
- LDA (SRC),Y
STA (ESTKL,X)
LDA ESTKL+1,X
SBC #$04
STA ESTKL+1,X
DEY
BNE -
LDA (SRC),Y
STA (ESTKL,X)
INX
INX
INX
RTS
end
//export def tileXorDraw(x, y, tileptr)#0
// var scrnptr
//
// scrnptr = (scanaddr[y] | drawbuff) + x
// scrnptr->[$1C00] = tileptr->[7]
// scrnptr->[$1800] = tileptr->[6]
// scrnptr->[$1400] = tileptr->[5]
// scrnptr->[$1000] = tileptr->[4]
// scrnptr->[$0C00] = tileptr->[3]
// scrnptr->[$0800] = tileptr->[2]
// scrnptr->[$0400] = tileptr->[1]
// scrnptr->[$0000] = tileptr->[0]
//end
export asm tileXorDraw(x, y, tileptr)#0
LDA ESTKL+0,X ; TILEPTRL
STA SRCL
LDA ESTKH+0,X ; TILEPTRH
STA SRCH
LDY ESTKL+1,X ; Y COORD
LDA ESTKL+2,X ; X COORD
CLC
end
asm _tileXDraw
ADC $1000,Y ; SCANBTTML
STA ESTKL+0,X ; USE ESTK AS POINTER
LDA $3001 ; DRAWBUFFH
ADC $2000,Y ; SCANBTTMH
STA ESTKL+1,X
LDY #$07 ; DRAW BOTTOM UP
SEC
- LDA (SRC),Y
EOR (ESTKL,X)
STA (ESTKL,X)
LDA ESTKL+1,X
SBC #$04
STA ESTKL+1,X
DEY
BNE -
LDA (SRC),Y
EOR (ESTKL,X)
STA (ESTKL,X)
INX
INX
INX
RTS
end
//export def tileOrDraw(x, y, tileptr)#0
// var scrnptr
//
// scrnptr = (scanaddr[y] | drawbuff) + x
// scrnptr->[$1C00] = tileptr->[7]
// scrnptr->[$1800] = tileptr->[6]
// scrnptr->[$1400] = tileptr->[5]
// scrnptr->[$1000] = tileptr->[4]
// scrnptr->[$0C00] = tileptr->[3]
// scrnptr->[$0800] = tileptr->[2]
// scrnptr->[$0400] = tileptr->[1]
// scrnptr->[$0000] = tileptr->[0]
//end
export asm tileOrDraw(x, y, tileptr)#0
LDA ESTKL+0,X ; TILEPTRL
STA SRCL
LDA ESTKH+0,X ; TILEPTRH
STA SRCH
LDY ESTKL+1,X ; Y COORD
LDA ESTKL+2,X ; X COORD
CLC
end
asm _tileODraw
ADC $1000,Y ; SCANBTTML
STA ESTKL+0,X ; USE ESTK AS POINTER
LDA $3001 ; DRAWBUFFH
ADC $2000,Y ; SCANBTTMH
STA ESTKL+1,X
LDY #$07 ; DRAW BOTTOM UP
SEC
- LDA (SRC),Y
ORA (ESTKL,X)
STA (ESTKL,X)
LDA ESTKL+1,X
SBC #$04
STA ESTKL+1,X
DEY
BNE -
LDA (SRC),Y
ORA (ESTKL,X)
STA (ESTKL,X)
INX
INX
INX
RTS
end
//export def tileAndDraw(x, y, tileptr)#0
// var scrnptr
//
// scrnptr = (scanaddr[y] | drawbuff) + x
// scrnptr->[$1C00] = tileptr->[7]
// scrnptr->[$1800] = tileptr->[6]
// scrnptr->[$1400] = tileptr->[5]
// scrnptr->[$1000] = tileptr->[4]
// scrnptr->[$0C00] = tileptr->[3]
// scrnptr->[$0800] = tileptr->[2]
// scrnptr->[$0400] = tileptr->[1]
// scrnptr->[$0000] = tileptr->[0]
//end
export asm tileAndDraw(x, y, tileptr)#0
LDA ESTKL+0,X ; TILEPTRL
STA SRCL
LDA ESTKH+0,X ; TILEPTRH
STA SRCH
LDY ESTKL+1,X ; Y COORD
LDA ESTKL+2,X ; X COORD
CLC
end
asm _tileADraw
ADC $1000,Y ; SCANBTTML
STA ESTKL+0,X ; USE ESTK AS POINTER
LDA $3001 ; DRAWBUFFH
ADC $2000,Y ; SCANBTTMH
STA ESTKL+1,X
LDY #$07 ; DRAW BOTTOM UP
SEC
- LDA (SRC),Y
AND (ESTKL,X)
STA (ESTKL,X)
LDA ESTKL+1,X
SBC #$04
STA ESTKL+1,X
DEY
BNE -
LDA (SRC),Y
AND (ESTKL,X)
STA (ESTKL,X)
INX
INX
INX
RTS
end
//export def tileDrawStr(x, y, strptr, strlen, tileset)#0
// while strlen
// tileDraw(x, y, tileset + ^strptr * 8)
// x++
// strptr++
// strlen--
// loop
//end
export asm tileDrawStr(x, y, strptr, strlen, tileset)#0
LDA ESTKL+0,X ; TILESETPTRL
STA DSTL
LDA ESTKH+0,X ; TILESETPTRH
STA DSTH
LDA ESTKL+2,X ; STRPTRL
STA TMPL
LDA ESTKH+2,X ; STRPTRH
STA TMPH
LDY ESTKL+3,X ; Y COORD
LDA ESTKL+4,X ; X COORD
CLC
end
asm _tileDSa
ADC $1000,Y ; SCANBTTML
STA $D000 ; SELF MODIFY LOOP
STA $D001
STA $D002
STA $D003
STA $D004
STA $D005
STA $D006
STA $D007
end
asm _tileDSb
LDA $3001 ; DRAWBUFFH
ADC $2000,Y ; SCANBTTMH
STA $D008 ; SELF MODIFY LOOP
SEC
SBC #$04
STA $D009
SBC #$04
STA $D00A
SBC #$04
STA $D00B
SBC #$04
STA $D00C
SBC #$04
STA $D00D
SBC #$04
STA $D00E
SBC #$04
STA $D00F
LDA ESTKL+1,X ; STRLEN
STX IPY
TAX ; DRAW RIGHT TO LEFT
BEQ +
DEX
LDY #$00
- STY SRCH
TXA
TAY
LDA (TMP),Y ; TILE INDEX * 8
ASL
ROL SRCH
ASL
ROL SRCH
ASL
ROL SRCH
; CLC ; CARRY IS CLEAR FROM ABOVE
ADC DSTL ; ADD TO TILESETPTR
STA SRCL
LDA SRCH
ADC DSTH
STA SRCH
LDY #$07 ; DRAW BOTTOM UP
end
asm _tileDSc
LDA (SRC),Y
STA $4000,X
DEY
LDA (SRC),Y
STA $4000,X
DEY
LDA (SRC),Y
STA $4000,X
DEY
LDA (SRC),Y
STA $4000,X
DEY
LDA (SRC),Y
STA $4000,X
DEY
LDA (SRC),Y
STA $4000,X
DEY
LDA (SRC),Y
STA $4000,X
DEY
LDA (SRC),Y
STA $4000,X
DEX
BPL -
LDX IPY
+ INX
INX
INX
INX
INX
RTS
end
export def tileFromText(txtpage, tileset)#0
byte y
word txtptr
txtptr = txtbuff[txtpage & 1]
for y = 0 to 23
tileDrawStr(0, y, rowaddr[y] | txtptr, 40, tileset)
next
end
export def tileMode(mode)#1
if mode
//
// Set HGR mode
//
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]
return drawpage
end
//
// Assembly fixups
//
_tileDraw:1 = @scanbttml
_tileDraw:6 = @drawbuff.1
_tileDraw:9 = @scanbttmh
_tileXDraw:1 = @scanbttml
_tileXDraw:6 = @drawbuff.1
_tileXDraw:9 = @scanbttmh
_tileODraw:1 = @scanbttml
_tileODraw:6 = @drawbuff.1
_tileODraw:9 = @scanbttmh
_tileADraw:1 = @scanbttml
_tileADraw:6 = @drawbuff.1
_tileADraw:9 = @scanbttmh
_tileDSa:1 = @scanbttml
_tileDSa:4 = @_tileDSc.3
_tileDSa:7 = @_tileDSc.9
_tileDSa:10 = @_tileDSc.15
_tileDSa:13 = @_tileDSc.21
_tileDSa:16 = @_tileDSc.27
_tileDSa:19 = @_tileDSc.33
_tileDSa:22 = @_tileDSc.39
_tileDSa:25 = @_tileDSc.45
_tileDSa:28 = @_tileDSc.51
_tileDSb:1 = @drawbuff.1
_tileDSb:4 = @scanbttmh
_tileDSb:7 = @_tileDSc.4
_tileDSb:13 = @_tileDSc.10
_tileDSb:18 = @_tileDSc.16
_tileDSb:23 = @_tileDSc.22
_tileDSb:28 = @_tileDSc.28
_tileDSb:33 = @_tileDSc.34
_tileDSb:38 = @_tileDSc.40
_tileDSb:43 = @_tileDSc.46
done

56
src/libsrc/apple/jit.pla Normal file
View File

@@ -0,0 +1,56 @@
//
// PLASMA JIT bytecode compiler
//
include "inc/cmdsys.plh"
//
// Indirect interpreter DEFinition entrypoint
//
struc t_defentry
byte interpjsr
word interpaddr
word bytecodeaddr
byte callcount
byte bytecodesize
end
//
// JIT compiler constants
//
const jitcomp = $03E2
const jitcodeptr = $03E4
const codemax = $BEE0
const estkh8 = $C000
const estkh = $00C0
const estkl8 = $D000
const estkl = $00D0
const ifpl8 = $E000
const ifph8 = $E100
const jmptmp = $00E6
const tmpl8 = $E700
const tmph8 = $E800
//
// Bytecode interpreter entrypoints
//
const indirectentry = $03DC
const directentry = $03D0
//
// Copy bytecode DEF to main memory
//
def defcpy(dst, defptr)#0
*$003C = defptr=>bytecodeaddr
*$003E = *$003C + defptr->bytecodesize
*$0042 = dst
call($C311, 0, 0, 0, $04) // CALL XMOVE with carry clear (AUX->MAIN) and ints disabled
end
include "libsrc/jitcore.pla"
//
// Install JIT compiler
//
if *jitcomp
return 0
fin
*jitcomp = @compiler
cmdsys.jitcount = 36
cmdsys.jitsize = 96
puts("JITC enabled\n")
return modkeep
done

View File

@@ -0,0 +1,67 @@
//
// PLASMA JIT bytecode compiler
//
include "inc/cmdsys.plh"
//
// Indirect interpreter DEFinition entrypoint
//
struc t_defentry
byte interpjsr
word interpaddr
word bytecodeaddr
byte callcount
byte bytecodesize
end
//
// JIT compiler constants
//
const jitcomp = $03E2
const jitcodeptr = $03E4
const codemax = $BEE0
const estkh8 = $C000
const estkh = $00C0
const estkl8 = $D000
const estkl = $00D0
const ifp8 = $E000
const ifpl8 = $E000
const ifph8 = $E100
const jmptmp = $00E6
const tmp8 = $E700
const tmpl8 = $E700
const tmph8 = $E800
const fetchop = $00F1
const ip8 = $F200
const ip = $00F2
//
// Bytecode interpreter entrypoints
//
const indirectentry = $03DC
const directentry = $03D0
//
// Copy bytecode DEF to main memory
//
def defcpy(dst, defptr)#0
*$003C = defptr=>bytecodeaddr
*$003E = *$003C + defptr->bytecodesize
*$0042 = dst
call($C311, 0, 0, 0, $04) // CALL XMOVE with carry clear (AUX->MAIN) and ints disabled
end
//
// Identify hardware addresses for certain byte sized access operations
//
def is_hwaddr(addr)
return isuge(addr, $C000) and isult(addr, $C100)
end
include "libsrc/jit16core.pla"
//
// Install JIT compiler
//
if *jitcomp
return 0
fin
*jitcomp = @compiler
cmdsys.jitcount = 32
cmdsys.jitsize = 96
puts("16-bit VM/JITC enabled\n")
return modkeep
done

View File

@@ -0,0 +1,60 @@
asm asmdefs
!SOURCE "vmsrc/plvmzp.inc"
SPEAKER = $C030
GCSTRB = $C070
GC0 = $C064
GC1 = $C065
GCPB1 = $C061
GCPB2 = $C062
GCMAX = 79 ; MAX VALUE FOR GAME CONTROLLER
end
//
// Read both game controllers in parallel
//
export asm joypos(buzz)#4
LDY ESTKL,X ; BUZZ TONE
STY TMPH
DEX
DEX
DEX
LDA #$00
STA ESTKL+2,X
STA ESTKH+2,X
STA ESTKL+3,X
STA ESTKH+3,X
LDA #GCMAX
SEC
BIT GCSTRB
BUZZ DEY
BNE BUZZDLY
BIT SPEAKER
LDY TMPH ; BUZZ TONE
GC0READ BIT GC0
BPL GC0DLY
INC ESTKL+3,X
GC1READ BIT GC1
BPL GC1DLY
INC ESTKL+2,X
JOYLP SBC #$01
BNE BUZZ
TAY ; LDY #$00
BIT GCPB1 ; READ GC BUTTONS
BPL +
DEY
+ STY ESTKL+1,X
STY ESTKH+1,X
TAY ; LDY #$00
BIT GCPB2
BPL +
DEY
+ STY ESTKL,X
STY ESTKH,X
RTS
GC0DLY NOP ; TIMING
BPL GC1READ
GC1DLY NOP ; TIMING
BPL JOYLP
BUZZDLY BNE + ; TIMING
+ BNE GC0READ
end
done

View File

@@ -0,0 +1,117 @@
include "inc/cmdsys.plh"
include "inc/fileio.plh"
var dirbuf
//
// Match next section of source and expression
//
def matchNext(src, srcofst, exp, expofst)
if ^exp >= expofst
when exp->[expofst]
is '*' // Multi-char wildcard
if matchNext(src, srcofst, exp, expofst + 1) // Match zero wild chars
return TRUE
elsif ^src >= srcofst and matchNext(src, srcofst + 1, exp, expofst) // Match more wild chars
return TRUE
fin
is '?' // Single char wildcard
if ^src >= srcofst
return matchNext(src, srcofst + 1, exp, expofst + 1)
fin
return FALSE
otherwise // verbatim match
if ^src >= srcofst and src->[srcofst] == exp->[expofst]
return matchNext(src, srcofst + 1, exp, expofst + 1)
fin
return FALSE
wend
fin
return ^src < srcofst and ^exp < expofst // Return TRUE if at the end of both
end
//
// Start off matching process
//
export def matchName(src, exp)#1
//
// Match on empty wildcard name (same as '*')
//
if not ^exp
return TRUE
fin
return matchNext(src, 1, exp, 1)
end
export def matchList(pathstr, exp)#2
byte refnum
char[64] curpath
var firstblk, entrylen, entriesblk, i, entry, entrylist, entryptr, entrycnt
if not dirbuf
dirbuf = heapallocalign(512, 8, 0)
fin
if not ^pathstr
fileio:getpfx(@curpath)
pathstr = @curpath
fin
if pathstr->[^pathstr] <> '/' // Make sure path ends with a '/'
^pathstr++
pathstr->[^pathstr] = '/'
fin
entrylist = 0
entrycnt = 0
firstblk = 1
refnum = fileio:open(pathstr)
while fileio:read(refnum, dirbuf, 512) == 512
//
// Skip block pointers
//
entry = dirbuf + 4
if firstblk
//
// Pull out revelant details from the first block
//
entrylen = dirbuf->$23
entriesblk = dirbuf->$24 - 1
entry = entry + entrylen
fin
for i = firstblk to entriesblk
//
// Copy directory entry details
//
^entry = ^entry & $0F
if ^entry
//
// Match wildcard filename
//
if matchName(entry, exp)
entryptr = heapalloc(t_fileentry)
memcpy(entryptr, entry, t_fileentry)
entrycnt++
if not entrylist
entrylist = entryptr
fin
fin
fin
entry = entry + entrylen
next
firstblk = 0
loop
fileio:close(refnum)
return entrylist, entrycnt
end
//
// Is this a wildcard name?
//
export def isWildName(exp)#1
byte i
if ^exp
for i = 1 to ^exp
if exp->[i] == '*' or exp->[i] == '?'
return TRUE
fin
next
fin
return FALSE
end
done

582
src/libsrc/apple/mouse.pla Normal file
View File

@@ -0,0 +1,582 @@
include "inc/cmdsys.plh"
//
// Mouse driver interface
//
predef chkVbl, chkMouse, readMouse#3, setMouse(mode), clearMouse, posMouse(x, y), clampMouse(xMin, xMax, yMin, yMax), homeMouse, detachMouse
word = @chkVbl, @chkMouse, @readMouse, @setMouse, @clearMouse, @posMouse, @clampMouse, @homeMouse, @detachMouse
word rom
byte params[]
byte slot, index, page
word setMouseFW
byte vblDiv, vblInt, mouInt, bttnPrev
asm equates
!SOURCE "vmsrc/plvmzp.inc"
end
//
// Serve Mouse/VBL IRQ
//
asm serviceMouse#0
VBLINT = $400 ; DUMMY VALUES TO BE FIXED-UP
MOUINT = $401
LASTBTTN= $402
CLD
JSR $C400
BCC +
RTS ; NOT MOUSE INT
+ LDY $0778+4 ; CHECK MOUSE INT CAUSE
TYA ; WAS IT VBL?
AND #$08
BEQ + ; NOPE, MOVE OR BUTTON
end
asm vblEvent
INC VBLINT ; INC VBL EVENT
+ TYA ; MOUSE MOVE OR BUTTON ACTIVE
AND #$82
end
asm bttnEvent
EOR LASTBTTN
BEQ +
end
asm mouseEvent
INC MOUINT ; INC MOUSE EVENT
+ TYA
AND #$80
end
asm updateBttn
STA LASTBTTN
end
asm updateMouse
LDX #$C4
LDY #$40
JMP $C400 ; IIGS REQUIRES THIS HAPPEN IN IRQ
end
asm serviceCYA#0
CLC
RTS
end
//
// Check for VBL (timer) and Mouse events (atomic read and reset)
//
asm chkEvt(addr)
LDA ESTKL,X
STA ESTKH-1,X
SEI
LDA (ESTKH-1,X) ; READ INT COUNT
TAY
LDA #$00
STA (ESTKH-1,X) ; CLEAR INT COUNT
CLI
STY ESTKL,X ; RETURN INT COUNT
STA ESTKH,X
RTS
end
asm readMouse#3
LDY #$04
DEX
DEX
DEX
PHP
SEI
LDA $0478,Y
STA ESTKL+2,X
LDA $0578,Y
STA ESTKH+2,X
LDA $04F8,Y
STA ESTKL+1,X
LDA $05F8,Y
STA ESTKH+1,X
LDA $0778,Y
STA ESTKL,X
LDA #$00
STA ESTKH,X
PLP
RTS
end
//
// Convert VBL interrupts into millisecond timer increment
//
def chkVblTimer
byte count
word msec
msec = 0
count = chkEvt(@vblInt)
while count
if vblDiv & 2
msec = msec + 16
vblDiv = 0
else
msec = msec + 17
vblDiv++
fin
count--
loop
return msec
end
//
// Check for VBL/Mouse interrupt events
//
def chkVbl
return chkEvt(@vblInt)
end
def chkMouse
return chkEvt(@mouInt)
end
//
// Mouse routines
//
def setMouse(mode)
return call(setMouseFW, mode, slot, page, $04)
end
def clearMouse
return call(rom + rom->$15, $00, slot, page, $04) // clearMouseFW
end
def posMouse(x, y)
//
// Fill screen holes
//
^($0478 + index) = x
^($0578 + index) = x >> 8
^($04F8 + index) = y
^($05F8 + index) = y >> 8
return call(rom + rom->$16, $00, slot, page, $04) // posMouseFW
end
def clampMouse(xMin, xMax, yMin, yMax)
^$0478 = xMin
^$0578 = xMin >> 8
^$04F8 = xMax
^$05F8 = xMax >> 8
call(rom + rom->$17, $00, slot, page, $04) // clampMouseFW
^$0478 = yMin
^$0578 = yMin >> 8
^$04F8 = yMax
^$05F8 = yMax >> 8
return call(rom + rom->$17, $01, slot, page, $04)) // clampMouseFW
end
def homeMouse
return call(rom + rom->$18, $00, slot, page, $04) // homeMouseFW
end
//
// Detach mouse from interrupts
//
def detachMouse
setMouse(0)
params.0 = 1
params.1 = 0
return syscall($41, @params)
end
//
// Identify Mouse card/slot and initialize
//
for rom = $C100 to $C700 step $0100
if rom->5 == $38 and rom->7 == $18 and rom->11 == $01 and rom->12 == $20
puts("Found Mouse in slot #"); putc('0' + ((rom >> 8) & $07)); putln
//
// Hook mouse IRQ handler into ProDOS IRQ chain
//
params.0 = 2
params.1 = 0
params:2 = @serviceMouse
syscall($40, @params)
//
// Hook CYA IRQ handler into ProDOS IRQ chain
//
params.0 = 2
params.1 = 3
params:2 = @serviceCYA
syscall($40, @params)
//
// Set values
//
slot = rom >> 8
index = slot & $07
page = index << 4
setMouseFW = rom + rom->$12
//
// Fix-up IRQ routine
//
serviceMouse:2 = rom + rom->$13 // serveMouseFW
serviceMouse:8 = $0778+index
vblEvent:1 = @vblInt
bttnEvent:1 = @bttnPrev
mouseEvent:1 = @mouInt
updateBttn:1 = @bttnPrev
updateMouse.1 = slot
updateMouse.3 = page
updateMouse:5 = rom + rom->$14 // readMouseFW
readMouse.1 = index
call(rom + rom->$19, $00, slot, page, $04) // initMouseFW
return modkeep
fin
next
//
// Not found
//
return -1
done
What follows is the relevant parts to the mouse driver for VM02
CHKMOUSE: LDX #$20 ; LOOK FOR MOUSE
LDA #$01
JSR SCAN_SLOTS
BCS NOMOUSE
PHA ; SAVE SLOT
LDY #$13
LDA (TMPTR),Y
STA SERVEMOUSE+1 ; FIXUP IRQ HANDLER
STX SERVEMOUSE+2
LDY #$14
LDA (TMPTR),Y
STA READMOUSE+1 ; FIXUP IRQ HANDLER
STX READMOUSE+2
TXA
AND #$07
STA MOUSE_SLOT
TAY
JSR MOUSE_INIT ; MAKE SURE MOUSE IS OFF, INTS OFF
LDA WARM_INIT
BNE :+
JSR PUTS
.ASCIIZ "Mouse in slot #"
LDA MOUSE_SLOT
JSR PRBYTE
JSR CROUT
: PLA
TAY
LDA #<MOUSE_DRIVER ; LOAD MOUSE DRIVER
LDX #>MOUSE_DRIVER
JSR LOAD_DRIVER
;
; SCAN SLOTS FOR MATCHING CARD ID
; ENTRY: A = START SLOT SCAN
; X = CARD ID
; EXIT: A = SLOT # :: C = 0
; X = SLOT PAGE
;
SCAN_SLOTS: ORA #$C0
STA TMPTR+1
LDA #$00
STA TMPTR
CHKSIG: LDY #$05
LDA (TMPTR),Y
CMP #$38 ; LOOK FOR PASCAL COMPAT SIG
BNE :+
LDY #$07
LDA (TMPTR),Y
CMP #$18
BNE :+
LDY #$0B
LDA (TMPTR),Y
CMP #$01
BNE :+
INY
TXA ; LOOK FOR MATCHING ID
CMP (TMPTR),Y
BNE :+
LDA TMPTR+1
TAX
AND #$07
CLC
RTS
: INC TMPTR+1
LDA TMPTR+1
CMP #$C8
BCC CHKSIG
RTS
;*
;* TURN VBL INTS ON AFTER INIT
;*
VBL_INIT: LDA MOUSE_SLOT
BEQ NOVBL
ASL
TAX
LSR
ORA #MOUSECTL_CALLFW
TAY
SEI ; TURN OFF INTERRUPTS
LDA LINK_DEVCTRL,X
STA CALLVBLPROC+1
LDA LINK_DEVCTRL+1,X
STA CALLVBLPROC+2
LDA #$08 ; TURN MOUSE OFF, LEAVE VBL ON
LDX #$12
CALLVBLPROC: JSR $0000
CLI ; BACK ON
LDA WARM_INIT
BNE NOVBL
JSR PUTSLN
.ASCIIZ "VBlank timer active"
NOVBL: RTS
JSR PRODOS
.BYTE $40 ; ALLOC INTERRUPT
.ADDR ALLOCINTPARMS
.IFDEF DEBUG
BCC :+
JSR PUTSLN
.ASCIIZ "FAILED TO ALLOCATE INTERRUPT"
:
.ENDIF
RTS
ALLOCINTPARMS: .BYTE $02
.BYTE $00 ; INT NUM
.ADDR IO_INTERRUPT ; INT CODE
;*
;* I/O INTERRUPT ROUTINE
;*
IO_INTERRUPT: CLD
LDY #$02 ; SLOT #1 * 2
FNDIRQPROC: LDA LINK_DEVIRQ+1,Y
BEQ NXTIRQPROC
STA CALLIRQPROC+2
LDA LINK_DEVIRQ,Y
STA CALLIRQPROC+1
TYA
LSR
PHA
CALLIRQPROC: JSR $0000
BCS :+
PLA
TAY
PHA
JSR THREAD_NOTIFYIO
: PLA
ASL
TAY
NXTIRQPROC: INY
INY
CPY #$10
BCC FNDIRQPROC
CLC
RTS
;*
;* MOUSE DEVICE DRIVER
;*
MOUSE_INIT: ORA #$C0
STA XREGMOUSE1+1
STA XREGMOUSE2+1
ASL
ASL
ASL
ASL
STA YREGMOUSE1+1
STA YREGMOUSE2+1
LDA #$00
PHA ; DISABLE ALL MOUSE INTS
LDX #$12 ; FW INDEX FOR SETMOUSE
BNE CALLMOUSEFW
MOUSE_DRIVER:
MOUSE_DRVR_SZ: .WORD MOUSE_DRVR_END - MOUSE_DRVR_START
MOUSE_READ_OFS: .WORD MOUSE_READ - MOUSE_DRVR_START
MOUSE_WRITE_OFS: .WORD MOUSE_WRITE - MOUSE_DRVR_START
MOUSE_CTRL_OFS: .WORD MOUSE_CTRL - MOUSE_DRVR_START
MOUSE_IRQ_OFS: .WORD MOUSE_IRQ - MOUSE_DRVR_START
MOUSE_DRVR_START:
MOUSE_READ:
MOUSE_WRITE: SEC
RTS
MOUSE_X: .WORD $0000
MOUSE_Y: .WORD $0000
MOUSE_STATUS: .BYTE $00
MOUSE_CTRL: PHA
TYA
AND #$F8 ; MASK OFF SLOT #
CMP #MOUSECTL_CALLFW
BNE :+
CALLMOUSEFW: STX OPADDR
XREGMOUSE2: LDX #$C4
STX OPADDR+1
LDY #$00
LDA (OPADDR),Y ; GET ENTRYPOINT OFFSET
STA OPADDR
YREGMOUSE2: LDY #$40
PLA
SEI
JMP (OPADDR) ; CALL FIXED UP FUNCTION POINTER
: CMP #MOUSECTL_READMOUSE ; COPY MOUSE STATUS/POSITION INTO EASILY ACCESSIBLE MEMORY
BNE :+
PLA
TYA
AND #$07
TAX ; SAVE MOUSE PARAMETERS
ASL
TAY
LDA LINK_DEVREAD,Y
STA TMPTR
LDA LINK_DEVREAD+1,Y
STA TMPTR+1
SEI
LDY #$02
LDA $0478,X
STA (TMPTR),Y
PHA
INY
LDA $0578,X
STA (TMPTR),Y
INY
LDA $04F8,X
STA (TMPTR),Y
PHA
INY
LDA $05F8,X
STA (TMPTR),Y
INY
LDA $0778,X
STA (TMPTR),Y
STA TMP
PLA
TAY
PLA
TAX
LDA TMP
RTS
: CMP #MOUSECTL_CLAMPX
BEQ :+
CMP #MOUSECTL_CLAMPY
BNE :++
: PLA
STA $04F8
STX $05F8
LDA #$00
STA $0478
STA $0578
TYA
LSR
LSR
LSR
AND #$01
PHA
LDX #$17 ; FW INDEX FOR CLAMPMOUSE
BNE CALLMOUSEFW
SETMOUSE: PHA
LDX #$12 ; FW INDEX FOR SETMOUSE
BNE CALLMOUSEFW
: PLA
TYA
AND #$F8 ; MASK OFF SLOT #
CMP #IOCTL_OPEN
BNE :+
LDA #<THREAD_YIELD ; REMOVE SOFTWARE TIMER
STA LINK_YIELD
LDA #>THREAD_YIELD
STA LINK_YIELD+1
LDA #$0F ; TURN MOUSE INTS ON
BNE SETMOUSE
: CMP #IOCTL_CLOSE
BNE :+
LDA #$08 ; TURN MOUSE OFF
BNE SETMOUSE
: CMP #IOCTL_DEACTIVATE
BNE :+
LDA #MOUSECTL_NOIRQ
: CMP #MOUSECTL_NOIRQ ; UNINSTALL IRQ HANDLER
BNE :+
SEI
LDA #<SW_TIMER ; RE-INSTALL SW TIMER
STA LINK_YIELD
LDA #>SW_TIMER
STA LINK_YIELD+1
BNE SETMOUSE
: CMP #IOCTL_ID
BEQ :+
SEC
RTS
: LDA #$20 ; MOUSE ID
CLC
RTS
;
; VBLANK TIMER AND MOUSE IRQ
;
MOUSE_IRQ: STA TMP
SERVEMOUSE: JSR $C400
BCS VBLEXIT ; NOT MOUSE INT
LDY TMP ; CHECK MOUSE INT CAUSE
LDA $0778,Y
PHA
AND #$08 ; WAS IT VLB?
BEQ MOUSEEXIT ; NOPE, MOVE OR BUTTON
VBLTIC: LDX #$00
LDA #$11 ; 17 MSEC (2/3 OF THE TIME)
DEC TIMERADJUST
BNE :+
LDA #$02
STA TIMERADJUST
LDA #$10 ; 16 MSEC (1/3 OF THE TIME)
: JSR SYSTEM_TIC
MOUSEEXIT: PLA
AND #$86 ; MOUSE MOVE OR BUTTON ACTIVE
BEQ VBLEXIT
XREGMOUSE1: LDX #$C4
YREGMOUSE1: LDY #$40
READMOUSE: JSR $C400 ; IIGS REQUIRES THIS HAPPEN IN IRQ
CLC
RTS
VBLEXIT: SEC
RTS
MOUSE_DRVR_END EQU *
package apple2;
/*
* This class interfaces directly with the mouse device driver.
*/
public class Mouse
{
static private int slot, mouseSlot, mouseCtrl, ctrlRead, addrXPos, addrYPos;
static public int xPos, yPos, status;
public static boolean enable()
{
//
// Search for mouse card and disable VBL interrupts
//
for (slot = 1; slot < 8; slot++)
{
int mouse = vm02.call((1 << 19), 0x90 + (slot << 1)); // ID device
if ((mouse & 0x010000FF) == 0x20) // CARRY clear == valid device IOCTL, 0x20 == mouse card ID
{
mouseCtrl = 0x90 + (slot << 1);
mouseSlot = slot << 16;
ctrlRead = mouseSlot | 0x801400;
addrXPos = vm02.peekWord(0x0370 + (slot << 1)) + 2;
addrYPos = addrXPos + 2;
return (vm02.call(mouseSlot | (3 << 19), mouseCtrl) & 0x01000000) == 0; // open port
}
}
slot = 0;
return false;
}
public static void disable()
{
vm02.call(mouseSlot | (4<<19), mouseCtrl); // close port
}
public static void disableIRQ()
{
int vblSlot, vbl;
//
// Search for mouse card and disable/remove interrupts
//
for (vblSlot = 1; vblSlot < 8; vblSlot++)
{
vbl = vm02.call((1 << 19), 0x90 + (vblSlot << 1)); // ID device
if ((vbl & 0x010000FF) == 0x20) // CARRY clear == valid device IOCTL, 0x20 == mouse card ID
{
vm02.call((vblSlot << 16) | (17 << 19), 0x90 + (vblSlot << 1)); // MOUSECTL_UNVBL
break;
}
}
}
public static int slotMask()
{
return (1 << slot);
}
public static void update()
{
status = vm02.call(ctrlRead, mouseCtrl) & 0xFF; // CALL_FW ReadMouse
xPos = vm02.peekWord(addrXPos);
yPos = vm02.peekWord(addrYPos);
}
}

181
src/libsrc/apple/shrlib.pla Normal file
View File

@@ -0,0 +1,181 @@
include "inc/cmdsys.plh"
//
// Apple II hardware constants.
//
const store80dis = $C000
const store80en = $C001
const vidctl = $C029
const showgraphics = $C050
const showtext = $C051
const showfull = $C052
const showmix = $C053
const showpage1 = $C054
const showpage2 = $C055
const showlores = $C056
const showhires = $C057
const show40 = $C00C
const show80 = $C00D
const mapmain = $C000
const mapaux = $C001
const an3on = $C05E
const an3off = $C05F
const ena80 = $C07E
const dis80 = $C07F
const pixbuf = $2000
const scbbuf = $9D00
const palbuf = $9E00
const scb640 = $80 // 640 PIXEL SUPER-HIRES
const scb320 = $00 // 320 PIXEL SUPER-HIRES
word palette = $0000, $0007, $0070, $0077, $0700, $0707, $0770, $0
word = $0CCC, $000F, $00F0, $00FF, $0F00, $0F0F, $0FF0, $0FFF
asm shrInc(buff)
!SOURCE "vmsrc/plvmzp.inc"
GBASL = $26
GBASH = $27
GBASE = GBASL
GCLR = $30
STORE80DIS = $C000
STORE80EN = $C001
MAINWRT = $C004
AUXWRT = $C005
VIDCTL = $C029
SHADOW = $C035
end
//
// This gets copied to $0100!!!
//
asm auxRead
STA $C003 ; READ AUX MEM
LDA (GBASE),Y
STA $C002 ; READ MAIN MEM
RTS
end
//
// Peek byte from SHR memory
//
asm shrPeek(addr)
LDA ESTKL,X
STA GBASL
LDA ESTKH,X
STA GBASH
LDY #$00
STY ESTKH,X
PHP
SEI
LDA SHADOW
AND #$F7
STA SHADOW
JSR $0100
STA ESTKL,X
LDA SHADOW
ORA #$08
STA SHADOW
PLP
RTS
end
//
// Poke byte into SHR memory
//
asm shrPoke(addr, data)#0
LDA ESTKL+1,X
STA GBASL
LDA ESTKH+1,X
STA GBASH
LDY #$00
PHP
SEI
LDA SHADOW
AND #$F7
STA SHADOW
LDA ESTKL+0,X
STA AUXWRT
STA (GBASE),Y
STA MAINWRT
LDA SHADOW
ORA #$08
STA SHADOW
PLP
INX
INX
RTS
end
//
// Fill byte into SHR memory
//
asm shrFill(addr, data, len)#0
LDA ESTKL+2,X
STA GBASL
LDA ESTKH+2,X
STA GBASH
LDY #$00
PHP
SEI
LDA SHADOW
AND #$F7
STA SHADOW
LDA ESTKL+1,X
STA AUXWRT
- STA (GBASE),Y
INY
BNE +
INC GBASH
+ DEC ESTKL+0,X
BNE -
DEC ESTKH+0,X
BNE -
STA MAINWRT
LDA SHADOW
ORA #$08
STA SHADOW
PLP
INX
INX
RTS
end
export def shrPalette(pal, rgbptr)#0
word palptr
byte i
palptr = palbuf + pal * 32
for i = 0 to 31
shrPoke(palptr + i, ^(rgbptr + i))
next
end
export def shrMode(mode)#0
byte row, scb
if mode
//
// Set super hires graphics
//
if mode == 640
scb = scb640
else
scb = scb320
fin
for row = 0 to 199
shrPoke(scbbuf + row, scb)
shrRowPalette(row, palette)
next
^store80dis = 0 // Turn off 80 column mode
^vidctl = ^vidctl | $80 // Turn on SHR mode
return
fin
//
// Set text mode
//
^vidctl = ^vidctl & $7F
^showtext
^showpage1
^ena80 = 0
^show40 = 0
^mapmain = 0
^an3off
call($FC58, 0, 0, 0, 0) // home()
end
// Put read AUX mem routine in scary location
memcpy($0100, @auxRead, 9)
done

View File

@@ -67,12 +67,14 @@ predef musicStop#0
predef spkrSequence(yield, func)#0
predef a2spkrTone(pitch, duration)#0
predef a2spkrPWM(sample, speed, len)#0
predef a2keypressed
//
// Static sequencer values
//
export word musicSequence = @spkrSequence
export word spkrTone = @a2spkrTone
export word spkrPWM = @a2spkrPWM
word keypressed = @a2keypressed
word instr[] // Overlay with other variables
word seqTrack, seqEvent, seqTime, eventTime, updateTime
@@ -211,6 +213,31 @@ asm psgWrite(pVIA, reg, val)#0
INX
RTS
end
asm viaCheck(pVIA)#1
PHP
SEI
LDA ESTKL,X
STA TMPL
LDA ESTKH,X
STA TMPH
STX ESP
LDX #$80
LDY #$04
SEC
- LDA (TMP),Y
BMI +
DEX
BNE -
TXA ; TIMEOUT
BEQ ++
+ SBC (TMP),Y
++ LDX ESP
STA ESTKL,X
LDA #$00
STA ESTKH,X
PLP
RTS
end
//
// Apple II speaker tone generator routines
//
@@ -278,7 +305,7 @@ TONELP SBC #$01 ; 2
;+4 = 11 (from BNE above)
+++ BIT $C000 ; 4
BMI TONEXIT ; 2
NOP ; 2
BPL TONELP ; 3
;---
;+9 = 20
@@ -328,6 +355,30 @@ asm a2spkrPWM(sample, speed, len)#0
INX
RTS
end
asm a2keypressed
INC $004E ; rndseed
BNE +
INC $004F
+ DEX
LDY #$00
BIT $C000
BPL +
DEY
+ STY ESTKL,X
STY ESTKH,X
RTS
end
def a3keypressed
byte count
byte params[5]
params.0 = 3
params.1 = cmdsys.devcons
params.2 = 5
params:3 = @count
syscall($82, @params)
return count
end
def a3spkrTone(pitch, duration)#0
byte env
@@ -348,14 +399,16 @@ end
// Search slots for MockingBoard
//
def mbTicklePSG(pVIA)
pVIA->IER = $7F // Mask all interrupts
pVIA->ACR = $00 // Stop T1 countdown
pVIA->DDRB = $FF // Output enable port A and B
pVIA->DDRA = $FF
pVIA->IORA = $00 // Reset MockingBoard
if pVIA->IORA == $00
//puts("VIA address: $"); puth(pVIA); puts(" Timer Diff = "); puti(viaCheck(pVIA)); putln
if viaCheck(pVIA) == 8 and viaCheck(pVIA) == 8 // Check twice
pVIA->IER = $7F // Mask all interrupts
//pVIA->ACR = $00 // Stop T1 countdown
pVIA->DDRB = $FF // Output enable port A and B
pVIA->DDRA = $FF
pVIA->IORA = $00 // Reset MockingBoard
//if pVIA->IORA == $00
pVIA->IORA = $04 // Inactive MockingBoard control lines
if pVIA->IORA == $04
//if pVIA->IORA == $04
//
// At least we know we have some sort of R/W in the ROM
// address space. Most likely a MockingBoard or John Bell
@@ -366,7 +419,7 @@ def mbTicklePSG(pVIA)
//if mbReadP(pVIA, 2) == $7E and mbReadP(pVIA, 3) == $0A
return pVIA
//fin
fin
//fin
fin
return 0
end
@@ -591,8 +644,7 @@ def mbSequence(yield, func)#0
//
seqTime++
while !(mbVIA1->IFR & $40) // Wait for T1 interrupt
if ^$C000 > 127; quit = TRUE; break; fin
*rndseed++
if a2keypressed(); quit = TRUE; break; fin
loop
mbVIA1->IFR = $40 // Clear interrupt
if yieldTime <= seqTime; func()#0; yieldTime = seqTime + yield; fin
@@ -607,7 +659,7 @@ def mbSequence(yield, func)#0
psgWrite(mbVIA2, BENVAMP, $00)
psgWrite(mbVIA2, CENVAMP, $00)
fin
mbVIA1->ACR = $00 // Stop T1 countdown
//mbVIA1->ACR = $00 // Stop T1 countdown
mbVIA1->IER = $7F // Mask all interrupts
mbVIA1->IFR = $40 // Clear interrupt
setStatusReg(status)
@@ -703,7 +755,6 @@ def spkrSequence(yield, func)#0
if notes1[i]
spkrTone(periods1[i], arpeggioDuration[numNotes])#0
fin
*rndseed++
next
seqTime++
else
@@ -713,13 +764,12 @@ def spkrSequence(yield, func)#0
period = periods1[i]
break;
fin
*rndseed++
next
duration = eventTime - seqTime
seqTime = duration + seqTime
spkrTone(period, DUR16TH * duration)#0
fin
if ^$C000 > 127; return; fin
if keypressed(); return; fin
if yieldTime <= seqTime; func()#0; yieldTime = seqTime + yield; fin
until FALSE
end
@@ -737,9 +787,8 @@ def noSequence(yield, func)#0
repeat
seqTime++
if seqTime < 0; seqTime = 1; fin // Capture wrap-around
*rndseed++
a2spkrTone(0, DUR16TH) // Waste 16th of a second playing silence
if ^$C000 > 127; return; fin
spkrTone(0, DUR16TH) // Waste 16th of a second playing silence
if keypressed(); return; fin
if yield == seqTime; func()#0; seqTime = 0; fin
until FALSE
end
@@ -782,31 +831,32 @@ end
// Play until keystroke
//
export def musicGetKey(yield, backgroundProc)#1
while ^$C000 < 128
while not keypressed()
musicSequence(yield, backgroundProc)#0 // Call background proc every half second
loop
^$C010
return ^$C000
return getc
end
when MACHID & MACHID_MODEL
is MACHID_III
spkrTone = @a3spkrTone
spkrPWM = @a3spkrPWM
spkrTone = @a3spkrTone
spkrPWM = @a3spkrPWM
keypressed = @a3keypressed
break
is MACHID_I
puts("Sound unsupported.\n")
return -1
break
otherwise
puts("MockingBoard Slot:\n")
puts("ENTER = None\n")
puts("0 = Scan\n")
puts("1-7 = Slot #\n")
instr = gets('>'|$80)
if ^instr
mbSlot = mbSearch(^(instr + 1) - '0')
fin
//puts("MockingBoard Slot:\n")
//puts("ENTER = None\n")
//puts("0 = Scan\n")
//puts("1-7 = Slot #\n")
//instr = gets('>'|$80)
//if ^instr
// mbSlot = mbSearch(^(instr + 1) - '0')
//fin
mbSlot = mbSearch(0)
break
wend
if mbSlot < 0

View File

@@ -0,0 +1,255 @@
//
// Original Uthernet ethernet card based on Cirrus Logic cs8900a
//
include "inc/cmdsys.plh"
//
// Include dependency on S/W IP stack
//
import etherip
predef setEtherDriver(MAC, getlen, readfrm, setlen, writefrm)#0
end
//
// Uthernet register offsets
//
const TX_DATA = $00
const RX_DATA = $00
const TX_CMD = $04
const TX_LEN = $06
const INT_STATUS = $08
const PREG_INDEX = $0A
const PREG_DATA = $0C
const AUTO_INC = $8000
//
// Uthernet register addresses
//
byte rxdata_lo, rxdata_hi
byte txcmd
byte txlen
byte isq
word rom[]
byte pregidx
byte pregdata
byte[] slot // Init time only
//
// Uthernet MAC address
//
byte[6] utherMAC = $00,$0A,$99,$1E,$02,$A0
//
// Defines for ASM routines
//
asm equates
!SOURCE "vmsrc/plvmzp.inc"
end
//
// Uthernet I/O functions
//
asm _pokeiow(val)#0
LDA ESTKL,X
end
asm _pokeiowl
STA $C000
LDA ESTKH,X
end
asm _pokeiowh
STA $C000
INX
RTS
end
//
// PEEK BYTE FROM I/O SPACE
// _peekio()
//
asm _peekio#1
DEX
end
asm _peekiol
LDA $C000
STA ESTKL,X
LDA #$00
STA ESTKH,X
RTS
end
//
// PEEK WORD FROM I/O SPACE
// _peekiow()
//
asm _peekiow#1
DEX
end
asm _peekiowl
LDA $C000
STA ESTKL,X
end
asm _peekiowh
LDA $C000
STA ESTKH,X
RTS
end
//
// WRITE FRAME DATA INTO I/O SPACE
// pokefrm(BUF, LEN)
//
asm pokefrm(buf, len)#1
LDY #$00
LDA ESTKL+1,X
STA SRCL
LDA ESTKH+1,X
STA SRCH
LSR ESTKH,X ; CONVERT BYTE LEN TO WORD LEN
LDA ESTKL,X
ROR
ADC #$00
STA ESTKL,X
BEQ +
INC ESTKH,X
+ BCC POKELP
INC ESTKH,X
POKELP LDA (SRC),Y
end
asm _pokefrml
STA $C000
INY
LDA (SRC),Y
end
asm _pokefrmh
STA $C000
INY
BNE +
INC SRCH
+ DEC ESTKL,X
BNE POKELP
DEC ESTKH,X
BNE POKELP
INX
RTS
end
//
// READ FRAME DATA FROM I/O SPACE
// peekfrm(BUF, LEN)
//
asm peekfrm(buf, len)#1
LDY #$00
LDA ESTKL+1,X
STA DSTL
LDA ESTKH+1,X
STA DSTH
LSR ESTKH,X ; CONVERT BYTE LEN TO WORD LEN
LDA ESTKL,X
ROR
ADC #$00
STA ESTKL,X
BEQ +
INC ESTKH,X
+ BCC PEEKLP
INC ESTKH,X
end
asm _peekfrml
PEEKLP LDA $C000
STA (DST),Y
INY
end
asm _peekfrmh
LDA $C000
STA (DST),Y
INY
BNE +
INC DSTH
+ DEC ESTKL,X
BNE PEEKLP
DEC ESTKH,X
BNE PEEKLP
EXPSW INX
RTS
end
def pokeiow(io, data)#0
_pokeiowl.1 = io
_pokeiowh.1 = io+1
_pokeiow(data)
end
def peekio(io)#1
_peekiol.1 = io
return _peekio()
end
def peekiow(io)#1
_peekiowl.1 = io
_peekiowh.1 = io+1
return _peekiow()
end
def pokepreg(reg, data)#0
pokeiow(pregidx, reg)
pokeiow(pregdata, data)
end
def peekpreg(reg)#1
pokeiow(pregidx, reg)
return peekiow(pregdata)
end
//
// Set the length of the next packet to send and wait for data space availability
//
def pokefrmlen(len)#1
pokeiow(txcmd, $C0)
pokeiow(txlen, len)
repeat; until peekpreg($0138) & $0100
return 0
end
//
// Return the length of awaiting packet, 0 otherwise
//
def peekfrmlen#1
word len
len = 0
if peekiow(isq) & $3F == $04
if peekio(rxdata_hi) & $01
peekio(rxdata_lo)
len.1 = peekio(rxdata_hi)
len.0 = peekio(rxdata_lo)
else
peekio(rxdata_lo)
pokepreg($0102, $0140) // Skip pkt
fin
fin
return len
end
//
// Identify Uthernet card and initialize
//
for slot = $90 to $F0 step $10
rom = ((slot & $70) << 4) | $C000
if rom=>$06 <> $3C86 or (slot == $0B or (rom->$05 <> $38 and rom->$07 <> $18)) // Skip slots with signature
if (peekiow(slot+TX_CMD) & $CC3F) == $0009
pokeiow(slot+PREG_INDEX, 0)
if peekiow(slot+PREG_DATA) == $630E
pregidx = slot + PREG_INDEX
pregdata = slot + PREG_DATA
pokepreg($0114, $40) // RESET
rxdata_lo = slot + RX_DATA
rxdata_hi = slot + RX_DATA + 1
txcmd = slot + TX_CMD
txlen = slot + TX_LEN
isq = slot + INT_STATUS
_pokefrml.1 = slot + TX_DATA
_pokefrmh.1 = slot + TX_DATA + 1
_peekfrml.1 = slot + RX_DATA
_peekfrmh.1 = slot + RX_DATA + 1
pokepreg($0158, utherMAC:0) // MAC addr
pokepreg($015A, utherMAC:2) // MAC addr
pokepreg($015C, utherMAC:4) // MAC addr
pokepreg($0102, $0100) // Recv cfg
pokepreg($0104, $0D00) // Recv ctrl
pokepreg($0106, $8200) // Xmit cfg
pokepreg($0112, $00C0) // Line ctrl
//
// Install etherip driver
//
puts("Found Uthernet I in slot #"); putc('0' + ((slot - $80) >> 4)); putln
setEtherDriver(@utherMAC, @peekfrmlen, @peekfrm, @pokefrmlen, @pokefrm)
return modkeep
fin
fin
fin
next
//
// Not found
//
return -1
done

View File

@@ -71,10 +71,11 @@ const WIZ_RXMEM3 = $7800
//
// Wiznet indirect registers
//
byte slot
word saveidx
byte regidx
byte regdata
word[] rom
word saveidx
byte regidx
byte regdata
byte slot
//
// Wiznet MAC address
//
@@ -137,16 +138,15 @@ word bcast = IP_BROADCAST, IP_BROADCAST
//
// ICMP type/codes
//
const IP_PROTO_ICMP = 1
const ICMP_ECHO_REQST = 8
const ICMP_ECHO_REPLY = 0
//
// ICMP message format
//
struc t_icmp
byte icmp_type
byte icmp_code
word icmp_chksm
byte icmp_type
byte icmp_code
word icmp_chksm
word[2] icmp_header
end
//
@@ -155,9 +155,9 @@ end
struc t_piphdr
byte[IP4ADR_SIZE] pip_src
byte[IP4ADR_SIZE] pip_dst
byte pip_zero
byte pip_proto
word pip_len
byte pip_zero
byte pip_proto
word pip_len
end
//
// UDP header
@@ -184,11 +184,11 @@ const MAX_WIZ_CHANNELS = 4
//
// Channel protocols
//
const WIZ_PROTO_CLOSED = 0
const WIZ_PROTO_TCP = 1
const WIZ_PROTO_UDP = 2
const WIZ_PROTO_IP = 3
const WIZ_PROTO_RAW = 4
const WIZ_PROTO_CLOSED = 0
const WIZ_PROTO_TCP = 1
const WIZ_PROTO_UDP = 2
const WIZ_PROTO_IP = 3
const WIZ_PROTO_RAW = 4
//
// State transistions
//
@@ -212,7 +212,7 @@ struc t_channel
word channel_recv_func
word channel_recv_parm
end
byte[t_channel * MAX_WIZ_CHANNELS] wizChannel
byte[t_channel] wizChannel[MAX_WIZ_CHANNELS]
//
// Service ICMP hook
//
@@ -221,17 +221,17 @@ export word hookICMP
// Defines for ASM routines
//
asm equates
!SOURCE "vmsrc/plvmzp.inc"
!SOURCE "vmsrc/plvmzp.inc"
end
//
// Swap bytes in word
//
asm swab(val)
LDA ESTKL,X
LDY ESTKH,X
STA ESTKH,X
STY ESTKL,X
RTS
LDA ESTKL,X
LDY ESTKH,X
STA ESTKH,X
STY ESTKL,X
RTS
end
//
// Wiznet I/O functions
@@ -239,118 +239,122 @@ end
// POKE WORD TO I/O SPACE
// Note: Big Endian format
//
asm _pokeiow(val)
LDA ESTKH,X
asm _pokeiow(val)#0
LDA ESTKH,X
end
asm _pokeiowl
STA $C000
LDA ESTKL,X
STA $C000
LDA ESTKL,X
end
asm _pokeiowh
STA $C000
RTS
STA $C000
INX
RTS
end
//
// POKE BYTE TO I/O SPACE
//
asm _pokeio(val)
LDA ESTKL,X
asm _pokeio(val)#0
LDA ESTKL,X
end
asm _pokeiol
STA $C000
RTS
STA $C000
INX
RTS
end
//
// PEEK BYTE FROM I/O SPACE
//
asm _peekio
DEX
DEX
end
asm _peekiol
LDA $C000
STA ESTKL,X
LDA #$00
STA ESTKH,X
RTS
LDA $C000
STA ESTKL,X
LDA #$00
STA ESTKH,X
RTS
end
//
// PEEK WORD FROM I/O SPACE
// Note: Big Endian format
//
asm _peekiow
DEX
DEX
end
asm _peekiowl
LDA $C000
STA ESTKH,X
LDA $C000
STA ESTKH,X
end
asm _peekiowh
LDA $C000
STA ESTKL,X
RTS
LDA $C000
STA ESTKL,X
RTS
end
//
// WRITE DATA INTO I/O SPACE
// pokedata(BUF, LEN)
//
asm pokedata(buf, len)
LDA ESTKL+1,X
STA SRCL
LDA ESTKH+1,X
STA SRCH
LDY ESTKL,X
BEQ POKELP
LDY #$00
INC ESTKH,X
POKELP LDA (SRC),Y
asm pokedata(buf, len)#0
LDA ESTKL+1,X
STA SRCL
LDA ESTKH+1,X
STA SRCH
LDY ESTKL,X
BEQ POKELP
LDY #$00
INC ESTKH,X
POKELP LDA (SRC),Y
end
asm _pokedata
STA $C000
INY
BNE +
INC SRCH
+ DEC ESTKL,X
BNE POKELP
DEC ESTKH,X
BNE POKELP
INX
RTS
STA $C000
INY
BNE +
INC SRCH
+ DEC ESTKL,X
BNE POKELP
DEC ESTKH,X
BNE POKELP
INX
INX
RTS
end
//
// READ DATA FROM I/O SPACE
// peekdata(BUF, LEN)
//
asm peekdata(buf, len)
LDA ESTKL+1,X
STA DSTL
LDA ESTKH+1,X
STA DSTH
LDY ESTKL,X
BEQ PEEKLP
LDY #$00
INC ESTKH,X
asm peekdata(buf, len)#0
LDA ESTKL+1,X
STA DSTL
LDA ESTKH+1,X
STA DSTH
LDY ESTKL,X
BEQ PEEKLP
LDY #$00
INC ESTKH,X
end
asm _peekdata
PEEKLP LDA $C000
STA (DST),Y
INY
BNE +
INC DSTH
+ DEC ESTKL,X
BNE PEEKLP
DEC ESTKH,X
BNE PEEKLP
INX
RTS
PEEKLP LDA $C000
STA (DST),Y
INY
BNE +
INC DSTH
+ DEC ESTKL,X
BNE PEEKLP
DEC ESTKH,X
BNE PEEKLP
INX
INX
RTS
end
def pokeiow(io, data)
def pokeiow(io, data)#0
_pokeiowl.1 = io
_pokeiowh.1 = io+1
return _pokeiow(data)
_pokeiow(data)
end
def pokeio(io, data)
def pokeio(io, data)#0
_pokeiol.1 = io
return _pokeio(data)
_pokeio(data)
end
def peekio(io)
_peekiol.1 = io
@@ -361,26 +365,26 @@ def peekiow(io)
_peekiowh.1 = io+1
return _peekiow()
end
def pokereg(reg, data)
def pokereg(reg, data)#0
_pokeiow(reg)
return _pokeio(data)
_pokeio(data)
end
def peekreg(reg)
_pokeiow(reg)
return _peekio()
end
def pokeregs(reg, buf, len)
def pokeregs(reg, buf, len)#0
_pokeiow(reg)
return pokedata(buf, len)
pokedata(buf, len)
end
def peekregs(reg, buf, len)
def peekregs(reg, buf, len)#0
_pokeiow(reg)
return peekdata(buf, len)
peekdata(buf, len)
end
def pokeregw(reg, dataw)
def pokeregw(reg, dataw)#0
_pokeiow(reg)
_pokeio(dataw.1)
return _pokeio(dataw.0)
_pokeio(dataw.0)
end
def peekregw(reg)
word dataw
@@ -415,7 +419,7 @@ def wizSendUDP(wiz, ipdst, portdst, data, len)
splitlen = WIZ_TXSIZE - txrr
pokeregs(wizdata + txrr, data, splitlen)
pokeregs(wizdata, data + splitlen, len - splitlen)
else
else
pokeregs(wizdata + txrr, data, len)
fin
//
@@ -470,9 +474,9 @@ def wizOpenUDP(localport, callback, param)
wiz=>channel_lclport = localport
wiz=>channel_recv_func = callback
wiz=>channel_recv_parm = param
pokereg(wiz=>channel_regs + WIZ_SnMR, $02) // UDP protocol
pokeregw(wiz=>channel_regs + WIZ_SnPORT, localport)
pokereg(wiz=>channel_regs + WIZ_SnMR, $02) // UDP protocol
pokereg(wiz=>channel_regs + WIZ_SnCR, $01) // OPEN
pokereg(wiz=>channel_regs + WIZ_SnCR, $01) // OPEN
return wiz
end
//
@@ -480,14 +484,14 @@ end
//
def wizCloseUDP(wiz)
if isuge(wiz, @wizChannel) and isult(wiz, @wizChannel + MAX_WIZ_CHANNELS * t_channel)
//
// Clear notiications on this port
//
//
// Clear notiications on this port
//
if wiz->channel_proto == WIZ_PROTO_UDP
wiz->channel_proto = WIZ_PROTO_CLOSED
pokereg(wiz=>channel_regs + WIZ_SnCR, $10) // CLOSE
return 0
fin
return 0
fin
fin
//
// Invalid port
@@ -508,8 +512,8 @@ def wizListenTCP(lclport, callback, param)
for i = 1 to MAX_WIZ_CHANNELS
if wiz->channel_proto == WIZ_PROTO_TCP and wiz->channel_state == TCP_STATE_LISTEN and wiz=>channel_lclport == lclport
break
fin
wiz = wiz + t_channel
fin
wiz = wiz + t_channel
next
if i > MAX_WIZ_CHANNELS
//
@@ -519,8 +523,8 @@ def wizListenTCP(lclport, callback, param)
for i = 1 to MAX_WIZ_CHANNELS
if !wiz->channel_proto
break
fin
wiz = wiz + t_channel
fin
wiz = wiz + t_channel
next
if i > MAX_WIZ_CHANNELS
return 0
@@ -537,9 +541,9 @@ def wizListenTCP(lclport, callback, param)
wiz=>channel_lclport = lclport
wiz=>channel_recv_func = callback
wiz=>channel_recv_parm = param
pokereg(wiz=>channel_regs + WIZ_SnMR, $01) // TCP protocol
pokereg(wiz=>channel_regs + WIZ_SnMR, $01) // TCP protocol
pokeregw(wiz=>channel_regs + WIZ_SnPORT, lclport)
pokereg(wiz=>channel_regs + WIZ_SnCR, $01) // OPEN
pokereg(wiz=>channel_regs + WIZ_SnCR, $01) // OPEN
while peekreg(wiz=>channel_regs + WIZ_SnSR) <> $13; loop // Wait for init
pokereg(wiz=>channel_regs + WIZ_SnCR, $02) // LISTEN
return wiz
@@ -619,7 +623,7 @@ def wizSendTCP(wiz, data, len)
pokeregs(wizdata + txrr, data, splitlen)
pokeregs(wizdata, data + splitlen, len - splitlen)
//putc('(');puti(splitlen);putc(',');puti(len-splitlen);putc(')')
else
else
pokeregs(wizdata + txrr, data, len)
fin
//
@@ -634,9 +638,9 @@ end
//
def wizCloseTCP(wiz)
if isuge(wiz, @wizChannel) and isult(wiz, @wizChannel + MAX_WIZ_CHANNELS * t_channel)
//
// Clear notiications on this port
//
//
// Clear notiications on this port
//
if wiz->channel_proto == WIZ_PROTO_TCP
pokereg(wiz=>channel_regs + WIZ_SnCR, $10) // CLOSE
wiz->channel_proto = WIZ_PROTO_CLOSED
@@ -670,10 +674,10 @@ end
def wizSetParam(wiz, param)
if wiz->channel_proto == WIZ_PROTO_UDP or wiz->channel_proto == WIZ_PROTO_TCP
//
// Update param on this port
//
wiz=>channel_recv_parm = param
return 0
// Update param on this port
//
wiz=>channel_recv_parm = param
return 0
fin
//
// Invalid port
@@ -698,7 +702,7 @@ def wizServiceIP
wizregs = wiz=>channel_regs
wizdata = wiz=>channel_rxmem
sir = peekreg(wizregs + WIZ_SnIR)
pokereg(wiz=>channel_regs + WIZ_SnIR, sir) // Clear SnIR
pokereg(wizregs + WIZ_SnIR, sir) // Clear SnIR
when wiz->channel_proto
is WIZ_PROTO_UDP
if sir & $04
@@ -735,63 +739,63 @@ def wizServiceIP
wiz->channel_state = TCP_STATE_OPEN
wend
fin
if sir & $04
//
// Receive TCP packet
//
if wiz->channel_state == TCP_STATE_OPEN
rxlen = peekregw(wizregs + WIZ_SnRSR)
rxrr = peekregw(wizregs + WIZ_SnRXRD)
rxwr = rxrr & WIZ_RXMASK
rxpkt = heapalloc(rxlen)
if rxwr + rxlen > WIZ_RXSIZE
splitlen = WIZ_RXSIZE - rxwr
peekregs(wizdata + rxwr, rxpkt, splitlen)
peekregs(wizdata, rxpkt + splitlen, rxlen - splitlen)
else
peekregs(wizdata + rxwr, rxpkt, rxlen)
if sir & $04
//
// Receive TCP packet
//
if wiz->channel_state == TCP_STATE_OPEN
rxlen = peekregw(wizregs + WIZ_SnRSR)
rxrr = peekregw(wizregs + WIZ_SnRXRD)
rxwr = rxrr & WIZ_RXMASK
rxpkt = heapalloc(rxlen)
if rxwr + rxlen > WIZ_RXSIZE
splitlen = WIZ_RXSIZE - rxwr
peekregs(wizdata + rxwr, rxpkt, splitlen)
peekregs(wizdata, rxpkt + splitlen, rxlen - splitlen)
else
peekregs(wizdata + rxwr, rxpkt, rxlen)
fin
pokeregw(wizregs + WIZ_SnRXRD, rxrr + rxlen)
pokereg(wizregs + WIZ_SnCR, $40) // RECV
wiz=>channel_recv_func(@wiz=>channel_remip,wiz=>channel_remport,wiz=>channel_lclport,rxpkt,rxlen,wiz=>channel_recv_parm)
heaprelease(rxpkt)
fin
pokeregw(wizregs + WIZ_SnRXRD, rxrr + rxlen)
pokereg(wizregs + WIZ_SnCR, $40) // RECV
wiz=>channel_recv_func(@wiz=>channel_remip,wiz=>channel_remport,wiz=>channel_lclport,rxpkt,rxlen,wiz=>channel_recv_parm)
heaprelease(rxpkt)
fin
fin
if sir & $02
//
// Close TCP socket
//
if wiz->channel_state == TCP_STATE_OPEN // Notify callback w/ len = 0
wiz=>channel_recv_func(@wiz=>channel_remip,wiz=>channel_remport,0,wiz=>channel_lclport,0,wiz=>channel_recv_parm)
if sir & $02
//
// Close TCP socket
//
if wiz->channel_state == TCP_STATE_OPEN // Notify callback w/ len = 0
wiz=>channel_recv_func(@wiz=>channel_remip,wiz=>channel_remport,0,wiz=>channel_lclport,0,wiz=>channel_recv_parm)
fin
wiz->channel_state = TCP_STATE_CLOSED
pokereg(wiz=>channel_regs + WIZ_SnCR, $10) // CLOSE
fin
if sir & $08
//
// Timeout on TCP socket
//
when wiz->channel_state
is TCP_STATE_OPEN
wiz->channel_state = TCP_STATE_CLOSING
wiz=>channel_recv_func(@wiz=>channel_remip,wiz=>channel_remport,wiz=>channel_lclport,0,0,wiz=>channel_recv_parm)
break
is TCP_STATE_CONNECT
wiz=>channel_recv_func(@wiz=>channel_remip,wiz=>channel_remport,wiz=>channel_lclport,0,0,wiz=>channel_recv_parm)
is TCP_STATE_CLOSING
wiz->channel_state = TCP_STATE_CLOSED
pokereg(wiz=>channel_regs + WIZ_SnCR, $10) // CLOSE
wend
fin
wiz->channel_state = TCP_STATE_CLOSED
pokereg(wiz=>channel_regs + WIZ_SnCR, $10) // CLOSE
fin
if sir & $08
//
// Timeout on TCP socket
//
when wiz->channel_state
is TCP_STATE_OPEN
wiz->channel_state = TCP_STATE_CLOSING
wiz=>channel_recv_func(@wiz=>channel_remip,wiz=>channel_remport,wiz=>channel_lclport,0,0,wiz=>channel_recv_parm)
break
is TCP_STATE_CONNECT
wiz=>channel_recv_func(@wiz=>channel_remip,wiz=>channel_remport,wiz=>channel_lclport,0,0,wiz=>channel_recv_parm)
is TCP_STATE_CLOSING
wiz->channel_state = TCP_STATE_CLOSED
pokereg(wiz=>channel_regs + WIZ_SnCR, $10) // CLOSE
wend
fin
wend
fin
wiz = wiz + t_channel
next
if ir & $80
if ir & $80
//
// IP conflict
//
pokereg(WIZ_IR, $80)
// IP conflict
//
pokereg(WIZ_IR, $80)
fin
if ir & $40
//
@@ -839,71 +843,77 @@ end
// Identify Uthernet II card and initialize
//
for slot = $90 to $F0 step $10
regdata = peekio(slot)
if (regdata & $E4) == $00
pokeio(slot, $03) // Try setting auto-increment indirect I/F
if peekio(slot) == $03
saveidx = peekiow(slot + 1)
peekio(slot + 3) // Dummy read to data register should increment index
if peekiow(slot + 1) == saveidx + 1
//
// Good chance this is it
//
pokeio(slot, $80) // RESET
regidx = slot + 1
regdata = slot + 3
_pokedata.1 = regdata
_peekdata.1 = regdata
pokeio(slot, $03) // Auto-increment indirect I/F + enable ping
//
// The following looks redundant, but it sets up the peek/poke locations
// for peekreg(s)/pokereg(s)
//
pokeiow(regidx, WIZ_MR)
pokeio(regdata, $03) // Auto-increment indirect I/F + enable ping
peekio(regdata)
//
// Initialize common registers
//
pokeregs(WIZ_SHAR, @wizMAC, 6) // MAC addr
pokeregw(WIZ_RTR, 5000) // Timeout period to 500ms
pokereg(WIZ_RMSR, $55) // 2K Rx memory/channel
pokereg(WIZ_TMSR, $55) // 2K Tx memory/channel
//
// Print settings
//
puts("Found Uthernet II in slot #")
putc('0' + ((slot - $80) >> 4))
putln
//
// Fill channel structure
//
saveidx = @wizChannel
for slot = 0 to 3
saveidx=>channel_regs = WIZ_SREGS + (WIZ_SSIZE * slot)
saveidx=>channel_txmem = WIZ_TXMEM + (WIZ_TXSIZE * slot)
saveidx=>channel_rxmem = WIZ_RXMEM + (WIZ_RXSIZE * slot)
saveidx = saveidx + t_channel
next
//
// Fill in Net class
//
iNet:serviceIP = @wizServiceIP
iNet:openUDP = @wizOpenUDP
iNet:sendUDP = @wizSendUDP
iNet:closeUDP = @wizCloseUDP
iNet:listenTCP = @wizListenTCP
iNet:connectTCP = @wizConnectTCP
iNet:sendTCP = @wizSendTCP
iNet:closeTCP = @wizCloseTCP
iNet:setInterfaceIP = @setWizIP
iNet:getInterfaceHA = @getWizHA
iNet:setCallback = @wizSetCallback
iNet:setParam = @wizSetParam
return modkeep
rom = ((slot & $70) << 4) | $C000
if rom=>$06 <> $3C86 or (slot == $0B or (rom->$05 <> $38 and rom->$07 <> $18)) // Skip slots with signature
regdata = peekio(slot)
if (regdata & $E4) == $00
pokeio(slot, $03) // Try setting auto-increment indirect I/F
if peekio(slot) == $03
saveidx = peekiow(slot + 1)
peekio(slot + 3) // Dummy read to data register should increment index
if peekiow(slot + 1) == saveidx + 1
//
// Good chance this is it
//
pokeio(slot, $80) // RESET
regidx = slot + 1
regdata = slot + 3
_pokedata.1 = regdata
_peekdata.1 = regdata
repeat
pokeio(slot, $03) // Auto-increment indirect I/F + enable ping
until peekio(slot) == $03
//
// The following looks redundant, but it sets up the peek/poke locations
// for peekreg(s)/pokereg(s)
//
pokeiow(regidx, WIZ_MR)
pokeio(regdata, $03) // Auto-increment indirect I/F + enable ping
peekio(regdata)
//
// Initialize common registers
//
wizMAC[5] = slot >> 4 // Slighty unique MAC address
pokeregs(WIZ_SHAR, @wizMAC, 6) // MAC addr
pokeregw(WIZ_RTR, 5000) // Timeout period to 500ms
pokereg(WIZ_RMSR, $55) // 2K Rx memory/channel
pokereg(WIZ_TMSR, $55) // 2K Tx memory/channel
//
// Print settings
//
puts("Found Uthernet II in slot #")
putc('0' + ((slot - $80) >> 4))
putln
//
// Fill channel structure
//
saveidx = @wizChannel
for slot = 0 to 3
saveidx=>channel_regs = WIZ_SREGS + (WIZ_SSIZE * slot)
saveidx=>channel_txmem = WIZ_TXMEM + (WIZ_TXSIZE * slot)
saveidx=>channel_rxmem = WIZ_RXMEM + (WIZ_RXSIZE * slot)
saveidx = saveidx + t_channel
next
//
// Fill in Net class
//
iNet:serviceIP = @wizServiceIP
iNet:openUDP = @wizOpenUDP
iNet:sendUDP = @wizSendUDP
iNet:closeUDP = @wizCloseUDP
iNet:listenTCP = @wizListenTCP
iNet:connectTCP = @wizConnectTCP
iNet:sendTCP = @wizSendTCP
iNet:closeTCP = @wizCloseTCP
iNet:setInterfaceIP = @setWizIP
iNet:getInterfaceHA = @getWizHA
iNet:setCallback = @wizSetCallback
iNet:setParam = @wizSetParam
return modkeep
fin
fin
pokeio(slot, regdata) // Restore register
fin
pokeio(slot, regdata) // Restore register
fin
next
//

View File

@@ -1,4 +1,5 @@
include "inc/cmdsys.plh"
sysflags nojitc // No need to speed this up
def argDelim(str)
byte n

195
src/libsrc/c64/conio.pla Normal file
View File

@@ -0,0 +1,195 @@
include "inc/cmdsys.plh"
//
// Handy constants.
//
const FULLMODE = 0
const MIXMODE = 1
//
// External interface.
//
struc t_conio
word keypressed
word getkey
word echo
word home
word gotoxy
word viewport
word texttype
word textmode
word grmode
word grcolor
word grplot
word tone
word rnd
end
//
// Predefined functions.
//
predef a2keypressed,a2home,a12echo(state),a2gotoxy(x,y),a2viewport(left, top, width, height),a2texttype(type)
predef a2textmode(cols),a2grmode(mix),a2grcolor(color),a2grplot(x,y),a2tone(duration, delay),a2rnd
//
// Exported function table.
//
word conio[]
//
// Function pointers.
//
word = @a2keypressed
word = @getc
word = @a12echo
word = @a2home
word = @a2gotoxy
word = @a2viewport
word = @a2texttype
word = @a2textmode
word = @a2grmode
word = @a2grcolor
word = @a2grplot
word = @a2tone
word = @a2rnd
//
// Screen row address arrays.
//
word txt1scrn[] = $0400,$0480,$0500,$0580,$0600,$0680,$0700,$0780
word = $0428,$04A8,$0528,$05A8,$0628,$06A8,$0728,$07A8
word = $0450,$04D0,$0550,$05D0,$0650,$06D0,$0750,$07D0
word txt2scrn[] = $0800,$0880,$0900,$0980,$0A00,$0A80,$0B00,$0B80
word = $0828,$08A8,$0928,$09A8,$0A28,$0AA8,$0B28,$0BA8
word = $0850,$08D0,$0950,$09D0,$0A50,$0AD0,$0B50,$0BD0
//
// Text screen parameters.
//
//byte textcols = 40
//byte curshpos = 0
//byte cursvpos = 0
//
// Apple 3 console codes.
//
byte textbwmode[] = 2, 16, 0
byte textclrmode[] = 2, 16, 1
byte grcharset[] = 1, 0, $7F, $7F, $7F, $7F, $00, $00, $00, $00
//
// Random number for Apple 1 and III.
//
word randnum = 12345
//
// Native routines.
//
asm equates
!SOURCE "vmsrc/plvmzp.inc"
end
//
// def grscrn(rowaddrs)
//
asm a2grscrn(rowaddrs)
GRSCRN = $26
GRSCRNL = GRSCRN
GRSCRNH = GRSCRNL+1
LDA ESTKL,X
STA GRSCRNL
LDA ESTKH,X
STA GRSCRNH
RTS
end
//
// def grcolor(color)
//
asm a2grcolor(color)
GRCLR = $30
LDA #$0F
AND ESTKL,X
STA GRCLR
ASL
ASL
ASL
ASL
ORA GRCLR
STA GRCLR
RTS
end
//
// def grplot(x, y)
//
asm a2grplot(x, y)
STY IPY
LDA ESTKL,X
AND #$FE
CMP ESTKL,X
TAY
LDA (GRSCRN),Y
STA DSTL
INY
LDA (GRSCRN),Y
STA DSTH
LDY ESTKL+1,X
LDA (DST),Y
EOR GRCLR
STA TMPL
LDA #$FF
ADC #$00
EOR #$F0
AND TMPL
EOR GRCLR
STA (DST),Y
LDY IPY
INX
RTS
end
//
// Commodore 64 routines.
//
def a2keypressed
return ^keyboard >= 128
end
def a2home
return call($FC58, 0, 0, 0, 0) // home()
end
def a2gotoxy(x, y)
^$24 = x + ^$20
return call($FB5B, y + ^$22, 0, 0, 0)
end
def a2viewport(left, top, width, height)
if !width or !height
left = 0
top = 0
width = 40
height = 24
fin
^$20 = left
^$21 = width
^$22 = top
^$23 = height + top - 1
return a2gotoxy(0, 0)
end
def a2texttype(type)
^$32 = type
return 0
end
def a2textmode(columns)
call($FB39, 0, 0, 0, 0) // textmode()
return a2home
end
def a2grmode(mix)
call($FB2F, 0, 0, 0, 0) // initmode()
call($FB40, 0, 0, 0, 0) // grmode()
if !mix
^showfull
fin
a2home
return a2grscrn(@txt1scrn) // point to lo-res screen
end
def a2tone(duration, delay)
byte i
while duration
^speaker // toggle speaker
for i = delay downto 0; next
duration--
loop
return 0
end
def a2rnd
*a2rndnum = (*a2rndnum << 1) + *a2rndnum + 123
return *a2rndnum & $7FFF
end
done

77
src/libsrc/c64/fileio.pla Normal file
View File

@@ -0,0 +1,77 @@
include "inc/cmdsys.plh"
//
// External interface
//
struc t_fileio
word getpfx
word setpfx
word getfileinfo
word geteof
word iobufalloc
word open
word close
word read
word write
word create
word destroy
word newline
word readblock
word writeblock
end
predef a2getpfx(path), a23setpfx(path), a2getfileinfo(path, fileinfo), a23geteof(refnum), a2iobufs(iobufs), a2open(path), a2close(refnum)
predef a23read(refnum, buf, len), a2write(refnum, buf, len), a2create(path, type, aux), a23destroy(path)
predef a2newline(refnum, emask, nlchar), a2readblock(unit, buf, block), a2writeblock(unit, buf, block)
//
// Exported function table.
//
word fileio[]
word = @a2getpfx, @a23setpfx, @a2getfileinfo, @a23geteof, @a2iobufs, @a2open, @a2close
word = @a23read, @a2write, @a2create, @a23destroy
word = @a2newline, @a2readblock, @a2writeblock
//
// SOS/ProDOS error code
//
export byte perr
def a2getpfx(path)
return path
end
def a23setpfx(path)
return path
end
def a2getfileinfo(path, fileinfo)
return perr
end
def a23geteof(refnum)
return 0
end
def a2iobufs(iobufs)
return 0
end
def a2open(path)
return 0
end
def a2close(refnum)
return perr
end
def a23read(refnum, buf, len)
return len
end
def a2write(refnum, buf, len)
return len
end
def a2create(path, type, aux)
return perr
end
def a23destroy(path)
return perr
end
def a2newline(refnum, emask, nlchar)
return perr
end
def a2readblock(unit, buf, block)
return 0
end
def, a2writeblock(unit, buf, block)
return 0
end
done

View File

@@ -3,6 +3,7 @@
//
include "inc/cmdsys.plh"
include "inc/inet.plh"
sysflags nojitc // No need to JITC this temp loaded module
//
// Needed to init subnet
//
@@ -137,7 +138,7 @@ end
def recvDHCP(remip, remport, pkt, len, param)
word servopts, maskopts, gwopts, dnsopts
//putip(remip);putc(':');puti(remport);putln
//puts("recvDHCP: ");putip(remip);putc(':');puti(remport);putln
//dumpdhcp(pkt)
if pkt=>dhcp_xid:0 == $0201 and pkt=>dhcp_xid:2 == $0403
when pkt->dhcp_opts.[parseopts(@pkt->dhcp_opts, 53) + 2]
@@ -155,10 +156,10 @@ def recvDHCP(remip, remport, pkt, len, param)
iNet:sendUDP(portDHCP, 0, DHCP_SERVER_PORT, @DHCP, @endDHCP - @DHCP)
break
is DHCP_ACK
optsOP.2 = DHCP_ACK
//
// Copy parameters to working copy
//
optsOP.2 = DHCP_ACK
memcpy(@localip, @pkt->dhcp_yourip, IP4ADR_SIZE)
maskopts = parseopts(@pkt->dhcp_opts, 1) + 2
if maskopts >= 0
@@ -187,7 +188,7 @@ iNet:getInterfaceHA(@optsCID.3)
//
// Clear our local IP address
//
iNet:setInterfaceIP(@zeros,@ones, @zeros)
iNet:setInterfaceIP(@zeros, @ones, @zeros)
//
// Prepare to receive DHCP packets from a server
//
@@ -206,17 +207,17 @@ repeat
optsSRV = 255
DHCP.dhcp_secs.1 = retry
iNet:sendUDP(portDHCP, 0, DHCP_SERVER_PORT, @DHCP, @optsSRV - @DHCP + 1)
for timeout = 0 to 1000
for timeout = 0 to 4000
iNet:serviceIP()
if optsOP.2 == DHCP_ACK
break
fin
next
retry = retry + 1
retry++
until retry > 4 or optsOP.2 == DHCP_ACK
iNet:closeUDP(portDHCP)
iNet:setInterfaceIP(@localip, @localnet, @localgw)
puts("Apple II bound to:\n");putip(@localip);putc('/');putip(@localnet);putln
iNet:setDNS(@localdns)
//puts("DNS: ");putip(@localdns);putln
puts("DNS:");putip(@localdns);putln
done

View File

@@ -52,7 +52,6 @@ const IP_PROTO_TCP = $06
//
// ICMP type/codes
//
const IP_PROTO_ICMP = 1
const ICMP_ECHO_REQST = 8
const ICMP_ECHO_REPLY = 0
//
@@ -101,7 +100,7 @@ const ARP_REQST = $0100 // BE format
const ARP_REPLY = $0200 // BE format
struc t_arp
word arp_hw
word arp_proto
word arp_prot
byte arp_hlen
byte arp_plen
word arp_op
@@ -155,8 +154,8 @@ struc t_notify
word notify_func
word notify_parm
end
byte[t_notify * MAX_UDP_NOTIFIES] portsUDP
byte[t_notify * MAX_TCP_NOTIFIES] portsTCP
byte[t_notify] portsUDP[MAX_UDP_NOTIFIES]
byte[t_notify] portsTCP[MAX_TCP_NOTIFIES]
//
// Service ICMP hook
//
@@ -379,12 +378,14 @@ end
// Open TCP socket in SERVER mode
//
def etherListenTCP(lclport, callback, param)
puts("TCP/IP not yet implented for this hardware.\n")
return 0
end
//
// Open TCP socket in CLIENT mode
//
def etherConnectTCP(remip, remport, lclport, callback, param)
puts("TCP/IP not yet implented for this hardware.\n")
return 0
end
//
@@ -500,7 +501,7 @@ def etherServiceIP
lclport = swab(rxptr=>udp_dst)
for i = 1 to MAX_UDP_NOTIFIES
if port=>notify_port == lclport
port=>notify_func(@iphdr=>ip_src,swab(rxptr=>udp_src),rxptr+t_udphdr,swab(rxptr=>udp_len),port=>notify_parm)
port=>notify_func(@iphdr=>ip_src,swab(rxptr=>udp_src),rxptr+t_udphdr,swab(rxptr=>udp_len)-t_udphdr,port=>notify_parm)
break
fin
port = port + t_notify
@@ -586,7 +587,6 @@ def getEtherHA(ha)
if ha; memcpy(ha, @myMAC, MAC_SIZE); fin
return MAC_SIZE
end
//
// Fill in iNet class
//

View File

@@ -33,7 +33,7 @@ end
//
// External interface to net class. Must be first.
//
export byte[t_inet] iNet
res[t_inet] iNet
//
// List of loadable network device drivers
//
@@ -54,12 +54,6 @@ def iNetSetDNS(ipptr)
return 0
end
//def putb(hexb)
// return call($FDDA, hexb, 0, 0, 0)
//end
//def puth(hex)
// return call($F941, hex >> 8, hex, 0, 0)
//end
//def dumpbytes(buf, len)
// word i
//
@@ -87,14 +81,14 @@ def parseIP(ipstr, ipaddr)
endstr = ipstr + ^ipstr
for i = 0 to 3
ipstr = ipstr + 1
while ^ipstr >= '0' and ^ipstr <= '9' and ipstr <= endstr
ipaddr->[i] = ipaddr->[i] * 10 + ^ipstr - '0'
ipstr = ipstr + 1
loop
if ^ipstr <> '.' and ipstr < endstr
return 0
fin
while ^ipstr >= '0' and ^ipstr <= '9' and ipstr <= endstr
ipaddr->[i] = ipaddr->[i] * 10 + ^ipstr - '0'
ipstr = ipstr + 1
loop
if ^ipstr <> '.' and ipstr < endstr
return 0
fin
next
return i == 3
end
@@ -105,11 +99,11 @@ def parseDomain(domstr, msgptr)
l = 0
for i = 1 to ^domstr
if domstr->[i] == '.'
msgptr->[l] = i - l - 1
l = i
else
msgptr->[i] = domstr->[i]
fin
msgptr->[l] = i - l - 1
l = i
else
msgptr->[i] = domstr->[i]
fin
next
msgptr->[l] = i - l - 1
msgptr = msgptr + i
@@ -154,7 +148,7 @@ def recvDNS(remip, remport, pkt, len, ipaddr)
resptr = resptr + 8
//dumpbytes(resptr + 2, ^(resptr + 1))
resptr = resptr + 2 + ^(resptr + 1); putln
r = r - 1
r--
loop
fin
stateDNS = DNS_ANSWER
@@ -171,7 +165,7 @@ def iNetResolve(namestr, ipaddr)
//
// Query Domain Name Server for address
//
dnspkt = heapmark // Use heap as working DNS query packet
dnspkt = heapalloc(^namestr + t_dnshdr + 8) // Use heap as working DNS query packet
msgptr = dnspkt
msgptr=>dnsID = $BEEF
msgptr=>dnsCode = $0001 // RD (Recursion Desired)
@@ -181,9 +175,8 @@ def iNetResolve(namestr, ipaddr)
msgptr=>dnsArCount = 0
msgptr = parseDomain(namestr, msgptr + t_dnshdr)
msgptr=>0 = $0100 // BE TYPE = Address
msgptr=>2 = $0100 // BE CLASS = INternet
msgptr=>2 = $0100 // BE CLASS = Internet
msglen = msgptr - dnspkt + 4
heapalloc(msglen)
//
// Prepare to receive DNS answer from server
//
@@ -204,29 +197,27 @@ def iNetResolve(namestr, ipaddr)
fin
return ipaddr=>0 <> 0 or ipaddr=>2 <> 0
end
//
// Initialze network stack
//
def iNetInit
//
// Look for net hardware
//
while ^driver
//puts(driver);putln
if cmdsys:modexec(driver) >= 0
break
//
// Get an IP address
//
cmdsys:modexec("DHCP")
iNet:resolveIP = @iNetResolve
return @iNet
fin
driver = driver + ^driver + 1
loop
if !^driver
return 0
fin
//
// Get an IP address
//
cmdsys:modexec("DHCP")
iNet:resolveIP = @iNetResolve
return @iNet
puts("No network adapters found.\n")
return NULL
end
//
// Fill iNet class
//

682
src/libsrc/int32.pla Normal file
View File

@@ -0,0 +1,682 @@
//
// 32 bit integer math routines
//
include "inc/cmdsys.plh"
const t_i32 = 4
//
// Include zero page definitions
//
asm int32Inc
!SOURCE "vmsrc/plvmzp.inc"
ACCUM32 = DSTH+1
DVSIGN = TMP+3
end
export asm zero32#0
LDA #$00
STA ACCUM32+0
STA ACCUM32+1
STA ACCUM32+2
STA ACCUM32+3
RTS
end
export asm zext16to32#0
LDA #$00
STA ACCUM32+2
STA ACCUM32+3
RTS
end
export asm neg32#0
LDA #$00
SEC
SBC ACCUM32+0
STA ACCUM32+0
LDA #$00
SBC ACCUM32+1
STA ACCUM32+1
LDA #$00
SBC ACCUM32+2
STA ACCUM32+2
LDA #$00
SBC ACCUM32+3
STA ACCUM32+3
RTS
end
export asm load32(i32ptr)#0
LDA ESTKL+0,X ; I32PTR
STA TMPL
LDA ESTKH+0,X ; I32PTR
STA TMPH
LDY #$00
LDA (TMP),Y
STA ACCUM32+0
INY
LDA (TMP),Y
STA ACCUM32+1
INY
LDA (TMP),Y
STA ACCUM32+2
INY
LDA (TMP),Y
STA ACCUM32+3
INX
RTS
end
export asm loadi16(imm16)#0
LDY #$00
LDA ESTKL+0,X ; IMM16L
STA ACCUM32+0
LDA ESTKH+0,X ; IMM16H
STA ACCUM32+1
BPL + ; SIGN EXTEND
DEY
+ STY ACCUM32+2
STY ACCUM32+3
INX
RTS
end
export asm store32(i32ptr)#0
LDA ESTKL+0,X ; I32PTR
STA TMPL
LDA ESTKH+0,X ; I32PTR
STA TMPH
LDY #$00
LDA ACCUM32+0
STA (TMP),Y
INY
LDA ACCUM32+1
STA (TMP),Y
INY
LDA ACCUM32+2
STA (TMP),Y
INY
LDA ACCUM32+3
STA (TMP),Y
INX
RTS
end
export asm add32(i32ptr)#0
LDA ESTKL+0,X ; I32PTR
STA TMPL
LDA ESTKH+0,X ; I32PTR
STA TMPH
LDY #$00
LDA (TMP),Y
CLC
ADC ACCUM32+0
STA ACCUM32+0
INY
LDA (TMP),Y
ADC ACCUM32+1
STA ACCUM32+1
INY
LDA (TMP),Y
ADC ACCUM32+2
STA ACCUM32+2
INY
LDA (TMP),Y
ADC ACCUM32+3
STA ACCUM32+3
INX
RTS
end
export asm addi16(imm16)#0
LDY #$00
LDA ESTKL+0,X ; IMM16L
CLC
ADC ACCUM32+0
STA ACCUM32+0
LDA ESTKH+0,X ; IMM16H
BPL +
DEY
+ ADC ACCUM32+1
STA ACCUM32+1
TYA
ADC ACCUM32+2
STA ACCUM32+2
TYA
ADC ACCUM32+3
STA ACCUM32+3
INX
RTS
end
export asm sub32(i32ptr)#0
LDA ESTKL+0,X ; I32PTR
STA TMPL
LDA ESTKH+0,X ; I32PTR
STA TMPH
LDY #$03
- LDA (TMP),Y
STA SRC,Y
DEY
BPL -
BMI _SUB
end
export asm subi16(imm16)#0
LDY #$00
LDA ESTKL+0,X ; IMM16L
STA SRC+0
LDA ESTKH+0,X ; IMM16H
STA SRC+1
BPL + ; SIGN EXTEND
DEY
+ STY SRC+2
STY SRC+3
_SUB LDA ACCUM32+0
SEC
SBC SRC+0
STA ACCUM32+0
LDA ACCUM32+1
SBC SRC+1
STA ACCUM32+1
LDA ACCUM32+2
SBC SRC+2
STA ACCUM32+2
LDA ACCUM32+3
SBC SRC+3
STA ACCUM32+3
INX
RTS
end
export asm shl32(imm8)#0
LDA ESTKL+0,X ; IMM8
AND #$1F
CMP #16
BCC +
LDY ACCUM32+1
STY ACCUM32+3
LDY ACCUM32+0
STY ACCUM32+2
LDY #$00
STY ACCUM32+1
STY ACCUM32+0
SBC #16
+ CMP #8
BCC +
LDY ACCUM32+2
STY ACCUM32+3
LDY ACCUM32+1
STY ACCUM32+2
LDY ACCUM32+0
STY ACCUM32+1
LDY #$00
STY ACCUM32+0
SBC #8
+ TAY
BEQ ++
- ASL ACCUM32+0
ROL ACCUM32+1
ROL ACCUM32+2
ROL ACCUM32+3
DEY
BNE -
++ INX
RTS
end
export asm shr32(imm8)#0
LDA ESTKL+0,X ; IMM8
AND #$1F
BEQ +
TAY
LDA #$80
- CMP ACCUM32
ROR ACCUM32+3
ROR ACCUM32+2
ROR ACCUM32+1
ROR ACCUM32+0
DEY
BNE -
+ INX
RTS
end
export asm mul32(i32ptr)#0
LDA ESTKL+0,X ; I32PTR
STA TMPL
LDA ESTKH+0,X ; I32PTR
STA TMPH
LDY #$03
- LDA (TMP),Y
STA SRC,Y
DEY
BPL -
INY
BEQ _MUL
end
export asm muli16(imm16)#0
LDY #$00
LDA ESTKL+0,X ; IMM16L
STA SRC+0
LDA ESTKH+0,X ; IMM16H
STA SRC+1
BPL + ; SIGN EXTEND
DEY
+ STY SRC+2
STY SRC+3
LDY #$00
_MUL LDA ACCUM32+0
STA ESTKL-1,X
LDA ACCUM32+1
STA ESTKH-1,X
LDA ACCUM32+2
STA ESTKL+0,X
LDA ACCUM32+3
STA ESTKH+0,X
STY ACCUM32+0
STY ACCUM32+1
STY ACCUM32+2
STY ACCUM32+3
LDY #$03
LDA #$80
STA TMPL
- AND SRC,Y
BEQ +
CLC
LDA ESTKL-1,X
ADC ACCUM32+0
STA ACCUM32+0
LDA ESTKH-1,X
ADC ACCUM32+1
STA ACCUM32+1
LDA ESTKL+0,X
ADC ACCUM32+2
STA ACCUM32+2
LDA ESTKH+0,X
ADC ACCUM32+3
STA ACCUM32+3
+ LSR TMPL
BCC +
DEY
BMI ++
ROR TMPL
+ ASL ACCUM32+0
ROL ACCUM32+1
ROL ACCUM32+2
ROL ACCUM32+3
LDA TMPL
BNE -
++ INX
RTS
end
export asm div32(i32ptr)#2
LDA ESTKL+0,X ; I32PTR
STA TMPL
LDA ESTKH+0,X ; I32PTR
STA TMPH
LDY #$03 ; DVSR = SRC..SRC+3
LDA (TMP),Y
BMI +
STA SRC+3
DEY
- LDA (TMP),Y
STA SRC,Y
DEY
BPL -
INY
BEQ _DIV
+ SEC
- LDA #$00
SBC (TMP),Y
STA SRC,Y
DEY
BPL -
LDY #$01
BNE _DIV
end
export asm divi16(imm16)#2
LDY #$00 ; DVSR = SRC..SRC+3
STY SRC+2
STY SRC+3
LDA ESTKH+0,X ; IMM16H
BPL +
TYA ; DVSR IS NEG
SEC
SBC ESTKL+0,X ; IMM16L
STA SRC+0
TYA
SBC ESTKH+0,X ; IMM16L
STA SRC+1
INY
BNE _DIV
+ STA SRC+1
LDA ESTKL+0,X ; IMM16L
STA SRC+0
_DIV STY DVSIGN ; LSB = SIGN OF DVSR
DEX ; REMNDR = ESTK..ESTK+1
LDY #$00
STY ESTKL+0,X
STY ESTKH+0,X
STY ESTKL+1,X
STY ESTKH+1,X
LDA SRC+0 ; DIVIDE BY 0?
ORA SRC+1
ORA SRC+2
ORA SRC+3
BNE +
STA ACCUM32+0 ; SET TO 0 AND EXIT
STA ACCUM32+1
STA ACCUM32+2
STA ACCUM32+3
- RTS
+ LDA ACCUM32+0 ; DIVIDE 0?
ORA ACCUM32+1
ORA ACCUM32+2
ORA ACCUM32+3
BEQ -
LDA ACCUM32+3 ; DVDND = ACCUM32
BPL +
LDA #$81 ; DVDND IS NEG
CLC
ADC DVSIGN
STA DVSIGN
TYA
SEC
SBC ACCUM32+0
STA ACCUM32+0
TYA
SBC ACCUM32+1
STA ACCUM32+1
TYA
SBC ACCUM32+2
STA ACCUM32+2
TYA
SBC ACCUM32+3
STA ACCUM32+3
+ LDY #$21 ; #BITS+1
- ASL ACCUM32+0 ; SKIP DVDND LEADING 0 BITS
ROL ACCUM32+1
ROL ACCUM32+2
ROL ACCUM32+3
DEY
BCC -
- ROL ESTKL+0,X ; REMNDR
ROL ESTKH+0,X
ROL ESTKL+1,X
ROL ESTKH+1,X
LDA ESTKL+0,X ; REMNDR
CMP SRC+0 ; DVSR
LDA ESTKH+0,X ; COMPARE
SBC SRC+1
LDA ESTKL+1,X
SBC SRC+2
LDA ESTKH+1,X
SBC SRC+3
BCC + ; IS LESS THAN?
STA ESTKH+1,X
LDA ESTKL+0,X ; REMNDR
SBC SRC+0 ; DVSR
STA ESTKL+0,X ; SUBTRACT
LDA ESTKH+0,X
SBC SRC+1
STA ESTKH+0,X
LDA ESTKL+1,X
SBC SRC+2
STA ESTKL+1,X
SEC
+ ROL ACCUM32+0 ; DVDND
ROL ACCUM32+1 ; ROTATE IN RESULT
ROL ACCUM32+2
ROL ACCUM32+3
DEY
BNE -
LDA DVSIGN ; SET SIGNS OF RESULTS
BPL +
TYA
SEC
SBC ESTKL+0,X
STA ESTKL+0,X
TYA
SBC ESTKH+0,X
STA ESTKH+0,X
TYA
SBC ESTKL+1,X
STA ESTKL+1,X
TYA
SBC ESTKH+1,X
STA ESTKH+1,X
LDA DVSIGN
+ LSR
BCC +
TYA
SBC ACCUM32+0
STA ACCUM32+0
TYA
SBC ACCUM32+1
STA ACCUM32+1
TYA
SBC ACCUM32+2
STA ACCUM32+2
TYA
SBC ACCUM32+3
STA ACCUM32+3
+ RTS
end
export asm iseq32(i32ptr)#1
LDA ESTKL+0,X ; I32PTR
STA TMPL
LDA ESTKH+0,X ; I32PTR
STA TMPH
LDY #$03
- LDA (TMP),Y
STA SRC,Y
DEY
BPL -
INY
BEQ _ISEQ
end
export asm iseqi16(imm16)#1
LDY #$00
LDA ESTKL+0,X ; IMM16L
STA SRC+0
LDA ESTKH+0,X ; IMM16H
STA SRC+1
BPL + ; SIGN EXTEND
DEY
+ STY SRC+2
STY SRC+3
LDY #$00
_ISEQ LDA ACCUM32+0
CMP SRC+0
BNE +
LDA ACCUM32+1
CMP SRC+1
BNE +
LDA ACCUM32+2
CMP SRC+2
BNE +
LDA ACCUM32+3
CMP SRC+3
BNE +
DEY
+ STY ESTKL+0,X
STY ESTKH+0,X
RTS
end
export asm isge32(i32ptr)#1
LDA ESTKL+0,X ; I32PTR
STA TMPL
LDA ESTKH+0,X ; I32PTR
STA TMPH
LDY #$03
- LDA (TMP),Y
STA SRC,Y
DEY
BPL -
INY
BEQ _ISGE
end
export asm isgei16(imm16)#1
LDY #$00
LDA ESTKL+0,X ; IMM16L
STA SRC+0
LDA ESTKH+0,X ; IMM16H
STA SRC+1
BPL + ; SIGN EXTEND
DEY
+ STY SRC+2
STY SRC+3
LDY #$00
_ISGE LDA ACCUM32+0
CMP SRC+0
LDA ACCUM32+1
SBC SRC+1
LDA ACCUM32+2
SBC SRC+2
LDA ACCUM32+3
SBC SRC+3
BVC +
EOR #$80
+ BMI +
DEY
+ STY ESTKL+0,X
STY ESTKH+0,X
RTS
end
export asm isle32(i32ptr)#1
LDA ESTKL+0,X ; I32PTR
STA TMPL
LDA ESTKH+0,X ; I32PTR
STA TMPH
LDY #$03
- LDA (TMP),Y
STA SRC,Y
DEY
BPL -
INY
BEQ _ISLE
end
export asm islei16(imm16)#1
LDY #$00
LDA ESTKL+0,X ; IMM16L
STA SRC+0
LDA ESTKH+0,X ; IMM16H
STA SRC+1
BPL + ; SIGN EXTEND
DEY
+ STY SRC+2
STY SRC+3
LDY #$00
_ISLE LDA SRC+0
CMP ACCUM32+0
LDA SRC+1
SBC ACCUM32+1
LDA SRC+2
SBC ACCUM32+2
LDA SRC+3
SBC ACCUM32+3
BVC +
EOR #$80
+ BMI +
DEY
+ STY ESTKL+0,X
STY ESTKH+0,X
RTS
end
export asm isgt32(i32ptr)#1
LDA ESTKL+0,X ; I32PTR
STA TMPL
LDA ESTKH+0,X ; I32PTR
STA TMPH
LDY #$03
- LDA (TMP),Y
STA SRC,Y
DEY
BPL -
INY
BEQ _ISGT
end
export asm isgti16(imm16)#1
LDY #$00
LDA ESTKL+0,X ; IMM16L
STA SRC+0
LDA ESTKH+0,X ; IMM16H
STA SRC+1
BPL + ; SIGN EXTEND
DEY
+ STY SRC+2
STY SRC+3
LDY #$00
_ISGT LDA SRC+0
CMP ACCUM32+0
LDA SRC+1
SBC ACCUM32+1
LDA SRC+2
SBC ACCUM32+2
LDA SRC+3
SBC ACCUM32+3
BVC +
EOR #$80
+ BPL +
DEY
+ STY ESTKL+0,X
STY ESTKH+0,X
RTS
end
export asm islt32(i32ptr)#1
LDA ESTKL+0,X ; I32PTR
STA TMPL
LDA ESTKH+0,X ; I32PTR
STA TMPH
LDY #$03
- LDA (TMP),Y
STA SRC,Y
DEY
BPL -
INY
BEQ _ISLT
end
export asm islti16(imm16)#1
LDY #$00
LDA ESTKL+0,X ; IMM16L
STA SRC+0
LDA ESTKH+0,X ; IMM16H
STA SRC+1
BPL + ; SIGN EXTEND
DEY
+ STY SRC+2
STY SRC+3
LDY #$00
_ISLT LDA ACCUM32+0
CMP SRC+0
LDA ACCUM32+1
SBC SRC+1
LDA ACCUM32+2
SBC SRC+2
LDA ACCUM32+3
SBC SRC+3
BVC +
EOR #$80
+ BPL +
DEY
+ STY ESTKL+0,X
STY ESTKH+0,X
RTS
end
export def i32tos(i32ptr, strptr)#1
res[t_i32] save
word iptr, rem
char[12] istr
iptr = @istr.11
store32(@save)
load32(i32ptr)
if i32ptr->3 & $80
neg32()
putc('-')
fin
repeat
drop, rem = divi16(10) // Only care about LSW of remainder
^iptr = rem + '0'
iptr--
until iseqi16(0)
^iptr = @istr.11 - iptr
strcpy(strptr, iptr)
load32(@save)
return strptr
end
export def puti32(i32ptr)#0
char[12] i32str
puts(i32tos(i32ptr, @i32str))
end
done

1321
src/libsrc/jit16core.pla Normal file

File diff suppressed because it is too large Load Diff

1548
src/libsrc/jitcore.pla Normal file

File diff suppressed because it is too large Load Diff

506
src/libsrc/lines.pla Normal file
View File

@@ -0,0 +1,506 @@
include "inc/cmdsys.plh"
predef nopLin(a, b, c)#0
predef nopPix(a, b)#0
byte jmpplot = $4C // Sneaky!
var plot = @nopPix
var hspan = @nopLin
var vspan = @nopLin
var err, shorterr, shortlen, longerr, longlen
//def nopLin(a, b, c)#0
//end
//def majorspans(majorstart, major, majorend, minor, dir, majorspan)#0
// //
// // Initial half-span step
// //
// err = err + shorterr
// repeat
// majorspan(majorstart, major, minor)#0
// minor = minor + dir // Move to next span
// majorstart = major + 1 // Start of next span = end of previous + 1
// if err >= 0 // Short span
// err = err + shorterr
// major = major + shortlen
// else // Long span
// err = err + longerr
// major = major + longlen
// fin
// until major >= majorend
// //
// // Final half-span step
// //
// majorspan(majorstart, majorend, minor)#0
//end
asm majorspans(majorstart, major, majorend, minor, dir, majorspan)#0
!SOURCE "vmsrc/plvmzp.inc"
LDA $1000 ; ERRL
CLC
ADC $2000 ; SHORTERRL
STA $1000 ; ERRL
LDA $1001 ; ERRH
ADC $2001 ; SHORTERRH
STA $1001 ; ERRH
LDA ESTKL+0,X ; MAJORSPANL
STA $A000
STA $B000
LDA ESTKH+0,X ; MAJORSPANH
STA $A001
STA $B001
end
asm _majorspansA
- DEX
DEX
DEX
LDA ESTKL+8,X ; MAJORSTARTL
STA ESTKL+2,X
LDA ESTKH+8,X ; MAJORSTARTH
STA ESTKH+2,X
LDA ESTKL+7,X ; MAJORL
STA ESTKL+1,X
LDA ESTKH+7,X ; MAJORH
STA ESTKH+1,X
LDA ESTKL+5,X ; MINORL
STA ESTKL+0,X
LDA ESTKH+5,X ; MINORH
STA ESTKH+0,X
JSR $A000
LDA ESTKL+2,X ; MINORL
CLC
ADC ESTKL+1,X ; DIRL
STA ESTKL+2,X
LDA ESTKH+2,X ; MINORH
ADC ESTKH+1,X ; DIRH
STA ESTKH+2,X
LDA ESTKL+4,X ; MAJORL
CLC
ADC #$01
STA ESTKL+5,X ; MAJORSTARTL
LDA ESTKH+4,X ; MAJORH
ADC #$00
STA ESTKH+5,X ; MAJORSTARTH
end
asm _majorspansB
LDY $1001 ; ERRH
BMI +
end
asm _majorspansC
LDA $1000 ; ERRL
CLC
ADC $2000 ; SHORTERRL
STA $1000 ; ERRL
TYA ; ERRH
ADC $2001 ; SHORTERRH
STA $1001 ; ERRH
LDA ESTKL+4,X ; MAJORL
CLC
ADC $3000 ; SHORTLENL
STA ESTKL+4,X
LDA ESTKH+4,X ; MAJORH
ADC $3001 ; SHORTLENH
STA ESTKH+4,X
LDA ESTKL+4,X ; MAJORL
CMP ESTKL+3,X ; MAJORENDL
LDA ESTKH+4,X ; MAJORH
SBC ESTKH+3,X ; MAJORENDH
BCC -
BCS ++
end
asm _majorspansD
+ LDA $1000 ; ERRL
CLC
ADC $4000 ; LONGERRL
STA $1000 ; ERRL
TYA ; ERRH
ADC $4001 ; LONGERRL
STA $1001 ; ERRH
LDA ESTKL+4,X ; MAJORL
CLC
ADC $5000 ; LONGLENL
STA ESTKL+4,X
LDA ESTKH+4,X ; MAJORH
ADC $5001 ; LONGLENH
STA ESTKH+4,X
LDA ESTKL+4,X ; MAJORL
CMP ESTKL+3,X ; MAJORENDL
LDA ESTKH+4,X ; MAJORH
SBC ESTKH+3,X ; MAJORENDH
BCS ++
end
asm _majorspansE
JMP $6000
++ DEX
DEX
DEX
LDA ESTKL+8,X ; MAJORSTARTL
STA ESTKL+2,X
LDA ESTKH+8,X ; MAJORSTARTH
STA ESTKH+2,X
LDA ESTKL+6,X ; MAJORENDL
STA ESTKL+1,X
LDA ESTKH+6,X ; MAJORENDH
STA ESTKH+1,X
LDA ESTKL+5,X ; MINORL
STA ESTKL+0,X
LDA ESTKH+5,X ; MINORH
STA ESTKH+0,X
JSR $B000
TXA
CLC
ADC #$06
TAX
RTS
end
asm nopLin(a, b, c)#0
INX
end
asm nopPix(a, b)#0
INX
INX
RTS
end
//def hline(x1, x2, dx2, y, dy2, sy)#0
// var dyx2, x
//
// err = dy2 - dx2 / 2
// dyx2 = dy2 - dx2
// for x = x1 to x2
// plot(x, y)#0
// if err >= 0
// y = y + sy
// err = err + dyx2
// else
// err = err + dy2
// fin
// next
//end
asm hline(x1, x2, dx2, y, dy2, sy)#0
LDA ESTKH+3,X ; DX2H
LSR
STA TMPH
LDA ESTKL+3,X ; DX2L
ROR
STA TMPL
LDA ESTKL+1,X ; DY2L
SEC
SBC TMPL
STA $1000 ; ERRL
LDA ESTKH+1,X ; DY2H
SBC TMPH
STA $1001 ; ERRH
LDA ESTKL+1,X ; DY2L
SEC
SBC ESTKL+3,X ; DX2L
STA ESTKL+3,X ; DYX2L
LDA ESTKH+1,X ; DY2H
SBC ESTKH+3,X ; DX2H
STA ESTKH+3,X ; DYX2H
- DEX
DEX
LDA ESTKL+7,X ; XL
STA ESTKL+1,X
LDA ESTKH+7,X ; XH
STA ESTKH+1,X
LDA ESTKL+4,X ; YL
STA ESTKL+0,X
LDA ESTKH+4,X ; YH
STA ESTKH+0,X
end
asm _hlineA
JSR $2000 ; PLOT
LDA $1001 ; ERRH
BMI +
LDA ESTKL+2,X ; YL
CLC
ADC ESTKL+0,X ; SYL
STA ESTKL+2,X
LDA ESTKH+2,X ; YH
ADC ESTKH+0,X ; SYH
STA ESTKH+2,X
LDA ESTKL+3,X ; DYX2L
LDY ESTKH+3,X ; DYX2H
BEQ ++
BNE ++
end
asm _hlineB
+ LDA ESTKL+1,X ; DY2L
LDY ESTKH+1,X ; DY2H
++ CLC
ADC $1000 ; ERRL
STA $1000 ; ERRL
TYA
ADC $1001 ; ERRH
STA $1001 ; ERRH
LDA ESTKL+5,X ; X1L
CMP ESTKL+4,X ; X2L
LDA ESTKH+5,X
SBC ESTKH+4,X
BCS +
INC ESTKL+5,X ; XL
BNE -
INC ESTKH+5,X ; XH
BCC -
+ TXA
ADC #$05
TAX
RTS
end
//def vline(y1, y2, dy2, x, dx2, sx)#0
// var dxy2, y
//
// err = dx2 - dy2 / 2
// dxy2 = dx2 - dy2
// for y = y1 to y2
// plot(x, y)#0
// if err >= 0
// x = x + sx
// err = err + dxy2
// else
// err = err + dx2
// fin
// next
//end
asm vline(y1, y2, dy2, x, dx2, sx)#0
LDA ESTKH+3,X ; DY2H
LSR
STA TMPH
LDA ESTKL+3,X ; DY2L
ROR
STA TMPL
LDA ESTKL+1,X ; DX2L
SEC
SBC TMPL
STA $1000 ; ERRL
LDA ESTKH+1,X ; DX2H
SBC TMPH
STA $1001 ; ERRH
LDA ESTKL+1,X ; DX2L
SEC
SBC ESTKL+3,X ; DX2L
STA ESTKL+3,X ; DXY2L
LDA ESTKH+1,X ; DX2H
SBC ESTKH+3,X ; DY2H
STA ESTKH+3,X ; DXY2H
- DEX
DEX
LDA ESTKL+4,X ; XL
STA ESTKL+1,X
LDA ESTKH+4,X ; XH
STA ESTKH+1,X
LDA ESTKL+7,X ; YL
STA ESTKL+0,X
LDA ESTKH+7,X ; YH
STA ESTKH+0,X
end
asm _vlineA
JSR $2000 ; PLOT
LDA $1001 ; ERRH
BMI +
LDA ESTKL+2,X ; XL
CLC
ADC ESTKL+0,X ; SXL
STA ESTKL+2,X
LDA ESTKH+2,X ; XH
ADC ESTKH+0,X ; SXH
STA ESTKH+2,X
LDA ESTKL+3,X ; DXY2L
LDY ESTKH+3,X ; DXY2H
BEQ ++
BNE ++
end
asm _vlineB
+ LDA ESTKL+1,X ; DX2L
LDY ESTKH+1,X ; DX2H
++ CLC
ADC $1000 ; ERRL
STA $1000 ; ERRL
TYA
ADC $1001 ; ERRH
STA $1001 ; ERRH
LDA ESTKL+5,X ; Y1L
CMP ESTKL+4,X ; Y2L
LDA ESTKH+5,X
SBC ESTKH+4,X
BCS +
INC ESTKL+5,X ; YL
BNE -
INC ESTKH+5,X ; YH
BCC -
+ TXA
ADC #$05
TAX
RTS
end
export def setlinespans(h, v)#0
hspan = h
vspan = v
end
def hmajorspans(x1, y1, x2, y2, dx, dy, sy)#0
var dy2, halflen, rem
//
// Half-span length and error
//
dy2 = dy * 2
halflen, rem = divmod(dx, dy2)
err = dy2 - rem
//
// Long-span length = half-span length * 2
//
longlen = (halflen + 1) * 2
longerr = err * 2
if longerr >= dy2
longerr = longerr - dy2
longlen--
fin
//
// Short-span length = long-span length - 1
//
shortlen = longlen - 1
shorterr = longerr - dy2
majorspans(x1, x1 + halflen, x2, y1, sy, hspan)
end
def vmajorspans(x1, y1, x2, y2, dx, dy, sx)#0
var dx2, halflen, rem
//
// Half-span length and error
//
dx2 = dx * 2
halflen, rem = divmod(dy, dx2)
err = dx2 - rem
//
// Long-span length = half-span length * 2
//
longlen = (halflen + 1) * 2
longerr = err * 2
if longerr >= dx2
longerr = longerr - dx2
longlen--
fin
shortlen = longlen - 1
shorterr = longerr - dx2
majorspans(y1, y1 + halflen, y2, x1, sx, vspan)
end
export def linespans(x1, y1, x2, y2)#0
var dx, dy, dx2, dy2, halflen, rem, sx, sy
sx = 1
sy = 1
dx = x2 - x1
if dx < 0
sx = -1; dx = -dx
fin
dy = y2 - y1
if dy < 0
sy = -1; dy = -dy
fin
if dx >= dy
if sx < 0
y1, y2 = y2, y1
x1, x2 = x2, x1
sy = -sy
fin
if dy == 0
hspan(x1, x2, y1)#0; return
fin
//
// JIT optimize setup
//
hmajorspans(x1, y1, x2, y2, dx, dy, sy)
else
if sy < 0
x1, x2 = x2, x1
y1, y2 = y2, y1
sx = -sx
fin
if dx == 0
vspan(y1, y2, x1)#0; return
fin
//
// JIT optimize inner setup
//
vmajorspans(x1, y1, x2, y2, dx, dy, sx)
fin
end
export def setlineplot(p)#0
plot = p
end
export def line(x1, y1, x2, y2)#0
var sx, sy, dx2, dy2
sx = 1
sy = 1
dx2 = (x2 - x1) * 2
if dx2 < 0
sx = -1; dx2 = -dx2
fin
dy2 = (y2 - y1) * 2
if dy2 < 0
sy = -1; dy2 = -dy2
fin
if dx2 >= dy2
if sx < 0
x1, x2 = x2, x1
y1, y2 = y2, y1
sy = -sy
fin
hline(x1, x2, dx2, y1, dy2, sy)
else
if sy < 0
y1, y2 = y2, y1
x1, x2 = x2, x1
sx = -sx
fin
vline(y1, y2, dy2, x1, dx2, sx)
fin
end
//
// Assembly fixups
//
majorspans:1 = @err
majorspans:5 = @shorterr
majorspans:8 = @err
majorspans:11 = @err.1
majorspans:14 = @shorterr.1
majorspans:17 = @err.1
majorspans:22 = @_majorspansA.28
majorspans:25 = @_majorspansE.31
majorspans:30 = @_majorspansA.29
majorspans:33 = @_majorspansE.32
_majorspansB:1 = @err.1
_majorspansC:1 = @err
_majorspansC:5 = @shorterr
_majorspansC:8 = @err
_majorspansC:12 = @shorterr.1
_majorspansC:15 = @err.1
_majorspansC:21 = @shortlen
_majorspansC:28 = @shortlen.1
_majorspansD:1 = @err
_majorspansD:5 = @longerr
_majorspansD:8 = @err
_majorspansD:12 = @longerr.1
_majorspansD:15 = @err.1
_majorspansD:21 = @longlen
_majorspansD:28 = @longlen.1
_majorspansE:1 = @_majorspansA
hline:16 = @err
hline:23 = @err.1
_hlineA:1 = @jmpplot
_hlineA:4 = @err.1
_hlineB:6 = @err
_hlineB:9 = @err
_hlineB:13 = @err.1
_hlineB:16 = @err.1
vline:16 = @err
vline:23 = @err.1
_vlineA:1 = @jmpplot
_vlineA:4 = @err.1
_vlineB:6 = @err
_vlineB:9 = @err
_vlineB:13 = @err.1
_vlineB:16 = @err.1
done

91
src/libsrc/lz4.pla Normal file
View File

@@ -0,0 +1,91 @@
include "inc/cmdsys.plh"
asm incs
!SOURCE "vmsrc/plvmzp.inc"
end
//
// Always forward copy memory - important for overlapping match sequences
//
asm bcpy(dst, src, len)#0
INX
INX
INX
LDA ESTKL-3,X
ORA ESTKH-3,X
BEQ CPYEX
LDA ESTKL-1,X
STA DSTL
LDA ESTKH-1,X
STA DSTH
LDA ESTKL-2,X
STA SRCL
LDA ESTKH-2,X
STA SRCH
LDY ESTKL-3,X
BEQ CPYLP
INC ESTKH-3,X
LDY #$00
CPYLP LDA (SRC),Y
STA (DST),Y
INY
BNE +
INC DSTH
INC SRCH
+ DEC ESTKL-3,X
BNE CPYLP
DEC ESTKH-3,X
BNE CPYLP
CPYEX RTS
end
//
// Unpack LZ4 sequence into buffer, return unpacked length
//
export def lz4Unpack(seq, seqend, buff, buffend)
word data, len, match, i
byte token
data = buff
while isult(seq, seqend)
token = ^seq
seq++
len = token >> 4
if len
//
// Literal sequence
//
if len == 15
while ^seq == 255
len = len + 255
seq++
loop
len = len + ^seq
seq++
fin
if isuge(data + len, buffend); return 0; fin
bcpy(data, seq, len)
data = data + len
seq = seq + len
fin
len = token & $0F
if len or isult(seq, seqend)
//
// Match sequence
//
match = data - *seq
seq = seq + 2
len = len + 4
if len == 19 // $0F + 4
while ^seq == 255
len = len + 255
seq++
loop
len = len + ^seq
seq++
fin
if isuge(data + len, buffend); return 0; fin
bcpy(data, match, len)
data = data + len
fin
loop
return data - buff
end
done

View File

@@ -544,7 +544,7 @@ export def hmemNew(size)
//
// Allocate 3/4 of available heap on 128K machine, 1/2 on 64K machine
//
poolsize = ((@page - heapmark) >> 1) & $7FFF
poolsize = (heapavail >> 1) & $7FFF
if MACHID & $30 == $30
poolsize = poolsize + (poolsize >> 1)
fin
@@ -666,7 +666,7 @@ end
// !!! Does this work on Apple ///???
//
sysbuf = $0800 // heapallocalign(1024, 8, 0)
initdata = heapmark // Use data at top of heap for initialization
initdata = heapalloc(t_initdata) // Use data on heap for initialization
initdata=>volparms.0 = 2
initdata=>volparms.1 = 0
initdata=>volparms:2 = sysbuf
@@ -733,5 +733,6 @@ repeat
fin
until !initdata->filecnt
fileio:close(initdata->catref)
heaprelease(initdata)
//puts(@swapvol); putln
done

View File

@@ -734,19 +734,21 @@ def loadcode(codefile)
ref = fileio:open(strcat(strcpy(@filepath, cmdsys:syspath), codefile))
//puts("ref = "); prbyte(ref); puts(" perr = "); prbyte(perr); putln
if ref
pcode = heapmark
pcode = heapalloc(512)
fileio:read(ref, pcode, 512)
//puts("Read header bytes: "); puti(seglen)
//if seglen == 0; puts(" perr = "); prbyte(perr); fin
//getc; putln
//dumpheader(pcode)
//putname(pcode + segname + 8); putc('='); prword(pcode); putln
heaprelease(pcode + (pcode + t_diskinfo)=>codeaddr) // REserve heap to end of buffer
seglen = fileio:read(ref, pcode, (pcode + t_diskinfo)=>codeaddr)
//puts("Read segment bytes: "); puti(seglen); putln
fileio:close(ref)
if !fp6502 and (MACHID & $F0 == $B0) // 128K Apple //e or //c
seglen = fixup(AUXADDR, pcode + seglen - 2) - pcode
auxmove(AUXADDR, pcode, seglen)
heaprelease(pcode)
pcode = AUXADDR
else
heaprelease(fixup(pcode, pcode + seglen - 2)) // Set heap to beginning of relocation list
@@ -837,8 +839,10 @@ def fpInit()
fpzpsave = heapalloc($0034*2)
(@fixupXS)=>1 = fpzpsave+$34
(@fixupXR)=>1 = fpzpsave+$34
sane[9] = @zpSaveX
sane[10] = @zpRestoreX
zpSaveX // Clear XBYTEs
heaprelease(fpzpsave)
sane[9] = @zpNopSave//zpSaveX
sane[10] = @zpNopRestore//zpRestoreX
else // Apple II
fpzpsave = heapalloc($0034)
sane[9] = @zpSave

View File

@@ -1,116 +0,0 @@
export asm tone(pitch, duration)
!SOURCE "vmsrc/plvmzp.inc"
DEX
LDA ESTKL+1,X
STA ESTKL,X
LDA ESTKH+1,X
STA ESTKH,X
LDA #$00
STA ESTKL+1,X
STA ESTKH+1,X
end
export asm tone2(pitch1, pitch2, duration)#0
STX ESP
LDY ESTKH,X
LDA ESTKL,X
BEQ +
INY
+ STA DSTL
STY DSTH
LDY ESTKL+1,X
STY TMPL
LDA ESTKL+2,X
TAX
LDA #$00
CPX TMPL
BNE +
TAX
+ STX TMPH
PHP
SEI
- CLC
-- DEY
BNE +
LDY TMPL
BEQ ++ ; SILENCE
STA $C030
BNE +++
+ NOP
NOP
++ NOP
NOP
NOP
+++ DEX
BNE +
LDX TMPH
BEQ ++ ; SILENCE
STA $C030
BNE +++
+ NOP
NOP
++ NOP
NOP
NOP
+++ ADC #$01
BNE --
DEC DSTL
BNE -
DEC DSTH
BNE -
PLP
LDX ESP
INX
INX
INX
RTS
end
export asm tonePWM(sample, speed, len)#0
STX ESP
LDY ESTKH,X
LDA ESTKL,X
BEQ +
INY
+ STY DSTH
STA DSTL
LDA ESTKL+2,X
STA SRCL
LDA ESTKH+2,X
STA SRCH
LDY ESTKL+1,X
INY
STY TMPL
LDY #$00
PHP
SEI
- LDA (SRC),Y
SEC
-- LDX TMPL
--- DEX
BNE ---
SBC #$01
BCS --
LDA $C030
INY
BNE +
INC SRCH
+ DEC DSTL
BNE -
DEC DSTH
BNE -
PLP
LDX ESP
INX
INX
INX
RTS
++
end
def toneTest#0
byte t
for t = 2 to 128
tone2(t, t >> 1, 10)
tone(t, 50)
next
end
toneTest()
done

View File

@@ -1,253 +0,0 @@
//
// Original Uthernet ethernet card based on Cirrus Logic cs8900a
//
include "inc/cmdsys.plh"
//
// Include dependency on S/W IP stack
//
import etherip
predef setEtherDriver(MAC, getlen, readfrm, setlen, writefrm)#0
end
//
// Uthernet register offsets
//
const TX_DATA = $00
const RX_DATA = $00
const TX_CMD = $04
const TX_LEN = $06
const INT_STATUS = $08
const PREG_INDEX = $0A
const PREG_DATA = $0C
const AUTO_INC = $8000
//
// Uthernet register addresses
//
byte[] slot // Init time only
byte rxdata_lo, rxdata_hi
byte txcmd
byte txlen
byte isq
byte pregidx
byte pregdata
//
// Uthernet MAC address
//
byte[6] utherMAC = $00,$0A,$99,$1E,$02,$A0
//
// Defines for ASM routines
//
asm equates
!SOURCE "vmsrc/plvmzp.inc"
end
//
// Uthernet I/O functions
//
asm _pokeiow(val)
LDA ESTKL,X
end
asm _pokeiowl
STA $C000
LDA ESTKH,X
end
asm _pokeiowh
STA $C000
RTS
end
//
// PEEK BYTE FROM I/O SPACE
// _peekio()
//
asm _peekio
DEX
end
asm _peekiol
LDA $C000
STA ESTKL,X
LDA #$00
STA ESTKH,X
RTS
end
//
// PEEK WORD FROM I/O SPACE
// _peekiow()
//
asm _peekiow
DEX
end
asm _peekiowl
LDA $C000
STA ESTKL,X
end
asm _peekiowh
LDA $C000
STA ESTKH,X
RTS
end
//
// WRITE FRAME DATA INTO I/O SPACE
// pokefrm(BUF, LEN)
//
asm pokefrm(buf, len)
LDY #$00
LDA ESTKL+1,X
STA SRCL
LDA ESTKH+1,X
STA SRCH
LSR ESTKH,X ; CONVERT BYTE LEN TO WORD LEN
LDA ESTKL,X
ROR
ADC #$00
STA ESTKL,X
BEQ +
!BYTE $A9
- CLC
INC ESTKH,X
+ BCS -
POKELP LDA (SRC),Y
end
asm _pokefrml
STA $C000
INY
LDA (SRC),Y
end
asm _pokefrmh
STA $C000
INY
BNE +
INC SRCH
+ DEC ESTKL,X
BNE POKELP
DEC ESTKH,X
BNE POKELP
INX
RTS
end
//
// READ FRAME DATA FROM I/O SPACE
// peekfrm(BUF, LEN)
//
asm peekfrm(buf, len)
LDY #$00
LDA ESTKL+1,X
STA DSTL
LDA ESTKH+1,X
STA DSTH
LSR ESTKH,X ; CONVERT BYTE LEN TO WORD LEN
LDA ESTKL,X
ROR
ADC #$00
STA ESTKL,X
BEQ +
!BYTE $A9
- CLC
INC ESTKH,X
+ BCS -
end
asm _peekfrml
PEEKLP LDA $C000
STA (DST),Y
INY
end
asm _peekfrmh
+ LDA $C000
STA (DST),Y
INY
BNE +
INC DSTH
+ DEC ESTKL,X
BNE PEEKLP
DEC ESTKH,X
BNE PEEKLP
EXPSW INX
RTS
end
def pokeiow(io, data)
_pokeiowl.1 = io
_pokeiowh.1 = io+1
return _pokeiow(data)
end
def peekio(io)
_peekiol.1 = io
return _peekio()
end
def peekiow(io)
_peekiowl.1 = io
_peekiowh.1 = io+1
return _peekiow()
end
def pokepreg(reg, data)
pokeiow(pregidx, reg)
return pokeiow(pregdata, data)
end
def peekpreg(reg)
pokeiow(pregidx, reg)
return peekiow(pregdata)
end
//
// Set the length of the next packet to send and wait for data space availability
//
def pokefrmlen(len)
pokeiow(txcmd, $C0)
pokeiow(txlen, len)
repeat; until peekpreg($0138) & $0100
return 0
end
//
// Return the length of awaiting packet, 0 otherwise
//
def peekfrmlen
word len
len = 0
if peekiow(isq) & $3F == $04
if peekio(rxdata_hi) & $01
peekio(rxdata_lo)
len.1 = peekio(rxdata_hi)
len.0 = peekio(rxdata_lo)
else
peekio(rxdata_lo)
pokepreg($0102, $0140) // Skip pkt
fin
fin
return len
end
//
// Identify Uthernet card and initialize
//
for slot = $90 to $F0 step $10
if (peekiow(slot+TX_CMD) & $CC3F) == $09
pokeiow(slot+PREG_INDEX, 0)
if peekiow(slot+PREG_DATA) == $630E
pokepreg($0114, $40) // RESET
rxdata_hi = slot + 1
txcmd = slot + TX_CMD
txlen = slot + TX_LEN
isq = slot + INT_STATUS
pregidx = slot + PREG_INDEX
pregdata = slot + PREG_DATA
_pokefrml.1 = slot
_pokefrmh.1 = slot+1
_peekfrml.1 = slot
_peekfrmh.1 = slot+1
pokepreg($0158, utherMAC:0) // MAC addr
pokepreg($015A, utherMAC:2) // MAC addr
pokepreg($015C, utherMAC:4) // MAC addr
pokepreg($0102, $0100) // Recv cfg
pokepreg($0104, $0D00) // Recv ctrl
pokepreg($0106, $8200) // Xmit cfg
pokepreg($0112, $00C0) // Line ctrl
//
// Install etherip driver
//
puts("Found Uthernet I in slot #")
putc('0' + ((slot - $80) >> 4))
putln
setEtherDriver(@utherMAC, @peekfrmlen, @peekfrm, @pokefrmlen, @pokefrm)
return modkeep
fin
fin
next
//
// Not found
//
return -1
done

View File

@@ -1,993 +0,0 @@
//
// Wiznet 5100 based ethernet card
//
// TCP/IP is built into hardware, so no dependencies on the software
// layers, like the Uthernet
//
include "inc/cmdsys.plh"
//
// Net object
//
import inet
word iNet
end
struc t_inet
word initIP
word serviceIP
word openUDP
word sendUDP
word closeUDP
word listenTCP
word connectTCP
word sendTCP
word closeTCP
word setInterfaceIP
word getInterfaceHA
word setCallback
word setParam
end
//
// Module don't free memory
//
const modkeep = $2000
const modinitkeep = $4000
//
// Wiznet registers
//
const WIZ_MR = $00
const WIZ_GWR = $01
const WIZ_SUBR = $05
const WIZ_SHAR = $09
const WIZ_SIPR = $0F
const WIZ_IR = $15
const WIZ_IMR = $16
const WIZ_RTR = $17
const WIZ_RCR = $19
const WIZ_RMSR = $1A
const WIZ_TMSR = $1B
const WIZ_PATR = $1C
const WIZ_PTMR = $28
const WIZ_PMGC = $29
const WIZ_UIPR = $2A
const WIZ_UPRT = $2E
//
// Wiznet socket registers
//
const WIZ_SREGS = $0400
const WIZ_SSIZE = $0100
const WIZ_SOCK0 = $0400
const WIZ_SOCK1 = $0500
const WIZ_SOCK2 = $0600
const WIZ_SOCK3 = $0700
const WIZ_SnMR = $00
const WIZ_SnCR = $01
const WIZ_SnIR = $02
const WIZ_SnSR = $03
const WIZ_SnPORT = $04
const WIZ_SnDHAR = $06
const WIZ_SnDIPR = $0C
const WIZ_SnDPORT = $10
const WIZ_SnMSSR = $12
const WIZ_SnPROTO = $14
const WIZ_SnTOS = $15
const WIZ_SnTTL = $16
const WIZ_SnFSR = $20
const WIZ_SnTXRD = $22
const WIZ_SnTXWR = $24
const WIZ_SnRSR = $26
const WIZ_SnRXRD = $28
//
// Wiznet socket data
//
const WIZ_TXMEM = $4000
const WIZ_TXSIZE = $0800
const WIZ_TXMASK = WIZ_TXSIZE-1
const WIZ_TXMEM0 = $4000
const WIZ_TXMEM1 = $4800
const WIZ_TXMEM2 = $5000
const WIZ_TXMEM3 = $5800
const WIZ_RXMEM = $6000
const WIZ_RXSIZE = $0800
const WIZ_RXMASK = WIZ_RXSIZE-1
const WIZ_RXMEM0 = $6000
const WIZ_RXMEM1 = $6800
const WIZ_RXMEM2 = $7000
const WIZ_RXMEM3 = $7800
//
// Wiznet indirect registers
//
byte regidx, regdata
word slot, saveidx
//
// Wiznet MAC address
//
byte[6] wizMAC = $00,$0A,$99,$1E,$02,$B0
//
// Wiznet IP addresses
//
byte[4] localip
byte[4] subnet
byte[4] gateway
//
// Predefine service routine
//
predef wizServiceIP
//
// Segment list element
//
struc t_segment
word seg_buf
word seg_len
end
//
// Max Ethernet frame size
//
const MAX_FRAME_SIZE = 1518
const MAC_BROADCAST = $FFFF
const MAC_SIZE = 6
//
// Ethernet header
//
struc t_ethrhdr
byte[MAC_SIZE] ethr_dst
byte[MAC_SIZE] ethr_src
word ethr_payload
end
const PAYLOAD_IP = $0008 // BE format
const PAYLOAD_ARP = $0608 // BE format
//
// IP datagram header
//
const IP4ADR_SIZE = 4
struc t_iphdr
byte ip_vers_hlen
byte ip_service
word ip_length
word ip_id
word ip_flags_fragofst
byte ip_ttl
byte ip_proto
word ip_chksm
byte[IP4ADR_SIZE] ip_src
byte[IP4ADR_SIZE] ip_dst
byte[] ip_options
end
const IP_BROADCAST = $FFFF
const IP_PROTO_ICMP = $01
const IP_PROTO_UDP = $11
const IP_PROTO_TCP = $06
word bcast = IP_BROADCAST, IP_BROADCAST
//
// ICMP type/codes
//
const IP_PROTO_ICMP = 1
const ICMP_ECHO_REQST = 8
const ICMP_ECHO_REPLY = 0
//
// ICMP message format
//
struc t_icmp
byte icmp_type
byte icmp_code
word icmp_chksm
word[2] icmp_header
end
//
// UDP IPv4 psuedo header
//
struc t_piphdr
byte[IP4ADR_SIZE] pip_src
byte[IP4ADR_SIZE] pip_dst
byte pip_zero
byte pip_proto
word pip_len
end
//
// UDP header
//
struc t_udphdr
word udp_src
word udp_dst
word udp_len
word udp_chksm
end
//
// TCP header
//
struc t_tcphdr
word tcp_src
word tcp_dst
word tcp_len
word tcp_chksm
end
//
// Local network parameters
//
const MAX_WIZ_CHANNELS = 4
//
// Channel protocols
//
const WIZ_PROTO_CLOSED = 0
const WIZ_PROTO_TCP = 1
const WIZ_PROTO_UDP = 2
const WIZ_PROTO_IP = 3
const WIZ_PROTO_RAW = 4
//
// State transistions
//
const TCP_STATE_CLOSED = 0
const TCP_STATE_CLOSING = 1
const TCP_STATE_LISTEN = 2
const TCP_STATE_CONNECT = 3
const TCP_STATE_OPEN = 4
//
// HW channels
//
struc t_channel
byte channel_proto
byte channel_state
word channel_regs
word channel_txmem
word channel_rxmem
word channel_lclport
word channel_remport
byte[4] channel_remip
word channel_recv_func
word channel_recv_parm
end
byte[t_channel * MAX_WIZ_CHANNELS] wizChannel
//
// Service ICMP hook
//
export word hookICMP
//
// Defines for ASM routines
//
asm equates
!SOURCE "vmsrc/plvmzp.inc"
end
//
// Swap bytes in word
//
asm swab
LDA ESTKL,X
LDY ESTKH,X
STA ESTKH,X
STY ESTKL,X
RTS
end
//
// Wiznet I/O functions
//
// POKE WORD TO I/O SPACE
// Note: Big Endian format
//
asm _pokeiow
LDA ESTKH,X
end
asm _pokeiowl
STA $C000
LDA ESTKL,X
end
asm _pokeiowh
STA $C000
RTS
end
//
// POKE BYTE TO I/O SPACE
//
asm _pokeio
LDA ESTKL,X
end
asm _pokeiol
STA $C000
RTS
end
//
// PEEK BYTE FROM I/O SPACE
//
asm _peekio
DEX
end
asm _peekiol
LDA $C000
STA ESTKL,X
LDA #$00
STA ESTKH,X
RTS
end
//
// PEEK WORD FROM I/O SPACE
// Note: Big Endian format
//
asm _peekiow
DEX
end
asm _peekiowl
LDA $C000
STA ESTKH,X
end
asm _peekiowh
LDA $C000
STA ESTKL,X
RTS
end
//
// WRITE DATA INTO I/O SPACE
// pokedata(BUF, LEN)
//
asm pokedata
LDA ESTKL+1,X
STA SRCL
LDA ESTKH+1,X
STA SRCH
LDY ESTKL,X
BEQ POKELP
LDY #$00
INC ESTKH,X
POKELP LDA (SRC),Y
end
asm _pokedata
STA $C000
INY
BNE +
INC SRCH
+ DEC ESTKL,X
BNE POKELP
DEC ESTKH,X
BNE POKELP
INX
RTS
end
//
// READ DATA FROM I/O SPACE
// peekdata(BUF, LEN)
//
asm peekdata
LDA ESTKL+1,X
STA DSTL
LDA ESTKH+1,X
STA DSTH
LDY ESTKL,X
BEQ PEEKLP
LDY #$00
INC ESTKH,X
end
asm _peekdata
PEEKLP LDA $C000
STA (DST),Y
INY
BNE +
INC DSTH
+ DEC ESTKL,X
BNE PEEKLP
DEC ESTKH,X
BNE PEEKLP
INX
RTS
end
def pokeiow(io, data)
_pokeiowl.1 = io
_pokeiowh.1 = io+1
return _pokeiow(data)
end
def pokeio(io, data)
_pokeiol.1 = io
return _pokeio(data)
end
def peekio(io)
_peekiol.1 = io
return _peekio()
end
def peekiow(io)
_peekiowl.1 = io
_peekiowh.1 = io+1
return _peekiow()
end
def pokereg(reg, data)
_pokeiow(reg)
return _pokeio(data)
end
def peekreg(reg)
_pokeiow(reg)
return _peekio()
end
def pokeregs(reg, buf, len)
// _pokeiow(reg)
// return pokedata(buf, len)
word i
len = len - 1
for i = 0 to len
_pokeiow(reg + i)
_pokeio(buf->[i])
next
end
def peekregs(reg, buf, len)
// _pokeiow(reg)
// return peekdata(buf, len)
// There is an issue missing data on back-to-back reads
word i
len = len - 1
for i = 0 to len
_pokeiow(reg + i)
buf->[i] = _peekio()
next
end
def pokeregw(reg, dataw)
_pokeiow(reg)
_pokeio(dataw.1)
return _pokeio(dataw.0)
end
def peekregw(reg)
word dataw
_pokeiow(reg)
dataw.1 = _peekio()
_pokeiow(reg + 1)
dataw.0 = _peekio()
return dataw
end
//
// DEBUG
//
def putb(hexb)
return call($FDDA, hexb, 0, 0, 0)
end
def puth(hex)
return call($F941, hex >> 8, hex, 0, 0)
end
def putip(ipptr)
byte i
for i = 0 to 2
puti(ipptr->[i]); putc('.')
next
return puti(ipptr->[i])
end
//
// Send UDP datagram
//
def wizSendUDP(wiz, ipdst, portdst, data, len)
word wizregs, wizdata, txrr, txwr, splitlen
wizregs = wiz=>channel_regs
wizdata = wiz=>channel_txmem
if !ipdst
ipdst = @bcast
fin
//
// Wait for Tx room
//
repeat; until peekregw(wizregs + WIZ_SnFSR) >= len
//
// Calc new write ptr, check for split
//
txwr = peekregw(wizregs + WIZ_SnTXWR)
txrr = txwr & WIZ_TXMASK
if txrr + len > WIZ_TXSIZE
splitlen = WIZ_TXSIZE - txrr
pokeregs(wizdata + txrr, data, splitlen)
pokeregs(wizdata, data + splitlen, len - splitlen)
else
pokeregs(wizdata + txrr, data, len)
fin
//
// Set destination address/port
//
pokeregs(wizregs + WIZ_SnDIPR, ipdst, IP4ADR_SIZE)
pokeregw(wizregs + WIZ_SnDPORT, portdst)
//
// Update write pointer and send
//
pokeregw(wizregs + WIZ_SnTXWR, txwr + len)
pokereg(wizregs + WIZ_SnCR, $20) // SEND
end
//
// Open UDP channel and set datagram received callback
//
def wizOpenUDP(localport, callback, param)
word wiz
byte i
if !localport; return -1; fin // invalid port
//
// Look for an existing notification on localport
//
//putc('O')
wiz = @wizChannel
for i = 1 to MAX_WIZ_CHANNELS
if wiz->channel_proto == IP_PROTO_UDP and wiz=>channel_lclport == localport
break
fin
wiz = wiz + t_channel
next
if i > MAX_WIZ_CHANNELS
//
// Add notification on localport if room
//
wiz = @wizChannel
for i = 1 to MAX_WIZ_CHANNELS
if !wiz->channel_proto
break
fin
wiz = wiz + t_channel
next
if i > MAX_WIZ_CHANNELS
return 0
fin
fin
//putc('0' + i);putln
//
// Fill in this channel and open it
//
wiz->channel_proto = WIZ_PROTO_UDP
wiz=>channel_lclport = localport
wiz=>channel_recv_func = callback
wiz=>channel_recv_parm = param
pokeregw(wiz=>channel_regs + WIZ_SnPORT, localport)
pokereg(wiz=>channel_regs + WIZ_SnMR, $02) // UDP protocol
pokereg(wiz=>channel_regs + WIZ_SnCR, $01) // OPEN
return wiz
end
//
// Close UDP port
//
def wizCloseUDP(wiz)
//putc('S')
if isuge(wiz, @wizChannel) and isult(wiz, @wizChannel + MAX_WIZ_CHANNELS * t_channel)
//
// Clear notiications on this port
//
if wiz->channel_proto == WIZ_PROTO_UDP
//putc('1' + ((wiz=>channel_regs - WIZ_SREGS) >> 8));putln
wiz->channel_proto = WIZ_PROTO_CLOSED
pokereg(wiz=>channel_regs + WIZ_SnCR, $10) // CLOSE
return 0
fin
fin
//putc('!');putln
//
// Invalid port
//
return -1
end
//
// Open TCP socket in SERVER mode
//
def wizListenTCP(lclport, callback, param)
word wiz
byte i
//
// Look for an existing notification on localport
//
//putc('L')
wiz = @wizChannel
for i = 1 to MAX_WIZ_CHANNELS
if wiz->channel_proto == WIZ_PROTO_TCP and wiz->channel_state == TCP_STATE_LISTEN and wiz=>channel_lclport == lclport
break
fin
wiz = wiz + t_channel
next
if i > MAX_WIZ_CHANNELS
//
// Add notification on localport if room
//
wiz = @wizChannel
for i = 1 to MAX_WIZ_CHANNELS
if !wiz->channel_proto
break
fin
wiz = wiz + t_channel
next
if i > MAX_WIZ_CHANNELS
return 0
fin
fin
//putc('0' + i);putln
//
// Fill in this channel and open it
//
wiz->channel_proto = WIZ_PROTO_TCP
wiz->channel_state = TCP_STATE_LISTEN
wiz=>channel_remip:0 = 0
wiz=>channel_remip:2 = 0
wiz=>channel_remport = 0
wiz=>channel_lclport = lclport
wiz=>channel_recv_func = callback
wiz=>channel_recv_parm = param
pokereg(wiz=>channel_regs + WIZ_SnMR, $01) // TCP protocol
pokeregw(wiz=>channel_regs + WIZ_SnPORT, lclport)
pokereg(wiz=>channel_regs + WIZ_SnCR, $01) // OPEN
while peekreg(wiz=>channel_regs + WIZ_SnSR) <> $13; loop // Wait for init
pokereg(wiz=>channel_regs + WIZ_SnCR, $02) // LISTEN
return wiz
end
//
// Open TCP socket in CLIENT mode
//
def wizConnectTCP(remip, remport, lclport, callback, param)
word wiz
byte i
//
// Look for an existing notification on localport
//
wiz = @wizChannel
for i = 1 to MAX_WIZ_CHANNELS
if wiz->channel_proto == WIZ_PROTO_TCP and wiz->channel_state == TCP_STATE_CONNECT and wiz=>channel_lclport == lclport
break
fin
wiz = wiz + t_channel
next
if i > MAX_WIZ_CHANNELS
//
// Add notification on localport if room
//
wiz = @wizChannel
for i = 1 to MAX_WIZ_CHANNELS
if !wiz->channel_proto
break
fin
wiz = wiz + t_channel
next
if i > MAX_WIZ_CHANNELS
return 0
fin
fin
//
// Fill in this channel and open it
//
wiz->channel_proto = WIZ_PROTO_TCP
wiz->channel_state = TCP_STATE_CONNECT
wiz=>channel_remip:0 = remip=>0
wiz=>channel_remip:2 = remip=>2
wiz=>channel_remport = remport
wiz=>channel_lclport = lclport
wiz=>channel_recv_func = callback
wiz=>channel_recv_parm = param
pokereg(wiz=>channel_regs + WIZ_SnMR, $01) // TCP protocol
pokeregs(wiz=>channel_regs + WIZ_SnDIPR, remip, IP4ADR_SIZE)
pokeregw(wiz=>channel_regs + WIZ_SnDPORT, remport)
pokeregw(wiz=>channel_regs + WIZ_SnPORT, lclport)
pokereg(wiz=>channel_regs + WIZ_SnCR, $01) // OPEN
while peekreg(wiz=>channel_regs + WIZ_SnSR) <> $13; loop // Wait for init
pokereg(wiz=>channel_regs + WIZ_SnCR, $04) // CONNECT
return wiz
end
//
// Write to TCP socket
//
def wizSendTCP(wiz, data, len)
word wizregs, wizdata, txrr, txwr, splitlen
if wiz->channel_state <> TCP_STATE_OPEN; return -1; fin
//putc('W');puti(len);putc(':')
wizregs = wiz=>channel_regs
wizdata = wiz=>channel_txmem
//
// Wait for Tx room
//
repeat; until peekregw(wizregs + WIZ_SnFSR) >= len
//
// Calc new write ptr, check for split
//
txwr = peekregw(wizregs + WIZ_SnTXWR)
txrr = txwr & WIZ_TXMASK
if txrr + len > WIZ_TXSIZE
splitlen = WIZ_TXSIZE - txrr
pokeregs(wizdata + txrr, data, splitlen)
pokeregs(wizdata, data + splitlen, len - splitlen)
//putc('(');puti(splitlen);putc(',');puti(len-splitlen);putc(')')
else
pokeregs(wizdata + txrr, data, len)
fin
//puth(txrr);putc('-');putc('>');puth(txwr+len);putln
//
// Update write pointer and send
//
pokeregw(wizregs + WIZ_SnTXWR, txwr + len)
pokereg(wizregs + WIZ_SnCR, $20) // SEND
end
//
// Close TCP socket
//
def wizCloseTCP(wiz)
if isuge(wiz, @wizChannel) and isult(wiz, @wizChannel + MAX_WIZ_CHANNELS * t_channel)
//
// Clear notiications on this port
//
if wiz->channel_proto == WIZ_PROTO_TCP and (wiz->channel_state == TCP_STATE_OPEN or wiz->channel_state == TCP_STATE_CLOSING)
wiz->channel_state = TCP_STATE_CLOSING
pokereg(wiz=>channel_regs + WIZ_SnCR, $08) // DISCON
repeat
wizServiceIP()
until wiz->channel_state == TCP_STATE_CLOSED
wiz->channel_proto = WIZ_PROTO_CLOSED
return 0
fin
fin
//
// Invalid port
//
return -1
end
//
// Update notify callback
//
def wizSetCallback(wiz, callback)
if wiz->channel_proto == WIZ_PROTO_UDP or wiz->channel_proto == WIZ_PROTO_TCP
//
// Update callback on this port
//
wiz=>channel_recv_func = callback
return 0
fin
//
// Invalid port
//
return -1
end
//
// Update notify param
//
def wizSetParam(wiz, param)
if wiz->channel_proto == WIZ_PROTO_UDP or wiz->channel_proto == WIZ_PROTO_TCP
//
// Update param on this port
//
wiz=>channel_recv_parm = param
return 0
fin
//
// Invalid port
//
return -1
end
//
// Service incoming packets
//
def wizServiceIP
word wiz, wizregs, wizdata, rxlen, rxrr, rxwr, rxpkt, splitlen
byte ir, i, sir
ir = peekreg(WIZ_IR)
if ir and ir <> $FF // Ignore spurious read of IR
//putc('I');putb(ir)
wiz = @wizChannel
for i = 0 to 3
when ir & (1 << i)
is 1
is 2
is 4
is 8
wizregs = wiz=>channel_regs
wizdata = wiz=>channel_rxmem
sir = peekreg(wizregs + WIZ_SnIR)
when wiz->channel_proto
is WIZ_PROTO_TCP
if sir & $01
//putc('C')
//
// Connect TCP socket
//
when wiz->channel_state
is TCP_STATE_LISTEN
peekregs(wiz=>channel_regs + WIZ_SnDIPR, @wiz=>channel_remip, IP4ADR_SIZE)
wiz=>channel_remport = peekregw(wiz=>channel_regs + WIZ_SnDPORT)
is TCP_STATE_CONNECT
wiz->channel_state = TCP_STATE_OPEN
break
otherwise
//putc('?')
wend
fin
if sir & $04
//putc('R')
//
// Receive TCP packet
//
rxlen = peekregw(wizregs + WIZ_SnRSR)
rxrr = peekregw(wizregs + WIZ_SnRXRD)
rxwr = rxrr & WIZ_RXMASK
rxpkt = heapalloc(rxlen)
//puti(rxlen);putc(':')
if rxwr + rxlen > WIZ_RXSIZE
splitlen = WIZ_RXSIZE - rxwr
peekregs(wizdata + rxwr, rxpkt, splitlen)
peekregs(wizdata, rxpkt + splitlen, rxlen - splitlen)
//putc('(');puti(splitlen);putc(',');puti(rxlen-splitlen);putc(')')
else
peekregs(wizdata + rxwr, rxpkt, rxlen)
fin
//puth(rxwr);putc('-');putc('>');puth(rxwr+rxlen);putln
pokeregw(wizregs + WIZ_SnRXRD, rxrr + rxlen)
pokereg(wizregs + WIZ_SnCR, $40) // RECV
wiz=>channel_recv_func(@wiz=>channel_remip,wiz=>channel_remport,wiz=>channel_lclport,rxpkt,rxlen,wiz=>channel_recv_parm)
heaprelease(rxpkt)
fin
if sir & $02
//putc('S')
//
// Close TCP socket
//
when wiz->channel_state
is TCP_STATE_OPEN
wiz->channel_state = TCP_STATE_CLOSING
wiz=>channel_recv_func(@wiz=>channel_remip,wiz=>channel_remport,0,wiz=>channel_lclport,0,wiz=>channel_recv_parm)
break
is TCP_STATE_CLOSING
wiz->channel_state = TCP_STATE_CLOSED
pokereg(wiz=>channel_regs + WIZ_SnCR, $10) // CLOSE
break
otherwise
//putc('?')
wend
fin
if sir & $08
//putc('T')
//
// Timeout on TCP socket
//
when wiz->channel_state
is TCP_STATE_OPEN
wiz->channel_state = TCP_STATE_CLOSING
wiz=>channel_recv_func(@wiz=>channel_remip,wiz=>channel_remport,wiz=>channel_lclport,0,0,wiz=>channel_recv_parm)
break
is TCP_STATE_CONNECT
wiz=>channel_recv_func(@wiz=>channel_remip,wiz=>channel_remport,wiz=>channel_lclport,0,0,wiz=>channel_recv_parm)
is TCP_STATE_CLOSING
wiz->channel_state = TCP_STATE_CLOSED
pokereg(wiz=>channel_regs + WIZ_SnCR, $10) // CLOSE
break
otherwise
//putc('?')
wend
fin
//if sir & $10
//putc('W');putc('O');putc('K');puth(peekregw(wiz=>channel_regs+WIZ_SnTXWR));putln
//
// Write TCP socket OK
//
//fin
break
is WIZ_PROTO_UDP
//putc('U');putb(sir)
if sir & $04
//putc('R')
//
// Receive UDP packet
//
rxlen = peekregw(wizregs + WIZ_SnRSR)
rxrr = peekregw(wizregs + WIZ_SnRXRD)
rxwr = rxrr & WIZ_RXMASK
rxpkt = heapalloc(rxlen)
if rxwr + rxlen >= WIZ_RXSIZE
//putc('!')
splitlen = WIZ_RXSIZE - rxwr
peekregs(wizdata + rxwr, rxpkt, splitlen)
peekregs(wizdata, rxpkt + splitlen, rxlen - splitlen)
else
peekregs(wizdata + rxwr, rxpkt, rxlen)
fin
//putc('=');putip(rxpkt);putc(' ');puti(rxlen)
//putc('/');puti(swab(rxpkt=>6))
//putc(' ');puth(rxrr);putc(' ');puth(rxwr);putln
pokeregw(wizregs + WIZ_SnRXRD, rxrr + rxlen)
pokereg(wizregs + WIZ_SnCR, $40) // RECV
wiz=>channel_recv_func(rxpkt,swab(rxpkt=>4),rxpkt+8,rxlen-8,wiz=>channel_recv_parm)
heaprelease(rxpkt)
fin
break
otherwise
wend
pokereg(wiz=>channel_regs + WIZ_SnIR, sir) // Clear SnIR
ir = ir ^ (1 << i)
break
wend
wiz = wiz + t_channel
next
if ir
//
// Clear IR for now
//
pokereg(WIZ_IR, ir)
fin
fin
end
//
// Set the local IP addresses
//
def setWizIP(newIP, newSubnet, newGateway)
if newIP
localip:0 = newIP=>0; localip:2 = newIP=>2
pokeregs(WIZ_SIPR, newIP, IP4ADR_SIZE)
fin
if newSubnet
subnet:0 = newSubnet=>0; subnet:2 = newSubnet=>2
pokeregs(WIZ_SUBR, newSubnet, IP4ADR_SIZE)
fin
if newGateway
gateway:0 = newGateway=>0; gateway:2 = newGateway=>2
pokeregs(WIZ_GWR, newGateway, IP4ADR_SIZE)
fin
end
//
// Get the interface hardware address
//
def getWizHA(ha)
if ha
ha=>0 = wizMAC:0; ha=>2 = wizMAC:2; ha=>4 = wizMAC:4
fin
return MAC_SIZE
end
//
// Identify Wiznet card and initialize
//
for slot = $90 to $F0 step $10
regdata = peekio(slot)
if (regdata & $E4) == $00
pokeio(slot, $03) // Try setting auto-increment indirect I/F
if peekio(slot) == $03
saveidx = peekiow(slot + 1)
peekio(slot + 3) // Dummy read to data register should increment index
if peekiow(slot + 1) == saveidx + 1
//
// Good chance this is it
//
pokeio(slot, $80) // RESET
regidx = slot + 1
regdata = slot + 3
_pokedata.1 = regdata
_peekdata.1 = regdata
pokeio(slot, $03) // Auto-increment indirect I/F + enable ping
//
// The following looks redundant, but it sets up the peek/poke locations
// for peekreg(s)/pokereg(s)
//
pokeiow(regidx, WIZ_MR)
pokeio(regdata, $03) // Auto-increment indirect I/F + enable ping
peekio(regdata)
//
// Initialize common registers
//
pokeregs(WIZ_SHAR, @wizMAC, 6) // MAC addr
pokeregw(WIZ_RTR, 5000) // Timeout period to 500ms
pokereg(WIZ_RMSR, $55) // 2K Rx memory/channel
pokereg(WIZ_TMSR, $55) // 2K Tx memory/channel
//
// Fill channel structure
//
saveidx = @wizChannel
for slot = 0 to 3
saveidx=>channel_regs = WIZ_SREGS + (WIZ_SSIZE * slot)
saveidx=>channel_txmem = WIZ_TXMEM + (WIZ_TXSIZE * slot)
saveidx=>channel_rxmem = WIZ_RXMEM + (WIZ_RXSIZE * slot)
saveidx = saveidx + t_channel
next
//
// Fill in Net class
//
iNet:serviceIP = @wizServiceIP
iNet:openUDP = @wizOpenUDP
iNet:sendUDP = @wizSendUDP
iNet:closeUDP = @wizCloseUDP
iNet:listenTCP = @wizListenTCP
iNet:connectTCP = @wizConnectTCP
iNet:sendTCP = @wizSendTCP
iNet:closeTCP = @wizCloseTCP
iNet:setInterfaceIP = @setWizIP
iNet:getInterfaceHA = @getWizHA
iNet:setCallback = @wizSetCallback
iNet:setParam = @wizSetParam
return modkeep
fin
fin
pokeio(slot, regdata) // Restore register
fin
next
//
// Not found
//
return -1
done

View File

@@ -1,62 +1,98 @@
.SUFFIXES =
AFLAGS = -o $@
PLVM = plvm
PLVM01 = A1PLASMA\#060280
PLVM02 = PLASMA.SYSTEM\#FF2000
PLVM802 = PLASMA16.SYSTEM\#FF2000
PLVM03 = SOS.INTERP\#050000
CMD = CMD\#061000
ED = ED\#FE1000
SB = SB\#FF2000
SOS = SOS\#FE1000
ROD = ROD\#FE1000
SIEVE = SIEVE\#FE1000
ARGS = ARGS\#FE1000
SPIPORT = SPIPORT\#FE1000
SDFAT = SDFAT\#FE1000
FATCAT = FATCAT\#FE1000
FATGET = FATGET\#FE1000
FATPUT = FATPUT\#FE1000
FATWDSK = FATWRITEDSK\#FE1000
FATRDSK = FATREADDSK\#FE1000
FILEIO = FILEIO\#FE1000
CONIO = CONIO\#FE1000
SANE = SANE\#FE1000
FPSTR = FPSTR\#FE1000
FPU = FPU\#FE1000
SNDSEQ = SNDSEQ\#FE1000
PLAYSEQ = PLAYSEQ\#FE1000
SANITY = SANITY\#FE1000
RPNCALC = RPNCALC\#FE1000
WIZNET = WIZNET\#FE1000
UTHERNET2= UTHERNET2\#FE1000
UTHERNET= UTHERNET\#FE1000
ETHERIP = ETHERIP\#FE1000
INET = INET\#FE1000
DHCP = DHCP\#FE1000
HTTPD = HTTPD\#FE1000
DGR = DGR\#FE1000
TONE = TONE\#FE1000
PORTIO = PORTIO\#FE1000
ROGUE = ROGUE\#FE1000
ROGUEMAP= ROGUEMAP\#FE1000
ROGUECOMBAT= ROGUECOMBAT\#FE1000
HELLO = HELLO\#FE1000
MON = MON\#FE1000
DGRTEST = DGRTEST\#FE1000
TEST = TEST\#FE1000
TESTLIB = TESTLIB\#FE1000
PROFILE = PROFILE\#FE1000
MEMMGR = MEMMGR\#FE1000
MEMTEST = MEMTEST\#FE1000
FIBERTEST = FIBERTEST\#FE1000
FIBER = FIBER\#FE1000
LONGJMP = LONGJMP\#FE1000
PLASM = plasm
PLASMAPLASM = PLASM\#FE1000
CODEOPT = 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
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
ZIPCHIP = rel/apple/ZIPCHIP\#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 ][
#
@@ -73,13 +109,31 @@ TXTTYPE = .TXT
#SYSTYPE = \#FF2000
#TXTTYPE = \#040000
all: $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVM802) $(PLVM03) $(CMD) $(PLASMAPLASM) $(CODEOPT) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(SOS) $(ROD) $(SIEVE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(TONE) $(DGR) $(DGRTEST) $(FILEIO) $(CONIO) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ)
apple: $(PLVMZP_APL) $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVMJIT) $(PLVM802) $(PLVM03) $(PLVMJIT03) $(CMD) $(CMDJIT) $(JIT) $(JIT16) $(JITUNE) $(SOSCMD) $(SOSCMDJIT) $(PLASMAPLASM) $(CODEOPT) $(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)
-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) $(PLVM03)
-rm toolsrc/*.o toolsrc/*~ toolsrc/*.a
-rm vmsrc/*.o vmsrc/*~ vmsrc/*.a vmsrc/*.sym
-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
@@ -101,28 +155,68 @@ $(CODEOPT): toolsrc/codeopt.pla toolsrc/codeseq.plh
$(PLVM): vmsrc/plvm.c
cc vmsrc/plvm.c -o $(PLVM)
vmsrc/a1cmd.a: vmsrc/a1cmd.pla $(PLASM)
./$(PLASM) -AOW < vmsrc/a1cmd.pla > vmsrc/a1cmd.a
$(PLVMZP_APL): FORCE
-mkdir -p rel
-mkdir -p rel/apple
-rm -f vmsrc/plvmzp.inc
-ln -s apple/plvmzp.inc vmsrc/plvmzp.inc
$(PLVM01): vmsrc/plvm01.s vmsrc/a1cmd.a
acme -o $(PLVM01) -l vmsrc/plvm01.sym vmsrc/plvm01.s
$(PLVMZP_C64): FORCE
-mkdir -p rel
-mkdir -p rel/c64
-rm -f vmsrc/plvmzp.inc
-ln -s c64/plvmzp.inc vmsrc/plvmzp.inc
$(CMD): vmsrc/cmd.pla vmsrc/cmdstub.s $(PLVM02) $(PLASM)
./$(PLASM) -AOW < vmsrc/cmd.pla > vmsrc/cmd.a
acme --setpc 8192 -o $(CMD) vmsrc/cmdstub.s
FORCE:
$(PLVM02): vmsrc/plvm02.s
acme -o $(PLVM02) -l vmsrc/plvm02.sym vmsrc/plvm02.s
vmsrc/c64/cmd.a: vmsrc/c64/cmd.pla $(PLASM)
./$(PLASM) -AOW < vmsrc/c64/cmd.pla > vmsrc/c64/cmd.a
$(PLVM802): vmsrc/plvm802.s
acme -o $(PLVM802) -l vmsrc/plvm802.sym vmsrc/plvm802.s
$(PLVMC64): vmsrc/c64/plvmc64.s vmsrc/c64/cmd.a
acme -f cbm -o $(PLVMC64) -l vmsrc/c64/plvmc64.sym vmsrc/c64/plvmc64.s
vmsrc/soscmd.a: vmsrc/soscmd.pla $(PLASM)
./$(PLASM) -AOW < vmsrc/soscmd.pla > vmsrc/soscmd.a
vmsrc/apple/a1cmd.a: vmsrc/apple/a1cmd.pla $(PLASM)
./$(PLASM) -AOW < vmsrc/apple/a1cmd.pla > vmsrc/apple/a1cmd.a
$(PLVM03): vmsrc/plvm03.s vmsrc/soscmd.a
acme -o $(PLVM03) -l vmsrc/plvm03.sym vmsrc/plvm03.s
$(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
#
@@ -137,9 +231,9 @@ $(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
$(SB): toolsrc/sb.pla $(PLVM02) $(PLASM) toolsrc/sb.pla
./$(PLASM) -AOW < toolsrc/sb.pla > toolsrc/sb.a
acme --setpc 8192 -o $(SB) toolsrc/sb.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
@@ -157,69 +251,61 @@ $(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
$(SNDSEQ): libsrc/sndseq.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/sndseq.pla > libsrc/sndseq.a
acme --setpc 4094 -o $(SNDSEQ) libsrc/sndseq.a
$(PLAYSEQ): samplesrc/playseq.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/playseq.pla > samplesrc/playseq.a
acme --setpc 4094 -o $(PLAYSEQ) samplesrc/playseq.a
$(LONGJMP): libsrc/longjmp.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/longjmp.pla > libsrc/longjmp.a
acme --setpc 4094 -o $(LONGJMP) libsrc/longjmp.a
$(MON): samplesrc/mon.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/mon.pla > samplesrc/mon.a
acme --setpc 4094 -o $(MON) samplesrc/mon.a
$(SFM): samplesrc/sfm.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/sfm.pla > samplesrc/sfm.a
acme --setpc 4094 -o $(SFM) samplesrc/sfm.a
$(SOS): libsrc/sos.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMO < libsrc/sos.pla > libsrc/sos.a
acme --setpc 4094 -o $(SOS) libsrc/sos.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/rogue.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/rogue.pla > samplesrc/rogue.a
acme --setpc 4094 -o $(ROGUE) samplesrc/rogue.a
$(ROGUECOMBAT): samplesrc/rogue.combat.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/rogue.combat.pla > samplesrc/rogue.combat.a
acme --setpc 4094 -o $(ROGUECOMBAT) samplesrc/rogue.combat.a
$(ROGUEMAP): samplesrc/rogue.map.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/rogue.map.pla > samplesrc/rogue.map.a
acme --setpc 4094 -o $(ROGUEMAP) samplesrc/rogue.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) -AMO < samplesrc/rod.pla > samplesrc/rod.a
./$(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
$(UTHERNET): libsrc/uthernet.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/uthernet.pla > libsrc/uthernet.a
acme --setpc 4094 -o $(UTHERNET) libsrc/uthernet.a
$(PRIMEGAP): samplesrc/primegap.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMW < samplesrc/primegap.pla > samplesrc/primegap.a
acme --setpc 4094 -o $(PRIMEGAP) samplesrc/primegap.a
$(UTHERNET2): libsrc/uthernet2.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/uthernet2.pla > libsrc/uthernet2.a
acme --setpc 4094 -o $(UTHERNET2) libsrc/uthernet2.a
$(INT32): libsrc/int32.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/int32.pla > libsrc/int32.a
acme --setpc 4094 -o $(INT32) libsrc/int32.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
$(FILEIO): libsrc/fileio.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/fileio.pla > libsrc/fileio.a
acme --setpc 4094 -o $(FILEIO) libsrc/fileio.a
$(CONIO): libsrc/conio.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/conio.pla > libsrc/conio.a
acme --setpc 4094 -o $(CONIO) libsrc/conio.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
@@ -237,13 +323,81 @@ $(SANITY): samplesrc/sanity.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/sanity.pla > samplesrc/sanity.a
acme --setpc 4094 -o $(SANITY) samplesrc/sanity.a
$(RPNCALC): samplesrc/rpncalc.pla libsrc/fpu.pla inc/fpu.plh libsrc/fpstr.pla inc/fpstr.plh libsrc/conio.pla inc/conio.plh $(PLVM02) $(PLASM)
$(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
$(TONE): libsrc/tone.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/tone.pla > libsrc/tone.a
acme --setpc 4094 -o $(TONE) libsrc/tone.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
@@ -265,39 +419,108 @@ $(FATRDSK): samplesrc/fatreaddsk.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/fatreaddsk.pla > samplesrc/fatreaddsk.a
acme --setpc 4094 -o $(FATRDSK) samplesrc/fatreaddsk.a
$(SDFAT): libsrc/sdfat.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/sdfat.pla > libsrc/sdfat.a
acme --setpc 4094 -o $(SDFAT) libsrc/sdfat.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/spiport.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/spiport.pla > libsrc/spiport.a
acme --setpc 4094 -o $(SPIPORT) libsrc/spiport.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
$(PORTIO): libsrc/portio.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/portio.pla > libsrc/portio.a
acme --setpc 4094 -o $(PORTIO) libsrc/portio.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
$(DGR): libsrc/dgr.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/dgr.pla > libsrc/dgr.a
acme --setpc 4094 -o $(DGR) libsrc/dgr.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
$(DGRTEST): samplesrc/dgrtest.pla $(PLVM02) $(PLASM)
$(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
$(ROGUE): samplesrc/rogue.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/rogue.pla > samplesrc/rogue.a
acme --setpc 4094 -o $(ROGUE) samplesrc/rogue.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
$(ROGUECOMBAT): samplesrc/rogue.combat.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/rogue.combat.pla > samplesrc/rogue.combat.a
acme --setpc 4094 -o $(ROGUECOMBAT) samplesrc/rogue.combat.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
$(ZIPCHIP): utilsrc/apple/zipchip.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/zipchip.pla > utilsrc/apple/zipchip.a
acme --setpc 4094 -o $(ZIPCHIP) utilsrc/apple/zipchip.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
$(ROGUEMAP): samplesrc/rogue.map.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/rogue.map.pla > samplesrc/rogue.map.a
acme --setpc 4094 -o $(ROGUEMAP) samplesrc/rogue.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

311
src/mkrel
View File

@@ -1,102 +1,251 @@
cp CMD#061000 prodos/CMD.BIN
cp PLASMA.SYSTEM#FF2000 prodos/PLASMA.SYSTEM.SYS
cp PLASMA16.SYSTEM#FF2000 prodos/PLASMA16.SYSTEM.SYS
cp SOS.INTERP#050000 prodos/SOS.INTERP.\$05
cp ../doc/Editor.md prodos/EDITOR.README.TXT
cp rel/apple/CMD#061000 prodos/CMD.BIN
cp rel/apple/CMD128#061000 prodos/CMD128.BIN
cp rel/apple/PLASMA.SYSTEM#FF2000 prodos/PLASMA.SYSTEM.SYS
cp rel/apple/PLVM.128#FF2000 prodos/PLVM.128.SYS
cp rel/apple/PLVM16#FF2000 prodos/PLVM16.SYS
cp ../doc/Editor.md prodos/EDITOR.README.TXT
rm -rf prodos/sys
mkdir prodos/sys
cp ARGS#FE1000 prodos/sys/ARGS.REL
cp CONIO#FE1000 prodos/sys/CONIO.REL
cp DGR#FE1000 prodos/sys/DGR.REL
cp DHCP#FE1000 prodos/sys/DHCP.REL
cp ED#FE1000 prodos/sys/ED.REL
cp ETHERIP#FE1000 prodos/sys/ETHERIP.REL
cp FIBER#FE1000 prodos/sys/FIBER.REL
cp FILEIO#FE1000 prodos/sys/FILEIO.REL
cp FPSTR#FE1000 prodos/sys/FPSTR.REL
cp FPU#FE1000 prodos/sys/FPU.REL
cp INET#FE1000 prodos/sys/INET.REL
cp LONGJMP#FE1000 prodos/sys/LONGJMP.REL
cp MEMMGR#FE1000 prodos/sys/MEMMGR.REL
cp PORTIO#FE1000 prodos/sys/PORTIO.REL
cp SANE#FE1000 prodos/sys/SANE.REL
cp SDFAT#FE1000 prodos/sys/SDFAT.REL
cp SPIPORT#FE1000 prodos/sys/SPIPORT.REL
cp SNDSEQ#FE1000 prodos/sys/SNDSEQ.REL
cp UTHERNET#FE1000 prodos/sys/UTHERNET.REL
cp UTHERNET2#FE1000 prodos/sys/UTHERNET2.REL
cp SOS#FE1000 prodos/sys/SOS.REL
cp rel/apple/FILEIO#FE1000 prodos/sys/FILEIO.REL
cp rel/apple/CONIO#FE1000 prodos/sys/CONIO.REL
cp rel/LINES#FE1000 prodos/sys/LINES.REL
cp rel/apple/HGRFONT#FE1000 prodos/sys/HGRFONT.REL
cp rel/apple/HGRTILE#FE1000 prodos/sys/HGRTILE.REL
cp rel/apple/HGRSPRITE#FE1000 prodos/sys/HGRSPRITE.REL
cp rel/apple/HGRLIB#FE1000 prodos/sys/HGRLIB.REL
cp rel/apple/GRLIB#FE1000 prodos/sys/GRLIB.REL
cp rel/apple/DGRLIB#FE1000 prodos/sys/DGRLIB.REL
cp rel/apple/COPY#FE1000 prodos/sys/COPY.REL
cp rel/apple/DEL#FE1000 prodos/sys/DEL.REL
cp rel/apple/REN#FE1000 prodos/sys/REN.REL
cp rel/apple/CAT#FE1000 prodos/sys/CAT.REL
cp rel/apple/NEWDIR#FE1000 prodos/sys/NEWDIR.REL
cp rel/apple/TYPE#FE1000 prodos/sys/TYPE.REL
cp rel/apple/MATCHFILES#FE1000 prodos/sys/MATCHFILES.REL
cp rel/ARGS#FE1000 prodos/sys/ARGS.REL
cp rel/ED#FE1000 prodos/sys/ED.REL
cp rel/FIBER#FE1000 prodos/sys/FIBER.REL
cp rel/LONGJMP#FE1000 prodos/sys/LONGJMP.REL
cp rel/MEMMGR#FE1000 prodos/sys/MEMMGR.REL
cp rel/INET#FE1000 prodos/sys/INET.REL
cp rel/DHCP#FE1000 prodos/sys/DHCP.REL
cp rel/ETHERIP#FE1000 prodos/sys/ETHERIP.REL
cp rel/apple/MOUSE#FE1000 prodos/sys/MOUSE.REL
cp rel/apple/UTHERNET2#FE1000 prodos/sys/UTHERNET2.REL
cp rel/apple/UTHERNET#FE1000 prodos/sys/UTHERNET.REL
cp rel/apple/PORTIO#FE1000 prodos/sys/PORTIO.REL
cp rel/apple/JOYBUZZ#FE1000 prodos/sys/JOYBUZZ.REL
cp rel/apple/SNDSEQ#FE1000 prodos/sys/SNDSEQ.REL
cp rel/apple/JIT#FE1000 prodos/sys/JIT.REL
cp rel/apple/JIT16#FE1000 prodos/sys/JIT16.REL
cp rel/apple/JITUNE#FE1000 prodos/sys/JITUNE.REL
cp rel/apple/ZIPCHIP#FE1000 prodos/sys/ZIPCHIP.REL
cp rel/LZ4#FE1000 prodos/sys/LZ4.REL
cp rel/TFTPD#FE1000 prodos/sys/TFTPD.REL
cp rel/INT32#FE1000 prodos/sys/INT32.REL
cp rel/FPSTR#FE1000 prodos/sys/FPSTR.REL
cp rel/FPU#FE1000 prodos/sys/FPU.REL
cp rel/SANE#FE1000 prodos/sys/SANE.REL
cp ../sysfiles/FP6502.CODE#060000 prodos/sys/FP6502.CODE.BIN
cp ../sysfiles/ELEMS.CODE#060000 prodos/sys/ELEMS.CODE.BIN
cp ../sysfiles/ELEMS.CODE#060000 prodos/sys/ELEMS.CODE.BIN
cp rel/apple/SOS#FE1000 prodos/sys/SOS.REL
cp rel/apple/GRAFIX#FE1000 prodos/sys/GRAFIX.REL
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/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 DGRTEST#FE1000 prodos/demos/DGRTEST.REL
cp RPNCALC#FE1000 prodos/demos/RPNCALC.REL
cp ROD#FE1000 prodos/demos/ROD.REL
cp rel/INT32TEST#FE1000 prodos/demos/INT32TEST.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
cp rel/PRIMEGAP#FE1000 prodos/demos/PRIMEGAP.REL
mkdir prodos/demos/rogue
cp ROGUE#FE1000 prodos/demos/rogue/ROGUE.REL
cp ROGUECOMBAT#FE1000 prodos/demos/rogue/ROGUECOMBAT.REL
cp ROGUEMAP#FE1000 prodos/demos/rogue/ROGUEMAP.REL
cp rel/ROGUE#FE1000 prodos/demos/rogue/ROGUE.REL
cp rel/ROGUECOMBAT#FE1000 prodos/demos/rogue/ROGUECOMBAT.REL
cp rel/ROGUEMAP#FE1000 prodos/demos/rogue/ROGUEMAP.REL
cp samplesrc/LEVEL0#040000 prodos/demos/rogue/LEVEL0.TXT
cp samplesrc/LEVEL1#040000 prodos/demos/rogue/LEVEL1.TXT
mkdir prodos/demos/sdutils
cp FATCAT#FE1000 prodos/demos/sdutils/FATCAT.REL
cp FATGET#FE1000 prodos/demos/sdutils/FATGET.REL
cp FATPUT#FE1000 prodos/demos/sdutils/FATPUT.REL
cp FATREADDSK#FE1000 prodos/demos/sdutils/FATREADDSK.REL
cp FATWRITEDSK#FE1000 prodos/demos/sdutils/FATWRITEDSK.REL
mkdir prodos/demos/music
cp rel/apple/PLAYSEQ#FE1000 prodos/demos/music/PLAYSEQ.REL
cp mockingboard/ultima3.seq prodos/demos/music/ULTIMA3.SEQ.BIN
cp mockingboard/startrek.seq prodos/demos/music/STARTREK.SEQ.BIN
mkdir prodos/demos/net
cp HTTPD#FE1000 prodos/demos/net/HTTPD.REL
cp rel/HTTPD#FE1000 prodos/demos/net/HTTPD.REL
cp samplesrc/index.html prodos/demos/net/INDEX.HTML.TXT
mkdir prodos/demos/music
cp PLAYSEQ#FE1000 prodos/demos/music/PLAYSEQ.REL
cp mockingboard/ultima3.seq prodos/demos/music/ULTIMA3.SEQ.BIN
cp mockingboard/startrek.seq prodos/demos/music/STARTREK.SEQ.BIN
mkdir prodos/demos/apple2
cp rel/apple/TILETEST#FE1000 prodos/demos/apple2/TILETEST.REL
cp rel/apple/HGRTEST#FE1000 prodos/demos/apple2/HGRTEST.REL
cp rel/apple/GRTEST#FE1000 prodos/demos/apple2/GRTEST.REL
cp rel/apple/DGRTEST#FE1000 prodos/demos/apple2/DGRTEST.REL
mkdir prodos/demos/apple2/spiders
cp rel/apple/SFM#FE1000 prodos/demos/apple2/spiders/SFM.REL
cp rel/apple/SFMSPRT#FE1000 prodos/demos/apple2/spiders/SFMSPRT.REL
mkdir prodos/demos/apple2/sdutils
cp rel/apple/SPIPORT#FE1000 prodos/demos/apple2/sdutils/SPIPORT.REL
cp rel/apple/SDFAT#FE1000 prodos/demos/apple2/sdutils/SDFAT.REL
cp rel/apple/FATCAT#FE1000 prodos/demos/apple2/sdutils/FATCAT.REL
cp rel/apple/FATGET#FE1000 prodos/demos/apple2/sdutils/FATGET.REL
cp rel/apple/FATPUT#FE1000 prodos/demos/apple2/sdutils/FATPUT.REL
cp rel/apple/FATREADDSK#FE1000 prodos/demos/apple2/sdutils/FATREADDSK.REL
cp rel/apple/FATWRITEDSK#FE1000 prodos/demos/apple2/sdutils/FATWRITEDSK.REL
mkdir prodos/demos/apple3
cp rel/apple/GFXDEMO#FE1000 prodos/demos/apple3/GFXDEMO.REL
cp samplesrc/APPLE3.PIX#060000 prodos/demos/apple3/APPLE3.PIX.BIN
rm -rf prodos/bld
mkdir prodos/bld
cp PLASM#FE1000 prodos/bld/PLASM.REL
cp CODEOPT#FE1000 prodos/bld/CODEOPT.REL
cp samplesrc/dgrtest.pla prodos/bld/DGRTEST.PLA.TXT
cp samplesrc/hello.pla prodos/bld/HELLO.PLA.TXT
cp samplesrc/hgr1test.pla prodos/bld/HGR1TEST.PLA.TXT
cp samplesrc/fibertest.pla prodos/bld/FIBERTEST.PLA.TXT
cp samplesrc/mon.pla prodos/bld/MON.PLA.TXT
cp samplesrc/memtest.pla prodos/bld/MEMTEST.PLA.TXT
cp samplesrc/rod.pla prodos/bld/ROD.PLA.TXT
cp samplesrc/sieve.pla prodos/bld/SIEVE.PLA.TXT
cp samplesrc/test.pla prodos/bld/TEST.PLA.TXT
cp samplesrc/testlib.pla prodos/bld/TESTLIB.PLA.TXT
cp samplesrc/playseq.pla prodos/bld/PLAYSEQ.PLA.TXT
cp samplesrc/rpncalc.pla prodos/bld/RPNCALC.PLA.TXT
cp samplesrc/httpd.pla prodos/bld/HTTPD.PLA.TXT
cp samplesrc/fatcat.pla prodos/bld/FATCAT.PLA.TXT
cp samplesrc/rogue.pla prodos/bld/ROGUE.PLA.TXT
cp samplesrc/rogue.map.pla prodos/bld/ROGUE.MAP.PLA.TXT
cp samplesrc/rogue.combat.pla prodos/bld/ROGUE.COMBAT.PLA.TXT
cp rel/PLASM#FE1000 prodos/bld/PLASM.REL
cp rel/CODEOPT#FE1000 prodos/bld/CODEOPT.REL
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/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
cp samplesrc/tiletest.pla prodos/bld/samples/TILETEST.PLA.TXT
cp samplesrc/fibertest.pla prodos/bld/samples/FIBERTEST.PLA.TXT
cp samplesrc/mousetest.pla prodos/bld/samples/MOUSETEST.PLA.TXT
cp samplesrc/memtest.pla prodos/bld/samples/MEMTEST.PLA.TXT
cp samplesrc/rod.pla prodos/bld/samples/ROD.PLA.TXT
cp samplesrc/sieve.pla prodos/bld/samples/SIEVE.PLA.TXT
cp samplesrc/test.pla prodos/bld/samples/TEST.PLA.TXT
cp samplesrc/testlib.pla prodos/bld/samples/TESTLIB.PLA.TXT
cp samplesrc/playseq.pla prodos/bld/samples/PLAYSEQ.PLA.TXT
cp samplesrc/rpncalc.pla prodos/bld/samples/RPNCALC.PLA.TXT
cp samplesrc/fatcat.pla prodos/bld/samples/FATCAT.PLA.TXT
cp samplesrc/gfxdemo.pla prodos/bld/samples/GFXDEMO.PLA.TXT
cp samplesrc/lz4cat.pla prodos/bld/samples/Z4CAT.PLA.TXT
cp samplesrc/sfm.pla prodos/bld/samples/SFM.PLA.TXT
cp samplesrc/sfmsprt.pla prodos/bld/samples/SFMSPRT.PLA.TXT
cp utilsrc/apple/mon.pla prodos/bld/samples/MON.PLA.TXT
cp utilsrc/apple/zipchip.pla prodos/bld/samples/ZIPCHIP.PLA.TXT
#mkdir prodos/bld/examples
#cp samplesrc/examples/ex.1.pla prodos/bld/examples/EX.1.PLA.TXT
#cp samplesrc/examples/ex.2.pla prodos/bld/examples/EX.2.PLA.TXT
#cp samplesrc/examples/ex.3.pla prodos/bld/examples/EX.3.PLA.TXT
#cp samplesrc/examples/ex.4.pla prodos/bld/examples/EX.4.PLA.TXT
#cp samplesrc/examples/ex.5.pla prodos/bld/examples/EX.5.PLA.TXT
#cp samplesrc/examples/ex.6.pla prodos/bld/examples/EX.6.PLA.TXT
#cp samplesrc/examples/ex.7.pla prodos/bld/examples/EX.7.PLA.TXT
#cp samplesrc/examples/ex.8.pla prodos/bld/examples/EX.8.PLA.TXT
#cp samplesrc/examples/ex.9.pla prodos/bld/examples/EX.9.PLA.TXT
#cp samplesrc/examples/ex.10.pla prodos/bld/examples/EX.10.PLA.TXT
#cp samplesrc/examples/ex.11.pla prodos/bld/examples/EX.11.PLA.TXT
#cp samplesrc/examples/ex.12.pla prodos/bld/examples/EX.12.PLA.TXT
#cp samplesrc/examples/ex.13.pla prodos/bld/examples/EX.13.PLA.TXT
#cp samplesrc/examples/ex.14.pla prodos/bld/examples/EX.14.PLA.TXT
#cp samplesrc/examples/ex.15.pla prodos/bld/examples/EX.15.PLA.TXT
#cp samplesrc/examples/ex.16.pla prodos/bld/examples/EX.16.PLA.TXT
#cp samplesrc/examples/ex.17.pla prodos/bld/examples/EX.17.PLA.TXT
mkdir prodos/bld/inc
cp inc/args.plh prodos/bld/inc/ARGS.PLH.TXT
cp inc/cmdsys.plh prodos/bld/inc/CMDSYS.PLH.TXT
cp inc/conio.plh prodos/bld/inc/CONIO.PLH.TXT
cp inc/dgr.plh prodos/bld/inc/DGR.PLH.TXT
cp inc/fiber.plh prodos/bld/inc/FIBER.PLH.TXT
cp inc/fileio.plh prodos/bld/inc/FILEIO.PLH.TXT
cp inc/fpstr.plh prodos/bld/inc/FPSTR.PLH.TXT
cp inc/fpu.plh prodos/bld/inc/FPU.PLH.TXT
cp inc/inet.plh prodos/bld/inc/INET.PLH.TXT
cp inc/longjmp.plh prodos/bld/inc/LONGJMP.PLH.TXT
cp inc/memmgr.plh prodos/bld/inc/MEMMGR.PLH.TXT
cp inc/sane.plh prodos/bld/inc/SANE.PLH.TXT
cp inc/portio.plh prodos/bld/inc/PORTIO.PLH.TXT
cp inc/sdfat.plh prodos/bld/inc/SDFAT.PLH.TXT
cp inc/sndseq.plh prodos/bld/inc/SNDSEQ.PLH.TXT
cp inc/spiport.plh prodos/bld/inc/SPIPORT.PLH.TXT
cp inc/testlib.plh prodos/bld/inc/TESTLIB.PLH.TXT
cp vmsrc/plvmzp.inc prodos/bld/inc/PLVMZP.INC.TXT
cp inc/args.plh prodos/bld/inc/ARGS.PLH.TXT
cp inc/matchfiles.plh prodos/bld/inc/MATCHFILES.PLH.TXT
cp inc/cmdsys.plh prodos/bld/inc/CMDSYS.PLH.TXT
cp inc/conio.plh prodos/bld/inc/CONIO.PLH.TXT
cp inc/lines.plh prodos/bld/inc/LINES.PLH.TXT
cp inc/hgrfont.plh prodos/bld/inc/HGRFONT.PLH.TXT
cp inc/hgrtile.plh prodos/bld/inc/HGRTILE.PLH.TXT
cp inc/hgrsprite.plh prodos/bld/inc/HGRSPRITE.PLH.TXT
cp inc/hgrlib.plh prodos/bld/inc/HGRLIB.PLH.TXT
cp inc/grlib.plh prodos/bld/inc/GRLIB.PLH.TXT
cp inc/dgrlib.plh prodos/bld/inc/DGRLIB.PLH.TXT
cp inc/fiber.plh prodos/bld/inc/FIBER.PLH.TXT
cp inc/fileio.plh prodos/bld/inc/FILEIO.PLH.TXT
cp inc/int32.plh prodos/bld/inc/INT32.PLH.TXT
cp inc/fpstr.plh prodos/bld/inc/FPSTR.PLH.TXT
cp inc/fpu.plh prodos/bld/inc/FPU.PLH.TXT
cp inc/mouse.plh prodos/bld/inc/MOUSE.PLH.TXT
cp inc/inet.plh prodos/bld/inc/INET.PLH.TXT
cp inc/longjmp.plh prodos/bld/inc/LONGJMP.PLH.TXT
cp inc/memmgr.plh prodos/bld/inc/MEMMGR.PLH.TXT
cp inc/sane.plh prodos/bld/inc/SANE.PLH.TXT
cp inc/joybuzz.plh prodos/bld/inc/JOYBUZZ.PLH.TXT
cp inc/portio.plh prodos/bld/inc/PORTIO.PLH.TXT
cp inc/sdfat.plh prodos/bld/inc/SDFAT.PLH.TXT
cp inc/sndseq.plh prodos/bld/inc/SNDSEQ.PLH.TXT
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

82
src/opstat Executable file
View File

@@ -0,0 +1,82 @@
echo -n "CN "; grep -c '; CN' $1
echo -n "MINUS1 "; grep -c '; MINUS' $1
echo -n "BREQ "; grep -c '; BREQ' $1
echo -n "BRNE "; grep -c '; BRNE' $1
echo -n "LA "; grep -c '; LA' $1
echo -n "LLA "; grep -c '; LLA' $1
echo -n "CB "; grep -c '; CB' $1
echo -n "CW "; grep -c '; CW' $1
echo -n "CS "; grep -c '; CS' $1
echo -n "DROP "; grep -c '; DROP ' $1
echo -n "DROP2 "; grep -c '; DROP2' $1
echo -n "DUP "; grep -c '; DUP' $1
echo -n "DIVMOD "; grep -c '; DIVMOD' $1
echo -n "ADDI "; grep -c '; ADDI' $1
echo -n "SUBI "; grep -c '; SUBI' $1
echo -n "ANDI "; grep -c '; ANDI' $1
echo -n "ORI "; grep -c '; ORI' $1
echo -n "ISEQ "; grep -c '; ISEQ' $1
echo -n "ISNE "; grep -c '; ISNE' $1
echo -n "ISGT "; grep -c '; ISGT' $1
echo -n "ISLT "; grep -c '; ISLT' $1
echo -n "ISGE "; grep -c '; ISGE' $1
echo -n "ISLE "; grep -c '; ISLE' $1
echo -n "BRFLS "; grep -c '; BRFLS' $1
echo -n "BRTRU "; grep -c '; BRTRU' $1
echo -n "BRNCH "; grep -c '; BRNCH' $1
echo -n "SEL "; grep -c '; SEL' $1
echo -n "CALL "; grep -c '; CALL' $1
echo -n "ICAL "; grep -c '; ICAL' $1
echo -n "ENTER "; grep -c '; ENTER' $1
echo -n "LEAVE "; grep -c '; LEAVE' $1
echo -n "RET "; grep -c '; RET' $1
echo -n "CFFB "; grep -c '; CFFB' $1
echo -n "LB "; grep -c '; LB' $1
echo -n "LW "; grep -c '; LW' $1
echo -n "LLB "; grep -c '; LLB' $1
echo -n "LLW "; grep -c '; LLW' $1
echo -n "LAB "; grep -c '; LAB' $1
echo -n "LAW "; grep -c '; LAW' $1
echo -n "DLB "; grep -c '; DLB' $1
echo -n "DLW "; grep -c '; DLW' $1
echo -n "SB "; grep -c '; SB' $1
echo -n "SW "; grep -c '; SW' $1
echo -n "SLB "; grep -c '; SLB' $1
echo -n "SLW "; grep -c '; SLW' $1
echo -n "SAB "; grep -c '; SAB' $1
echo -n "SAW "; grep -c '; SAW' $1
echo -n "DAB "; grep -c '; DAB' $1
echo -n "DAW "; grep -c '; DAW' $1
echo -n "NOT "; grep -c '; NOT' $1
echo -n "ADD "; grep -c '; ADD ' $1
echo -n "SUB "; grep -c '; SUB ' $1
echo -n "MUL "; grep -c '; MUL' $1
echo -n "DIV "; grep -c '; DIV' $1
echo -n "MOD "; grep -c '; MOD' $1
echo -n "INCR "; grep -c '; INCR' $1
echo -n "DECR "; grep -c '; DECR' $1
echo -n "NEG "; grep -c '; NEG' $1
echo -n "COMP "; grep -c '; COMP' $1
echo -n "AND "; grep -c '; AND ' $1
echo -n "OR "; grep -c '; OR' $1
echo -n "XOR "; grep -c '; XOR' $1
echo -n "SHL "; grep -c '; SHL' $1
echo -n "SHR "; grep -c '; SHR' $1
echo -n "IDXW "; grep -c '; IDXW' $1
echo -n "BRGT "; grep -c '; BRGT' $1
echo -n "BRLT "; grep -c '; BRLT' $1
echo -n "INCBRLE "; grep -c '; INCBRLE' $1
echo -n "ADDBRLE "; grep -c '; ADDBRLE' $1
echo -n "DECBRGE "; grep -c '; DECBRGE' $1
echo -n "SUBBRGE "; grep -c '; SUBBRGE' $1
echo -n "BRAND "; grep -c '; BRAND' $1
echo -n "BROR "; grep -c '; BROR' $1
echo -n "ADDLB "; grep -c '; ADDLB' $1
echo -n "ADDLW "; grep -c '; ADDLW' $1
echo -n "ADDAB "; grep -c '; ADDAB' $1
echo -n "ADDAW "; grep -c '; ADDAW' $1
echo -n "IDXLB "; grep -c '; IDXLB' $1
echo -n "IDXLW "; grep -c '; IDXLW' $1
echo -n "IDXAB "; grep -c '; IDXAB' $1
echo -n "IDXAW "; grep -c '; IDXAW' $1

Binary file not shown.

View File

@@ -1,4 +1,7 @@
include "inc/dgr.plh"
include "inc/cmdsys.plh"
include "inc/dgrlib.plh"
include "inc/lines.plh"
sysflags restxt1|restxt2|resxtxt1|resxtxt2 // Reserve all text pages
byte[] sprite1 = $80,$80,$00,$00,$00,$00,$80,$80
byte[] = $80,$00,$0A,$0A,$0A,$0A,$00,$80
@@ -18,42 +21,45 @@ byte[] = $0A,$05,$0A,$05,$0A,$05,$0A,$00
// Test routine
//
def dgrTest#0
byte b, l, k
word i, j, ii, ij
byte b, l, k
word i, j, ii, ij
b = dgrMode()
for k = 15 downto 0
dgrClear(dgrbuff[0], k)
next
for l = 0 to 79
dgrColor(l)
dgrLine(dgrbuff[0], 0, 0, l, 47)
next
for l = 47 downto 0
dgrColor(l)
dgrLine(dgrbuff[0], 0, 0, 79, l)
next
ii = 2
ij = -1
i = 40
j = 10
^$C010
while ^$C000 < 128
dgrFill(dgrbuff[b], k, k, @tile1)
dgrBLT(dgrbuff[b], i, j, 8, 8, @sprite1)
b = dgrShow(b)
k++
i = i + ii
if i < -3 or i > 75
ii = -ii
fin
j = j + ij
if j < -3 or j > 43
ij = -ij
fin
loop
^$C010
txtMode
b = dgrMode(TRUE)
dgrDrawBuf(0)
for k = 15 downto 0
dgrClear(k)
next
setlinespans(@dgrHLin, @dgrVLin)
for l = 0 to 79
dgrColor(l)
linespans(0, 0, l, 47)
next
for l = 47 downto 0
dgrColor(l)
linespans(0, 0, 79, l)
next
ii = 2
ij = -1
i = 40
j = 10
^$C010
dgrDrawBuf(1)
while ^$C000 < 128
dgrFill(k, k, @tile1)
dgrBLT(i, j, 8, 8, @sprite1)
dgrSwap
k++
i = i + ii
if i < -3 or i > 75
ii = -ii
fin
j = j + ij
if j < -3 or j > 43
ij = -ij
fin
loop
^$C010
dgrMode(FALSE)
end
dgrTest

View File

@@ -0,0 +1,14 @@
//
// THE SIMPLE "HELLO, WORLD." PROGRAM!
//
// THIS IS A COMMENT, EVEYTHING IS
// IGNORED FOR THE REST OF THE LINE
// FOLLOWING "//"
//
// TO RUN, PRESS 'ESC', THEN "X" FROM
// COMMAND MODE. PRESS ANY KEY ONCE IT
// HAS SUCCESSFULLY COMPILED AND TOLD
// YOU HOW BIG THE RESULTANT PROGRAM IS.
//
PUTS("HELLO, WORLD.")

View File

@@ -0,0 +1,292 @@
// RADAR SCOPE
//
// HERE IS ANOTHER LO-RES DEMO WITH
// A LITTLE MORE ON THE ALGORITHMIC
// SIDE OF THINGS. ON A IIGS, YOU WILL
// NEED TO ENABLE THE ALTERNATE DISPLAY
// OPTION IN THE CONTROL PANEL (ROM 01
// ONLY). THIS PROGRAM COPIES THE PAGE1
// LORES GRAPHICS TO THE PAGE2 FOR A
// FLICKER-FREE DISPLAY.
//
// NOTICE HOW SOME OF THE FUNCTIONS
// RETURN A VALUE THAT ISN'T USED. THIS
// IS CALLED "CASCADING THE RETURN".
// IN PLASMA, ALL FUNCTION DEFINITIONS
// RETURN A VALUE, EVEN IF IT ISN'T
// EXPLICITY SHOWN. A VALUE OF ZERO
// WILL BE SILENTLY ADDED IF NONE IS
// SPECIFIED. BY RETURNING A VALUE OF
// A FUNCTION OR SOFTSWITCH REFERENCE AT
// THE END OF THE DEFINTION IS A SLIGHT
// OPTIMIZATION IN THAT PLASMA WILL
// JUST PASS THE LAST VALUE BACK TO THE
// CALLER, WITHOUT DROPPING THE VALUE
// ON THE STACK AND PUSHING A ZERO BACK
// ON.
//
CONST SHOWGR = $C050
CONST SHOWFULL = $C052
CONST SHOWPG1 = $C054
CONST SHOWPG2 = $C055
CONST SHOWLORES = $C056
CONST RADIUS = 19
CONST XORG = 19
CONST YORG = 23
BYTE[RADIUS] OCTANT
BYTE NUMPOINTS
DEF TEXTMODE
^SHOWPG1
RETURN CALL($FB39, 0, 0, 0, 0)
END
DEF CPYBUF
RETURN MEMCPY($0800, $0400, 1024)
END
DEF GRMODE
CALL($F832, 0, 0, 0, 0)
^SHOWGR
^SHOWFULL
CPYBUF
^SHOWPG2
RETURN ^SHOWLORES
END
DEF COLOR(CLR)
RETURN CALL($F864, CLR, 0, 0, 0)
END
DEF HLIN(LEFT, RIGHT, VERT)
^$2C = RIGHT
RETURN CALL($F819, VERT, 0, LEFT, 0)
END
DEF VLIN(TOP, BOTTOM, HORZ)
^$2D = BOTTOM
RETURN CALL($F828, TOP, 0, HORZ, 0)
END
//
// MODIFIED BRESENHAM TO DRAW SYMETRICAL
// SPANS FROM BOTH ENDS (DOUBLE SPEED)
//
DEF LINE(X1, Y1, X2, Y2)
BYTE DX, DY, DX2, DY2, PP, S
WORD SX, SY, ERR, DD2
IF X1 < X2
SX = 1
DX = X2 - X1
ELSE
SX = -1
DX = X1 - X2
FIN
IF Y1 < Y2
SY = 1
DY = Y2 - Y1
ELSE
SY = -1
DY = Y1 - Y2
FIN
DX2 = DX << 1
DY2 = DY << 1
IF DX >= DY
//
// HORIZONTAL LINE
//
IF SX < 0
PP = X1
X1 = X2
X2 = PP
PP = Y1
Y1 = Y2
Y2 = PP
SY = -SY
FIN
DD2 = DX2 - DY2
ERR = DX - DY2
DY = (DY + 1) >> 1
SX = 1
WHILE DY
IF ERR < 0
//
// DRAW TOP AND BOTTOM SPANS AT
// SAME TIME
//
IF Y2 - Y1 == SY
//
// THIS FIXES ANY OFF-BY-ONE
// PIXELS ON LAST REMAINING
// ADJACENT SPANS
//
HLIN(X1, X1 + SX - 1, Y1)
HLIN(X1 + SX, X2, Y2)
ELSE
HLIN(X1, X1 + SX - 1, Y1)
HLIN(X2 - SX + 1, X2, Y2)
FIN
X1 = X1 + SX
X2 = X2 - SX
Y1 = Y1 + SY
Y2 = Y2 - SY
DY = DY - 1
SX = 1
ERR = ERR + DD2
ELSE
SX = SX + 1
ERR = ERR - DY2
FIN
LOOP
IF Y2 == Y1
HLIN(X1, X2, Y2)
FIN
ELSE
//
// VERTICAL LINE
//
IF SY < 0
PP = X1
X1 = X2
X2 = PP
PP = Y1
Y1 = Y2
Y2 = PP
SX = -SX
FIN
DD2 = DY2 - DX2
ERR = DY - DX2
DX = (DX + 1) >> 1
SY = 1
WHILE DX
IF ERR < 0
//
// DRAW RIGHT AND LEFT SPANS
// AT THE SAME TIME
//
IF X2 - X1 == SX
//
// THIS FIXES ANY OFF-BY-ONE
// PIXELS ON LAST REMAINING
// ADJACENT SPANS
//
VLIN(Y1, Y1 + SY - 1, X1)
VLIN(Y1 + SY, Y2, X2)
ELSE
VLIN(Y1, Y1 + SY - 1, X1)
VLIN(Y2 - SY + 1, Y2, X2)
FIN
X1 = X1 + SX
X2 = X2 - SX
Y1 = Y1 + SY
Y2 = Y2 - SY
DX = DX - 1
SY = 1
ERR = ERR + DD2
ELSE
SY = SY + 1
ERR = ERR - DX2
FIN
LOOP
IF X2 == X1
VLIN(Y1, Y2, X2)
FIN
FIN
END
DEF RADAR(C)
BYTE I
FOR I = 1 TO NUMPOINTS
COLOR(C)
LINE(XORG, YORG, XORG + I, YORG - OCTANT[I])
CPYBUF
COLOR(0)
LINE(XORG, YORG, XORG + I, YORG - OCTANT[I])
NEXT
FOR I = NUMPOINTS - 1 DOWNTO 0
COLOR(C)
LINE(XORG, YORG, XORG + OCTANT[I], YORG - I)
CPYBUF
COLOR(0)
LINE(XORG, YORG, XORG + OCTANT[I], YORG - I)
NEXT
FOR I = 1 TO NUMPOINTS
COLOR(C)
LINE(XORG, YORG, XORG + OCTANT[I], YORG + I)
CPYBUF
COLOR(0)
LINE(XORG, YORG, XORG + OCTANT[I], YORG + I)
NEXT
FOR I = NUMPOINTS - 1 DOWNTO 0
COLOR(C)
LINE(XORG, YORG, XORG + I, YORG + OCTANT[I])
CPYBUF
COLOR(0)
LINE(XORG, YORG, XORG + I, YORG + OCTANT[I])
NEXT
FOR I = 1 TO NUMPOINTS
COLOR(C)
LINE(XORG, YORG, XORG - I, YORG + OCTANT[I])
CPYBUF
COLOR(0)
LINE(XORG, YORG, XORG - I, YORG + OCTANT[I])
NEXT
FOR I = NUMPOINTS - 1 DOWNTO 0
COLOR(C)
LINE(XORG, YORG, XORG - OCTANT[I], YORG + I)
CPYBUF
COLOR(0)
LINE(XORG, YORG, XORG - OCTANT[I], YORG + I)
NEXT
FOR I = 1 TO NUMPOINTS
COLOR(C)
LINE(XORG, YORG, XORG - OCTANT[I], YORG - I)
CPYBUF
COLOR(0)
LINE(XORG, YORG, XORG - OCTANT[I], YORG - I)
NEXT
FOR I = NUMPOINTS - 1 DOWNTO 0
COLOR(C)
LINE(XORG, YORG, XORG - I, YORG - OCTANT[I])
CPYBUF
COLOR(0)
LINE(XORG, YORG, XORG - I, YORG - OCTANT[I])
NEXT
END
//
// USE BRESENHAM CIRCLE ALG TO CALC
// FIRST OCTANT
//
DEF CIRCALC
BYTE X, Y
WORD ERR
X = 0
Y = RADIUS
ERR = 3 - (RADIUS << 1)
WHILE X <= Y
IF ERR <= 0
ERR = ERR + (X << 2) + 6
ELSE
ERR = ERR + ((X - Y) << 2) + 10
Y = Y - 1
FIN
OCTANT[X] = Y
X = X + 1
LOOP
NUMPOINTS = X - 1
END
CIRCALC
GRMODE
REPEAT
RADAR(15)
UNTIL ^$C000 > 127
^$C010
TEXTMODE
DONE

View File

@@ -0,0 +1,245 @@
CONST FALSE = 0
CONST TRUE = 1
//
// HERE IS AN INTERACTIVE EXAMPLE.
//
// SET AUTOPLAY TO FALSE TO USE THE
// PADDLE CONTROL AND PLAY YOURSELF.
//
BYTE AUTOPLAY = TRUE
//
// THE BUILT-IN FUNCTION CALL()
// RETURNS A STRUCTURE THAT CAN BE
// USED TO READ THE REGISTER RESULTS.
// CHECK OUT THE PADDLE() FUNCTION.
//
STRUC S_CALL
BYTE AREG
BYTE XREG
BYTE YREG
BYTE FLAGS
END
CONST SHOWLORES = $C056
CONST KEYBOARD = $C000
CONST KEYSTROBE = $C010
CONST SPEAKER = $C030
BYTE PDLPOS, PDLSIZE, PDLMID, MISS
BYTE XSCRN, YSCRN
BYTE[3] SCORE
WORD XBALL, YBALL, XSPEED, YSPEED
PREDEF INCSCORE
DEF BEEP(TONE, DURATION)
BYTE I, J
FOR J = DURATION DOWNTO 0
FOR I = TONE DOWNTO 0
NEXT
^SPEAKER
NEXT
END
DEF KEYPRESSED
RETURN ^KEYBOARD > 127
END
DEF GETKEY
BYTE KEY
REPEAT
KEY = ^KEYBOARD
UNTIL KEY > 127
^KEYSTROBE
RETURN KEY
END
DEF TEXTMODE
CALL($FB39, 0, 0, 0, 0)
RETURN HOME
END
DEF PUTSXY(X, Y, STRPTR)
GOTOXY(X, Y)
RETURN PUTS(STRPTR)
END
DEF GRMODE
CALL($FB40, 0, 0, 0, 0)
^SHOWLORES
RETURN HOME
END
DEF COLOR(CLR)
RETURN CALL($F864, CLR, 0, 0, 0)
END
DEF PLOT(X, Y)
RETURN CALL($F800, Y, 0, X, 0)
END
DEF HLIN(LEFT, RIGHT, VERT)
^($2C) = RIGHT
RETURN CALL($F819, VERT, 0, LEFT, 0)
END
DEF VLIN(TOP, BOTTOM, HORZ)
^($2D) = BOTTOM
RETURN CALL($F828, TOP, 0, HORZ, 0)
END
DEF PADDLE(NUM)
RETURN CALL($FB1E, 0, NUM, 0, 0)->YREG
END
DEF BUTTON(NUM)
RETURN ^($C060 + NUM) > 127
END
DEF UPDTPDL
IF AUTOPLAY
IF PDLPOS + PDLMID > XSCRN
IF PDLPOS > 0
PDLPOS = PDLPOS - 1
FIN
ELSIF PDLPOS + PDLMID + 1 < XSCRN
IF PDLPOS + PDLSIZE < 39
PDLPOS = PDLPOS + 1
FIN
FIN
ELSE
PDLPOS = PADDLE(0) / 5
FIN
IF PDLPOS + PDLSIZE > 39
PDLPOS = 39 - PDLSIZE
FIN
IF PDLPOS
COLOR(0)
HLIN(0, PDLPOS - 1, 39)
FIN
COLOR(1)
HLIN(PDLPOS, PDLPOS + PDLSIZE, 39)
IF PDLPOS + PDLSIZE < 38
COLOR(0)
HLIN(PDLPOS + PDLSIZE + 1, 39, 39)
FIN
END
DEF UPDTBALL
BYTE XNEW, YNEW
//
// UPDATE HORIZONTAL POSITION
//
XBALL = XBALL + XSPEED
IF XBALL > 623
XBALL = 623
XSPEED = -XSPEED
BEEP(4, 10)
ELSIF XBALL < 16
XBALL = 16
XSPEED = -XSPEED
BEEP(4, 10)
FIN
XNEW = XBALL >> 4
//
// UPDATE VERTICAL POSITION
//
YBALL = YBALL + YSPEED
IF YBALL > 623
//
// CHECK FOR PADDLE HIT
//
IF XNEW >= PDLPOS AND XNEW <= PDLPOS + PDLSIZE
YBALL = 623
YSPEED = -YSPEED - 2
XSPEED = XSPEED + (XNEW - (PDLPOS + PDLMID - 1))
IF XSPEED == 0
IF PDLPOS + PDLMID > 19
XSPEED = 1
ELSE
XSPEED = -1
FIN
FIN
INCSCORE
BEEP(4, 10)
ELSE
MISS = 1
BEEP(14, 40)
FIN
ELSIF YBALL < 16
YBALL = 16
YSPEED = -YSPEED
BEEP(4, 10)
FIN
YNEW = YBALL >> 4
//
// UPDATE ON-SCREEN BALL
//
IF XNEW <> XSCRN OR YNEW <> YSCRN
COLOR(8)
PLOT(XNEW, YNEW)
COLOR(0)
PLOT(XSCRN, YSCRN)
XSCRN = XNEW
YSCRN = YNEW
FIN
END
DEF PUTSCORE
PUTC(SCORE[2])
PUTC(SCORE[1])
PUTC(SCORE[0])
END
DEF INCSCORE
SCORE[0] = SCORE[0] + 1
IF SCORE[0] > '9'
SCORE[0] = '0'
SCORE[1] = SCORE[1] + 1
IF SCORE[1] > '9'
SCORE[1] = '0'
SCORE[2] = SCORE[2] + 1
FIN
FIN
GOTOXY(17, 2)
PUTSCORE
END
DEF INITSCORE
SCORE[0] = '0'
SCORE[1] = '0'
SCORE[2] = '0'
GOTOXY(17, 2)
PUTSCORE
END
PUTS("1=HARD 2=MED 3=EASY ?")
PDLSIZE = (GETKEY - $B0) * 3
PDLMID = PDLSIZE >> 1
GRMODE
COLOR(15)
HLIN(0, 39, 0)
VLIN(1, 38, 0)
VLIN(1, 38, 39)
XBALL = PADDLE(0) + 16
YBALL = PADDLE(1) + 16
XSCRN = XBALL >> 4
YSCRN = YBALL >> 4
XSPEED = 1
YSPEED = 1
MISS = 0
INITSCORE
REPEAT
UPDTPDL
UPDTBALL
UNTIL KEYPRESSED OR MISS
TEXTMODE
HOME
PUTS("YOUR SCORE WAS ")
PUTSCORE
PUTC($0D)
PUTS("THAT'S ALL FOLKS!")
DONE

View File

@@ -0,0 +1,189 @@
//
// This is a simple combat simulator
//
// Many of the different structure,
// address, an pointer operations are
// demonstrated. A few of the many
// flow control constructs are shown,
// including loops, tests, and function
// calls.
//
// A note about in-line strings. When a
// string is encountered in-line, space
// is allocated on the fly for the string
// in memory. PLASMA doesn't have garbage
// collection, so that memory adds up
// until the function exits (or the
// proram ends in the main function).
// If you use strings inside a loop, you
// may overflow memory. Try moving the
// string outside the loop, or into
// initialized memory.
//
const rndnum = $4E // ZP location of RND
const rndl = $4E
const rndh = $4F
struc t_player
byte name[32]
word morality
byte health
byte stamina
byte strength
byte skill
end
byte[32] player = "Player"
word = 0 // morality
byte = 0 // health
byte = 10 // stamina
byte = 50 // strength
byte = 20 // skill
struc t_actor
byte kind
byte life
byte power
word ethics
word next_actor
end
byte preacher = "Preacher", 200
byte zombie = "Zombie", 0
byte cowboy = "Cowboy", 129
byte clerk = "Clerk", 128
byte merchant = "Merchant", 192
byte rustler = "Rustler", 60
byte traveler = "Traveler", 132
byte rogue = "Rogue", 30
//
// Notice how the array is initialized
// with the addresses of prior records.
//
word actors = @preacher, @zombie, @cowboy
word = @clerk, @merchant, @rustler
word = @traveler, @rogue, 0
byte fightstr = "F)ight or R)un?"
byte whostr = "Whom do you want to fight (0=quit)?"
byte numactors
word choice
def rnd
*rndnum = (*rndnum << 1) + *rndnum + 251
return *rndnum & $7FFF
end
//
// Apple //e and //c computers can input
// lower-case, so convert all input into
// upper-case for easier testing.
//
def toupper(c)
if c >= 'a' and c <= 'z'
c = c - ('a' - 'A')
fin
return c
end
def putstats(other)
home()
gotoxy(0, 0)
puts(@player.name)
if player.health == 0
puts(" Died!")
fin
gotoxy(1, 1)
puts("Morality:"); puti(player:morality)
gotoxy(1, 2)
puts("Skill :"); puti(player.skill)
gotoxy(1, 3)
puts("Stamina :"); puti(player.stamina)
gotoxy(1, 4)
puts("Strength:"); puti(player.strength)
gotoxy(1, 5)
puts("Health :"); puti(player.health)
gotoxy(20, 0)
puts(actors[other->kind])
if other->life == 0
puts("Died!")
fin
gotoxy(21, 1)
puts("Ethics :"); puti(other=>ethics)
gotoxy(21, 2)
puts("Power :"); puti(other->power)
gotoxy(21, 3)
puts("Life :"); puti(other->life)
end
def fight(who)
byte[t_actor] enemy
byte quit
word p_atck, e_atck
enemy.kind = who
enemy:ethics = ^(actors[who] + ^(actors[who]) + 1) - 128
enemy.power = 64 + (rnd & 191)
enemy.life = 128 + (rnd & 127)
quit = 0
repeat
putstats(@enemy)
gotoxy(12, 8); puts(@fightstr)
if toupper(getc()) == 'F'
p_atck = player.skill * player.strength / enemy.power
p_atck = p_atck + (rnd() & 15)
if enemy.life > p_atck
enemy.life = enemy.life - p_atck
else
player:morality = player:morality - enemy:ethics
enemy.life = 0
p_atck = player.skill + enemy.power / 10
if p_atck > 255 // Limit skill
p_atck = 255
fin
player.skill = p_atck
quit = 1
fin
e_atck = enemy.power / player.stamina
e_atck = e_atck + (rnd() & 15)
if player.health > e_atck
player.health = player.health - e_atck
else
player.health = 0
quit = 1
fin
else
quit = 1
fin
until quit
putstats(@enemy)
end
//
// This is the main loop. Know when to
// walk away, know when to run.
//
home()
repeat
player.health = 192 + (rnd & 63)
numactors = 0
repeat
gotoxy(10, 10 + numactors)
puti(numactors + 1); putc(' ')
puts(actors[numactors])
numactors = numactors + 1
until not actors[numactors]
gotoxy(2, 11 + numactors)
puts(@whostr)
choice = getc() - '0'
if choice > 0 and choice <= numactors
fight(choice - 1)
elsif choice == 0
player.health = 0
fin
until player.health == 0
gotoxy(0, 21); puts("That's all, folks!")
done

View File

@@ -0,0 +1,59 @@
//
// SIEVE OF ERATOSTHENESE
//
// PRIME NUMBER FINDER SHOWING OFF SOME
// OF PLASMA'S BIT MANIPULATION
// OPERATIONS.
//
// THE APPLE ][ CANNOT DISPLAY THE
// TWO SYMBOLS USED FOR BIT COMPLIMENT
// AND INCLUSIVE OR: THE TILDE AND THE
// BAR. SO ALIASES FOR THESE OPERATORS
// ARE:
//
// ~ : BITWISE COMPLIMENT (CTRL-Y)
// | : BITWISE INCLUSIVE OR (CTRL-B)
//
// ON THE APPLE ][, THESE SHOW UP AS AN
// INVERTED ^ AND AN INVERTED \.
//
// IN THIS EXAMPLE, AN ARRAY IS USED TO
// HOLD THE FLAGS USED TO IDENTIFY NON-
// PRIME VALUES. THIS IS MORE MEMORY
// EFFICIENT THAN USING A WHOLE BYTE FOR
// EACH FLAG, BUT REQUIRES BITWISE TESTS
// FOR ONE OF THE EIGHT FLAGS IN EACH
// BYTE. SHIFTING RIGHT IS A FAST WAY
// TO DIVIDE BY POWERS OF TWO:
// X >> 3 IS THE SAME AS X / 8
// SHIFTING LEFT IS A FAST WAY TO
// MULTIPLY BY POWERS OF TWO:
// X << 2 IS THE SAME AS X * 4
//
CONST FALSE = 0
CONST TRUE = NOT FALSE
CONST IMAX = 8192
CONST IMAXM1 = IMAX-1
CONST SIZEF = IMAX/8
CONST CR = $0D
BYTE[SIZEF] FLAGS
WORD PRIME, I, K, COUNT = 0
MEMSET(@FLAGS, 0, SIZEF)
FOR I = 0 TO IMAXM1
IF NOT (FLAGS[I >> 3] & (1 << (I&7)))
PRIME = I + I + 3
FOR K = PRIME + I TO IMAXM1 STEP PRIME
FLAGS[K >> 3] = FLAGS[K >> 3] | (1 << (K&7))
NEXT
COUNT = COUNT + 1
PUTI(PRIME)
PUTC(CR)
FIN
NEXT
PUTI(COUNT)
PUTS(" PRIMES BETWEEN 0 AND ")
PUTI(IMAX << 1)
DONE

View File

@@ -0,0 +1,111 @@
// PRODOS
//
// I HOPE YOUR INTRODUCTION TO PLASMA
// HAS INSPIRED YOU TO PLAY AROUND WITH
// PROGRAMMING YOUR APPLE II.
//
// THIS NEXT EXAMPLE SHOWS HOW TO CALL
// PRODOS TO DISPLAY A CATALOG. YOU MAY
// WANT TO CONSULT THE PRODOS TECH REF
// TO UNDERSTAND ALL THE PARAMETERS AND
// STRUCTURE OFFSETS.
//
BYTE PERR = 0
BYTE[512] DATABUFF
DEF GETPFX(PATH)
BYTE[3] PARAMS
^PATH = 0
PARAMS.0 = 1
PARAMS:1 = PATH
PERR = SYSCALL($C7, @PARAMS)
RETURN PATH
END
DEF OPEN(PATH, IOBUFF)
BYTE[6] PARAMS
PARAMS.0 = 3
PARAMS:1 = PATH
PARAMS:3 = IOBUFF
PARAMS.5 = 0
SYSCALL($C8, @PARAMS)
RETURN PARAMS.5
END
DEF READ(REFNUM, BUFF, LEN)
BYTE[8] PARAMS
PARAMS.0 = 4
PARAMS.1 = REFNUM
PARAMS:2 = BUFF
PARAMS:4 = LEN
PARAMS:6 = 0
PERR = SYSCALL($CA, @PARAMS)
RETURN PARAMS:6
END
DEF CLOSE(REFNUM)
BYTE[2] PARAMS
PARAMS.0 = 1
PARAMS.1 = REFNUM
PERR = SYSCALL($CC, @PARAMS)
RETURN PERR
END
DEF CATALOG
BYTE[64] PATH
BYTE REFNUM
BYTE FIRSTBLK
BYTE ENTRYLEN, ENTRIESBLK
BYTE I, TYPE, LEN
WORD ENTRY, FILECNT
GETPFX(@PATH)
PUTS(@PATH)
PUTC($0D)
REFNUM = OPEN(@PATH, $0800) // SAFE IO BUFFER LOCATION
IF PERR; RETURN PERR; FIN
FIRSTBLK = 1 // FIRST BLOCK IS TREATED SPECIAL
REPEAT
IF READ(REFNUM, @DATABUFF, 512) == 512
ENTRY = @DATABUFF.$04
IF FIRSTBLK
ENTRYLEN = DATABUFF.$23
ENTRIESBLK = DATABUFF.$24
FILECNT = DATABUFF:$25
ENTRY = ENTRY + ENTRYLEN
FIN
FOR I = FIRSTBLK TO ENTRIESBLK
TYPE = ^ENTRY
IF TYPE
LEN = TYPE & $0F
^ENTRY = LEN
PUTS(ENTRY)
IF ENTRY->$10 == $D0 // IS IT A DIRECTORY?
PUTC('/')
LEN = LEN + 1
ELSIF ENTRY->$10 == $FF // IS IT A SYSTEM FILE?
PUTC('*')
LEN = LEN + 1
FIN
FOR LEN = 19 - LEN DOWNTO 0
PUTC(' ')
NEXT
FILECNT = FILECNT - 1
FIN
ENTRY = ENTRY + ENTRYLEN
NEXT
FIRSTBLK = 0 // DONE WITH FIRST BLOCK
ELSE
FILECNT = 0
FIN
UNTIL FILECNT == 0
RETURN CLOSE(REFNUM)
END
CATALOG()
DONE

View File

@@ -0,0 +1,30 @@
//
// THIS EXAMPLE SHOWS HOW TO CALL
// MACHINE CODE INSIDE YOUR PLASMA
// CODE. THIS MACHINE CODE IS EMBEDDED
// INSIDE THE DATA AND MUST BE POSITION
// INDEPENDENT. FUNCTIONS ARE EXPECTED
// TO RETURN A VALUE ON THE PLASMA
// EVALUATION STACK, INDEXED BY THE
// X-REGISTER. IT MUST BE CONSISTENT:
// INX FOR EVERY ARGUMENT, DEX FOR THE
// RETURN VALUE. THE ACTUAL VALUES ARE
// LOCATED IN ZERO PAGE:
//
// $C0,X = EVAL STACK LO BYTE
// $D0,X = EVAL STACK HI BYTE
//
// IF THE RETURN VALUE IS TO BE IGNORED,
// YOU CAN SKIP THE ACTUAL SETTING OF THE
// EVAL STACK AND JUST UPDATE THE X-REG.
//
BYTE CLICK = $AD, $30, $C0 // LDA $C030
BYTE = $CA // DEX
BYTE = $60 // RTS
BYTE I
FOR I=0 TO 200
(@CLICK)()
NEXT
DONE

View File

@@ -0,0 +1,159 @@
//
// Check github for fully commented code
//
const MAX_FIBERS = 3
const MAX_FIBER = MAX_FIBERS-1
const FIBER_UNAVAIL = 0
const FIBER_FREE = 1
const FIBER_HALT = 2
const FIBER_RUN = 3
byte fbrState[MAX_FIBERS]
word fbrVMState[MAX_FIBERS]
byte fbrNext[MAX_FIBERS] = 0
byte fbrRunning = 0
struc t_vm
byte estklo[$10]
byte estkhi[$10]
byte esp
word ifp
word pp
byte hwsp
byte fill[9]
byte drop
byte nextop[$10]
byte frame[$40]
byte hwstk[$80]
end
word fbrPool[t_vm*MAX_FIBERS]
byte fbrSwap = $B5
byte = $C0,$85,$06,$B5,$D0,$85,$07,$E8
byte = $B5,$C0,$85,$08,$B5,$D0,$85,$09
byte = $86,$E0,$BA,$86,$E5,$A0,$26,$B9
byte = $C0,$00,$91,$08,$B1,$06,$99,$C0
byte = $00,$88,$10,$F3,$8A,$A8,$B9,$00
byte = $01,$91,$08,$C8,$D0,$F8,$A4,$E5
byte = $B1,$06,$99,$00,$01,$C8,$D0,$F8
byte = $A6,$E5,$9A,$A6,$E0,$60
byte fbrLoad = $B5,$C0
byte = $85,$06,$B5,$D0,$85,$07,$A0,$26
byte = $B1,$06,$99,$C0,$00,$88,$10,$F8
byte = $A4,$E5,$B1,$06,$99,$00,$01,$C8
byte = $D0,$F8,$A6,$E5,$9A,$A6,$E0,$60
def fbrInit
byte i
word pool
pool = @fbrPool + t_vm
for i = MAX_FIBER downto 1
fbrState[i] = FIBER_FREE
fbrVMState[i] = pool
pool = pool + t_vm
next
fbrState = FIBER_RUN
fbrVMState = @fbrPool
end
def fbrStop(fid)
byte i
if fid
fbrState[fid] = FIBER_FREE
i = 0
while fbrNext[i] <> fid
i = fbrNext[i]
loop
fbrNext[i] = fbrNext[fid]
if fid == fbrRunning
fbrRunning = fbrNext[fbrRunning]
return (@fbrLoad)(fbrVMState[fbrRunning])
fin
fin
end
def fbrExit
fbrStop(fbrRunning)
end
def fbrStart(defaddr, param)
byte i
word vmstate
for i = MAX_FIBER downto 1
if fbrState[i] == FIBER_FREE
fbrState[i] = FIBER_RUN
vmstate = fbrVMState[i]
vmstate=>ifp = vmstate + hwstk
vmstate=>pp = vmstate + hwstk
vmstate->esp = $0E
vmstate->estklo.$0F = i
vmstate->estkhi.$0F = 0
vmstate->estklo.$0E = param.0 // param lo byte
vmstate->estkhi.$0E = param.1 // param hi byte
vmstate->hwsp = $FB
vmstate=>$FE = @fbrExit - 1
vmstate=>$FC = defaddr - 1
fbrNext[i] = fbrNext[fbrRunning]
fbrNext[fbrRunning] = i
return i
fin
next
end
def fbrYield
byte prev
if fbrNext[fbrRunning] <> fbrRunning
prev = fbrRunning
fbrRunning = fbrNext[fbrRunning]
return (@fbrSwap)(fbrVMState[prev], fbrVMState[fbrRunning])
fin
end
def fbrHalt
byte i
if fbrRunning
i = 0
while fbrNext[i] <> fbrRunning
i = fbrNext[i]
loop
fbrState[fbrRunning] = FIBER_HALT
fbrNext[i] = fbrNext[fbrRunning]
i = fbrRunning
fbrRunning = fbrNext[fbrRunning]
return (@fbrSwap)(fbrVMState[i], fbrVMState[fbrRunning])
fin
end
def fbrResume(fid)
if fbrState[fid] == FIBER_HALT
fbrState[fid] = FIBER_RUN
fbrNext[fid] = fbrNext[fbrRunning]
fbrNext[fbrRunning] = fid
fin
end
//
// Test Fibers
//
def fbrTest(fid, param)
byte x
word i
i = 1
x = fid * 8
while 1
gotoxy(x, fid)
puts(param)
x = x + i
if x < 1 or x > 32
i = -i
fin
fbrYield
loop
end
fbrInit
fbrStart(@fbrTest, " World ")
fbrStart(@fbrTest, " Hello ")
while ^$C000 < 128
fbrYield
loop
^$C010
done

View File

@@ -0,0 +1,55 @@
//
// GAME PORT I/O LIBRARY
// BASED ON THE WIRING LIBRARY
//
CONST ANN0 = $C058
CONST ANN1 = $C05A
CONST ANN2 = $C05C
CONST ANN3 = $C05E
CONST OFF = 0
CONST ON = 1
CONST STROBE = $C040
CONST FLAG0 = $C060
CONST FLAG1 = $C061
CONST FLAG2 = $C062
CONST FLAG3 = $C063
CONST PREAD = $FB1E
CONST WAIT = $FCA8
DEF DIGITALREAD(PIN)
RETURN FLAG0[PIN&3] > 127
END
DEF PORTREAD
RETURN (^FLAG0>>7)&1|(^FLAG1>>6)&2|(^FLAG2>>5)&4|(^FLAG3>>4)&8
END
DEF DIGITALWRITE(PIN, VAL)
RETURN ^ANN0[((PIN&3)<<1)+VAL&1]
END
DEF PORTWRITE(VAL)
^ANN0[VAL&1]
^ANN1[(VAL>>1)&1]
^ANN2[(VAL>>2)&1]
RETURN ^ANN3[(VAL>>3)&1]
END
DEF ANALOGREAD(PIN)
RETURN CALL(PREAD,0,PIN&3,0,0).2
END
DEF DELAY(TIME)
RETURN CALL(WAIT,TIME,0,0,0)
END
//
// OUTPUT THE ANALOG INPUT TO
// THE DIGITAL PORT
//
WHILE ^$C000 < 128
PORTWRITE((255 - ANALOGREAD(2)) / 16)
LOOP
^$C010
DONE

View File

@@ -0,0 +1,92 @@
//
// PLASMA UNDERSTANDS TWO TYPES OF DATA:
// BYTES (UNSIGNED 8 BIT VALUES), AND
// WORDS (SIGNED 16 BIT VALUES). FROM
// THESE TWO TYPES, EVERYTHING MUST BE
// BUILT. BUT, PLASMA HELPS OUT WITH
// DEFINING DATA, INCLUDING ARRAYS,
// STRUCTURES, STRINGS, AND POINTERS.
// YOU'VE ALREADY SEEN A STRING IN THE
// FIRST EXAMPLE. HERE ARE SOME MORE...
//
BYTE[16] FILENAME // RESERVES 16 BYTES
//
// THE FOLLOWING RESERVES A MINUMUM
// AMOUNT OF SPACE FOR A STRING, PLUS
// IT INITIALIZES IT WITH A VALUE.
//
BYTE[32] PREFIX = "/EXAMPLES"
//
// ARRAY DEFINITIONS WITH NO SIZE DON'T
// RESERVE ANY SPACE, BUT ARE USEFUL FOR
// LABELS. ARRAY DEFINITIONS WITHOUT A
// NAMED VARIABLE JUST INITIALIZE THE
// MEMORY WITH VALUES.
//
BYTE[] ALIAS // ALIAS HAS SAME
WORD MYVAR = 1 // ADDRESS AS MYVAR
WORD = 2, 3, 4// BUT DIFFERENT TYPE
//
// PLASMA ALLOWS FLEXIBLE ARRAY SYNTAX,
// MORE TRADITIONAL ARRAYS LOOK LIKE:
//
WORD MYARRAY[2] // PICK ONE STYLE AND
// STICK WITH IT
//
// PLASMA ALSO HELPS OUT WITH CONSTANTS
// THAT CAN BE GIVEN A NAME TO MAKE THE
// CODE MORE READABLE.
//
CONST SPEAKER = $C030 // HEX VALUES START WITH '$'
//
// OF COURSE PLASMA HAS LOOPING
// CONSTRUCTS INCLUDING FOR/NEXT,
// REPEAT/UNTIL, WHILE/LOOP.
//
// THE FOR/NEXT IS THE MOST FLEXIBLE,
// TAKING THE EXPANDED FORM OF:
//
// FOR VAR = LO TO HI STEP INC
//
// FOR VAR = HI DOWNTO LO STEP DEC
//
FOR MYVAR = 0 TO 1000
^SPEAKER // ACCESS SPEAKER TO MAKE NOISE
NEXT
//
// HERE IS THE SAME THING USING A WHILE
// LOOP AND THE INCREMENT STATEMENT. THE
// TONE IS SLIGHTLY LOWER THAN ABOVE DUE
// TO THE 'WHILE' EXECUTING SLIGHTLY
// SLOWER THAN THE 'FOR' LOOP.
//
MYVAR = 0
WHILE MYVAR <= 1000
^SPEAKER
MYVAR++ // INCREMENT VARIABLE
LOOP
//
// AND TO BE THOROUGH, PLASMA PROGRAMS
// SHOULD END WITH A "DONE" SO THE
// COMPILER KNOWS WHEN TO STOP. ANYTHING
// FOLLOWING "DONE" IS IGNORED.
//
DONE
THIS CAN BE HANDY TO HAVE ARBITRARY TEXT
FOLLOWING THE PROGRAM CODE.

View File

@@ -0,0 +1,83 @@
//
// THE PLASMA SANDBOX CAN'T LOAD
// MODULES LIKE THE FULL VERSION, BUT
// IT HAS SOME BUILT-IN FUNCTIONS THAT
// ALLOW EXTENSIVE ACCESS TO THE APPLE'S
// HARDWARE AND SOFTWARE ENVIRONMENT.
// OTHERS ARE JUST CONVENIENT OR ADD
// PERFORMANCE WHERE PLASMA MAY BE TOO
// SLOW
//
CONST TEXTSCREEN = $0400
CONST SCREENSIZE = 1024
BYTE[SCREENSIZE] SAVETXT
BYTE I
WORD NAME
//
// BUILT-IN FUNTIONS:
//
// SYSCALL(CMD,PARAMS) : CALL PRODOS
// CALL(ADDR,AREG,XREG,YREG,PSP) : CALL 6502 ROUTINE WITH REG VALUES
// MEMSET(DSTADDR, VALUE, SIZE) : FILL DSTADDR TO DSTADDR + SIZE WITH VALUE
// MEMCPY(DSTADDR, SRCADDR, SIZE) : COPY SRCADDR TO DSTADDR, SIZE BYTES
// PUTC(CHAR) : PRINT CHAR
// GETC() : READ CHAR FROM KEYBOARD
// PUTI(NUM) : PRINT INTEGER NUMBER
// PUTS(ADDR) : PRINT STRING AT ADDR
// GETS(CHAR) : READ STRING FROM KEYBOARD, PROMPTING WITH CHAR
// HOME() : CLEAR SCREEN AND HOME CURSOR
// GOTOXY(X,Y) : SET CURSOR TO X,Y
//
//
// SAVE THE TEXT SCREEN IN A BIG (1024) ARRAY
//
MEMCPY(@SAVETXT, TEXTSCREEN, SCREENSIZE) // SAVE TEXT SCREEN
//
// CLEAR SCREEN, HOME CURSOR. FOR
// FUNCTIONS WITHOUT PARAMETERS, THE
// "()" ARE OPTIONAL, BUT HELP CLARIFY
// THE FUNCTION CALL IS NOT A VARIABLE
// REFERENCE: HOME VS HOME()
//
HOME()
FOR I = 0 TO 23
//
// MOVE CURSOR TO POSITION X, Y
//
GOTOXY(I, I)
//
// OUTPUT A CHARACTER AND A SPACE
//
PUTC('A' + I)
PUTC(' ')
//
// OUTPUT AN INTEGER
//
PUTI(I)
NEXT
//
// NOTICE THE '@' IN SOME OF THE FUNCTION
// ARGUMENTS? DID YOU NOTICE THE '^' IN
// THE PREVIOUS EXAMPLE? ALL WILL BE
// EXPLAINED IN EX.4.PLA!
//
GOTOXY(10, 5)
PUTS("WHAT IS YOUR NAME")
NAME = GETS($BF) // GETS NEEDS PROMPT CHAR: '?' + 128
GOTOXY(12, 7)
PUTS("NICE TO MEET YOU, ")
PUTS(NAME)
GOTOXY(16, 10)
PUTS("PRESS ANY KEY TO EXIT.")
GETC()
GOTOXY(0, 5)
MEMCPY(TEXTSCREEN, @SAVETXT, SCREENSIZE)
DONE

View File

@@ -0,0 +1,75 @@
//
// IN PLASMA, ANY VALUE CAN BE USED
// AS A CHARACTER, INTEGER, ADDRESS,
// OFFSET, ETC. JUST LIKE IN ASSEMBLY
// LANGUAGE, THERE ARE NO RESTRICTIONS.
// WITH GREAT FLEXIBILITY COMES GREAT
// RESPONSIBILITY. IN THE FIRST EXAMPLE,
// YOU SAW WHERE A STRING WAS PRINTED.
// THE LINE LOOKED LIKE: PUTS(@HELLO)
// HOWEVER, THE STRING NAME WAS JUST
// "HELLO", WITHOUT THE '@'. SO WHAT
// DOES THAT '@' DO? IT IS THE
// ADDRESS-OF OPERATOR. IT TAKES THE
// ADDRESS WHERE THE VARIABLE IS STORED
// FOR ITS VALUE, NOT THE VALUE OF THE
// VARIABLE. WHEN OUTPUTTING THE STRING,
// THE ADDRESS OF THE STRING IS PASSED
// IN, NOT THE ENTIRE STRING. THIS IS
// MUCH MORE EFFICIENT. WHEN AN ADDRESS
// IS PASSED AROUND, IT IS REFERED TO
// AS A "POINTER". IT "POINTS" TO
// SOMETHING.
//
// THE COROLLARY TO THE ADDRESS-OF
// OPERATOR IS THE POINTER-TO OPERATOR.
// NOW, IN PLASMA, A POINTER IS JUST AN
// ADDRESS, THERE IS NO IDEA OF WHAT IT
// POINTS TO. PLASMA ONLY KNOWS ABOUT
// BYTES AND WORDS, SO THERE ARE TWO
// POINTER-TO OPERATORS:
//
// ^ POINTER-TO-BYTE
// * POINTER-TO-WORD
//
// NOW THE '*' OPERATOR LOOKS JUST LIKE
// THE MULTIPLICATION OPERATOR, BUT IT
// BEHAVES DIFFERENTLY DEPENDING ON
// WHERE IT IS PLACED. THESE OPERATORS
// ARE PRE-OPS; THEY COME BEFORE THE
// OPERAND.
//
// NOTE THAT ADDRESSES, THUS POINTERS,
// ARE 16 BIT VALUES ON THE APPLE II.
// IF YOU ARE GOING TO SAVE AN ADDRESS
// IN A VARIABLE, IT MUST BE A WORD
// VARIABLE TO HOLD THE FULL PRECISION.
//
// HERE IS AN EXAMPLE TO PLAY WITH:
//
BYTE MYBYTE = 26
WORD MYWORD = 75
WORD MYPTR
MYPTR = @MYBYTE
PUTI(^MYPTR)
PUTC($8D) // THIS IS A CARRIAGE-RETURN CHARACTER
MYPTR = @MYWORD
PUTI(*MYPTR)
DONE // EVERYTHING AFTER "DONE" IS IGNORED
TRY PLAYING AROUND WITH THE CODE. GO
AHEAD. YOU CAN'T REALLY BREAK THE
COMPUTER. IF IT LOCKS UP AND CTRL-RESET
DOESN'T GET YOU BACK TO THE EDITOR, JUST
REBOOT THE MACHINE.
HOPEFULLY YOU SEE THAT THE VARIABLE
NAMES IN PLASMA ARE JUST LABELS APPLIED
TO ADDRESSES. SPACE IS SET ASIDE
DEPENDING ON THE SIZE OF THE VARIABLE,IF
ITS AN ARRAY, AND IF IT IS INITIALIZED.

View File

@@ -0,0 +1,40 @@
//
// YOU'VE ALREADY SEEN SOME OF THE
// BUILT-IN FUNCTIONS IN PLASMA, NOW
// IT IS TIME TO DEFINE OUR OWN. THE
// REAL POWER OF PLASMA COMES FROM
// FUNCTION DEFINITIONS THAT USE LOCAL
// VARIABLES, AND THE ABILITY FOR
// RECURSION - FUNCTIONS THAT CAN CALL
// THEMSELVES. THE APPLE II DOES LIMIT
// THESE ABILITIES SOMEWHAT, BUT SOME
// COMPLEX ALGORITHMS WORK JUST FINE
// WITH THESE LIMITATION (INCLUDING
// THE PLASMA COMPILER, ITSELF).
//
// A FUNCTION DEFINITION HAS OPTIONAL
// ARGUMENTS, OPTIONAL LOCAL VARIABLES,
// AND AN OPTIONAL RETURN VALUE.
//
DEF ADD(A, B)
WORD C
C = A + B
RETURN C
END
PUTI(ADD(1, 2))
DONE
IN THE ABOVE EXAMPLE, THE RETURN COULD
BE SIMPLIFIED TO "RETURN A + B" BUT
I WAS TRYING TO SHOW HOW TO USE LOCAL
VARIABLES. ARRAYS CAN ALSO BE PLACED
IN THE LOCAL VARIABLES, BUT NOTE THAT
THE MAXIMUM SIZE OF LOCAL VARIABLES HAS
TO BE 255 BYTES OR LESS, PER DEFINITION.
ALSO, DUE TO THE NATURE OF THE 6502 CALL
STACK, ONLY A CALL DEPTH OF ABOUT 96 IS
AVAILABLE. AFTER THAT, THE STACK
OVERFLOWS AND UNEXPECTED THINGS HAPPEN.

View File

@@ -0,0 +1,68 @@
//
// INSTEAD OF USING HARD-TO-REMEMBER
// NUMBERS, PLASMA ALLOWS YOU TO
// REPLACE THOSE WITH SYMBOLIC VALUES
//
CONST CR = $8D
CONST MALE = 0
CONST FEMALE = 1
//
// STRUCTURES ARE SYNTACTICAL CANDY
// FOR CREATING OFFSETS. IN THE FOLLOWING
// EXAMPLE, MYSTRUC IS A CONSTANT VALUE
// OF THE SIZE OF THE STRUCTURE. THE
// ELEMENTS WILL BE CONSTANTS REPRESENTING
// THE OFFSETS INTO THE STRUCTURE.
//
STRUC MYSTRUC
BYTE[32] FIRST
BYTE[32] LAST
BYTE AGE
WORD SEX
END
BYTE MALESTR = "MALE"
BYTE FEMALESTR = "FEMALE"
//
// INITIALIZE A SAMPLE RECORD.
//
BYTE[] RECORD
BYTE[32] = "STEVE"
BYTE[32] = "WOZNIAK"
BYTE = 61
WORD = @MALESTR
//
// HERE IS A NEW WAY TO USE POINTERS: AS
// A POINTER TO A STRUCTURE. AGAIN,
// SINCE POINTERS DON'T KNOW WHAT THEY
// POINT TO, THERE ARE TWO OPERATORS TO
// POINT TO A BYTE, OR POINT TO A WORD.
// '->' POINTS TO A BYTE USING A POINTER
// AND AN OFFSET. '=>' POINTS TO A WORD
// USING A POINTER AND AN OFFSET. IN
// THE FOLLOWING EXAMPLE, THE OFFSETS
// COME FROM THE 'MYSTRUC' DEFINITION.
//
DEF PUTREC(RECPTR)
PUTS(@RECPTR->FIRST) // ADDRESS OF FIRST NAME
PUTC(CR)
PUTS(@RECPTR->LAST) // ADDRESS OF LAST NAME
PUTC(CR)
PUTI(RECPTR->AGE) // AGE (BYTE)
PUTC(CR)
PUTS(RECPTR=>SEX) // POINTER TO STRING (WORD)
END
PUTS("STRUCTURE SIZE:")
PUTI(MYSTRUC) // THIS IS JUST THE SIZE OF THE STRUCTURE
PUTC(CR)
//
// PASS THE ADDRESS OF A SAMPLE RECORD
// TO BE PRINTED OUT.
//
PUTREC(@RECORD)
DONE

View File

@@ -0,0 +1,65 @@
//
// RETURNING BACK TO ARRAYS AND STRINGS.
// SINGLE DIMENSION ARRAYS CAN BE
// ACCESSED WITH INDICES, USING THE TYPE
// THE ARRAY WAS DEFINED WITH. NOTICE
// THAT WITH INITIALIZED ARRAYS, THE "[]"
// IS OPTIONAL. ONLY IF A MINIMUM SIZE
// IS SPECIFIED (OR THERE ARE NO
// INITIALIZERS) ARE THE "[]" REQUIRED.
//
BYTE[] ASTRING = "PLASMA IS COOL!"
//
// MULTI-DIMENSIONAL ARRAYS ARE DEFINED
// AS POINTERS TO ARRAYS. THIS HAS THE
// BENEFIT OF CREATING SPARSE ARRAYS AND
// NON-CONTIGUOUS ARRAYS. THE APPLE II
// SCREEN MEMORY, FOR INSTANCE, WORKS
// WELL AS AN ARRAY OF POINTERS TO BYTES.
//
// BECAUSE POINTERS ARE 16 BITS, THE
// MULTI-DIMENSIONAL ARRAY IS DEFINED AS
// 'WORDS'. BUT HOW TO REPRESENT BYTE
// ARRAYS VS WORD ARRAYS? AGAIN, THERE
// ARE TWO SIZE OPERATORS THAT DEFINE
// BYTE ARRAYS AND WORD ARRAYS. '.' SETS
// THE ARRAY TYPE TO 'BYTE' AND ':' SETS
// THE ARRAY TYPE TO 'WORD'.
//
//
// '.' AND ':' CAN ALSO HAVE CONSTANTS
// FOLLOWING THEM, TO ACCESS FIXED
// OFFSETS FROM THE ARRAY, FOR STRUCTURE
// ELEMENT ACCESS. CHECK OUT THE ACCESS
// TO THE STRING LENGTH, IN BYTE OFFSET
// 0 (ASSIGNED TO CONSTANT STRLEN).
//
CONST STRLEN = 0
WORD[] TEXTSCREEN
WORD = $400, $480, $500, $580, $600, $680, $700, $780
WORD = $428, $4A8, $528, $5A8, $628, $6A8, $728, $7A8
WORD = $450, $4D0, $550, $5D0, $650, $6D0, $750, $7D0
//
// STRINGS IN PLASMA ARE PRODOS
// COMPATIBLE "PASCAL" STRINGS. STRINGS
// WITH THE LENGTH ENCODED IN THE FIRST
// BYTE, FOLLOWED BY THE CHARACTERS.
//
WORD P
BYTE I
HOME()
FOR I = 1 TO ASTRING.STRLEN // THE LENGTH OF THE STRING
TEXTSCREEN.[I, I] = ASTRING[I] | $80
NEXT
GOTOXY(0, ASTRING.STRLEN+2)
PUTS("THE STRING LENGTH IS:")
PUTI(ASTRING.STRLEN)
DONE
NOTE THAT THE HIGH BIT IS SET WHEN
WRITING CHARACTERS TO THE SCREEN. PLASMA
AND PRODOS USE 0..128 FOR ASCII VALUES,
BUT THE APPLE II SCREEN USES 128..255 FOR
NORMAL CHARACTERS.

View File

@@ -0,0 +1,71 @@
//
// PLASMA DOESN'T REQUIRE UPPER CASE.
// HOWEVER, DUE TO THE NATURE OF THE
// APPLE ][ AND ][+, UPPER CASE WILL
// LOOK BEST ON ALL APPLE II COMPUTERS.
// IF YOU PRINT LOWER CASE TEXT ON AN
// APPLE ][ OR ][+ USING PUTS, IT WILL
// BE AUTOMATICALLY SHIFTED TO UPPER
// CASE.
//
// Here is the PLASMA version of
// Rod's Colors from the DOS System
// Master disk using the built-in call
// function to call ROM routines:
//
const showlores = $C056
const keyboard = $C000
const keystrobe = $C010
byte i, j, k, w, fmi, fmk, color
def textmode
call($FB39, 0, 0, 0, 0)
return home
end
def grmode
call($FB40, 0, 0, 0, 0)
^showlores
return home
end
def colors
while 1
for w = 3 to 50
for i = 1 to 19
for j = 0 to 19
k = i + j
color = (j * 3) / (i + 3) + i * w / 12
fmi = 40 - i
fmk = 40 - k
call($F864, color, 0, 0, 0) //grcolor(color);
call($F800, k, 0, i, 0) //grplot(i, k);
call($F800, i, 0, k, 0) //grplot(k, i);
call($F800, fmk, 0, fmi, 0) //grplot(fmi, fmk);
call($F800, fmi, 0, fmk, 0) //grplot(fmk, fmi);
call($F800, fmi, 0, k, 0) //grplot(k, fmi);
call($F800, k, 0, fmi, 0) //grplot(fmi, k);
call($F800, fmk, 0, i, 0) //grplot(i, fmk);
call($F800, i, 0, fmk, 0) //grplot(fmk, i);
if ^keyboard >= 128
return ^keystrobe
fin
next
next
next
loop
end
grmode
gotoxy(10,2) // X,Y offsets from the text window
puts("Press any key to exit.")
colors
textmode
puts("That's all, folks!")
done
This program skips the optional "()" on
parameter-less functions. You decide if
this is a style you prefer. Regardless,
be consistent in your source code.

View File

@@ -0,0 +1,126 @@
//
// THIS IS A FOREST FIRE SIMULATION.
//
// WRITTEN IS A SLIGHTLY DIFFERENT STYLE.
//
CONST FALSE = 0
CONST TRUE = NOT FALSE
CONST SHOWLORES = $C056
CONST KEYBOARD = $C000
CONST KEYSTROBE = $C010
CONST EMPTY = 0
CONST TREE = 4
CONST FIRE = 13
CONST FORESTSIZE = 42*42
CONST RNDNUM = $4E
CONST RNDL = $4E
CONST RNDH = $4F
BYTE TREES1[FORESTSIZE] // ALT ARRAY SIZE SPECIFIER
BYTE TREES2[FORESTSIZE]
DEF TEXTMODE
CALL($FB39, 0, 0, 0, 0)
RETURN HOME
END
DEF GRMODE
CALL($FB40, 0, 0, 0, 0)
^SHOWLORES
RETURN HOME
END
//
// RANDOM NUMBERS
//
DEF RND
*RNDNUM = (*RNDNUM << 1) + *RNDNUM + 251
RETURN *RNDNUM & $7FFF
END
//
// CHECK IF A FIRE IS BURNING AROUND TREE
//
DEF BYFIRE(TREEPTR)
IF ^(TREEPTR - 43) == FIRE
RETURN TRUE
ELSIF ^(TREEPTR - 42) == FIRE
RETURN TRUE
ELSIF ^(TREEPTR - 41) == FIRE
RETURN TRUE
ELSIF ^(TREEPTR - 1) == FIRE
RETURN TRUE
ELSIF ^(TREEPTR + 1) == FIRE
RETURN TRUE
ELSIF ^(TREEPTR + 41) == FIRE
RETURN TRUE
ELSIF ^(TREEPTR + 42) == FIRE
RETURN TRUE
ELSIF ^(TREEPTR + 43) == FIRE
RETURN TRUE
FIN
RETURN FALSE
END
DEF FORESTFIRE
WORD NEWTREES, OLDTREES, NEWTREE, OLDTREE, YROW
BYTE X, Y
MEMSET(@TREES1, EMPTY, FORESTSIZE)
MEMSET(@TREES2, EMPTY, FORESTSIZE)
OLDTREES = @TREES1
NEWTREES = @TREES2
FOR Y = 1 TO 40
YROW = Y * 42
FOR X = 1 TO 40
IF RND < 8000
^(OLDTREES + X + YROW) = TREE
FIN
NEXT
NEXT
WHILE ^KEYBOARD < 128
FOR Y = 1 TO 40
YROW = Y * 42
FOR X = 1 TO 40
OLDTREE = OLDTREES + X + YROW
NEWTREE = NEWTREES + X + YROW
WHEN ^OLDTREE
IS EMPTY
IF RND < 5000
^NEWTREE = TREE
ELSE
^NEWTREE = EMPTY
FIN
BREAK
IS TREE
IF RND < 5 OR BYFIRE(OLDTREE)
^NEWTREE = FIRE
ELSE
^NEWTREE = TREE
FIN
BREAK
IS FIRE
^NEWTREE = EMPTY
WEND
CALL($F864, ^NEWTREE, 0, 0, 0)
CALL($F800, Y - 1, 0, X - 1, 0)
NEXT
NEXT
YROW = NEWTREES
NEWTREES = OLDTREES
OLDTREES = YROW
LOOP
RETURN ^KEYSTROBE
END
PUTS("PRESS ANY KEY TO BEGIN...")
GETC
GRMODE
HOME
GOTOXY(10,2)
PUTS("PRESS ANY KEY TO EXIT.")
FORESTFIRE
TEXTMODE
HOME
PUTS("THAT'S ALL FOLKS!")
DONE

41
src/samplesrc/gfxdemo.pla Normal file
View File

@@ -0,0 +1,41 @@
include "inc/cmdsys.plh"
include "inc/args.plh"
include "inc/fileio.plh"
include "inc/grafix.plh"
var arg
byte ref
def showimage#0
var row, x
byte scanline[140]
for row = 0 to 191
//
// Read one scanline at a time, scale it, and draw it
//
fileio:read(ref, @scanline, 140)
for x = 139 downto 0
//scanline[x] = scanline[x] >> 4
pencolor(scanline[x] >> 4)
plot(x, row)
next
next
end
arg = argNext(argFirst)
if ^arg
ref = fileio:open(arg)
if ref
setmode(3) // 140 x 192 full color (or greyscale)
showimage
fileio:close(ref)
getc
setmode(-1)
else
puts("Unable to open "); puts(arg); putln
fin
else
puts("Usage: gfxdemo <imagefile>\n")
fin
done

66
src/samplesrc/grtest.pla Normal file
View File

@@ -0,0 +1,66 @@
include "inc/cmdsys.plh"
include "inc/grlib.plh"
include "inc/lines.plh"
sysflags restxt1|restxt2 // Reserve all text pages
byte[] sprite1 = $80,$80,$00,$00,$00,$00,$80,$80
byte[] = $80,$00,$0A,$0A,$0A,$0A,$00,$80
byte[] = $00,$0A,$0F,$0F,$0F,$0F,$0A,$00
byte[] = $00,$0A,$0F,$80,$80,$0F,$0A,$00
byte[] = $00,$0A,$0F,$80,$80,$0F,$0A,$00
byte[] = $00,$0A,$0F,$0F,$0F,$0F,$0A,$00
byte[] = $80,$00,$0A,$0A,$0A,$0A,$00,$80
byte[] = $80,$80,$00,$00,$00,$00,$80,$80
byte[] tile1 = $11,$11,$11,$11,$11,$11,$55,$00
byte[] = $11,$11,$11,$11,$11,$11,$55,$00
byte[] = $11,$11,$11,$11,$11,$11,$55,$00
byte[] = $05,$05,$05,$05,$05,$05,$05,$00
//
// Test routine
//
def grTest#0
byte b, l, k
word i, j, ii, ij
b = grMode(TRUE)
grDrawBuf(0)
for k = 15 downto 0
grClear(k)
next
setlinespans(@grHLin, @grVLin)
for l = 0 to 39
grColor(l)
linespans(0, 0, l, 47)
next
for l = 47 downto 0
grColor(l)
linespans(0, 0, 39, l)
next
ii = 2
ij = -1
i = 20
j = 10
^$C010
grDrawBuf(1)
while ^$C000 < 128
grFill(k, k, @tile1)
grBLT(i, j, 8, 8, @sprite1)
grSwap
k++
i = i + ii
if i < -3 or i > 35
ii = -ii
fin
j = j + ij
if j < -3 or j > 43
ij = -ij
fin
loop
^$C010
grMode(FALSE)
end
grTest
done

View File

@@ -1,56 +0,0 @@
include "inc/cmdsys.plh"
sysflags reshgr1 // Reserve HGR page 1
//
// Hardware addresses
//
const speaker = $C030
const showgraphics = $C050
const showtext = $C051
const showfull = $C052
const showmix = $C053
const showpage1 = $C054
const showpage2 = $C055
const showlores = $C056
const showhires = $C057
const keyboard = $C000
const keystrobe = $C010
const hgr1 = $2000
const hgr2 = $4000
const page1 = 0
const page2 = 1
word hgrpage[] = hgr1, hgr2
word hgrscan[] = $0000,$0400,$0800,$0C00,$1000,$1400,$1800,$1C00
word = $0080,$0480,$0880,$0C80,$1080,$1480,$1880,$1C80
word = $0100,$0500,$0900,$0D00,$1100,$1500,$1900,$1D00
word = $0180,$0580,$0980,$0D80,$1180,$1580,$1980,$1D80
word = $0200,$0600,$0A00,$0E00,$1200,$1600,$1A00,$1E00
word = $0280,$0680,$0A80,$0E80,$1280,$1680,$1A80,$1E80
word = $0300,$0700,$0B00,$0F00,$1300,$1700,$1B00,$1F00
word = $0380,$0780,$0B80,$0F80,$1380,$1780,$1B80,$1F80
word = $0028,$0428,$0828,$0C28,$1028,$1428,$1828,$1C28
word = $00A8,$04A8,$08A8,$0CA8,$10A8,$14A8,$18A8,$1CA8
word = $0128,$0528,$0928,$0D28,$1128,$1528,$1928,$1D28
word = $01A8,$05A8,$09A8,$0DA8,$11A8,$15A8,$19A8,$1DA8
word = $0228,$0628,$0A28,$0E28,$1228,$1628,$1A28,$1E28
word = $02A8,$06A8,$0AA8,$0EA8,$12A8,$16A8,$1AA8,$1EA8
word = $0328,$0728,$0B28,$0F28,$1328,$1728,$1B28,$1F28
word = $03A8,$07A8,$0BA8,$0FA8,$13A8,$17A8,$1BA8,$1FA8
word = $0050,$0450,$0850,$0C50,$1050,$1450,$1850,$1C50
word = $00D0,$04D0,$08D0,$0CD0,$10D0,$14D0,$18D0,$1CD0
word = $0150,$0550,$0950,$0D50,$1150,$1550,$1950,$1D50
word = $01D0,$05D0,$09D0,$0DD0,$11D0,$15D0,$19D0,$1DD0
word = $0250,$0650,$0A50,$0E50,$1250,$1650,$1A50,$1E50
word = $02D0,$06D0,$0AD0,$0ED0,$12D0,$16D0,$1AD0,$1ED0
word = $0350,$0750,$0B50,$0F50,$1350,$1750,$1B50,$1F50
word = $03D0,$07D0,$0BD0,$0FD0,$13D0,$17D0,$1BD0,$1FD0
word hcolor[] = $0000,$552A,$2A55,$7F7F,$8080,$D5AA,$AAD5,$FFFF
memset(hgr1, 0, $2000) // Clear HGR page 1
^showpage1
^showfull
^showhires
^showgraphics
getc
^showpage1
^showtext
done

Some files were not shown because too many files have changed in this diff Show More