1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-06-10 02:29:30 +00:00

Compare commits

...

380 Commits
DP3 ... master

Author SHA1 Message Date
David Schmenk
b8d300f9f9 DRAWL continued development 2024-06-05 21:14:20 -07:00
David Schmenk
3ceba530a5 Update biuld environment for DRAWL 2024-06-05 09:02:01 -07:00
David Schmenk
ec14660f87 Initial test for slow, minimal LISP - DRAWL 2024-06-04 19:02:04 -07:00
David Schmenk
3fd11ca0d4 llow single step and quit options during executions of 6502 simulation 2024-03-16 11:26:22 -07:00
David Schmenk
31d5b8a5ec Add some terminal control to Apple1 emulation 2024-03-12 13:57:15 -07:00
dschmenk
82a1632bfd Quick updates 2024-03-09 16:12:05 -08:00
David Schmenk
db424e9fc7 Add single stepping to lib6502 adn complete Apple 1+CFFA emulation 2024-03-09 15:13:07 -08:00
dschmenk
8344f18612 Add lib6502 to make an Apple1+CFFA1 emulator for testing PLASMA 2024-03-08 19:48:10 -08:00
David Schmenk
2b9eb6a5fc Fix A1PLASMA type and aux type and update image 2024-03-07 18:38:35 -08:00
David Schmenk
c23cb6d239 Clean up module loading and images 2024-03-07 18:36:47 -08:00
David Schmenk
1d099df299 Update images 2024-03-07 15:45:17 -08:00
David Schmenk
7aeda2d98b Fix case tatement in self hosted compiler and Apple 1 module loading 2024-03-07 15:18:15 -08:00
David Schmenk
d90b7ba69d Update DHGR Toolkit- 2024-03-01 15:51:08 -08:00
David Schmenk
2eea9e585c DHGR test lib 2024-02-28 13:32:08 -08:00
Dave Schmenk
0ab16d4877 Fix asm example code 2024-02-26 15:25:17 -08:00
David Schmenk
7d669e97b8
Changlist to 2.11 2024-02-26 13:44:54 -08:00
David Schmenk
a1c49d2705 Update SOS images 2024-02-26 13:06:38 -08:00
David Schmenk
578d002b8c Standard REL files load as MODKEEP and update ProDOS images 2024-02-26 12:57:11 -08:00
David Schmenk
7527a5a7d3 Can't forget the assembly include helper files 2024-02-25 13:10:32 -08:00
David Schmenk
b3d1dfed7d
Update Version 2.1.md 2024-02-25 12:08:53 -08:00
David Schmenk
0190c2c3cd
Fix typos and add info 2024-02-25 11:18:41 -08:00
David Schmenk
6f61b4ae8a
Formatting 2024-02-25 10:34:36 -08:00
David Schmenk
e02c068706
Info about assembly language toolkit 2024-02-25 10:32:24 -08:00
David Schmenk
e7ce06fe62
Fix raw links to disk images 2024-02-25 10:18:43 -08:00
David Schmenk
90cfcd2840
Fix HD link 2024-02-25 10:16:07 -08:00
David Schmenk
1e368ced63
Fix link to HD image 2024-02-25 10:14:32 -08:00
David Schmenk
6e45185cfd
Fix links to full images 2024-02-25 10:13:03 -08:00
David Schmenk
db2f9eecc3 Update HD image to 2.11 w/ ASM Toolkit 2024-02-25 10:10:43 -08:00
David Schmenk
5eefe74c6b Update 2.11 2024-02-25 09:59:37 -08:00
David Schmenk
15b14899f4
Add link to assembly toolkit 2024-02-25 09:52:49 -08:00
David Schmenk
d5803ceba9
2.11 Update 2024-02-25 09:50:47 -08:00
David Schmenk
34624f3162
Release 2.11 2024-02-25 09:47:02 -08:00
David Schmenk
b1d463f4e4 Update images to 2.11 2024-02-25 09:16:43 -08:00
David Schmenk
d3b9fe14a0 Add new ASM build tools/files 2024-02-24 11:25:07 -08:00
David Schmenk
6efc2b1a98 Update module loader to handle 8 bit fixups generated by EDASM 2024-02-24 11:13:46 -08:00
David Schmenk
a89b1b9b40 Add EDASM sample code 2024-02-23 17:06:41 -08:00
David Schmenk
9038c7e649
Update Version 2.1.md 2024-02-18 13:37:47 -08:00
David Schmenk
f5c562eafb Clean up dhgrPlot 2024-02-18 09:56:33 -08:00
David Schmenk
2f7c1b3e59 First pass at DHGR toolkit 2024-02-17 18:48:03 -08:00
David Schmenk
631034034c Start DHGR TOOLKIT 2024-02-17 12:12:03 -08:00
David Schmenk
c64843b1e1
Update README.md 2024-02-15 13:46:05 -08:00
David Schmenk
88960e6745
Update README.md 2024-02-15 13:32:51 -08:00
David Schmenk
b4ab21f80c
Update README.md 2024-02-15 13:29:11 -08:00
dschmenk
9e0f0ecd0f Release 2.1 2024-02-15 13:13:28 -08:00
dschmenk
a8584753e0 Release 2.1 2024-02-15 12:55:18 -08:00
dschmenk
3e91616666 Forgot DGRLIB.4TH in image 2024-02-14 17:32:36 -08:00
dschmenk
ca95dd356d Update imaged 2024-02-14 15:34:20 -08:00
dschmenk
6211cb31a3 Fix some low memory conditions 2024-02-14 15:32:24 -08:00
dschmenk
260ea6fe6b Fix low memory copy buffer sizing 2024-02-14 14:04:45 -08:00
dschmenk
a6c94440a2 More room for recursion 2024-02-14 13:42:00 -08:00
dschmenk
c6220f389d Try that again 2024-02-14 13:30:28 -08:00
dschmenk
0743eba40c Leave even more room for 64K systems 2024-02-14 13:20:08 -08:00
dschmenk
2e4364f9c6 Adjust copy buffer size calc 2024-02-14 13:08:03 -08:00
David Schmenk
ab57909099 Update FORTH WORDS picture 2024-02-13 10:18:21 -08:00
David Schmenk
b4c9c93c2e Add COMPARE DUP2 DROP2 2024-02-13 10:10:17 -08:00
David Schmenk
dbd1f336f4 Update (COMPILE) -> COMPILE, 2024-02-13 09:06:40 -08:00
David Schmenk
51daf7e8ff Update images with latest PLFORTH 2024-02-12 17:01:01 -08:00
David Schmenk
2476b85fa8 Update images with latest PLFORTH 2024-02-12 16:59:44 -08:00
Dave Schmenk
974a7d63f6 Switch COMPILE/[COMPILE] to POSTPONE 2024-02-12 16:34:06 -08:00
David Schmenk
fbcfae86e0 Update images with install scripts 2024-02-12 07:53:20 -08:00
Dave Schmenk
a818dec4aa Force compile of [ELSE] inside of [IF] 2024-02-11 16:10:09 -08:00
Dave Schmenk
29498dc6e7 Chanfe batch words ?EXEC RESUME> to [IF][ELSE][THEN] 2024-02-11 10:51:12 -08:00
Dave Schmenk
a587aa477f Update Apple /// image 2024-02-10 14:22:37 -08:00
David Schmenk
5d5f60c2d5 Allow GRAFIX to be unloaded and reloaded 2024-02-09 21:11:07 -08:00
Dave Schmenk
1fb7960a1b break out Apple /// sample code into FPSOS 2024-02-09 16:41:56 -08:00
Dave Schmenk
a08bc126a2 Apple /// grafix scripts 2024-02-09 16:21:30 -08:00
David Schmenk
ab3b91ad78 UPdate image to latest PLFORTH 2024-02-09 14:17:22 -08:00
dschmenk
a9b4492504 Fix corrupted image 2024-02-09 10:36:02 -08:00
David Schmenk
66d674d494 Clean up SANE init source 2024-02-08 16:44:35 -08:00
David Schmenk
8c2e3eaa5c Clean up SANE init for Apple /// 2024-02-08 16:44:06 -08:00
David Schmenk
e2f29ffb2a Clean up SANE save/restoreZP for Apple /// 2024-02-08 16:33:33 -08:00
David Schmenk
a717f15e02 Update Apple /// HD dimage with fixed SANE 2024-02-08 16:25:01 -08:00
David Schmenk
42be6c6f80 (re)Fix SANE ZP save/restore for Apple /// 2024-02-08 16:23:08 -08:00
dschmenk
7c9e24d332 Update images 2024-02-07 11:14:24 -08:00
David Schmenk
80c8cd4e6a Fix CFA pointer to PFA in DEFER for PBC words 2024-02-07 09:17:42 -08:00
dschmenk
9b749d6f99 Add more info to SEE 2024-02-06 20:22:12 -08:00
David Schmenk
87c261bf3d Fix SEE for DEFERed words 2024-02-05 17:40:15 -08:00
David Schmenk
67960518b0 Fix SEE for DEFERed words 2024-02-05 17:38:56 -08:00
dschmenk
211ce933b2 Move PAD out of the way of JIT compiler usage 2024-02-05 15:07:16 -08:00
David Schmenk
13f88a8ad3 Fix corner case for IS ITC vs PBC 2024-02-05 08:17:48 -08:00
David Schmenk
f25f4c6dc7 Fix DEFER for compiled code 2024-02-04 21:16:36 -08:00
David Schmenk
969277f8ae Update docs for latest PLFORTH 2024-02-04 13:38:06 -08:00
David Schmenk
a840f2b2ac Ad DEFER and friends. Aling more with forth-standard.org naming 2024-02-04 12:40:51 -08:00
David Schmenk
cdfb59846f Had to screw up _interpret_. Reverted and update images 2024-02-03 20:15:19 -08:00
David Schmenk
ee5c66e710 Forget a few libs 2024-02-03 18:39:09 -08:00
David Schmenk
c9f081e1b3 Update Apple /// image with PLFORTH 2024-02-03 18:28:22 -08:00
David Schmenk
b3b92b39c6 Add samples and command line options to PLFORTH 2024-02-03 18:15:44 -08:00
David Schmenk
734d9a50c6 Update images with PLFORTH and install script 2024-01-28 16:52:53 -08:00
David Schmenk
1a7f7bec62 Another screenshoe 2024-01-28 16:34:14 -08:00
David Schmenk
7cb4534efb Merge branch 'master' of https://github.com/dschmenk/PLASMA 2024-01-28 16:31:03 -08:00
David Schmenk
30437ce21a Update Forth words in PLFORTH image 2024-01-28 16:30:34 -08:00
David Schmenk
016b31a01c
Remove SHOWHASH from PLFORTH
Update PLFORTH onky words
2024-01-28 16:27:30 -08:00
David Schmenk
350ab5b783 Streamline copy for build tools 2024-01-28 16:16:24 -08:00
David Schmenk
96bac30316 Clean up DROP/SWAP sequence 2024-01-28 15:17:42 -08:00
David Schmenk
1a3e8eb3da Update dsk images with newer PLFORTHPLFO 2024-01-28 15:13:39 -08:00
David Schmenk
23a5e7840a Forget to uncomment test 2024-01-28 14:13:52 -08:00
David Schmenk
81fa548f52 No warmstart inside BRK handler on Mo match error 2024-01-28 14:07:59 -08:00
David Schmenk
153e6f6f8b Update Apple /// MAME disk images 2024-01-27 18:43:02 -08:00
David Schmenk
3dd07beaf8 Streamline files for install 2024-01-27 13:35:42 -08:00
David Schmenk
ed295b0599 Fix 16 bit VM calls from AUX mem 2024-01-27 09:38:25 -08:00
Dave Schmenk
ff7c35deb9 Update SHOW words and disk images 2024-01-26 21:21:45 -08:00
David Schmenk
b93b4d7c75 Fixes to compilers case statement to allow addresses. Update names to Forth words 2024-01-26 17:19:37 -08:00
David Schmenk
c2773d208c Add CREATE name to hash immediately 2024-01-25 20:36:08 -08:00
David Schmenk
a9cadd9fda Add LATEST and UNLOOP to clean up scripts 2024-01-25 17:46:04 -08:00
David Schmenk
8d92e854ae Fix ?EXEC definition self referencing 2024-01-25 15:15:14 -08:00
dschmenk
f3ac3035ba Update 800K image 2024-01-25 07:41:56 -08:00
dschmenk
bfb3eb4672 Big update with installer disk. Allow FORTH to execute SYSTEM files 2024-01-24 15:50:45 -08:00
David Schmenk
2434d262c5 Enable external access to execsys 2024-01-24 13:01:10 -08:00
dschmenk
547bdcc2ad Comments for install script 2024-01-23 19:48:02 -08:00
David Schmenk
6c6d6e664d Update HD install script 2024-01-23 17:10:12 -08:00
dschmenk
76c85e350c Update Apple /// image with latest 2024-01-23 16:58:13 -08:00
dschmenk
e2163c856e Go for consistancy over tradition with conditional words 2024-01-23 16:46:14 -08:00
dschmenk
96d4e3eb02 Update images 2024-01-23 15:10:27 -08:00
David Schmenk
12de12b0b4 Expanding install scripts 2024-01-23 12:47:36 -08:00
David Schmenk
d0fc4120c9 Prepare install script 2024-01-23 10:37:28 -08:00
David Schmenk
3fcbf48665 Change MACHID constants to better match uppercase only keyboard 2024-01-23 08:43:16 -08:00
David Schmenk
92be9cd631 Fix PAD weirdness 2024-01-23 08:31:14 -08:00
David Schmenk
2a475a01e2 Update disk images 2024-01-22 14:06:18 -08:00
David Schmenk
2578b1a3fb Remove checks from '[' and ']'. Apparently unneeded and unwanted 2024-01-22 10:17:58 -08:00
David Schmenk
4364319176 Fix stack restore for throw, add scripts to ID machine 2024-01-21 17:25:44 -08:00
David Schmenk
da404a8dfa Fix error in MACHID_MEM 2024-01-21 08:30:30 -08:00
David Schmenk
68e31ccc30 Stupid Git 2024-01-19 07:37:19 -08:00
David Schmenk
da0bf22b2e Merge branch 'master' of https://github.com/dschmenk/PLASMA 2024-01-19 07:34:30 -08:00
David Schmenk
e14eda8617 Forgot to fix autorun to point to /PLASMA partition 2024-01-19 07:27:55 -08:00
dschmenk
3166341e96 Update Apple /// MAME disk images 2024-01-18 16:40:23 -08:00
dschmenk
c61a787271 Fix floppy volume name 2024-01-18 13:57:34 -08:00
dschmenk
637b1d8248 Fix disk name 2024-01-18 12:58:42 -08:00
dschmenk
9ff1695012 Fix disk name 2024-01-18 12:57:43 -08:00
dschmenk
86ef49cc5e All graphics libraries get consistent mode set API 2024-01-18 12:41:19 -08:00
dschmenk
8f3780617b All graphics libraries get consistent mode set API 2024-01-18 12:28:23 -08:00
David Schmenk
912a865a25 Update images with new PLVM16 2024-01-16 22:01:26 -08:00
David Schmenk
12216fcab5 Update default JIT parameters with improved VM16 2024-01-16 21:57:25 -08:00
David Schmenk
1d88369ae0 Call bytecode routines whithin VM16 to avoid stack conversion 2024-01-16 20:55:27 -08:00
David Schmenk
f2846bdaf3 Add to FORTH ,_> PLASMA library integration 2024-01-16 10:12:13 -08:00
David Schmenk
3b3fc24246 Fill out more FORTH <-> PLASMA librariesP 2024-01-16 10:09:08 -08:00
David Schmenk
232ced8fe3 Prepare for 2.1 release 2024-01-15 19:59:49 -08:00
David Schmenk
c3cc7cb139 DIVMOD now works properly 2024-01-14 21:43:57 -08:00
David Schmenk
0515117d52 Update image with latest 2024-01-14 18:26:16 -08:00
David Schmenk
751799352c FORTH and JIT compiler fighting over memory above heapmark for temp buffer space
Have FORTH trya nd reserve space for temp string and PAD away from potential JIT interference
2024-01-14 17:54:17 -08:00
David Schmenk
1be159e3ed Mostly working JIT16. Still an issue with +HRFORTH PBC HRBOUNCE.4th 2024-01-14 17:24:54 -08:00
David Schmenk
7fe51aaf56 Fix 16 bit VM except JIT compiler 2024-01-14 15:18:01 -08:00
dschmenk
eaa0e3c7d4 16 bit VM is a disaster. Needed complete architecture overhaul 2024-01-10 20:08:04 -08:00
David Schmenk
9f45afe3d0 Maybe I have the compile words right 2024-01-10 13:52:21 -08:00
dschmenk
85710bbfdf Fix some SOS exemod memory problems and remove last hard-coded Apple
II-ism from PLFORTH
2024-01-10 12:11:32 -08:00
David Schmenk
ef9fc81ece Break out the scripts to build individual release floppy images 2024-01-10 09:01:08 -08:00
David Schmenk
2eacd75b69 SHOW pretty print improvements 2024-01-10 08:24:50 -08:00
dschmenk
d5c22b1ff0 Get keypress/getkey working for Apple /// properly 2024-01-09 21:18:34 -08:00
dschmenk
dff6c2bd9b Merge branch 'master' of https://github.com/dschmenk/PLASMA 2024-01-09 20:23:47 -08:00
dschmenk
cefb8128c6 Rearrange code so BYE processing is in proper location 2024-01-09 20:22:21 -08:00
David Schmenk
6e03017d25 Use CONIO for ?TERMINAL and KEY words. Prepare Apple /// support for FORTH 2024-01-09 13:35:08 -08:00
David Schmenk
8985011207 Can't believe I got OVER wrong 2024-01-09 12:37:07 -08:00
David Schmenk
1548a63a9f Clean up ] and [ compile on/off 2024-01-09 11:12:20 -08:00
David Schmenk
1f1376c467 Catagorize words in VLIST and strip system scripts for faster loading 2024-01-09 11:04:29 -08:00
David Schmenk
5832883da9 Pretty list VLIST 2024-01-09 08:43:44 -08:00
David Schmenk
ea114c4350 Fix -TRAILING 2024-01-09 08:21:24 -08:00
David Schmenk
2770a6f774 Add CR to PBC compiled words for SHOW 2024-01-09 07:43:08 -08:00
David Schmenk
a755df496c Attempt better formatting for SHOW 2024-01-09 07:28:22 -08:00
David Schmenk
de4d6fb104 Use inline ops to compile ITC version. Slightly faster, less source 2024-01-09 06:29:17 -08:00
David Schmenk
3f9f56be74 Use inline ops to compile ITC version. Slightly faster, less source 2024-01-09 05:52:56 -08:00
dschmenk
fa94f4c8d8 Break FORTH TFTP script 2024-01-08 16:41:56 -08:00
David Schmenk
b3f6c7970a Further source cleanup and calling it an Alpha 2024-01-08 15:55:07 -08:00
dschmenk
bc1cf8368d Get rid of EXPECT - ACCEPT does input better 2024-01-08 13:32:38 -08:00
dschmenk
7aed4d4d4a Fix ' (tick) thatI broke 2024-01-08 13:04:10 -08:00
dschmenk
d9d57f383d Fix ' (tick) that I broke 2024-01-08 13:02:50 -08:00
David Schmenk
3424b085cf Added ?NUM word to convert string to number 2024-01-08 12:42:13 -08:00
David Schmenk
eefd9ba2dd Can't put test for componly in execword 2024-01-08 11:37:25 -08:00
David Schmenk
9587423c46 End SRCing file input early 2024-01-08 11:28:09 -08:00
David Schmenk
d4dee597dc ENDSRC word to stop SRC input early 2024-01-08 05:33:03 -08:00
dschmenk
919339041a Don't auto load plasma.4th 2024-01-07 23:11:26 -08:00
dschmenk
d1f99e1142 No, don't auto load PLASMA.4TH. Add batch file to create 800K ProDOS
disk with AppleCommander
2024-01-07 23:06:38 -08:00
David Schmenk
5114ab48dd Update imager 2024-01-07 16:39:18 -08:00
David Schmenk
7bd13f1bcb Add FENCE and fix docolon itc_flag foible 2024-01-07 15:59:04 -08:00
David Schmenk
8999c3286f Auto SRC plasma.4th at PLFORTH startup 2024-01-07 14:13:08 -08:00
David Schmenk
bb4e0ee773 Add syspath to SRC" search and move system scripts there 2024-01-07 13:53:58 -08:00
David Schmenk
38832640e7 Don't add new word to vocabulary until after it's done compiling 2024-01-07 12:20:58 -08:00
dschmenk
ca4cebf394 Fill in disk image directories for PLFORTH # Please enter the commit
message for your changes. Lines starting # with '#' will be ignored,
and an empty message aborts the commit. # # On branch master # Your
branch is up to date with 'origin/master'. # # Changes to be
committed: # modified: ../mkrel # # Untracked files: #
../libsrc/apple/conio.a # ../libsrc/apple/dgrlib.a #
../libsrc/apple/fileio.a # ../libsrc/apple/grafix.a #
../libsrc/apple/grlib.a # ../libsrc/apple/hgrfont.a #
../libsrc/apple/hgrlib.a # ../libsrc/apple/hgrsprite.a #
../libsrc/apple/hgrtile.a # ../libsrc/apple/jit.a #
../libsrc/apple/jit16.a # ../libsrc/apple/joybuzz.a #
../libsrc/apple/matchfiles.a # ../libsrc/apple/mouse.a #
../libsrc/apple/portio.a # ../libsrc/apple/sdfat.a #
../libsrc/apple/sndseq.a # ../libsrc/apple/spiport.a #
../libsrc/apple/uthernet.a # ../libsrc/apple/uthernet2.a #
../libsrc/args.a # ../libsrc/dhcp.a # ../libsrc/etherip.a #
../libsrc/fiber.a # ../libsrc/fpstr.a # ../libsrc/fpu.a #
../libsrc/inet.a # ../libsrc/int32.a # ../libsrc/lines.a #
../libsrc/longjmp.a # ../libsrc/lz4.a # ../libsrc/memmgr.a #
../libsrc/sane.a # ../plasm # ../plvm # ./ # ../rel/ #
../samplesrc/coniotst.a # ../samplesrc/dgrtest.a #
../samplesrc/fatcat.a # ../samplesrc/fatget.a # ../samplesrc/fatput.a
../samplesrc/fibertest.a # ../samplesrc/gfxdemo.a #
../samplesrc/grtest.a # ../samplesrc/hgrtest.a # ../samplesrc/httpd.a
../samplesrc/memtest.a # ../samplesrc/playseq.a #
../samplesrc/primegap.a # ../samplesrc/rod.a # ../samplesrc/rogue.a #
../samplesrc/rogue.combat.a # ../samplesrc/rogue.map.a #
../samplesrc/rpncalc.a # ../samplesrc/sanity.a # ../samplesrc/sfm.a #
../samplesrc/sfmsprt.a # ../samplesrc/sieve.a #
../samplesrc/tiletest.a # ../toolsrc/codeopt.a # ../toolsrc/ed.a #
../toolsrc/hr2forth.a # ../toolsrc/hrforth.a # ../toolsrc/plasm.a #
../toolsrc/plforth.a # ../utilsrc/apple/cat.a #
../utilsrc/apple/copy.a # ../utilsrc/apple/del.a #
../utilsrc/apple/jitune.a # ../utilsrc/apple/mon.a #
../utilsrc/apple/newdir.a # ../utilsrc/apple/ren.a #
../utilsrc/apple/sos.a # ../utilsrc/apple/type.a #
../utilsrc/apple/zipchip.a # ../utilsrc/tftpd.a #
../vmsrc/apple/a1cmd.a # ../vmsrc/apple/cmd.a #
../vmsrc/apple/cmdjit.a # ../vmsrc/apple/plvm01.sym #
../vmsrc/apple/plvm02.sym # ../vmsrc/apple/plvm03.sym #
../vmsrc/apple/plvm802.sym # ../vmsrc/apple/plvmjit02.sym #
../vmsrc/apple/plvmjit03.sym # ../vmsrc/apple/soscmd.a #
../vmsrc/apple/soscmdjit.a # ../vmsrc/apple/sossys.a #
../vmsrc/apple/sossysjit.a #
2024-01-06 18:48:57 -08:00
dschmenk
93c72c98ed Update tftp scripts 2024-01-06 16:51:24 -08:00
dschmenk
82bc7ebb1f Preliminary doc for PLFORTH 2024-01-06 15:28:58 -08:00
David Schmenk
2e36d0f52f FIND returns same address as ' (tick) 2024-01-06 09:43:06 -08:00
David Schmenk
64ef4cca70 CHAR word 2024-01-06 08:58:25 -08:00
David Schmenk
b54ba1fdaf CHAR word 2024-01-06 08:57:18 -08:00
David Schmenk
41d56cdefa Might have COMPIE and [COMPILE} closer to correct 2024-01-06 08:47:57 -08:00
David Schmenk
b481804a4d Might have COMPLE and [COMPILE] closer to correct 2024-01-06 08:46:31 -08:00
David Schmenk
9e42e3d640 Simplify DOES> with new JUMP bytecode 2024-01-06 08:04:42 -08:00
David Schmenk
a067c3e804 COMPLEMENT, not COMPLIMENT :-) 2024-01-06 07:04:44 -08:00
David Schmenk
1c3505a196 scripts ready for demo 2024-01-05 14:39:06 -08:00
David Schmenk
0d552c5e51 Update version # and add stubs to reserve HGR pages for PLFORTH 2024-01-05 12:52:49 -08:00
David Schmenk
41ad4e9778 Don't forget the ROD demo
Signed-off-by: David Schmenk <dschmenk@sbcglobal.net>
2024-01-05 08:25:53 -08:00
David Schmenk
a3dc055897 Updates for FORTH scripts and demos 2024-01-04 20:52:39 -08:00
David Schmenk
420af77a96 Additional script demos and associated bug fixes 2024-01-04 17:06:50 -08:00
David Schmenk
1db7cd16ee Lots of library updates and FORTH bugfixes importing existing libraries 2024-01-04 14:24:45 -08:00
David Schmenk
2d4417c698 Curate some built-in FORTH words and HGRLIB scripts 2024-01-03 19:18:38 -08:00
David Schmenk
68cc31993f Update all VMs with new FORTH opcodes 2024-01-03 13:03:48 -08:00
David Schmenk
54a256cd60 Add JUMP/JUMPZ opcodes to PLVM for PLFORTH 2024-01-03 07:05:46 -08:00
David Schmenk
1bf6c41be5 Fix add to hashtable in CREATE DOES>
Signed-off-by: David Schmenk <dschmenk@sbcglobal.net>
2024-01-03 06:32:59 -08:00
David Schmenk
75ef74b3ba Better, smaller, faster hash function
Signed-off-by: David Schmenk <dschmenk@sbcglobal.net>
2024-01-03 06:08:57 -08:00
David Schmenk
9aba6b71f1 Lots of forth word verification 2024-01-03 00:00:30 -08:00
David Schmenk
8dd03a3413 Slightly improve hash function 2024-01-01 14:36:49 -08:00
David Schmenk
3b8bad0abd Hash dictionary entries to speed up vocabulary lookup 2023-12-31 22:36:56 -08:00
David Schmenk
b466a48a16 Add remaining compile words 2023-12-31 17:57:18 -08:00
David Schmenk
1dd792e87c Add words to find existing words and improved versions of SRC 2023-12-31 11:32:14 -08:00
David Schmenk
6bb7a9dca9 Include conio inside plforth for keypress() 2023-12-31 10:19:37 -08:00
David Schmenk
a15658a714 Remove extraneous source and cleanup 2023-12-29 23:46:16 -08:00
David Schmenk
b2ddb0434d Fix running editor from inside forth 2023-12-29 20:44:25 -08:00
David Schmenk
965ccecf2a I think thic CREATE works properly 2023-12-29 19:59:43 -08:00
David Schmenk
3455286a48 Properly implement WORD externally and internally 2023-12-29 15:57:26 -08:00
David Schmenk
7ce2ab726c Clean up dictionary and add a few minor ops 2023-12-29 10:07:58 -08:00
David Schmenk
64b516f810 CASE clause 2023-12-28 22:07:40 -08:00
David Schmenk
f7c37de60a bounce.4th samplesrc (replaces gr.4th) 2023-12-28 17:05:02 -08:00
David Schmenk
3cb1d97a6c Clean up PLASMA interface and fix fileio when calling execmod 2023-12-28 16:43:53 -08:00
David Schmenk
5d6b9b1f7e Fix create and friends 2023-12-28 14:52:04 -08:00
David Schmenk
9aa0ab68ee modkeep some libraries so PLFORTH can link to them 2023-12-28 13:31:42 -08:00
David Schmenk
677869ed4c Linkeage to PLASMA symbol table 2023-12-28 12:58:35 -08:00
David Schmenk
a7c7cf9e19 dd ability to functionaly break out 2023-12-27 20:33:53 -08:00
David Schmenk
99d584f45f Add breakpoint 2023-12-27 20:24:57 -08:00
David Schmenk
7a73d2b621 Add CALL and RESTART 2023-12-27 10:21:54 -08:00
David Schmenk
e22e8f472f Clean up fileio module using sys fileio 2023-12-27 10:11:52 -08:00
David Schmenk
1ab3657f36 Allow for breaking into running program 2023-12-27 09:34:37 -08:00
David Schmenk
5dabd1dbb7 Compile both Indirect Threaded Code and PLASMA Byte Code 2023-12-26 21:41:20 -08:00
David Schmenk
645278604f Minor cleanup 2023-12-25 13:01:47 -08:00
David Schmenk
e953458e76 Exec with or without checks 2023-12-25 11:29:17 -08:00
David Schmenk
07e0397ba4 Simplified DOES> processing 2023-12-24 21:38:32 -08:00
David Schmenk
64b0e0ca80 Fix <BUILD DOES> 2023-12-24 19:36:56 -08:00
David Schmenk
4876ddea60 Lots of stack monitoring routines 2023-12-24 16:12:49 -08:00
David Schmenk
2fba961f14 Interpret file, including command line argument 2023-12-24 13:37:59 -08:00
David Schmenk
4d2ab77740 Better BYE after abort 2023-12-24 09:32:27 -08:00
David Schmenk
8d0dad15b3 EMIT and SHOW cleanup 2023-12-24 08:22:21 -08:00
David Schmenk
4e77f83bed DO LOOP 2023-12-23 22:03:12 -08:00
David Schmenk
59dbef75f1 Move flags into seperate field 2023-12-23 09:49:10 -08:00
David Schmenk
5de565ebb1 IF/THEN/ELSE words 2023-12-21 22:41:23 -08:00
David Schmenk
bf13409d16 Better comment handling and return stack ops 2023-12-20 12:52:31 -08:00
Dave Schmenk
c874426091 Refactor input handling 2023-12-19 20:35:08 -08:00
Dave Schmenk
ec9718de53 Functional <BUILD DOES> 2023-12-19 14:21:37 -08:00
Dave Schmenk
ec16b9cc78 Compile simple colon definitions 2023-12-18 16:47:12 -08:00
Dave Schmenk
27fc9a0fea Variable compiler 2023-12-17 14:10:08 -08:00
David Schmenk
3ddb448775 faster MUL for small numbers 2023-12-16 09:39:31 -08:00
David Schmenk
097bde5257
Delete src/prodos 2023-12-16 07:14:01 -08:00
David Schmenk
92078abec1
Delete src/.DS_Store 2023-12-16 07:13:35 -08:00
David Schmenk
312bd349fc
Delete .DS_Store 2023-12-16 07:13:16 -08:00
David Schmenk
2242a02075
Delete images/.DS_Store 2023-12-16 07:13:04 -08:00
David Schmenk
eab0727c71 I hate GIT sometimes 2023-12-15 11:49:19 -08:00
David Schmenk
9337e5f20f Merge branch 'master' of https://github.com/dschmenk/PLASMA 2023-12-15 11:46:18 -08:00
David Schmenk
35b2aa3080 Fix check for last character of number 2023-12-15 11:45:50 -08:00
David Schmenk
9a7593fafe proper input line processing 2023-12-13 10:31:50 -08:00
dschmenk
929678269f Fix check for last character of number 2023-12-12 21:50:48 -08:00
David Schmenk
21ac8cc402 Add minimal FORTH environmnet 2023-12-12 19:24:37 -08:00
David Schmenk
7433b52e28 Add a simple forth environment 2023-12-12 12:54:45 -08:00
David Schmenk
2e19e9f6b1 Make ROGUE disk image official 2023-04-11 21:30:37 -07:00
David Schmenk
dad996203d Make water look more like water 2023-04-11 20:26:11 -07:00
David Schmenk
4f9f58ba29 Making water look more like water 2023-04-11 20:22:44 -07:00
David Schmenk
4cfadf3ec8 Make water look more like 2023-04-11 20:01:06 -07:00
David Schmenk
e47ca69101 Buffer screen updates for better visual appearance 2023-04-11 16:28:08 -07:00
David Schmenk
37f906d5a6
2.0 release 2023-03-24 12:46:31 -07:00
David Schmenk
550fde7f1e
2.0 release 2023-03-24 11:54:15 -07:00
David Schmenk
1fcc4c3735
2.0 release 2023-03-24 11:53:11 -07:00
David Schmenk
2c11ce4e96
Improve Apple /// Ready-To-Run instructions 2023-03-23 08:15:25 -07:00
David Schmenk
4854baec5a update Apple /// images for apple3rtr 2023-03-22 17:25:13 -07:00
David Schmenk
82a4a252a3
Update utility command options 2023-03-20 22:28:19 -07:00
David Schmenk
0e0ba23d7a
Update 2.0 release fixes 2023-03-20 22:26:04 -07:00
Dave Schmenk
b865004d7b Update images 2023-03-20 22:19:14 -07:00
dschmenk
9932639b1b VBL test compatible with IIe and IIc 2023-03-20 10:55:46 -07:00
Dave Schmenk
655e410a1d IOUSDis must be written 2023-03-19 19:30:37 -07:00
Dave Schmenk
ee14a3bdf4 forgot IOUDis 2023-03-19 18:57:26 -07:00
Dave Schmenk
60c1b4f6e9 Enable/disable VBL ints for //c 2023-03-19 17:59:38 -07:00
Dave Schmenk
094ddd31e8 Flash cursor on 2e based on VBL 2023-03-19 16:28:41 -07:00
dschmenk
6fc53c4c21 Make '=' shorthand for destionation being current directory 2023-03-19 13:57:13 -07:00
dschmenk
0d585d7110 Disable windowsize because TFTPD is so slow 2023-03-19 13:33:41 -07:00
David Schmenk
bc68776f93 Merge branch 'master' of https://github.com/dschmenk/PLASMA 2023-03-19 12:21:30 -07:00
David Schmenk
9e7a774972 Add lz4 rogue instructions 2023-03-19 12:20:52 -07:00
David Schmenk
17d1e1eb89
Use PLASMA editor to edit levels 2023-03-19 11:30:42 -07:00
David Schmenk
976581b1c1 Cleanup for release 2023-03-19 08:51:17 -07:00
David Schmenk
3d1c3e9407 Keep trying to free some bytes 2023-03-18 19:30:17 -07:00
David Schmenk
4ca1ba9c04 Free prefix buffer before execmod 2023-03-18 16:33:55 -07:00
David Schmenk
af57dfdeeb Increase size of command line buffer without additional memory 2023-03-18 16:05:29 -07:00
David Schmenk
267fdebdef
Beta release 2023-02-28 15:10:02 -08:00
David Schmenk
66c51a2ab5
Beta release 2023-02-28 15:03:45 -08:00
David Schmenk
64a722f1e2
Beta release 2023-02-28 15:02:39 -08:00
David Schmenk
75c2847cf1 Update images with FIBER library 2023-02-28 13:03:10 -08:00
dschmenk
f5efc5641e Add count of active fibers 2023-02-28 12:57:49 -08:00
David Schmenk
c39fd20746 Update images will PLASM Apple /// fix 2023-02-27 12:31:38 -08:00
dschmenk
79287f2c51 Fix status print for Apple /// 2023-02-27 11:59:12 -08:00
Dave Schmenk
cd0126477b Had to make room to update compiler to latest 2023-02-26 21:25:05 -08:00
Dave Schmenk
1c35a7ae0a Update disk images 2023-02-26 12:21:02 -08:00
Dave Schmenk
ffce999045 Update 2mg image file 2023-02-25 22:38:32 -08:00
dschmenk
9e62379b46 Update strings to BETA 2023-02-25 20:32:56 -08:00
dschmenk
9125b7bfd4 Error on local constants 2023-02-25 19:21:36 -08:00
dschmenk
cdb734d1ba Allow to import module header itself 2023-02-25 16:16:46 -08:00
David Schmenk
f78f2827dc Add output filename to compile data 2023-02-25 10:54:17 -08:00
David Schmenk
ef268697b5 Fix display width calc 2023-02-25 10:51:36 -08:00
David Schmenk
6665199e55 Fix display width calc 2023-02-25 10:50:36 -08:00
David Schmenk
f4ce23a3cf Slight adjustment to FPSTR_FLEX formatting 2023-02-25 10:29:30 -08:00
dschmenk
177c621364 Add fppow sample test 2023-02-24 17:49:13 -08:00
David Schmenk
54fba4e12f Update FPPOW.PLA sample in images 2023-02-24 11:26:08 -08:00
David Schmenk
0d41deb7ec Update 2mg with lastest FPSTR files 2023-02-24 11:12:31 -08:00
Dave Schmenk
7a3debfd0c Much better floating point string conversion 2023-02-23 17:57:11 -08:00
David Schmenk
1713c71505 Fix *some* of the exponent formatting 2023-02-13 15:40:47 -08:00
David Schmenk
abd9d35cae Fix string -> decrec conversion 2023-02-12 14:13:59 -08:00
David Schmenk
1d3de982d6 Give output filename as STDOUT if -S flag 2023-02-02 12:02:54 -06:00
David Schmenk
9cb7d29bfa
Merge pull request #69 from ZornsLemma/plasm-stdout
Add new -S option to "plasm" to output to stdout
2023-02-02 11:35:00 -06:00
Steven Flintham
374d2465b6 Add -S option to plasm to output to stdout 2023-01-15 22:30:53 +00:00
ZornsLemma
156bca2413
Merge pull request #18 from dschmenk/master
Merge latest upstream changes to master
2023-01-14 22:30:39 +00:00
David Schmenk
f5b2db78a3 Allow importing self 2023-01-14 12:20:16 -08:00
David Schmenk
ca5f81530c
Alpha 2 format 2023-01-01 23:56:45 +00:00
David Schmenk
76b3905a60
Release Alpha 2 2023-01-01 23:55:53 +00:00
David Schmenk
4613584099
Update Version 2.0.md 2023-01-01 23:51:10 +00:00
David Schmenk
0d76b322f1 Final ALPHA2 images 2023-01-01 13:57:10 -08:00
David Schmenk
f0d89f6b5c Merge branch 'master' of https://github.com/dschmenk/PLASMA 2023-01-01 13:01:15 -08:00
Dave Schmenk
f8a6589f34 Place common routine into matchfiles 2022-12-31 22:41:28 -08:00
David Schmenk
ec629745f9 ALPHA 2 2022-12-31 16:36:35 -08:00
David Schmenk
a0cc6662d5 Update large disk image 2022-12-31 16:02:38 -08:00
David Schmenk
bba4570a93 Fix filefrompath() 2022-12-31 14:57:08 -08:00
David Schmenk
fe86c7e3f1 Merge branch 'master' of https://github.com/dschmenk/PLASMA 2022-12-21 14:45:47 -08:00
Dave Schmenk
602fd75509 Reintroduce PRODOS 1.9 2022-12-20 21:46:21 -08:00
David Schmenk
62c55eb4ea Update image to ALPHA2 2022-12-20 12:45:52 -08:00
David Schmenk
970d692592 Update code to ALPHA2 2022-12-20 09:58:26 -08:00
David Schmenk
c4551c2c59 Ensure max of 32 characters significant for IDs 2022-07-19 18:21:57 -07:00
David Schmenk
bb41023498 Ensure max of 32 characters significant for IDs 2022-07-19 18:20:53 -07:00
David Schmenk
c3111a63be Make sure 32 characters significant for import/export ID 2022-07-19 18:16:36 -07:00
David Schmenk
726609a573 Make sure 32 significant characters for import/export IDs 2022-07-19 18:06:47 -07:00
David Schmenk
d48ccdf979
Merge pull request #64 from ZornsLemma/plvm-putb
plvm putb support
2022-06-17 19:30:06 -07:00
Steven Flintham
a64afe5486 Add putb() support to plvm.c 2022-06-17 19:51:48 +01:00
ZornsLemma
691c3851f0
Merge branch 'dschmenk:master' into master 2022-05-14 20:46:29 +01:00
David Schmenk
28f06edf9c
Update license 2022-05-08 21:20:26 -07:00
Steven Flintham
6b20c4da10 Merge branch 'master' of github.com:ZornsLemma/PLASMA 2022-04-25 17:57:57 +01:00
ZornsLemma
2ff4c9d842
Merge pull request #17 from dschmenk/master
Merge latest upstream changes
2022-04-25 17:51:28 +01:00
David Schmenk
c7234e2d04 Python3 2021-01-27 12:36:44 -08:00
David Schmenk
bf9c61892c
ALPHA2 2020-07-15 19:37:47 -07:00
Steven Flintham
7d66c27ecf Merge branch 'master' of https://github.com/ZornsLemma/PLASMA 2020-07-06 23:23:43 +01:00
ZornsLemma
0fdc319481
Merge pull request #16 from dschmenk/master
Merge latest upstream changes
2020-07-06 23:23:05 +01:00
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
Steven Flintham
fbb50a9127 Merge branch 'master' of https://github.com/ZornsLemma/PLASMA 2020-06-29 19:34:23 +01: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
ZornsLemma
f0b18db6c2
Merge pull request #15 from dschmenk/master
Merge latest upstream master
2020-01-15 00:37:03 +00:00
Steven Flintham
c05c0789da Merge branch 'master' of https://github.com/ZornsLemma/PLASMA 2020-01-15 00:34:14 +00: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
ZornsLemma
112d5f4639
Merge pull request #14 from dschmenk/master
Merge latest upstream changes to master
2019-04-28 11:47:14 +01:00
201 changed files with 13745 additions and 3177 deletions

21
LICENSE.md Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2010-2022 David Schmenk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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>.

158
README.md
View File

@ -1,10 +1,10 @@
# 11/10/2020 PLASMA 2.0 Developer Preview 3 Available!
[Download and read the Release Notes](https://github.com/dschmenk/PLASMA/releases)
# 2/25/2024 PLASMA 2.11 Available!
[Change List](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%202.0.md#changes-in-plasma-for-20-dp-3)
[Download and read the Release Notes](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%202.1.md)
# 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)
[Change List](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%202.1.md#changes-in-plasma-for-211-release)
[Get single boot floppy of FORTH for PLASMA 2.11](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLFORTH.PO)
# The PLASMA Programming Language
@ -23,86 +23,88 @@ Different projects have led to the architecture of PLASMA, most notably Apple Pa
<!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
- [The PLASMA Programming Language](#the-plasma-programming-language)
- [Contents](#contents)
- [Build Environment](#build-environment)
- [PLASMA Cross-Compiler](#plasma-cross-compiler)
- [acme Cross-Assembler](#acme-cross-assembler)
- [PLASMA Source](#plasma-source)
- [Portable VM](#portable-vm)
- [Target VM](#target-vm)
- [Portable VM](#portable-vm)
- [Target VM](#target-vm)
- [PLASMA Target Hosted Compiler](#plasma-target-hosted-compiler)
- [Tutorial](#tutorial)
- [PLASMA Compiler/Assembler](#plasma-compilerassembler)
- [PLASMA Modules](#plasma-modules)
- [Data Types](#data-types)
- [Obligatory 'Hello World'](#obligatory-hello-world)
- [Character Case](#character-case)
- [Comments](#comments)
- [Numbers](#numbers)
- [Characters](#characters)
- [Strings](#strings)
- [Organization of a PLASMA Source File](#organization-of-a-plasma-source-file)
- [Module Dependencies](#module-dependencies)
- [File Inclusion](#file-inclusion)
- [Predefined Functions](#predefined-functions)
- [Constant Declarations](#constant-declarations)
- [Structure Declarations](#structure-declarations)
- [Global Data & Variables Declarations](#global-data-variables-declarations)
- [Function Definitions](#function-definitions)
- [Statements and Expressions](#statements-and-expressions)
- [Exported Declarations](#exported-declarations)
- [Module Main Initialization Function](#module-main-initialization-function)
- [Module Done](#module-done)
- [Runtime](#runtime)
- [Reference](#reference)
- [Decimal and Hexadecimal Numbers](#decimal-and-hexadecimal-numbers)
- [Character and String Literals](#character-and-string-literals)
- [In-line String Literals](#in-line-string-literals)
- [Words](#words)
- [Bytes](#bytes)
- [Addresses](#addresses)
- [Arrays](#arrays)
- [Type Overrides](#type-overrides)
- [Multi-Dimensional Arrays](#multi-dimensional-arrays)
- [Offsets (Structure Elements)](#offsets-structure-elements)
- [Defining Structures](#defining-structures)
- [Pointers](#pointers)
- [Pointer Dereferencing](#pointer-dereferencing)
- [Addresses of Data/Code](#addresses-of-datacode)
- [Function Pointers](#function-pointers)
- [PLASMA Compiler/Assembler](#plasma-compilerassembler)
- [PLASMA Modules](#plasma-modules)
- [Data Types](#data-types)
- [Obligatory 'Hello World'](#obligatory-hello-world)
- [Character Case](#character-case)
- [Comments](#comments)
- [Numbers](#numbers)
- [Characters](#characters)
- [Strings](#strings)
- [Organization of a PLASMA Source File](#organization-of-a-plasma-source-file)
- [Module Dependencies](#module-dependencies)
- [File Inclusion](#file-inclusion)
- [Predefined Functions](#predefined-functions)
- [Constant Declarations](#constant-declarations)
- [Structure Declarations](#structure-declarations)
- [Global Data \& Variables Declarations](#global-data--variables-declarations)
- [Function Definitions](#function-definitions)
- [Expressions and Statements](#expressions-and-statements)
- [Address Operators](#address-operators)
- [Arithmetic, Bitwise, and Logical Operators](#arithmetic-bitwise-and-logical-operators)
- [Assignment](#assignment)
- [Empty Assignments](#empty-assignments)
- [Increment and Decrement](#increment-and-decrement)
- [Lambda (Anonymous) Functions](#lambda-functions)
- [Control Flow](#control-flow)
- [CALL](#call)
- [RETURN](#return)
- [IF/[ELSIF]/[ELSE]/FIN](#ifelsifelsefin)
- [WHEN/IS/[OTHERWISE]/WEND](#whenisotherwisewend)
- [FOR \<TO,DOWNTO\> [STEP]/NEXT](#for-todownto-stepnext)
- [WHILE/LOOP](#whileloop)
- [REPEAT/UNTIL](#repeatuntil)
- [CONTINUE](#continue)
- [BREAK](#break)
- [Statements and Expressions](#statements-and-expressions)
- [Exported Declarations](#exported-declarations)
- [Module Main Initialization Function](#module-main-initialization-function)
- [Module Done](#module-done)
- [Runtime](#runtime)
- [Reference](#reference)
- [Decimal and Hexadecimal Numbers](#decimal-and-hexadecimal-numbers)
- [Character and String Literals](#character-and-string-literals)
- [In-line String Literals](#in-line-string-literals)
- [Words](#words)
- [Bytes](#bytes)
- [Addresses](#addresses)
- [Arrays](#arrays)
- [Type Overrides](#type-overrides)
- [Multi-Dimensional Arrays](#multi-dimensional-arrays)
- [Offsets (Structure Elements)](#offsets-structure-elements)
- [Defining Structures](#defining-structures)
- [Pointers](#pointers)
- [Pointer Dereferencing](#pointer-dereferencing)
- [Addresses of Data/Code](#addresses-of-datacode)
- [Function Pointers](#function-pointers)
- [Function Definitions](#function-definitions-1)
- [Expressions and Statements](#expressions-and-statements)
- [Address Operators](#address-operators)
- [Arithmetic, Bitwise, and Logical Operators](#arithmetic-bitwise-and-logical-operators)
- [Assignment](#assignment)
- [Empty Assignments](#empty-assignments)
- [Increment and Decrement](#increment-and-decrement)
- [Lambda Functions](#lambda-functions)
- [Control Flow](#control-flow)
- [CALL](#call)
- [RETURN](#return)
- [IF/\[ELSIF\]/\[ELSE\]/FIN](#ifelsifelsefin)
- [WHEN/IS/\[OTHERWISE\]/WEND](#whenisotherwisewend)
- [FOR \<TO,DOWNTO\> \[STEP\]/NEXT](#for-todownto-stepnext)
- [WHILE/LOOP](#whileloop)
- [REPEAT/UNTIL](#repeatuntil)
- [CONTINUE](#continue)
- [BREAK](#break)
- [Advanced Topics](#advanced-topics)
- [Code Optimizations](#code-optimizations)
- [Functions Without Parameters Or Local Variables](#functions-without-parameters-or-local-variables)
- [Return Values](#return-values)
- [Native Assembly Functions](#native-assembly-functions)
- [Libraries and Sample Code](https://github.com/dschmenk/PLASMA/wiki)
- [Code Optimizations](#code-optimizations)
- [Functions Without Parameters Or Local Variables](#functions-without-parameters-or-local-variables)
- [Return Values](#return-values)
- [Native Assembly Functions](#native-assembly-functions)
- [Implementation](#implementation)
- [A New Approach](#a-new-approach)
- [The Virtual Machine](#the-virtual-machine)
- [The Stacks](#the-stacks)
- [Evaluation Stack](#evaluation-stack)
- [Call Stack](#call-stack)
- [Local Frame Stack](#local-frame-stack)
- [Local String Pool](#local-string-pool)
- [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)
- [A New Approach](#a-new-approach)
- [The Virtual Machine](#the-virtual-machine)
- [The Stacks](#the-stacks)
- [Evaluation Stack](#evaluation-stack)
- [Call Stack](#call-stack)
- [Local Frame Stack](#local-frame-stack)
- [Local String Pool](#local-string-pool)
- [Apple 1 PLASMA](#apple-1-plasma)
- [Apple II PLASMA](#apple-ii-plasma)
- [Apple /// PLASMA](#apple--plasma)
- [Links](#links)
<!-- /TOC -->

123
doc/PLFORTH.md Normal file
View File

@ -0,0 +1,123 @@
# FORTH PLASMA + PLFORTH !
PLFORTH represents a REPL and scripting language for the PLASMA environment. Or, what I did over the Holiday break.
The goals of PLFORTH are pretty straight forward:
**Interactivity** and **debugging**.
PLFORTH is a PLASMA module written in PLASMA itself. As a first class citizen of the PLASMA environment, it has instant access to all the PLASMA modules, from floating point to high-res graphics libraries and everything in between.
## Missing words in PLFORTH
There are quite a few missing word that a standard FORTH would have. Mostly due to deliberately keeping PLFORTH as minimal as possible to reduce the memory footpring and load time. Most of the missing words can be synthesized using existing PLASMA modules and some glue words. The double word have mostly been made avialable through PLASMA's 32 bit integer module, `INT32` by way of the `int32.4th` script. You can always petition to get your favorite FORTH word included in the default vocabulary. Speaking of `VOCABULARY`, PLFORTH only has one.
## PLFORTH built-in words
![WORDS](forthwords.png)
## PLFORTH specific words
### Words for looking at internal structures:
`.RS`: Displays the return stack. Note: PLFORTH uses a software defined return stack, this is not the hardware stack
### Words for tracing and single stepping execution:
`TRON`: Turn tracing on
`TROFF`: Turn tracing off (will also turn off single stepping if enabled)
`STEPON`: Turn single stepping on
`STEPOFF`: Turn single stepping off
While running code, `<CTRL-T>` will toggle tracing on and off as well
### Words for breakpoints:
`BRK`: Used inside compiled word to effect a runtime break
`BRKON xxxx`: Enable breakpoint whenever word `xxxx` is executed
`BRKOFF`: Disable the breakpoint. Note: only one breakpoint is currently supported
While running code, `<CTRL-C>` will break out and return to the interpreter.
`CONT`: Continue running from the last break point
### Words for PLASMA linkage:
`LOOKUP yyyy`: Lookup symbol `yyyy` in PLASMA symbol table and return its address
`PLASMA zzzz`: Create word `zzzz` with code address from `LOOKUP`
### Words to run a script:
`SRC`: Source filename on stack as input. Can be nested
`SRC" ssss"`: Source file `ssss` as input. Can be nested
`?ENDSRC`: End sourcing file as input if stack flag non-zero
`ENDSRC`: End sourcing file as input
### Words for compiler modes:
`PBC`: Compile into PLASMA Byte Code
`ITC`: Compile into Indirect Threaded Code
### Word for converting string to number:
`NUM?`: Convert string and length to number, returning number and valid flag
Numbers entered with a preceeding `$` will be interpreted as hex values
### Words for displaying hex numbers
`$.`: Display TOS word in hex with leading `$`
`C$.`: Display TOS byte in hex with leading `$`
## Debugging vs Performance
PLFORTH defaults to compiling using ITC (Indirect Threaded Code). This supports a list of inspection and debugging features while developing programs and scripts. However, the compiler can easily switch to PBC (PLASMA Byte Code) to greatly improve performance, but most of the debugging tools are lost. ITC compiled words and PBC compiled words can be intermingled and call each other seemlessly. PLASMA Byte Code is a direct match to many low-level FORTH constructs.
## Graphics
Due to the way the Apple II implements Hi-Res, Lo-Res and Double Lo-Res graphics, a stub loader is required to reserve the pages used.
`HRFORTH`: Reserve HGR page 1 before launching PLFORTH
`HR2FORTH`: Reserve HGR pages 1 and 2 before launching PLFORTH
`TX2FORTH`: Reserve GR and DGR pages 1 and 2 before launching PLFORTH
## Scripts
There are a few useful scripts located in the `scripts` directory. By far the most useful is `plasma.4th`
### plasma.4th useful words
`CAT`: Display files in current ProDOS directory
`CAT" pppp"`: Display files in `pppp` ProDOS directory
`PFX" pppp"`: Set current ProDOS prefix to `pppp`
`PFX.`: Display current ProDOS prefix
`EDIT" ssss"`: Edit file `ssss`
## Command line options
`-F`: Fast flag (like `PCB` as first command)
`-T`: Trace flag (like `TRON` as first command)
`SCRIPT NAME`: Soure filename to execute
## Links
Here is a (worse than usual) video running through some examples. This was a preliminary release so the final is a bit different: https://youtu.be/picPyXAk77I?si=Td2En5Z3oxVTzh0z
A pre-configured ProDOS floppy image able to run and a few utilities is available here: https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLFORTH.PO

BIN
doc/ROGUE.LZ4.BIN Normal file

Binary file not shown.

94
doc/ROGUE.TXT Normal file
View File

@ -0,0 +1,94 @@
PLASMA goes ROGUE
=================
Introduction
------------
This version of ROGUE is somewhat different than others. It is very simple in most ways, but I have developed a (I think) unique visibility algorithm that runs extremely fast. Fast enough to run interpreted by the PLASMA VM on a 1 MHz 6502, and space efficient enough to allow for large (in the future) dungeons. The unique feature of this ROGUE is that lighting becomes critical and strategic. You are in dark catacombs, after all. You enter with a lit lamp, throwing off a circle of light. There are also torches throughout the catacombs that light up a small surrounding circle of light. Other items in the catacombs are mana (health+energy increase), a key, a raft, and gold. You will also encounter a number of enemies that will track you down to try and kill you. You will also encounter doors, locked doors, windows, water, and crevasses.
Strategy
--------
As you travel through the catacombs, you must watch your health, energy, and lamp oil levels. Once health reaches zero, you are dead. As energy reaches zero, your vision will narrow and you will no longer be able to run. When the lamp oil runs out, you will be cast into darkness. If you see any torches in your field of vision, you can navigate to them. Taking the torch will extinguish the torch and replenish some of your lamp oil. Note that as you travel through the catacombs, your map of what you have seen will automatically fill in. But, if you are in the dark, you cannot read your map. You must turn on your lamp or get next to a torch before you can read the map again. If you are in the dark and cant see any torches in your field of vision, you are in complete darkness. It is easy to lose your bearings. As such, the absolute direction movements no longer work (NSEW) - you will end up in a random direction if you try. However, the relative turns, left/right and forward/backward controls continue to work (that you can do in the dark).
Being in the dark can be advantageous, however. All the enemies in the catacombs can see you if you are in light, just as you can see them. If you are in darkness, they can't see you, and you can move around without being tracked. Don't run into them! Also, don't fall off a crevasse. You will hear certain noises giving you feedback on what is going on. A simple beep when you run into walls. A groan when an enemy moves towards you. A bleep when you pick an item up. Other noises when you fall over an edge or win a battle. These can be used strategically when moving in the dark.
Health will slowly improve as you move around. However, energy is depleted as you move. Mana will increase both health and energy. If health is already at 100, it wont go any higher. Same for energy, but it is important to keep both high. When energy goes low, you can no longer move quickly and your field-of-vision narrows. When health goes to zero, you are dead.
Tile Description
----------------
As ROGUE uses the text screen for display, a little creativity is required to interpret the map. These are the characters you will see and what the represent. Once you get the hang of it, it will be just like looking at the unencoded Matrix.
Screen Character Represents
# Wall
. Floor
: Window (barred opening)
+ Door
% Locked Door (need key to open)
' ' space Crevasse (pit - don't fall in)
= Exit
- Entrance
*,X Torch
& Mana
, Key (yep, hard to spot)
@ Raft (need to cross water)
((( Water
))) Water (you will drown without raft)
$ Gold
Flashing Entity
T Thief
O Ogre
Z Zombie
R Rogue
Player Facing Direction
^ North
\ NE
> East
/ SE
v South
\ SW
< West
/ NW
Tiles in light are inverse. Entities are displayed only when lit and in field of view. The map is only visible when lit, i.e lamp is on or standing next to a torch.
Interaction
-----------
Keyboard commands Action
Q Run (Quick)
W up-arrow Forward
S down-arrow Backward
A left-arrow Turn left
D right-arrow Turn right
I Move N
J Move W
K Move E
M Move S
< , Turn lamp down
> . Turn lamp up/on
O Turn lamp off
Space-bar Open door
Return Pick up item
X Exit (die)
Whenever you and an enemy end up on the same tile, battle commences. As you win fights, your skill increases, improving your attack effectiveness. As you advance through the catacombs, the enemies become more powerful. You will need to replenish health and energy with mana. Don't forget, the alternative to fighting is stealth in the darkness. During battle, you have the option to run. If you have low energy, you won't get very far. Also, when fighting, you get turned around so you can't depend on the direction you were facing before fighting. Running ('Q'uick) will get you away from enemies but will use much more energy.
If you should die, restart the game by typing:
+rogue
Map Levels
----------
Level maps are up to 62x62 in size (plus a wall boundary for an effective 64x64 map size). They can be smaller than this. The game will end when it tries to load an non-existent level. Levels start at file name “LEVEL0“ and can go all the way to “LEVEL9“, but must be sequential.
There are two levels included on the disk, and an empty level for you to use as a template. You can edit the map levels, and add your own. They are simple ASCII text files. The included editor can edit the maps right on the disk. type:
+ed level.empty
after exiting from ROGUE. Make your changes and save it as LEVEL0" to "LEVEL9". The next free level is currently "LEVEL2". You may also edit an existing level:
+ed level0
for instance.

View File

@ -81,13 +81,13 @@ If you should die, restart the game by typing:
Level maps are up to 62x62 in size (plus a wall boundary for an effective 64x64 map size). They can be smaller than this. The game will end when it tries to load an non-existent level. Levels start at file name “LEVEL0“ and can go all the way to “LEVEL9“, but must be sequential.
There are two levels included on the disk, and an empty level for you to use as a template. You can edit the map levels, and add your own. They are simple ASCII text files. The included sandbox editor can edit the maps right on the disk. type:
There are two levels included on the disk, and an empty level for you to use as a template. You can edit the map levels, and add your own. They are simple ASCII text files. The included editor can edit the maps right on the disk. type:
```
-sandbox level.empty
+ed level.empty
```
after exiting from ROGUE. Make your changes and save it as LEVEL0" to "LEVEL9". The next free level is currently "LEVEL2". You may also edit an existing level:
```
-sandbox level0
+ed level0
```
for instance.

View File

@ -1,32 +1,40 @@
# PLASMA Version 2.0 Developer Preview 3
# PLASMA Version 2.1
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 ///):
Download the five disk images:
[PLASMA 2.0 DP 800K Full System](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2.2mg?raw=true)
[PLASMA 2.1 800K Full System](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1.2mg?raw=true)
[PLASMA 2.0 DP System and ProDOS Boot](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-SYS.PO?raw=true)
[PLASMA 2.1 ProDOS Boot & Install](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-INST.po?raw=true)
[PLASMA 2.0 DP Build Tools](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-BLD.PO?raw=true)
[PLASMA 2.1 System Libraries](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-SYS.po?raw=true)
[PLASMA 2.0 DP Demos](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-DEM.PO?raw=true)
[PLASMA 2.1 Build Tools](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-BLD.po?raw=true)
[PLASMA 2.0 TCP/IP modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-INET.PO?raw=true)
[PLASMA 2.1 Demos](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-DEMOS.po?raw=true)
[PLASMA 2.0 DP Apple /// SOS Boot and SANE floating point modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-FPSOS.PO?raw=true)
[PLASMA 2.1 TCP/IP network modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-INET.po?raw=true)
PLASMA can be run from floppies, System in Drive 1, and Build or Demos in Drive 2. Mass storage is the recommended installation that looks like (replacing HARDISK with your volume name of choice):
[PLASMA 2.1 Apple /// SOS Mame Boot and SANE floating point modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-FPSOS.po?raw=true)
System Files => /HARDISK/PLASMA/
[PLASMA 2.1 Apple /// SOS Mame Boot](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-A3MAME.PO?raw=true)
[PLASMA 2.1 Apple /// Mame hard disk image](https://github.com/dschmenk/PLASMA/blob/master/images/apple/apple3.hd?raw=true)
[PLASMA 2.1 PLFORTH stand-alone boot](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLFORTH.PO?raw=true)
PLASMA now has a ProDOS hard disk install script. Mass storage is the recommended installation that looks like (replacing HARDISK with your volume name of choice) if you want to copy files yourself:
Boot & System Files => /HARDISK/PLASMA/
Build Files => /HARDISK/PLASMA/BLD/
Demo Files => /HARDISK/PLASMA/DEMOS/
SANE files => /HARDISK/PLASMA/SYS
Floating Point SANE Files => /HARDISK/PLASMA/SYS
INET files => /HARDDISK/PLASMA/SYS
INET Files => /HARDDISK/PLASMA/SYS
Use the System Utilities to copy the floppy images into the above mentioned directories.
@ -44,7 +52,7 @@ PLASMA can utilize the 16 bit features of the 65802 and 65816 processors to impr
## Apple ///
The Apple /// gets the environment it always wanted: The ability to navigate the filesystem with a command line interface. The Apple /// always boots from the floppy drive, even if a hard disk is installed. The PLASMA.SOS floppy should be updated with the SOS.DRIVER configured for your machine. Once booted, type `S /HARDISK/PLASMA` (or your install directory of choice) to change to, and set, the system directory. This can be automated by creating an `AUTORUN` file on the boot floppy with the above command in it.
The Apple /// gets the environment it always wanted: The ability to navigate the filesystem with a command line interface. The Apple /// always boots from the floppy drive, even if a hard disk is installed. `PLASMA2-A3MAME.PO` is an Apple 3 bootable disk containing the SOS.DRIVER configured for the [Apple 3 Ready-To-Run Mame environment](https://github.com/datajerk/apple3rtr). `apple3.hd` is the pre-installed PLASMA hard disk image set up for [Apple 3 Ready-to-Run](https://github.com/datajerk/apple3rtr). For a physical Apple 3, the PLASMA2-FPSOS.PO floppy should be updated with the SOS.DRIVER configured for the machine. Once booted, type `S /HARDISK/PLASMA` (or your install directory of choice) to change to, and set, the system directory. This can be automated by creating an `AUTORUN` file on the boot floppy with the above command in it.
## PLASMA Command Line Shell
@ -73,7 +81,7 @@ The shell is very brief with error messages. It is meant solely as a way to run
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]
+ED [TEXT FILE] [GOTO LINE NUMBER]
```
The file manipulation utilities to copy, delete, rename, create directories, and change file type and aux type remove the need for external programs to do the same. PLASMA can now be installed with the tools included on the PLASMA2-SYS boot floppy. They are:
```
@ -82,8 +90,9 @@ The file manipulation utilities to copy, delete, rename, create directories, and
+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.
The ```-R``` option will operate on the directories recursively. Wildcard filenames can be specified with ```'*'``` matching zero or more characters, and ```'?'``` matching any character. When copying files to the current directory, ```=``` can be used as a shortcut.
## Compiler Modules
@ -115,6 +124,50 @@ 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 2.0 Release
1. Fix command line buffer overflow
2. Use VBlank to blink editor cursor so not CPU speed dependent
3. Add ```=``` for ```+COPY``` current destination
4. Add //c support for DGRLIB and GRLIB wait-for-VBlank routines
# Changes in PLASMA for 2.0 Beta
1. Compilers allows for including self imported defines
2. Compilers fixed for local constants
3. Floating point string formatting fixes and improvements
4. Fiber library exports number of active fibers
# Changes in PLASMA for 2.0 Alpha 2
1. Self hosted compiler fixes for invalid array size constants
2. Ensure IDs in self hosted compiler are 31 characters significant
3. Fix bug COPY file parsing and move common routine into MATCHFILES
# Changes in PLASMA for 2.0 Alpha 1
1. Improved entry/exit for 128K Apple IIe //c
2. Improved entry for Apple ///
3. Improved entry and function calls for 16 bit VM
# Changes in PLASMA for 2.0 DP 4
1. Improved editor auto-indenting
2. Compiler fix for terneray operator precedence
3. Machine check for HGR library
# Changes in PLASMA for 2.0 DP 3
1. File manipulation utilities fixed for Apple /// SOS vs ProDOS differences

352
doc/Version 2.1.md Normal file
View File

@ -0,0 +1,352 @@
# PLASMA Version 2.11
Welcome to PLASMA: the Grand Unifying Platform for the Apple 1, ][, and ///.
Version 2.11 is a minor update to address the relocating loader for EDASM generated modules with 8 bit fixups. All modules up to now have been generated by PLASM and only use 16 bit fixups. Mostly usefull for future modules built with EDASM. Check out the Assembly Language Toolkit below.
If you already have 2.1 installed, here are the updated files:
[PLASMA 2.11 Update](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.11-UPD.po)
Download the full 2.11 disk image set:
[PLASMA 2.11 HD Full System](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA2.2mg)
[PLASMA 2.11 800K Full System](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1.po)
[PLASMA 2.11 ProDOS Boot & Install](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-INST.po)
[PLASMA 2.1 System Libraries](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-SYS.po)
[PLASMA 2.11 Build Tools](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-BLD.po)
[PLASMA 2.1 Demos](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-DEMOS.po)
[PLASMA 2.1 TCP/IP network modules](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-INET.po)
[PLASMA 2.11 Apple /// SOS and SANE floating point modules](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-FPSOS.po)
[PLASMA 2.11 Apple /// SOS Mame Boot](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA2-A3MAME.PO)
[PLASMA 2.11 Apple /// Mame hard disk image](https://github.com/dschmenk/PLASMA/raw/master/images/apple/apple3.hd)
[PLASMA 2.11 PLFORTH stand-alone boot](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLFORTH.PO)
[PLASMA 2.11 Assembly Language Toolkit](https://github.com/dschmenk/PLASMA/raw/master/images/apple/ASM-TK.po)
PLASMA now has a ProDOS hard disk install script. Mass storage is the recommended installation that looks like (replacing HARDISK with your volume name of choice) if you want to copy files yourself:
Boot & System Files => /HARDISK/PLASMA/
Build Files => /HARDISK/PLASMA/BLD/
Demo Files => /HARDISK/PLASMA/DEMOS/
Floating Point SANE Files => /HARDISK/PLASMA/SYS
INET Files => /HARDDISK/PLASMA/SYS
Use the System Utilities to copy the floppy images into the above mentioned directories.
## Apple 1
The Apple 1 is a very constrained system compared to the ][ and ///. It is required to have the CFFA1 disk adapter installed to provide file storage and a full 32K od RAM. To get the files onto the CF card required the use of [CiderPress](http://a2ciderpress.com) and they must be placed in one directory. Most PLASMA programs won't work on the Apple 1 due to limited filesystem support, video/graphics capabilities, and lack of audio output. It does, however, make a good place to start when porting PLASMA to a new platform.
## Apple ][
To boot directly into PLASMA, you will need to put the system files in the root prefix of the boot device and make sure PLASMA.SYSTEM is the first SYSTEM file in the directory. Otherwise, start PLASMA.SYSTEM from your program launcher of choice. All Apple ][ models with 64K and two floppy drives are supported up to a maxed out IIGS with accelerator and hard drive.
#### 65802/65816 Support
PLASMA can utilize the 16 bit features of the 65802 and 65816 processors to improve performance of the PLASMA VM operation. This is transparent to the programmer/user and doesn't make any additional memory or capabilities available to PLASMA. PLASMA will automatically run the most optimal VM for your configuration.
## Apple ///
The Apple /// gets the environment it always wanted: The ability to navigate the filesystem with a command line interface. The Apple /// always boots from the floppy drive, even if a hard disk is installed. `PLASMA2-A3MAME.PO` is an Apple 3 bootable disk containing the SOS.DRIVER configured for the [Apple 3 Ready-To-Run Mame environment](https://github.com/datajerk/apple3rtr). `apple3.hd` is the pre-installed PLASMA hard disk image set up for [Apple 3 Ready-to-Run](https://github.com/datajerk/apple3rtr). For a physical Apple 3, the PLASMA2-FPSOS.PO floppy should be updated with the SOS.DRIVER configured for the machine. Once booted, type `S /HARDISK/PLASMA` (or your install directory of choice) to change to, and set, the system directory. This can be automated by creating an `AUTORUN` file on the boot floppy with the above command in it.
## PLASMA Command Line Shell
PLASMA incorporates a very basic command line shell to facilitate navigating the filesystem and executing both SYSTEM/SOS programs and PLASMA modules. It has a few built-in commands:
| Command | Operation |
|:----------------------------:|-------------------------|
| C [PREFIX] | Catalog prefix
| P \<PREFIX\> | change to Prefix
| / | change to parent prefix
| V | show online Volumes
| S \<PREFIX\> | set System prefix*
| +SOS \<SOS.INTERP\> [PREFIX] | launch SOS interpreter*
| -\<SYSTEM PROGRAM\> [PARAMS] | launch SYSTEM program**
| +\<PLASMA MODULE\> [PARAMS] | exec PLASMA module
```
[Optional parameters]
<Required parameters>
* Apple /// only
** Apple ][ only
```
The shell is very brief with error messages. It is meant solely as a way to run programs that accept command line parameters and take up as little memory as possible. It does, however, provide a rich runtime for PLASMA modules.
## Included Modules
PLASMA comes with many library modules used by the tools, demos and sample code. The PLASMA system volume must remain in place for the duration of PLASMAs run otherwise it won't be able to find CMD or the system libraries. Probably the most useful included module is the editor. It is used for editing PLASMA source file, assembly source files, or any text file. Execute it with:
```
+ED [TEXT FILE] [GOTO LINE NUMBER]
```
The file manipulation utilities to copy, delete, rename, create directories, and change file type and aux type remove the need for external programs to do the same. PLASMA can now be installed with the tools included on the PLASMA2-SYS boot floppy. They are:
```
+COPY [-R] <SRCPATH>+ <DSTPATH>
+DEL [-R] <FILEPATH>
+REN <FILENAME> <NEWNAME>
+NEWDIR <NEWDIRECTORY>
+TYPE <FILENAME> [NEWTYPE [NEWAUX]]
+CAT [-R] <FILEPATH]
```
The ```-R``` option will operate on the directories recursively. Wildcard filenames can be specified with ```'*'``` matching zero or more characters, and ```'?'``` matching any character. When copying files to the current directory, ```=``` can be used as a shortcut.
## Compiler Modules
The build disk includes sample source, include files for the system modules, and the PLASMA compiler+optimizer modules. The compiler is invoked with:
```
+PLASM [-[W][O[2]] <SOURCE FILE> [OUTPUT FILE]
```
Compiler warnings are enabled with `-W`. The optional optimizer is enabled with `-O` and extra optimizations are enabled with `-O2`. The source code for a few sample programs are included. The big one, `RPNCALC.PLA`, is the sample RPN calculator that uses many of PLASMA's advanced features. The self-hosted compiler is the same compiler as the cross-compiler, just transcribed from C to PLASMA (yes, the self-hosted PLASMA compiler is written in PLASMA). It requires patience when compiling: it is a fairly large and extensive program.
## Assembly Toolkit
New for 2.11 is the assembly language toolkit. The PLASMA module was originally architected around the REL file generated by the ProDOS toolkit assembler, EDASM. This minor update fixes the PLASMA relocating loader to handle 8 bit fixups. PLASM generated modules only use 16 bit fixups, so not an issue for existing modules. Download the toolkit that includes the ProDOS EDASM assembler and sample code. Also the 2.11 updates (if you have 2.1 already installed) here:
[PLASMA 2.11 Assembly Language Toolkit](https://github.com/dschmenk/PLASMA/raw/master/images/apple/ASM-TK.po)
[PLASMA 2.11 Update](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.11-UPD.po)
## FORTH Module
New for version 2.1 is a FORTH language module capable of interpreting script files and interactive programming. Further documentation here: https://github.com/dschmenk/PLASMA/blob/master/doc/PLFORTH.md. Samples scripts are in /HARDISK/BLD/SCRIPTS
## Demos
There are some demo programs included for your perusal. Check out `ROGUE` for some diversion. You can find the documentation here: https://github.com/dschmenk/PLASMA/blob/master/doc/Rogue%20Instructions.md. A music sequencer to play through a MockingBoard if it is detected, or the built-in speaker if not. A minimal Web server if you have an Uthernet2 card (required). Try `SPIDERS`for some hires shoot'em-up action. Bug reports appreciated.
## Source Code
Most sample source code is included from the project. They build without alteration and should be a good starting point for further explorations. The header files for the included library modules are in the INC directory.
## Video Playlist
There is a [YouTube playlist](https://www.youtube.com/playlist?list=PLlPKgUMQbJ79VJvZRfv1CJQf4SP2Gw3yU) created for learning PLASMA.
## Issues
- All the modules and runtime are written mostly in PLASMA; the compiler and editor as well. This means that there may be some startup delay as the PLASMA module loader reads in the module dependencies and performs dynamic linking. But a 1 MHz, 8 bit CPU interpreting bytecodes is never going to match a modern computer. As noted earlier, an accelerator and mass storage are your (and PLASMA's) friend.
- All the project modules are included. They have been lightly tested.
- The Apple /// may not always report errors properly or at all.
- The documentation is sparse and incomplete. Yep, could use your help...
# Changes in PLASMA for 2.11 Release
1. Minor update to load modules generated by EDASM with 8 bit fixups
# Changes in PLASMA for 2.1 Release
1. Lots of small bug fixes in floating point, file copy and graphics libraries
2. MULT opcode speedup improvements
3. Overhaul 65802/65814 VM for better speed and compatibility with PLFORTH compilation
4. Many Apple /// improvements and bug fixes
5. Low memory fixes and tests
6. FORTH language support as a PLASMA module. Full accessabilit to PLASMA modules and libraries
7. Install script for ProDOS mass storage
# Changes in PLASMA for 2.0 Release
1. Fix command line buffer overflow
2. Use VBlank to blink editor cursor so not CPU speed dependent
3. Add ```=``` for ```+COPY``` current destination
4. Add //c support for DGRLIB and GRLIB wait-for-VBlank routines
# Changes in PLASMA for 2.0 Beta
1. Compilers allows for including self imported defines
2. Compilers fixed for local constants
3. Floating point string formatting fixes and improvements
4. Fiber library exports number of active fibers
# Changes in PLASMA for 2.0 Alpha 2
1. Self hosted compiler fixes for invalid array size constants
2. Ensure IDs in self hosted compiler are 31 characters significant
3. Fix bug COPY file parsing and move common routine into MATCHFILES
# Changes in PLASMA for 2.0 Alpha 1
1. Improved entry/exit for 128K Apple IIe //c
2. Improved entry for Apple ///
3. Improved entry and function calls for 16 bit VM
# Changes in PLASMA for 2.0 DP 4
1. Improved editor auto-indenting
2. Compiler fix for terneray operator precedence
3. Machine check for HGR library
# Changes in PLASMA for 2.0 DP 3
1. File manipulation utilities fixed for Apple /// SOS vs ProDOS differences
2. More optimizations for HiRes graphics libraries
3. Spiders From Mars hires demo game
# Changes in PLASMA for 2.0 DP 2
1. Many file manipulaition utilities (COPY, REName, NEWDIRectory, DELete, CATalog, TYPE)
2. New and updated libraries for lo-res. double lo-res and hi-res graphics w/ sprites
3. 32 bit integer library for those times when 16 bits just isn't enough
4. Apple /// improvements to other SOS.INTERP launching with SOS utility
5. Apple /// JIT VM for speed and non JIT version to free up global memory
6. Editor improvements
7. A couple small compiler optimizations
8. Needed to break out TCP/IP modules into seperate floppy image
9. Library changes require full install
# Changes in PLASMA for 2.0 DP 1z
1. Many fixes for the value zero - especially in 65802/65816 divide routine
# Changes in PLASMA for 2.0 DP 1 E+C
1. Greatly improved code editor and additional compiler stats
# Changes in PLASMA for 2.0 DP 1a
1. Fix interaction with JIT compiler and module load/unload
# Changes in PLASMA for 2.0 DP 1
1. Expanded bytecode for more efficient size/performance of programs
2. Just-In-Time Compiler for native code performance (6502 and 65816) for frequently called routines
3. Automatically identify and run most optimal VM for configuration
# Changes in PLASMA for 1.2
1. Add TFTPD TFTP server
2. Fix Uthernet 1 driver
3. Add mouse module
4. Fix IRQ issues for interrupt driven mouse driver
# Changes in PLASMA for 1.1
1. All known bugs are fixed
2. PLASM compiler received a little performance boost with an assembly language helper for ID/keyword lexical scanner
# Changes in PLASMA for 1.0
If you have been programming in PLASMA before, the 1.0 version has some major and minor changes that you should be aware of:
1. Case is no longer significant. Imported symbols were always upper case. Now, all symbols are treated as if they were upper case. You may find that some symbols clash with previously defined symbols of different case. Hey, we didn't need lower case in 1977 and we don't need it now. You kids, get off my lawn!
2. Modules are now first class citizens. Translation: importing a module adds a symbol with the module name. You can simply refer to a module's address with it's name. This is how a module's API table is accessed (instead of adding a variable of the same name in the IMPORT section).
3. Bytecode changes means previously compiled modules will crash. Rebuild.
4. `BYTE` and `WORD` have aliases that may improve readability of the code. `CHAR` (character) and `RES` (reserve) are synonyms for `BYTE`. `VAR` (variable) is a synonym for `WORD`. These aliases add no functionality. They are simply syntactic sugar to add context to the source code, but may cause problems if you've previously used the same names for identifiers.
5. When declaring variables, a base size can come after the type, and an array size can folllow the identifier. For instance:
```
res[10] a, b, c
```
will reserve three variables of 10 bytes each. Additionally:
```
res[10] v[5], w[3]
```
will reserve a total of 80 bytes (10 * 5 + 10 * 3). This would be useful when combined with a structure definition. One could:
```
res[t_record] patients[20]
```
to reserve an array of 20 patient records.
6. Ternary operator. Just like C and descendants, `??` and `::` allow for an if-then-else inside an expression:
```
puts(truth == TRUE ?? "TRUE" :: "FALSE")
```
7. Multiple value assignements. Multiple values can be returned from functions and listed on variable assignments:
```
def func#3 // Return 3 values
return 10, 20, 30
end
a, b, c = 1, 2, 3
c, d, f = func()
x, y = y, x // Swap x and y
```
8. `DROP` allows for explicit dropping of values. In the above `func()` example, if the middle value was the only one desired, the others can be ignored with:
```
drop, h, drop = func()
```
9. The compiler tracks parameter and return counts for functions. If the above `func()` were used without assigning all the return values, they would be dropped:
```
a = func() // Two values silently dropped
```
To generate compiler warning for this issue, and a few others, use the `-W` option when compiling.
10. Lambda (Anonymous) Functions. The ability to code a quick function in-line can be very powerful when used properly. Look here, https://en.wikipedia.org/wiki/Anonymous_function, for more information.
11. SANE (Standard Apple Numerics Environment) Floating Point Library. An extensive library (two, actually) of extended floating point (80 bit IEEE precision) functionality is suported. A wrapper library has been written to greatly simplify the interface to SANE. Look at the `RPNCALC.PLA` source code as an example.
12. Library Documentation. Preliminary documentation is available on the Wiki: https://github.com/dschmenk/PLASMA/wiki
13. Significant effort has gone into VM tuning and speeding up module loading/dynamic linking.
14. The VM zero page usage has changed. If you write assembly language routines, you will need to rebuild.
# Thanks
I wish to thank the people who have contributed the the PLASMA project. They have greatly improved the development of the language and documentation:
- Martin Haye: PLASMA programmer extraordinaire. Mr. Lawless Legends has requested many of the crucial features that set PLASMA apart.
- Steve F (ZornsLemma): Has taken the optimizer to new levels and his work on porting PLASMA to the Beeb are amazing: http://stardot.org.uk/forums/viewtopic.php?f=55&t=12306&sid=5a503c593f0698ebc31e590ac61b09fc
- Peter Ferrie: Assembly optimizer extraordinaire. He has made significant improvements into the code footprint in PLASMA so all the functionality can exist in just a few bytes.
- David Schmidt (DaveX): His help in documentation have made it much more accessible and professional. Of course any errors are all his. Just kidding, they're mine ;-)
- Andy Werner (6502.org): Catching the grammatical errors that I ain't no good at.
- John Brooks: Apple II Guru par excellence. His insights got 10% performance increase out of the VM.
Dave Schmenk
http://schmenk.is-a-geek.com

BIN
doc/forthwords.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
images/apple/A1PLASMA.po Executable file

Binary file not shown.

BIN
images/apple/ASM-TK.po Executable file

Binary file not shown.

BIN
images/apple/BLANK140.po Executable file

Binary file not shown.

BIN
images/apple/BLANK800.po Normal file

Binary file not shown.

BIN
images/apple/DHGR-TK.po Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
images/apple/PLASMA-2.1.po Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
images/apple/PLFORTH.PO Normal file

Binary file not shown.

BIN
images/apple/ROGUE.PO Executable file

Binary file not shown.

BIN
images/apple/apple3.hd Normal file

Binary file not shown.

View File

@ -2,7 +2,7 @@ import cmdsys
//
// Useful values for everyone
//
const _SYSVER_ = $0200 // Version built against
const _SYSVER_ = $0211 // Version built against
const FALSE = 0
const TRUE = not FALSE
const NULL = 0
@ -11,7 +11,7 @@ import cmdsys
//
const MACHID_CLOCK = $01
const MACHID_80COL = $02
const MACHID_MEM = $03
const MACHID_MEM = $30
const MACHID_64K = $20
const MACHID_128K = $30
const MACHID_MODEL = $C8
@ -54,8 +54,10 @@ import cmdsys
byte syserr
byte jitcount
byte jitsize
byte refcons // Apple /// specific
byte devcons // Apple /// specific
word sysexec[] // Apple II specific
byte refcons // Apple /// specific
byte devcons // Apple /// specific
word lookupsym
end
//
// CMD exported functions

View File

@ -6,10 +6,14 @@ import dgrlib
predef dgrTile(x, y, src)#0
predef dgrTileStr(x, y, tilestr, strlen, tilebuff)#0
predef dgrFill(x, y, tile)#0
predef dgrVLB#0
predef dgrClear(clr)#0
predef dgrMode(mode)#1
predef dgrShow(page)#1
predef dgrSwap#0
predef dgrDrawBuf(page)#0
predef dgrColor(clr)#0
const dgrPage1 = 0
const dgrPage2 = 1
const dgrOff = -1
end

11
src/inc/extdefseg.inc Normal file
View File

@ -0,0 +1,11 @@
;
; BYTECODE DEFS SEGMENT
;
DB 0 ; PAD BYE
DEFSEG EQU *
;
; INIT CODE RUNS WHEN MODULE LOADED
;
MODINIT DB $54 ; CALL ASM INIT
DW INIT
DB $5C ; RET

5
src/inc/extheader.inc Normal file
View File

@ -0,0 +1,5 @@
DW $6502
DW RESFLAGS ; SYSFLAGS
DW DEFSEG ; DEF OFFSET
DW 1 ; DEF COUNT (INCLUDING INIT)
DW MODINIT ; MOD INIT

View File

@ -1,4 +1,5 @@
import fiber
predef fbrInit(numPool), fbrStop(fid)#0, fbrExit#0, fbrStart(defaddr, param)
predef fbrYield#0, fbrHalt#0, fbrResume(fid)#0
byte fbrCount
end

View File

@ -6,6 +6,7 @@ const FPSTR_FIXED = 1 // Fixed count of fractional digits
const FPSTR_FLOAT = 0 // Floating count of fractional digits
const FPSTR_STRIP = 2 // Strip trailing fractional zeros
const FPSTR_EXP = 4 // Force exponential format
const FPSTR_FLEX = 8 // Flexible switch to EXP format if over/underflow
//
// Parse string into decrecord, return SANE conversion output
//

View File

@ -6,10 +6,14 @@ import grlib
predef grTile(x, y, src)#0
predef grTileStr(x, y, tilestr, strlen, tilebuff)#0
predef grFill(x, y, tile)#0
predef dgrVLB#0
predef grClear(clr)#0
predef grMode(mode)#1
predef grShow(page)#1
predef grSwap#0
predef grDrawBuf(page)#0
predef grColor(clr)#0
const grPage1 = 0
const grPage2 = 1
const grOff = -1
end

View File

@ -21,4 +21,7 @@ import hgrlib
predef hgrSwap#1
predef hgrDrawBuf(page)#1
predef hgrColor(clr)#0
const hgrPage1 = 0
const hgrPage2 = 1
const hgrOff = -1
end

View File

@ -5,9 +5,5 @@ import hgrtile
predef tileAndDraw(x, y, tileptr)#0
predef tileDrawStr(x, y, strptr, strlen, tileset)#0
predef tileFromText(txtpage, tileset)#0
predef tileMode(mode)#1
predef tileClear#0
predef tileShow(page)#1
predef tileSwap#1
predef tileDrawBuf(page)#1
end

View File

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

41
src/inc/plasma.inc Normal file
View File

@ -0,0 +1,41 @@
REL
ORG $1000
;
; USEFUL ZERO PAGE LOCATIONS
;
SRC EQU $06
SRCL EQU SRC
SRCH EQU SRC+1
DST EQU SRC+2
DSTL EQU DST
DSTH EQU DST+1
TMP EQU $E7
TMPL EQU TMP
TMPH EQU TMP+1
ESTKH EQU $C0
ESTKL EQU $D0
DROPOP EQU $EF
NEXTOP EQU $F0
FETCHOP EQU NEXTOP+1
;
; JUMP TO BYTECODE INTERPRETER ADDRESS
;
INTERP EQU $03D0
;
; SYSTEM FLAGS: MEMORY ALLOCATOR SCREEN HOLES
;
RESTXT1 EQU $0001
RESTXT2 EQU $0002
RESXTXT1 EQU $0004
RESXTXT2 EQU $0008
RESHGR1 EQU $0010
RESHGR2 EQU $0020
RESXHGR1 EQU $0040
RESXHGR2 EQU $0080
NOJITC EQU $0100
;
; MODULE FREE FLAGS
;
MODNOKEEP EQU $0000
MODKEEP EQU $2000
MODINITKEEP EQU $4000

83
src/lib6502/BSDmakefile Normal file
View File

@ -0,0 +1,83 @@
# THIS FILE WAS GENERATED AUTOMATICALLY
# EDIT AT YOUR OWN RISK
#
# Makefile for lib6502, run6502
# Copyright (c) 2005 Ian Piumarta
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sub-license, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS". USE ENTIRELY AT YOUR OWN RISK.
# last edited: 2005-11-01 22:48:49 by piumarta on margaux.local
CFLAGS = -g -O3
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
LIBDIR = $(PREFIX)/lib
INCDIR = $(PREFIX)/include
DOCDIR = $(PREFIX)/doc/lib6502
EGSDIR = $(DOCDIR)/examples
MANDIR = $(PREFIX)/man
MAN1DIR = $(MANDIR)/man1
MAN3DIR = $(MANDIR)/man3
all : run6502
run6502 : run6502.o lib6502.a
lib6502.a : lib6502.o
$(AR) -rc $@.new lib6502.o
mv $@.new $@
-ranlib $@
clean : .FORCE
rm -f run6502 lib1 *~ *.o *.a .gdb* *.img *.log
.FORCE :
install : .FORCE
install -d $(BINDIR)
install -d $(LIBDIR)
install -d $(INCDIR)
install -d $(MANDIR)
install -d $(MAN1DIR)
install -d $(MAN3DIR)
install -d $(DOCDIR)
install -d $(EGSDIR)
install -c run6502 $(BINDIR)/run6502
install -c lib6502.a $(LIBDIR)/lib6502.a
install -c lib6502.h $(INCDIR)/lib6502.h
install -c man/run6502.1 $(MAN1DIR)/run6502.1
install -c man/lib6502.3 $(MAN3DIR)/lib6502.3
install -c man/M6502_delete.3 $(MAN3DIR)/M6502_delete.3
install -c man/M6502_disassemble.3 $(MAN3DIR)/M6502_disassemble.3
install -c man/M6502_dump.3 $(MAN3DIR)/M6502_dump.3
install -c man/M6502_getCallback.3 $(MAN3DIR)/M6502_getCallback.3
install -c man/M6502_getVector.3 $(MAN3DIR)/M6502_getVector.3
install -c man/M6502_irq.3 $(MAN3DIR)/M6502_irq.3
install -c man/M6502_new.3 $(MAN3DIR)/M6502_new.3
install -c man/M6502_nmi.3 $(MAN3DIR)/M6502_nmi.3
install -c man/M6502_reset.3 $(MAN3DIR)/M6502_reset.3
install -c man/M6502_run.3 $(MAN3DIR)/M6502_run.3
install -c man/M6502_setCallback.3 $(MAN3DIR)/M6502_setCallback.3
install -c man/M6502_setVector.3 $(MAN3DIR)/M6502_setVector.3
install -c ChangeLog $(DOCDIR)/ChangeLog
install -c COPYING $(DOCDIR)/COPYING
install -c README $(DOCDIR)/README
install -c examples/README $(EGSDIR)/README
install -c examples/lib1.c $(EGSDIR)/lib1.c
install -c examples/hex2bin $(EGSDIR)/hex2bin
uninstall : .FORCE
rm -f $(BINDIR)/run6502 $(LIBDIR)/lib6502.a $(INCDIR)/lib6502.h $(MAN1DIR)/run6502.1 $(MAN3DIR)/lib6502.3 $(MAN3DIR)/M6502_delete.3 $(MAN3DIR)/M6502_disassemble.3 $(MAN3DIR)/M6502_dump.3 $(MAN3DIR)/M6502_getCallback.3 $(MAN3DIR)/M6502_getVector.3 $(MAN3DIR)/M6502_irq.3 $(MAN3DIR)/M6502_new.3 $(MAN3DIR)/M6502_nmi.3 $(MAN3DIR)/M6502_reset.3 $(MAN3DIR)/M6502_run.3 $(MAN3DIR)/M6502_setCallback.3 $(MAN3DIR)/M6502_setVector.3 $(DOCDIR)/ChangeLog $(DOCDIR)/COPYING $(DOCDIR)/README $(EGSDIR)/README $(EGSDIR)/lib1.c $(EGSDIR)/hex2bin
rmdir $(EGSDIR) $(DOCDIR)

26
src/lib6502/COPYING Normal file
View File

@ -0,0 +1,26 @@
Distasteful though it is for me to have to induce from afar any perturbation
into your pursuit of happiness, this MIT (X11 flavour) license is at least
relatively benign. Investigation into copyright stupidity reveals that it is
effectively impossible to dedicate (formally) any software to the public
domain (the only sure path to this most enlightened status being to leave the
software to expire naturally from its 25-, 50-, 75- or whatever-year copyright
rot). I fear this is not going to change before the revolution comes. In the
meantime the only way I can *guarantee* you any rights at all to this software
would (unfortunately) appear to be...
Copyright (c) 2005 Ian Piumarta
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to
do so, provided that the above copyright notice(s) and this permission
notice appear in all copies or substantial portions of the Software.
Inclusion of the above copyright notice(s) and this permission notice in
supporting documentation would be appreciated, but is not required.
THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.

7
src/lib6502/ChangeLog Normal file
View File

@ -0,0 +1,7 @@
2005-11-01 Ian Piumarta <com -dot- gmail -at- piumarta (backwards)>
* RELEASE 1.0
2005-10-30 Ian Piumarta <com -dot- gmail -at- piumarta (backwards)>
* ChangeLog: created.

232
src/lib6502/Makefile Normal file
View File

@ -0,0 +1,232 @@
# Makefile for lib6502, run6502
# Copyright (c) 2005 Ian Piumarta
#
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the 'Software'), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, provided
# that the above copyright notice(s) and this permission notice appear
# in all copies of the Software and that both the above copyright
# notice(s) and this permission notice appear in supporting
# documentation.
#
# THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
# last edited: 2013-06-08 01:08:02 by piumarta on vps2.piumarta.com
CFLAGS = -g -O3
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
LIBDIR = $(PREFIX)/lib
INCDIR = $(PREFIX)/include
DOCDIR = $(PREFIX)/doc/lib6502
EGSDIR = $(DOCDIR)/examples
MANDIR = $(PREFIX)/man
MAN1DIR = $(MANDIR)/man1
MAN3DIR = $(MANDIR)/man3
all : run6502
run6502 : run6502.o lib6502.a
lib6502.a : lib6502.o
$(AR) -rc $@.new lib6502.o
mv $@.new $@
-ranlib $@
clean : .FORCE
rm -f run6502 lib1 *~ *.o *.a .gdb* *.img *.log
.FORCE :
# ----------------------------------------------------------------
INSTALLDIRS = $(BINDIR) $(LIBDIR) $(INCDIR) $(MANDIR) $(MAN1DIR) $(MAN3DIR) $(DOCDIR) $(EGSDIR)
BINFILES = $(BINDIR)/run6502
LIBFILES = $(LIBDIR)/lib6502.a
INCFILES = $(INCDIR)/lib6502.h
MANFILES = $(MAN1DIR)/run6502.1 \
$(MAN3DIR)/lib6502.3 \
$(MAN3DIR)/M6502_delete.3 \
$(MAN3DIR)/M6502_disassemble.3 \
$(MAN3DIR)/M6502_dump.3 \
$(MAN3DIR)/M6502_getCallback.3 \
$(MAN3DIR)/M6502_getVector.3 \
$(MAN3DIR)/M6502_irq.3 \
$(MAN3DIR)/M6502_new.3 \
$(MAN3DIR)/M6502_nmi.3 \
$(MAN3DIR)/M6502_reset.3 \
$(MAN3DIR)/M6502_run.3 \
$(MAN3DIR)/M6502_setCallback.3 \
$(MAN3DIR)/M6502_setVector.3
DOCFILES = $(DOCDIR)/ChangeLog \
$(DOCDIR)/COPYING \
$(DOCDIR)/README \
$(EGSDIR)/README \
$(EGSDIR)/lib1.c \
$(EGSDIR)/hex2bin
MKDIR = install -d
RMDIR = rmdir
INSTALL = install -c
RM = rm -f
$(BINDIR)/% $(LIBDIR)/% $(INCDIR)/% $(DOCDIR)/% : %
$(INSTALL) $< $@
$(MAN1DIR)/% $(MAN3DIR)/% : man/%
$(INSTALL) $< $@
$(EGSDIR)/% : examples/%
$(INSTALL) $< $@
$(INSTALLDIRS) :
$(MKDIR) $@
install : $(INSTALLDIRS) $(BINFILES) $(LIBFILES) $(INCFILES) $(MANFILES) $(DOCFILES)
uninstall : .FORCE
-$(RM) $(BINFILES) $(LIBFILES) $(INCFILES) $(MANFILES) $(DOCFILES)
-$(RMDIR) $(EGSDIR) $(DOCDIR)
# ----------------------------------------------------------------
PACKAGE_VERSION = 1.3
PACKAGE_TARNAME = lib6502
TARNAME= $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
DISTFILES = \
$(TARNAME)/ChangeLog \
$(TARNAME)/COPYING \
$(TARNAME)/README \
$(TARNAME)/Makefile \
$(TARNAME)/BSDmakefile \
$(TARNAME)/config.h \
$(TARNAME)/lib6502.h \
$(TARNAME)/lib6502.c \
$(TARNAME)/run6502.c \
$(TARNAME)/test.out \
$(TARNAME)/man/run6502.1 \
$(TARNAME)/man/lib6502.3 \
$(TARNAME)/man/M6502_delete.3 \
$(TARNAME)/man/M6502_disassemble.3 \
$(TARNAME)/man/M6502_dump.3 \
$(TARNAME)/man/M6502_getCallback.3 \
$(TARNAME)/man/M6502_getVector.3 \
$(TARNAME)/man/M6502_irq.3 \
$(TARNAME)/man/M6502_new.3 \
$(TARNAME)/man/M6502_nmi.3 \
$(TARNAME)/man/M6502_reset.3 \
$(TARNAME)/man/M6502_run.3 \
$(TARNAME)/man/M6502_setCallback.3 \
$(TARNAME)/man/M6502_setVector.3 \
$(TARNAME)/examples/hex2bin \
$(TARNAME)/examples/lib1.c \
$(TARNAME)/examples/README
dist : .FORCE
rm -f $(TARNAME)
ln -s . $(TARNAME)
tar -cf $(TARNAME).tar $(DISTFILES)
gzip -v9 $(TARNAME).tar
rm -f $(TARNAME)
dist-test : .FORCE
rm -rf $(TARNAME)
tar -xz -f $(TARNAME).tar.gz
ln -s ../images $(TARNAME)/images
$(MAKE) -C $(TARNAME) test
rm -rf $(TARNAME)
# ----------------------------------------------------------------
image :
./run6502 \
-l C000 images/os1.2 \
-l 8000 images/basic2 \
-s 0000 +10000 image \
-x
newimage : .FORCE
rm -f image
$(MAKE) image
test1 : run6502 .FORCE
echo a2418a20eeffe8e05bd0f7a90a20eeff0000 | perl -e '$$_=pack"H*",<STDIN>;print' > temp.img
./run6502 \
-l 1000 temp.img \
-d 1000 +11 \
-R 1000 \
-P FFEE \
-X 0
lib1 : lib6502.a
$(CC) -I. -o lib1 examples/lib1.c lib6502.a
test2 : lib1 .FORCE
./lib1
test3 : run6502 image .FORCE
echo 'PRINT:FORA%=1TO10:PRINTA%:NEXT:PRINT"HELLO WORLD"' | ./run6502 image
test4 : run6502 image .FORCE
echo 'P%=&2800:O%=P%:[opt3:ldx#65:.l txa:jsr&FFEE:inx:cpx#91:bnel:lda#13:jsr&FFEE:lda#10:jmp&FFEE:]:CALL&2800' | ./run6502 image
test : run6502 lib1 image .FORCE
@$(MAKE) test1 test2 test3 test4 | grep -v '^make.* directory' | tee test.log
cmp test.log test.out
@echo
@echo SUCCESS
@echo
# ----------------------------------------------------------------
# I don't know what it is (probably me, who knows?) but every single
# time I try to write a Makefile that is compatible with both GNU and
# BSD make I spend three hours getting absolutely nowhere. It's
# telling when a program consisting of precisely TWO SOURCE FILES and
# a few man pages and examples is already TOO COMPLEX to be installed
# with BSD make, in the absence of an explicit rule for every single
# target, be it installed or intermediate, from a Makefile that won't
# also break GNU make. Good Grief Charlie Brown.
# Yes I know I can compose the sed substitutions into a single script,
# but it looks even uglier that way.
BSDmakefile : .FORCE
$(MAKE)
rm -rf /tmp/bsd
echo '# THIS FILE WAS GENERATED AUTOMATICALLY' > BSDmakefile
echo '# EDIT AT YOUR OWN RISK' >> BSDmakefile
echo '# ' >> BSDmakefile
sed '/# -/,$$d' < Makefile >> BSDmakefile
echo 'install : .FORCE' > BSDtemp
$(MAKE) install PREFIX=/tmp/bsd >> BSDtemp
echo >> BSDtemp
echo 'uninstall : .FORCE' >> BSDtemp
$(MAKE) uninstall PREFIX=/tmp/bsd >> BSDtemp
cat BSDtemp | \
sed 's,/tmp/bsd/doc/lib6502/examples,$$(EGSDIR),g' | \
sed 's,/tmp/bsd/doc/lib6502,$$(DOCDIR),g' | \
sed 's,/tmp/bsd/man/man1,$$(MAN1DIR),g' | \
sed 's,/tmp/bsd/man/man3,$$(MAN3DIR),g' | \
sed 's,/tmp/bsd/man,$$(MANDIR),g' | \
sed 's,/tmp/bsd/include,$$(INCDIR),g' | \
sed 's,/tmp/bsd/lib,$$(LIBDIR),g' | \
sed 's,/tmp/bsd/lib,$$(LIBDIR),g' | \
sed 's,/tmp/bsd/bin,$$(BINDIR),g' | \
sed 's,^, ,g' >> BSDmakefile
rm -f BSDtemp
rm -rf /tmp/bsd

131
src/lib6502/README Executable file
View File

@ -0,0 +1,131 @@
lib6502 - 6502 Microprocessor Emulator
Version: 1.0
WHAT IF I'M TOO LAZY TO READ 'README'S?
make
make install
more examples/README
WHAT IS LIB6502?
lib6502 is a library that emulates the 6502 microprocessor. It
comes with a small 'shell', run6502, that can execute 6502 programs
from the command line.
lib6502 is distributed under the MIT license: it is non-infectious
and will not make your projects contagious to others the instant you
choose to use lib6502 in them. See the file COPYING for details.
WHERE IS THE LATEST SOURCE CODE?
Source code for lib6502 is available from the author's home page at
'http://piumarta.com/software'. You can download the most recent
release or use Subversion to get the very latest sources.
WHERE IS THE DOCUMENTATION?
Manual pages for run6502 and lib6502 (and all the functions it
exports) should be available once it is installed. Each includes a
short 'examples' section. Use the 'man' command to read them.
Your best place to start looking for documentation on the 6502
itself is 'http://6502.org'. A google search of the web will also
turn up vast quantities of information about (and programs for) the
6502.
HOW DO I INSTALL IT?
It's not really big enough to warrant the whole 'configure' thing.
Any system with an ANSI compiler and C library should be able to
compile it out of the box. After unpacking the archive, just type:
make
to build it. If the compiler blows up immediately, edit the
Makefile and play with the '-g' and '-O' flags and then try again.
If you really can't make the compiler happy you've found a bug (read
the next section but one). Otherwise, if you want it put it
somewhere more permanent then type:
make install
(as root) to install it. It goes into /usr/local by default; if you
want it elsewhere then set PREFIX in the make command. For example:
make install PREFIX=/usr
will put everything under '/usr'.
When you get bored with it, go back to the source directory and
type:
make uninstall
(with the same PREFIX you specified during the install, if
necessary.)
WHAT CAN I DO WITH IT?
See the file EXAMPLES for some suggestions (all of them polite).
If that leaves you wanting more, read the source for run6502 -- it
exercises just about every feature in lib6502.
HOW DO I REPORT PROBLEMS?
Send e-mail to the author at: firstName (at) lastName (dot) com
(For suitable values of firstName and lastName, see the last section
of this file.)
If you're still confused, contact him at: http://piumarta.com
HOW CAN I HELP?
Use it. Find bugs. Fix bugs. Make it faster. Evangelism: spread
it to as many other projects as possible, especially those that
might be using a slower emulator! Read the manual pages to see
what's considered missing, then add it, then send it in.
(One thing that would be be really handy, and isn't mentioned in the
manual pages, is a test suite. Figure out how to test every mode in
every instruction with every possible combination of operand values
and condition codes and verify the behaviour is correct. Then write
it down in the form of a program and send it in. If it's a
self-contained program that runs once to completion then we can
probably find some real hardware to test against the test suite.)
If you know how to write software that emulates peripheral hardware
devices, google up some details on the popular 6502-based
microcomputers (Acorn, Commodore, etc.) and add some serious system
emulation to run6502. Make it all pluggable (think dynamic
libraries over an 'agnostic' core), so we can change machines at the
flip of a (command-line) switch. (The callback mechanism in lib6502
was designed with this kind of 'pluggable hardware emulation' in
mind.)
WHO WROTE THIS STUFF, AND WHY?
lib6502 was written by Ian Piumarta.
While writing ccg (an entirely different project that creates
runtime assemblers for dynamic code generators) he decided to
include support for an 8-bit microprocessor, just for fun. He chose
the 6502 because it was used in the first computer he owned and
programmed (an Ohio Scientific Superboard II, when he was 14) as
well as the second (an Acorn 'BBC Model B', about four years later).
lib6502 started as a 'glorified switch statement' that ran some
small test programs spewed into memory by ccg, but rapidly got out
of control over the course of a weekend. You're looking at the
result.

267
src/lib6502/a1cffa.c Normal file
View File

@ -0,0 +1,267 @@
/* run6502.c -- 6502 emulator shell -*- C -*- */
/* Copyright (c) 2005 Ian Piumarta
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the 'Software'),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, provided that the above copyright notice(s) and this
* permission notice appear in all copies of the Software and that both the
* above copyright notice(s) and this permission notice appear in supporting
* documentation.
*
* THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
*/
/* Last edited: 2005-11-02 01:18:58 by piumarta on margaux.local
*/
/* Apple 1 + CFFA1 support for PLASMA by resman
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <termios.h>
#include "config.h"
#include "lib6502.h"
#define VERSION PACKAGE_NAME " " PACKAGE_VERSION " " PACKAGE_COPYRIGHT
typedef uint8_t byte;
typedef uint16_t word;
struct termios org_tio;
void pfail(const char *msg)
{
fflush(stdout);
perror(msg);
exit(1);
}
#define rts \
{ \
word pc; \
pc = mpu->memory[++mpu->registers->s + 0x100]; \
pc |= mpu->memory[++mpu->registers->s + 0x100] << 8; \
return pc + 1; \
}
int save(M6502 *mpu, word address, unsigned length, const char *path)
{
FILE *file;
int count;
if (!(file = fopen(path, "wb")))
return 0;
while ((count = fwrite(mpu->memory + address, 1, length, file)))
{
address += count;
length -= count;
}
fclose(file);
return 1;
}
int load(M6502 *mpu, word address, const char *path)
{
FILE *file;
int count;
size_t max = 0x10000 - address;
if (!(file = fopen(path, "rb")))
return 0;
while ((count = fread(mpu->memory + address, 1, max, file)) > 0)
{
address += count;
max -= count;
}
fclose(file);
return 1;
}
//
// CFFA1 zero page addresses.
//
#define CFFADest 0x00
#define CFFAFileName 0x02
#define CFFAOldName 0x04
#define CFFAFileType 0x06
#define CFFAAuxType 0x07
#define CFFAFileSize 0x09
#define CFFAEntryPtr 0x0B
int cffa1(M6502 *mpu, word address, byte data)
{
char *fileptr, filename[64];
int addr;
struct stat sbuf;
switch (mpu->registers->x)
{
case 0x02: /* quit */
exit(0);
break;
case 0x14: /* find dir entry */
addr = mpu->memory[CFFAFileName] | (mpu->memory[CFFAFileName + 1] << 8);
memset(filename, 0, 64);
strncpy(filename, (char *)(mpu->memory + addr + 1), mpu->memory[addr]);
strcat(filename, "#FE1000");
if (!(stat(filename, &sbuf)))
{
/* DirEntry @ $9100 */
mpu->memory[CFFAEntryPtr] = 0x00;
mpu->memory[CFFAEntryPtr + 1] = 0x91;
mpu->memory[0x9115] = sbuf.st_size;
mpu->memory[0x9116] = sbuf.st_size >> 8;
mpu->registers->a = 0;
}
else
mpu->registers->a = -1;
break;
case 0x22: /* load file */
addr = mpu->memory[CFFAFileName] | (mpu->memory[CFFAFileName + 1] << 8);
memset(filename, 0, 64);
strncpy(filename, (char *)(mpu->memory + addr + 1), mpu->memory[addr]);
strcat(filename, "#FE1000");
addr = mpu->memory[CFFADest] | (mpu->memory[CFFADest + 1] << 8);
mpu->registers->a = load(mpu, addr, filename) - 1;
break;
default:
{
char state[64];
fprintf(stderr, "Unimplemented CFFA function: %02X\n", mpu->registers->x);
M6502_dump(mpu, state);
fflush(stdout);
fprintf(stderr, "\nCFFA1 %s\n", state);
pfail("ABORT");
}
break;
}
rts;
}
int bye(M6502 *mpu, word addr, byte data) { exit(0); return 0; }
int cout(M6502 *mpu, word addr, byte data) { if (mpu->registers->a == 0x8D) putchar('\n'); putchar(mpu->registers->a & 0x7F); fflush(stdout); rts; }
int paused = 0;
unsigned char keypending = 0;
unsigned char keypressed(M6502 *mpu)
{
unsigned char cin, cext[2];
if (read(STDIN_FILENO, &cin, 1) > 0)
{
if (cin == 0x03) // CTRL-C
{
mpu->flags |= M6502_SingleStep;
paused = 1;
}
if (cin == 0x1B) // Look for left arrow
{
if (read(STDIN_FILENO, cext, 2) == 2 && cext[0] == '[' && cext[1] == 'D')
cin = 0x08;
}
keypending = cin | 0x80;
}
return keypending & 0x80;
}
unsigned char keyin(M6502 *mpu)
{
unsigned char cin;
if (!keypending)
keypressed(mpu);
cin = keypending;
keypending = 0;
return cin;
}
int rd6820kbdctl(M6502 *mpu, word addr, byte data) { return keypressed(mpu); }
int rd6820vidctl(M6502 *mpu, word addr, byte data) { return 0x00; }
int rd6820kbd(M6502 *mpu, word addr, byte data) { return keyin(mpu); }
int rd6820vid(M6502 *mpu, word addr, byte data) { return 0x80; }
int wr6820vid(M6502 *mpu, word addr, byte data) { if (data == 0x8D) putchar('\n'); putchar(data & 0x7F); fflush(stdout); return 0; }
int setTraps(M6502 *mpu)
{
/* Apple 1 memory-mapped IO */
M6502_setCallback(mpu, read, 0xD010, rd6820kbd);
M6502_setCallback(mpu, read, 0xD011, rd6820kbdctl);
M6502_setCallback(mpu, read, 0xD012, rd6820vid);
M6502_setCallback(mpu, write, 0xD012, wr6820vid);
M6502_setCallback(mpu, read, 0xD013, rd6820vidctl);
/* CFFA1 and ROM calls */
M6502_setCallback(mpu, call, 0x9000, bye);
M6502_setCallback(mpu, call, 0x900C, cffa1);
M6502_setCallback(mpu, call, 0xFFEF, cout);
return 0;
}
void resetInput(void)
{
tcsetattr(STDIN_FILENO, TCSANOW, &org_tio);
}
void setRawInput(void)
{
struct termios termio;
// Save input settings.
tcgetattr(STDIN_FILENO, &termio); /* save current port settings */
memcpy(&org_tio, &termio, sizeof(struct termios));
termio.c_cflag = /*BAUDRATE | CRTSCTS |*/ CS8 | CLOCAL | CREAD;
termio.c_iflag = IGNPAR;
termio.c_oflag = 0;
termio.c_lflag = 0; /* set input mode (non-canonical, no echo,...) */
termio.c_cc[VTIME] = 0; /* inter-character timer unused */
termio.c_cc[VMIN] = 0; /* non-blocking read */
tcsetattr(STDIN_FILENO, TCSANOW, &termio);
atexit(resetInput);
}
int main(int argc, char **argv)
{
char *interpfile = "A1PLASMA#060280";
char *program= argv[0];
M6502 *mpu = M6502_new(0, 0, 0);
while (++argv, --argc > 0)
{
if (!strcmp(*argv, "-t")) mpu->flags |= M6502_SingleStep;
else
if (argv[0][0] != '-') interpfile = *argv;
else fprintf(stderr, "Usage: %s [-t] [interpreter file]", program);
}
if (!load(mpu, 0x280, interpfile))
pfail(interpfile);
setRawInput();
setTraps(mpu);
M6502_reset(mpu);
mpu->registers->pc = 0x0280;
while (M6502_run(mpu))
{
char state[64];
char insn[64];
M6502_dump(mpu, state);
M6502_disassemble(mpu, mpu->registers->pc, insn);
printf("%s : %s\r\n", state, insn);
if (paused || (keypressed(mpu) && keypending == 0x83))
{
keypending = 0;
while (!keypressed(mpu));
if (keypending == (0x80|'C'))
paused = 0;
else if (keypending == (0x80|'Q'))
break;
keypending = 0;
}
}
M6502_delete(mpu);
return 0;
}

9
src/lib6502/config.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef __config_h
#define __config_h
#define PACKAGE_NAME "lib6502"
#define PACKAGE_VERSION "1.0"
#define PACKAGE_BUGREPORT "firstName (at) lastName (dot) com"
#define PACKAGE_COPYRIGHT "Copyright (c) 2005 Ian Piumarta"
#endif /* __config_h */

896
src/lib6502/lib6502.c Normal file
View File

@ -0,0 +1,896 @@
/* lib6502.c -- MOS Technology 6502 emulator -*- C -*- */
/* Copyright (c) 2005 Ian Piumarta
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the 'Software'),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, provided that the above copyright notice(s) and this
* permission notice appear in all copies of the Software and that both the
* above copyright notice(s) and this permission notice appear in supporting
* documentation.
*
* THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
*/
/* Last edited: 2013-06-07 23:03:39 by piumarta on emilia.local
*
* BUGS:
* - RTS and RTI do not check the return address for a callback
* - the disassembler cannot be configured to read two bytes for BRK
* - architectural variations (unimplemented/extended instructions) not implemented
* - ANSI versions (from from gcc extensions) of the dispatch macros are missing
* - emulator+disassembler in same object file (library is kind of pointless)
*/
#include <stdio.h>
#include <stdlib.h>
#include "lib6502.h"
typedef uint8_t byte;
typedef uint16_t word;
enum {
flagN= (1<<7), /* negative */
flagV= (1<<6), /* overflow */
flagX= (1<<5), /* unused */
flagB= (1<<4), /* irq from brk */
flagD= (1<<3), /* decimal mode */
flagI= (1<<2), /* irq disable */
flagZ= (1<<1), /* zero */
flagC= (1<<0) /* carry */
};
#define getN() (P & flagN)
#define getV() (P & flagV)
#define getB() (P & flagB)
#define getD() (P & flagD)
#define getI() (P & flagI)
#define getZ() (P & flagZ)
#define getC() (P & flagC)
#define setNVZC(N,V,Z,C) (P= (P & ~(flagN | flagV | flagZ | flagC)) | (N) | ((V)<<6) | ((Z)<<1) | (C))
#define setNZC(N,Z,C) (P= (P & ~(flagN | flagZ | flagC)) | (N) | ((Z)<<1) | (C))
#define setNZ(N,Z) (P= (P & ~(flagN | flagZ )) | (N) | ((Z)<<1) )
#define setZ(Z) (P= (P & ~( flagZ )) | ((Z)<<1) )
#define setC(C) (P= (P & ~( flagC)) | (C))
#define NAND(P, Q) (!((P) & (Q)))
#define tick(n)
#define tickIf(p)
/* memory access (indirect if callback installed) -- ARGUMENTS ARE EVALUATED MORE THAN ONCE! */
#define putMemory(ADDR, BYTE) \
( writeCallback[ADDR] \
? writeCallback[ADDR](mpu, ADDR, BYTE) \
: (memory[ADDR]= BYTE) )
#define getMemory(ADDR) \
( readCallback[ADDR] \
? readCallback[ADDR](mpu, ADDR, 0) \
: memory[ADDR] )
/* stack access (always direct) */
#define push(BYTE) (memory[0x0100 + S--]= (BYTE))
#define pop() (memory[++S + 0x0100])
/* adressing modes (memory access direct) */
#define implied(ticks) \
tick(ticks);
#define immediate(ticks) \
tick(ticks); \
ea= PC++;
#define abs(ticks) \
tick(ticks); \
ea= memory[PC] + (memory[PC + 1] << 8); \
PC += 2;
#define relative(ticks) \
tick(ticks); \
ea= memory[PC++]; \
if (ea & 0x80) ea -= 0x100; \
tickIf((ea >> 8) != (PC >> 8));
#define indirect(ticks) \
tick(ticks); \
{ \
word tmp; \
tmp= memory[PC] + (memory[PC + 1] << 8); \
ea = memory[tmp] + (memory[tmp + 1] << 8); \
PC += 2; \
}
#define absx(ticks) \
tick(ticks); \
ea= memory[PC] + (memory[PC + 1] << 8); \
PC += 2; \
tickIf((ticks == 4) && ((ea >> 8) != ((ea + X) >> 8))); \
ea += X;
#define absy(ticks) \
tick(ticks); \
ea= memory[PC] + (memory[PC + 1] << 8); \
PC += 2; \
tickIf((ticks == 4) && ((ea >> 8) != ((ea + Y) >> 8))); \
ea += Y
#define zp(ticks) \
tick(ticks); \
ea= memory[PC++];
#define zpx(ticks) \
tick(ticks); \
ea= memory[PC++] + X; \
ea &= 0x00ff;
#define zpy(ticks) \
tick(ticks); \
ea= memory[PC++] + Y; \
ea &= 0x00ff;
#define indx(ticks) \
tick(ticks); \
{ \
byte tmp= memory[PC++] + X; \
ea= memory[tmp] + (memory[tmp + 1] << 8); \
}
#define indy(ticks) \
tick(ticks); \
{ \
byte tmp= memory[PC++]; \
ea= memory[tmp] + (memory[tmp + 1] << 8); \
tickIf((ticks == 5) && ((ea >> 8) != ((ea + Y) >> 8))); \
ea += Y; \
}
#define indabsx(ticks) \
tick(ticks); \
{ \
word tmp; \
tmp= memory[PC ] + (memory[PC + 1] << 8) + X; \
ea = memory[tmp] + (memory[tmp + 1] << 8); \
}
#define indzp(ticks) \
tick(ticks); \
{ \
byte tmp; \
tmp= memory[PC++]; \
ea = memory[tmp] + (memory[tmp + 1] << 8); \
}
/* insns */
#define adc(ticks, adrmode) \
adrmode(ticks); \
{ \
byte B= getMemory(ea); \
if (!getD()) \
{ \
int c= A + B + getC(); \
int v= (int8_t)A + (int8_t)B + getC(); \
fetch(); \
A= c; \
setNVZC((A & 0x80), (((A & 0x80) > 0) ^ (v < 0)), (A == 0), ((c & 0x100) > 0)); \
next(); \
} \
else \
{ \
int l, h, s; \
/* inelegant & slow, but consistent with the hw for illegal digits */ \
l= (A & 0x0F) + (B & 0x0F) + getC(); \
h= (A & 0xF0) + (B & 0xF0); \
if (l >= 0x0A) { l -= 0x0A; h += 0x10; } \
if (h >= 0xA0) { h -= 0xA0; } \
fetch(); \
s= h | (l & 0x0F); \
/* only C is valid on NMOS 6502 */ \
setNVZC(s & 0x80, !(((A ^ B) & 0x80) && ((A ^ s) & 0x80)), !s, !!(h & 0x80)); \
A= s; \
tick(1); \
next(); \
} \
}
#define sbc(ticks, adrmode) \
adrmode(ticks); \
{ \
byte B= getMemory(ea); \
if (!getD()) \
{ \
int b= 1 - (P &0x01); \
int c= A - B - b; \
int v= (int8_t)A - (int8_t) B - b; \
fetch(); \
A= c; \
setNVZC(A & 0x80, ((A & 0x80) > 0) ^ ((v & 0x100) != 0), A == 0, c >= 0); \
next(); \
} \
else \
{ \
/* this is verbatim ADC, with a 10's complemented operand */ \
int l, h, s; \
B= 0x99 - B; \
l= (A & 0x0F) + (B & 0x0F) + getC(); \
h= (A & 0xF0) + (B & 0xF0); \
if (l >= 0x0A) { l -= 0x0A; h += 0x10; } \
if (h >= 0xA0) { h -= 0xA0; } \
fetch(); \
s= h | (l & 0x0F); \
/* only C is valid on NMOS 6502 */ \
setNVZC(s & 0x80, !(((A ^ B) & 0x80) && ((A ^ s) & 0x80)), !s, !!(h & 0x80)); \
A= s; \
tick(1); \
next(); \
} \
}
#define cmpR(ticks, adrmode, R) \
adrmode(ticks); \
fetch(); \
{ \
byte B= getMemory(ea); \
byte d= R - B; \
setNZC(d & 0x80, !d, R >= B); \
} \
next();
#define cmp(ticks, adrmode) cmpR(ticks, adrmode, A)
#define cpx(ticks, adrmode) cmpR(ticks, adrmode, X)
#define cpy(ticks, adrmode) cmpR(ticks, adrmode, Y)
#define dec(ticks, adrmode) \
adrmode(ticks); \
fetch(); \
{ \
byte B= getMemory(ea); \
--B; \
putMemory(ea, B); \
setNZ(B & 0x80, !B); \
} \
next();
#define decR(ticks, adrmode, R) \
fetch(); \
tick(ticks); \
--R; \
setNZ(R & 0x80, !R); \
next();
#define dea(ticks, adrmode) decR(ticks, adrmode, A)
#define dex(ticks, adrmode) decR(ticks, adrmode, X)
#define dey(ticks, adrmode) decR(ticks, adrmode, Y)
#define inc(ticks, adrmode) \
adrmode(ticks); \
fetch(); \
{ \
byte B= getMemory(ea); \
++B; \
putMemory(ea, B); \
setNZ(B & 0x80, !B); \
} \
next();
#define incR(ticks, adrmode, R) \
fetch(); \
tick(ticks); \
++R; \
setNZ(R & 0x80, !R); \
next();
#define ina(ticks, adrmode) incR(ticks, adrmode, A)
#define inx(ticks, adrmode) incR(ticks, adrmode, X)
#define iny(ticks, adrmode) incR(ticks, adrmode, Y)
#define bit(ticks, adrmode) \
adrmode(ticks); \
fetch(); \
{ \
byte B= getMemory(ea); \
P= (P & ~(flagN | flagV | flagZ)) \
| (B & (0xC0)) | (((A & B) == 0) << 1); \
} \
next();
#define tsb(ticks, adrmode) \
adrmode(ticks); \
fetch(); \
{ \
byte b= getMemory(ea); \
b |= A; \
putMemory(ea, b); \
setZ(!b); \
} \
next();
#define trb(ticks, adrmode) \
adrmode(ticks); \
fetch(); \
{ \
byte b= getMemory(ea); \
b |= (A ^ 0xFF); \
putMemory(ea, b); \
setZ(!b); \
} \
next();
#define bitwise(ticks, adrmode, op) \
adrmode(ticks); \
fetch(); \
A op##= getMemory(ea); \
setNZ(A & 0x80, !A); \
next();
#define and(ticks, adrmode) bitwise(ticks, adrmode, &)
#define eor(ticks, adrmode) bitwise(ticks, adrmode, ^)
#define ora(ticks, adrmode) bitwise(ticks, adrmode, |)
#define asl(ticks, adrmode) \
adrmode(ticks); \
{ \
unsigned int i= getMemory(ea) << 1; \
putMemory(ea, i); \
fetch(); \
setNZC(i & 0x80, !i, i >> 8); \
} \
next();
#define asla(ticks, adrmode) \
tick(ticks); \
fetch(); \
{ \
int c= A >> 7; \
A <<= 1; \
setNZC(A & 0x80, !A, c); \
} \
next();
#define lsr(ticks, adrmode) \
adrmode(ticks); \
{ \
byte b= getMemory(ea); \
int c= b & 1; \
fetch(); \
b >>= 1; \
putMemory(ea, b); \
setNZC(0, !b, c); \
} \
next();
#define lsra(ticks, adrmode) \
tick(ticks); \
fetch(); \
{ \
int c= A & 1; \
A >>= 1; \
setNZC(0, !A, c); \
} \
next();
#define rol(ticks, adrmode) \
adrmode(ticks); \
{ \
word b= (getMemory(ea) << 1) | getC(); \
fetch(); \
putMemory(ea, b); \
setNZC(b & 0x80, !(b & 0xFF), b >> 8); \
} \
next();
#define rola(ticks, adrmode) \
tick(ticks); \
fetch(); \
{ \
word b= (A << 1) | getC(); \
A= b; \
setNZC(A & 0x80, !A, b >> 8); \
} \
next();
#define ror(ticks, adrmode) \
adrmode(ticks); \
{ \
int c= getC(); \
byte m= getMemory(ea); \
byte b= (c << 7) | (m >> 1); \
fetch(); \
putMemory(ea, b); \
setNZC(b & 0x80, !b, m & 1); \
} \
next();
#define rora(ticks, adrmode) \
adrmode(ticks); \
{ \
int ci= getC(); \
int co= A & 1; \
fetch(); \
A= (ci << 7) | (A >> 1); \
setNZC(A & 0x80, !A, co); \
} \
next();
#define tRS(ticks, adrmode, R, S) \
fetch(); \
tick(ticks); \
S= R; \
setNZ(S & 0x80, !S); \
next();
#define tax(ticks, adrmode) tRS(ticks, adrmode, A, X)
#define txa(ticks, adrmode) tRS(ticks, adrmode, X, A)
#define tay(ticks, adrmode) tRS(ticks, adrmode, A, Y)
#define tya(ticks, adrmode) tRS(ticks, adrmode, Y, A)
#define tsx(ticks, adrmode) tRS(ticks, adrmode, S, X)
#define txs(ticks, adrmode) \
fetch(); \
tick(ticks); \
S= X; \
next();
#define ldR(ticks, adrmode, R) \
adrmode(ticks); \
fetch(); \
R= getMemory(ea); \
setNZ(R & 0x80, !R); \
next();
#define lda(ticks, adrmode) ldR(ticks, adrmode, A)
#define ldx(ticks, adrmode) ldR(ticks, adrmode, X)
#define ldy(ticks, adrmode) ldR(ticks, adrmode, Y)
#define stR(ticks, adrmode, R) \
adrmode(ticks); \
fetch(); \
putMemory(ea, R); \
next();
#define sta(ticks, adrmode) stR(ticks, adrmode, A)
#define stx(ticks, adrmode) stR(ticks, adrmode, X)
#define sty(ticks, adrmode) stR(ticks, adrmode, Y)
#define stz(ticks, adrmode) stR(ticks, adrmode, 0)
#define branch(ticks, adrmode, cond) \
if (cond) \
{ \
adrmode(ticks); \
PC += ea; \
tick(1); \
} \
else \
{ \
tick(ticks); \
PC++; \
} \
fetch(); \
next();
#define bcc(ticks, adrmode) branch(ticks, adrmode, !getC())
#define bcs(ticks, adrmode) branch(ticks, adrmode, getC())
#define bne(ticks, adrmode) branch(ticks, adrmode, !getZ())
#define beq(ticks, adrmode) branch(ticks, adrmode, getZ())
#define bpl(ticks, adrmode) branch(ticks, adrmode, !getN())
#define bmi(ticks, adrmode) branch(ticks, adrmode, getN())
#define bvc(ticks, adrmode) branch(ticks, adrmode, !getV())
#define bvs(ticks, adrmode) branch(ticks, adrmode, getV())
#define bra(ticks, adrmode) \
adrmode(ticks); \
PC += ea; \
fetch(); \
tick(1); \
next();
#define jmp(ticks, adrmode) \
adrmode(ticks); \
PC= ea; \
if (mpu->callbacks->call[ea]) \
{ \
word addr; \
externalise(); \
if ((addr= mpu->callbacks->call[ea](mpu, ea, 0))) \
{ \
internalise(); \
PC= addr; \
} \
} \
fetch(); \
next();
#define jsr(ticks, adrmode) \
PC++; \
push(PC >> 8); \
push(PC & 0xff); \
PC--; \
adrmode(ticks); \
if (mpu->callbacks->call[ea]) \
{ \
word addr; \
externalise(); \
if ((addr= mpu->callbacks->call[ea](mpu, ea, 0))) \
{ \
internalise(); \
PC= addr; \
fetch(); \
next(); \
} \
} \
PC=ea; \
fetch(); \
next();
#define rts(ticks, adrmode) \
tick(ticks); \
PC = pop(); \
PC |= (pop() << 8); \
PC++; \
fetch(); \
next();
#define brk(ticks, adrmode) \
tick(ticks); \
PC++; \
push(PC >> 8); \
push(PC & 0xff); \
P |= flagB; \
push(P | flagX); \
P |= flagI; \
{ \
word hdlr= getMemory(0xfffe) + (getMemory(0xffff) << 8); \
if (mpu->callbacks->call[hdlr]) \
{ \
word addr; \
externalise(); \
if ((addr= mpu->callbacks->call[hdlr](mpu, PC - 2, 0))) \
{ \
internalise(); \
hdlr= addr; \
} \
} \
PC= hdlr; \
} \
fetch(); \
next();
#define rti(ticks, adrmode) \
tick(ticks); \
P= pop(); \
PC= pop(); \
PC |= (pop() << 8); \
fetch(); \
next();
#define nop(ticks, adrmode) \
fetch(); \
tick(ticks); \
next();
#define ill(ticks, adrmode) \
fetch(); \
tick(ticks); \
fflush(stdout); \
fprintf(stderr, "\nundefined instruction %02X\n", memory[PC-1]); \
return 0;
#define phR(ticks, adrmode, R) \
fetch(); \
tick(ticks); \
push(R); \
next();
#define pha(ticks, adrmode) phR(ticks, adrmode, A)
#define phx(ticks, adrmode) phR(ticks, adrmode, X)
#define phy(ticks, adrmode) phR(ticks, adrmode, Y)
#define php(ticks, adrmode) phR(ticks, adrmode, P | flagX | flagB)
#define plR(ticks, adrmode, R) \
fetch(); \
tick(ticks); \
R= pop(); \
setNZ(R & 0x80, !R); \
next();
#define pla(ticks, adrmode) plR(ticks, adrmode, A)
#define plx(ticks, adrmode) plR(ticks, adrmode, X)
#define ply(ticks, adrmode) plR(ticks, adrmode, Y)
#define plp(ticks, adrmode) \
fetch(); \
tick(ticks); \
P= pop(); \
next();
#define clF(ticks, adrmode, F) \
fetch(); \
tick(ticks); \
P &= ~F; \
next();
#define clc(ticks, adrmode) clF(ticks, adrmode, flagC)
#define cld(ticks, adrmode) clF(ticks, adrmode, flagD)
#define cli(ticks, adrmode) clF(ticks, adrmode, flagI)
#define clv(ticks, adrmode) clF(ticks, adrmode, flagV)
#define seF(ticks, adrmode, F) \
fetch(); \
tick(ticks); \
P |= F; \
next();
#define sec(ticks, adrmode) seF(ticks, adrmode, flagC)
#define sed(ticks, adrmode) seF(ticks, adrmode, flagD)
#define sei(ticks, adrmode) seF(ticks, adrmode, flagI)
#define do_insns(_) \
_(00, brk, implied, 7); _(01, ora, indx, 6); _(02, ill, implied, 2); _(03, ill, implied, 2); \
_(04, tsb, zp, 3); _(05, ora, zp, 3); _(06, asl, zp, 5); _(07, ill, implied, 2); \
_(08, php, implied, 3); _(09, ora, immediate, 3); _(0a, asla,implied, 2); _(0b, ill, implied, 2); \
_(0c, tsb, abs, 4); _(0d, ora, abs, 4); _(0e, asl, abs, 6); _(0f, ill, implied, 2); \
_(10, bpl, relative, 2); _(11, ora, indy, 5); _(12, ora, indzp, 3); _(13, ill, implied, 2); \
_(14, trb, zp, 3); _(15, ora, zpx, 4); _(16, asl, zpx, 6); _(17, ill, implied, 2); \
_(18, clc, implied, 2); _(19, ora, absy, 4); _(1a, ina, implied, 2); _(1b, ill, implied, 2); \
_(1c, trb, abs, 4); _(1d, ora, absx, 4); _(1e, asl, absx, 7); _(1f, ill, implied, 2); \
_(20, jsr, abs, 6); _(21, and, indx, 6); _(22, ill, implied, 2); _(23, ill, implied, 2); \
_(24, bit, zp, 3); _(25, and, zp, 3); _(26, rol, zp, 5); _(27, ill, implied, 2); \
_(28, plp, implied, 4); _(29, and, immediate, 3); _(2a, rola,implied, 2); _(2b, ill, implied, 2); \
_(2c, bit, abs, 4); _(2d, and, abs, 4); _(2e, rol, abs, 6); _(2f, ill, implied, 2); \
_(30, bmi, relative, 2); _(31, and, indy, 5); _(32, and, indzp, 3); _(33, ill, implied, 2); \
_(34, bit, zpx, 4); _(35, and, zpx, 4); _(36, rol, zpx, 6); _(37, ill, implied, 2); \
_(38, sec, implied, 2); _(39, and, absy, 4); _(3a, dea, implied, 2); _(3b, ill, implied, 2); \
_(3c, bit, absx, 4); _(3d, and, absx, 4); _(3e, rol, absx, 7); _(3f, ill, implied, 2); \
_(40, rti, implied, 6); _(41, eor, indx, 6); _(42, ill, implied, 2); _(43, ill, implied, 2); \
_(44, ill, implied, 2); _(45, eor, zp, 3); _(46, lsr, zp, 5); _(47, ill, implied, 2); \
_(48, pha, implied, 3); _(49, eor, immediate, 3); _(4a, lsra,implied, 2); _(4b, ill, implied, 2); \
_(4c, jmp, abs, 3); _(4d, eor, abs, 4); _(4e, lsr, abs, 6); _(4f, ill, implied, 2); \
_(50, bvc, relative, 2); _(51, eor, indy, 5); _(52, eor, indzp, 3); _(53, ill, implied, 2); \
_(54, ill, implied, 2); _(55, eor, zpx, 4); _(56, lsr, zpx, 6); _(57, ill, implied, 2); \
_(58, cli, implied, 2); _(59, eor, absy, 4); _(5a, phy, implied, 3); _(5b, ill, implied, 2); \
_(5c, ill, implied, 2); _(5d, eor, absx, 4); _(5e, lsr, absx, 7); _(5f, ill, implied, 2); \
_(60, rts, implied, 6); _(61, adc, indx, 6); _(62, ill, implied, 2); _(63, ill, implied, 2); \
_(64, stz, zp, 3); _(65, adc, zp, 3); _(66, ror, zp, 5); _(67, ill, implied, 2); \
_(68, pla, implied, 4); _(69, adc, immediate, 3); _(6a, rora,implied, 2); _(6b, ill, implied, 2); \
_(6c, jmp, indirect, 5); _(6d, adc, abs, 4); _(6e, ror, abs, 6); _(6f, ill, implied, 2); \
_(70, bvs, relative, 2); _(71, adc, indy, 5); _(72, adc, indzp, 3); _(73, ill, implied, 2); \
_(74, stz, zpx, 4); _(75, adc, zpx, 4); _(76, ror, zpx, 6); _(77, ill, implied, 2); \
_(78, sei, implied, 2); _(79, adc, absy, 4); _(7a, ply, implied, 4); _(7b, ill, implied, 2); \
_(7c, jmp, indabsx, 6); _(7d, adc, absx, 4); _(7e, ror, absx, 7); _(7f, ill, implied, 2); \
_(80, bra, relative, 2); _(81, sta, indx, 6); _(82, ill, implied, 2); _(83, ill, implied, 2); \
_(84, sty, zp, 2); _(85, sta, zp, 2); _(86, stx, zp, 2); _(87, ill, implied, 2); \
_(88, dey, implied, 2); _(89, bit, immediate, 2); _(8a, txa, implied, 2); _(8b, ill, implied, 2); \
_(8c, sty, abs, 4); _(8d, sta, abs, 4); _(8e, stx, abs, 4); _(8f, ill, implied, 2); \
_(90, bcc, relative, 2); _(91, sta, indy, 6); _(92, sta, indzp, 3); _(93, ill, implied, 2); \
_(94, sty, zpx, 4); _(95, sta, zpx, 4); _(96, stx, zpy, 4); _(97, ill, implied, 2); \
_(98, tya, implied, 2); _(99, sta, absy, 5); _(9a, txs, implied, 2); _(9b, ill, implied, 2); \
_(9c, stz, abs, 4); _(9d, sta, absx, 5); _(9e, stz, absx, 5); _(9f, ill, implied, 2); \
_(a0, ldy, immediate, 3); _(a1, lda, indx, 6); _(a2, ldx, immediate, 3); _(a3, ill, implied, 2); \
_(a4, ldy, zp, 3); _(a5, lda, zp, 3); _(a6, ldx, zp, 3); _(a7, ill, implied, 2); \
_(a8, tay, implied, 2); _(a9, lda, immediate, 3); _(aa, tax, implied, 2); _(ab, ill, implied, 2); \
_(ac, ldy, abs, 4); _(ad, lda, abs, 4); _(ae, ldx, abs, 4); _(af, ill, implied, 2); \
_(b0, bcs, relative, 2); _(b1, lda, indy, 5); _(b2, lda, indzp, 3); _(b3, ill, implied, 2); \
_(b4, ldy, zpx, 4); _(b5, lda, zpx, 4); _(b6, ldx, zpy, 4); _(b7, ill, implied, 2); \
_(b8, clv, implied, 2); _(b9, lda, absy, 4); _(ba, tsx, implied, 2); _(bb, ill, implied, 2); \
_(bc, ldy, absx, 4); _(bd, lda, absx, 4); _(be, ldx, absy, 4); _(bf, ill, implied, 2); \
_(c0, cpy, immediate, 3); _(c1, cmp, indx, 6); _(c2, ill, implied, 2); _(c3, ill, implied, 2); \
_(c4, cpy, zp, 3); _(c5, cmp, zp, 3); _(c6, dec, zp, 5); _(c7, ill, implied, 2); \
_(c8, iny, implied, 2); _(c9, cmp, immediate, 3); _(ca, dex, implied, 2); _(cb, ill, implied, 2); \
_(cc, cpy, abs, 4); _(cd, cmp, abs, 4); _(ce, dec, abs, 6); _(cf, ill, implied, 2); \
_(d0, bne, relative, 2); _(d1, cmp, indy, 5); _(d2, cmp, indzp, 3); _(d3, ill, implied, 2); \
_(d4, ill, implied, 2); _(d5, cmp, zpx, 4); _(d6, dec, zpx, 6); _(d7, ill, implied, 2); \
_(d8, cld, implied, 2); _(d9, cmp, absy, 4); _(da, phx, implied, 3); _(db, ill, implied, 2); \
_(dc, ill, implied, 2); _(dd, cmp, absx, 4); _(de, dec, absx, 7); _(df, ill, implied, 2); \
_(e0, cpx, immediate, 3); _(e1, sbc, indx, 6); _(e2, ill, implied, 2); _(e3, ill, implied, 2); \
_(e4, cpx, zp, 3); _(e5, sbc, zp, 3); _(e6, inc, zp, 5); _(e7, ill, implied, 2); \
_(e8, inx, implied, 2); _(e9, sbc, immediate, 3); _(ea, nop, implied, 2); _(eb, ill, implied, 2); \
_(ec, cpx, abs, 4); _(ed, sbc, abs, 4); _(ee, inc, abs, 6); _(ef, ill, implied, 2); \
_(f0, beq, relative, 2); _(f1, sbc, indy, 5); _(f2, sbc, indzp, 3); _(f3, ill, implied, 2); \
_(f4, ill, implied, 2); _(f5, sbc, zpx, 4); _(f6, inc, zpx, 6); _(f7, ill, implied, 2); \
_(f8, sed, implied, 2); _(f9, sbc, absy, 4); _(fa, plx, implied, 4); _(fb, ill, implied, 2); \
_(fc, ill, implied, 2); _(fd, sbc, absx, 4); _(fe, inc, absx, 7); _(ff, ill, implied, 2);
void M6502_irq(M6502 *mpu)
{
if (!(mpu->registers->p & flagI))
{
mpu->memory[0x0100 + mpu->registers->s--] = (byte)(mpu->registers->pc >> 8);
mpu->memory[0x0100 + mpu->registers->s--] = (byte)(mpu->registers->pc & 0xff);
mpu->memory[0x0100 + mpu->registers->s--] = mpu->registers->p;
mpu->registers->p &= ~flagB;
mpu->registers->p |= flagI;
mpu->registers->pc = M6502_getVector(mpu, IRQ);
}
}
void M6502_nmi(M6502 *mpu)
{
mpu->memory[0x0100 + mpu->registers->s--] = (byte)(mpu->registers->pc >> 8);
mpu->memory[0x0100 + mpu->registers->s--] = (byte)(mpu->registers->pc & 0xff);
mpu->memory[0x0100 + mpu->registers->s--] = mpu->registers->p;
mpu->registers->p &= ~flagB;
mpu->registers->p |= flagI;
mpu->registers->pc = M6502_getVector(mpu, NMI);
}
void M6502_reset(M6502 *mpu)
{
mpu->registers->p &= ~flagD;
mpu->registers->p |= flagI;
mpu->registers->pc = M6502_getVector(mpu, RST);
}
/* the compiler should elminate all call to this function */
static void oops(void)
{
fprintf(stderr, "\noops -- instruction dispatch missing\n");
}
int M6502_run(M6502 *mpu)
{
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
static void *itab[256]= { &&_00, &&_01, &&_02, &&_03, &&_04, &&_05, &&_06, &&_07, &&_08, &&_09, &&_0a, &&_0b, &&_0c, &&_0d, &&_0e, &&_0f,
&&_10, &&_11, &&_12, &&_13, &&_14, &&_15, &&_16, &&_17, &&_18, &&_19, &&_1a, &&_1b, &&_1c, &&_1d, &&_1e, &&_1f,
&&_20, &&_21, &&_22, &&_23, &&_24, &&_25, &&_26, &&_27, &&_28, &&_29, &&_2a, &&_2b, &&_2c, &&_2d, &&_2e, &&_2f,
&&_30, &&_31, &&_32, &&_33, &&_34, &&_35, &&_36, &&_37, &&_38, &&_39, &&_3a, &&_3b, &&_3c, &&_3d, &&_3e, &&_3f,
&&_40, &&_41, &&_42, &&_43, &&_44, &&_45, &&_46, &&_47, &&_48, &&_49, &&_4a, &&_4b, &&_4c, &&_4d, &&_4e, &&_4f,
&&_50, &&_51, &&_52, &&_53, &&_54, &&_55, &&_56, &&_57, &&_58, &&_59, &&_5a, &&_5b, &&_5c, &&_5d, &&_5e, &&_5f,
&&_60, &&_61, &&_62, &&_63, &&_64, &&_65, &&_66, &&_67, &&_68, &&_69, &&_6a, &&_6b, &&_6c, &&_6d, &&_6e, &&_6f,
&&_70, &&_71, &&_72, &&_73, &&_74, &&_75, &&_76, &&_77, &&_78, &&_79, &&_7a, &&_7b, &&_7c, &&_7d, &&_7e, &&_7f,
&&_80, &&_81, &&_82, &&_83, &&_84, &&_85, &&_86, &&_87, &&_88, &&_89, &&_8a, &&_8b, &&_8c, &&_8d, &&_8e, &&_8f,
&&_90, &&_91, &&_92, &&_93, &&_94, &&_95, &&_96, &&_97, &&_98, &&_99, &&_9a, &&_9b, &&_9c, &&_9d, &&_9e, &&_9f,
&&_a0, &&_a1, &&_a2, &&_a3, &&_a4, &&_a5, &&_a6, &&_a7, &&_a8, &&_a9, &&_aa, &&_ab, &&_ac, &&_ad, &&_ae, &&_af,
&&_b0, &&_b1, &&_b2, &&_b3, &&_b4, &&_b5, &&_b6, &&_b7, &&_b8, &&_b9, &&_ba, &&_bb, &&_bc, &&_bd, &&_be, &&_bf,
&&_c0, &&_c1, &&_c2, &&_c3, &&_c4, &&_c5, &&_c6, &&_c7, &&_c8, &&_c9, &&_ca, &&_cb, &&_cc, &&_cd, &&_ce, &&_cf,
&&_d0, &&_d1, &&_d2, &&_d3, &&_d4, &&_d5, &&_d6, &&_d7, &&_d8, &&_d9, &&_da, &&_db, &&_dc, &&_dd, &&_de, &&_df,
&&_e0, &&_e1, &&_e2, &&_e3, &&_e4, &&_e5, &&_e6, &&_e7, &&_e8, &&_e9, &&_ea, &&_eb, &&_ec, &&_ed, &&_ee, &&_ef,
&&_f0, &&_f1, &&_f2, &&_f3, &&_f4, &&_f5, &&_f6, &&_f7, &&_f8, &&_f9, &&_fa, &&_fb, &&_fc, &&_fd, &&_fe, &&_ff };
register void **itabp= &itab[0];
register void *tpc;
//# define begin() fetch(); next()
# define begin() goto *(itabp[memory[PC++]])
# define fetch() tpc= itabp[memory[PC++]]
# define next() if (STEP) { PC--; externalise(); return 1; } goto *tpc
# define dispatch(num, name, mode, cycles) _##num: name(cycles, mode) oops(); next()
# define end()
#else /* (!__GNUC__) || (__STRICT_ANSI__) */
# define begin() for (;;) switch (memory[PC++]) {
# define fetch()
# define next() if (STEP) { externalise(); return 1; } break
# define dispatch(num, name, mode, cycles) case 0x##num: name(cycles, mode); next()
# define end() }
#endif
register byte *memory= mpu->memory;
register word PC;
word ea;
byte A, X, Y, P, S;
M6502_Callback *readCallback= mpu->callbacks->read;
M6502_Callback *writeCallback= mpu->callbacks->write;
unsigned int STEP;
# define internalise() STEP=mpu->flags&M6502_SingleStep; A= mpu->registers->a; X= mpu->registers->x; Y= mpu->registers->y; P= mpu->registers->p; S= mpu->registers->s; PC= mpu->registers->pc
# define externalise() mpu->registers->a= A; mpu->registers->x= X; mpu->registers->y= Y; mpu->registers->p= P; mpu->registers->s= S; mpu->registers->pc= PC
internalise();
begin();
do_insns(dispatch);
end();
# undef begin
# undef internalise
# undef externalise
# undef fetch
# undef next
# undef dispatch
# undef end
(void)oops;
return 0;
}
int M6502_disassemble(M6502 *mpu, word ip, char buffer[64])
{
char *s= buffer;
byte *b= mpu->memory + ip;
switch (b[0])
{
# define _implied return 1;
# define _immediate sprintf(s, "#%02X", b[1]); return 2;
# define _zp sprintf(s, "%02X", b[1]); return 2;
# define _zpx sprintf(s, "%02X,X", b[1]); return 2;
# define _zpy sprintf(s, "%02X,Y", b[1]); return 2;
# define _abs sprintf(s, "%02X%02X", b[2], b[1]); return 3;
# define _absx sprintf(s, "%02X%02X,X", b[2], b[1]); return 3;
# define _absy sprintf(s, "%02X%02X,Y", b[2], b[1]); return 3;
# define _relative sprintf(s, "%04X", ip + 2 + (int8_t)b[1]); return 2;
# define _indirect sprintf(s, "(%02X%02X)", b[2], b[1]); return 3;
# define _indzp sprintf(s, "(%02X)", b[1]); return 2;
# define _indx sprintf(s, "(%02X,X)", b[1]); return 2;
# define _indy sprintf(s, "(%02X),Y", b[1]); return 2;
# define _indabsx sprintf(s, "(%02X%02X,X)", b[2], b[1]); return 3;
# define disassemble(num, name, mode, cycles) case 0x##num: s += sprintf(s, "%s ", #name); _##mode
do_insns(disassemble);
# undef _do
}
return 0;
}
void M6502_dump(M6502 *mpu, char buffer[64])
{
M6502_Registers *r= mpu->registers;
uint8_t p= r->p;
# define P(N,C) (p & (1 << (N)) ? (C) : '-')
sprintf(buffer, "PC=%04X SP=%04X A=%02X X=%02X Y=%02X P=%02X %c%c%c%c%c%c%c%c",
r->pc, 0x0100 + r->s,
r->a, r->x, r->y, r->p,
P(7,'N'), P(6,'V'), P(5,'?'), P(4,'B'), P(3,'D'), P(2,'I'), P(1,'Z'), P(0,'C'));
# undef P
}
static void outOfMemory(void)
{
fflush(stdout);
fprintf(stderr, "\nout of memory\n");
abort();
}
M6502 *M6502_new(M6502_Registers *registers, M6502_Memory memory, M6502_Callbacks *callbacks)
{
M6502 *mpu= calloc(1, sizeof(M6502));
if (!mpu) outOfMemory();
if (!registers) { registers = (M6502_Registers *)calloc(1, sizeof(M6502_Registers)); mpu->flags |= M6502_RegistersAllocated; }
if (!memory ) { memory = (uint8_t *)calloc(1, sizeof(M6502_Memory )); mpu->flags |= M6502_MemoryAllocated; }
if (!callbacks) { callbacks = (M6502_Callbacks *)calloc(1, sizeof(M6502_Callbacks)); mpu->flags |= M6502_CallbacksAllocated; }
if (!registers || !memory || !callbacks) outOfMemory();
mpu->registers = registers;
mpu->memory = memory;
mpu->callbacks = callbacks;
return mpu;
}
void M6502_delete(M6502 *mpu)
{
if (mpu->flags & M6502_CallbacksAllocated) free(mpu->callbacks);
if (mpu->flags & M6502_MemoryAllocated ) free(mpu->memory);
if (mpu->flags & M6502_RegistersAllocated) free(mpu->registers);
free(mpu);
}

76
src/lib6502/lib6502.h Normal file
View File

@ -0,0 +1,76 @@
#ifndef __m6502_h
#define __m6502_h
#include <stdio.h>
#include <stdint.h>
typedef struct _M6502 M6502;
typedef struct _M6502_Registers M6502_Registers;
typedef struct _M6502_Callbacks M6502_Callbacks;
typedef int (*M6502_Callback)(M6502 *mpu, uint16_t address, uint8_t data);
typedef M6502_Callback M6502_CallbackTable[0x10000];
typedef uint8_t M6502_Memory[0x10000];
enum {
M6502_NMIVector= 0xfffa, M6502_NMIVectorLSB= 0xfffa, M6502_NMIVectorMSB= 0xfffb,
M6502_RSTVector= 0xfffc, M6502_RSTVectorLSB= 0xfffc, M6502_RSTVectorMSB= 0xfffd,
M6502_IRQVector= 0xfffe, M6502_IRQVectorLSB= 0xfffe, M6502_IRQVectorMSB= 0xffff
};
struct _M6502_Registers
{
uint8_t a; /* accumulator */
uint8_t x; /* X index register */
uint8_t y; /* Y index register */
uint8_t p; /* processor status register */
uint8_t s; /* stack pointer */
uint16_t pc; /* program counter */
};
struct _M6502_Callbacks
{
M6502_CallbackTable read;
M6502_CallbackTable write;
M6502_CallbackTable call;
};
struct _M6502
{
M6502_Registers *registers;
uint8_t *memory;
M6502_Callbacks *callbacks;
unsigned int flags;
};
enum {
M6502_RegistersAllocated = 1 << 0,
M6502_MemoryAllocated = 1 << 1,
M6502_CallbacksAllocated = 1 << 2,
M6502_SingleStep = 1 << 3
};
extern M6502 *M6502_new(M6502_Registers *registers, M6502_Memory memory, M6502_Callbacks *callbacks);
extern void M6502_reset(M6502 *mpu);
extern void M6502_nmi(M6502 *mpu);
extern void M6502_irq(M6502 *mpu);
extern int M6502_run(M6502 *mpu);
extern int M6502_disassemble(M6502 *mpu, uint16_t addr, char buffer[64]);
extern void M6502_dump(M6502 *mpu, char buffer[64]);
extern void M6502_delete(M6502 *mpu);
#define M6502_getVector(MPU, VEC) \
( ( ((MPU)->memory[M6502_##VEC##VectorLSB]) ) \
| ((MPU)->memory[M6502_##VEC##VectorMSB] << 8) )
#define M6502_setVector(MPU, VEC, ADDR) \
( ( ((MPU)->memory[M6502_##VEC##VectorLSB]= ((uint8_t)(ADDR)) & 0xff) ) \
, ((MPU)->memory[M6502_##VEC##VectorMSB]= (uint8_t)((ADDR) >> 8)) )
#define M6502_getCallback(MPU, TYPE, ADDR) ((MPU)->callbacks->TYPE[ADDR])
#define M6502_setCallback(MPU, TYPE, ADDR, FN) ((MPU)->callbacks->TYPE[ADDR]= (FN))
#endif __m6502_h

View File

@ -0,0 +1 @@
.so man3/lib6502.3

View File

@ -0,0 +1 @@
.so man3/lib6502.3

View File

@ -0,0 +1 @@
.so man3/lib6502.3

View File

@ -0,0 +1 @@
.so man3/lib6502.3

View File

@ -0,0 +1 @@
.so man3/lib6502.3

View File

@ -0,0 +1 @@
.so man3/lib6502.3

View File

@ -0,0 +1 @@
.so man3/lib6502.3

View File

@ -0,0 +1 @@
.so man3/lib6502.3

View File

@ -0,0 +1 @@
.so man3/lib6502.3

View File

@ -0,0 +1 @@
.so man3/lib6502.3

View File

@ -0,0 +1 @@
.so man3/lib6502.3

View File

@ -0,0 +1 @@
.so man3/lib6502.3

508
src/lib6502/man/lib6502.3 Normal file
View File

@ -0,0 +1,508 @@
.\" Copyright (c) 2005 Ian Piumarta
.\"
.\" Permission is hereby granted, free of charge, to any person
.\" obtaining a copy of this software and associated documentation
.\" files (the 'Software'), to deal in the Software without
.\" restriction, including without limitation the rights to use, copy,
.\" modify, merge, publish, distribute, and/or sell copies of the
.\" Software, and to permit persons to whom the Software is furnished
.\" to do so, provided that the above copyright notice(s) and this
.\" permission notice appear in all copies of the Software and that
.\" both the above copyright notice(s) and this permission notice
.\" appear in supporting documentation.
.\"
.\" THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
.\"
.\" last edited: 2005-11-02 01:18:07 by piumarta on margaux.local
.\"
.Dd October 31, 2005
.Dt LIB6502 3 LOCAL
.Os ""
.\" ----------------------------------------------------------------
.Sh NAME
.\"
.Nm lib6502
.Nd 6502 microprocessor emulator
.\" ----------------------------------------------------------------
.Sh SYNOPSIS
.\"
.In stdint.h
.In lib6502.h
.Ft M6502 *
.Fn M6502_new "M6502_Registers *registers" "M6502_Memory memory" "M6502_Callbacks *callbacks"
.Ft void
.Fn M6502_reset "M6502 *mpu"
.Ft void
.Fn M6502_nmi "M6502 *mpu"
.Ft void
.Fn M6502_irq "M6502 *mpu"
.Ft uint16_t
.Fn M6502_getVector "M6502 *mpu" "vector"
.Ft uint16_t
.Fn M6502_setVector "M6502 *mpu" "vector" "uint16_t address"
.Ft M6502_Callback
.Fn M6502_getCallback "M6502 *mpu" "type" "uint16_t address"
.Ft M6502_Callback
.Fn M6502_setCallback "M6502 *mpu" "type" "uint16_t address" "M6502_Callback callback"
.Ft void
.Fn M6502_run "M6502 *mpu"
.Ft int
.Fn M6502_disassemble "M6502 *mpu" "uint16_t address" "char buffer[64]"
.Ft void
.Fn M6502_dump "M6502 *mpu" "char buffer[64]"
.Ft void
.Fn M6502_delete "M6502 *mpu"
.\" ----------------------------------------------------------------
.Sh DESCRIPTION
.\"
.Fn M6502_new
creates an instance of a 6502 microprocessor.
.Fn M6502_reset ,
.Fn M6502_nmi
and
.Fn M6502_irq
place it into the states associated with the hardware signals for
reset, non-maskable interrupt and interrupt request, respectively.
The macros
.Fn M6502_getVector
and
.Fn M6502_setVector
read and write the vectors through which the processor jumps in
response to the above signals. The macros
.Fn M6502_getCallback
and
.Fn M6502_setVector
read and write client-supplied functions that intercept accesses to
memory.
.Fn M6502_run
begins emulated execution.
.Fn M6502_dump
and
.Fn M6502_disassemble
create human-readable representations of processor or memory state.
.Fn M6502_delete
frees all resources associated with a processor instance. Each of
these functions and macros is described in more detail below.
.Pp
.Fn M6502_new
returns a pointer to a
.Fa M6502
structure containing at least the following members:
.Bd -literal
struct _M6502
{
M6502_Registers *registers; /* processor state */
uint8_t *memory; /* memory image */
M6502_Callbacks *callbacks; /* r/w/x callbacks */
};
.Ed
.Pp
These members are initialised according to the supplied
.Fa registers ,
.Fa memory
and
.Fa callbacks
arguments. If a given argument is NULL, the corresponding member is
initialised automatically with a suitable (non-NULL) value.
.Pp
The members of
.Fa M6502
are as follows:
.Bl -tag -width ".Fa callbacks"
.It Fa registers
the processor state, containing all registers and condition codes.
.It Fa memory
a block of at least 64 kilobytes of storage containing the processor's
memory. (An array type
.Vt M6502_Memory,
suitable for defining values to pass as the
.Fa memory
argument, is defined in the
.In lib6502.h
include file.)
.It Fa callbacks
a structure mapping processor memory accesses to client callback
functions.
.El
.Pp
Access to the contents of the
.Fa registers
and
.Fa memory
members can be made directly.
The
.Fa registers
member is a
.Vt M6502_Registers
containing the following members:
.Bd -literal
struct _M6502_Registers
{
uint8_t a; /* accumulator */
uint8_t x; /* X index register */
uint8_t y; /* Y index register */
uint8_t p; /* processor status register */
uint8_t s; /* stack pointer */
uint16_t pc; /* program counter */
};
.Ed
.Pp
The
.Fa memory
member is an array of
.Vt unsigned char
and can be indexed directly. In addition, two convenience macros
.Fn M6502_getVector
and
.Fn M6502_setVector
provide access to the reset and interrupt vectors within
.Fa memory .
.Fn M6502_getVector
returns the address stored in the named
.Fa vector
which must be precisely one of the following:
.Bl -tag -width ".Dv RST" -offset indent
.It Dv RST
the reset vector.
.It Dv NMI
the non-maskable interrupt vector.
.It Dv IRQ
the interrupt request vector.
.El
.Pp
.Fn M6502_setVector
stores its
.Fa address
argument in the named
.Fa vector
and returns the new value.
.Pp
The
.Fa callbacks
member contains an opaque structure mapping processor memory accesses
to client callback functions. Whenever the processor performs an
access for which a corresponding entry exists in the the
.Fa callbacks
structure, the emulator suspends execution and invokes the callback to
complete the operation. Each callback function should have a
signature equivalent to:
.Bd -ragged -offset indent
int
.Va callback
(M6502 *mpu, uint16_t address, uint8_t data);
.Ed
.Pp
The macros
.Fn M6502_getCallback
and
.Fn M6502_setCallback
read and write entries in the
.Fa callbacks
structure. These macros identify a unique memory access operation
from the specified
.Fa address
on which it operates and
.Fa type
of access involved. The
.Fa type
argument must be one of the following:
.Bl -tag -width ".Dv write"
.It Dv read
the
.Fa callback
is invoked when the processor attempts to read from the
given address. The emulator passes the effective address of the
operation to the callback in its
.Fa address
argument. (The
.Fa data
argument is undefined.) The value returned by the callback will be
used by the emulator as the result of the read operation.
.It Dv write
the
.Fa callback
is invoked when the processor attempts to write to the
given address. The emulator passes the effective address of the
operation to the callback in its
.Fa address
argument and the byte being written in the
.Fa data
argument. The emulator will not perform the write operation before
invoking the callback; if the write should complete, the callback must
modify the processor's
.Fa memory
explicitly. The valued returned from the callback is ignored.
.It Dv call
the
.Fa callback
is invoked when the processor attempts to transfer control to the
given address by any instruction other than a relative branch. The
emulator passes the destination address to the callback in its
.Fa address
argument and the instruction that initiated the control transfer in
its
.Fa data
argument (one of JMP, JSR, BRK, RTS or RTI). If the callback returns
zero (the callback refuses to handle the operation) the emulator will
allow the operation to complete as normal. If the callback returns a
non-zero address (indicating that the callback has handled the
operation internally) the emulator will transfer control to that
address.
.El
.Pp
.Fn M6502_getCallback
returns zero if there is no callback associated with the given
.Fa type
and
.Fa address .
Passing zero as the
.Fa callback
argument of
.Fn M6502_setCallback
removes any callback that might have been associated with
.Fa type
and
.Fa address .
.Pp
.Fn M6502_run
emulates processor execution in the given
.Fa mpu
by repeatedly fetching the instruction addressed by
.Fa pc
and dispatching to it. This function normally never returns.
.Pp
.Fn M6502_dump
writes a (NUL-terminated) symbolic representation of the processor's
internal state into the supplied
.Fa buffer .
Typical output resembles:
.Bd -literal -offset indent
PC=1010 SP=01FE A=0A X=5B Y=00 P=D1 NV-B---C
.Ed
.Pp
.Fn M6502_disassemble
writes a (NUL-terminated) symbolic representation of the instruction
in the processor's memory at the given
.Fa address
into the supplied
.Fa buffer .
It returns the size (in bytes) of the instruction. (In other words,
the amount by which
.Fa address
should be incremented to arrive at the next instruction.)
Typical output resembles:
.Bd -literal -offset indent
1009 cpx #5B
.Ed
.Pp
(The
.Fa buffer
arguments are oversized to allow for future expansion.)
.Pp
.Fn M6502_delete
frees the resources associated with the given
.Fa mpu.
Any members that were allocated implicitly (passed as NULL to
.Fn M6502_new )
are deallocated. Members that were initialised from non-NULL
arguments are not deallocated.
.\" ----------------------------------------------------------------
.Sh IMPLEMENTATION NOTES
.\"
You can share the
.Fa memory
and
.Fa callbacks
members of
.Vt M6502
between multiple instances to simulate multiprocessor hardware.
.\" ----------------------------------------------------------------
.Sh RETURN VALUES
.\"
.Fn M6502_new
returns a pointer to a
.Vt M6502
structure.
.Fn M6502_getVector
and
.Fn M6502_setVector
return the contents of the given
.Fa vector .
.Fn M6502_getCallback
and
.Fn M6502_setCallback
return the
.Vt M6502_Callback
function associated with the given
.Fa address
and access
.Fa type .
.Fn M6502_disassemble
returns the size (in bytes) of the instruction at the given
.Fa address .
.Fn M6502_reset ,
.Fn M6502_nmi ,
.Fn M6502_irq ,
.Fn M6502_run ,
.Fn M6502_dump
and
.Fn M6502_delete
don't return anything (unless you forgot to include
.In lib6502.h ) .
.\" ----------------------------------------------------------------
.Sh EXAMPLES
.\"
The following program creates a 6502 processor, sets up callbacks for
printing characters and halting after a BRK instruction, stores a
program into memory that prints the alphabet, disassembles the program
on stdout, and then executes the program.
.Bd -literal -offset indent -compact
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include "lib6502.h"
#define WRCH 0xFFEE
int wrch(M6502 *mpu, uint16_t address, uint8_t data)
{
int pc;
putchar(mpu->registers->a);
pc = mpu->memory[++mpu->registers->s + 0x100];
pc |= mpu->memory[++mpu->registers->s + 0x100] << 8;
return pc + 1; /* JSR pushes next insn addr - 1 */
}
int done(M6502 *mpu, uint16_t address, uint8_t data)
{
char buffer[64];
M6502_dump(mpu, buffer);
printf("\\nBRK instruction\\n%s\\n", buffer);
exit(0);
}
int main(int argc, char **argv)
{
M6502 *mpu = M6502_new(0, 0, 0);
unsigned pc = 0x1000;
mpu->callbacks->call[WRCH] = wrch; /* write character */
mpu->callbacks->call[0000] = done; /* reached after BRK */
# define gen1(X) (mpu->memory[pc++] = (uint8_t)(X))
# define gen2(X,Y) gen1(X); gen1(Y)
# define gen3(X,Y,Z) gen1(X); gen2(Y,Z)
gen2(0xA2, 'A' ); /* LDX #'A' */
gen1(0x8A ); /* TXA */
gen3(0x20,0xEE,0xFF); /* JSR FFEE */
gen1(0xE8 ); /* INX */
gen2(0xE0, 'Z'+1 ); /* CPX #'Z'+1 */
gen2(0xD0, -9 ); /* BNE 1002 */
gen2(0xA9, '\\n' ); /* LDA #'\\n' */
gen3(0x20,0xEE,0xFF); /* JSR FFEE */
gen2(0x00,0x00 ); /* BRK */
{
uint16_t ip = 0x1000;
while (ip < pc)
{
char insn[64];
ip += M6502_disassemble(mpu, ip, insn);
printf("%04X %s\\n", ip, insn);
}
}
M6502_setVector(mpu, RST, 0x1000);
M6502_reset(mpu);
M6502_run(mpu);
M6502_delete(mpu);
return 0;
}
.Ed
.\" ----------------------------------------------------------------
.Sh DIAGNOSTICS
.\"
If
.Fn M6502_new
cannot allocate sufficient memory it prints "out of memory" to stderr
and exits with a non-zero status.
.Pp
If
.Fn M6502_run
encounters an illegal or undefined instruction, it prints "undefined
instruction" and the processor's state to stderr, then exits with a
non-zero status.
.\" ----------------------------------------------------------------
.Sh COMPATIBILITY
.\"
M6502 is a generic name. The initial letter is mandated by C naming
conventions and chosen in deference to MOS Technology, the original
designers of the processor. To the best of my knowledge the 'M'
prefix was never stamped on a physical 6502.
.Pp
The emulator implements the CMOS version of the processor (NMOS bugs
in effective address calculations involving page boundaries are
corrected) but does not tolerate the execution of undefined
instructions (which were all no-ops in the first-generation CMOS
hardware). It would be nice to support the several alternative
instruction sets (model-specific undocumented instructions in NMOS
models, and various documented extensions in the later CMOS models)
but there are currently no plans to do so.
.Pp
The emulated 6502 will run much faster than real hardware on any
modern computer. The fastest 6502 hardware available at the time of
writing has a clock speed of 14 MHz. On a 2 GHz PowerPC, the emulated
6502 runs at almost 300 MHz.
.\" ----------------------------------------------------------------
.Sh SEE ALSO
.\"
.Xr run6502 1
.Pp
For development tools, documentation and source code:
.Pa http://6502.org
.\" ----------------------------------------------------------------
.Sh AUTHORS
.\"
The software and manual pages were written by Ian Piumarta.
.Pp
The software is provided as-is, with absolutely no warranty, in the
hope that you will enjoy and benefit from it. You may use (entirely
at your own risk) and redistribute it under the terms of a very
liberal license that does not seek to restrict your rights in any way
(unlike certain so-called 'open source' licenses that significantly
limit your freedom in the name of 'free' software that is, ultimately,
anything but free). See the file COPYING for details.
.\" ----------------------------------------------------------------
.Sh BUGS
.\"
.Fn M6502_getVector
and
.Fn M6502_setVector
evaluate their arguments more than once.
.Pp
The out-of-memory condition and attempted execution of
illegal/undefined instructions should not be fatal errors.
.Pp
There is no way to limit the duration of execution within
.Fn M6502_run
to a certain number of instructions or cycles.
.Pp
The emulator should support some means of implicit interrupt
generation, either by polling or in response to (Unix) signals.
.Pp
The
.Sx COMPATIBILITY
section in this manual page has been diverted from its legitimate
purpose.
.Pp
The plural of 'callback' really aught to be 'callsback'.
.Pp
Please send bug reports (and feature requests) to the author at:
firstName (at) lastName (dot) com. (See
.Sx AUTHORS
above for suitable values of firstName and lastName.)

380
src/lib6502/man/run6502.1 Normal file
View File

@ -0,0 +1,380 @@
.\" Copyright (c) 2005 Ian Piumarta
.\"
.\" Permission is hereby granted, free of charge, to any person
.\" obtaining a copy of this software and associated documentation
.\" files (the 'Software'), to deal in the Software without
.\" restriction, including without limitation the rights to use, copy,
.\" modify, merge, publish, distribute, and/or sell copies of the
.\" Software, and to permit persons to whom the Software is furnished
.\" to do so, provided that the above copyright notice(s) and this
.\" permission notice appear in all copies of the Software and that
.\" both the above copyright notice(s) and this permission notice
.\" appear in supporting documentation.
.\"
.\" THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
.\"
.\" last edited: 2005-11-02 01:18:22 by piumarta on margaux.local
.\"
.Dd October 31, 2005
.Dt RUN6502 1 LOCAL
.Os ""
.\" ----------------------------------------------------------------
.Sh NAME
.\"
.Nm run6502
.Nd execute a 6502 microprocessor program
.\" ----------------------------------------------------------------
.Sh SYNOPSIS
.\"
.Nm run6502
.Op Ar option ...
.Nm run6502
.Op Ar option ...
.Fl B
.Op Ar
.\" ----------------------------------------------------------------
.Sh DESCRIPTION
The
.Nm run6502
command emulates the execution of a 6502 microprocessor. It creates a
memory image from the contents of one or more files on the command
line and then simulates a power-on hardware reset to begin execution.
.Pp
In its first form,
.Nm run6502
emulates an embedded 6502 processor with 64 kilobytes of RAM, no
memory-mapped hardware, and no input-output capabilities. Limited
interaction with the machine is possible only through the
.Fl G , M
and
.Fl P
options.
.Pp
In its second form (with the
.Fl B
option)
.Nm run6502
provides minimal emulation of Acorn 'BBC Model B' hardware with 32
kilobytes of RAM, 16 kilobytes of paged language ROMs, and 16
kilobytes of operating system ROM. A few MOS calls are intercepted to
provide keyboard input and screen output via stdin and stdout.
Switching between the sixteen paged read-only memory banks is also
supported by the usual memory-mapped control register. Any
.Ar file
arguments after the
.Fl B
are loaded into successive paged ROM banks (starting at 15 and working
down towards 0) before execution begins.
.\" ----------------------------------------------------------------
.Ss Options
.\"
.Bl -tag -width indent
.It Fl B
enable minimal Acorn 'BBC Model B' hardware emulation:
.Bl -bullet
.It
the contents of memory between addresses 0x8000 and 0xBFFF are copied
into paged ROM number 0;
.It
memory between 0x8000 and 0xBFFF becomes bank-switchable between
sixteen different ROM images;
.It
the memory-mapped pages ('FRED', 'JIM' and 'SHEILA') between 0xFC00
and 0xFEFF are initialised to harmless values;
.It
the upper half of the address space is write-protected; and
.It
callbacks are installed on several OS entry points to provide
input-output via stdin and stdout.
.El
.Pp
Any remaining non-option arguments on the command line will name files
to be loaded successively into paged ROMs, starting at 15 and working
downwards towards 0.
.It Fl d Ar addr Ar end
dump memory from the address
.Ar addr
(given in hexadecimal) up to (but not including)
.Ar end .
The
.Ar end
argument is either an absolute address or a relative address specified
as a '+' character followed by the number (in hexadecimal) of bytes to
dump. In other words, the following two options dump the same region
of memory:
.Bd -ragged -offset indent
.Fl d
8000 C000
.Ed
.Bd -ragged -offset indent -compact
.Fl d
8000 +4000
.Ed
.Pp
The format of the dump cannot currently be modified and consists of
the current address followed by one, two or three hexadecimal bytes,
and a symbolic representation of the instruction at that address.
.It Fl G Ar addr
arrange that subroutine calls to
.Ar addr
will behave as if there were an implementation of
.Xr getchar 3
at that address, reading a character from stdin and returning it in
the accumulator.
.It Fl h
print a summary of the available options and then exit.
.It Fl I Ar addr
set the IRQ (interrupt request) vector (the address to which the
processor will transfer control upon execution of a BRK instruction).
Setting this address to zero will cause execution to halt (and the
emulator to exit) when a BRK instruction is encountered.
.It Fl i Ar addr Ar file
Load
.Ar file
into the memory image at the address
.Ar addr
(in hexadecimal), skipping over any initial '#!' interpreter line.
.It Fl l Ar addr Ar file
Load
.Ar file
into the memory image at the address
.Ar addr
(in hexadecimal).
.It Fl M Ar addrio
arrange that memory reads from address
.Ar addrio
will return the next character on stdin (blocking if necessary), and
memory writes to
.Ar addrio
will send the value written to stdout.
.It Fl N Ar addr
set the NMI (non-maskable interrupt) vector to
.Ar addr .
.It Fl P Ar addr
arrange that subroutine calls to
.Ar addr
will behave as if there were an implementation of
.Xr putchar 3
at that address, writing the contents of the accumulator to stdout.
.It Fl R Ar addr
set the RST (hardware reset) vector. The processor will transfer
control to this address when emulated execution begins.
.It Fl s Ar addr Ar end Ar file
save the contents of memory from the address
.Ar addr
up to
.Ar end
(exclusive) to the given
.Ar file .
As with the
.Fl d
option,
.Ar end
can be absolute or '+' followed by a byte count.
.It Fl v
print version information and then exit.
.It Fl X Ar addr
arrange that any transfer of control to the address
.Ar addr
will cause an immediate exit with zero exit status.
.It Fl x
exit immediately. (Useful after
.Fl d
or when
.Nm run6502
is being used as a trivial 'image editor', with several
.Fl l
options followed by
.Fl s
and
.Fl x . )
.It Ar
following a
.Fl B
option, load one or more ROM image
files
into successive paged ROM slots. Other than the paging aspect, this
is equivalent to:
.Bd -ragged -offset indent
.Fl l Ar 8000 Ar image
.Ed
.El
.\" ----------------------------------------------------------------
.Sh EXAMPLES
.\"
.Ss A Very Simple Program
The
.Xr perl 1
command can be used to create a binary file from hexadecimal input:
.Bd -literal
echo a2418a20eeffe8e05bd0f7a90a20eeff00 |
perl -e 'print pack "H*",<STDIN>' > temp.img
.Ed
.Pp
The file can be loaded and executed with:
.Bd -literal
run6502 -l 1000 temp.img -R 1000 -P FFEE -X 0
.Ed
.Pp
The contents of the file can be inspected symbolically with:
.Bd -literal
run6502 -l 1000 temp.img -d 1000 +12
.Ed
.Pp
The options passed to
.Nm run6502
in the above examples have the following effects:
.Bl -tag -width offset
.It \-l 1000 temp.img
loads the file
.Pa temp.img
into memory at address 0x8000.
.It \-R 1000
sets the reset vector (the address of first instruction to be executed
after 'power on') to 0x1000.
.It \-P FFEE
arranges for calls to address 0xFFEE to behave as if there were an
implementation of
.Xr putchar 3
at that address.
.It \-X 0
arranges for transfers of control to address 0 to exit from the
emulator. This works in the above example because the final 'BRK'
instruction causes an implicit subroutine call through an
uninitialised interrupt vector to location 0. To see this
instruction...
.It \-d 1000 +12
disassembles 18 bytes of memory at address 0x8000.
.El
.Ss Standalone Images
The
.Fl i
option is designed for use in the 'interpreter command' appearing on
the first line of an executable script. Adding the line
.Bd -literal
#!run6502 -R 1000 -P FFEE -X 0 -i 1000
.Ed
.Pp
(with no leading spaces and a single trailing newline character)
to the
.Pa temp.img
file from the first example turns it into a script. If the file is
made executable with
.Bd -literal
chmod +x temp.img
.Ed
.Pp
it can be run like a standalone program:
.Bd -literal
./temp.img
.Ed
.Ss A Very Complex Program
Consider a pair of files named
.Pa os1.2
and
.Pa basic2
containing (legally-acquired, of course) ROM images of Acorn MOS 1.2
and BBC Basic 2. The following command loads each of the images into
memory at the appropriate address, cleans up the regions of memory
containing memory-mapped i/o on the BBC computer, saves a snapshot of
the entire memory to the file
.Pa image
and then exits:
.Bd -literal
run6502 -l C000 os1.2 -l 8000 basic2 -B -s0 +10000 image -x
.Ed
.Pp
Running the generated image with
.Bd -literal
run6502 image
.Ed
.Pp
will cold-start the emulated hardware, run the OS for a while, and
then drop into the language ROM. Basic programs can then be entered,
edited and run from the terminal.
.Pp
More details are given in the
.Pa README
file available in the
.Pa examples
directory of the distribution.
.Ss Exercises
Create a standalone image (one that can be run as a program, with
a '#!' interpreter line at the beginning) that contains Basic2 and
OS1.2 (as described above). This image should be no larger than 32K
(memory below 0x8000, which would be full of zeroes, should not appear
in the image file).
.\" ----------------------------------------------------------------
.Sh DIAGNOSTICS
.\"
If nothing goes wrong, none. Otherwise lots. They should be
self-explanatory. I'm too lazy to enumerate them.
.\" ----------------------------------------------------------------
.Sh COMPATIBILITY
.\"
See
.Xr lib6502 3
for a discussion of the emulated instruction set.
.\" ----------------------------------------------------------------
.Sh SEE ALSO
.\"
.Xr lib6502 3
.Pp
The file
.Pa examples/README
in the lib6502 distribution. (Depending on your system this may be
installed in
.Pa /usr/doc/lib6502 ,
.Pa /usr/local/doc/lib6502 ,
.Pa /usr/share/doc/lib6502 ,
or similar.)
.Pp
.Pa http://piumarta.com/software/lib6502
for updates and documentation.
.Pp
.Pa http://6502.org
for lots of 6502-related resources.
.\" ----------------------------------------------------------------
.Sh AUTHORS
.\"
The software and manual pages were written by
.An "Ian Piumarta" .
.Pp
The software is provided as-is, with absolutely no warranty, in the
hope that you will enjoy and benefit from it. You may use (entirely
at your own risk) and redistribute it under the terms of a very
liberal license that does not seek to restrict your rights in any way
(unlike certain so-called 'open source' licenses that significantly
limit your freedom in the name of 'free' software that is, ultimately,
anything but free). See the file COPYING for details.
.\" ----------------------------------------------------------------
.Sh BUGS
.\"
.Bl -bullet
.It
Options must appear one at a time.
.It
Any attempt (in a load or save operation) to transfer data beyond
0xFFFF is silently truncated at the end of memory.
.It
There is no way to specify the slot into which a ROM image should be
loaded, other than implicitly according to the order of arguments on
the command line.
.It
Execution can only be started via the emulated power-up reset. There
is no support for 'warm-starting' execution in an image at an
arbitrary address.
.It
Even though the emulator fully supports them, there is no way to
artificially generate a hardware interrupt request, non-maskable
interrupt, or reset condition. If you need these, read
.Xr lib6502 3
and write your own shell.
.It
The Acorn 'BBC Model B' hardware emulation is totally lame.
.El
.Pp
Please send bug reports (and feature requests) to the author at:
firstName (at) lastName (dot) com. (See
.Sx AUTHORS
above for suitable values of firstName and lastName.)

520
src/lib6502/run6502.c Normal file
View File

@ -0,0 +1,520 @@
/* run6502.c -- 6502 emulator shell -*- C -*- */
/* Copyright (c) 2005 Ian Piumarta
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the 'Software'),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, provided that the above copyright notice(s) and this
* permission notice appear in all copies of the Software and that both the
* above copyright notice(s) and this permission notice appear in supporting
* documentation.
*
* THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
*/
/* Last edited: 2005-11-02 01:18:58 by piumarta on margaux.local
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include "config.h"
#include "lib6502.h"
#define VERSION PACKAGE_NAME " " PACKAGE_VERSION " " PACKAGE_COPYRIGHT
typedef uint8_t byte;
typedef uint16_t word;
static char *program= 0;
static byte bank[0x10][0x4000];
void fail(const char *fmt, ...)
{
va_list ap;
fflush(stdout);
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
fprintf(stderr, "\n");
exit(1);
}
void pfail(const char *msg)
{
fflush(stdout);
perror(msg);
exit(1);
}
#define rts \
{ \
word pc; \
pc = mpu->memory[++mpu->registers->s + 0x100]; \
pc |= mpu->memory[++mpu->registers->s + 0x100] << 8; \
return pc + 1; \
}
int osword(M6502 *mpu, word address, byte data)
{
byte *params= mpu->memory + mpu->registers->x + (mpu->registers->y << 8);
switch (mpu->registers->a)
{
case 0x00: /* input line */
/* On entry: XY+0,1=>string area,
* XY+2=maximum line length,
* XY+3=minimum acceptable ASCII value,
* XY+4=maximum acceptable ASCII value.
* On exit: Y is the line length (excluding CR),
* C is set if Escape terminated input.
*/
{
word offset= params[0] + (params[1] << 8);
byte *buffer= mpu->memory + offset;
byte length= params[2], minVal= params[3], maxVal= params[4], b= 0;
if (!fgets(buffer, length, stdin))
{
putchar('\n');
exit(0);
}
for (b= 0; b < length; ++b)
if ((buffer[b] < minVal) || (buffer[b] > maxVal) || ('\n' == buffer[b]))
break;
buffer[b]= 13;
mpu->registers->y= b;
mpu->registers->p &= 0xFE;
break;
}
default:
{
char state[64];
M6502_dump(mpu, state);
fflush(stdout);
fprintf(stderr, "\nOSWORD %s\n", state);
fail("ABORT");
}
break;
}
rts;
}
int osbyte(M6502 *mpu, word address, byte data)
{
switch (mpu->registers->a)
{
case 0x7A: /* perform keyboard scan */
mpu->registers->x= 0x00;
break;
case 0x7E: /* acknowledge detection of escape condition */
return 1;
break;
case 0x82: /* read machine higher order address */
mpu->registers->y= 0x00;
mpu->registers->x= 0x00;
break;
case 0x83: /* read top of OS ram address (OSHWM) */
mpu->registers->y= 0x0E;
mpu->registers->x= 0x00;
break;
case 0x84: /* read bottom of display ram address */
mpu->registers->y= 0x80;
mpu->registers->x= 0x00;
break;
case 0x89: /* motor control */
break;
case 0xDA: /* read/write number of items in vdu queue (stored at 0x026A) */
return 0;
break;
default:
{
char state[64];
M6502_dump(mpu, state);
fflush(stdout);
fprintf(stderr, "\nOSBYTE %s\n", state);
fail("ABORT");
}
break;
}
rts;
}
int oscli(M6502 *mpu, word address, byte data)
{
byte *params= mpu->memory + mpu->registers->x + (mpu->registers->y << 8);
char command[1024], *ptr= command;
while (('*' == *params) || (' ' == *params))
++params;
while (13 != *params)
*ptr++= *params++;
*ptr= '\0';
system(command);
rts;
}
int oswrch(M6502 *mpu, word address, byte data)
{
switch (mpu->registers->a)
{
case 0x0C:
fputs("\033[2J\033[H", stdout);
break;
default:
putchar(mpu->registers->a);
break;
}
fflush(stdout);
rts;
}
static int writeROM(M6502 *mpu, word address, byte value)
{
return 0;
}
static int bankSelect(M6502 *mpu, word address, byte value)
{
memcpy(mpu->memory + 0x8000, bank[value & 0x0F], 0x4000);
return 0;
}
static int doBtraps(int argc, char **argv, M6502 *mpu)
{
unsigned addr;
/* Acorn Model B ROM and memory-mapped IO */
for (addr= 0x8000; addr <= 0xFBFF; ++addr) mpu->callbacks->write[addr]= writeROM;
for (addr= 0xFC00; addr <= 0xFEFF; ++addr) mpu->memory[addr]= 0xFF;
for (addr= 0xFE30; addr <= 0xFE33; ++addr) mpu->callbacks->write[addr]= bankSelect;
for (addr= 0xFE40; addr <= 0xFE4F; ++addr) mpu->memory[addr]= 0x00;
for (addr= 0xFF00; addr <= 0xFFFF; ++addr) mpu->callbacks->write[addr]= writeROM;
/* anything already loaded at 0x8000 appears in bank 0 */
memcpy(bank[0x00], mpu->memory + 0x8000, 0x4000);
/* fake a few interesting OS calls */
# define trap(vec, addr, func) mpu->callbacks->call[addr]= (func)
trap(0x020C, 0xFFF1, osword);
trap(0x020A, 0xFFF4, osbyte);
//trap(0x0208, 0xFFF7, oscli ); /* enable this to send '*COMMAND's to system(3) :-) */
trap(0x020E, 0xFFEE, oswrch);
trap(0x020E, 0xE0A4, oswrch); /* NVWRCH */
#undef trap
return 0;
}
static void usage(int status)
{
FILE *stream= status ? stderr : stdout;
fprintf(stream, VERSION"\n");
fprintf(stream, "please send bug reports to: %s\n", PACKAGE_BUGREPORT);
fprintf(stream, "\n");
fprintf(stream, "usage: %s [option ...]\n", program);
fprintf(stream, " %s [option ...] -B [image ...]\n", program);
fprintf(stream, " -B -- minimal Acorn 'BBC Model B' compatibility\n");
fprintf(stream, " -d addr last -- dump memory between addr and last\n");
fprintf(stream, " -G addr -- emulate getchar(3) at addr\n");
fprintf(stream, " -h -- help (print this message)\n");
fprintf(stream, " -I addr -- set IRQ vector\n");
fprintf(stream, " -l addr file -- load file at addr\n");
fprintf(stream, " -M addr -- emulate memory-mapped stdio at addr\n");
fprintf(stream, " -N addr -- set NMI vector\n");
fprintf(stream, " -P addr -- emulate putchar(3) at addr\n");
fprintf(stream, " -R addr -- set RST vector\n");
fprintf(stream, " -s addr last file -- save memory from addr to last in file\n");
fprintf(stream, " -v -- print version number then exit\n");
fprintf(stream, " -X addr -- terminate emulation if PC reaches addr\n");
fprintf(stream, " -x -- exit wihout further ado\n");
fprintf(stream, " image -- '-l 8000 image' in available ROM slot\n");
fprintf(stream, "\n");
fprintf(stream, "'last' can be an address (non-inclusive) or '+size' (in bytes)\n");
exit(status);
}
static int doHelp(int argc, char **argv, M6502 *mpu)
{
usage(0);
return 0;
}
static int doVersion(int argc, char **argv, M6502 *mpu)
{
puts(VERSION);
exit(0);
return 0;
}
static unsigned long htol(char *hex)
{
char *end;
unsigned long l= strtol(hex, &end, 16);
if (*end) fail("bad hex number: %s", hex);
return l;
}
static int loadInterpreter(M6502 *mpu, word start, const char *path)
{
FILE *file= 0;
int count= 0;
byte *memory= mpu->memory + start;
size_t max= 0x10000 - start;
int c= 0;
if ((!(file= fopen(path, "r"))) || ('#' != fgetc(file)) || ('!' != fgetc(file)))
return 0;
while ((c= fgetc(file)) >= ' ')
;
while ((count= fread(memory, 1, max, file)) > 0)
{
memory += count;
max -= count;
}
fclose(file);
return 1;
}
static int save(M6502 *mpu, word address, unsigned length, const char *path)
{
FILE *file= 0;
int count= 0;
if (!(file= fopen(path, "w")))
return 0;
while ((count= fwrite(mpu->memory + address, 1, length, file)))
{
address += count;
length -= count;
}
fclose(file);
return 1;
}
static int load(M6502 *mpu, word address, const char *path)
{
FILE *file= 0;
int count= 0;
size_t max= 0x10000 - address;
if (!(file= fopen(path, "r")))
return 0;
while ((count= fread(mpu->memory + address, 1, max, file)) > 0)
{
address += count;
max -= count;
}
fclose(file);
return 1;
}
static int doLoadInterpreter(int argc, char **argv, M6502 *mpu)
{
if (argc < 3) usage(1);
if (!loadInterpreter(mpu, htol(argv[1]), argv[2])) pfail(argv[2]);
return 2;
}
static int doLoad(int argc, char **argv, M6502 *mpu) /* -l addr file */
{
if (argc < 3) usage(1);
if (!load(mpu, htol(argv[1]), argv[2])) pfail(argv[2]);
return 2;
}
static int doSave(int argc, char **argv, M6502 *mpu) /* -l addr size file */
{
if (argc < 4) usage(1);
if (!save(mpu, htol(argv[1]), htol(argv[2]), argv[3])) pfail(argv[3]);
return 3;
}
#define doVEC(VEC) \
static int do##VEC(int argc, char **argv, M6502 *mpu) \
{ \
unsigned addr= 0; \
if (argc < 2) usage(1); \
addr= htol(argv[1]); \
M6502_setVector(mpu, VEC, addr); \
return 1; \
}
doVEC(IRQ);
doVEC(NMI);
doVEC(RST);
#undef doVEC
static int gTrap(M6502 *mpu, word addr, byte data) { mpu->registers->a= getchar(); rts; }
static int pTrap(M6502 *mpu, word addr, byte data) { putchar(mpu->registers->a); rts; }
static int doGtrap(int argc, char **argv, M6502 *mpu)
{
unsigned addr;
if (argc < 2) usage(1);
addr= htol(argv[1]);
M6502_setCallback(mpu, call, addr, gTrap);
return 1;
}
static int doPtrap(int argc, char **argv, M6502 *mpu)
{
unsigned addr;
if (argc < 2) usage(1);
addr= htol(argv[1]);
M6502_setCallback(mpu, call, addr, pTrap);
return 1;
}
static int mTrapRead(M6502 *mpu, word addr, byte data) { return getchar(); }
static int mTrapWrite(M6502 *mpu, word addr, byte data) { return putchar(data); }
static int doMtrap(int argc, char **argv, M6502 *mpu)
{
unsigned addr= 0;
if (argc < 2) usage(1);
addr= htol(argv[1]);
M6502_setCallback(mpu, read, addr, mTrapRead);
M6502_setCallback(mpu, write, addr, mTrapWrite);
return 1;
}
static int xTrap(M6502 *mpu, word addr, byte data) { exit(0); return 0; }
static int doXtrap(int argc, char **argv, M6502 *mpu)
{
unsigned addr= 0;
if (argc < 2) usage(1);
addr= htol(argv[1]);
M6502_setCallback(mpu, call, addr, xTrap);
return 1;
}
static int doDisassemble(int argc, char **argv, M6502 *mpu)
{
unsigned addr= 0, last= 0;
if (argc < 3) usage(1);
addr= htol(argv[1]);
last= ('+' == *argv[2]) ? addr + htol(1 + argv[2]) : htol(argv[2]);
while (addr < last)
{
char insn[64];
int i= 0, size= M6502_disassemble(mpu, addr, insn);
printf("%04X ", addr);
while (i++ < size) printf("%02X", mpu->memory[addr + i - 1]);
while (i++ < 4) printf(" ");
putchar(' ');
i= 0;
while (i++ < size) putchar(isgraph(mpu->memory[addr + i - 1]) ? mpu->memory[addr + i - 1] : ' ');
while (i++ < 4) putchar(' ');
printf(" %s\n", insn);
addr += size;
}
return 2;
}
int main(int argc, char **argv)
{
M6502 *mpu= M6502_new(0, 0, 0);
int bTraps= 0;
program= argv[0];
if ((2 == argc) && ('-' != *argv[1]))
{
if ((!loadInterpreter(mpu, 0, argv[1])) && (!load(mpu, 0, argv[1])))
pfail(argv[1]);
doBtraps(0, 0, mpu);
}
else
while (++argv, --argc > 0)
{
int n= 0;
if (!strcmp(*argv, "-B")) bTraps= 1;
else if (!strcmp(*argv, "-d")) n= doDisassemble(argc, argv, mpu);
else if (!strcmp(*argv, "-G")) n= doGtrap(argc, argv, mpu);
else if (!strcmp(*argv, "-h")) n= doHelp(argc, argv, mpu);
else if (!strcmp(*argv, "-i")) n= doLoadInterpreter(argc, argv, mpu);
else if (!strcmp(*argv, "-I")) n= doIRQ(argc, argv, mpu);
else if (!strcmp(*argv, "-l")) n= doLoad(argc, argv, mpu);
else if (!strcmp(*argv, "-M")) n= doMtrap(argc, argv, mpu);
else if (!strcmp(*argv, "-N")) n= doNMI(argc, argv, mpu);
else if (!strcmp(*argv, "-P")) n= doPtrap(argc, argv, mpu);
else if (!strcmp(*argv, "-R")) n= doRST(argc, argv, mpu);
else if (!strcmp(*argv, "-s")) n= doSave(argc, argv, mpu);
else if (!strcmp(*argv, "-v")) n= doVersion(argc, argv, mpu);
else if (!strcmp(*argv, "-X")) n= doXtrap(argc, argv, mpu);
else if (!strcmp(*argv, "-x")) exit(0);
else if ('-' == **argv) usage(1);
else
{
/* doBtraps() left 0x8000+0x4000 in bank 0, so load */
/* additional images starting at 15 and work down */
static int bankSel= 0x0F;
if (!bTraps) usage(1);
if (bankSel < 0) fail("too many images");
if (!load(mpu, 0x8000, argv[0])) pfail(argv[0]);
memcpy(bank[bankSel--],
0x8000 + mpu->memory,
0x4000);
n= 1;
}
argc -= n;
argv += n;
}
if (bTraps)
doBtraps(0, 0, mpu);
M6502_reset(mpu);
M6502_run(mpu);
M6502_delete(mpu);
return 0;
}

View File

@ -1,4 +1,5 @@
include "inc/cmdsys.plh"
include "inc/conio.plh"
sysflags nojitc // Keep tone() from compiling and sounding different
//
// Handy constants.
@ -34,24 +35,6 @@ const page2 = 1
//
const ENV_REG = $FFDF
//
// 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)
@ -97,6 +80,7 @@ word = $0850,$08D0,$0950,$09D0,$0A50,$0AD0,$0B50,$0BD0
byte textbwmode[] = 2, 16, 0
byte textclrmode[] = 2, 16, 1
byte grcharset[] = 1, 0, $7F, $7F, $7F, $7F, $00, $00, $00, $00
byte a3keyqueue = 0
//
// Random number for Apple 1 and III.
//
@ -168,7 +152,13 @@ end
// Apple 1 routines.
//
def a1keypressed
return ^$D011 >= 128
return ^$D011 >= 128 ?? ^$D011 :: 0
end
def a1getkey
while not a1keypressed
randnum = randnum + 123
loop
return getc()
end
def a12echo(state)
return 0
@ -215,7 +205,7 @@ end
// Apple II routines.
//
def a2keypressed
return ^keyboard >= 128
return ^keyboard >= 128 ?? ^keyboard :: 0
end
def a2home
//curshpos = 0
@ -238,7 +228,7 @@ def a2viewport(left, top, width, height)
^$20 = left
^$21 = width
^$22 = top
^$23 = height + top - 1
^$23 = height + top
return a2gotoxy(0, 0)
end
def a2texttype(type)
@ -295,8 +285,22 @@ def dev_status(devnum, code, list)
end
def a3keypressed
byte count
dev_status(cmdsys.devcons, 5, @count)
return count
if count
a3keyqueue = getc
fin
return a3keyqueue ?? a3keyqueue | $80 :: 0
end
def a3getkey
byte keycode
repeat
randnum = randnum + 123
a3keypressed
keycode = a3keyqueue
until keycode
a3keyqueue = 0
return keycode
end
def a3echo(state)
return dev_control(cmdsys.devcons, 11, @state)
@ -379,12 +383,6 @@ end
//
// Apple 1 and III combined routines.
//
def a13getkey
while not conio:keypressed()
randnum = randnum + 123
loop
return getc()
end
def a13rnd
randnum = (randnum << 1) + randnum + 123
return randnum & $7FFF
@ -395,7 +393,7 @@ end
when MACHID & MACHID_MODEL
is MACHID_III
conio:keypressed = @a3keypressed
conio:getkey = @a13getkey
conio:getkey = @a3getkey
conio:echo = @a3echo
conio:home = @a3home
conio:gotoxy = @a3gotoxy
@ -408,7 +406,7 @@ when MACHID & MACHID_MODEL
break
is MACHID_I
conio:keypressed = @a1keypressed
conio:getkey = @a13getkey
conio:getkey = @a1getkey
conio:home = @a1home
conio:gotoxy = @a1gotoxy
conio:viewport = @a1viewport
@ -420,4 +418,8 @@ when MACHID & MACHID_MODEL
break
otherwise // MACHID_II puts("Found MACHID_MODEL = $"); putb(MACHID & MACHID_MODEL); putln
wend
//
// Keep module in memory
//
return modkeep
done

View File

@ -52,10 +52,10 @@ end
//
export asm dgrPlot(x, y)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
LDA $3000
STA SRCL
LDA $3001
STA SRCH
STA SRCH
STX ESP
LDA ESTKL,X ; Y COORD
AND #$FE
@ -84,10 +84,10 @@ end
//
export asm dgrHLin(x1, x2, y)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
LDA $3000
STA SRCL
LDA $3001
STA SRCH
STA SRCH
STX ESP
LDA ESTKL+1,X ; X2 COORD
STA TMPH
@ -126,10 +126,10 @@ end
//
export asm dgrVLin(y1, y2, x)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
LDA $3000
STA SRCL
LDA $3001
STA SRCH
STA SRCH
STX ESP
LDA ESTKL+2,X ; Y1 COORD
PHP
@ -165,10 +165,10 @@ end
//
export asm dgrBLT(x, y, width, height, src)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
LDA $3000
STA DSTL
LDA $3001
STA DSTH
STA DSTH
LDA ESTKL,X ; SPRITE
STA SRCL
LDA ESTKH,X
@ -325,10 +325,10 @@ end
//
export asm dgrTile(x, y, src)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
LDA $3000
STA DSTL
LDA $3001
STA DSTH
STA DSTH
STX ESP
LDA ESTKL,X ; TILE
STA SRCL
@ -492,39 +492,23 @@ asm _dgrFillTile
RTS
end
//
// Wait for VLB - Only IIe/IIGS.
// Wait for VLB
//
asm vlbWait#0
export asm dgrVLB#0
PHP
SEI
STA $C079 ; Enable IOU access and reset VBL int on //c
STA $C05B ; Enable VBL int
- LDA $C019
STA $C079 ; Reset VBL int on //c
BMI -
- LDA $C019
BPL -
STA $C05A ; Disable VBL int on //c
STA $C078 ; Disable IOU access on //c
PLP
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
//
// wait for VBL:
// - bit $C019
// bpl -
// lda $C070 ; $c019 bit 7 is sticky, reset it
//
// 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
//
@ -536,32 +520,48 @@ export def dgrClear(clr)#0
dgrFill(0, 0, @clrtile)
end
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
^show40 = 0
^mapmain = 0
^an3off
call($FC58, 0, 0, 0, 0) // home()
return 0
when mode
is page1
//
// Set double lores graphics, return draw buffer
//
^showlores
^showfull
^showgraphics
^showpage1
^ena80 = 0
^show80 = 0
^an3on
drawpage = page2
drawbuff = dgrbuff[page2]
break
is page2
//
// Set double lores graphics, return draw buffer
//
^showlores
^showfull
^showgraphics
^showpage1
^ena80 = 0
^show80 = 0
^an3on
drawpage = page1
drawbuff = dgrbuff[page1]
break
otherwise
//
// Set text mode
//
^showtext
^showpage1
^ena80 = 0
^show40 = 0
^mapmain = 0
^an3off
call($FC58, 0, 0, 0, 0) // home()
wend
return mode
end
//
// Set display page, return other page
@ -623,4 +623,8 @@ dgrTile:1 = @drawbuff
dgrTile:6 = @drawbuff+1
// Put read AUX mem routine in scary location
memcpy($0100, @auxRead, 9)
//
// Keep module in memory
//
return modkeep
done

View File

@ -0,0 +1,277 @@
include "inc/cmdsys.plh"
include "inc/lines.plh"
sysflags resxtxt1|reshgr1|resxhgr1
//
// Apple II graphics soft switches
//
const store80dis = $C000
const store80ena = $C001
const show40col = $C00C
const show80col = $C00D
const showgraphics = $C050
const showtext = $C051
const showfull = $C052
const showmix = $C053
const page1m = $C054
const page1x = $C055
const showhires = $C057
const dhresena = $C05E
const dhresdis = $C05F
const IOUdis = $C07E
const IOUena = $C07F
//
// HiRes scanline addresses
//
word hgrscan[] = $2000,$2400,$2800,$2C00,$3000,$3400,$3800,$3C00
word = $2080,$2480,$2880,$2C80,$3080,$3480,$3880,$3C80
word = $2100,$2500,$2900,$2D00,$3100,$3500,$3900,$3D00
word = $2180,$2580,$2980,$2D80,$3180,$3580,$3980,$3D80
word = $2200,$2600,$2A00,$2E00,$3200,$3600,$3A00,$3E00
word = $2280,$2680,$2A80,$2E80,$3280,$3680,$3A80,$3E80
word = $2300,$2700,$2B00,$2F00,$3300,$3700,$3B00,$3F00
word = $2380,$2780,$2B80,$2F80,$3380,$3780,$3B80,$3F80
word = $2028,$2428,$2828,$2C28,$3028,$3428,$3828,$3C28
word = $20A8,$24A8,$28A8,$2CA8,$30A8,$34A8,$38A8,$3CA8
word = $2128,$2528,$2928,$2D28,$3128,$3528,$3928,$3D28
word = $21A8,$25A8,$29A8,$2DA8,$31A8,$35A8,$39A8,$3DA8
word = $2228,$2628,$2A28,$2E28,$3228,$3628,$3A28,$3E28
word = $22A8,$26A8,$2AA8,$2EA8,$32A8,$36A8,$3AA8,$3EA8
word = $2328,$2728,$2B28,$2F28,$3328,$3728,$3B28,$3F28
word = $23A8,$27A8,$2BA8,$2FA8,$33A8,$37A8,$3BA8,$3FA8
word = $2050,$2450,$2850,$2C50,$3050,$3450,$3850,$3C50
word = $20D0,$24D0,$28D0,$2CD0,$30D0,$34D0,$38D0,$3CD0
word = $2150,$2550,$2950,$2D50,$3150,$3550,$3950,$3D50
word = $21D0,$25D0,$29D0,$2DD0,$31D0,$35D0,$39D0,$3DD0
word = $2250,$2650,$2A50,$2E50,$3250,$3650,$3A50,$3E50
word = $22D0,$26D0,$2AD0,$2ED0,$32D0,$36D0,$3AD0,$3ED0
word = $2350,$2750,$2B50,$2F50,$3350,$3750,$3B50,$3F50
word = $23D0,$27D0,$2BD0,$2FD0,$33D0,$37D0,$3BD0,$3FD0
//
// Pixel masks for 7 contiguous pixels
//
word auxmask[] = $000F
word = $0070
word = $0000
word = $0300
word = $3C00
word = $4000
word = $0000
word memmask[] = $0000
word = $0001
word = $001E
word = $0060
word = $0000
word = $0700
word = $7800
//
// Solid colors
//
word auxclrs[] = $0000 // black
word = $2208 // magenta
word = $1144 // brown
word = $334C // orange
word = $0822 // dark green
word = $2A2A // gray 1
word = $1966 // green
word = $3B6E // yellow
word = $4411 // dark blue
word = $6619 // purple
word = $5555 // gray 2
word = $775D // pink
word = $4C33 // medium blue
word = $6E3B // light blue
word = $5D77 // aqua
word = $7F7F // white
word memclrs[] = $0000 // black
word = $4411 // magenta
word = $2208 // brown
word = $6619 // orange
word = $1144 // dark green
word = $5555 // gray 1
word = $334C // green
word = $775D // yellow
word = $0822 // dark blue
word = $4C33 // purple
word = $2A2A // gray 2
word = $6E3B // pink
word = $1966 // medium blue
word = $5D77 // light blue
word = $3B6E // aqua
word = $7F7F // white
word auxclr, memclr
//
// Modulo 7
//
byte mod7[] = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
//
// Divide 7
//
byte div7x2[] = 0, 0, 0, 0, 0, 0, 0
byte = 2, 2, 2, 2, 2, 2, 2
byte = 4, 4, 4, 4, 4, 4, 4
byte = 6, 6, 6, 6, 6, 6, 6
byte = 8, 8, 8, 8, 8, 8, 8
byte =10,10,10,10,10,10,10
byte =12,12,12,12,12,12,12
byte =14,14,14,14,14,14,14
byte =16,16,16,16,16,16,16
byte =18,18,18,18,18,18,18
byte =20,20,20,20,20,20,20
byte =22,22,22,22,22,22,22
byte =24,24,24,24,24,24,24
byte =26,26,26,26,26,26,26
byte =28,28,28,28,28,28,28
byte =30,30,30,30,30,30,30
byte =32,32,32,32,32,32,32
byte =34,34,34,34,34,34,34
byte =36,36,36,36,36,36,36
byte =38,38,38,38,38,38,38
def dhgrColor(c)#0
auxclr = auxclrs[c & $0F]
memclr = memclrs[c & $0F]
end
def dhgrPlot(x, y)#0
byte pix7
word pix7addr, mask
pix7addr = hgrscan[y] + div7x2[x]
pix7 = mod7[x]
mask = auxmask[pix7]
if mask
^page1x
*pix7addr = (*pix7addr & ~mask) | (mask & auxclr)
fin
mask = memmask[pix7]
if mask
^page1m
*pix7addr = (*pix7addr & ~mask) | (mask & memclr)
fin
end
def dhgrTile(x7, y8, tileptr)#0
word tileaddr
byte scan
tileaddr = hgrscan[y8 * 8] + x7 * 2
for scan = 0 to 7
^page1x
*tileaddr = *tileptr
tileptr = tileptr + 2
^page1m
*tileaddr = *tileptr
tileptr = tileptr + 2
tileaddr = tileaddr + $0400
next
end
def dhgrDst(x7, y, w7, h, dstptr)#0
word pix7addr
byte scan, b
for scan = y to y+h-1
pix7addr = hgrscan[scan] + x7 * 2
for b = 1 to w7
^page1x
*dstptr = *pix7addr
dstptr = dstptr + 2
^page1m
*dstptr = *pix7addr
dstptr = dstptr + 2
pix7addr = pix7addr + 2
next
next
end
def dhgrSrc(x7, y, w7, h, srcptr)#0
word pix7addr
byte scan, b
for scan = y to y+h-1
pix7addr = hgrscan[scan] + x7 * 2
for b = 1 to w7
^page1x
*pix7addr = *srcptr
srcptr = srcptr + 2
^page1m
*pix7addr = *srcptr
srcptr = srcptr + 2
pix7addr = pix7addr + 2
next
next
end
def dhgrMode(mode)
if mode == 0
^page1m
^showfull
^showhires
^showgraphics
^IOUdis = 0
^show80col = 0
^dhresena
^store80ena = 0
^page1m
memset($2000, 0, $2000)
^page1x
memset($2000, 0, $2000)
else
^store80dis = 0
^dhresdis
^show40col = 0
^showtext
^page1m
fin
return mode
end
def dhgrTest#0
byte i, j
word pixblk
setlineplot(@dhgrPlot)
for i = 0 to 191 step 4
dhgrColor(i)
line(0, 0, 139, i)
next
for i = 139 downto 0 step 4
dhgrColor(i)
line(0, 0, i, 191)
next
pixblk = heapalloc(16/2*20)
dhgrDst(0, 0, 2, 20, pixblk)
for i = 1 to 170
dhgrSrc(0, i, 2, 20, pixblk)
next
dhgrDst(0, 0, 1, 8, pixblk) // Create tile
for j = 0 to 19
for i = 0 to 19
dhgrTile(i, j, pixblk)
next
next
while ^$C000 < 128
loop
^$C010
end
dhgrmode(0)
dhgrtest
dhgrmode(-1)
done

View File

@ -1,4 +1,5 @@
include "inc/cmdsys.plh"
include "inc/fileio.plh"
//
// CFFA1 addresses.
//
@ -22,34 +23,14 @@ const sysbuf = $0800
//
// External interface
//
struc t_fileio
word getpfx
word setpfx
word getfileinfo
word setfileinfo
word geteof
word seteof
word iobufalloc
word open
word close
word read
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), a2setfileinfo(path, fileinfo), a23geteof(refnum)#2, a23seteof(refnum, eofl, eofh), a2iobufs(iobufs), a2open(path), a2close(refnum)
predef a2getpfx(path), a2setpfx(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, @a2setfileinfo, @a23geteof, @a23seteof, @a2iobufs, @a2open, @a2close
word = @a2getpfx, @a2setpfx, @a2getfileinfo, @a2setfileinfo, @a23geteof, @a23seteof, @a2iobufs, @a2open, @a2close
word = @a23read, @a2write, @a2create, @a23destroy, @a23rename
word = @a2newline, @a2online, @a2readblock, @a2writeblock
//
@ -79,7 +60,7 @@ def a2getpfx(path)
return path
end
def a3getpfx(path)
byte params[3]
byte params[4]
params.0 = 2
params:1 = path
@ -90,7 +71,7 @@ end
def a1setpfx(path)
return path
end
def a23setpfx(path)
def a2setpfx(path)
byte params[3]
params.0 = 1
@ -98,6 +79,29 @@ def a23setpfx(path)
perr = syscall($C6, @params)
return path
end
def a3setpfx(path)
byte params[6]
byte fileinfo[2]
char fullpath[65]
if ^path and ^(path + 1) <> '/' and ^(path + 1) <> '.'
a3getpfx(@fullpath)
strcat(@fullpath, path)
path = @fullpath
fin
params.0 = 3
params:1 = path
params:3 = @fileinfo
params.5 = 2
if not syscall($C4, @params) and (fileinfo.1 == $00 or fileinfo.1 == $0F) // Make sure it's a directory
params.0 = 1
params:1 = path
syscall($C6, @params)
else
a3getpfx(path) // Get current path
fin
return path
end
def a1getfileinfo(path, fileinfo)
perr = $01
return perr
@ -209,9 +213,9 @@ def a13iobufs(iobufs)
end
def a2open(path)
byte i, params[6]
for i = 0 to MAX_IOBUFS-1
if iobuf_addr[i] and not iobuf_ref[i]
for i = MAX_IOBUFS-1 downto 0
if iobuf_addr[i] and not iobuf_ref[i]
params.0 = 3
params:1 = path
params:3 = iobuf_addr[i]
@ -240,7 +244,7 @@ end
def a2close(refnum)
byte i, params[2]
for i = 0 to MAX_IOBUFS-1
for i = MAX_IOBUFS-1 downto 0
if refnum == iobuf_ref[i]
iobuf_ref[i] = 0
params.0 = 1
@ -396,7 +400,7 @@ def a3volume(unit, volname)
byte devname[17]
byte info[11]
byte params[9]
^volname = 0
params.0 = 4
params.1 = unit
@ -464,6 +468,7 @@ end
when MACHID & MACHID_MODEL
is MACHID_III
fileio:getpfx = @a3getpfx
fileio:setpfx = @a3setpfx
fileio:getfileinfo = @a3getfileinfo
fileio:setfileinfo = @a3setfileinfo
fileio:iobufalloc = @a13iobufs
@ -498,4 +503,8 @@ when MACHID & MACHID_MODEL
break
otherwise // Apple ][
wend
//
// Keep module in memory
//
return modkeep
done

View File

@ -2,6 +2,7 @@ include "inc/cmdsys.plh"
byte gfxref, gfxseg
byte params[8], cmd[16]
byte textmode[] = 16, 0, 15
export def pencolor(clr)#0
params:4 = 2
@ -112,6 +113,31 @@ export def drawmode(mode)#0
syscall($CB, @params)
end
def gfxopen#1
//
// 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
return gfxref <> 0
end
export def setmode(mode)#0
if mode < 0
//
@ -122,15 +148,19 @@ export def setmode(mode)#0
syscall($CC, @params)
gfxref = 0
//
// Deaalocate bank 0
// Deallocate bank 0
//
params.0 = 1
params.1 = gfxseg
syscall($45, @params)
^$1907 = $00 // Unset graphics pages allocated
fin
if not gfxref
//
// Reset textmode
//
cmdsys:syswrite(cmdsys.refcons, @textmode, 3)
return
elsif not gfxref
gfxopen
fin
params.0 = 3
params.1 = gfxref
@ -151,24 +181,7 @@ if MACHID <> $F2
return -1
fin
//
// Allocate bank 0
// Keep module in memory
//
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
return gfxopen ?? modkeep :: -1
done

View File

@ -45,10 +45,10 @@ end
//
export asm grPlot(x, y)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
LDA $3000
STA SRCL
LDA $3001
STA SRCH
STA SRCH
LDA ESTKL,X ; Y COORD
AND #$FE
TAY
@ -78,10 +78,10 @@ end
//
export asm grHLin(x1, x2, y)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
LDA $3000
STA SRCL
LDA $3001
STA SRCH
STA SRCH
LDA ESTKL+1,X ; X2 COORD
STA TMPH
LDA ESTKL+0,X ; Y COORD
@ -120,10 +120,10 @@ end
//
export asm grVLin(y1, y2, x)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
LDA $3000
STA SRCL
LDA $3001
STA SRCH
STA SRCH
LDA ESTKL+2,X ; Y1 COORD
- AND #$FE
TAY
@ -160,10 +160,10 @@ end
//
export asm grBLT(x, y, width, height, src)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
LDA $3000
STA DSTL
LDA $3001
STA DSTH
STA DSTH
LDA ESTKL,X ; SPRITE
STA SRCL
LDA ESTKH,X
@ -252,10 +252,10 @@ end
//
export asm grTile(x, y, src)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
LDA $3000
STA DSTL
LDA $3001
STA DSTH
STA DSTH
STX ESP
LDA ESTKL,X ; TILE
STA SRCL
@ -407,6 +407,28 @@ asm _grFillTile
RTS
end
//
// Wait for VLB
//
export asm grVLB#0
LDA $BF98
AND #$C0
CMP #$80
BNE +
PHP
SEI
STA $C079 ; Enable IOU access and reset VBL int on //c
STA $C05B ; Enable VBL int
- LDA $C019
STA $C079 ; Reset VBL int on //c
BMI -
- LDA $C019
BPL -
STA $C05A ; Disable VBL int on //c
STA $C078 ; Disable IOU access on //c
PLP
+ RTS
end
//
// Clear the buffer
//
export def grClear(clr)#0
@ -421,33 +443,50 @@ 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
when mode
is page1
//
// Set GR mode
//
^showlores
^showfull
^showgraphics
^showpage1
^ena80 = 0
^show40 = 0
^mapmain = 0
^an3off
drawpage = page2
drawbuff = grbuff[page2]
break
is page2
//
// Set GR mode
//
^showlores
^showfull
^showgraphics
^showpage2
^ena80 = 0
^show40 = 0
^mapmain = 0
^an3off
drawpage = page1
drawbuff = grbuff[page1]
break
otherwise
//
// Set text mode
//
^showtext
^showpage1
^ena80 = 0
^show40 = 0
^mapmain = 0
^an3off
call($FC58, 0, 0, 0, 0) // home()
wend
return mode
end
//
// Set display page, return other page
@ -458,6 +497,7 @@ export def grShow(page)#1
return page ^ 1
end
export def grSwap#0
//vlbWait
^(showpage1 + drawpage)
drawpage = drawpage ^ 1
drawbuff = grbuff[drawpage]
@ -490,4 +530,8 @@ grBLT:1 = @drawbuff
grBLT:6 = @drawbuff+1
grTile:1 = @drawbuff
grTile:6 = @drawbuff+1
//
// Keep module in memory
//
return modkeep
done

View File

@ -1,3 +1,4 @@
include "inc/cmdsys.plh"
include "inc/hgrtile.plh"
//
// Apple //e hires character font
@ -137,4 +138,8 @@ byte = $00,$2C,$1A,$00,$00,$00,$00,$00,$00,$2A,$14,$2A,$14,$2A,$00,$00
export def hgrPutStr(x, y, strptr)#0
tileDrawStr(x, y, strptr + 1, ^strptr, @hgrFont + 1024) // Offset into regular char
end
//
// Keep module in memory
//
return modkeep
done

View File

@ -16,6 +16,13 @@ const hgr1 = $2000
const hgr2 = $4000
const page1 = 0
const page2 = 1
//
// Apple III hardware constants.
//
const ENV_REG = $FFDF
//
// Screen addresses
//
word hgrbuff[] = hgr1, hgr2
//word hgrscan[] = $0000,$0400,$0800,$0C00,$1000,$1400,$1800,$1C00
//word = $0080,$0480,$0880,$0C80,$1080,$1480,$1880,$1C80
@ -114,7 +121,7 @@ export asm divmod7(x)#2
BCC +
LDY #40 ; > 512 SO CLIP AT MAX
LDA #00
BEQ +++
BEQ +++
+ CMP #140
BCC +
++ SEC
@ -325,7 +332,7 @@ export asm hgrCopySrc(ofst, y, w, h, srcptr)#0
; LDA ESTKL+0,X ; SRC PTR
; STA SRCL
; LDA ESTKH+0,X
; STA SRCH
; STA SRCH
-- LDY ESTKL+3,X ; Y COORD
LDA ESTKL+4,X ; HORIZ OFFSET
CLC
@ -376,7 +383,7 @@ export asm hgrAndSrc(ofst, y, w, h, srcptr)#0
; LDA ESTKL+0,X ; SRC PTR
; STA SRCL
; LDA ESTKH+0,X
; STA SRCH
; STA SRCH
-- LDY ESTKL+3,X ; Y COORD
LDA ESTKL+4,X ; HORIZ OFFSET
CLC
@ -428,7 +435,7 @@ export asm hgrXorSrc(ofst, y, w, h, srcptr)#0
; LDA ESTKL+0,X ; SRC PTR
; STA SRCL
; LDA ESTKH+0,X
; STA SRCH
; STA SRCH
-- LDY ESTKL+3,X ; Y COORD
LDA ESTKL+4,X ; HORIZ OFFSET
CLC
@ -480,7 +487,7 @@ export asm hgrOrSrc(ofst, y, w, h, srcptr)#0
; LDA ESTKL+0,X ; SRC PTR
; STA SRCL
; LDA ESTKH+0,X
; STA SRCH
; STA SRCH
-- LDY ESTKL+3,X ; Y COORD
LDA ESTKL+4,X ; HORIZ OFFSET
CLC
@ -517,7 +524,7 @@ end
//export def hgrPlot(x, y)#0
// word pixptr
// byte ofst, pixofst, pmask
//
//
// ofst, pixofst = divmod7(x)
// pixptr = hgrscan[y] + drawbuff + ofst
// pmask = hbmask[pixofst]
@ -563,7 +570,7 @@ end
//export def hgrXorPlot(x, y)#0
// word pixptr
// byte ofst, pixofst, pmask
//
//
// ofst, pixofst = divmod7(x)
// pixptr = hgrscan[y] + drawbuff + ofst
// pmask = hbmask[pixofst]
@ -608,7 +615,7 @@ end
//export def hgrOrPlot(x, y)#0
// word pixptr
// byte ofst, pixofst, pmask
//
//
// ofst, pixofst = divmod7(x)
// pixptr = hgrscan[y] + drawbuff + ofst
// pmask = hbmask[pixofst]
@ -654,7 +661,7 @@ end
// word pixptr, x
// byte lofst, lpixofst, lpmask
// byte rofst, rpixofst, rpmask
//
//
// if x1 == x2
// hgrPlot(x1, y)
// else
@ -772,7 +779,7 @@ end
// word pixptr, x
// byte lofst, lpixofst, lpmask
// byte rofst, rpixofst, rpmask
//
//
// if x1 == x2
// hgrPlot(x1, y)
// else
@ -887,7 +894,7 @@ end
//export def hgrVlin(y1, y2, x)#0
// word pixptr, y, ofst
// byte pixofst, pmask, cmask
//
//
// if y1 == y2
// hgrPlot(x, y1)
// else
@ -918,7 +925,7 @@ end
asm _hgrVLinB
LDA $2000,Y ; CURHCLR
AND TMPL
STA TMPL
STA TMPL
LDY ESTKL+3,X ; Y1 COORD
end
asm _hgrVLinC
@ -947,7 +954,7 @@ end
//export def hgrXVlin(y1, y2, x)#0
// word pixptr, y, ofst
// byte pixofst, pmask, cmask
//
//
// if y1 == y2
// hgrXorPlot(x, y1)
// else
@ -978,7 +985,7 @@ end
asm _hgrXVLinB
LDA $2000,Y ; CURHCLR
AND TMPL
STA TMPL
STA TMPL
LDY ESTKL+3,X ; Y1 COORD
end
asm _hgrXVLinC
@ -1029,13 +1036,13 @@ asm _scanBLTA
DEX
DEX
LDA ESTKL+5,X ; X COORDL
STA ESTKL+1,X
STA ESTKL+1,X
LDA ESTKH+5,X ; X COORDH
STA ESTKH+1,X
STA ESTKH+1,X
LDA ESTKL+4,X ; Y COORDL
STA ESTKL+0,X
STA ESTKL+0,X
LDA ESTKH+4,X ; Y COORDH
STA ESTKH+0,X
STA ESTKH+0,X
PLA
AND #$08
BEQ +
@ -1066,13 +1073,13 @@ asm _scanBLTC
DEX
DEX
LDA ESTKL+5,X ; X COORDL
STA ESTKL+1,X
STA ESTKL+1,X
LDA ESTKH+5,X ; X COORDH
STA ESTKH+1,X
STA ESTKH+1,X
LDA ESTKL+4,X ; Y COORDL
STA ESTKL+0,X
STA ESTKL+0,X
LDA ESTKH+4,X ; Y COORDH
STA ESTKH+0,X
STA ESTKH+0,X
PLA
AND #$08
BEQ +
@ -1098,7 +1105,7 @@ BLTDONE INX
end
export def hgrRect(x1, y1, x2, y2)#0
word y
if x1 == x2
hgrVLin(y1, y2, x1)
else
@ -1109,7 +1116,7 @@ export def hgrRect(x1, y1, x2, y2)#0
end
export def hgrXorRect(x1, y1, x2, y2)#0
word y
if x1 == x2
hgrXorVLin(y1, y2, x1)
else
@ -1122,7 +1129,7 @@ export def hgrBLT(x, y, w, h, srcptr)#0
word i, j
word saveclr
byte c
saveclr = curhclr
for j = y to y + h - 1
scanBLT(x, j, w, srcptr)
@ -1149,25 +1156,39 @@ export def hgrBLT(x, y, w, h, srcptr)#0
curhclr = saveclr
end
export def hgrMode(mode)#1
if mode
//
// Set HGR mode
//
memset(hgr1, 0, $2000) // Clear HGR page 1
^showpage1
^showfull
^showhires
^showgraphics
drawpage = 1
drawbuff = hgrbuff[1]
return 1
fin
//
// Show text mode
//
^showpage1
^showtext
return 0
when mode
is page1
//
// Set HGR1 mode
//
memset(hgr1, 0, $2000) // Clear HGR1
^showpage1
^showfull
^showhires
^showgraphics
drawpage = page2
drawbuff = hgrbuff[page2]
break
is page2
//
// Set HGR2 mode
//
memset(hgr2, 0, $2000) // Clear HGR2
^showpage2
^showfull
^showhires
^showgraphics
drawpage = page1
drawbuff = hgrbuff[page1]
break
otherwise
//
// Show text mode
//
^showpage1
^showtext
wend
return mode
end
export def hgrClear#0
memset(drawbuff, curhclr, drawbuff) // Clear current HGR page
@ -1192,6 +1213,13 @@ export def hgrDrawBuf(page)#1
return drawpage
end
//
// Machine compatibility check
//
if MACHID & MACHID_MODEL == MACHID_III or MACHID & MACHID_MODEL == MACHID_I
puts("Apple II compatible only.\n")
return -1
fin
//
// Assembly fixups
//
hgrCopyDst:1 = @clipsrc
@ -1278,4 +1306,8 @@ _scanBLTB:8 = @hgrOrPlot
_scanBLTC:1 = @hgrColor
_scanBLTD:1 = @hgrPlot
_scanBLTD:8 = @hgrOrPlot
//
// Keep module in memory
//
return modkeep
done

View File

@ -48,13 +48,13 @@ asm _scanMaskA
DEX
DEX
LDA ESTKL+5,X ; X COORDL
STA ESTKL+1,X
STA ESTKL+1,X
LDA ESTKH+5,X ; X COORDH
STA ESTKH+1,X
STA ESTKH+1,X
LDA ESTKL+4,X ; Y COORDL
STA ESTKL+0,X
STA ESTKL+0,X
LDA ESTKH+4,X ; Y COORDH
STA ESTKH+0,X
STA ESTKH+0,X
end
asm _scanMaskB
JSR $D000 ; HPLOT
@ -81,13 +81,13 @@ asm _scanMaskC
DEX
DEX
LDA ESTKL+5,X ; X COORDL
STA ESTKL+1,X
STA ESTKL+1,X
LDA ESTKH+5,X ; X COORDH
STA ESTKH+1,X
STA ESTKH+1,X
LDA ESTKL+4,X ; Y COORDL
STA ESTKL+0,X
STA ESTKL+0,X
LDA ESTKH+4,X ; Y COORDH
STA ESTKH+0,X
STA ESTKH+0,X
end
asm _scanMaskD
JSR $D000 ; HPLOT
@ -109,7 +109,7 @@ 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)
@ -127,7 +127,7 @@ def spriteBLTMask(x, y, w, h, srcptr)#0
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
@ -160,7 +160,7 @@ 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)
@ -171,7 +171,7 @@ 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)
@ -226,7 +226,7 @@ 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
@ -252,7 +252,7 @@ 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
@ -282,7 +282,7 @@ end
export def spriteUnDrawList#0
byte i
var undrawptr
undrawptr = undrawList[drawpage]
for i = 15 downto 0
if undrawptr=>[i]
@ -294,7 +294,7 @@ end
export def spriteDrawList#0
byte i
var undrawptr
undrawptr = undrawList[drawpage]
for i = 15 downto 0
if undrawptr=>[i]
@ -311,7 +311,7 @@ end
export def spriteUnDrawXorList#0
byte i
var undrawptr
undrawptr = undrawList[drawpage]
for i = 0 to 15
if undrawptr=>[i]
@ -323,7 +323,7 @@ end
export def spriteDrawXorList#0
byte i
var undrawptr
undrawptr = undrawList[drawpage]
for i = 0 to 15
if undrawptr=>[i]
@ -337,7 +337,7 @@ export def spriteDrawXorList#0
end
export def spriteAdd(i, sprtptr)#1
var sprtprev
i = i & 15
sprtprev = drawList[i]
drawList[i] = sprtptr
@ -345,7 +345,7 @@ export def spriteAdd(i, sprtptr)#1
end
export def spriteDel(i)#1
var sprtprev
i = i & 15
sprtprev = drawList[i]
drawList[i] = 0
@ -362,4 +362,8 @@ _scanMaskA:1 = @hgrColor
_scanMaskB:1 = @hgrPlot
_scanMaskC:1 = @hgrColor
_scanMaskD:1 = @hgrPlot
//
// Keep module in memory
//
return modkeep
done

View File

@ -55,7 +55,7 @@ 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]
@ -99,7 +99,7 @@ asm _tileDraw
end
//export def tileXorDraw(x, y, tileptr)#0
// var scrnptr
//
//
// scrnptr = (scanaddr[y] | drawbuff) + x
// scrnptr->[$1C00] = tileptr->[7]
// scrnptr->[$1800] = tileptr->[6]
@ -145,7 +145,7 @@ asm _tileXDraw
end
//export def tileOrDraw(x, y, tileptr)#0
// var scrnptr
//
//
// scrnptr = (scanaddr[y] | drawbuff) + x
// scrnptr->[$1C00] = tileptr->[7]
// scrnptr->[$1800] = tileptr->[6]
@ -191,7 +191,7 @@ asm _tileODraw
end
//export def tileAndDraw(x, y, tileptr)#0
// var scrnptr
//
//
// scrnptr = (scanaddr[y] | drawbuff) + x
// scrnptr->[$1C00] = tileptr->[7]
// scrnptr->[$1800] = tileptr->[6]
@ -347,50 +347,15 @@ 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
next
end
//
// Set display page, return other page
// Set draw buffer
//
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]
@ -431,5 +396,9 @@ _tileDSb:28 = @_tileDSc.28
_tileDSb:33 = @_tileDSc.34
_tileDSb:38 = @_tileDSc.40
_tileDSb:43 = @_tileDSc.46
//
// Keep module in memory
//
return modkeep
done

View File

@ -60,8 +60,8 @@ if *jitcomp
return 0
fin
*jitcomp = @compiler
cmdsys.jitcount = 32
cmdsys.jitsize = 96
cmdsys.jitcount = 48
cmdsys.jitsize = 128
puts("16-bit VM/JITC enabled\n")
return modkeep
done

View File

@ -1,3 +1,4 @@
include "inc/cmdsys.plh"
asm asmdefs
!SOURCE "vmsrc/plvmzp.inc"
SPEAKER = $C030
@ -57,4 +58,8 @@ GC1DLY NOP ; TIMING
BUZZDLY BNE + ; TIMING
+ BNE GC0READ
end
//
// Keep module in memory
//
return modkeep
done

View File

@ -15,7 +15,7 @@ def matchNext(src, srcofst, exp, expofst)
return TRUE
fin
is '?' // Single char wildcard
if ^src >= srcofst
if ^src >= srcofst
return matchNext(src, srcofst + 1, exp, expofst + 1)
fin
return FALSE
@ -43,7 +43,7 @@ end
export def matchList(pathstr, exp)#2
byte refnum
char[64] curpath
var firstblk, entrylen, entriesblk, i, entry, filecnt, entrylist, entryptr, entrycnt
var firstblk, entrylen, entriesblk, i, entry, entrylist, entryptr, entrycnt
if not dirbuf
dirbuf = heapallocalign(512, 8, 0)
@ -58,48 +58,43 @@ export def matchList(pathstr, exp)#2
fin
entrylist = 0
entrycnt = 0
filecnt = 0
firstblk = 1
refnum = fileio:open(pathstr)
repeat
if fileio:read(refnum, dirbuf, 512) == 512
while fileio:read(refnum, dirbuf, 512) == 512
//
// Skip block pointers
//
entry = dirbuf + 4
if firstblk
//
// Skip block pointers
// Pull out revelant details from the first block
//
entry = dirbuf + 4
if firstblk
//
// Pull out revelant details from the first block
//
entrylen = dirbuf->$23
entriesblk = dirbuf->$24
filecnt = dirbuf=>$25
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
filecnt--
fin
entry = entry + entrylen
next
firstblk = 0
entrylen = dirbuf->$23
entriesblk = dirbuf->$24 - 1
entry = entry + entrylen
fin
until filecnt == 0
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
@ -108,7 +103,7 @@ end
//
export def isWildName(exp)#1
byte i
if ^exp
for i = 1 to ^exp
if exp->[i] == '*' or exp->[i] == '?'
@ -118,5 +113,18 @@ export def isWildName(exp)#1
fin
return FALSE
end
//
// Utility routine to separate filename from path
//
export def fileFromPath(filestr, pathstr)#0
byte i
for i = ^pathstr downto 1
if pathstr->[i] == '/'
break
fin
next
^filestr = ^pathstr - i
memcpy(filestr + 1, pathstr + 1 + i, ^filestr)
end
done

View File

@ -206,6 +206,9 @@ for rom = $C100 to $C700 step $0100
updateMouse:5 = rom + rom->$14 // readMouseFW
readMouse.1 = index
call(rom + rom->$19, $00, slot, page, $04) // initMouseFW
//
// Keep module in memory
//
return modkeep
fin
next

View File

@ -20,28 +20,26 @@ const WAIT = $FCA8
export def digitalRead(pin)
return FLAG0[pin&3] > 127
end
export def portRead
return (^FLAG0>>7)&1|(^FLAG1>>6)&2|(^FLAG2>>5)&4|(^FLAG3>>4)&8
end
export def digitalWrite(pin, val)#0
ANN0[((pin&3)<<1)+(val&1)]
end
export def portWrite(val)#0
ANN0[val&1]
ANN1[(val>>1)&1]
ANN2[(val>>2)&1]
ANN3[(val>>3)&1]
end
export def analogRead(pin)
return call(PREAD,0,pin&3,0,0).2
end
export def delay(time)#0
call(WAIT,time,0,0,0)
end
//
// Keep module in memory
//
return modkeep
done

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

@ -0,0 +1,183 @@
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)
//
// Keep module in memory
//
done

View File

@ -867,7 +867,9 @@ if mbSlot < 0
spkrOctave0[instr] = mbOctave0[instr]/NOTEDIV
next
fin
//
// Keep module in memory
//
done
////////////////////////////////////////////////////////////////////////////////

View File

@ -5,14 +5,12 @@ include "inc/cmdsys.plh"
const SPI_SLAVE_READY = '@'
const SPI_SLAVE_ERROR = '!'
const SPI_SLAVE_BUSY = $FF
word spiReadWriteByte, spiWriteBytes, spiReadBytes
asm spiInc
!SOURCE "vmsrc/plvmzp.inc"
!CPU 65C02
end
asm spiXferByteStd(outbyte)
PHP ; DISABLE INTS
SEI
@ -80,7 +78,6 @@ asm spiXferByteStd(outbyte)
PLP
RTS
end
asm spiXferByteGS(outbyte)
PHP ; DISABLE INTS
SEI
@ -211,7 +208,6 @@ asm spiReadBytesStd(buf, len)
PLP
RTS
end
asm spiReadBytesGS(buf, len)
PHP ; DISABLE INTS
SEI
@ -275,7 +271,6 @@ asm spiReadBytesGS(buf, len)
PLP
RTS
end
asm spiWriteBytesStd(buf, len)
PHP ; DISABLE INTS
SEI
@ -348,7 +343,6 @@ asm spiWriteBytesStd(buf, len)
PLP
RTS
end
asm spiWriteBytesGS(buf, len)
PHP ; DISABLE INTS
SEI
@ -393,15 +387,12 @@ asm spiWriteBytesGS(buf, len)
PLP
RTS
end
export def spiXferByte(outbyte)
return (spiReadWriteByte)(outbyte)
end
export def spiDelay(time)
return call($FCA8, time, 0, 0, 0) // DELAY
end
export def spiSend(data)
byte timeout, status
@ -415,23 +406,19 @@ export def spiSend(data)
putc(status);putc('0'+data/10);putc('0'+data%10)
return status
end
export def spiRecv
return spiSend(0)
end
export def spiWriteBuf(buf, len)
spiSend(13) // CMD_BUF_WRITE
spiSend(len >> 8); spiSend(len)
return (spiWriteBytes)(buf, len)
end
export def spiReadBuf(buf, len)
spiSend(12) // CMD_BUF_READ
spiSend(len >> 8); spiSend(len)
return (spiReadBytes)(buf, len)
end
export def spiReady
byte timeout
@ -442,13 +429,11 @@ export def spiReady
loop
return timeout
end
export def spiReset
^$C05B // DISABLE SLAVE SELECT
^$C05D // CLOCK RAISE (GS ONLY)
return spiReady
end
if call($FE1F, 0, 0, 0, 1).3 & 1 // GS ID ROUTINE
spiReadWriteByte = @spiXferByteStd
spiReadBytes = @spiReadBytesStd
@ -458,5 +443,8 @@ else
spiReadBytes = @spiReadBytesGS
spiWriteBytes = @spiWriteBytesGS
fin
//
// Keep module in memory
//
return spiReset <> 0
done

View File

@ -243,6 +243,9 @@ for slot = $90 to $F0 step $10
//
puts("Found Uthernet I in slot #"); putc('0' + ((slot - $80) >> 4)); putln
setEtherDriver(@utherMAC, @peekfrmlen, @peekfrm, @pokefrmlen, @pokefrm)
//
// Keep module in memory
//
return modkeep
fin
fin

View File

@ -909,6 +909,9 @@ for slot = $90 to $F0 step $10
iNet:getInterfaceHA = @getWizHA
iNet:setCallback = @wizSetCallback
iNet:setParam = @wizSetParam
//
// Keep module in memory
//
return modkeep
fin
fin

View File

@ -602,4 +602,8 @@ iNet:setInterfaceIP = @setEtherIP
iNet:getInterfaceHA = @getEtherHA
iNet:setCallback = @etherSetCallback
iNet:setParam = @etherSetParam
//
// Keep module in memory
//
return modkeep
done

View File

@ -19,6 +19,7 @@ byte fbrNext[MAX_FIBERS]
word fbrVMState[MAX_FIBERS]
word fbrPool
byte fbrRunning = 0
export byte fbrCount = 0
//
// Zero Page VM state and 6502 stack
//
@ -136,6 +137,7 @@ export def fbrInit(numPool)
else
return -1
fin
fbrCount = 1
return 0
end
//
@ -151,6 +153,7 @@ export def fbrStop(fid)#0
//
// Remove fiber from RUN list and tag as free
//
fbrCount--
fbrState[fid] = FIBER_FREE
i = 0
while fbrNext[i] <> fid
@ -212,6 +215,7 @@ export def fbrStart(defaddr, param)
//
// Return fiber ID (index)
//
fbrCount++
return i
fin
next

View File

@ -3,6 +3,7 @@
//
include "inc/cmdsys.plh"
include "inc/sane.plh"
include "inc/fpstr.plh"
//
// Structures for DEC2BIN, BIN2DEC
//
@ -19,14 +20,13 @@ end
// Parse string into decrecord, return SANE conversion output
//
export def str2ext(str, ext)
byte i, s, d
byte i, d
byte decrec[t_decrecord]
word sgnadj, expadj
decrec:sgn = 0
decrec:exp = 0
decrec.sig = 0
s = 1
i = 1
//
// Skip whitespace
@ -51,27 +51,34 @@ export def str2ext(str, ext)
// Parse number
//
while i <= ^str
d = toupper(^(str+i))
d = ^(str+i)
if d >= '0' and d <= '9'
//
// Parse digit
//
decrec.sig[s] = ^(str+i)
decrec:sig++
s++
decrec.sig[decrec.sig] = d
elsif d == '.'
//
// Parse decimal point
//
i++
while i <= ^str
d = toupper(^(str+i))
if d >= '0' and d <= '9'
decrec.sig[s] = ^(str+i)
decrec.sig++
if !decrec.sig
//
// Skip leading zeros
//
while i <= ^str and ^(str+i) == '0'
decrec:exp--
s++
elsif d == 'E'
i++
loop
fin
while i <= ^str
d = ^(str+i)
if d >= '0' and d <= '9'
decrec.sig++
decrec.sig[decrec.sig] = d
decrec:exp--
elsif d == 'E' or d == 'e'
i--
break
else
@ -79,7 +86,7 @@ export def str2ext(str, ext)
fin
i++
loop
elsif d == 'E'
elsif d == 'E' or d == 'e'
//
// Parse exponent
//
@ -108,21 +115,20 @@ export def str2ext(str, ext)
i++
loop
//
// Strip leading zeros from sig
// Strip trailing zeros from sig
//
while decrec.sig > 1 and decrec.sig.1 == '0'
while decrec.sig > 0 and decrec.sig[decrec.sig] == '0'
decrec.sig--
if decrec:exp < 0
decrec:exp--
fin
memcpy(@decrec.sig.1, @decrec.sig.2, decrec.sig)
decrec:exp++
loop
//
// Check for zero
//
if !decrec.sig
decrec.sig = 1
decrec.sig = 1
decrec.sig.1 = '0'
decrec:sgn = 0
decrec:exp = 0
fin
sane:saveZP()
return sane:restoreZP(sane:op2FP(FFEXT|FOD2B, ext, @decrec))
@ -131,14 +137,15 @@ end
// Convert extended FP to string using , return string
//
export def ext2str(ext, str, intdigits, fracdigits, format)
byte d, i, sigdigits, numdigits
word dp, tens
byte d, numdigits
word istr, dp, tens
byte decform[t_decformat]
byte decrec[t_decrecord]
numdigits = intdigits + fracdigits
decform:style = format & $01
numdigits = intdigits + fracdigits
decform:style = format & FPSTR_FIXED
decform:digits = decform:style ?? fracdigits :: numdigits
decrec:exp = 0
sane:saveZP()
sane:restoreZP(sane:op3FP(FFEXT|FOB2D, @decrec, ext, @decform))
^(str+1) = decrec.sgn ?? '-' :: ' '
@ -156,93 +163,115 @@ export def ext2str(ext, str, intdigits, fracdigits, format)
^str = 4
return str
fin
if decrec.sig.1 == '0'
while decrec.sig < fracdigits
decrec.sig++
decrec.sig[decrec.sig] = '0'
loop
decrec:exp = -decrec.sig
fin
dp = decrec.sig + decrec:exp
sigdigits = decrec.sig
if decrec:exp < 0 and format & $02
//
// Strip off trailing fractional zeros
//
while sigdigits > dp and decrec.sig[sigdigits] == '0'
sigdigits--
decrec:exp++
loop
fin
if -decrec:exp > numdigits or sigdigits + decrec:exp >= (decform:style ?? intdigits :: numdigits) or format & $04
//
// Convert to exponential format
//
^(str+2) = decrec.sig.1
^(str+3) = '.'
i = 3
for d = 0 to fracdigits
i++
^(str+i) = decrec.sig.2[d]
next
if format & FPSTR_EXP
if format & FPSTR_STRIP
//
// Strip off trailing fractional zeros
//
while decrec.sig > 1 and decrec.sig[decrec.sig] == '0'
decrec.sig--
decrec:exp++
loop
fin
//
// Copy over all significant digits
//
if ^(str+i) == '.'; i--; fin
i++
^(str+i) = 'E'
i++
^(str+2) = decrec.sig.1
^(str+3) = '.'
istr = str + 3
for d = 2 to decrec.sig
istr++
^istr = decrec.sig[d]
next
if ^istr == '.'; istr--; fin
//
// Print exponent as 4 digits with leading zeros
//
istr++
^istr = 'E'
istr++
dp--
if dp < 0
^(str+i) = '-'
^istr = '-'
dp = -dp
else
^(str+i) = '+'
if dp == 0
i++
^(str+i) = '0'
fin
^istr = '+'
fin
//
// Pretty output the exponent (preceding zero for values less than 10)
//
d = 0
tens = 10000
while dp
d = d or tens <= 10
if dp >= tens or d
d = 1
i++
^(str+i) = (dp / tens) + '0'
fin
tens = 1000
while tens
istr++
^istr = (dp / tens) + '0'
dp = dp % tens
tens = tens / 10
if !tens; break; fin
loop
else
if format & FPSTR_STRIP and decrec:exp < 0
//
// Strip off trailing fractional zeros
//
while decrec.sig > dp and decrec.sig[decrec.sig] == '0'
decrec.sig--
decrec:exp++
loop
fin
if decrec:sig == 1 | '0'<<8
//
// Case of zero or underflow
//
if decrec:exp == 0
//
// Zero
//
if format & FPSTR_FIXED
//
// Add trailing fractional zeros
//
dp = 1 - fracdigits
fin
elsif format & FPSTR_FLEX
//
// Underflow
//
dp = -fracdigits - 1
fin
fin
if format & FPSTR_FLEX and (dp < -fracdigits or dp > (format & FPSTR_FIXED ?? intdigits :: numdigits))
//
// Print as exponent if over/underflow fixed digits
//
if numdigits < 7; numdigits = 7; fin
return ext2str(ext, str, 1, numdigits - 7, FPSTR_EXP | (format & FPSTR_STRIP))
fin
//
// Convert as floating point
//
i = 1
if dp <= 0
*(str+2) = '0'|('.'<<8)
i = 3
istr = str + 3
while dp < 0
dp++
i++
^(str+i) = '0'
istr++
^istr = '0'
loop
else
istr = str + 1
fin
for d = 1 to sigdigits
i++
^(str+i) = decrec.sig[d]
for d = 1 to decrec.sig
istr++
^istr = decrec.sig[d]
if d == dp
i++
^(str+i) = '.'
istr++
^istr = '.'
fin
next
if ^(str+i) == '.'; i--; fin
if ^istr == '.'; istr--; fin
fin
^str = i
^str = istr - str
return str
end
//
// Keep module in memory
//
return modkeep
done

View File

@ -369,4 +369,8 @@ def reset
next
return sane:restoreZP(0)
end
//
// Keep module in memory
//
return modkeep
done

View File

@ -1,24 +1,5 @@
include "inc/cmdsys.plh"
//
// iNet API - must match inet.plh
//
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 setDNS
word resolveIP
word setCallback
word setParam
end
include "inc/inet.plh"
//
// DNS message
//
@ -223,4 +204,8 @@ end
//
iNet:initIP = @iNetInit
iNet:setDNS = @iNetSetDNS
//
// Keep module in memory
//
return modkeep
done

View File

@ -360,7 +360,7 @@ _DIV STY DVSIGN ; LSB = SIGN OF DVSR
ORA ACCUM32+1
ORA ACCUM32+2
ORA ACCUM32+3
BEQ -
BEQ -
LDA ACCUM32+3 ; DVDND = ACCUM32
BPL +
LDA #$81 ; DVDND IS NEG
@ -654,7 +654,7 @@ export def i32tos(i32ptr, strptr)#1
res[t_i32] save
word iptr, rem
char[12] istr
iptr = @istr.11
store32(@save)
load32(i32ptr)
@ -674,9 +674,12 @@ export def i32tos(i32ptr, strptr)#1
end
export def puti32(i32ptr)#0
char[12] i32str
puts(i32tos(i32ptr, @i32str))
end
//
// Keep module in memory
//
return modkeep
done

View File

@ -249,7 +249,7 @@ asm _hlineB
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
@ -386,7 +386,7 @@ def vmajorspans(x1, y1, x2, y2, dx, dy, sx)#0
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
@ -430,7 +430,7 @@ export def setlineplot(p)#0
end
export def line(x1, y1, x2, y2)#0
var sx, sy, dx2, dy2
sx = 1
sy = 1
dx2 = (x2 - x1) * 2
@ -503,4 +503,8 @@ _vlineB:6 = @err
_vlineB:9 = @err
_vlineB:13 = @err.1
_vlineB:16 = @err.1
//
// Keep module in memory
//
return modkeep
done

View File

@ -60,10 +60,11 @@ export asm throw(env, retval)
DEC DST+1
LDX TMPL
TXS
LDY TMPL
LDY #$FE
- LDA (DST),Y
STA $0100,Y
INY
DEY
CPY TMPL
BNE -
LDX ESP
LDA SRC

View File

@ -839,10 +839,8 @@ def fpInit()
fpzpsave = heapalloc($0034*2)
(@fixupXS)=>1 = fpzpsave+$34
(@fixupXR)=>1 = fpzpsave+$34
zpSaveX // Clear XBYTEs
heaprelease(fpzpsave)
sane[9] = @zpNopSave//zpSaveX
sane[10] = @zpNopRestore//zpRestoreX
sane[9] = @zpSaveX
sane[10] = @zpRestoreX
else // Apple II
fpzpsave = heapalloc($0034)
sane[9] = @zpSave
@ -896,4 +894,8 @@ end
def uninit3(op, dst, src, src2)
return uninit
end
//
// Keep module in memory
//
return modkeep
done

View File

@ -15,7 +15,7 @@ CMDJIT = rel/apple/CMD128\#061000
PLVMZP_C64 = vmsrc/c64/plvmzp.inc
PLVMC64 = rel/c64/PLASMA
ED = rel/ED\#FE1000
ZIP = rel/apple/ZIP\#FE1000
ZIPCHIP = rel/apple/ZIPCHIP\#FE1000
JIT = rel/apple/JIT\#FE1000
JIT16 = rel/apple/JIT16\#FE1000
JITUNE = rel/apple/JITUNE\#FE1000
@ -60,6 +60,7 @@ DHCP = rel/DHCP\#FE1000
HTTPD = rel/HTTPD\#FE1000
TFTPD = rel/TFTPD\#FE1000
HGRLIB = rel/apple/HGRLIB\#FE1000
DHGRLIB = rel/apple/DHGRLIB\#FE1000
GRLIB = rel/apple/GRLIB\#FE1000
DGRLIB = rel/apple/DGRLIB\#FE1000
HGRSPRITE = rel/apple/HGRSPRITE\#FE1000
@ -76,6 +77,7 @@ ROGUE = rel/ROGUE\#FE1000
ROGUEMAP = rel/ROGUEMAP\#FE1000
ROGUECOMBAT= rel/ROGUECOMBAT\#FE1000
MON = rel/apple/MON\#FE1000
CONIOTEST = rel/apple/CONIOTEST\#FE1000
TILETEST = rel/apple/TILETEST\#FE1000
HGRTEST = rel/apple/HGRTEST\#FE1000
GRTEST = rel/apple/GRTEST\#FE1000
@ -91,6 +93,11 @@ TESTLIB = TESTLIB\#FE1000
PLASM = plasm
PLASMAPLASM = rel/PLASM\#FE1000
CODEOPT = rel/CODEOPT\#FE1000
PLFORTH = rel/PLFORTH\#FE1000
HRFORTH = rel/HRFORTH\#FE1000
HR2FORTH = rel/HR2FORTH\#FE1000
TX2FORTH = rel/TX2FORTH\#FE1000
DRAWL = rel/DRAWL\#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
#
@ -109,11 +116,11 @@ TXTTYPE = .TXT
#SYSTYPE = \#FF2000
#TXTTYPE = \#040000
apple: $(PLVMZP_APL) $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVMJIT) $(PLVM802) $(PLVM03) $(PLVMJIT03) $(CMD) $(CMDJIT) $(JIT) $(JIT16) $(JITUNE) $(SOSCMD) $(SOSCMDJIT) $(PLASMAPLASM) $(CODEOPT) $(ZIP) $(MATCHFILES) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(COPY) $(DEL) $(REN) $(CAT) $(NEWDIR) $(TYPE) $(SOS) $(ROD) $(SIEVE) $(PRIMEGAP) $(MOUSE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(TFTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(SFM) $(SFMSPRT) $(GRAFIX) $(GFXDEMO) $(LINES) $(HGRTILE) $(HGRFONT) $(HGRSPRITE) $(HGRLIB) $(TILETEST) $(HGRTEST) $(GRLIB) $(DGRLIB) $(GRTEST) $(DGRTEST) $(HGRTEST) $(FILEIO_APL) $(CONIO_APL) $(JOYBUZZ) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(INT32) $(INT32TEST) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(LZ4) $(LZ4CAT) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ)
apple: $(PLVMZP_APL) $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVMJIT) $(PLVM802) $(PLVM03) $(PLVMJIT03) $(CMD) $(CMDJIT) $(JIT) $(JIT16) $(JITUNE) $(SOSCMD) $(SOSCMDJIT) $(PLASMAPLASM) $(CODEOPT) $(PLFORTH) $(HRFORTH) $(HR2FORTH) $(TX2FORTH) $(DRAWL) $(ZIPCHIP) $(MATCHFILES) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(COPY) $(DEL) $(REN) $(CAT) $(NEWDIR) $(TYPE) $(SOS) $(ROD) $(SIEVE) $(PRIMEGAP) $(MOUSE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(TFTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(SFM) $(SFMSPRT) $(GRAFIX) $(GFXDEMO) $(LINES) $(HGRTILE) $(HGRFONT) $(HGRSPRITE) $(HGRLIB) $(TILETEST) $(HGRTEST) $(DHGRLIB) $(GRLIB) $(DGRLIB) $(GRTEST) $(DGRTEST) $(HGRTEST) $(FILEIO_APL) $(CONIO_APL) $(JOYBUZZ) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(INT32) $(INT32TEST) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(LZ4) $(LZ4CAT) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ) $(CONIOTEST)
-rm vmsrc/plvmzp.inc
c64: $(PLVMZP_C64) $(PLASM) $(PLVM) $(PLVMC64)
c64: $(PLVMZP_C64) $(PLASM) $(PLVM) $(PLVMC64)
-rm vmsrc/plvmzp.inc
all: apple c64
@ -142,13 +149,33 @@ $(PLASM): $(OBJS) $(INCS)
cc $(OBJS) -o $(PLASM)
$(PLASMAPLASM): toolsrc/plasm.pla toolsrc/lex.pla toolsrc/parse.pla toolsrc/codegen.pla toolsrc/codeseq.plh
./$(PLASM) -AMOW < toolsrc/plasm.pla > toolsrc/plasm.a
./$(PLASM) -AMOW toolsrc/plasm.pla
acme --setpc 4094 -o $(PLASMAPLASM) toolsrc/plasm.a
$(CODEOPT): toolsrc/codeopt.pla toolsrc/codeseq.plh
./$(PLASM) -AMOW < toolsrc/codeopt.pla > toolsrc/codeopt.a
./$(PLASM) -AMOW toolsrc/codeopt.pla
acme --setpc 4094 -o $(CODEOPT) toolsrc/codeopt.a
$(HRFORTH): toolsrc/hrforth.pla
./$(PLASM) -AMOW toolsrc/hrforth.pla
acme --setpc 4094 -o $(HRFORTH) toolsrc/hrforth.a
$(HR2FORTH): toolsrc/hr2forth.pla
./$(PLASM) -AMOW toolsrc/hr2forth.pla
acme --setpc 4094 -o $(HR2FORTH) toolsrc/hr2forth.a
$(TX2FORTH): toolsrc/tx2forth.pla
./$(PLASM) -AMOW toolsrc/tx2forth.pla
acme --setpc 4094 -o $(TX2FORTH) toolsrc/tx2forth.a
$(PLFORTH): toolsrc/plforth.pla
./$(PLASM) -AMOW toolsrc/plforth.pla
acme --setpc 4094 -o $(PLFORTH) toolsrc/plforth.a
$(DRAWL): toolsrc/drawl.pla
./$(PLASM) -AMOW toolsrc/drawl.pla
acme --setpc 4094 -o $(DRAWL) toolsrc/drawl.a
#
# PLASMA VMs
#
@ -159,42 +186,42 @@ $(PLVMZP_APL): FORCE
-mkdir -p rel
-mkdir -p rel/apple
-rm -f vmsrc/plvmzp.inc
-ln -s apple/plvmzp.inc vmsrc/plvmzp.inc
-cp vmsrc/apple/plvmzp.inc vmsrc/plvmzp.inc
$(PLVMZP_C64): FORCE
-mkdir -p rel
-mkdir -p rel/c64
-rm -f vmsrc/plvmzp.inc
-ln -s c64/plvmzp.inc vmsrc/plvmzp.inc
-cp vmsrc/c64/plvmzp.inc vmsrc/plvmzp.inc
FORCE:
vmsrc/c64/cmd.a: vmsrc/c64/cmd.pla $(PLASM)
./$(PLASM) -AOW < vmsrc/c64/cmd.pla > vmsrc/c64/cmd.a
./$(PLASM) -AOW vmsrc/c64/cmd.pla
$(PLVMC64): vmsrc/c64/plvmc64.s vmsrc/c64/cmd.a
acme -f cbm -o $(PLVMC64) -l vmsrc/c64/plvmc64.sym vmsrc/c64/plvmc64.s
vmsrc/apple/a1cmd.a: vmsrc/apple/a1cmd.pla $(PLASM)
./$(PLASM) -AOW < vmsrc/apple/a1cmd.pla > vmsrc/apple/a1cmd.a
./$(PLASM) -AOW vmsrc/apple/a1cmd.pla
$(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
./$(PLASM) -AOW vmsrc/apple/cmd.pla
acme --setpc 8192 -o $(CMD) -l vmsrc/apple/cmd.sym 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
./$(PLASM) -AOW vmsrc/apple/cmdjit.pla
acme --setpc 8192 -o $(CMDJIT) -l vmsrc/apple/cmdjit.sym vmsrc/apple/cmdjitstub.s
$(SOSCMD): vmsrc/apple/soscmd.pla $(PLVM03) $(PLASM)
./$(PLASM) -AMOW < vmsrc/apple/soscmd.pla > vmsrc/apple/soscmd.a
./$(PLASM) -AMOW vmsrc/apple/soscmd.pla
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
./$(PLASM) -AMOW vmsrc/apple/soscmdjit.pla
acme --setpc 4094 -o $(SOSCMDJIT) vmsrc/apple/soscmdjit.a
$(PLVM02): vmsrc/apple/plvm02.s
@ -207,13 +234,13 @@ $(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
./$(PLASM) -AOW vmsrc/apple/sossys.pla
$(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
./$(PLASM) -AOW vmsrc/apple/sossysjit.pla
$(PLVMJIT03): vmsrc/apple/plvmjit03.s vmsrc/apple/sossysjit.a
acme -o $(PLVMJIT03) -l vmsrc/apple/plvmjit03.sym vmsrc/apple/plvmjit03.s
@ -221,306 +248,313 @@ $(PLVMJIT03): vmsrc/apple/plvmjit03.s vmsrc/apple/sossysjit.a
# Sample code
#
test: samplesrc/test.pla samplesrc/testlib.pla $(PLVM) $(PLASM)
./$(PLASM) -AMOW < samplesrc/test.pla > samplesrc/test.a
./$(PLASM) -AMOW samplesrc/test.pla
acme --setpc 4094 -o $(TEST) samplesrc/test.a
./$(PLASM) -AMOW < samplesrc/testlib.pla > samplesrc/testlib.a
./$(PLASM) -AMOW samplesrc/testlib.pla
acme --setpc 4094 -o $(TESTLIB) samplesrc/testlib.a
./$(PLVM) TEST
$(ED): toolsrc/ed.pla $(PLVM02) $(PLASM) toolsrc/ed.pla
./$(PLASM) -AMOW < toolsrc/ed.pla > toolsrc/ed.a
./$(PLASM) -AMOW toolsrc/ed.pla
acme --setpc 4094 -o $(ED) toolsrc/ed.a
$(MATCHFILES): libsrc/apple/matchfiles.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/matchfiles.pla > libsrc/apple/matchfiles.a
./$(PLASM) -AMOW libsrc/apple/matchfiles.pla
acme --setpc 4094 -o $(MATCHFILES) libsrc/apple/matchfiles.a
$(ARGS): libsrc/args.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/args.pla > libsrc/args.a
./$(PLASM) -AMOW libsrc/args.pla
acme --setpc 4094 -o $(ARGS) libsrc/args.a
$(MEMMGR): libsrc/memmgr.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/memmgr.pla > libsrc/memmgr.a
./$(PLASM) -AMOW libsrc/memmgr.pla
acme --setpc 4094 -o $(MEMMGR) libsrc/memmgr.a
$(MEMTEST): samplesrc/memtest.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/memtest.pla > samplesrc/memtest.a
./$(PLASM) -AMOW samplesrc/memtest.pla
acme --setpc 4094 -o $(MEMTEST) samplesrc/memtest.a
$(FIBER): libsrc/fiber.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/fiber.pla > libsrc/fiber.a
./$(PLASM) -AMOW libsrc/fiber.pla
acme --setpc 4094 -o $(FIBER) libsrc/fiber.a
$(LINES): libsrc/lines.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/lines.pla > libsrc/lines.a
./$(PLASM) -AMOW libsrc/lines.pla
acme --setpc 4094 -o $(LINES) libsrc/lines.a
$(FIBERTEST): samplesrc/fibertest.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/fibertest.pla > samplesrc/fibertest.a
./$(PLASM) -AMOW samplesrc/fibertest.pla
acme --setpc 4094 -o $(FIBERTEST) samplesrc/fibertest.a
$(LONGJMP): libsrc/longjmp.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/longjmp.pla > libsrc/longjmp.a
./$(PLASM) -AMOW libsrc/longjmp.pla
acme --setpc 4094 -o $(LONGJMP) libsrc/longjmp.a
$(SFM): samplesrc/sfm.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/sfm.pla > samplesrc/sfm.a
./$(PLASM) -AMOW samplesrc/sfm.pla
acme --setpc 4094 -o $(SFM) samplesrc/sfm.a
$(SFMSPRT): samplesrc/sfmsprt.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/sfmsprt.pla > samplesrc/sfmsprt.a
./$(PLASM) -AMOW samplesrc/sfmsprt.pla
acme --setpc 4094 -o $(SFMSPRT) samplesrc/sfmsprt.a
$(ROGUE): samplesrc/rogue.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/rogue.pla > samplesrc/rogue.a
./$(PLASM) -AMOW samplesrc/rogue.pla
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
./$(PLASM) -AMOW samplesrc/rogue.combat.pla
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
./$(PLASM) -AMOW samplesrc/rogue.map.pla
acme --setpc 4094 -o $(ROGUEMAP) samplesrc/rogue.map.a
hello: samplesrc/hello.pla $(PLVM) $(PLASM)
./$(PLASM) -AMOW < samplesrc/hello.pla > samplesrc/hello.a
./$(PLASM) -AMOW samplesrc/hello.pla
acme --setpc 4094 -o $(HELLO) samplesrc/hello.a
./$(PLVM) HELLO
$(CONIOTEST): samplesrc/coniotest.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW samplesrc/coniotest.pla
acme --setpc 4094 -o $(CONIOTEST) samplesrc/coniotest.a
$(ROD): samplesrc/rod.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/rod.pla > samplesrc/rod.a
./$(PLASM) -AMOW samplesrc/rod.pla
acme --setpc 4094 -o $(ROD) samplesrc/rod.a
$(SIEVE): samplesrc/sieve.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMW < samplesrc/sieve.pla > samplesrc/sieve.a
./$(PLASM) -AMW samplesrc/sieve.pla
acme --setpc 4094 -o $(SIEVE) samplesrc/sieve.a
$(PRIMEGAP): samplesrc/primegap.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMW < samplesrc/primegap.pla > samplesrc/primegap.a
./$(PLASM) -AMW samplesrc/primegap.pla
acme --setpc 4094 -o $(PRIMEGAP) samplesrc/primegap.a
$(INT32): libsrc/int32.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/int32.pla > libsrc/int32.a
./$(PLASM) -AMOW libsrc/int32.pla
acme --setpc 4094 -o $(INT32) libsrc/int32.a
$(INT32TEST): samplesrc/int32test.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/int32test.pla > samplesrc/int32test.a
./$(PLASM) -AMOW samplesrc/int32test.pla
acme --setpc 4094 -o $(INT32TEST) samplesrc/int32test.a
$(SANE): libsrc/sane.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/sane.pla > libsrc/sane.a
./$(PLASM) -AMOW libsrc/sane.pla
acme --setpc 4094 -o $(SANE) libsrc/sane.a
$(FPSTR): libsrc/fpstr.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/fpstr.pla > libsrc/fpstr.a
./$(PLASM) -AMOW libsrc/fpstr.pla
acme --setpc 4094 -o $(FPSTR) libsrc/fpstr.a
$(FPU): libsrc/fpu.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/fpu.pla > libsrc/fpu.a
./$(PLASM) -AMOW libsrc/fpu.pla
acme --setpc 4094 -o $(FPU) libsrc/fpu.a
$(SANITY): samplesrc/sanity.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/sanity.pla > samplesrc/sanity.a
./$(PLASM) -AMOW samplesrc/sanity.pla
acme --setpc 4094 -o $(SANITY) samplesrc/sanity.a
$(LZ4): libsrc/lz4.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/lz4.pla > libsrc/lz4.a
./$(PLASM) -AMOW libsrc/lz4.pla
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
./$(PLASM) -AMOW samplesrc/lz4cat.pla
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
./$(PLASM) -AMOW samplesrc/rpncalc.pla
acme --setpc 4094 -o $(RPNCALC) samplesrc/rpncalc.a
$(ETHERIP): libsrc/etherip.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/etherip.pla > libsrc/etherip.a
./$(PLASM) -AMOW libsrc/etherip.pla
acme --setpc 4094 -o $(ETHERIP) libsrc/etherip.a
$(INET): libsrc/inet.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/inet.pla > libsrc/inet.a
./$(PLASM) -AMOW libsrc/inet.pla
acme --setpc 4094 -o $(INET) libsrc/inet.a
$(DHCP): libsrc/dhcp.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/dhcp.pla > libsrc/dhcp.a
./$(PLASM) -AMOW libsrc/dhcp.pla
acme --setpc 4094 -o $(DHCP) libsrc/dhcp.a
$(HTTPD): samplesrc/httpd.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/httpd.pla > samplesrc/httpd.a
./$(PLASM) -AMOW samplesrc/httpd.pla
acme --setpc 4094 -o $(HTTPD) samplesrc/httpd.a
$(TFTPD): utilsrc/tftpd.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < utilsrc/tftpd.pla > utilsrc/tftpd.a
./$(PLASM) -AMOW utilsrc/tftpd.pla
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
./$(PLASM) -AMOW libsrc/apple/mouse.pla
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
./$(PLASM) -AMOW libsrc/apple/uthernet.pla
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
./$(PLASM) -AMOW libsrc/apple/uthernet2.pla
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
./$(PLASM) -AMOW libsrc/apple/fileio.pla
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
./$(PLASM) -AMOW libsrc/apple/conio.pla
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
./$(PLASM) -AMOW libsrc/c64/fileio.pla
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
./$(PLASM) -AMOW libsrc/c64/conio.pla
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
./$(PLASM) -AMOW libsrc/apple/sndseq.pla
acme --setpc 4094 -o $(SNDSEQ) libsrc/apple/sndseq.a
$(PLAYSEQ): samplesrc/playseq.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/playseq.pla > samplesrc/playseq.a
./$(PLASM) -AMOW samplesrc/playseq.pla
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
./$(PLASM) -AMOW libsrc/apple/grafix.pla
acme --setpc 4094 -o $(GRAFIX) libsrc/apple/grafix.a
$(GFXDEMO): samplesrc/gfxdemo.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/gfxdemo.pla > samplesrc/gfxdemo.a
./$(PLASM) -AMOW samplesrc/gfxdemo.pla
acme --setpc 4094 -o $(GFXDEMO) samplesrc/gfxdemo.a
$(FATCAT): samplesrc/fatcat.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/fatcat.pla > samplesrc/fatcat.a
./$(PLASM) -AMOW samplesrc/fatcat.pla
acme --setpc 4094 -o $(FATCAT) samplesrc/fatcat.a
$(FATGET): samplesrc/fatget.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/fatget.pla > samplesrc/fatget.a
./$(PLASM) -AMOW samplesrc/fatget.pla
acme --setpc 4094 -o $(FATGET) samplesrc/fatget.a
$(FATPUT): samplesrc/fatput.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/fatput.pla > samplesrc/fatput.a
./$(PLASM) -AMOW samplesrc/fatput.pla
acme --setpc 4094 -o $(FATPUT) samplesrc/fatput.a
$(FATWDSK): samplesrc/fatwritedsk.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/fatwritedsk.pla > samplesrc/fatwritedsk.a
./$(PLASM) -AMOW samplesrc/fatwritedsk.pla
acme --setpc 4094 -o $(FATWDSK) samplesrc/fatwritedsk.a
$(FATRDSK): samplesrc/fatreaddsk.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/fatreaddsk.pla > samplesrc/fatreaddsk.a
./$(PLASM) -AMOW samplesrc/fatreaddsk.pla
acme --setpc 4094 -o $(FATRDSK) samplesrc/fatreaddsk.a
$(SDFAT): libsrc/apple/sdfat.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/sdfat.pla > libsrc/apple/sdfat.a
./$(PLASM) -AMOW libsrc/apple/sdfat.pla
acme --setpc 4094 -o $(SDFAT) libsrc/apple/sdfat.a
$(SPIPORT): libsrc/apple/spiport.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/spiport.pla > libsrc/apple/spiport.a
./$(PLASM) -AMOW libsrc/apple/spiport.pla
acme --setpc 4094 -o $(SPIPORT) libsrc/apple/spiport.a
$(JOYBUZZ): libsrc/apple/joybuzz.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/joybuzz.pla > libsrc/apple/joybuzz.a
./$(PLASM) -AMOW libsrc/apple/joybuzz.pla
acme --setpc 4094 -o $(JOYBUZZ) libsrc/apple/joybuzz.a
$(PORTIO): libsrc/apple/portio.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/portio.pla > libsrc/apple/portio.a
./$(PLASM) -AMOW libsrc/apple/portio.pla
acme --setpc 4094 -o $(PORTIO) libsrc/apple/portio.a
$(HGRLIB): libsrc/apple/hgrlib.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/hgrlib.pla > libsrc/apple/hgrlib.a
./$(PLASM) -AMOW libsrc/apple/hgrlib.pla
acme --setpc 4094 -o $(HGRLIB) libsrc/apple/hgrlib.a
$(DHGRLIB): libsrc/apple/dhgrlib.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW libsrc/apple/dhgrlib.pla
acme --setpc 4094 -o $(DHGRLIB) libsrc/apple/dhgrlib.a
$(GRLIB): libsrc/apple/grlib.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/grlib.pla > libsrc/apple/grlib.a
./$(PLASM) -AMOW libsrc/apple/grlib.pla
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
./$(PLASM) -AMOW libsrc/apple/dgrlib.pla
acme --setpc 4094 -o $(DGRLIB) libsrc/apple/dgrlib.a
$(TILETEST): samplesrc/tiletest.pla $(PLASM)
./$(PLASM) -AMOW < samplesrc/tiletest.pla > samplesrc/tiletest.a
./$(PLASM) -AMOW samplesrc/tiletest.pla
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
./$(PLASM) -AMOW libsrc/apple/hgrtile.pla
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
./$(PLASM) -AMOW libsrc/apple/hgrfont.pla
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
./$(PLASM) -AMOW libsrc/apple/hgrsprite.pla
acme --setpc 4094 -o $(HGRSPRITE) libsrc/apple/hgrsprite.a
$(HGRTEST): samplesrc/hgrtest.pla $(HGRLIB) $(PLASM)
./$(PLASM) -AMOW < samplesrc/hgrtest.pla > samplesrc/hgrtest.a
./$(PLASM) -AMOW samplesrc/hgrtest.pla
acme --setpc 4094 -o $(HGRTEST) samplesrc/hgrtest.a
$(GRTEST): samplesrc/grtest.pla $(GRLIB) $(PLASM)
./$(PLASM) -AMOW < samplesrc/grtest.pla > samplesrc/grtest.a
./$(PLASM) -AMOW samplesrc/grtest.pla
acme --setpc 4094 -o $(GRTEST) samplesrc/grtest.a
$(DGRTEST): samplesrc/dgrtest.pla $(DGRLIB) $(PLASM)
./$(PLASM) -AMOW < samplesrc/dgrtest.pla > samplesrc/dgrtest.a
./$(PLASM) -AMOW samplesrc/dgrtest.pla
acme --setpc 4094 -o $(DGRTEST) samplesrc/dgrtest.a
$(MON): utilsrc/apple/mon.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/mon.pla > utilsrc/apple/mon.a
./$(PLASM) -AMOW utilsrc/apple/mon.pla
acme --setpc 4094 -o $(MON) utilsrc/apple/mon.a
$(COPY): utilsrc/apple/copy.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/copy.pla > utilsrc/apple/copy.a
$(COPY): utilsrc/apple/copy.pla $(MATCHFILES) $(PLASM)
./$(PLASM) -AMOW utilsrc/apple/copy.pla
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
$(DEL): utilsrc/apple/del.pla $(MATCHFILES) $(PLASM)
./$(PLASM) -AMOW utilsrc/apple/del.pla
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
./$(PLASM) -AMOW utilsrc/apple/ren.pla
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
$(CAT): utilsrc/apple/cat.pla $(MATCHFILES) $(PLASM)
./$(PLASM) -AMOW utilsrc/apple/cat.pla
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
./$(PLASM) -AMOW utilsrc/apple/newdir.pla
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
./$(PLASM) -AMOW utilsrc/apple/type.pla
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
./$(PLASM) -AMOW utilsrc/apple/sos.pla
acme --setpc 4094 -o $(SOS) utilsrc/apple/sos.a
$(ZIP): utilsrc/apple/zip.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/zip.pla > utilsrc/apple/zip.a
acme --setpc 4094 -o $(ZIP) utilsrc/apple/zip.a
$(ZIPCHIP): utilsrc/apple/zipchip.pla $(PLASM)
./$(PLASM) -AMOW utilsrc/apple/zipchip.pla
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
./$(PLASM) -AMOW libsrc/apple/jit.pla
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
./$(PLASM) -AMOW libsrc/apple/jit16.pla
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
./$(PLASM) -AMOW utilsrc/apple/jitune.pla
acme --setpc 4094 -o $(JITUNE) utilsrc/apple/jitune.a

9
src/mk140 Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
./mkrel
./mkinst
./mksys
./mkfpsos
./mkbld
./mkinet
./mkdemos

49
src/mk4th Executable file
View File

@ -0,0 +1,49 @@
cp ../sysfiles/BLANK140.po PLFORTH.PO
./ac.jar -n PLFORTH.PO PLFORTH
cat ../sysfiles/PRODOS#FF0000 | ./ac.jar -p PLFORTH.PO PRODOS SYS
cat rel/apple/CMD#061000 | ./ac.jar -p PLFORTH.PO CMD BIN $1000
cat rel/apple/PLASMA.SYSTEM#FF2000 | ./ac.jar -p PLFORTH.PO PLASMA.SYSTEM SYS
cat rel/apple/FILEIO#FE1000 | ./ac.jar -p PLFORTH.PO sys/FILEIO REL
cat rel/apple/CONIO#FE1000 | ./ac.jar -p PLFORTH.PO sys/CONIO REL
cat rel/ARGS#FE1000 | ./ac.jar -p PLFORTH.PO sys/ARGS REL
cat rel/LONGJMP#FE1000 | ./ac.jar -p PLFORTH.PO sys/LONGJMP REL
cat rel/HRFORTH#FE1000 | ./ac.jar -p PLFORTH.PO sys/HRFORTH REL
cat rel/HR2FORTH#FE1000 | ./ac.jar -p PLFORTH.PO sys/HR2FORTH REL
cat rel/TX2FORTH#FE1000 | ./ac.jar -p PLFORTH.PO sys/TX2FORTH REL
cat rel/PLFORTH#FE1000 | ./ac.jar -p PLFORTH.PO sys/PLFORTH REL
cat rel/apple/COPY#FE1000 | ./ac.jar -p PLFORTH.PO sys/COPY REL
cat rel/apple/DEL#FE1000 | ./ac.jar -p PLFORTH.PO sys/DEL REL
cat rel/apple/REN#FE1000 | ./ac.jar -p PLFORTH.PO sys/REN REL
cat rel/apple/CAT#FE1000 | ./ac.jar -p PLFORTH.PO sys/CAT REL
#cat rel/apple/TYPE#FE1000 | ./ac.jar -p PLFORTH.PO sys/TYPE REL
#cat rel/apple/NEWDIR#FE1000 | ./ac.jar -p PLFORTH.PO sys/NEWDIR REL
cat rel/apple/MATCHFILES#FE1000 | ./ac.jar -p PLFORTH.PO sys/MATCHFILES REL
cat rel/INT32#FE1000 | ./ac.jar -p PLFORTH.PO sys/INT32 REL
#cat rel/FPSTR#FE1000 | ./ac.jar -p PLFORTH.PO sys/FPSTR REL
#cat rel/FPU#FE1000 | ./ac.jar -p PLFORTH.PO sys/FPU REL
#cat rel/SANE#FE1000 | ./ac.jar -p PLFORTH.PO sys/SANE REL
#cat ../sysfiles/FP6502.CODE#060000 | ./ac.jar -p PLFORTH.PO sys/FP6502.CODE BIN
#cat ../sysfiles/ELEMS.CODE#060000 | ./ac.jar -p PLFORTH.PO sys/ELEMS.CODE BIN
cat rel/ED#FE1000 | ./ac.jar -p PLFORTH.PO sys/ED REL
cat rel/LINES#FE1000 | ./ac.jar -p PLFORTH.PO sys/LINES REL
cat rel/apple/HGRFONT#FE1000 | ./ac.jar -p PLFORTH.PO sys/HGRFONT REL
cat rel/apple/HGRTILE#FE1000 | ./ac.jar -p PLFORTH.PO sys/HGRTILE REL
cat rel/apple/HGRSPRITE#FE1000 | ./ac.jar -p PLFORTH.PO sys/HGRSPRITE REL
cat rel/apple/HGRLIB#FE1000 | ./ac.jar -p PLFORTH.PO sys/HGRLIB REL
cat rel/apple/GRLIB#FE1000 | ./ac.jar -p PLFORTH.PO sys/GRLIB REL
cat rel/apple/DGRLIB#FE1000 | ./ac.jar -p PLFORTH.PO sys/DGRLIB REL
cat scripts/plasma.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/PLASMA.4TH TXT
cat scripts/machid.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/MACHID.4TH TXT
cat scripts/conio.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/CONIO.4TH TXT
cat scripts/fileio.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/FILEIO.4TH TXT
cat scripts/grlib.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/GRLIB.4TH TXT
cat scripts/dgrlib.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/DGRLIB.4TH TXT
cat scripts/hgrlib.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/HGRLIB.4TH TXT
cat scripts/int32.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/INT32.4TH TXT
#cat scripts/fpu.4th | ./ac.jar -ptx PLFORTH.PO sys/scripts/FPU.4TH TXT
cat scripts/rod.4th | ./ac.jar -ptx PLFORTH.PO scripts/ROD.4TH TXT
cat scripts/bounce.4th | ./ac.jar -ptx PLFORTH.PO scripts/BOUNCE.4TH TXT
cat scripts/dbounce.4th | ./ac.jar -ptx PLFORTH.PO scripts/DBOUNCE.4TH TXT
cat scripts/hrbounce.4th | ./ac.jar -ptx PLFORTH.PO scripts/HRBOUNCE.4TH TXT
#cat scripts/hrplot.4th | ./ac.jar -ptx PLFORTH.PO scripts/HRPLOT.4TH TXT
echo "+PLFORTH PLASMA.4TH" | ./ac.jar -ptx PLFORTH.PO AUTORUN TXT

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