1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-08-07 18:25:03 +00:00

910 Commits
DP3 ... master

Author SHA1 Message Date
David Schmenk
3bfdbd1910 Add Fest video link 2025-08-06 07:30:47 -07:00
David Schmenk
f4c58afec2 Update system files for slideshow 2025-07-13 13:56:32 -07:00
David Schmenk
21cdc64434 Add composite option to list 2025-06-26 20:47:20 -07:00
David Schmenk
aeda1f8ce7 Add KFest presentation disk image 2025-06-04 10:08:21 -07:00
David Schmenk
5b3417387a Ultraterm fix for screen height 2025-05-31 10:16:49 -07:00
David Schmenk
9baf4dc120 Expand documentation list 2025-05-12 08:50:16 -07:00
David Schmenk
194aa4d7f2 Update terminology 2025-05-12 08:37:36 -07:00
David Schmenk
2266407598 welcome video link 2025-05-10 13:38:16 -07:00
David Schmenk
725646e68e Update README.md 2025-05-10 13:36:02 -07:00
David Schmenk
890c43f8dc Update to PLIEADES 2025-05-10 13:34:48 -07:00
David Schmenk
d1fabd4538 Convert ROD.BAS to uppercase for older Apple ]['s 2025-05-09 10:38:07 -07:00
David Schmenk
02345e68fe Update image with new CMD* 2025-05-09 08:49:40 -07:00
David Schmenk
9a7fedabc2 Clean up Virtual ][ 80 column card mode set 2025-05-09 08:48:00 -07:00
David Schmenk
5d9ff1c492 Always run through 80+ column initialization 2025-05-09 08:39:45 -07:00
David Schmenk
6f64bcecdf Rebuild 32M image 2025-05-08 12:41:14 -07:00
David Schmenk
257f814cd3 Adjust how 80 columns is initialized 2025-05-08 11:02:28 -07:00
David Schmenk
7175f5f6e7 Make 80 column the default 2025-05-08 10:31:52 -07:00
David Schmenk
11d5b42cf3 Make 80 column mode the default 2025-05-08 10:30:46 -07:00
David Schmenk
cfced6a64a Fix command files and ProDOS clock overwriting the cmd line 2025-05-05 17:55:52 -07:00
David Schmenk
8c61098fdc Add BASIC ROD sample code 2025-05-05 14:32:20 -07:00
David Schmenk
4fcb9e2769 Add INITSLOT to stand-alone language images 2025-05-05 06:35:16 -07:00
David Schmenk
119bc00b49 Add modkeep to DHGR modules 2025-05-01 16:08:55 -07:00
David Schmenk
be0e7a7427 Set 80 column flag for Portable VM 2025-05-01 16:01:11 -07:00
David Schmenk
1fb08214b8 Fix return to 80 column mode if enabled 2025-04-21 21:22:00 -07:00
David Schmenk
e2ea8af616 Update images with more 80 column support and LISP memory improvemets 2025-04-21 13:21:58 -07:00
David Schmenk
22a411c098 Actually build CONIO 2025-04-20 22:01:51 -07:00
David Schmenk
a4f9d6455f Apple /// defaults to 80 columns 2025-04-20 20:41:54 -07:00
David Schmenk
af3fbd5edf Default Apple /// to 80 columns 2025-04-20 20:21:11 -07:00
David Schmenk
4f2174c8f1 Shorten name of install floppy 2025-04-19 12:39:02 -07:00
David Schmenk
a1c1c6498f Fix install script disk names 2025-04-18 17:24:11 -07:00
David Schmenk
fda3ec6960 Clean up dhgr utils directory 2025-04-18 09:54:47 -07:00
David Schmenk
f4510b0d3f Forgot DHGR FONTS 2025-04-18 09:38:35 -07:00
David Schmenk
acd25e476f Update stand alone image 2025-04-18 08:37:00 -07:00
David Schmenk
919058b039 Fix PLFORTH and FP loading. Fix return to default text mode 2025-04-18 08:32:31 -07:00
David Schmenk
f3c15e7d3d Allocate temp inbuf during BRK handling in FORTH 2025-04-17 13:46:14 -07:00
David Schmenk
568a02df50 Don't copy LISP interpreter source 2025-04-16 17:21:14 -07:00
David Schmenk
152e491506 Default PLFORTH to PBC mode and fix Apple /// keypressed() 2025-04-16 16:36:33 -07:00
David Schmenk
acd5d01d7e Pause after state dump in DHGRRGB 2025-04-16 13:22:46 -07:00
David Schmenk
4a371e1620 Update default gamma correction to zero for DHGRRGB 2025-04-16 13:09:42 -07:00
David Schmenk
180db77474 Fix last line in source file not ending with CR 2025-04-16 11:00:35 -07:00
David Schmenk
ce0b5c1757 Add more DHGR test fonts 2025-04-15 12:49:56 -07:00
David Schmenk
6524063c66 Update DHGR toolkit files in images 2025-04-15 10:36:41 -07:00
David Schmenk
063ea4c888 Clean up BLD image and update ASM.TK with latest sources 2025-04-15 07:51:56 -07:00
David Schmenk
4e27c38cca Another typo in link 2025-04-14 21:22:03 -07:00
David Schmenk
8ac82548f4 Fix type in link 2025-04-14 21:21:24 -07:00
David Schmenk
5a9e17c645 Prep docs for update 2025-04-14 21:19:41 -07:00
David Schmenk
fa20432ef3 Update PLEIADES.md 2025-04-14 21:07:45 -07:00
David Schmenk
152249690d Update PLEIADES.md 2025-04-14 20:50:03 -07:00
David Schmenk
21008ec08d Update images with debug.asm sample src and fixed cmd* 2025-04-14 17:02:27 -07:00
David Schmenk
13c9779d0d Working debug skeleton 2025-04-14 14:26:40 -07:00
David Schmenk
b126e15272 Update build image scripts 2025-04-13 21:26:24 -07:00
David Schmenk
72e72ebf0c working debug skeleton 2025-04-12 20:13:43 -07:00
David Schmenk
e98ee57e6c Fix prefix overwriting modkeep modules 2025-04-12 19:06:29 -07:00
David Schmenk
1829b73b60 Fix prefix overwriting modkeep modules 2025-04-12 19:04:23 -07:00
David Schmenk
3fb399deeb Start a debugging module 2025-04-10 06:46:32 -07:00
David Schmenk
8493c14ee6 Update PLFORTH.md 2025-04-07 20:08:42 -07:00
David Schmenk
ecb19d8580 Forgot LISP in images :-( 2025-04-07 19:31:21 -07:00
David Schmenk
5f4f6a32e2 Remove unneccesary 4TH file 2025-04-07 19:06:39 -07:00
David Schmenk
0f484aff27 New PLEIADES header 2025-04-07 17:04:28 -07:00
David Schmenk
52c59eba07 Re-brand everything with PLEIADES 2025-04-07 11:13:33 -07:00
David Schmenk
56658cf49d Prepare for PLEIADES 2025-04-06 22:45:56 -07:00
David Schmenk
c5f950ff24 Update FORTH 2025-04-06 18:47:24 -07:00
David Schmenk
1ea090b08e Allow lower case input for PLFORTH. Remove PLVM16 from DRAWL.PO and change directory to LISP at startup 2025-04-06 12:22:42 -07:00
David Schmenk
75eb25b67c Update images 2025-04-06 11:45:15 -07:00
David Schmenk
87bdb7882e Keypad command clarification 2025-04-02 17:58:58 -07:00
David Schmenk
4df8bfc66d Fix misplaed ED 2025-04-01 18:40:44 -07:00
David Schmenk
a5bdac2973 forgot bld sources 2025-03-25 19:08:21 -07:00
David Schmenk
e1ac8f4da4 Update images 2025-03-25 19:01:04 -07:00
David Schmenk
4157f0235e Going for all optimizations 2025-03-25 17:35:27 -07:00
David Schmenk
0fe84a9bdb micro optimizations 2025-03-24 16:53:59 -07:00
David Schmenk
257815f9fc A few more optimizations trying to get mem->screen as fast as possible
Signed-off-by: David Schmenk <dschmenk@gmail.com>
2025-03-24 13:01:24 -07:00
David Schmenk
da22dfd526 Add startrek demo 2025-03-22 23:47:33 -07:00
David Schmenk
cbae6efa78 Add another multivalue return test for pointer lvalues 2025-03-22 06:38:46 -07:00
David Schmenk
03e562bc88 Make goto line # simpler (just ESC line #) 2025-03-21 12:04:28 -07:00
David Schmenk
0dae68e86d Update BASIC to 1.5 2025-03-20 17:35:34 -07:00
David Schmenk
8491f221e5 Update to BASIC 1.5 2025-03-20 17:32:38 -07:00
David Schmenk
2aadc82154 Fix makefile for Linux compiles of dhgrrgb.c 2025-03-20 13:46:38 -07:00
David Schmenk
41180672a0 Add BASIC for real this time 2025-03-20 12:55:55 -07:00
David Schmenk
a080ff02b1 Add BASIC to BLD directory 2025-03-20 12:49:13 -07:00
David Schmenk
6cba91005c Fix creash on return from BASIC and ROGUE conio calls 2025-03-20 12:42:37 -07:00
David Schmenk
0f2c495425 Update editor readme 2025-03-20 11:13:32 -07:00
David Schmenk
e73c623a52 Add command line shortcut executable files 2025-03-20 08:27:53 -07:00
David Schmenk
93debf7de0 update images 2025-03-19 18:36:51 -07:00
David Schmenk
751cb5acf7 Update image 2025-03-19 18:19:39 -07:00
David Schmenk
5402b7c44c Fix incorrect viewport setiings 2025-03-19 18:15:05 -07:00
David Schmenk
e2601361ef Add executable macros to cmdsys and numlock to editor 2025-03-19 17:50:56 -07:00
David Schmenk
d8d8489fd6 Windows EXE for DHGRRGB 2025-03-18 18:25:12 -07:00
David Schmenk
8fe9e802cc Fix grey mapping 2025-03-18 17:47:52 -07:00
David Schmenk
12a3071652 Update makefile to build C version of dhgrrgb 2025-03-18 12:30:02 -07:00
David Schmenk
ef37709a2d Add C version of RGB -> DHGR converter 2025-03-18 12:20:11 -07:00
David Schmenk
756ea5b4bc Update darth.dhgr 2025-03-18 10:40:26 -07:00
David Schmenk
222457911c Render Darth with gamma of 0 2025-03-18 10:36:15 -07:00
David Schmenk
4742c2d490 Update image 2025-03-18 09:54:29 -07:00
David Schmenk
204e2e57ba Clean up music API 2025-03-18 09:07:03 -07:00
David Schmenk
14ee367e56 Simplify music sequence parameters 2025-03-18 09:00:38 -07:00
David Schmenk
4c4e9a4e4f Now fix repeating sequences 2025-03-15 19:17:56 -07:00
David Schmenk
7df77e19f1 Fix non-repeating sequences and font extentes 2025-03-15 18:54:53 -07:00
David Schmenk
ed5bdc314d Make sure 40 column text mode properly restored 2025-03-15 13:51:08 -07:00
David Schmenk
1f62957e36 Add new demo 2025-03-15 11:21:44 -07:00
David Schmenk
23f9fdaa46 Add some test assets 2025-03-15 10:27:30 -07:00
David Schmenk
ebaa7b25be Add samples image 2025-03-15 09:54:36 -07:00
David Schmenk
4321eec00f Better INITSLOT 0 processing 2025-03-14 19:45:55 -07:00
David Schmenk
10cd4969f4 Fixed 80 column mode set/unset 2025-03-14 19:22:25 -07:00
David Schmenk
16d848e784 Fix duplicate racecar.pnm 2025-03-14 17:54:47 -07:00
David Schmenk
559c44624d Update images 2025-03-14 15:04:49 -07:00
David Schmenk
bc500851cd Remove unneeded initialization for gc_trigger 2025-03-14 14:56:47 -07:00
David Schmenk
8909d0b933 Do a better job of matching garbage collection with available memory 2025-03-14 12:27:19 -07:00
David Schmenk
c1bfeae763 Update the asm inc file 2025-03-13 19:54:59 -07:00
David Schmenk
ae762e6f0b A few low level LISP optimizations 2025-03-13 18:01:21 -07:00
David Schmenk
dc28a5490b Add Apple /// functionality to VBLANK 2025-03-12 19:39:16 -07:00
David Schmenk
aa0db454e1 Update FORTH image 2025-03-12 15:41:51 -07:00
David Schmenk
ac0c605325 Update FORTH images 2025-03-12 14:51:00 -07:00
David Schmenk
3db001ee79 Optimize some low level FORTH routines 2025-03-12 13:22:23 -07:00
David Schmenk
d1f7ed7e6f Hopefully have Solid Apple support for Apple /// 2025-03-11 17:50:15 -07:00
David Schmenk
5707d5357e 80 column editor support for Apple /// 2025-03-11 17:26:39 -07:00
David Schmenk
81e6092a30 Fix jump to end off-by-one bug 2025-03-07 13:31:58 -08:00
David Schmenk
3c9212de9b Fix view width off by one bug 2025-03-07 08:25:08 -08:00
David Schmenk
8bb1efcf95 Fix past last line redraw 2025-03-07 07:45:33 -08:00
David Schmenk
bd5f97c91d Unbreak 40 column uppercase output 2025-03-06 21:41:47 -08:00
David Schmenk
b00e764971 Update disk images 2025-03-06 20:35:44 -08:00
David Schmenk
b729ceabc7 Fix cursor to end hard coded fo 24 lines 2025-03-06 20:02:36 -08:00
David Schmenk
9430f28df0 More ALS SmartTerm controls 2025-03-06 19:46:37 -08:00
David Schmenk
31c9fae21f Test for ALS SmartTerm 2025-03-06 19:23:49 -08:00
David Schmenk
7228eb8309 Update disk image build scripts 2025-03-05 22:01:40 -08:00
David Schmenk
c19a40843d Update disk image 2025-03-05 15:52:38 -08:00
David Schmenk
9c9d78bd60 Fix bottom of window scroll for VIDEX 2025-03-05 15:34:17 -08:00
David Schmenk
75927fcf6b Fix bottom of scroll windows for > 24 lines 2025-03-05 15:14:56 -08:00
David Schmenk
8e404df8d8 Fix textmode to allow UltraTerm resolution return values 2025-03-05 14:55:57 -08:00
David Schmenk
32b29f44a2 Remove unneccesary return value from putchars 2025-03-05 09:02:55 -08:00
David Schmenk
84cd9bf413 Update FORTH image 2025-03-05 07:54:05 -08:00
David Schmenk
bde32b9c39 Maybe it was my //e 80 column bug. 2025-03-05 07:42:25 -08:00
David Schmenk
6b691dcdc5 Fix bug in //e 80 column CLEOL after GOTOXY 2025-03-04 20:49:28 -08:00
David Schmenk
e9a75048ef Fix gutter toggle redraw 2025-03-04 17:25:19 -08:00
David Schmenk
574c6e5964 Work better with VIDEX inverse character set 2025-03-04 13:00:12 -08:00
David Schmenk
74e669a23c Add support for VIDEX UltraTerm 2025-03-04 12:07:22 -08:00
David Schmenk
121e415b4b Fix keypad input tesdt 2025-03-03 20:15:54 -08:00
David Schmenk
67d5c2525f Fix previous mess 2025-03-03 16:23:04 -08:00
David Schmenk
22f11a089c Work around VIDEX capturing CTRL-S 2025-03-03 14:57:39 -08:00
David Schmenk
93af94055d Get VIDEX and //e 80 col to agree on cursor 2025-03-03 14:35:11 -08:00
David Schmenk
f56784b275 Try again for VIDEX cursor control 2025-03-03 14:13:01 -08:00
David Schmenk
348b45a7d8 Slightly better cursor handling for VIDEX 2025-03-03 13:57:00 -08:00
David Schmenk
e2334444f1 Make sure printing works 2025-03-03 12:22:14 -08:00
David Schmenk
87ef9a9a2d Further fix some VIDEX 80 column issues 2025-03-03 10:21:51 -08:00
David Schmenk
27785e8513 Update images 2025-03-02 22:09:08 -08:00
David Schmenk
9425c69b39 Another attempt at workable VBL measurement 2025-03-02 22:01:53 -08:00
David Schmenk
279123fd68 Make new editor the default 2025-03-02 21:13:07 -08:00
David Schmenk
82d4633d28 Work out more VIDEX 80 column handling 2025-03-02 14:31:10 -08:00
David Schmenk
83315b492d Use VBLank to calibrate cursor flashing 2025-03-02 09:56:35 -08:00
David Schmenk
82411e5e49 Update disk image 2025-03-01 20:40:09 -08:00
David Schmenk
cb2b28e3a5 Prep for 80 column support throughout 2025-03-01 18:24:36 -08:00
David Schmenk
2b79be476d Closer to functional 80 column support 2025-02-25 22:37:26 -08:00
David Schmenk
b0846eac5f Start moving device specific code into conio 2025-02-21 08:45:59 -08:00
David Schmenk
b135504044 Upgrade ED80 to 127 length lines 2025-02-17 17:07:20 -08:00
Dave Schmenk
024a1c01c6 Allow lines up to 127 characters 2025-02-17 12:56:04 -08:00
David Schmenk
bb3730f943 Begin 80 column text editor 2025-02-16 09:18:12 -08:00
David Schmenk
413284a09f Fix bugs affecting FORTH and EDitor 2025-02-16 06:53:02 -08:00
David Schmenk
318eb58a13 Remove VBL functions from 4TH scripts 2025-02-14 17:45:05 -08:00
David Schmenk
cae889cffd Make better use of available memory in editor 2025-02-14 15:51:15 -08:00
David Schmenk
99dffac141 Fix parsing bug I just introduced 2025-02-14 14:47:32 -08:00
David Schmenk
eb0ed22c2a Assembly-ize poolalloc for massive speedup 2025-02-14 05:58:07 -08:00
David Schmenk
95833a5d4a Speed up editor a little 2025-02-13 22:15:54 -08:00
David Schmenk
1436bbd2e8 Fix stupid new/del string in editor 2025-02-13 17:30:11 -08:00
David Schmenk
c42797d544 ample code formatting 2025-02-12 18:44:05 -08:00
David Schmenk
a9f90b3db0 Update editor to use Platinum //e keypad like /// keypad 2025-02-12 14:41:06 -08:00
David Schmenk
2940da149e Update image 2025-02-12 14:08:14 -08:00
David Schmenk
c37ab7058a Save full version of DHGRRGB and simplify main DHGRRGB 2025-02-12 13:58:09 -08:00
David Schmenk
5efa958bc9 Add way to disable GREY hack dor better composite output 2025-02-10 11:50:53 -08:00
David Schmenk
9117737e27 Speed up DHGRRGB conversion a bit 2025-02-06 20:57:44 -08:00
David Schmenk
f74c11947e Break out VBlank waiting into own module 2025-02-06 17:46:47 -08:00
David Schmenk
b85234b910 Fix //c VBL ints once and for all 2025-02-06 15:40:46 -08:00
David Schmenk
0f179defd3 Update disk image 2025-02-06 14:02:14 -08:00
David Schmenk
9fc2f1769e Fix VBL test for //c and UltraWarp 2025-02-06 13:56:51 -08:00
David Schmenk
98440eef79 Capture all ZP state for 16 bit VM in FIBER library 2025-02-02 20:20:43 -08:00
David Schmenk
fa0fe76533 Fix fiber library for larger VM state 2025-02-02 17:07:43 -08:00
David Schmenk
db921c7545 Break out //c keyin so it doesn't mess wuth UltraWarp soft switches 2025-02-02 14:54:16 -08:00
David Schmenk
bb4cb253fb Update disk image with dhgrshow lz4 updates 2025-02-01 18:14:38 -08:00
David Schmenk
8f706f387c Move more LZ4 file decomression into LZ4 module 2025-02-01 17:41:28 -08:00
David Schmenk
f697f502cf Fix typo 2025-02-01 12:22:45 -08:00
David Schmenk
6117c69d08 Use end of dest buffer fro decompress tokens for due to low memory 2025-02-01 12:19:52 -08:00
David Schmenk
8d7d9ce6b4 Update disk image 2025-01-30 08:59:38 -08:00
David Schmenk
b4d8f463a1 Add binary format to numbers in PLFORTH and cleant up some plvm code 2025-01-19 16:14:42 -08:00
David Schmenk
4c4924a34b Adjust native compiler buffer sizes for best useage 2025-01-19 07:43:43 -08:00
David Schmenk
18812f9b67 Try and free up some compiler memory for 64K machines 2025-01-18 19:59:27 -08:00
David Schmenk
434871d0c2 Ignore control characters in strings 2025-01-18 07:40:26 -08:00
David Schmenk
dcf1d9cba5 Add string extents calc 2025-01-18 06:58:05 -08:00
David Schmenk
2a01a25278 Add default fonts to system directory 2025-01-17 17:59:43 -08:00
David Schmenk
ef4efa5052 Make default fonts load on demand 2025-01-17 15:32:07 -08:00
David Schmenk
bde5af00b7 Convert Apple II ROM font into slim proportional font 2025-01-16 16:59:15 -08:00
David Schmenk
e3671ea831 Cleanr up demo text and neg y clippings 2025-01-16 13:47:54 -08:00
David Schmenk
794802c2b1 Add neg y check for screen bit/pixmap and add black on white or white on black options for AA font conversions 2025-01-16 09:53:38 -08:00
David Schmenk
95a30fb13a Many font fixes (and mem dest y clipping for neg y) 2025-01-15 18:32:04 -08:00
David Schmenk
218eb6fcb1 Fix bugs and add bitmap/pixmap options for font conversion 2025-01-15 09:00:28 -08:00
David Schmenk
8d8f831e3d Add DazleDraw font file to decode 2025-01-14 16:53:43 -08:00
David Schmenk
8bc6108313 Update compiler module 2025-01-14 14:57:10 -08:00
David Schmenk
53dd1ec6aa Use line continuation to remove intermediate calcs 2025-01-14 10:21:11 -08:00
David Schmenk
18cf6aea8b Fix datasize adjustment when no global data emitted 2025-01-14 10:13:58 -08:00
David Schmenk
08db20753b Add line continuation to compiler lexer 2025-01-14 09:28:31 -08:00
David Schmenk
ea39e71ed9 Two font formats for bitmaps and pixmaps 2025-01-12 19:23:03 -08:00
David Schmenk
b7a7d60019 Add left and width together for advance 2025-01-11 22:54:16 -08:00
David Schmenk
6b8d7fa38b Mostly working font conversion 2025-01-11 18:41:31 -08:00
David Schmenk
affba20a20 Clean up font conversions 2025-01-10 21:28:50 -08:00
David Schmenk
5c68a9c6ea A bunch of GS fonts 2025-01-10 20:09:15 -08:00
David Schmenk
abbb32de5c Parse and dump GS font glyphs 2025-01-10 19:45:03 -08:00
David Schmenk
a32b82dcd7 Dump additional state 2025-01-10 10:38:54 -08:00
David Schmenk
9477cd1413 Adjust inital scanline RGB 2025-01-10 07:39:01 -08:00
David Schmenk
1527273bcc Add more dump data and default err = 4 2025-01-10 07:31:37 -08:00
Dave Schmenk
e21a8fff60 Set default errDiv to 6. Not quite so noisy 2025-01-07 22:07:18 -08:00
David Schmenk
1b19b48de9 Undo weighted distance. Do ame thing with gamut 2025-01-07 08:42:30 -08:00
David Schmenk
7dfafd2d93 Make weighted distance an option 2025-01-06 11:06:05 -08:00
David Schmenk
4bb8d7b1cc Merge branch 'master' of https://github.com/dschmenk/PLASMA 2025-01-06 10:29:14 -08:00
David Schmenk
bfa2a58993 Use weighted distance for nearest color match 2025-01-06 10:28:44 -08:00
David Schmenk
1667161d1c Fix new name for cross-compiler 2025-01-04 08:33:24 -08:00
David Schmenk
4769f3fb82 Clean up stack handling for FORTH and PLVM 2025-01-03 15:55:29 -08:00
David Schmenk
b30d61f834 Merge branch 'master' of http://github.com/dschmenk/PLASMA 2025-01-03 13:41:16 -08:00
David Schmenk
6a4362c970 Fix input for portable VM 2025-01-03 13:39:33 -08:00
David Schmenk
dc7a32077b Add tutorial image 2025-01-02 23:33:33 -08:00
David Schmenk
d47956443c Tutorial images 2025-01-02 20:23:16 -08:00
David Schmenk
c3e24be56c Update tutorial files 2025-01-02 19:03:30 -08:00
David Schmenk
de57f5e19b Code optimizations for RGB conversion 2025-01-02 09:39:35 -08:00
David Schmenk
5883fc8fae Add optimization for multiply by 3 2025-01-02 07:25:21 -08:00
David Schmenk
e1f0cf9164 Add the big disk for 2.20 2025-01-01 22:04:30 -08:00
David Schmenk
ca0250f500 Update DHGRSHOW with NOJITC version 2025-01-01 21:42:24 -08:00
David Schmenk
20eaf2a74a Update images 2025-01-01 21:19:08 -08:00
David Schmenk
d188d75a19 Increase compiler symbol size and update images 2025-01-01 17:17:17 -08:00
David Schmenk
516752c285 Call DHGRRGB version 1.0 2025-01-01 11:44:29 -08:00
David Schmenk
08fcd3a986 Even more simplification with *better* results 2025-01-01 10:52:08 -08:00
David Schmenk
9e7f26407c Update WOZ image 2024-12-31 07:59:21 -08:00
David Schmenk
2c1a243311 Forgot to update portable VM eval stack size 2024-12-31 07:30:32 -08:00
David Schmenk
15ba3b9553 Updated images 2024-12-30 22:03:10 -08:00
David Schmenk
fe783e5038 Update images 2024-12-30 19:41:53 -08:00
David Schmenk
a7328da9b3 Update disk image build scripts 2024-12-29 12:56:16 -08:00
David Schmenk
692cf84712 Update ZP stack size 2024-12-29 10:40:58 -08:00
David Schmenk
ad03eff0eb BIG update to expand eval stack to 32. These are the dependencies: 2024-12-27 10:10:11 -08:00
David Schmenk
b776452157 Update comments and data types 2024-12-26 19:24:00 -08:00
David Schmenk
f6a1dcf256 Add multiple RGB phase angles 2024-12-24 16:21:54 -08:00
David Schmenk
75353621c1 Add full pixel match option 2024-12-24 08:14:21 -08:00
David Schmenk
af23f7cf71 Rename gamut array 2024-12-22 10:35:40 -08:00
David Schmenk
550931305b Adjust indivivual RGB gamut 2024-12-22 10:12:13 -08:00
David Schmenk
2da1388a5e Update command line help display 2024-12-19 15:04:19 -08:00
David Schmenk
6678772a06 Add slide for SMPT colorbars 2024-12-18 08:16:35 -08:00
David Schmenk
8673659267 Add slides 2024-12-16 17:08:43 -08:00
David Schmenk
d7df8f04c6 Add more slides 2024-12-16 15:56:09 -08:00
David Schmenk
71e04a3cdc Add larger slideshow 2024-12-15 21:44:06 -08:00
David Schmenk
44e4e835e5 Tweak values and add setmakr/getmark to PLVM 2024-12-15 17:57:22 -08:00
David Schmenk
2310fba421 Read PNM image directly 2024-12-15 13:36:40 -08:00
David Schmenk
4232ef839a cleanup 2024-12-14 19:27:21 -08:00
David Schmenk
376feacbf5 Add ability to run all in memory for PLVM 2024-12-14 19:04:34 -08:00
David Schmenk
512c307531 Avoid reading pixel back from screen - just track it 2024-12-14 12:45:16 -08:00
David Schmenk
f3089caba6 Tweak some values for better colorbars matching 2024-12-13 22:41:35 -08:00
David Schmenk
331c5c2dea Calc true NTSC color wheel values for RGB 2024-12-13 13:32:44 -08:00
David Schmenk
480b98e817 Add more command line optionsa 2024-12-13 10:12:38 -08:00
David Schmenk
e51753e512 Fix expressios op priority sequence bug in parser 2024-12-13 07:21:20 -08:00
David Schmenk
af7988a71b Replace ARCHES with BMW 2024-12-11 12:42:54 -08:00
David Schmenk
bbe09b035d Replace ARCHES with BMW in slideshow 2024-12-11 12:38:13 -08:00
David Schmenk
d90e3c797e Update DHGR slidesh t push 2024-12-11 12:04:59 -08:00
David Schmenk
8f4b05ef31 Update to calculate chroma cycle values and adjust tint - to great effect! 2024-12-11 08:36:22 -08:00
David Schmenk
318c893b32 Better scaled, sliding chroma window calc 2024-12-10 09:15:07 -08:00
David Schmenk
ce34adc3e9 All new and simpler color matching algorithm 2024-12-09 21:44:17 -08:00
David Schmenk
616096fb53 Cleaned up with magic chroma reset value 2024-12-08 18:24:30 -08:00
David Schmenk
6f6c41943a Revert to more complete grey1 -> grey2 mappingg 2024-12-08 14:42:30 -08:00
David Schmenk
efa87a5473 Attempt chroma cycle reset after grey output 2024-12-08 12:00:19 -08:00
David Schmenk
60baf4ce5f Fix grey streaks wit articial grey chroma cycle 2024-12-08 11:30:33 -08:00
David Schmenk
4a40412236 Add a bunch of command line options to tweak RGB conversion 2024-12-07 16:13:43 -08:00
David Schmenk
d73a2a9007 Lower low-pass filter threshold 2024-12-07 12:28:50 -08:00
David Schmenk
99bbca0264 More inclusive low pass filter for color match look ahead 2024-12-07 11:57:59 -08:00
David Schmenk
2a9e506fa2 Add low-pass filter for color match lookahead 2024-12-07 11:51:00 -08:00
David Schmenk
010b57e99c Add samples 2024-12-07 09:04:36 -08:00
David Schmenk
c3243f491e Simplify interface to rgbPix match 2024-12-07 08:58:33 -08:00
David Schmenk
70fd56a93c Settable lookahead 2024-12-07 08:20:43 -08:00
David Schmenk
0b31397eb6 Update libraries on disk 2024-12-06 21:53:43 -08:00
David Schmenk
e6c1aa35bf Update slideshow program on disk 2024-12-06 21:50:37 -08:00
David Schmenk
742c8b9d77 Update slideshow program on disk 2024-12-06 21:47:56 -08:00
David Schmenk
e87ae469bb Update slideshow program on disk 2024-12-06 21:42:59 -08:00
David Schmenk
8ded05fcfb Ad an extra pixel of lookup to reduce streaking 2024-12-06 21:35:13 -08:00
David Schmenk
6ae6a343b2 dd selectable color palettes and keep more precision for errDiv 2024-12-06 14:07:07 -08:00
David Schmenk
0df3fe544c Update to RGB24 and 32 bit distance calc 2024-12-05 21:33:28 -08:00
David Schmenk
fbafc4abd9 Add font test harness 2024-12-03 15:09:59 -08:00
David Schmenk
480ea58026 Better font file format 2024-12-03 15:06:18 -08:00
David Schmenk
d9466112a8 Getting bit/color mapping correct 2024-12-02 11:55:05 -08:00
David Schmenk
8d289856fd Start TTF conversion for DHGR 2024-11-30 16:31:57 -08:00
David Schmenk
3c38943141 Slightly better error calc for lookahead 2024-11-28 11:52:58 -08:00
David Schmenk
ccf8893367 Make dlgrshow a true conversion utility with dlgrconv 2024-11-28 10:39:44 -08:00
David Schmenk
b7d8baa9de Calculated NTSC colors and convert dark grey to light grey 2024-11-27 22:35:28 -08:00
David Schmenk
c5914ab2b2 Forgot to rename dhgrAllocBl7 2024-11-27 16:23:02 -08:00
David Schmenk
a26e856057 Add dhgr.tk penguin demo 2024-11-27 16:10:04 -08:00
David Schmenk
54c14a6112 Wholesale DHGR Toolkit project reconfiguration 2024-11-27 15:58:02 -08:00
David Schmenk
2c884102bb Fix dcgr rgb utility 2024-11-26 21:00:18 -08:00
David Schmenk
f9dd7b5417 Break DCGR Toolit out into own project 2024-11-26 20:22:29 -08:00
David Schmenk
f592edeb8a Clean up keypress handling 2024-11-25 20:04:25 -08:00
David Schmenk
1211991144 Fix matchfiles for NULL path 2024-11-25 13:34:38 -08:00
David Schmenk
8ddc1ef8aa Add lz4 test image to demos 2024-11-25 10:11:33 -08:00
David Schmenk
0a1e2363ab Add more slides and autobooting 2024-11-24 23:09:07 -08:00
David Schmenk
e731908136 Slideshow with decompress option 2024-11-24 16:04:01 -08:00
David Schmenk
3033b4b125 Add DHGR slideshow 2024-11-24 13:40:22 -08:00
David Schmenk
6279a82064 Prep DCGR slideshow 2024-11-24 07:57:51 -08:00
David Schmenk
325e74c4ba Add WozJobs to images 2024-11-23 09:52:03 -08:00
David Schmenk
e1425ac97a Update sample images 2024-11-23 08:53:28 -08:00
David Schmenk
f5107dc6e5 Update image disk with converted images 2024-11-22 19:22:13 -08:00
David Schmenk
9d5c45f3c5 DCGRRGB conversion quite workable now 2024-11-22 18:22:07 -08:00
David Schmenk
2ac3304a68 Improve LZ4CAT with ability to write to destination file 2024-11-21 16:31:53 -08:00
David Schmenk
d3a418a09f get dcgrtest.pla to compile natively 2024-11-21 10:47:07 -08:00
David Schmenk
593585d2ed Add sample RGB file for DCGR Toolkit 2024-11-21 09:57:44 -08:00
David Schmenk
66c57287d6 Mask off 5 bits of RGB import 2024-11-20 20:26:59 -08:00
David Schmenk
dd8e38a692 Rename RACECAR to reflect RGB 2024-11-20 14:55:08 -08:00
David Schmenk
995ea5f1cf Clamp code if needed 2024-11-20 11:00:51 -08:00
David Schmenk
5d90bd94b2 Propogate error forward and downwards 2024-11-20 10:15:13 -08:00
David Schmenk
4fb7fe3e40 Update for power outage 2024-11-20 05:53:15 -08:00
David Schmenk
47b8e18cf7 Use imperical RGB chromas 2024-11-19 18:15:26 -08:00
David Schmenk
3e2bdd4803 Back to distance formula for best match 2024-11-19 18:02:31 -08:00
David Schmenk
7f3b1823dd Tweak dot prod version for better match 2024-11-19 13:29:10 -08:00
David Schmenk
8ac23f05dd Switch to dot product for closeset chroma match 2024-11-19 10:31:00 -08:00
David Schmenk
ee397da178 RGB update 2024-11-18 16:32:35 -08:00
David Schmenk
32dc3095aa Better RGB -> DHGR match 2024-11-18 16:23:15 -08:00
David Schmenk
514da5b967 Merge branch 'master' of https://github.com/dschmenk/PLASMA 2024-11-17 20:53:54 -08:00
David Schmenk
3dd43e7992 First attempt at RGB matching 2024-11-17 20:53:23 -08:00
David Schmenk
c2c0b0633e Update README.md 2024-11-15 14:53:01 -08:00
David Schmenk
9b26f74771 Update API slighty 2024-11-14 10:13:59 -08:00
David Schmenk
730360b786 Add RLE encoding 2024-11-13 19:59:31 -08:00
David Schmenk
50a4fbc230 Add pixel read routine 2024-11-13 18:36:29 -08:00
David Schmenk
27da5dca92 Add GREASY frame import utility 2024-11-13 14:05:50 -08:00
David Schmenk
6593a32253 Add DHGR pixel plotting (560x192) 2024-11-12 19:15:05 -08:00
David Schmenk
94d47f031a Add keepflags option to module return value 2024-11-12 10:53:50 -08:00
David Schmenk
75b1441574 Still looking for 80 column crasht 2024-11-11 19:23:13 -08:00
David Schmenk
6d7465377e Slot init for 80 column requires fixes 2024-11-11 17:33:25 -08:00
David Schmenk
d91816019e Move GREASY IMPORT back intro SPRED 2024-11-11 15:58:25 -08:00
David Schmenk
7675708a27 Add catalog command to SPRED 2024-11-11 15:30:10 -08:00
David Schmenk
71011e644f Update version # for minor bug fixes in fileio and AUTORUN 2024-11-11 15:12:35 -08:00
David Schmenk
6931813a50 Allow uppercase command keys 2024-11-09 07:15:50 -08:00
David Schmenk
b32be1d955 Move sprite editor to utils 2024-11-06 19:50:14 -08:00
David Schmenk
e23419e0c0 Sprite editor update for toolkit 2024-11-06 15:34:55 -08:00
David Schmenk
96a7553ee3 Change BL7Tile API 2024-11-04 14:19:05 -08:00
David Schmenk
224592679a Fix clean up of spriteWrite 2024-11-02 08:27:45 -07:00
David Schmenk
eb43eb4e14 read/write dazzle draw screens 2024-11-02 08:23:40 -07:00
David Schmenk
8fc9175555 RLE pixmap support 2024-11-01 20:16:08 -07:00
David Schmenk
91d889bbb8 Update DCGR Toolit image 2024-10-29 12:42:05 -07:00
David Schmenk
297c0ab493 Thin fonts 2024-10-29 10:23:02 -07:00
David Schmenk
bab302ebc1 Simplify spinning enterprise XOR case 2024-10-28 16:02:38 -07:00
David Schmenk
ff14bbb35c Additional spinning enterprise implementations 2024-10-28 15:59:19 -07:00
David Schmenk
f63456d941 Clean up editor min/max processing 2024-10-28 10:48:44 -07:00
David Schmenk
12c9e07826 Minimal but working sprite editor 2024-10-27 19:53:38 -07:00
David Schmenk
a2d8d22c3d read/write sprite files and flip h/v 2024-10-27 14:10:49 -07:00
David Schmenk
57f6e85d3c Match lores colors and preliminary sprite edito 2024-10-26 09:54:18 -07:00
David Schmenk
2fa5207496 Prep for DCGR sprite editor 2024-10-25 13:48:01 -07:00
Dave Schmenk
75fad76b85 Prep DCGR ToolKit image 2024-10-23 21:25:13 -07:00
Dave Schmenk
48da6f197a Update test sample code 2024-10-23 20:40:52 -07:00
David Schmenk
ba0f11e3a5 Update tests 2024-10-06 12:48:10 -07:00
David Schmenk
b671d73a22 Pause 2024-10-02 21:22:20 -07:00
David Schmenk
1ae700960b Full screen tile fill 2024-10-02 16:55:29 -07:00
David Schmenk
13a5c0bdc3 Working TilesScr 2024-10-02 16:45:09 -07:00
David Schmenk
5464f1a52c DCGR Tile support WIP 2024-09-30 09:31:14 -07:00
David Schmenk
5ceb7bd6b9 Fix call to structure function pointer 2024-09-29 12:08:26 -07:00
David Schmenk
39a5d98f93 Add keyboard pauses to test harness 2024-09-18 13:32:19 -07:00
David Schmenk
aa03e5bdab Add palette swatches with different stipple patterns 2024-09-17 22:13:29 -07:00
David Schmenk
bec33a2e88 Slight PixMap speedups and better FadeOut 2024-09-17 18:10:21 -07:00
David Schmenk
7da4ff8713 Fix bitmaps with factor of 8 widths 2024-09-17 10:03:12 -07:00
David Schmenk
00d0956a19 Prep for generic sprite compilation 2024-09-16 19:00:45 -07:00
David Schmenk
fee8eabd36 Syntax updates 2024-09-15 15:26:26 -07:00
David Schmenk
ff89556104 Simplified set destination surface API 2024-09-15 14:47:36 -07:00
David Schmenk
70a067d134 Test out some optimizations 2024-09-14 15:10:12 -07:00
David Schmenk
5b792798ac Clipping optimizations 2024-09-14 10:50:58 -07:00
David Schmenk
f9cd6cac29 Transition to different memory format with all AUX pixels then all MEM pixels per scanline instead of interleaving them 2024-09-14 10:38:33 -07:00
David Schmenk
2a9eb9c55d more compiled sprite tests 2024-09-12 09:07:01 -07:00
David Schmenk
0b531e7f3e Add bitmap drawing for screen and memory 2024-09-11 19:03:40 -07:00
David Schmenk
d70ae2ec1e Left edge clippping for compiled sprites 2024-09-11 11:35:23 -07:00
David Schmenk
b19f7d6d60 Left edge clip WIP 2024-09-10 11:47:09 -07:00
David Schmenk
c8e3173348 Precompiled sprite test 2024-09-10 08:00:25 -07:00
Dave Schmenk
d79695270e Code opt WIP 2024-09-08 20:44:47 -07:00
Dave Schmenk
ecab8dac1b Little double color test update 2024-09-08 19:19:13 -07:00
Dave Schmenk
fef7d5ce90 Some code optimizations 2024-09-08 18:43:57 -07:00
David Schmenk
246af31891 Clip Y WIP 2024-09-08 13:47:12 -07:00
David Schmenk
90e4f21dc0 clipY WIP 2024-09-08 07:13:01 -07:00
David Schmenk
5abdeef09a Ops for MemBl7Mem 2024-09-07 20:39:03 -07:00
David Schmenk
5242148ef6 Mem <-> Mem BLT 2024-09-07 14:30:57 -07:00
David Schmenk
83c70b14b6 Memory plot pix routines 2024-09-06 16:56:27 -07:00
David Schmenk
1c39679540 pix7 clipping 2024-09-05 21:34:48 -07:00
David Schmenk
fdcf4fc557 Rename DHGR as DCGR and break out test 2024-09-04 08:34:31 -07:00
David Schmenk
9f578db33f Simple raster ops 2024-09-03 16:49:56 -07:00
David Schmenk
8f6211c087 Asssembly BLT w/ last of commented out PLASMA implementations 2024-09-03 10:42:55 -07:00
David Schmenk
6b3b9cf10f Calc masks for HLin 2024-09-02 18:09:14 -07:00
David Schmenk
748eaa342d Prepare HLin assemblyizing 2024-09-02 12:05:35 -07:00
David Schmenk
d979f0ffed Better set pixel sequence 2024-09-01 09:39:56 -07:00
David Schmenk
22f17edcce plot and xorplot 2024-08-31 18:01:10 -07:00
David Schmenk
493715fe1d Assemblyinze plot 2024-08-31 14:46:10 -07:00
Dave Schmenk
fab8d498a0 Prep DHGR toolkit for assembly-izing 2024-08-29 18:24:28 -07:00
dschmenk
22b65573a3 Remove OSX dependency 2024-08-28 23:35:36 -07:00
David Schmenk
a061833ef8 use nopn-conanical imput for PLVM and A1 CFFA 2024-08-26 18:41:41 -07:00
David Schmenk
0cdcb66888 Fix STRCAT - can load 4th scripts fro sys/scripts 2024-08-24 15:49:38 -07:00
David Schmenk
2cb60895b8 Implement enough PLVM I/O for plasm, drawl, plforth and rod 2024-08-24 12:16:08 -07:00
David Schmenk
d767418eff Fix decimal mode carry out in lib6502 for adc, sbc 2024-08-23 17:57:22 -07:00
David Schmenk
4ee3a2140b Load and run PLFORTH and DRAWL in PLVM 2024-08-23 13:46:12 -07:00
David Schmenk
88981cfd4f Prepare universal I/O for PLVM 2024-08-21 15:10:32 -07:00
David Schmenk
93fc68b736 Continue filling out cmdsys routines 2024-08-17 10:53:54 -07:00
David Schmenk
5aabb8b13e Stub out remaining cmdsys functions 2024-08-16 21:23:44 -07:00
David Schmenk
b9e9fa2397 Place bytecode in external memory 2024-08-16 17:02:28 -07:00
David Schmenk
2315282ec9 Filling out CMDSYS exports 2024-08-14 20:05:31 -07:00
David Schmenk
f46a65eb28 Get PLVM to run TEST+TESTLIB 2024-08-13 18:16:46 -07:00
David Schmenk
1e1bbcd857 PLVM exporting symbols and loading modules 2024-08-12 16:47:53 -07:00
David Schmenk
c6353355c4 Change name of MOD files for C PLVM 2024-08-10 09:31:06 -07:00
David Schmenk
dfb6afc5f0 Add new files for C VM 2024-08-10 08:20:46 -07:00
David Schmenk
bde74778b0 Swap out 6502 VM for C VM 2024-08-09 21:21:57 -07:00
David Schmenk
3783e20220 Fix makefile for lib6502 2024-08-08 06:41:52 -07:00
David Schmenk
867e282a36 Prep plvm.c for 6502 emulation 2024-08-07 19:32:26 -07:00
David Schmenk
c5824ed632 Run GC more often 2024-08-02 16:19:33 -07:00
David Schmenk
3e258bf622 Reset assoc_list and sweep_stack in eval_quote 2024-08-02 15:38:00 -07:00
David Schmenk
31a716062e Check for RETURN() inside FOR() 2024-08-02 11:59:08 -07:00
David Schmenk
7fc9c946ce Special form for CHARS() and comment out SYMS() 2024-08-02 10:31:08 -07:00
David Schmenk
d13269fc52 Dump symbols 2024-08-02 10:03:28 -07:00
David Schmenk
3d149b668c Add ARRAY? predicate 2024-08-02 08:09:57 -07:00
David Schmenk
f77c0e9a9e Convert all errors to exceptions. Add nice aliases 2024-08-02 07:58:09 -07:00
David Schmenk
44aab3e3ba Add more I/O functions 2024-08-01 21:50:19 -07:00
David Schmenk
3b323c76ee Throw "Out of memory" exception 2024-08-01 21:13:53 -07:00
David Schmenk
4a7a1a69bb Add more string handling and cool macros in defun.lisp 2024-08-01 20:51:30 -07:00
David Schmenk
ea1af9f40b String atoms 2024-08-01 18:00:19 -07:00
David Schmenk
7936b189e1 Refill input on empty lines 2024-08-01 11:52:56 -07:00
David Schmenk
2c814d8829 Add comments with ';' 2024-08-01 10:13:06 -07:00
David Schmenk
9f0289b5d6 Typo 2024-08-01 09:00:26 -07:00
David Schmenk
340b5b4b04 describe missing property lists 2024-08-01 08:59:51 -07:00
David Schmenk
3c8bf7b1e5 Update docs with MACRO 2024-08-01 08:55:29 -07:00
David Schmenk
bfffd6e567 Clean up macro implementation 2024-07-31 20:16:17 -07:00
David Schmenk
082f1061d0 Clear up Personal LISP link descriptions 2024-07-31 19:55:04 -07:00
David Schmenk
7a1dc790f2 Add another link to old Personal LISP on Apple II 2024-07-31 14:38:34 -07:00
David Schmenk
e818da7339 Add MACROs 2024-07-31 14:28:39 -07:00
David Schmenk
ccc13a0a6f Fix setting index value association 2024-07-28 12:53:06 -07:00
David Schmenk
2f9bd7d26c Update disk image 2024-07-28 09:48:31 -07:00
David Schmenk
485aba5542 Fix RETURN (NULL) handling in PROG() 2024-07-28 09:16:02 -07:00
David Schmenk
320bfbef81 Continue optimizing eval_expr & friends 2024-07-27 20:09:22 -07:00
David Schmenk
b834f4dc05 Updare disk image 2024-07-27 14:24:58 -07:00
David Schmenk
7dd569b809 Allow cset with FUNCTION 2024-07-27 14:20:37 -07:00
David Schmenk
5207c0ba05 Update docst 2024-07-25 11:30:59 -07:00
David Schmenk
551a50ece9 Fix FUNARG assoc_list swapping 2024-07-25 08:07:47 -07:00
David Schmenk
c1326814ea Merge branch 'master' of https://github.com/dschmenk/PLASMA 2024-07-24 20:45:06 -07:00
David Schmenk
c3ea787808 Fix minmax.lisp example 2024-07-24 20:44:04 -07:00
David Schmenk
478ddfcfcb Update DRAWL.md 2024-07-24 20:11:15 -07:00
David Schmenk
54b36f9ef7 Hash symbols for much faster lookup 2024-07-24 11:19:57 -07:00
David Schmenk
1e43899f97 Fix mul and optionally skip ELEM library 2024-07-24 10:42:53 -07:00
David Schmenk
6ef1e26249 Clean up *T* to match manual 2024-07-24 09:28:17 -07:00
David Schmenk
f404affcd0 Update multiply to a special form (like add) 2024-07-24 08:41:42 -07:00
David Schmenk
12cab55271 Update looping examples 2024-07-23 17:26:12 -07:00
David Schmenk
60b526bcb0 Clean up examples 2024-07-23 17:18:26 -07:00
David Schmenk
e77ff928ca Fix FOR index variable and update lores example 2024-07-23 17:05:03 -07:00
David Schmenk
bbfa59ccc7 Update documentation 2024-07-23 15:46:57 -07:00
David Schmenk
daed69e113 Add logical shift and rename arithmetic shift 2024-07-23 14:49:33 -07:00
David Schmenk
ef3b3eb1b1 Drop WHILE/UNTIL loops, gain EVAL(). Lose FPU and talk directly to SANE 2024-07-23 14:24:49 -07:00
David Schmenk
0fd3afdd7a Fix NUMBERP 2024-07-22 19:14:14 -07:00
David Schmenk
ec3b9de737 Update docs and images 2024-07-22 16:31:38 -07:00
David Schmenk
9592ac3f2c Add LORES graphics to DRAWL 2024-07-22 16:22:46 -07:00
David Schmenk
e9bde21346 Add a little to hook_expr 2024-07-22 12:06:19 -07:00
David Schmenk
a5d2fdc17b Add CTRL-C keyboard interrupt 2024-07-22 08:44:46 -07:00
David Schmenk
23aae45787 Clean up T and fix GC'ing of consants 2024-07-22 07:52:24 -07:00
dschmenk
64de8140d3 Update floppy image 2024-07-21 21:47:06 -07:00
David Schmenk
d8f21f1f65 Handle errors better 2024-07-21 20:49:08 -07:00
dschmenk
9df7eeb28e Update floppy image 2024-07-21 18:35:35 -07:00
David Schmenk
d9bc53d5d0 test code update 2024-07-21 18:31:54 -07:00
David Schmenk
843d0a85e7 Fix LABEL once and for all 2024-07-21 18:17:15 -07:00
David Schmenk
604497c8b8 Clean up some FUNCTION and LABEL implementationimplementat 2024-07-20 17:28:43 -07:00
David Schmenk
d019030e78 Unwind assoc_list but still bug with LABEL 2024-07-20 11:28:01 -07:00
David Schmenk
27b11725d0 Update floppy image 2024-07-20 09:49:15 -07:00
David Schmenk
85295c5515 Modulo shift/rotate counts 2024-07-20 07:51:56 -07:00
David Schmenk
4c4ec7c985 Back to directly manipulating FOR index value 2024-07-20 07:19:07 -07:00
David Schmenk
f9b7c51b3d Type 2024-07-19 21:07:02 -07:00
David Schmenk
b243bf9c51 Formatting 2024-07-19 17:55:01 -07:00
David Schmenk
afc7da3746 Formatting 2024-07-19 17:51:43 -07:00
David Schmenk
3dd9bd8d0f Formatting documentation 2024-07-19 17:49:56 -07:00
David Schmenk
bbfb61f736 Add printer echo support 2024-07-19 17:44:24 -07:00
David Schmenk
22046c55ae Update LISP floppy image 2024-07-19 15:43:21 -07:00
David Schmenk
7ee1c2f524 Fix looping ops to use variables instead of constants (LISP 1.5 uses constants) 2024-07-19 15:11:08 -07:00
David Schmenk
01a5f0d75b Add bitwise operators and hex input/output 2024-07-19 12:32:42 -07:00
David Schmenk
58fc3a3025 Add more looping options and clean up GC in-flight sweeping 2024-07-18 07:52:03 -07:00
David Schmenk
68e2cec638 Add a bunch of extras: IF() style COND(), FOR loops, etc) 2024-07-17 22:11:18 -07:00
David Schmenk
5b4050d1d2 Fill out rest of SANE floating point functions 2024-07-17 12:52:37 -07:00
David Schmenk
cae5cd110e Sweep arrays in GC 2024-07-16 16:26:47 -07:00
David Schmenk
86669849d9 Working background GC 2024-07-16 15:20:10 -07:00
David Schmenk
82130cb2e8 Still working on better GC 2024-07-15 20:43:46 -07:00
David Schmenk
713b6ea7fa Add source with reference counting. Super slow. Ouch 2024-07-15 09:01:10 -07:00
David Schmenk
d8ec9f9709 Clean up NIL handling 2024-07-14 08:36:27 -07:00
David Schmenk
f0678795de Clean up APVAL set to NULL 2024-07-13 17:55:46 -07:00
David Schmenk
77dd8d0d0b Work out NIL eval 2024-07-13 17:24:19 -07:00
David Schmenk
5e7dc428e5 First pass at arrays 2024-07-13 13:56:21 -07:00
David Schmenk
45a7a44b69 Initial pass at arrays 2024-07-13 13:14:49 -07:00
David Schmenk
b0c5f1c2e9 Refactor LISP modules 2024-07-13 07:20:30 -07:00
David Schmenk
2814843331 Floating point numbers 2024-07-12 22:25:32 -07:00
David Schmenk
257b31aa56 Typo 2024-07-12 12:09:38 -07:00
David Schmenk
439216d437 Add PROG example 2024-07-12 12:02:08 -07:00
David Schmenk
0ddec876ac Added PROG feature through s-expr extension mechanism. Really easy 2024-07-12 11:59:51 -07:00
dschmenk
b4536f98ba Update floppy image 2024-07-11 15:19:01 -07:00
David Schmenk
c29ab9bd82 Improved tail recursion and loop example 2024-07-11 15:17:05 -07:00
dschmenk
de72884699 Update floppy image 2024-07-11 11:39:07 -07:00
David Schmenk
c2cac963b6 Cleanup cond() 2024-07-11 11:37:08 -07:00
David Schmenk
52d4c08f36 Improve tail recursion by inlining cond in eval_expr 2024-07-11 11:23:37 -07:00
David Schmenk
2a21428a54 eval_expr optimizations 2024-07-11 11:06:31 -07:00
dschmenk
7f9a47e77e Update floppy image 2024-07-11 08:26:06 -07:00
David Schmenk
4e1c6a5963 Fix freeing heap in init when running on 64K VM 2024-07-11 08:23:38 -07:00
dschmenk
52b47c571e Debugging 64K VM 2024-07-10 23:05:20 -07:00
David Schmenk
c76124c4cb Add video link 2024-07-09 16:11:55 -07:00
David Schmenk
9b576d75c8 wording 2024-07-09 14:25:41 -07:00
David Schmenk
254928624f Docs... 2024-07-09 12:53:48 -07:00
David Schmenk
e48ce3d2dd DRAWL bootable floppy image and samples 2024-07-09 12:35:21 -07:00
David Schmenk
abb1738c06 Formatting 2024-07-09 12:22:20 -07:00
David Schmenk
43bdb61043 Add DRAWL page 2024-07-09 12:21:17 -07:00
David Schmenk
d920a14c8f Faster and looser w/ is_alpha/is_alphasym but allow ',' as whitespace 2024-07-09 10:55:32 -07:00
David Schmenk
e4a5b1a5a5 Inline parts of eval_expr() 2024-07-09 07:55:23 -07:00
David Schmenk
6a67577a9b Clean up source 2024-07-08 20:55:55 -07:00
David Schmenk
ab2239753c Fix math with sub-expressions 2024-07-08 20:26:11 -07:00
David Schmenk
6f58db9b92 Fix swapping of lambda arguments and gcd example 2024-07-08 17:09:31 -07:00
David Schmenk
5e00ed6a4d Add list examplesd 2024-07-08 14:30:59 -07:00
David Schmenk
0004ec0cd0 Fix . operator parsing and error in SUBST 2024-07-08 14:29:59 -07:00
David Schmenk
06a3bd55e1 Comment and add MEM function to REPL 2024-07-08 11:58:49 -07:00
David Schmenk
50d72dd386 Break out s-expression processor core from REPL 2024-07-08 11:36:50 -07:00
David Schmenk
c5e56c7d63 Fix ATOM and add EQUAL to SET functions( 2024-07-08 09:00:13 -07:00
David Schmenk
5e3baa70fb Add neg 2024-07-07 21:23:47 -07:00
David Schmenk
5ad6b0733c Add logic operations 2024-07-07 20:26:32 -07:00
David Schmenk
4b4b7e0683 add LISP to build process 2024-07-07 17:15:56 -07:00
David Schmenk
66c2104b76 No, undo remainder return from div32 so no need to update libs 2024-07-07 16:46:42 -07:00
David Schmenk
3a488a5854 Fix order of remainder results from div32 2024-07-07 16:43:10 -07:00
David Schmenk
a63fed59c9 Simply predicate evaluation 2024-07-07 15:35:42 -07:00
David Schmenk
2fecde9a7a Upgrade to 32 bit integers 2024-07-07 15:16:03 -07:00
David Schmenk
4e876b7a64 Update value of NIL 2024-07-07 08:32:46 -07:00
David Schmenk
d481bfaad1 fix evaluations in CONS, CAR, and CDR 2024-07-06 23:30:52 -07:00
David Schmenk
45cf817bd1 Command line source file input 2024-07-06 18:32:22 -07:00
David Schmenk
d60c6a46ae Add garbage collection 2024-07-06 14:21:24 -07:00
David Schmenk
04146f954a Uppercase symbol names 2024-07-06 07:46:16 -07:00
David Schmenk
cf8d13f067 Add LABELs and inline LAMBDAs 2024-07-06 07:33:36 -07:00
David Schmenk
86f2140b80 Add COND 2024-07-05 19:25:33 -07:00
David Schmenk
5396298b50 DEFINE and EVAL lambda functions 2024-07-05 18:01:20 -07:00
David Schmenk
e5f1790da6 Continue with eval updates 2024-07-02 12:03:44 -07:00
David Schmenk
7e53d66c64 Stub out primitive functions 2024-07-02 10:12:36 -07:00
David Schmenk
fe27016df0 Add QUOTE 2024-07-01 20:42:59 -07:00
David Schmenk
7cf622999d Native functions 2024-06-30 10:25:45 -07:00
David Schmenk
e439ca5ba7 Match symbols 2024-06-28 08:47:04 -07:00
David Schmenk
0baad05c04 First working LISP parser 2024-06-27 14:41:06 -07:00
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
435 changed files with 47656 additions and 6387 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>.

1385
README.md Executable file → Normal file

File diff suppressed because it is too large Load Diff

222
doc/DRAWL.md Normal file
View File

@@ -0,0 +1,222 @@
# LISP 1.5 implemented in PLASMA
LISP interpreted on a bytecode VM running on a 1 MHz 6502 is going to be sssllllooooowwwww. So I called this implementation DRAWL in keeping with the speech theme. DRAWL represents an exploration REPL language for the PLASMA environment. It isn't meant to be a full-blown programming language, more of an interactive sandbox for playing with S-expressions.
## Missing features of LISP 1.5 in DRAWL
- Minimal I/O facilities
- Property lists. Only DEFINE() and CSETQ()/CSET() property functions supported
- General recursion. The 6502 architecture limits recursion (but see tail recursion below), so don't expect too much here
- Many of the built-in functions from the LISP 1.5 manual. Most can be coded in LISP and loaded at startup
However, the code is partitioned to allow for easy extension so some of these missing features could be implemented.
## Features of DRAWL
- 32 bit integers and 80 bit floating point with transcendental math operators by way of the SANE library
- Tail recursion handles deep recursion. Check out [loop.lisp](https://github.com/dschmenk/PLASMA/blob/master/src/lisp/loop.lisp)
- Fully garbage collected behind the scenes
- Optionally read LISP source file at startup
- Arrays of up to four dimensions
- Bit-wise logic operations on 32 bit integers
- FUNCTION operation with bound variables
- The PROG Alogol-like programming construct
- Additional testing/looping constructs: IF and FOR
- Hexadecimal input/output
- LoRes Apple II graphics
- Ctrl-C break into running program
- MACROs for meta-programming. See [defun.lisp](https://github.com/dschmenk/PLASMA/blob/master/src/lisp/defun.lisp)
- End-of-line comment using ';'
- String handling functions
The DRAWL implementation comes with the following built-in functions:
### Constants
- T = True
- F = False
- NIL = NULL
- CSET() = Set constant value
- CSETQ() = Set constant value
- :=() = Alias got CSETQ()
- DEFINE() = Define function
### Function types
- LAMBDA(...)
- FUNARG() = List constructed by FUNCTION()
- FUNCTION()
- MACRO(...) = Operate on non-evaluated argument list
### Predicates
- ATOM()
- EQ()
- NOT()
- AND(...)
- OR(...)
- NULL()
- NUMBER?()
- STRING?()
### Misc
- SET = Used in array access to set element value
- QUOTE()
- ARRAY() = Arrays up to four dimensions
- EVAL() = Evaluate S-expression
- TRACE() = Turn tracing on/off
- GC() = Run garbage collector and return free memory amount
- QUIT() = Exit REPL
### List manipulation
- CAR()
- CDR()
- CONS()
- LIST(...)
### Conditionals
- COND(...)
- IF() = IF THEN w/ optional ELSE
### Output
- PRHEX() = Turn hexadecimal output on/off
- PRI(...) = Print without newline
- PRINT(...) = Print with newline
- FMTFPI() = Floating point format integer digits
- FMTFPF() = Floating point format fractional digits
- PRINTER() = Turn printer echo on/off on slot#
### Looping
- FOR(...)
### Associations
- LABEL()
- SET()
- SETQ()
- =() = Alias got SETQ()
### Program feature
- PROG(...) = Algol like programming in LISP
- SET() = Update variable value
- SETQ() = Update variable value
- = = Alias for SETQ
- COND(...) = Fall-through COND()
- IF() = Fall-through IF THEN w/ optional ELSE
- GO() = Goto label inside PROG
- RETURN() = Return from PROG with value
### Numbers
- +(...)
- -()
- \*(...)
- /()
- REM()
- NEG()
- ABS()
- \>()
- <()
- MIN(...)
- MAX(...)
- NUMBER?()
### Integers
- BITNOT() = Bit-wise NOT
- ~() = Alias for BITNOT()
- BITAND() = Bit-wise AND
- &() = Alias for BITAND()
- BITOR() = Bit-wise OR
- |() = Alias for BITOR()
- BITXOR = Bit-wise XOR
- ^() = Alias for BITXOR()
- ARITHSHIFT() = Bit-wise arithmetic SHIFT (positive = left, negative = right)
- <<-() = Alias for ARITHSHIFT()
- LOGICSHIFT() = Bit-wise logicalal SHIFT (positive = left, negative = right)
- <<() = Alias for LOGICSHIFT()
- ROTATE() = Bit-wise ROTATE (positive = left, negative = right)
- <<<() = Alias for ROTATE()
### Floating Point (from the SANE library)
- *PI* = Constant value of pi
- *E* = Constant value of e
- NUMBER() = Convert atom to number (symbol and array return NIL)
- INTEGER() = Convert number to integer
- LOGB()
- SCALEB()
- TRUNCATE()
- ROUND()
- SQRT()
- COS()
- SIN()
- TAN()
- ATAN()
- LOG2()
- LOG2_1()
- LN()
- LN_1()
- POW2()
- POW2_1()
- POWE()
- POWE_1()
- POW_I()
- POW()
- COMP()
- ANNUITY()
### Strings
- STRING() = Convert atom to string
- SUBS() = SUB String offset length
- CATS(...) = conCATenate Strings
- LENS() = LENgth String
- CHARS(...) = CHARacter String from integer values
- ASCII() = ASCII value of first character in string
### I/O functions
- HOME()
- GOTOXY()
- KEYPRESSED?()
- READKEY()
- READ()
- READFILE()
- READSTRING()
### Lo-Res Graphics
- GR() = Turn lo-res graphics mode on/off
- COLOR() = Set plotting color
- PLOT() = Plot pixel at X,Y coordinate
LISP is one of the earliest computer languages. As such, it holds a special place in the anals of computer science. I've always wanted to learn why LISP is held in such high regard by so many, so I went about learning LISP by actually implementing a LISP interpreter in PLASMA. PLASMA is well suited to implement other languages due to its rich syntax, performance and libraries.
## Links
Here are some links to get you started.
LISP 1.5 Manual: https://archive.org/details/bitsavers_mitrlelisprammersManual2ed1985_9279667
LISP 1.5 Primer: https://www.softwarepreservation.org/projects/LISP/book/Weismann_LISP1.5_Primer_1967.pdf
Personal LISP on Apple II Manual (PDF): https://archive.org/details/gLISP/gnosisLISPManual
Personal LISP on Apple II Manual (web archive): https://web.archive.org/web/20190603120105/http://jeffshrager.org/llisp/
Apple Numerics Manual (SANE): https://vintageapple.org/inside_o/pdf/Apple_Numerics_Manual_Second_Edition_1988.pdf
Part 1 of DRAWL in action (S-expressions): https://youtu.be/wBMivg6xfSg
Part 2 of DRAWL in action (The rest of LISP 1.5): https://youtu.be/MdKZIrfPN7s
Preconfigured PLASMA ProDOS boot floppy for DRAWL: https://github.com/dschmenk/PLASMA/blob/master/images/apple/DRAWL.po
My blog post about LISP 1.5 and DRAWL: http://schmenk.is-a-geek.com/wordpress/?p=365

View File

@@ -1,9 +1,10 @@
WELCOME TO THE PLASMA EDITOR!
=============================
WELCOME TO THE PLEIADES EDITOR!
===============================
FIRST THINGS FIRST:
TO NAVIGATE, USE THE ARROW KEYS. ON
THE APPLE ][:
TO NAVIGATE, USE THE ARROW KEYS.
ON THE APPLE ][:
CTRL-K = UP
CTRL-J = DOWN.
@@ -24,17 +25,13 @@ EXIT BY ENTERING 'Q' AND 'RETURN'.
YOU CAN ALSO RETURN TO THE EDITOR BY
JUST PRESSING 'RETURN'.
-------
-------------------------------------------------------------------------
THE PLASMA EDITOR IS A SIMPLE TEXT
EDITOR FOR ENTERING AND MANIPULATING
TEXT AND SOURCE CODE FILES. THE
EDITOR ONLY SUPPORTS 40 COLUMN TEXT
ALTHOUGH LINES CAN BE UP TO 79
CHARACTERS LONG. THE SCREEN WILL
SCROLL HORIZONTALLY AS THE CURSOR
MOVES. THERE IS 16K OF MEMORY FOR
THE TEXT BUFFER.
THE PLEIADES EDITOR IS A SIMPLE TEXT EDITOR FOR ENTERING AND MANIPULATING
TEXT AND SOURCE CODE FILES. THE EDITOR SUPPORTS FROM 40 TO 128 COLUMN MODE
WITH LINES THAT CAN BE UP TO 127 CHARACTERS LONG. THE SCREEN WILL SCROLL
HORIZONTALLY AS THE CURSOR MOVES, IF NEDED. THERE IS ABOUT 16K TO 30K OF
MEMORY FOR THE TEXT BUFFER, DEPENDING ON YOUR CONFIGURATION.
IT HAS TWO MODES, COMMAND AND EDIT.
@@ -59,8 +56,8 @@ EDIT COMMANDS:
CTRL-V = PASTE CLIPBOARD
CTRL-O = OPEN NEW LINE
CTRL-F = OPEN A FOLLOWING NEW LINE
CTRL-T = JOIN LINES
CTRL-Y = TOGGLE INSERT/OVERWRITE
CTRL-Y = JOIN LINES
CTRL-T = TOGGLE INSERT/OVERWRITE
TAB/CTRL-I = INSERT SPACES TO NEXT TAB
= INDENT SELECTION IF INSERT MODE
= UNDENT SELECTION IF OVERWITE MODE
@@ -79,24 +76,19 @@ EDIT COMMANDS:
CTRL-L = SHIFT LOCK
SHIFT-LEFT ARROW = DELETE (SHIFT-MOD)
WITH THE SHIFT-KEY MOD ON AN
APPLE ][, UPPER AND LOWER CASE
ENTRY WORKS AS EXPECTED.
WITH THE SHIFT-KEY MOD ON AN APPLE ][, UPPER AND LOWER CASE ENTRY WORKS
AS EXPECTED.
ESC T C = FORCE LOWER-CASE CHARS
If you have a lower-case character
generator installed, you can force
lower-case display. Otherwise,
upper case will be displayed normally
but lower-case will be displayed in
inverse. This is the default.
If you have a lower-case character generator installed, you can force
lower-case display. Otherwise, upper case will be displayed normally
but lower-case will be displayed in inverse. This is the default.
Apple //e AND //c FEATURES:
---------------------------
The 'SOLID-APPLE' key will modify
theese keys:
The 'SOLID-APPLE' key will modify these keys:
SA-RETURN = OPEN FOLLOWING LINE
SA-LEFT ARROW = JUMP LEFT
@@ -108,8 +100,7 @@ EDIT COMMANDS:
Apple /// FEATURES:
-------------------
The 'OPEN-APPLE' key will modify
these keys:
The 'OPEN-APPLE' key will modify these keys:
OA-\ = DELETE CHAR LEFT
OA-RETURN = OPEN FOLLOWING LINE
@@ -119,8 +110,12 @@ EDIT COMMANDS:
OA-DOWN ARROW = JUMP DOWN
OA-TAB = DETAB
On the keypad, 'OPEN-APPLE' allows
the keys for navigation and misc:
Apple //e Platinum IIGS & /// FEATURES:
---------------------------------------
On the keypad, 'OPTION' on //e Platinum & IIGS
or 'OPEN-APPLE' on the /// allows the keys for
navigation and misc operations:
OA-4 = MOVE CHAR LEFT
OA-6 = MOVE CHAR RIGHT
@@ -130,11 +125,15 @@ EDIT COMMANDS:
OA-3 = JUMP DOWN
OA-7 = JUMP BEGIN
OA-1 = JUMP END
OA-5 = DELETE CHAR
OA-- = CUT SELECTION INTO CLIPBOARD
OA-0 = PASTE CLIPBOARD
OA-ENTER = OPEN FOLLOWING LINE
OA-. = TOGGLE INSERT/OVERWRITE
OA-5 = SELECT/DESELECT
OA-- = CUT SELECTION INTO CLIPBOARD
OA-+ = COPY SELECTION INTO CLIPBOARD
OA-0 = DELETE CHARACTER
OA-/ = INSERT/OVERWRITE
OA-* = OPEN CURRENT LINE
OA-ENTER = OPEN NEXT LINE
OA-. = PASTE CLIPBOARD
OA-= = NUMLOCK (NUMBER KEYS ACT LIKE OA/OPTION PRESSED)
COMMAND MODE:
@@ -151,7 +150,8 @@ COMMAND MODE:
N = CLEAR TEXT IN MEMORY
T G = TOGGLE GUTTER VIEW
T C = TOGGLE LOWER-CASE SUPPORT (APPLE ][)
G <LINE> = GO TO LINE #
F [STRING] = FIND STRING
E = EDIT MODE
'RETURN' = EDIT MODE
1..999 = GO TO LINE #

1330
doc/PLASMA.md Executable file

File diff suppressed because it is too large Load Diff

158
doc/PLFORTH.md Normal file
View File

@@ -0,0 +1,158 @@
# 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
Compile only: LITERAL ; EXIT POSTPONE
COMPILE, [ DOES> REPEAT WHILE UNTIL
AGAIN BEGIN J I +LOOP LOOP UNLOOP LEAVE
DO ENDCASE ENDOF OF CASE THEN ELSE IF
RECURSE
Interpret only: PBC ITC BRKOFF BRKON
SEE CONT ] IS DEFER :NONAME : FORGET
CONSTANT VARIABLE PLASMA
Both: WORDS BRK STEPOFF STEPON TROFF
TRON .RS .S BYE ( COLD ?ABORT"
(?ABORT") ?ABORT QUIT ENDSRC ?ENDSRC
SRC" SRC .( ." (.") " CHAR BL TYPE
SPACES SPACE CR EMIT C%. %. C$. $. . ?
COMPARE -TRAILING NUM? WORD ACCEPT KEY
KEY? ' FIND COUNT IMMEDIATE INTERPONLY
COMPONLY STATE C, , CREATE ALLOT PAD
HERE LATEST FILL CMOVE LOOKUP R@ R> >R
EXECUTE @ C@ +! ! C! MAX MIN ABS 0<> 0=
0> 0< U< U> < > <> = RSHIFT LSHIFT NOT
COMPLEMENT XOR OR AND NEGATE MOD /MOD /
* - 2- 1- 2+ 1+ + ROT OVER ?DUP DUP2
DUP SWAP DROP2 DROP
## 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
Numbers entered with a preceeding `%` will be interpreted as binary values
### Words for displaying hex numbers
`$.`: Display TOS word in hex with leading `$`
`C$.`: Display TOS byte in hex with leading `$`
Hex numbers can be entered when preceded by `$`
### Words for displaying binary numbers
`%.`: Display TOS word in binary with leading `%`
`C%.`: Display TOS byte in binary with leading `%`
Binary numbers can be entered when preceded by `%`
## 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
doc/racecar-scaled.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
doc/rcg1-dhgr-ntsc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 KiB

BIN
doc/rcg1-dhgr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
doc/rcg2-dhgr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 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/DARTHGR.po Executable file

Binary file not shown.

BIN
images/apple/DCGR-RGB.PO Executable file

Binary file not shown.

Binary file not shown.

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

Binary file not shown.

BIN
images/apple/DRAWL.po Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
images/apple/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.

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,20 @@
include "inc/cmdsys.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
include "inc/sndseq.plh"
sysflags resxtxt1|reshgr1|resxhgr1
var strWidth, strHeight
char darthstr = "DartH GRaphics"
dcgrFont(fontRead("trade54.fon"))
strWidth, strHeight = dcgrStrExtents(@darthstr)
dhgrMode(DHGR_COLOR_MODE)
screenRead("darth.dhgr")
musicPlay(musicRead("imperial.seq"), FALSE)
musicGetKey(0, NULL)
dcgrColor(CLR_WHITE)
dcgrStr((140 - strWidth) / 2, (strHeight * 7) / 8, @darthstr)
getc
dhgrMode(DHGR_TEXT_MODE)
done

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.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,134 @@
include "inc/cmdsys.plh"
include "inc/args.plh"
include "inc/fileio.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags resxtxt1|reshgr1|resxhgr1
const FRAME_WIDTH = 40
const FRAME_HEIGHT = 40
const FRAME_SIZE = FRAME_WIDTH * FRAME_HEIGHT / 2
var arg
byte xTV = 3
byte yTV = 100
def greasy2dcgr(pixptr, grptr)#0
byte i, j, cl, ch
for j = 0 to 39 step 2
for i = 0 to 39 step 2
cl = ^(grptr + i)
ch = ^(grptr + i + 1)
^(pixptr + i / 2) = (cl & $0F) | (ch << 4)
^(pixptr + i / 2 + 20) = (cl >> 4) | (ch & $F0)
next
pixptr = pixptr + 40
grptr = grptr + 40
next
end
def greasyImport(filename)#2
var pixmapbase, pixmapptr, frameptr
byte refnum, numframes, i
pixmapbase = NULL
numframes = 0
refnum = fileio:open(filename)
if refnum
fileio:read(refnum, @numframes, 1)
pixmapbase = heapalloc(FRAME_SIZE * numframes)
if pixmapbase
frameptr = heapalloc(FRAME_SIZE)
pixmapptr = pixmapbase
for i = 1 to numframes
fileio:read(refnum, frameptr, FRAME_SIZE)
greasy2dcgr(pixmapptr, frameptr)
pixmapptr = pixmapptr + FRAME_SIZE
next
fin
fileio:close(refnum)
heaprelease(frameptr)
fin
return pixmapbase, numframes
end
def delay_getkey#0
var busywait
for busywait = 0 to 3000
if ^$C000 > 127
break
fin
next
end
def dblHeight(w, h, pixptr)#0
byte i, span
span = (w + 1) / 2
h = (h - 1) * 2
for i = 0 to h step 2
dcgrPixMap(0, i, w, 1, pixptr)
dcgrPixMap(0, i + 1, w, 1, pixptr)
pixptr = pixptr + span
next
end
def frameAnimate(filename)#0
var frames, frameptr, framesize
var frame7ptr, frame7span
byte numframes, i
frames, numframes = greasyImport(filename)
if frames == NULL; return; fin
frame7ptr, frame7span = dhgrAllocBl7Mem(FRAME_WIDTH, FRAME_HEIGHT*2)
dhgrSurfMem(OP_SRC, FRAME_HEIGHT, frame7ptr, frame7span)
dhgrScrBl7(xTV, yTV, frame7span >> 2, FRAME_HEIGHT*2)
dhgrSurfScr(OP_SRC)
while ^$C000 < 128
frameptr = frames
for i = 1 to numframes
dhgrSurfMem(OP_SRC, FRAME_HEIGHT*2, frame7ptr, frame7span)
//dcgrPixMap(0, 0, FRAME_WIDTH, FRAME_HEIGHT, frameptr)
dblHeight(FRAME_WIDTH, FRAME_HEIGHT, frameptr)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(xTV,yTV,frame7span>>2,FRAME_HEIGHT*2,frame7ptr,frame7span)
frameptr = frameptr + FRAME_SIZE
//delay_getkey
next
loop
^$C010
end
arg = argNext(argFirst)
if ^arg
while ^(arg + 1) == '-'
when toupper(^(arg + 2))
is 'X' // Set X coord
if ^arg > 2
xTV = ^(arg + 3) - '0'
if ^arg > 3
xTV = xTV * 10 + ^(arg + 4) - '0'
fin
fin
break
is 'Y' // Set Y coord
if ^arg > 2
yTV = ^(arg + 3) - '0'
if ^arg > 3
yTV = yTV * 10 + ^(arg + 4) - '0'
fin
fin
break
wend
arg = argNext(arg)
loop
dhgrMode(DHGR_COLOR_MODE)
screenRead("PENGUIN.DHGR")
frameAnimate(arg)
dhgrMode(DHGR_TEXT_MODE)
return 0
fin
puts("Usage: DCGRDEMO <GREASYFILE>\n")
done

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.

View File

@@ -0,0 +1,217 @@
include "inc/cmdsys.plh"
include "inc/lines.plh"
include "inc/vblank.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
//
// Pattern fill
//
const PAT_WIDTH = SCR_WIDTH
const PAT_HEIGHT = 2
word pattern
//
// Polygon variables
//
word leftedge, rightedge // Edge arrays
byte polytop, polybottom // Poly top and bottom extents
byte startvx, startvy // Starting poly vertex
byte polyvx, polyvy // Current poly vertex
byte sin90[] // first 90 degrees of sin in fixed s.15 format
byte = 0>>7, 571>>7, 1143>>7, 1714>>7, 2285>>7, 2855>>7, 3425>>7, 3993>>7
byte = 4560>>7, 5126>>7, 5690>>7, 6252>>7, 6812>>7, 7371>>7, 7927>>7, 8480>>7
byte = 9032>>7, 9580>>7, 10125>>7, 10668>>7, 11207>>7, 11743>>7, 12275>>7, 12803>>7
byte = 13327>>7, 13848>>7, 14364>>7, 14876>>7, 15383>>7, 15886>>7, 16383>>7, 16876>>7
byte = 17364>>7, 17846>>7, 18323>>7, 18794>>7, 19260>>7, 19720>>7, 20173>>7, 20621>>7
byte = 21062>>7, 21497>>7, 21926>>7, 22347>>7, 22762>>7, 23170>>7, 23571>>7, 23964>>7
byte = 24351>>7, 24730>>7, 25101>>7, 25465>>7, 25821>>7, 26169>>7, 26509>>7, 26841>>7
byte = 27165>>7, 27481>>7, 27788>>7, 28087>>7, 28377>>7, 28659>>7, 28932>>7, 29196>>7
byte = 29451>>7, 29697>>7, 29935>>7, 30163>>7, 30381>>7, 30591>>7, 30791>>7, 30982>>7
byte = 31164>>7, 31336>>7, 31498>>7, 31651>>7, 31794>>7, 31928>>7, 32051>>7, 32165>>7
byte = 32270>>7, 32364>>7, 32449>>7, 32523>>7, 32588>>7, 32643>>7, 32688>>7, 32723>>7
byte = 32748>>7, 32763>>7, 32767>>7
//
// Sin and Cos
//
def sinext(deg)#1
return (sin90[deg] << 7) | (sin90[deg] >> 1)
end
def sin(deg)#1
while deg > 360; deg = deg - 360; loop
while deg < 0; deg = deg + 360; loop
if deg <= 90
return sinext(deg)
elsif deg <= 180
return sinext(180 - deg)
elsif deg <= 270
return -sinext(deg - 180)
fin
return -sinext(360 - deg)
end
def cos(deg)#1
return sin(deg + 90)
end
//
// Create pattern pixmap for filling
//
export def setPattern(clr1, clr2, dither)#0
word patfill, clr
if not pattern
pattern = heapalloc(SCR_WIDTH * PAT_HEIGHT)
fin
//
// Even scanlines
//
clr = dither & 1 ?? clr2 :: clr1
patfill = clr | (clr << 8)
clr = dither & 2 ?? clr2 :: clr1
patfill = patfill | (clr << 4) | (clr << 12)
memset(pattern, patfill, SCR_WIDTH/2)
patfill = (patfill << 4) | clr // Rotate pattern for odd pixel
memset(pattern + SCR_WIDTH, patfill, SCR_WIDTH/2)
//
// Odd scanlines
//
clr = dither & 4 ?? clr2 :: clr1
patfill = clr | (clr << 8)
clr = dither & 8 ?? clr2 :: clr1
patfill = patfill | (clr << 4) | (clr << 12)
memset(pattern + SCR_WIDTH/2, patfill, SCR_WIDTH/2)
patfill = (patfill << 4) | clr // Rotate pattern for odd pixel
memset(pattern + SCR_WIDTH + SCR_WIDTH/2, patfill, SCR_WIDTH/2)
end
export def patrnRect(left, top, right, bottom)#0
word patscan
byte width, y
width = right - left + 1
patscan = pattern + (left & 1 ?? SCR_WIDTH :: 0)
for y = top to bottom
dcgrPixMap(left, y, width, 1, patscan + (y & 1 ?? (SCR_WIDTH/2) :: 0))
next
end
export def solidRect(left, top, right, bottom)#0
byte l7, r7, x
l7 = (left | 7) / 7
r7 = right / 7
if l7 < r7
dhgrClearBl7(l7, top, r7 - l7, bottom - top + 1)
fin
l7 = l7 * 7
if l7 > left
for x = l7-1 downto left
dcgrVLin(top, bottom, x)
next
fin
r7 = r7 * 7
if r7 < right
for x = r7 to right
dcgrVLin(top, bottom, x)
next
fin
end
//
// Convex polygon
//
def setEdge(x, y)#0
if x < leftedge->[y]; leftedge->[y] = x; fin
if x > rightedge->[y]; rightedge->[y] = x; fin
end
export def startPoly(x, y)#0
setlineplot(@setEdge)
leftedge = heapalloc(SCR_HEIGHT)
rightedge = heapalloc(SCR_HEIGHT)
memset(leftedge, $FFFF, SCR_HEIGHT)
memset(rightedge, $0000, SCR_HEIGHT)
polytop = y
polybottom = y
startvx = x
startvy = y
polyvx = x
polyvy = y
end
export def addVertex(x, y)#0
if y < polytop; polytop = y; fin
if y > polybottom; polybottom = y; fin
line(polyvx, polyvy, x, y)
polyvx = x
polyvy = y
end
export def patrnPoly(x, y)#0
var width
byte left
if y < polytop; polytop = y; fin
if y > polybottom; polybottom = y; fin
line(polyvx, polyvy, x, y)
line(x, y, startvx, startvy)
for y = polytop to polybottom
left = leftedge->[y]
width = rightedge->[y] - left + 1
if width > 0
dcgrPixMap(left, y, width, 1, \
pattern + (left & 1 ?? SCR_WIDTH :: 0) \
+ (y & 1 ?? (SCR_WIDTH/2) :: 0))
fin
next
heaprelease(leftedge)
end
export def solidPoly(x, y)#0
byte left, right
if y < polytop; polytop = y; fin
if y > polybottom; polybottom = y; fin
line(polyvx, polyvy, x, y)
line(x, y, startvx, startvy)
for y = polytop to polybottom
left = leftedge->[y]
right = rightedge->[y]
if right >= left
dcgrHLin(left, right, y)
fin
next
heaprelease(leftedge)
end
//
// Ellipse
//
export def solidEllip(xorg, yorg, width, height)#0
var x, y, angle
for angle = 0 to 90 step 90 / height
x = ((cos(angle) >> 8) * width) >> 8
y = ((sin(angle) >> 8) * height) >> 8
dcgrHLin(xorg - x, xorg + x, yorg + y)
dcgrHLin(xorg - x, xorg + x, yorg - y)
next
end
export def patrnEllip(xorg, yorg, width, height)#0
var x, y, angle, left, len, scan
for angle = 0 to 90 step 90 / height
x = ((cos(angle) >> 8) * width) >> 8
y = ((sin(angle) >> 8) * height) >> 8
left = xorg - x
len = x * 2
if len == 0; len = 1; fin
scan = yorg + y
dcgrPixMap(left, scan, len, 1, \
pattern + (left & 1 ?? SCR_WIDTH :: 0) \
+ (scan & 1 ?? (SCR_WIDTH/2) :: 0))
scan = yorg - y
dcgrPixMap(left, scan, len, 1, \
pattern + (left & 1 ?? SCR_WIDTH :: 0) \
+ (scan & 1 ?? (SCR_WIDTH/2) :: 0))
next
end
export def frame(left, top, right, bottom, thickness)#0
while thickness
thickness--
dcgrHLin(left + thickness, right - thickness, top + thickness)
dcgrHLin(left + thickness, right - thickness, bottom - thickness)
dcgrVLin(top + thickness, bottom - thickness, left + thickness)
dcgrVLin(top + thickness, bottom - thickness, right - thickness)
loop
end

View File

@@ -0,0 +1,353 @@
include "inc/cmdsys.plh"
//include "inc/lines.plh"
include "inc/vblank.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
import fillshape
//
// Dither matrices
//
const DITHER0 = $00
const DITHER25 = $04
const DITHER50 = $06
const DITHER75 = $07
const DITHER100 = $0F
predef setPattern(clr1, clr2, dither)#0
predef patrnRect(left, top, right, bottom)#0
predef solidRect(left, top, right, bottom)#0
predef startPoly(x, y)#0
predef addVertex(x, y)#0
predef patrnPoly(x, y)#0
predef solidPoly(x, y)#0
predef solidEllip(xorg, yorg, width, height)#0
predef patrnEllip(xorg, yorg, width, height)#0
predef frame(left, top, right, bottom, thickness)#0
end
sysflags resxtxt1|reshgr1|resxhgr1
//
// ViewScreen coordinates
//
const VIEW_LEFT7 = 3
const VIEW_RIGHT7 = 17
const VIEW_WIDTH7 = VIEW_RIGHT7 - VIEW_LEFT7
const VIEW_LEFT = VIEW_LEFT7 * 7 // 21
const VIEW_RIGHT = VIEW_RIGHT7 * 7 // 119
const VIEW_WIDTH = VIEW_RIGHT - VIEW_LEFT
const VIEW_TOP = 24
const VIEW_BOTTOM = 122
const VIEW_HEIGHT = VIEW_BOTTOM - VIEW_TOP
const VIEW_ORGX = (VIEW_LEFT+VIEW_RIGHT)/2
const VIEW_ORGY = (VIEW_TOP+VIEW_BOTTOM)/2
//
// Enterprise sprites
//
struc t_sprite
var spr_xorg
var spr_yorg
var spr_width
var spr_height
var spr_pixmap
var spr_bl7
end
res[t_sprite * 8] ncc1701
char[12] sprFile = "ENT.UP.SPR"
char[12] = "ENT.UR.SPR"
char[12] = "ENT.RT.SPR"
char[12] = "ENT.DR.SPR"
char[12] = "ENT.DN.SPR"
char[12] = "ENT.DL.SPR"
char[12] = "ENT.LT.SPR"
char[12] = "ENT.UL.SPR"
const ENT_W7 = 5
const ENT_H = 43
const ENT_SZ = ENT_W7*4*ENT_H
//
// Random seed
//
var rndseed = $A64D
def random#1
rndseed = (rndseed << 8) ^ ((rndseed & $7FFF) >> 7) + $62B3
return rndseed
end
//
// Draw components
//
def drawSurround#0
//
// Viewscreen surround
//
dcgrColor(CLR_GREY)
dhgrClearBl7(0, 0, SCR_WIDTH7, VIEW_TOP)
dhgrClearBl7(0, VIEW_BOTTOM, SCR_WIDTH7, VIEW_TOP)
dhgrClearBl7(0, VIEW_TOP, VIEW_LEFT7, VIEW_HEIGHT)
dhgrClearBl7(VIEW_RIGHT7, VIEW_TOP, VIEW_LEFT7, VIEW_HEIGHT)
setPattern(CLR_BLACK, CLR_GREY, DITHER50)
patrnRect(0, VIEW_BOTTOM+VIEW_TOP, SCR_WIDTH-1, SCR_HEIGHT-1)
//
// Above viewscreen ceiling
//
setPattern(CLR_BLACK, CLR_GREY, DITHER50)
startPoly(0, 0)
addVertex(SCR_WIDTH-1, 0)
addVertex(VIEW_RIGHT+3-1, VIEW_TOP-6)
patrnPoly(VIEW_LEFT-3, VIEW_TOP-6)
//
// Below viewscreen bump-out
//
setPattern(CLR_GREY, CLR_WHITE, DITHER50)
startPoly(VIEW_LEFT-3, VIEW_BOTTOM+5)
addVertex(VIEW_RIGHT+3-1, VIEW_BOTTOM+5)
addVertex(SCR_WIDTH-1, VIEW_BOTTOM+VIEW_TOP-1)
patrnPoly(0, VIEW_BOTTOM+VIEW_TOP-1)
//
// Viewscreen frame
//
dcgrColor(CLR_DRKBLUE)
frame(VIEW_LEFT-3, VIEW_TOP-3, VIEW_RIGHT+3-1, VIEW_BOTTOM+3-1, 3)
dcgrColor(CLR_MEDBLUE)
frame(VIEW_LEFT-2, VIEW_TOP-2, VIEW_RIGHT+2-1, VIEW_BOTTOM+2-1, 1)
end
def drawRails#0
dcgrColor(CLR_ORANGE)
dhgrClearBl7(0, 132, 40/7, 1)
dhgrClearBl7(107/7, 132, 40/7, 1)
dcgrColor(CLR_MAGENTA)
dhgrClearBl7(0, 133, 40/7, 7)
dhgrClearBl7(107/7, 133, 40/7, 7)
dcgrColor(CLR_BLACK)
solidRect( 20, 140, 24, 191)
solidRect(115, 140, 119, 191)
end
def drawAlerts#0
dcgrColor(CLR_ORANGE)
frame( 1*7-2, 40-2, 2*7+2-1, 80+2-1, 2)
frame(18*7-2, 40-2, 19*7+2-1, 80+2-1, 2)
dcgrColor(CLR_BLACK)
dhgrClearBl7( 1, 40, 1, 40)
dhgrClearBl7(18, 40, 1, 40)
end
def drawConsoles#0
dcgrColor(CLR_MAGENTA)
startPoly(70-30, 160)
addVertex(70-30, SCR_HEIGHT-1)
solidPoly(70-40, SCR_HEIGHT-1)
startPoly(70+30-1, 160)
addVertex(70+30-1, SCR_HEIGHT-1)
solidPoly(70+40-1, SCR_HEIGHT-1)
setPattern(CLR_BLACK, CLR_BROWN, DITHER50)
startPoly(0, 160)
addVertex(70-30, 160)
addVertex(70-40, SCR_HEIGHT-1)
patrnPoly(0, SCR_HEIGHT-1)
startPoly(70+30-1, 160)
addVertex(SCR_WIDTH-1, 160)
addVertex(SCR_WIDTH-1, SCR_HEIGHT-1)
patrnPoly(70+40-1, SCR_HEIGHT-1)
dcgrColor(CLR_BLACK)
startPoly(0, 170)
addVertex(70-40, 170)
addVertex(70-51, SCR_HEIGHT-1)
solidPoly(0, SCR_HEIGHT-1)
startPoly(70+40-1, 170)
addVertex(SCR_WIDTH-1, 170)
addVertex(SCR_WIDTH-1, SCR_HEIGHT-1)
solidPoly(70+51-1, SCR_HEIGHT-1)
end
def drawNavigation#0
dcgrColor(CLR_WHITE)
startPoly(70-20, 150)
addVertex(70+20-1, 150)
addVertex(70+30-1, SCR_HEIGHT-1)
solidPoly(70-30, SCR_HEIGHT-1)
setPattern(CLR_GREY, CLR_BROWN, DITHER50)
patrnEllip(70, 170, 40, 35)
end
//
// Read Enterprise sprites
//
def readEnterprise#0
var xorg, yorg, width, height, pixptr, t_ptr, f_ptr
byte i
t_ptr = @ncc1701
f_ptr = @sprFile
for i = 0 to 7
xorg, yorg, width, height, pixptr = spriteRead(f_ptr)
t_ptr=>spr_xorg = xorg
t_ptr=>spr_yorg = yorg
t_ptr=>spr_width = width
t_ptr=>spr_height = height
t_ptr=>spr_pixmap = pixptr
t_ptr=>spr_bl7 = heapalloc(ENT_SZ)
dhgrSurfMem(OP_SRC, ENT_H, t_ptr=>spr_bl7, ENT_W7*4)
dcgrColor(CLR_BLACK)
dhgrClearBl7(0, 0, ENT_W7, ENT_H)
dcgrPixmap(ENT_W7*7/2 - xorg,ENT_H/2 - yorg, width, height, pixptr)
t_ptr = t_ptr + t_sprite
f_ptr = f_ptr + 12
next
end
//
// Animate stuff
//
def keypressed#1
return ^$C000 & $80
end
def idleViewPlot(x)#0
x = (x&63)+70-32
dcgrHLin(x - 1, x + 1, VIEW_BOTTOM+3)
dcgrHlin(x - 1, x + 1, VIEW_BOTTOM+4)
end
def newStar#3
return 15 - (random & 30), 15 - (random & 30), random & 15
end
def idleStars#0
byte xpos, star, nstars
var starx, stary, starincx, starincy, starclr
var x, y, incx, incy
waitVBL; nstars = waitVBL / 50
starx = heapalloc(nstars*2)
stary = heapalloc(nstars*2)
starincx = heapalloc(nstars*2)
starincy = heapalloc(nstars*2)
starclr = heapalloc(nstars)
nstars--
for star = 0 to nstars
repeat
incx, incy, starclr->[star] = newstar
until incx <> 0 and incy <> 0
if starclr->[star] == 0; starclr->[star] = 15; fin
starx=>[star] = incx * (VIEW_WIDTH-1)/2
stary=>[star] = incy * (VIEW_HEIGHT-1)/2
starincx=>[star] = incx
starincy=>[star] = incy
next
xpos = 8
star = 0
while not keypressed
dcgrColor(CLR_WHITE)
idleViewPlot(xpos)
dcgrColor(CLR_YELLOW)
idleViewPlot(xpos-4)
dcgrColor(CLR_ORANGE)
idleViewPlot(xpos-8)
dcgrColor(CLR_GREY)
idleViewPlot(xpos-12)
xpos = xpos + 4
for star = 0 to nstars
x = starx=>[star]
y = stary=>[star]
incx = x + starincx=>[star]
incy = y + starincy=>[star]
if incx > (VIEW_WIDTH-1)*8 or incx < -VIEW_WIDTH*8 \
or incy > (VIEW_HEIGHT-1)*8 or incy < -VIEW_HEIGHT*8
repeat
incx, incy, starclr->[star] = newStar
until incx <> 0 and incy <> 0
if starclr->[star] == 0; starclr->[star] = 15; fin
starx=>[star] = incx << 5
stary=>[star] = incy << 5
starincx=>[star] = incx
starincy=>[star] = incy
else
starx=>[star] = incx
stary=>[star] = incy
incx = starincx=>[star]
incy = starincy=>[star]
starincx=>[star] = incx + ((incx > 0 ?? incx + 7 :: incx - 7) >> 3)
starincy=>[star] = incy + ((incy > 0 ?? incy + 7 :: incy - 7) >> 3)
fin
dcgrColor(CLR_BLACK)
dcgrPixel((x >> 4) + VIEW_ORGX, (y >> 4) + VIEW_ORGY)
dcgrColor(starclr->[star])
dcgrPixel((starx=>[star] >> 4) + VIEW_ORGX, (stary=>[star] >> 4) + VIEW_ORGY)
next
loop
getc
heaprelease(starx)
end
def idleSpin#0
var viewbuf, viewspan
var i, k, oi, oj
byte xpos
//
// Use back buffer
//
viewbuf, viewspan = dhgrAllocBl7Mem(VIEW_WIDTH, VIEW_HEIGHT)
i = @ncc1701
k = 0
xpos = 0
while not keypressed
//
// Rotate Enterprise
//
dhgrSurfMem(OP_SRC, VIEW_HEIGHT, viewbuf, viewspan)
dcgrColor(CLR_DRKBLUE)
dhgrClearBl7(0, 0, VIEW_WIDTH7, VIEW_HEIGHT)
dcgrColor(CLR_GREEN)
for oi = (xpos/4)&31 to VIEW_WIDTH-1 step 32
dcgrVLin(0, VIEW_HEIGHT-1, oi)
next
for oi = (xpos/4)&63 to VIEW_HEIGHT-1 step 64
dcgrHLin(0, VIEW_WIDTH-1, oi)
next
dhgrOp(OP_OR)
dhgrMemBl7((VIEW_WIDTH7 - ENT_W7 + 1)/2, (VIEW_HEIGHT-ENT_H + 1)/2, \
ENT_W7, ENT_H, \
i=>spr_bl7, ENT_W7*4)
dhgrSurfScr(OP_SRC)
//waitVBL
dhgrMemBl7(VIEW_LEFT7, VIEW_TOP, \
VIEW_WIDTH7, VIEW_HEIGHT, \
viewbuf, viewspan)
i = i + t_sprite
k++
if k > 7
k = 0
i = @ncc1701
fin
//
// Animate useless view screen lights
//
dcgrColor(CLR_WHITE)
idleViewPlot(xpos)
dcgrColor(CLR_YELLOW)
idleViewPlot(xpos-4)
dcgrColor(CLR_ORANGE)
idleViewPlot(xpos-8)
dcgrColor(CLR_GREY)
idleViewPlot(xpos-12)
xpos = xpos + 4
loop
heaprelease(viewbuf)
getc
end
//
// Read sprites
//
readEnterprise
//
// Initialize
//
dhgrMode(DHGR_COLOR_MODE)
//
// Draw bridge
//
drawSurround
drawRails
drawAlerts
drawConsoles
drawNavigation
//
// Animate stars waiting for keypress
//
idleStars
idleSpin
//
// All done
//
dhgrMode(DHGR_TEXT_MODE)
done

View File

@@ -0,0 +1,54 @@
import dhgrlib
const DST_SCREEN = 0
const DST_MEMORY = 1
const SCR_WIDTH7 = 20
const SCR_WIDTH = 140
const SCR_HEIGHT = 192
const OP_SRC = 0
const OP_XOR = 1
const OP_AND = 2
const OP_OR = 3
const CLR_BLACK = 0
const CLR_MAGENTA = 1
const CLR_DRKBLUE = 2
const CLR_PURPLE = 3
const CLR_DRKGREEN = 4
const CLR_GREY1 = 5
const CLR_XPARENT = 5
const CLR_MEDBLUE = 6
const CLR_LTBLUE = 7
const CLR_BROWN = 8
const CLR_ORANGE = 9
const CLR_GREY2 = 10
const CLR_GREY = 10
const CLR_PINK = 11
const CLR_GREEN = 12
const CLR_YELLOW = 13
const CLR_AQUA = 14
const CLR_WHITE = 15
const DHGR_MONO_MODE = 2
const DHGR_COLOR_MODE = 0
const DHGR_MIXED_MODE = 1
const DHGR_TEXT_MODE = -1
predef dcgrColor(c)#0
predef dcgrPixel(x, y)#0
predef dcgrGetPixel(x, y)#1
predef dcgrHLin(x1, x2, y)#0
predef dcgrVLin(y1, y2, x)#0
predef dcgrBitMap(x, y, bitw, bith, bitptr)#0
predef dcgrPixMap(x, y, pixw, pixh, pixptr)#0
predef dcgrRleMap(x, y, pixw, pixh, pixptr)#0
predef dhgrScrBl7(x7, y, w7, h)#0
predef dhgrMemBl7(x7, y, w7, h, memptr, memspan)#0
predef dhgrClearBl7(x7, y, w7, h)#0
predef dhgrTiles(x7, y8, strptr, strlen, tileset)#0
predef dhgrMemBl7Tile(x7, y, memptr, memspan, tileptr)#0
predef dhgrSet(dhx, y)#0
predef dhgrUnset(dhx, y)#0
predef dhgrOp(op)#0
predef dhgrSurfScr(op)#0
predef dhgrSurfMem(op, memh, memptr, memspan)#0
predef dhgrMode(mode)#1
end

View File

@@ -0,0 +1,32 @@
import dhgrutils
//
// Font type bits
//
const FONT_MONO = $00
const FONT_PROP = $80
const FONT_AA = $40
//
// Default fonts
//
const FONT_DEFAULT = 0
const FONT_DEF_THIN = 1
const FONT_DEF_SLIM = 2
//
// Exported functions
//
predef dhgrAllocBl7Mem(w, h)#2
predef dcgrStr(x, y, strptr)#2
predef dcgrStrExtents(strptr)#2
predef dcgrBoldStr(clr, x, y, strptr)#2
predef dcgrFont(font)#1
predef fontRead(filename)#1
predef fontGlyphDim(ch)#2
predef fontType#1
predef dcgrRect(x, y, w, h)#0
predef dcgrGetPixMap(x, y, w, h)#1
predef dcgrEncPixMap(w, h, pixmap, rlemap)#1
predef spriteRead(filestr)#5
predef spriteWrite(filestr, xorg, yorg, width, height, sprptr)#1
predef screenRead(filestr)#1
predef screenWrite(filestr)#1
end

2687
src/dhgr.tk/libs/dhgrlib.pla Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,434 @@
include "inc/cmdsys.plh"
include "inc/fileio.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
const page1m = $C054
const page1x = $C055
//
// Font header
//
struc t_font
byte[] fnt_typelen
char fnt_name[16]
byte fnt_first
byte fnt_last
byte fnt_width
byte fnt_height
var fnt_glyptrs[]
end
//
// Variable pitch glyphs
//
struc t_glyph
var gly_left
var gly_top
byte gly_width
byte gly_height
byte gly_adv
byte gly_strike[]
end
//
// Current and default font pointers
//
var fontPtr, fontDefault, fontDefThin, fontDefSlim
//
// Function pointers
//
export asm dcgrStr(x, y, strptr)#2
JMP $2000
end
//
// Utility functions
//
export def dhgrAllocBl7Mem(w, h)#2
word memblk, span
span = (w+13)/14 << 3
memblk = heapalloc(span * h)
return memblk, span
end
def bitMonoGlyphStr(x, y, strptr)#2
byte first, last, width, height, size, i, ch
var strikes
first = fontPtr->fnt_first
last = fontPtr->fnt_last
width = fontPtr->fnt_width
height = fontPtr->fnt_height
strikes = fontPtr + fnt_glyptrs
size = (width + 7) / 8 * height
for i = 1 to ^strptr
ch = ^(strptr + i)
if ch >= first and ch <= last
dcgrBitmap(x, y - height, width, height, \
strikes + (^(strptr + i) - first) * size)
x = x + width
fin
next
return x, y
end
def pixPropGlyphStr(x, y, strptr)#2
var glyptrs, glyph
byte first, last, i, ch
first = fontPtr->fnt_first
last = fontPtr->fnt_last
glyptrs = fontPtr + fnt_glyptrs
x = x * 4
for i = 1 to ^strptr
ch = ^(strptr + i)
if ch >= first and ch <= last
glyph = glyptrs=>[ch - first]
dcgrPixmap((x + glyph=>gly_left) / 4, \
y + glyph=>gly_top, \
glyph->gly_width, \
glyph->gly_height, \
glyph + gly_strike)
x = x + glyph->gly_adv
fin
next
return x / 4, y
end
def bitPropGlyphStr(x, y, strptr)#2
var glyptrs, glyph
byte first, last, i, ch
first = fontPtr->fnt_first
last = fontPtr->fnt_last
glyptrs = fontPtr + fnt_glyptrs
for i = 1 to ^strptr
ch = ^(strptr + i)
if ch >= first and ch <= last
glyph = glyptrs=>[ch - first]
dcgrBitmap(x + glyph=>gly_left, \
y + glyph=>gly_top, \
glyph->gly_width, \
glyph->gly_height, \
glyph + gly_strike)
x = x + glyph->gly_adv
fin
next
return x, y
end
export def dcgrStrExtents(strptr)#2
var glyptrs, xext, yext
byte first, last, width, i, ch
first = fontPtr->fnt_first
last = fontPtr->fnt_last
if ^fontPtr & FONT_PROP
glyptrs = fontPtr + fnt_glyptrs
xext = -glyptrs=>[^(strptr + 1) - first]=>gly_left
if ^strptr > 1
for i = 1 to ^strptr-1
ch = ^(strptr + i)
if ch >= first and ch <= last
xext = xext + glyptrs=>[ch - first]->gly_adv
fin
next
fin
xext = xext + glyptrs=>[^(strptr + ^strptr) - first]->gly_width
if ^fontPtr & FONT_AA
xext = xext / 4
fin
else
xext = fontPtr->fnt_width * ^strptr
fin
return xext, fontPtr->fnt_height
end
export def dcgrBoldStr(clr, x, y, strptr)#2
byte h, v
for v = y - 1 to y + 1
for h = x - 1 to x + 1
dcgrStr(h, v, strptr)
next
next
dcgrColor(clr)
return dcgrStr(x, y, strptr)
end
export def fontRead(filename)#1
var glyph, strksize, left, top
byte refnum, num, i, width, height, adv
byte roundup, pixbyte
var font_header, gly_ptr
byte[64] sysfont
font_header = NULL
if filename and ^filename
refnum = fileio:open(filename)
if not refnum // Look for system font
strcpy(@sysfont, cmdsys:syspath)
strcat(@sysfont, "fonts/")
strcat(@sysfont, filename)
refnum = fileio:open(@sysfont)
if not refnum
strcpy(@sysfont, cmdsys:syspath)
strcat(@sysfont, "fonts/apple2.fon")
refnum = fileio:open(@sysfont)
fin
fin
if refnum
font_header = heapalloc(t_font)
fileio:read(refnum, font_header, t_font)
num = font_header->fnt_last - font_header->fnt_first
if font_header->fnt_typelen & FONT_PROP
gly_ptr = heapalloc(num * 2) // Allocate glyph ptrs right after
if font_header->fnt_typelen & FONT_AA
roundup = 1
pixbyte = 2
else
roundup = 7
pixbyte = 8
fin
for i = 1 to num
fileio:read(refnum, @left, 1); left = sext(left)
fileio:read(refnum, @top, 1); top = sext(top)
fileio:read(refnum, @width, 1)
fileio:read(refnum, @height, 1)
fileio:read(refnum, @adv, 1)
strksize = (width + roundup) / pixbyte * height
if strksize
*gly_ptr = heapalloc(strksize + t_glyph)
glyph = *gly_ptr
if glyph and fileio:read(refnum, glyph + gly_strike, strksize) == strksize
glyph=>gly_left = left
glyph=>gly_top = top
glyph->gly_width = width
glyph->gly_height = height
glyph->gly_adv = adv
else
heaprelease(font_header)
font_header = NULL
break
fin
else
*gly_ptr = NULL
fin
gly_ptr = gly_ptr + 2
next
else // FONT_MONO
strksize = (font_header->fnt_width + 7) / 8 * font_header->fnt_height * num
glyph = heapalloc(strksize) // Allocate glyphs right after
if not glyph or fileio:read(refnum, glyph, strksize) <> strksize
heaprelease(font_header)
font_header = NULL
fin
fin
fileio:close(refnum)
fin
fin
return font_header
end
export def dcgrFont(font)#1
var rows, pWide, pThin, prevFont
if font == FONT_DEFAULT // Will also capture NULL font pointers
if not fontDefault
fontDefault = fontRead("apple2.fon")
if not fontDefault
return fontPtr
fin
fin
font = fontDefault
elsif font == FONT_DEF_THIN // Thin version of Apple2 font
if not fontDefThin
fontDefThin = fontRead("apple2thin.fon")
if not fontDefThin
return fontPtr
fin
fin
font = fontDefThin
elsif font == FONT_DEF_SLIM // Proportional version of thin font
if not fontDefSlim
fontDefSlim = fontRead("a2slim8.fon")
if not fontDefSlim
return fontPtr
fin
fin
font = fontDefSlim
fin
prevFont = fontPtr
fontPtr = font
if fontPtr->fnt_typelen & FONT_PROP
if fontPtr->fnt_typelen & FONT_AA
dcgrStr:1 = @pixPropGlyphStr
else
dcgrStr:1 = @bitPropGlyphStr
fin
else // FONT_MONO
dcgrStr:1 = @bitMonoGlyphStr
fin
return prevFont
end
def dcgrLoadDefFont(x, y, strptr)#2 // Default if no font selected
dcgrFont(FONT_DEFAULT)
if fontDefault // Ensure it got loaded
return dcgrStr(x, y, strptr)
fin
return 0, 0
end
export def fontGlyphDim(ch)#2
byte width, height, first
width = fontPtr->fnt_width
height = fontPtr->fnt_height
if fontPtr->fnt_typelen & FONT_PROP
first = fontPtr->fnt_first
if ch >= first and ch <= fontPtr->fnt_last
width = fontPtr=>fnt_glyptrs=>[ch - first]->gly_adv / 4
fin
fin
return width, height
end
export def fontType#1
return ^fontPtr & $F0
end
export def dcgrRect(x, y, w, h)#0
byte x2, y2, v
x2 = x + w - 1
y2 = y + h - 1
for v = y to y2
dcgrHLin(x, x2, v)
next
end
export def dcgrGetPixMap(x, y, w, h)#1
var pixmap, pixptr
byte i, j
pixmap = heapalloc((w + 1)/2 * h)
pixptr = pixmap
w--; h--
for j = 0 to h
for i = 0 to w step 2
^pixptr = dcgrGetPixel(i+x,j+y)|(dcgrGetPixel(i+x+1,j+y)<<4)
pixptr++
next
next
return pixmap
end
export def dcgrEncPixMap(w, h, pixmap, rlemap)#1
var rleptr
byte i, j, run, pixrun
rleptr = rlemap
w--; h--
for j = 0 to h
run = 0
for i = 0 to w step 2
if run and ^pixmap == pixrun
run++
else
if run
*rleptr = run*2 | (pixrun << 8)
//puth(*rleptr); putc(',')
rleptr = rleptr + 2
fin
run = 1
pixrun = ^pixmap
fin
pixmap++
next
*rleptr = run*2 | (pixrun << 8)
//puth(*rleptr); putln
rleptr = rleptr + 2
next
return rleptr - rlemap
end
export def spriteRead(filestr)#5
var sprptr, sprsize, xorg, yorg
byte refnum, width, height
width = 0
height = 0
sprptr = 0
refnum = fileio:open(filestr)
if refnum
fileio:read(refnum, @xorg, 1); xorg = sext(xorg)
fileio:read(refnum, @yorg, 1); yorg = sext(yorg)
fileio:read(refnum, @width, 1)
fileio:read(refnum, @height, 1)
if width <= 40 and height <= 48
sprsize = (width + 1) / 2 * height
sprptr = heapalloc(sprsize)
if sprptr
if fileio:read(refnum, sprptr, sprsize) <> sprsize
heaprelease(sprptr)
sprptr = NULL
fin
fin
fin
fileio:close(refnum)
fin
return xorg, yorg, width, height, sprptr
end
export def spriteWrite(filestr, xorg, yorg, width, height, sprptr)#1
var sprsize
byte refnum, i, result
sprsize = (width + 1) / 2 * height
fileio:destroy(filestr)
result = fileio:create(filestr, $06, $0000)
if result == FILE_ERR_OK
refnum = fileio:open(filestr)
if refnum
fileio:write(refnum, @xorg, 1)
fileio:write(refnum, @yorg, 1)
fileio:write(refnum, @width, 1)
fileio:write(refnum, @height, 1)
sprsize = (width + 1) / 2 * height
fileio:write(refnum, sprptr, sprsize)
result = perr
fileio:close(refnum)
else
result = perr
fin
fin
return result
end
export def screenRead(filestr)#1
byte refnum
refnum = fileio:open(filestr)
if refnum
^page1x // Read AUX bytes
fileio:read(refnum, $2000, $2000)
^page1m // Read MAIN bytes
fileio:read(refnum, $2000, $2000)
fileio:close(refnum)
fin
return perr
end
export def screenWrite(filestr)#1
byte refnum, result
fileio:destroy(filestr)
result = fileio:create(filestr, $06, $2000)
if result == FILE_ERR_OK
refnum = fileio:open(filestr)
if refnum
^page1x // Write AUX bytes
if fileio:write(refnum, $2000, $2000) == $2000
^page1m // Write MAIN bytes
fileio:write(refnum, $2000, $2000)
fin
result = perr
fileio:close(refnum)
else
result = perr
fin
fin
return result
end
//
// Fixups
//
dcgrStr:1 = @dcgrLoadDefFont
//
// Keep module in memory
//
return modkeep
done

177
src/dhgr.tk/makefile Normal file
View File

@@ -0,0 +1,177 @@
.SUFFIXES =
AFLAGS = -o $@
DHGRLIB = dhgr.tk/libs/DHGRLIB.REL
DHGRUTILS = dhgr.tk/libs//DHGRUTILS.REL
DHGRTEST = dhgr.tk/test/DHGRTEST.REL
FONTTEST = dhgr.tk/test/FONTTEST.REL
DHGRSPRED = dhgr.tk/utils/DHGRSPRED.REL
DHGREASY = dhgr.tk/utils/DHGREASY.REL
DHGRRGB = dhgr.tk/utils/DHGRRGB.REL
DHGRSHOW = dhgr.tk/utils/DHGRSHOW.REL
DLGRCONV = dhgr.tk/utils/DLGRCONV.REL
DHGRRGB_C = dhgr.tk/utils/dhgrrgb
TTFCONV = dhgr.tk/utils/ttfconv
IIGSCONV = dhgr.tk/utils/gsfonconv
A2CONV = dhgr.tk/utils/a2fonconv
A2DEFAULT = dhgr.tk/utils/a2fondef
DDCONV = dhgr.tk/utils/ddfonconv
PENGUINS = dhgr.tk/demos/penguins/PENGUINS.REL
DARTHGR = dhgr.tk/demos/darthgr/DARTHGR.REL
STARTREK = dhgr.tk/demos/startrek/STARTREK.REL
FILLSHAPE = dhgr.tk/demos/startrek/FILLSHAPE.REL
DROGUE = dhgr.tk/drogue/DROGUE.REL
DROGUE.MAP = dhgr.tk/drogue/DROGUE.MAP.REL
DROGUE.COMBAT = dhgr.tk/drogue/DROGUE.COMBAT.REL
libs: $(DHGRLIB) $(DHGRUTILS)
cp $(DHGRLIB) prodos/sys
cp $(DHGRUTILS) prodos/sys
-mkdir prodos/sys/fonts
cp dhgr.tk/utils/fonts/APPLE2.FON.BIN prodos/sys/fonts
cp dhgr.tk/utils/fonts/APPLE2THIN.FON.BIN prodos/sys/fonts
cp dhgr.tk/utils/fonts/A2SLIM8.FON.BIN prodos/sys/fonts
test: $(DHGRTEST) $(FONTTEST)
-mkdir prodos/dhgr.tk/
-mkdir prodos/dhgr.tk/test
cp dhgr.tk/test/*.REL prodos/dhgr.tk/test
cp dhgr.tk/test/*.BIN prodos/dhgr.tk/test
utils: $(DHGRSPRED) $(DHGREASY) $(DHGRRGB) $(DHGRRGB_C) $(DHGRSHOW) $(DLGRCONV)
-mkdir prodos/dhgr.tk/
-mkdir prodos/dhgr.tk/utils
-mkdir prodos/dhgr.tk/utils/samples
cp dhgr.tk/utils/*.REL prodos/dhgr.tk/utils
cp dhgr.tk/utils/samples/* prodos/dhgr.tk/utils/samples
demos: $(PENGUINS) $(DARTHGR) $(STARTREK) $(FILLSHAPE)
-mkdir prodos/dhgr.tk/
-mkdir prodos/dhgr.tk/demos/
-mkdir prodos/dhgr.tk/demos/penguins/
-mkdir prodos/dhgr.tk/demos/darthgr/
-mkdir prodos/dhgr.tk/demos/startrek/
cp $(PENGUINS) prodos/dhgr.tk/demos/penguins/
cp dhgr.tk/demos/penguins/*.BIN prodos/dhgr.tk/demos/penguins/
cp $(DARTHGR) prodos/dhgr.tk/demos/darthgr/
cp dhgr.tk/demos/darthgr/*.BIN prodos/dhgr.tk/demos/darthgr/
cp $(STARTREK) prodos/dhgr.tk/demos/startrek/
cp $(FILLSHAPE) prodos/dhgr.tk/demos/startrek/
cp dhgr.tk/demos/startrek/*.BIN prodos/dhgr.tk/demos/startrek/
drogue: $(DROGUE) $(DROGUE.MAP) $(DROGUE.COMBAT)
-mkdir prodos/dhgr.tk/demos
-mkdir prodos/dhgr.tk/demos/drogue
cp dhgr.tk/drogue/DROGUE.REL prodos/dhgr.tk/demos/drogue
cp dhgr.tk/drogue/DROGUE.MAP.REL prodos/dhgr.tk/demos/drogue/DROGUEMAP.REL
cp dhgr.tk/drogue/DROGUE.COMBAT.REL prodos/dhgr.tk/demos/drogue/DROGUECOMBAT.REL
cp samplesrc/LEVEL0#040000 prodos/dhgr.tk/demos/drogue/LEVEL0.TXT
cp samplesrc/LEVEL1#040000 prodos/dhgr.tk/demos/drogue/LEVEL1.TXT
bld: $(DHGRLIB) $(DHGRUTILS) $(DHGRTEST) $(DHGRRGB) $(DHGRSHOW) $(STARTREK)
-mkdir prodos/bld/dhgr.tk/
-mkdir prodos/bld/dhgr.tk/inc/
cp dhgr.tk/inc/dhgrlib.plh prodos/bld/dhgr.tk/inc/DHGRLIB.PLH.TXT
cp dhgr.tk/inc/dhgrutils.plh prodos/bld/dhgr.tk/inc/DHGRUTILS.PLH.TXT
cp dhgr.tk/test/dhgrtest.pla prodos/bld/dhgr.tk/DHGRTEST.PLA.TXT
cp dhgr.tk/test/fonttest.pla prodos/bld/dhgr.tk/FONTTEST.PLA.TXT
cp dhgr.tk/demos/darthgr/darthgr.pla prodos/bld/dhgr.tk/DARTHGR.PLA.TXT
cp dhgr.tk/demos/startrek/startrek.pla prodos/bld/dhgr.tk/STARTREK.PLA.TXT
cp dhgr.tk/demos/startrek/fillshape.pla prodos/bld/dhgr.tk/FILLSHAPE.PLA.TXT
cp dhgr.tk/utils/dhgrrgb.pla prodos/bld/dhgr.tk/DHGRRGB.PLA.TXT
cp dhgr.tk/utils/dhgrshow.pla prodos/bld/dhgr.tk/DHGRSHOW.PLA.TXT
fontconv: $(TTFCONV) $(IIGSCONV) $(A2CONV) $(A2DEFAULT) $(DDCONV)
all: libs test utils demos bld
clean:
-rm dhgr.tk/demos/pengiuns/*.o dhgr.tk/demos/pengiuns/*.REL dhgr.tk/demos/pengiuns/*.a
-rm dhgr.tk/demos/darthgr/*.o dhgr.tk/demos/darthgr/*.REL dhgr.tk/demos/darthgr/*.a
-rm dhgr.tk/demos/startrek/*.o dhgr.tk/demos/startrek/*.REL dhgr.tk/demos/startrek/*.a
-rm dhgr.tk/test/*.o dhgr.tk/test/*.REL dhgr.tk/test/*.a
-rm dhgr.tk/utils/*.o dhgr.tk/utils/*.REL dhgr.tk/utils/*.a
$(TTFCONV): dhgr.tk/utils/ttfconv.c
cc `pkg-config --cflags freetype2` dhgr.tk/utils/ttfconv.c -o dhgr.tk/utils/ttfconv -lfreetype
$(IIGSCONV): dhgr.tk/utils/gsfonconv.c
cc dhgr.tk/utils/gsfonconv.c -o dhgr.tk/utils/gsfonconv
$(A2CONV): dhgr.tk/utils/a2fonconv.c
cc dhgr.tk/utils/a2fonconv.c -o dhgr.tk/utils/a2fonconv
$(A2DEFAULT): dhgr.tk/utils/a2fondef.c
cc dhgr.tk/utils/a2fondef.c -o dhgr.tk/utils/a2fondef
$(DDCONV): dhgr.tk/utils/ddfonconv.c
cc dhgr.tk/utils/ddfonconv.c -o dhgr.tk/utils/ddfonconv
$(DHGRLIB): dhgr.tk/libs/dhgrlib.pla dhgr.tk/inc/dhgrlib.plh
./xplasm -AMOW dhgr.tk/libs/dhgrlib.pla
acme --setpc 4094 -o $(DHGRLIB) dhgr.tk/libs/dhgrlib.a
$(DHGRUTILS): dhgr.tk/libs/dhgrutils.pla $(DHGRLIB) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/libs/dhgrutils.pla
acme --setpc 4094 -o $(DHGRUTILS) dhgr.tk/libs/dhgrutils.a
$(DHGRTEST): dhgr.tk/test/dhgrtest.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/test/dhgrtest.pla
acme --setpc 4094 -o $(DHGRTEST) dhgr.tk/test/dhgrtest.a
$(FONTTEST): dhgr.tk/test/fonttest.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/test/fonttest.pla
acme --setpc 4094 -o $(FONTTEST) dhgr.tk/test/fonttest.a
$(DHGRSPRED): dhgr.tk/utils/dhgrspred.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/utils/dhgrspred.pla
acme --setpc 4094 -o $(DHGRSPRED) dhgr.tk/utils/dhgrspred.a
$(DHGREASY): dhgr.tk/utils/dhgreasy.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/utils/dhgreasy.pla
acme --setpc 4094 -o $(DHGREASY) dhgr.tk/utils/dhgreasy.a
$(DHGRSHOW): dhgr.tk/utils/dhgrshow.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/utils/dhgrshow.pla
acme --setpc 4094 -o $(DHGRSHOW) dhgr.tk/utils/dhgrshow.a
$(DLGRCONV): dhgr.tk/utils/dlgrconv.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/utils/dlgrconv.pla
acme --setpc 4094 -o $(DLGRCONV) dhgr.tk/utils/dlgrconv.a
$(DHGRRGB): dhgr.tk/utils/dhgrrgb.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/utils/dhgrrgb.pla
acme --setpc 4094 -o $(DHGRRGB) dhgr.tk/utils/dhgrrgb.a
$(DHGRRGB_C): dhgr.tk/utils/dhgrrgb.c
cc dhgr.tk/utils/dhgrrgb.c -o dhgr.tk/utils/dhgrrgb -lm
$(PENGUINS): dhgr.tk/demos/penguins/penguins.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/demos/penguins/penguins.pla
acme --setpc 4094 -o $(PENGUINS) dhgr.tk/demos/penguins/penguins.a
$(DARTHGR): dhgr.tk/demos/darthgr/darthgr.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/demos/darthgr/darthgr.pla
acme --setpc 4094 -o $(DARTHGR) dhgr.tk/demos/darthgr/darthgr.a
$(STARTREK): dhgr.tk/demos/startrek/startrek.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/demos/startrek/startrek.pla
acme --setpc 4094 -o $(STARTREK) dhgr.tk/demos/startrek/startrek.a
$(FILLSHAPE): dhgr.tk/demos/startrek/fillshape.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/demos/startrek/fillshape.pla
acme --setpc 4094 -o $(FILLSHAPE) dhgr.tk/demos/startrek/fillshape.a
$(DROGUE): dhgr.tk/drogue/drogue.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/drogue/drogue.pla
acme --setpc 4094 -o $(DROGUE) dhgr.tk/drogue/drogue.a
$(DROGUE.MAP): dhgr.tk/drogue/drogue.map.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/drogue/drogue.map.pla
acme --setpc 4094 -o $(DROGUE.MAP) dhgr.tk/drogue/drogue.map.a
$(DROGUE.COMBAT): dhgr.tk/drogue/drogue.combat.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/drogue/drogue.combat.pla
acme --setpc 4094 -o $(DROGUE.COMBAT) dhgr.tk/drogue/drogue.combat.a

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.

View File

@@ -0,0 +1,458 @@
include "inc/cmdsys.plh"
include "inc/lines.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags resxtxt1|reshgr1|resxhgr1
//
// Test sprite
//
const SPR_W = 16
const SPR_H = 16
byte[] sprite = $55,$55,$55,$05,$50,$55,$55,$55
byte[] = $55,$55,$00,$00,$00,$00,$55,$55
byte[] = $55,$00,$00,$AA,$AA,$00,$00,$55
byte[] = $05,$00,$AA,$AA,$AA,$AA,$00,$50
byte[] = $00,$A0,$AA,$FF,$FF,$AA,$0A,$00
byte[] = $00,$AA,$FF,$FF,$FF,$FF,$AA,$00
byte[] = $00,$AA,$1F,$12,$12,$F2,$AA,$00
byte[] = $00,$AA,$2F,$21,$21,$F1,$AA,$00
byte[] = $00,$AA,$1F,$12,$12,$F2,$AA,$00
byte[] = $00,$AA,$2F,$21,$21,$F1,$AA,$00
byte[] = $00,$AA,$FF,$FF,$FF,$FF,$AA,$00
byte[] = $00,$A0,$AA,$FF,$FF,$AA,$0A,$00
byte[] = $05,$00,$AA,$AA,$AA,$AA,$00,$50
byte[] = $55,$00,$00,$AA,$AA,$00,$00,$55
byte[] = $55,$55,$00,$00,$00,$00,$55,$55
byte[] = $55,$55,$55,$05,$50,$55,$55,$55
byte[] rlesprt = 7,$55,2,$00,7,$55
byte[] = 4,$55,8,$00,4,$55
byte[] = 2,$55,4,$00,4,$AA,4,$00,2,$55
byte[] = 1,$05,3,$00,8,$AA,3,$00,1,$55
byte[] = 3,$00,3,$AA,4,$FF,3,$AA,3,$00
byte[] = 2,$00,2,$AA,8,$FF,2,$AA,2,$00
byte[] = 2,$00,2,$AA,2,$1F,4,$12,2,$F2,2,$AA,2,$00
byte[] = 2,$00,2,$AA,2,$2F,4,$21,2,$F1,2,$AA,2,$00
byte[] = 2,$00,2,$AA,2,$1F,4,$12,2,$F2,2,$AA,2,$00
byte[] = 2,$00,2,$AA,2,$2F,4,$21,2,$F1,2,$AA,2,$00
byte[] = 2,$00,2,$AA,8,$FF,2,$AA,2,$00
byte[] = 3,$00,3,$AA,4,$FF,3,$AA,3,$00
byte[] = 1,$05,3,$00,8,$AA,3,$00,1,$55
byte[] = 2,$55,4,$00,4,$AA,4,$00,2,$55
byte[] = 4,$55,8,$00,4,$55
byte[] = 7,$55,2,$00,7,$55
word rlesprptr
word sprite7msk[7]
word sprite7[7]
word sprite7span,sprite7w
//
// Dither matrices
//
byte[] dither25 = $55,$55,$00,$00,$AA,$AA,$00,$00
byte[] = $55,$55,$00,$00,$AA,$AA,$00,$00
byte[] = $55,$55,$00,$00,$AA,$AA,$00,$00
byte[] = $55,$55,$00,$00,$AA,$AA,$00,$00
byte[] dither50 = $55,$55,$AA,$AA,$55,$55,$AA,$AA
byte[] = $55,$55,$AA,$AA,$55,$55,$AA,$AA
byte[] = $55,$55,$AA,$AA,$55,$55,$AA,$AA
byte[] = $55,$55,$AA,$AA,$55,$55,$AA,$AA
byte[] dither75 = $55,$55,$FF,$FF,$AA,$AA,$FF,$FF
byte[] = $55,$55,$FF,$FF,$AA,$AA,$FF,$FF
byte[] = $55,$55,$FF,$FF,$AA,$AA,$FF,$FF
byte[] = $55,$55,$FF,$FF,$AA,$AA,$FF,$FF
word[] dither = @dither25,@dither50,@dither75
//
// Sliding sprite Y coordinate
//
const SLIDE_Y = 170
//
// Enterprise sprites
//
struc t_sprite
var spr_xorg
var spr_yorg
var spr_width
var spr_height
var spr_pixmap
var spr_bl7
end
res[t_sprite * 8] ncc1701
char[12] sprFile = "ENT.UP.SPR"
char[12] = "ENT.UR.SPR"
char[12] = "ENT.RT.SPR"
char[12] = "ENT.DR.SPR"
char[12] = "ENT.DN.SPR"
char[12] = "ENT.DL.SPR"
char[12] = "ENT.LT.SPR"
char[12] = "ENT.UL.SPR"
const ENT_W7 = 5
const ENT_H = 43
const ENT_SZ = ENT_W7*4*ENT_H
def dcgrCompSprite(offset)#0
byte i
for i = 0 to 6
sprite7[i],sprite7span = dhgrAllocBl7Mem(SPR_W+offset,SPR_H)
sprite7w = sprite7span >> 2
dhgrSurfMem(OP_SRC,SPR_H,sprite7[i],sprite7span)
dcgrColor(CLR_BLACK)
dhgrClearBl7(0,0,sprite7w,SPR_H)
//dcgrPixMap(i + offset,0,SPR_W,SPR_H,@sprite)
//dcgrRleMap(i + offset,0,SPR_W,SPR_H,@rlesprt)
dcgrRleMap(i + offset,0,SPR_W,SPR_H,rlesprptr)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(0,i*SPR_H,sprite7w,SPR_H,sprite7[i],sprite7span)
next
end
def dcgrCompMask(offset)#0
byte i
for i = 0 to 6
sprite7msk[i],sprite7span = dhgrAllocBl7Mem(SPR_W + offset,SPR_H)
sprite7w = sprite7span >> 2
dhgrSurfMem(OP_SRC,SPR_H,sprite7msk[i],sprite7span)
dcgrColor(CLR_WHITE)
dhgrClearBl7(0,0,sprite7w,SPR_H)
//dcgrPixMap(i + offset,0,SPR_W,SPR_H,@sprite)
dcgrRleMap(i + offset,0,SPR_W,SPR_H,@rlesprt)
dhgrOp(OP_XOR)
//dcgrPixMap(i + offset,0,SPR_W,SPR_H,@sprite)
dcgrRleMap(i + offset,0,SPR_W,SPR_H,@rlesprt)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(sprite7w,i * SPR_H,sprite7w,SPR_H,sprite7msk[i],sprite7span)
next
end
def readEnterprise#0
var xorg,yorg,width,height,pixptr,t_ptr,f_ptr
byte i
t_ptr = @ncc1701
f_ptr = @sprFile
for i = 0 to 7
xorg,yorg,width,height,pixptr = spriteRead(f_ptr)
t_ptr=>spr_xorg = xorg
t_ptr=>spr_yorg = yorg
t_ptr=>spr_width = width
t_ptr=>spr_height = height
t_ptr=>spr_pixmap = pixptr
t_ptr=>spr_bl7 = heapalloc(ENT_SZ)
dhgrSurfMem(OP_SRC,ENT_H,t_ptr=>spr_bl7,ENT_W7*4)
dcgrColor(CLR_BLACK)
dhgrClearBl7(0,0,ENT_W7,ENT_H)
dcgrPixmap(ENT_W7*7/2 - xorg,ENT_H/2 - yorg,width,height,pixptr)
t_ptr = t_ptr + t_sprite
f_ptr = f_ptr + 12
next
end
//////////////////////////////////////////
// //
// Test Harness //
// //
//////////////////////////////////////////
def dhgrTest#0
word i
//
// Double Hires Lines
//
dhgrSurfScr(OP_OR)
setlineplot(@dhgrSet)
for i = 559 downto 0 step 20
line(0,0,i,191)
next
getc
end
def dcgrTest#0
word i,j,k,oi,oj,i7,im7,k7,km7,s7w,inci,incj,inck
word backblk,backspan
word restrblk,restrspan,restr7w,restrw
byte mode
byte[40] tilestr
//
// Use back buffer for tile set buffer
//
backblk,backspan = dhgrAllocBl7Mem(SCR_WIDTH,SPR_H)
j = 0
while ^$C000 < 128
//
// Convert compiled sprite into tile set
//
dhgrMemBl7Tile(0,0,sprite7[j],sprite7span,backblk)
dhgrMemBl7Tile(1,0,sprite7[j],sprite7span,backblk + 32)
dhgrMemBl7Tile(2,0,sprite7[j],sprite7span,backblk + 64)
dhgrMemBl7Tile(3,0,sprite7[j],sprite7span,backblk + 96)
dhgrMemBl7Tile(0,8,sprite7[j],sprite7span,backblk + 128)
dhgrMemBl7Tile(1,8,sprite7[j],sprite7span,backblk + 160)
dhgrMemBl7Tile(2,8,sprite7[j],sprite7span,backblk + 192)
dhgrMemBl7Tile(3,8,sprite7[j],sprite7span,backblk + 224)
//
// Fill screen wil tiles matching compiled sprite
//
for i = 0 to 19
tilestr[i] = i & $03
next
for i = 0 to 19
tilestr[i + 20] = (i & $03) + 4
next
dhgrSurfScr(OP_SRC)
for i = 0 to 12 step 2
dhgrTiles(10,i, @tilestr, 10,backblk)
dhgrTiles(10,i + 1,@tilestr + 20,10,backblk)
next
j++
if j == 7; j = 0; fin
loop
getc
//
// Lines
//
dhgrSurfScr(OP_SRC)
setlineplot(@dcgrPixel)
setlinespans(@dcgrHLin,@dcgrVLin)
for i = 0 to 191 step 2
dcgrColor(i)
linespans(0,0,139,i)
next
for i = 139 downto 0 step 2
dcgrColor(i)
linespans(0,0,i,191)
next
dcgrColor(CLR_BLACK)
dhgrClearBl7(21/7,30,100/7,132)
dcgrColor(CLR_WHITE)
dcgrHLin((21/7)*7-1,(21/7)*7+(100/7)*7,29)
dcgrHLin((21/7)*7-1,(21/7)*7+(100/7)*7,29+133)
dcgrVLin(29,29+133,(21/7)*7-1)
dcgrVLin(29,29+133,(21/7)*7+(100/7)*7)
dcgrColor(CLR_BLACK) // Outline color
dcgrBoldStr(CLR_WHITE,48,14,"Hello!")
dcgrFont(FONT_DEF_THIN)
dcgrColor(CLR_WHITE) // Outline color
dcgrBoldStr(CLR_BLACK,42,24,"from DCGRTEST")
i = 64; j = 64; k = 86
k7 = k/7
inci = 1; incj = 1; inck = 2
dhgrSurfMem(OP_SRC,SPR_H,backblk,backspan)
dhgrScrBl7(0,SLIDE_Y,backspan >> 2,SPR_H)
dhgrSurfScr(OP_SRC)
dcgrColor(CLR_WHITE)
dcgrHLin(0,139,SLIDE_Y)
dcgrHLin(0,139,SLIDE_Y+SPR_H-1)
dcgrVLin(SLIDE_Y,SLIDE_Y+SPR_H-1,0)
dcgrVLin(SLIDE_Y,SLIDE_Y+SPR_H-1,139)
getc
dhgrMemBl7(0,SLIDE_Y,backspan >> 2,SPR_H,backblk,backspan)
restrblk,restrspan = dhgrAllocBl7Mem(SPR_W,SPR_H)
restr7w = restrspan >> 2
restrw = restr7w * 7
mode = 1
while mode
if ^$C000 >= 128
mode = (^$C010 & $7F) - '0'
fin
k7,km7 = divmod(k,7)
i7,im7 = divmod(i,7)
if i7 + sprite7w < (21/7)+(100/7)
s7w = sprite7w
else
s7w = (21/7)+(100/7) - i7
fin
when mode
is 1
dhgrSurfScr(OP_SRC)
dhgrMemBl7(i7,j,s7w,SPR_H,sprite7[im7],sprite7span)
is 2
if k < 0 and km7 // Handle off left edge special case
k7--
km7 = 7 + km7
fin
dhgrSurfMem(OP_SRC,SPR_H,restrblk,restrspan)
dhgrMemBl7(0,0,restr7w,SPR_H,backblk + (k7 << 1),backspan)
dhgrOp(OP_AND)
dhgrMemBl7(0,0,sprite7w,SPR_H,sprite7msk[km7],sprite7span)
dhgrOp(OP_XOR)
dhgrMemBl7(0,0,sprite7w,SPR_H,sprite7[km7],sprite7span)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(k7,SLIDE_Y,restr7w,SPR_H,restrblk,restrspan)
break
is 3
dhgrSurfScr(OP_SRC)
dcgrPixMap(i,j,SPR_W,SPR_H,@sprite)
is 4
dhgrSurfMem(OP_SRC,SPR_H,restrblk,restrspan)
dhgrMemBl7(0,0,restr7w,SPR_H,backblk + (k7 << 1),backspan)
dcgrPixMap(km7 + 2,0,SPR_W,SPR_H,@sprite)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(k7,SLIDE_Y,restr7w,SPR_H,restrblk,restrspan)
break
is 5
dhgrSurfScr(OP_SRC)
dcgrPixMap(i,j,SPR_W,SPR_H,@sprite)
is 6
dhgrSurfMem(OP_SRC,SPR_H,restrblk,restrspan)
dhgrMemBl7(0,0,restr7w,SPR_H,backblk + (k7 << 1),backspan)
dcgrColor(CLR_BLACK)
dcgrRect(km7 + 2,3,16 + 2,10)
dcgrColor(CLR_WHITE)
dcgrStr(km7 + 3,13,"DCGR")
dhgrSurfScr(OP_SRC)
dhgrMemBl7(k7,SLIDE_Y,restr7w,SPR_H,restrblk,restrspan)
break
is 7
dhgrSurfScr(OP_SRC)
dhgrMemBl7(i7,j,s7w,SPR_H,sprite7[im7],sprite7span)
break
is 8
dhgrSurfScr(OP_SRC)
dcgrPixMap(i,j,SPR_W,SPR_H,@sprite)
break
is 9
dhgrSurfScr(OP_XOR)
dcgrPixMap(i,j,SPR_W,SPR_H,@sprite)
dcgrPixMap(oi,oj,SPR_W,SPR_H,@sprite)
break
wend
if k > 136 or k < -16; inck = -inck; fin
k = k + inck
oi = i; oj = j
if i > 102 or i < 22; inci = -inci; fin
i = i + inci
if j > 145 or j < 32; incj = -incj; fin
j = j + incj
loop
//
// Rotate Enterprise
//
dhgrSurfScr(OP_SRC)
dcgrColor(CLR_BLACK)
dhgrClearBl7(21/7,30,100/7,132)
dhgrOp(OP_XOR)
k = 0
i = @ncc1701
oi = 73-i=>spr_xorg
oj = 96-i=>spr_yorg
dcgrPixMap(oi,oj,i=>spr_width,i=>spr_height,i=>spr_pixmap)
while ^$C000 < 128
dcgrPixMap(oi,oj,i=>spr_width,i=>spr_height,i=>spr_pixmap)
i = i + t_sprite
k++
if k > 7
k = 0
i = @ncc1701
fin
oi = 73-i=>spr_xorg
oj = 96-i=>spr_yorg
dcgrPixMap(oi,oj,i=>spr_width,i=>spr_height,i=>spr_pixmap)
loop
getc
dhgrOp(OP_SRC)
while ^$C000 < 128
dcgrColor(CLR_BLACK)
dhgrClearBl7(60/7,75,5,43)
oi = 73-i=>spr_xorg
oj = 96-i=>spr_yorg
dcgrPixMap(oi,oj,i=>spr_width,i=>spr_height,i=>spr_pixmap)
i = i + t_sprite
k++
if k > 7
k = 0
i = @ncc1701
fin
loop
getc
while ^$C000 < 128
dhgrMemBl7(60/7,75,ENT_W7,ENT_H,i=>spr_bl7,ENT_W7*4)
i = i + t_sprite
k++
if k > 7
k = 0
i = @ncc1701
fin
loop
getc
//
// Re-use the back buffer for a stipple pattern to mask the screen
//
for k = 0 to 2
dhgrSurfMem(OP_SRC,SPR_H,backblk,backspan)
dcgrColor(CLR_WHITE)
dhgrClearBl7(0,0,SCR_WIDTH7,SPR_H)
dcgrColor(CLR_BLACK)
for i = 0 to 139 step 16
dcgrBitMap(i,0,16,16,dither[k])
next
dhgrSurfScr(OP_AND)
for j = 0 to 95 step 16
dhgrMemBl7(0,j,SCR_WIDTH7,16,backblk,backspan)
dhgrMemBl7(0,175 - j,SCR_WIDTH7,16,backblk,backspan)
next
next
dhgrSurfScr(OP_SRC)
dhgrClearBl7(0,0,SCR_WIDTH7,SCR_HEIGHT)
//
// Create color patterns
//
for i = 0 to 15
dcgrColor(i)
dhgrClearBl7(i,0,1,SCR_HEIGHT)
next
oj = 0
for j = 0 to 191 step 12
dcgrColor(oj)
oi = 0
for i = 0 to 111 step 14
dcgrBitMap(i,j,14,12,@dither25)
oi++
next
oj++
next
getc
for i = 0 to 15
dcgrColor(i)
dhgrClearBl7(i,0,1,SCR_HEIGHT)
next
oj = 0
for j = 0 to 191 step 12
dcgrColor(oj)
oi = 0
for i = 0 to 111 step 14
dcgrBitMap(i,j,14,12,@dither50)
oi++
next
oj++
next
getc
for i = 0 to 15
dcgrColor(i)
dhgrClearBl7(i,0,1,SCR_HEIGHT)
next
oj = 0
for j = 0 to 191 step 12
dcgrColor(oj)
oi = 0
for i = 0 to 111 step 14
dcgrBitMap(i,j,14,12,@dither75)
oi++
next
oj++
next
getc
end
rlesprptr = heapmark
heapalloc(dcgrEncPixMap(SPR_W,SPR_H,@sprite,rlesprptr))
dhgrMode(DHGR_COLOR_MODE)
dhgrTest
screenRead("splash.dhgr")
dhgrOp(OP_SRC)
dcgrPixMap(10,10,20,20,dcgrGetPixMap(60,66,20,20))
getc
readEnterprise
dcgrCompSprite(2)
dcgrCompMask(2)
dcgrTest
dhgrMode(DHGR_TEXT_MODE)
done

View File

@@ -0,0 +1,36 @@
include "inc/cmdsys.plh"
include "inc/lines.plh"
include "inc/args.plh"
include "inc/fileio.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags resxtxt1|reshgr1|resxhgr1
var arg
var xPen = 60
var yPen = 30
var fontWidth, fontHeight
char hello = "Hello, world"
var msg = @hello
arg = argNext(argFirst)
dhgrMode(DHGR_COLOR_MODE)
screenRead("scroll.dhgr")
while arg and ^arg
if ^(arg + 1) == '-'
msg = arg + 1
^msg = ^arg - 1
else
dcgrFont(fontRead(arg))
fontWidth, fontHeight = fontGlyphDim('a')
fontHeight++
dcgrColor(CLR_BLACK)
dcgrStr(xPen, yPen + (fontHeight * 7) / 8, msg)
yPen = yPen + fontHeight
fin
arg = argNext(arg)
loop
getc
dhgrMode(DHGR_TEXT_MODE)
done

View File

@@ -0,0 +1,189 @@
/*
* Apple 2 font converter
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include <stdbit.h>
#include <stdint.h>
#include <ctype.h>
#define FONT_WIDTH 32
#define FONT_HEIGHT 12
#define GLYPH_FIRST 32
#define GLYPH_LAST 127
#define GLYPH_COUNT (GLYPH_LAST-GLYPH_FIRST+1)
#define FONT_BITMAP 0
#define FONT_PIXMAP 1
int fontFormat = FONT_BITMAP;
//
// Apple //e hires character font
//
uint8_t Apple2Glyphs[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x08,0x00,
0x14,0x14,0x14,0x00,0x00,0x00,0x00,0x00,0x14,0x14,0x3E,0x14,0x3E,0x14,0x14,0x00,
0x08,0x3C,0x0A,0x1C,0x28,0x1E,0x08,0x00,0x06,0x26,0x10,0x08,0x04,0x32,0x30,0x00,
0x04,0x0A,0x0A,0x04,0x2A,0x12,0x2C,0x00,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,
0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00,0x08,0x10,0x20,0x20,0x20,0x10,0x08,0x00,
0x08,0x2A,0x1C,0x08,0x1C,0x2A,0x08,0x00,0x00,0x08,0x08,0x3E,0x08,0x08,0x00,0x00,
0x00,0x00,0x00,0x00,0x08,0x08,0x04,0x00,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00,
0x1C,0x22,0x32,0x2A,0x26,0x22,0x1C,0x00,0x08,0x0C,0x08,0x08,0x08,0x08,0x1C,0x00,
0x1C,0x22,0x20,0x18,0x04,0x02,0x3E,0x00,0x3E,0x20,0x10,0x18,0x20,0x22,0x1C,0x00,
0x10,0x18,0x14,0x12,0x3E,0x10,0x10,0x00,0x3E,0x02,0x1E,0x20,0x20,0x22,0x1C,0x00,
0x38,0x04,0x02,0x1E,0x22,0x22,0x1C,0x00,0x3E,0x20,0x10,0x08,0x04,0x04,0x04,0x00,
0x1C,0x22,0x22,0x1C,0x22,0x22,0x1C,0x00,0x1C,0x22,0x22,0x3C,0x20,0x10,0x0E,0x00,
0x00,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x08,0x04,0x00,
0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x00,0x00,0x00,0x3E,0x00,0x3E,0x00,0x00,0x00,
0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x00,0x1C,0x22,0x10,0x08,0x08,0x00,0x08,0x00,
0x1C,0x22,0x2A,0x3A,0x1A,0x02,0x3C,0x00,0x08,0x14,0x22,0x22,0x3E,0x22,0x22,0x00,
0x1E,0x22,0x22,0x1E,0x22,0x22,0x1E,0x00,0x1C,0x22,0x02,0x02,0x02,0x22,0x1C,0x00,
0x1E,0x22,0x22,0x22,0x22,0x22,0x1E,0x00,0x3E,0x02,0x02,0x1E,0x02,0x02,0x3E,0x00,
0x3E,0x02,0x02,0x1E,0x02,0x02,0x02,0x00,0x3C,0x02,0x02,0x02,0x32,0x22,0x3C,0x00,
0x22,0x22,0x22,0x3E,0x22,0x22,0x22,0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,
0x20,0x20,0x20,0x20,0x20,0x22,0x1C,0x00,0x22,0x12,0x0A,0x06,0x0A,0x12,0x22,0x00,
0x02,0x02,0x02,0x02,0x02,0x02,0x3E,0x00,0x22,0x36,0x2A,0x2A,0x22,0x22,0x22,0x00,
0x22,0x22,0x26,0x2A,0x32,0x22,0x22,0x00,0x1C,0x22,0x22,0x22,0x22,0x22,0x1C,0x00,
0x1E,0x22,0x22,0x1E,0x02,0x02,0x02,0x00,0x1C,0x22,0x22,0x22,0x2A,0x12,0x2C,0x00,
0x1E,0x22,0x22,0x1E,0x0A,0x12,0x22,0x00,0x1C,0x22,0x02,0x1C,0x20,0x22,0x1C,0x00,
0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x22,0x22,0x22,0x22,0x22,0x22,0x1C,0x00,
0x22,0x22,0x22,0x22,0x22,0x14,0x08,0x00,0x22,0x22,0x22,0x2A,0x2A,0x36,0x22,0x00,
0x22,0x22,0x14,0x08,0x14,0x22,0x22,0x00,0x22,0x22,0x14,0x08,0x08,0x08,0x08,0x00,
0x3E,0x20,0x10,0x08,0x04,0x02,0x3E,0x00,0x3E,0x06,0x06,0x06,0x06,0x06,0x3E,0x00,
0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00,0x3E,0x30,0x30,0x30,0x30,0x30,0x3E,0x00,
0x00,0x00,0x08,0x14,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,
0x04,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x20,0x3C,0x22,0x3C,0x00,
0x02,0x02,0x1E,0x22,0x22,0x22,0x1E,0x00,0x00,0x00,0x3C,0x02,0x02,0x02,0x3C,0x00,
0x20,0x20,0x3C,0x22,0x22,0x22,0x3C,0x00,0x00,0x00,0x1C,0x22,0x3E,0x02,0x3C,0x00,
0x18,0x24,0x04,0x1E,0x04,0x04,0x04,0x00,0x00,0x00,0x1C,0x22,0x22,0x3C,0x20,0x1C,
0x02,0x02,0x1E,0x22,0x22,0x22,0x22,0x00,0x08,0x00,0x0C,0x08,0x08,0x08,0x1C,0x00,
0x10,0x00,0x18,0x10,0x10,0x10,0x12,0x0C,0x02,0x02,0x22,0x12,0x0E,0x12,0x22,0x00,
0x0C,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00,0x00,0x36,0x2A,0x2A,0x22,0x22,0x00,
0x00,0x00,0x1E,0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x1C,0x22,0x22,0x22,0x1C,0x00,
0x00,0x00,0x1E,0x22,0x22,0x1E,0x02,0x02,0x00,0x00,0x3C,0x22,0x22,0x3C,0x20,0x20,
0x00,0x00,0x3A,0x06,0x02,0x02,0x02,0x00,0x00,0x00,0x3C,0x02,0x1C,0x20,0x1E,0x00,
0x04,0x04,0x1E,0x04,0x04,0x24,0x18,0x00,0x00,0x00,0x22,0x22,0x22,0x32,0x2C,0x00,
0x00,0x00,0x22,0x22,0x22,0x14,0x08,0x00,0x00,0x00,0x22,0x22,0x2A,0x2A,0x36,0x00,
0x00,0x00,0x22,0x14,0x08,0x14,0x22,0x00,0x00,0x00,0x22,0x22,0x22,0x3C,0x20,0x1C,
0x00,0x00,0x3E,0x10,0x08,0x04,0x3E,0x00,0x38,0x0C,0x0C,0x06,0x0C,0x0C,0x38,0x00,
0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0E,0x18,0x18,0x30,0x18,0x18,0x0E,0x00,
0x00,0x2C,0x1A,0x00,0x00,0x00,0x00,0x00,0x00,0x2A,0x14,0x2A,0x14,0x2A,0x00,0x00,
};
void write_glyph(FILE *fp, int c)
{
uint8_t glyphdef[5], *glyphBits;
uint8_t strike[9];
int i, left, top, width, height, rowOR;
glyphBits = (uint8_t *)Apple2Glyphs + (c - GLYPH_FIRST) * 8;
height = 8;
width = 4;
left = 0;
top = 7;
rowOR = 0;
for (i = 0; i < 8; i++)
{
strike[i] = ((*glyphBits ) & 0x02)
| ((*glyphBits | *glyphBits >> 1 | *glyphBits >> 2) & 0x04)
| (( *glyphBits >> 2) & 0x08);
glyphBits++;
rowOR |= strike[i];
}
if ((rowOR & 0x08) == 0)
width--;
if ((rowOR & 0x02) == 0)
{
for (i = 0; i < 8; i++)
strike[i] >>= 1;
width--;
}
for (i = 7; i >= 0; i--)
{
if (strike[i] == 0)
{
height--;
if (i < top)
top--;
}
else
break;
}
while ((height > 0) && (strike[0] == 0))
{
height--;
top--;
for (i = 0; i < height; i++)
strike[i] = strike[i + 1];
}
if (height <= 0)
height = 1;
if (top <= 0)
top = 1;
glyphdef[0] = left;
glyphdef[1] = -top;
glyphdef[2] = width;
glyphdef[3] = height;
glyphdef[4] = width + left;
fwrite(glyphdef, 1, 5, fp);
fwrite(strike, 1, height, fp);
}
void write_font_file(char *filename, char *fontname)
{
FILE *fp;
unsigned char ch;
char font_header[16];
int glyph_width, glyph_height, c;
if ((fp = fopen(filename, "wb")))
{
memset(font_header, 0, 16);
strncpy(&font_header[1], fontname, 15);
ch = strlen(fontname);
font_header[0] = (ch < 16 ? ch : 15) | 0x80; // FONT_PROP
fwrite(font_header, 1, 16, fp);
glyph_width = 4;
glyph_height = 8;
ch = GLYPH_FIRST;
fwrite(&ch, 1, 1, fp);
ch = GLYPH_LAST;
fwrite(&ch, 1, 1, fp);
ch = fontFormat == glyph_width;
fwrite(&ch, 1, 1, fp);
ch = glyph_height;
fwrite(&ch, 1, 1, fp);
for (c = GLYPH_FIRST; c <= GLYPH_LAST; c++)
write_glyph(fp, c);
fclose(fp);
}
}
void die(char *str)
{
fprintf(stderr,"error: %s\n", str);
exit(-1);
}
int main(int argc, char **argv)
{
char *font_file;
int i;
font_file = NULL;
while (*++argv)
{
if (argv[0][0] == '-')
{
}
else
{
if (!font_file)
font_file = *argv;
else
fprintf(stderr, "? %s\n", *argv);
}
}
if (!font_file)
die( "Missing font file");
write_font_file(font_file, "Apple2");
return 0;
}

View File

@@ -0,0 +1,272 @@
/*
* GS font converter
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include <stdbit.h>
#include <stdint.h>
#define FONT_WIDTH 32
#define FONT_HEIGHT 12
#define GLYPH_FIRST 32
#define GLYPH_LAST 127
#define GLYPH_COUNT (GLYPH_LAST-GLYPH_FIRST+1)
struct macfont {
uint16_t fontType;
uint16_t firstChar;
uint16_t lastChar;
uint16_t widMax;
uint16_t kernMax;
uint16_t nDescent;
uint16_t rectWidth;
uint16_t rectHeight;
uint16_t owTLoc;
uint16_t ascent;
uint16_t descent;
uint16_t leading;
uint16_t rowWords;
uint16_t bitImage; // [rowWords * rectHeight] (fonstStrike)
//uint16_t rlocTable; // lastChar - firstChar + 3 : pixel offset of glyph in bitImage
//uint16_t owTable; lastChar - firstChar + 3 : offset/width table
};
struct gsfont *gsf;
struct macfont *macf;
int16_t *locTable;
uint16_t *owTable;
/*
* Bit reversals
*/
unsigned char bitReverse[256];
unsigned char clrSwap[256];
unsigned char clrRot[] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,
0x01,0x03,0x05,0x07,0x09,0x0B,0x0D,0x0F};
void write_glyph(FILE *fp, int c)
{
uint8_t glyphdef[5], *swapbuf, *glyphBits;
uint32_t rowbits;
int pixOffset, pixWidth, byteWidth, byteOffset, bitShift, bitWidth, glyphSpan, i;
int left, top, width, height;
if (c < macf->firstChar || c > macf->lastChar)
{
memset(glyphdef, 0, 5);
fwrite(&glyphdef, 1, 5, fp);
return;
}
c -= macf->firstChar;
glyphBits = (uint8_t *)&(macf->bitImage),
glyphSpan = macf->rowWords * 2;
height = macf->rectHeight;
width = owTable[c] & 0xFF;
left = owTable[c] >> 8;
top = macf->ascent;
glyphdef[0] = left;
glyphdef[1] = -top;
#if PIXFONT
glyphdef[2] = (width + 3) / 4;
#else
glyphdef[2] = width;
#endif
glyphdef[3] = height;
glyphdef[4] = width + left;
fwrite(&glyphdef, 1, 5, fp);
pixOffset = locTable[c];
pixWidth = locTable[c+1] - locTable[c];
byteOffset = pixOffset / 8;
bitShift = pixOffset & 7;
bitWidth = bitShift + pixWidth;
byteWidth = (width + 7) / 8;
rowbits = 0;
while (height--)
{
if (pixWidth > 0)
{
rowbits = bitReverse[glyphBits[byteOffset]];
if (bitWidth > 8)
{
rowbits |= bitReverse[glyphBits[byteOffset + 1]] << 8;
if (bitWidth > 16)
{
rowbits |= bitReverse[glyphBits[byteOffset + 2]] << 16;
if (bitWidth > 24)
rowbits |= bitReverse[glyphBits[byteOffset + 3]] << 24;
}
}
rowbits >>= bitShift;
rowbits &= 0xFFFFFFFF >> (32 - pixWidth);
}
#if PIXFONT
glyphdef[0] = clrSwap[rowbits & 0xFF];
glyphdef[1] = clrSwap[(rowbits >> 8) & 0xFF];
glyphdef[2] = clrSwap[(rowbits >> 16) & 0xFF];
glyphdef[3] = clrSwap[(rowbits >> 24) & 0xFF];
#else
glyphdef[0] = rowbits;
glyphdef[1] = rowbits >> 8;
glyphdef[2] = rowbits >> 16;
glyphdef[3] = rowbits >> 24;
#endif
fwrite(&glyphdef, 1, byteWidth, fp);
glyphBits += glyphSpan;
}
}
void write_font_file(char *filename, char *fontfile)
{
FILE *fp;
unsigned char ch;
char *fontname, *scanname, font_header[16];
int glyph_width, glyph_height, c;
if ((fp = fopen(filename, "wb")))
{
fontname = scanname = fontfile;
while (*scanname) // Strip leading directory names
{
if (*scanname == '/')
fontname = scanname + 1;
scanname++;
}
while (scanname > fontfile)
{
if (*scanname == '.')
{
*scanname = '\0';
}
scanname--;
}
memset(font_header, 0, 16);
strncpy(&font_header[1], fontname, 15);
ch = strlen(fontname);
font_header[0] = ch < 16 ? ch : 15;
#if PIXFONT
font_header[0] |= 0x80 | 0x40; // FONT_PROP | FONT_PIXMAP
#else
font_header[0] |= 0x80; // FONT_PROP
#endif
fwrite(font_header, 1, 16, fp);
glyph_width = macf->rectWidth;
glyph_height = macf->rectHeight;
ch = GLYPH_FIRST;
fwrite(&ch, 1, 1, fp);
ch = GLYPH_LAST;
fwrite(&ch, 1, 1, fp);
#if PIXFONT
ch = (glyph_width + 3) / 4;
#else
ch = glyph_width;
#endif
fwrite(&ch, 1, 1, fp);
ch = glyph_height;
fwrite(&ch, 1, 1, fp);
for (c = GLYPH_FIRST; c <= GLYPH_LAST; c++)
write_glyph(fp, c);
fclose(fp);
}
}
void die(char *str)
{
fprintf(stderr,"error: %s\n", str);
exit(-1);
}
void dispGlyph(uint8_t *glyphBits, int glyphSpan, int width, int height)
{
uint32_t rowbits;
int byteOffset, bitShift, bitWidth, i;
while (height--)
{
rowbits = glyphBits[0];
if (width > 8)
{
rowbits |= glyphBits[1] << 8;
if (width > 16)
{
rowbits |= glyphBits[2] << 16;
if (width > 24)
rowbits |= glyphBits[3] << 24;
}
}
for (i = 0; i < width; i++)
{
putchar(rowbits & 1 ? '*' : ' ');
rowbits >>= 1;
}
puts("");
glyphBits += glyphSpan;
}
}
void load_dazzledraw_file(char *filename)
{
FILE *fp;
uint8_t *fontdef;
int fontdefsize, c, i, s;
char msg[] = "Hello, world";
if ((fp = fopen(filename, "rb")))
{
fontdef = malloc(65536);
fontdefsize = fread(fontdef, 1, 65536, fp);
fclose(fp);
}
else
die("Unable to open DazzleDraw font file");
locTable = (int16_t *)fontdef;
for (c = 32; c < 127; c++)
{
i = locTable[c] - 0x1000 + 0x100;
printf("%c[%3d]: $%04X - $%04X (%d)\n", c, c, i, locTable[c + 1] - 1, locTable[c + 1] - locTable[c]);
printf("\t$%02X, %d, %d [%d]\n", fontdef[i], fontdef[i + 1], fontdef[i + 2], (fontdef[i] & 0x0F) * fontdef[i + 1] + 3);
dispGlyph(fontdef + i + 4, fontdef[i + 1], fontdef[i + 2], fontdef[i] & 0x0F);
}
}
int main(int argc, char **argv)
{
char *dd_file, *font_file;
int glyph_width, glyph_height;
int i;
font_file = NULL;
if (argc > 1)
{
dd_file = argv[1];
if (argc > 2)
font_file = argv[2];
if (argc > 3)
glyph_width = atoi(argv[3]);
else
glyph_width = FONT_WIDTH;
if (argc > 4)
glyph_height = atoi(argv[4]);
else
glyph_height = FONT_HEIGHT;
}
else
die( "Missing font file");
/*
* Bit/color reversal
*/
for (i = 0; i < 256; i++)
{
bitReverse[i] = ((i & 0x01) << 7)
| ((i & 0x02) << 5)
| ((i & 0x04) << 3)
| ((i & 0x08) << 1)
| ((i & 0x10) >> 1)
| ((i & 0x20) >> 3)
| ((i & 0x40) >> 5)
| ((i & 0x80) >> 7);
clrSwap[i] = clrRot[i & 0x0F]
| (clrRot[i >> 4] << 4);
}
/*
* Load IIGS font file header.
*/
load_dazzledraw_file(dd_file);
//write_font_file(font_file, "DazzleDraw");
return 0;
}

View File

@@ -0,0 +1,148 @@
include "inc/cmdsys.plh"
include "inc/args.plh"
include "inc/fileio.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags restxt1|resxtxt1|reshgr1|resxhgr1 // Reserve all the pages
const PAUSE = 1
const HEIGHT_X2 = 2
char[64] greasyfile = ""
byte[40*96/2] frame
byte flags
byte frameHeight = 40
var arg
def greasy2dcgr(pGreasy)#0
byte i, j, cl, ch
var pPixmap
pPixmap = @frame
for j = 0 to frameHeight-1 step 2
for i = 0 to 39 step 2
cl = ^(pGreasy + i)
ch = ^(pGreasy + i + 1)
^(pPixmap + i / 2) = (cl & $0F) | (ch << 4)
if flags & HEIGHT_X2
^(pPixmap + i / 2 + 20) = (cl & $0F) | (ch << 4)
^(pPixmap + i / 2 + 40) = (cl >> 4) | (ch & $F0)
^(pPixmap + i / 2 + 60) = (cl >> 4) | (ch & $F0)
else
^(pPixmap + i / 2 + 20) = (cl >> 4) | (ch & $F0)
fin
next
if flags & HEIGHT_X2
pPixmap = pPixmap + 80
else
pPixmap = pPixmap + 40
fin
pGreasy = pGreasy + 40
next
end
def greasyRead(filestr, frame)#1
var sprptr, sprsize
byte refnum, numframes
sprptr = 0
refnum = fileio:open(filestr)
if refnum
sprsize = 40 * frameHeight / 2
sprptr = heapalloc(sprsize)
if sprptr and fileio:read(refnum, @numframes, 1)
if numframes < frame
heaprelease(sprptr)
sprptr = NULL
fin
fin
if sprptr
if fileio:setmark(refnum, (frame - 1) * sprsize + 1, 0)
heaprelease(sprptr)
sprptr = NULL
elsif fileio:read(refnum, sprptr, sprsize) <> sprsize
heaprelease(sprptr)
sprptr = NULL
fin
fin
fileio:close(refnum)
fin
return sprptr
end
def importGreasy#0
var grptr
byte screennum, framenum, i, j, numrows
char[64] screenfile
screennum = 1
framenum = 1
dhgrMode(DHGR_COLOR_MODE)
numrows = 192 / frameHeight
if flags & HEIGHT_X2
numrows = numrows / 2
fin
numrows--
while framenum
dcgrColor(CLR_GREY1)
dhgrClearBl7(0, 0, SCR_WIDTH7, SCR_HEIGHT)
for j = 0 to numrows
for i = 0 to 2
grptr = greasyRead(@greasyfile, framenum)
if grptr
greasy2dcgr(grptr)
heaprelease(grptr)
if flags & HEIGHT_X2
dcgrPixMap(i*42+8, j*(frameHeight+1)*2+2, 40, frameHeight*2, @frame)
else
dcgrPixMap(i*42+8, j*(frameHeight+2)+2, 40, frameHeight, @frame)
fin
framenum++
else
framenum = 0
break
fin
next
if framenum == 0; break; fin
next
strcpy(@screenfile, @greasyfile)
strcat(@screenfile, ".SCR")
screenfile++
screenfile[screenfile] = '0' + screennum
screennum++
if screenWrite(@screenfile)
dhgrMode(DHGR_TEXT_MODE)
puts("Error writing: "); puts(@screenfile); putln
return
fin
if flags & PAUSE; getc; fin
loop
dhgrMode(DHGR_TEXT_MODE)
end
arg = argNext(argFirst)
if ^arg
while arg and ^(arg + 1) == '-'
when toupper(^(arg + 2))
is 'P'
flags = flags | PAUSE
break
is '2'
flags = flags | HEIGHT_X2
break
is 'T'
frameHeight = 48
break
wend
arg = argNext(arg)
loop
if ^arg
strcpy(@greasyfile, arg)
importGreasy
return 0
fin
fin
puts("Usage: DHGRGREASY [-P] [-2] [-T] FRAMEFILE\n")
done

View File

@@ -0,0 +1,843 @@
include "inc/cmdsys.plh"
include "inc/args.plh"
include "inc/fileio.plh"
include "inc/int32.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags resxtxt1|reshgr1|resxhgr1
// Bit patterns and associated default NTSC colors
// NTSC_BLACK = 0000
// NTSC_DRKBLUE = 0001 73, 14, 116
// NTSC_DRKGREEN = 0010 0, 104, 100
// NTSC_BROWN = 0100 55, 113, 11
// NTSC_MAGENTA = 1000 127, 23, 27
// NTSC_PURPLE = 1001
// NTSC_MEDBLUE = 0011
// NTSC_LTBLUE = 1011
// NTSC_AQUA = 0111
// NTSC_GREEN = 0110
// NTSC_ORANGE = 1100
// NTSC_PINK = 1101
// NTSC_YELLOW = 1110
// NTSC_WHITE = 1111
const RED = 0
const GRN = 1
const BLU = 2
// According to what I could find out about the NTSC color wheel:
// Red maxes at 103.5 degrees
// Green maxes at 240.7 degrees
// Blue maxes at 347.1 degrees
const RED_PHASE_NTSC = 104
const GREEN_PHASE_NTSC = 241
const BLUE_PHASE_NTSC = 347
// Ideal phase angles for 4 phase
const RED_PHASE_IDEAL = 90
const GREEN_PHASE_IDEAL = 270
const BLUE_PHASE_IDEAL = 360
// Equal 120 deg phase angles
const RED_PHASE_EQUAL = 120
const GREEN_PHASE_EQUAL = 240
const BLUE_PHASE_EQUAL = 360
// Simplified phase angles: 90 deg between R and B, 135 between RG and BG
const RED_PHASE_SIMPLE = 90
const GREEN_PHASE_SIMPLE = 225
const BLUE_PHASE_SIMPLE = 360
const GREY_CHROMA = 32 * 4 / 3
// Flags
const GREY_HACK = $01 // Remap GREY1->GREY2 hack
const MEM_MODE = $02 // Render to memory surface
const DUMP_STATE = $04 // Dump internal state
const RAW_INFILE = $08 // Raw 560x192 24BPP RGB values
const MATCH_PREV = $00 // Match previous RGB
const MATCH_NEXT = $10 // Match next pixel
const MATCH_CYCLE = $20 // Match current cycle
const MATCH_ONE = 8
const MATCH_ZERO = 0
byte clrRot = $00,$02,$04,$06,$08,$0A,$0C,$0E
byte = $01,$03,$05,$07,$09,$0B,$0D,$0F
var sin90[] // first 90 degrees of sin in fixed s.15 format
var = 0, 571, 1143, 1714, 2285, 2855, 3425, 3993
var = 4560, 5126, 5690, 6252, 6812, 7371, 7927, 8480
var = 9032, 9580, 10125, 10668, 11207, 11743, 12275, 12803
var = 13327, 13848, 14364, 14876, 15383, 15886, 16383, 16876
var = 17364, 17846, 18323, 18794, 19260, 19720, 20173, 20621
var = 21062, 21497, 21926, 22347, 22762, 23170, 23571, 23964
var = 24351, 24730, 25101, 25465, 25821, 26169, 26509, 26841
var = 27165, 27481, 27788, 28087, 28377, 28659, 28932, 29196
var = 29451, 29697, 29935, 30163, 30381, 30591, 30791, 30982
var = 31164, 31336, 31498, 31651, 31794, 31928, 32051, 32165
var = 32270, 32364, 32449, 32523, 32588, 32643, 32688, 32723
var = 32748, 32763, 32767
word hgrScan[] // HGR scanline order for saving memory buffer as DHGR
word = $0000,$0400,$0800,$0C00,$1000,$1400,$1800,$1C00
word = $0080,$0480,$0880,$0C80,$1080,$1480,$1880,$1C80
word = $0100,$0500,$0900,$0D00,$1100,$1500,$1900,$1D00
word = $0180,$0580,$0980,$0D80,$1180,$1580,$1980,$1D80
word = $0200,$0600,$0A00,$0E00,$1200,$1600,$1A00,$1E00
word = $0280,$0680,$0A80,$0E80,$1280,$1680,$1A80,$1E80
word = $0300,$0700,$0B00,$0F00,$1300,$1700,$1B00,$1F00
word = $0380,$0780,$0B80,$0F80,$1380,$1780,$1B80,$1F80
word = $0028,$0428,$0828,$0C28,$1028,$1428,$1828,$1C28
word = $00A8,$04A8,$08A8,$0CA8,$10A8,$14A8,$18A8,$1CA8
word = $0128,$0528,$0928,$0D28,$1128,$1528,$1928,$1D28
word = $01A8,$05A8,$09A8,$0DA8,$11A8,$15A8,$19A8,$1DA8
word = $0228,$0628,$0A28,$0E28,$1228,$1628,$1A28,$1E28
word = $02A8,$06A8,$0AA8,$0EA8,$12A8,$16A8,$1AA8,$1EA8
word = $0328,$0728,$0B28,$0F28,$1328,$1728,$1B28,$1F28
word = $03A8,$07A8,$0BA8,$0FA8,$13A8,$17A8,$1BA8,$1FA8
word = $0050,$0450,$0850,$0C50,$1050,$1450,$1850,$1C50
word = $00D0,$04D0,$08D0,$0CD0,$10D0,$14D0,$18D0,$1CD0
word = $0150,$0550,$0950,$0D50,$1150,$1550,$1950,$1D50
word = $01D0,$05D0,$09D0,$0DD0,$11D0,$15D0,$19D0,$1DD0
word = $0250,$0650,$0A50,$0E50,$1250,$1650,$1A50,$1E50
word = $02D0,$06D0,$0AD0,$0ED0,$12D0,$16D0,$1AD0,$1ED0
word = $0350,$0750,$0B50,$0F50,$1350,$1750,$1B50,$1F50
word = $03D0,$07D0,$0BD0,$0FD0,$13D0,$17D0,$1BD0,$1FD0
var surfMem, surfSpan
var rgbMatch
var[12] ntscChroma
var[12] ntscCycle
var[16] pixRed, pixGrn, pixBlu
var prevRed, prevBlu, prevGrn
byte[256] gammaRed // RED gamma correction
byte[256] gammaGrn // GREEN gamma correction
byte[256] gammaBlu // BLUE gamma correction
var[3] phase = RED_PHASE_NTSC, GREEN_PHASE_NTSC, BLUE_PHASE_NTSC
byte[3] gamut = 128, 128, 128 // Gamut
byte gamma = 1 // Gamma correction
var brightness = 0
var saturation = 255 // 1.0
var tint = 22 // = 45/2 deg
byte errDiv = 4
byte flags = GREY_HACK
var rgbErr // Running color error array
var arg
// Handy numeric functions
def min(a, b)#1
return a < b ?? a :: b
end
def max(a, b)#1
return a > b ?? a :: b
end
def sin(deg)#1
while deg > 360; deg = deg - 360; loop
while deg < 0; deg = deg + 360; loop
if deg <= 90
return sin90[deg]
elsif deg <= 180
return sin90[180 - deg]
elsif deg <= 270
return -sin90[deg - 180]
fin
return -sin90[360 - deg]
end
def cos(deg)#1
return sin(deg + 90)
end
def dist(dr, dg, db)#2 // Linear distance
res[t_i32] rr, gg
loadi16(dr)
muli16(dr)
store32(@rr)
loadi16(dg)
muli16(dg)
store32(@gg)
loadi16(db)
muli16(db)
add32(@gg)
add32(@rr)
store32(@rr)
return rr:[0], rr:[1]
end
def atoi(strptr)#1
var num, len, sign
sign = 1
num = 0
len = ^strptr
strptr++
if ^strptr == '-'
sign = -1
strptr++
len--
elsif ^strptr == '+'
strptr++
len--
fin
while len and ^strptr >= '0' and ^strptr <= '9'
num = num * 10 + ^strptr - '0'
strptr++
len--
loop
return num * sign
end
def calcChroma(angle)#0
var r, g, b
byte i
for i = 0 to 3
// Calculate RGB for this DHGR pixel
//r = max(0, (saturation + (cos(angle - phase[RED]) >> 7)))
//g = max(0, (saturation + (cos(angle - phase[GRN]) >> 7)))
//b = max(0, (saturation + (cos(angle - phase[BLU]) >> 7)))
r = saturation + (cos(angle - phase[RED]) >> 7)
g = saturation + (cos(angle - phase[GRN]) >> 7)
b = saturation + (cos(angle - phase[BLU]) >> 7)
// Make chroma add up to white
ntscChroma[i*3 + RED] = (r + 2) / 4
ntscChroma[i*3 + GRN] = (g + 2) / 4
ntscChroma[i*3 + BLU] = (b + 2) / 4
// Next NTSC chroma pixel
angle = angle - 90
next
end
def errProp(er, eg, eb, errptr)#0
// Propogate error down and forward
errptr=>[RED] = er
errptr=>[GRN] = eg
errptr=>[BLU] = eb
errptr = errptr + 6
errptr=>[RED] = er + errptr=>[RED]
errptr=>[GRN] = eg + errptr=>[GRN]
errptr=>[BLU] = eb + errptr=>[BLU]
end
def rgbMatchCycle(r, g, b, errptr, cx)#1
var pr1, pg1, pb1
var pr2, pg2, pb2
var pr3, pg3, pb3
var nr, ng, nb
var pr, pg, pb
var cr, cg, cb
var er, eg, eb
byte i, match
res[t_i32] pd, d0, nd, cd
// Previous 1/4 chroma cycle
i = ((cx - 1) & 3) * 3
pr1 = ntscCycle[i+RED]
pg1 = ntscCycle[i+GRN]
pb1 = ntscCycle[i+BLU]
// Previous 2/4 chroma cycle
i = ((cx - 2) & 3) * 3
pr2 = ntscCycle[i+RED] + pr1
pg2 = ntscCycle[i+GRN] + pg1
pb2 = ntscCycle[i+BLU] + pb1
// Previous 3/4 chroma cycle
i = ((cx - 3) & 3) * 3
pr3 = ntscCycle[i+RED] + pr2
pg3 = ntscCycle[i+GRN] + pg2
pb3 = ntscCycle[i+BLU] + pb2
// Previous chroma cycle
i = cx * 3 // ((cx - 4) & 3) * 3
pr = (pr1 + pr2 + pr3 + ntscCycle[i+RED] / 2) / 4
pg = (pg1 + pg2 + pg3 + ntscCycle[i+GRN] / 2) / 4
pb = (pb1 + pb2 + pb3 + ntscCycle[i+BLU] / 2) / 4
// Current potential chroma cycle
//i = cx * 3
cr = pr + ntscChroma[i+RED]
cg = pg + ntscChroma[i+GRN]
cb = pb + ntscChroma[i+BLU]
// Match next chroma subcycle
pd:[0], pd:[1] = dist(r - pr, g - pg, b - pb)
dist(r - cr, g - cg, b - cb)
if islt32(@pd)
// RGB better matched with next chroma color
er = r - cr
eg = g - cg
eb = b - cb
ntscCycle[i+RED] = ntscChroma[i+RED]
ntscCycle[i+GRN] = ntscChroma[i+GRN]
ntscCycle[i+BLU] = ntscChroma[i+BLU]
i = MATCH_ONE
else
// RGB closer to previous chroma color
er = r - pr
eg = g - pg
eb = b - pb
ntscCycle[i+RED] = 0
ntscCycle[i+GRN] = 0
ntscCycle[i+BLU] = 0
i = MATCH_ZERO
fin
errProp(er, eg, eb, errptr)
return i
end
def rgbMatchNext(r, g, b, errptr, cx)#1
var pr1, pg1, pb1
var pr2, pg2, pb2
var pr3, pg3, pb3
var pr, pg, pb
var cr, cg, cb
var er, eg, eb
byte i, match
res[t_i32] nd, cd
// Previous 1/4 chroma cycle
i = ((cx - 1) & 3) * 3
pr1 = ntscCycle[i+RED]
pg1 = ntscCycle[i+GRN]
pb1 = ntscCycle[i+BLU]
// Previous 2/4 chroma cycle
i = ((cx - 2) & 3) * 3
pr2 = ntscCycle[i+RED]
pg2 = ntscCycle[i+GRN]
pb2 = ntscCycle[i+BLU]
// Previous 3/4 chroma cycle
i = ((cx - 3) & 3) * 3
pr3 = ntscCycle[i+RED]
pg3 = ntscCycle[i+GRN]
pb3 = ntscCycle[i+BLU]
// Previous chroma cycle
i = cx * 3 // ((cx - 4) & 3) * 3
pr = pr1 + pr2 + pr3
pg = pg1 + pg2 + pg3
pb = pb1 + pb2 + pb3
// Current potential chroma cycle
//i = cx * 3
cr = pr + ntscChroma[i+RED]
cg = pg + ntscChroma[i+GRN]
cb = pb + ntscChroma[i+BLU]
// Match next full chroma cycle (pixel)
cd:[0], cd:[1] = $FFFF, $7FFF
for i = 0 to 15
nd:[0], nd:[1] = dist(r - pixRed[i], g - pixGrn[i], b - pixBlu[i])
if islt32(@cd)
cd:[0], cd:[1] = nd:[0], nd:[1]
match = i
fin
next
i = cx * 3
if match & (1 << cx)
// RGB better matched with next chroma color
er = r - cr
eg = g - cg
eb = b - cb
ntscCycle[i+RED] = ntscChroma[i+RED]
ntscCycle[i+GRN] = ntscChroma[i+GRN]
ntscCycle[i+BLU] = ntscChroma[i+BLU]
i = MATCH_ONE
else
// RGB closer to previous chroma color
er = r - pr
eg = g - pg
eb = b - pb
ntscCycle[i+RED] = 0
ntscCycle[i+GRN] = 0
ntscCycle[i+BLU] = 0
i = MATCH_ZERO
fin
errProp(er, eg, eb, errptr)
return i
end
def rgbMatchPrev(r, g, b, errptr, cx)#1
var cr, cg, cb
var er, eg, eb
byte i,
res[t_i32] pd
// Previous RGB minus current chroma cycle
prevRed = (prevRed * 3) / 4
prevGrn = (prevGrn * 3) / 4
prevBlu = (prevBlu * 3) / 4
// Current potential RGB
i = cx * 3
cr = prevRed + ntscChroma[i+RED]
cg = prevGrn + ntscChroma[i+GRN]
cb = prevBlu + ntscChroma[i+BLU]
// Match next chroma subcycle
pd:[0], pd:[1] = dist(r - prevRed, g - prevGrn, b - prevBlu)
dist(r - cr, g - cg, b - cb)
if islt32(@pd)
// RGB better matched with next chroma color
prevRed = cr
prevGrn = cg
prevBlu = cb
i = MATCH_ONE
else
i = MATCH_ZERO
fin
// Propogate error down and forward
er = r - prevRed
errptr=>[RED] = er
eg = g - prevGrn
errptr=>[GRN] = eg
eb = b - prevBlu
errptr=>[BLU] = eb
errptr=>[RED+3] = er + errptr=>[RED+3]
errptr=>[GRN+3] = eg + errptr=>[GRN+3]
errptr=>[BLU+3] = eb + errptr=>[BLU+3]
return i
end
def rgbInit#0
var i
res[t_i32] g32
if flags & DUMP_STATE
puts("Gamma = "); puti(sext(gamma)); putln
fin
when gamma
is 255 // (i + 1 / i^2) / 2
for i = 0 to 255
loadi16(i)
muli16(i)
addi16(127)
divi16(255)
neg32
addi16(255)
addi16(255 - i)
divi16(2)
store32(@g32)
gammaRed[255 - i] = g32
gammaGrn[255 - i] = g32
gammaBlu[255 - i] = g32
next
break
is 254 // 1 - i^2
for i = 0 to 255
loadi16(i)
muli16(i)
addi16(127)
divi16(255)
neg32
addi16(255)
store32(@g32)
gammaRed[255 - i] = g32
gammaGrn[255 - i] = g32
gammaBlu[255 - i] = g32
next
break
is 2 // 1/(i^2)
for i = 0 to 255
loadi16(i)
muli16(i)
addi16(127)
divi16(255)
store32(@g32)
gammaRed[i] = g32
gammaGrn[i] = g32
gammaBlu[i] = g32
next
break
is 1 // (i + i^2) / 2
for i = 0 to 255
loadi16(i)
muli16(i)
addi16(127)
divi16(255)
addi16(i)
divi16(2)
store32(@g32)
gammaRed[i] = g32
gammaGrn[i] = g32
gammaBlu[i] = g32
next
break
otherwise // i
for i = 0 to 255
gammaRed[i] = i
gammaGrn[i] = i
gammaBlu[i] = i
next
wend
if gamut[RED] <> 128
for i = 0 to 255
gammaRed[i] = max(0, min(255, (gammaRed[i] * 128) / gamut[RED]))
next
fin
if gamut[GRN] <> 128
for i = 0 to 255
gammaGrn[i] = max(0, min(255, (gammaGrn[i] * 128) / gamut[GRN]))
next
fin
if gamut[BLU] <> 128
for i = 0 to 255
gammaBlu[i] = max(0, min(255, (gammaBlu[i] * 128) / gamut[BLU]))
next
fin
if brightness
for i = 0 to 255
gammaRed[i] = max(0, min(255, gammaRed[i] + brightness))
gammaGrn[i] = max(0, min(255, gammaGrn[i] + brightness))
gammaBlu[i] = max(0, min(255, gammaBlu[i] + brightness))
next
fin
calcChroma(tint)
if flags & DUMP_STATE
puts("Err Div = "); puti(errDiv); putln
puts("Brightness = "); puti(brightness); putln
puts("Tint = "); puti(tint); putln
puts("Saturation = "); puti(saturation); putln
puts("Gamut = ["); puti(gamut[RED]); putc(',')
puti(gamut[GRN]); putc(','); puti(gamut[BLU]); puts("]\n")
puts("Match = ")
if flags & MATCH_NEXT; puts("Next\n")
elsif flags & MATCH_CYCLE; puts("Current\n")
else; puts("Prev\n"); fin
puts("Chroma cycle RGB =\n")
for i = 0 to 3
putc('[')
puti(ntscChroma[i*3 + RED]); putc(',')
puti(ntscChroma[i*3 + GRN]); putc(',')
puti(ntscChroma[i*3 + BLU]); puts("]\n")
next
fin
if flags & MATCH_NEXT
rgbMatch = @rgbMatchNext
// Calc pixel RGBs
for i = 0 to 15
if i & 1
pixRed[i] = ntscChroma[RED]
pixGrn[i] = ntscChroma[GRN]
pixBlu[i] = ntscChroma[BLU]
fin
if i & 2
pixRed[i] = pixRed[i] + ntscChroma[3+RED]
pixGrn[i] = pixGrn[i] + ntscChroma[3+GRN]
pixBlu[i] = pixBlu[i] + ntscChroma[3+BLU]
fin
if i & 4
pixRed[i] = pixRed[i] + ntscChroma[6+RED]
pixGrn[i] = pixGrn[i] + ntscChroma[6+GRN]
pixBlu[i] = pixBlu[i] + ntscChroma[6+BLU]
fin
if i & 8
pixRed[i] = pixRed[i] + ntscChroma[9+RED]
pixGrn[i] = pixGrn[i] + ntscChroma[9+GRN]
pixBlu[i] = pixBlu[i] + ntscChroma[9+BLU]
fin
next
// Adjust error scalng for this strategy
errDiv = errDiv * 2
elsif flags & MATCH_CYCLE
rgbMatch = @rgbMatchCycle
// Make up for scaled chroma cycle color match
for i = 0 to 11
ntscChroma[i] = (ntscChroma[i] * 3) / 2 // * 1.5
next
else // MATCH_PREV
rgbMatch = @rgbMatchPrev
fin
if flags & MEM_MODE
surfMem, surfSpan = dhgrAllocBl7Mem(SCR_WIDTH, SCR_HEIGHT)
dhgrSurfMem(OP_XOR, SCR_HEIGHT, surfMem, surfSpan)
dhgrOp(OP_SRC) // Force op recalc
dcgrColor(CLR_BLACK)
dhgrClearBl7(0, 0, surfSpan >> 2, SCR_HEIGHT)
else
dhgrMode(DHGR_COLOR_MODE)
fin
end
def rgbExit#0
heaprelease(rgbErr)
if not (flags & MEM_MODE)
dhgrMode(DHGR_TEXT_MODE)
fin
end
def pnmReadElement(refnum, bufptr)#1
var lenptr
lenptr = bufptr
repeat
^lenptr = 0
bufptr = lenptr + 1
if fileio:read(refnum, bufptr, 1) == 1 and ^bufptr == '#' // Comment
^lenptr++
bufptr++
while fileio:read(refnum, bufptr, 1) == 1 and ^bufptr >= ' '
loop
else
repeat // Read white space seperated element
^lenptr++
bufptr++
until fileio:read(refnum, bufptr, 1) <> 1 or ^bufptr <= ' ' or ^lenptr > 32
fin
until ^lenptr and ^(lenptr + 1) <> '#' // Repeat until not comment
if flags & DUMP_STATE; puts(lenptr); putc(' '); fin
return lenptr
end
def pnmVerifyHeader(refnum)#1
byte[128] buf
if flags & DUMP_STATE; puts("PNM = "); fin
pnmReadElement(refnum, @buf)
if buf[0] <> 2 and buf[1] <> 'P' and buf[2] <> '6'
puts("Invalid PNM magic #: "); putc(buf[1]); putc(buf[2]); putln
return FALSE
fin
if atoi(pnmReadElement(refnum, @buf)) <> 560
puts("Width not 560: "); puts(@buf); putln
return FALSE
fin
if atoi(pnmReadElement(refnum, @buf)) <> 192
puts("Height not 192: "); puts(@buf); putln
return FALSE
fin
if atoi(pnmReadElement(refnum, @buf)) <> 255
puts("Depth not 255: "); puts(@buf); putln
return FALSE
fin
if flags & DUMP_STATE; putln; fin
return TRUE
end
def rgbImportExport(rgbfile, dhgrfile)#0
byte refnum, chromaBits
var i, j, c, r, g, b
var rgbScanline, rgbptr, errptr
refnum = fileio:open(rgbfile)
if refnum
if not (flags & RAW_INFILE)
if not pnmVerifyHeader(refnum)
fileio:close(refnum)
return
fin
fin
rgbInit
rgbScanline = heapalloc(560 * 3)
rgbErr = heapalloc(561 * 3 * 2)
if rgbErr and rgbScanline
// Init error propogation array
memset(rgbErr, 0, 560 * 3 * 2)
memset(rgbScanline, 0, 560 * 3)
for j = 0 to 191
fileio:read(refnum, rgbScanline, 560 * 3)
memset(@ntscCycle, GREY_CHROMA, 24) // Reset chroma cycle
prevRed, prevGrn, prevBLu = 96, 96, 96 // Reset prev RGB
rgbptr = rgbScanline
errptr = rgbErr
for i = 0 to 139
chromaBits = 0
for c = 0 to 3
// Calc best match
r = gammaRed[rgbptr->[RED]]
g = gammaGrn[rgbptr->[GRN]]
b = gammaBlu[rgbptr->[BLU]]
if errDiv
r = r + errptr=>[RED] / errDiv
g = g + errptr=>[GRN] / errDiv
b = b + errptr=>[BLU] / errDiv
fin
chromaBits = (chromaBits >> 1) | rgbMatch(r, g, b, errptr, c)
rgbptr = rgbptr + 3
errptr = errptr + 3 * 2
next
if flags & GREY_HACK
// Map GREY1 -> GREY2
if chromaBits == $0A // Bits are in reverse order from DCGR color value
chromaBits = $05
memset(@ntscCycle, GREY_CHROMA, 24) // Grey chroma cycle
elsif chromaBits == $05
memset(@ntscCycle, GREY_CHROMA, 24) // Grey chroma cycle
fin
fin
dcgrColor(clrRot[chromaBits])
dcgrPixel(i, j)
next
if flags & MEM_MODE; putc('.'); fin
if ^$C000 == $83
break
fin
next
fileio:close(refnum)
if ^dhgrfile
if flags & MEM_MODE
heaprelease(rgbScanline) // Free up some memory
if MACHID & $F0 <> $B0
// Use allocated buffer on non 128K //e
rgbScanline = heapalloc($2000)
else
// Use HGR memory (already reserved) on 128K //e
rgbScanline = $2000
fin
if rgbScanline
memset(rgbScanline, 0, $2000)
fileio:destroy(dhgrfile)
fileio:create(dhgrfile, $06, $2000)
refnum = fileio:open(dhgrfile)
if refnum
// Reorder scanlines into HGR format
rgbptr = surfMem
for i = 0 to SCR_HEIGHT-1
memcpy(rgbScanline+hgrScan[i], rgbptr, 40)
rgbptr = rgbptr + surfSpan
next
// Write AUX bytes
fileio:write(refnum, rgbScanline, $2000)
rgbptr = surfMem + surfSpan / 2
for i = 0 to SCR_HEIGHT-1
memcpy(rgbScanline+hgrScan[i], rgbptr, 40)
rgbptr = rgbptr + surfSpan
next
// Write MAIN bytes
fileio:write(refnum, rgbScanline, $2000)
fileio:close(refnum)
fin
putln
fin
else
screenWrite(dhgrfile)
fin
fin
if not (flags & MEM_MODE); getc; fin
rgbExit
fin
else
puts("Unable to open "); puts(rgbfile); putln
fin
end
puts("DHGR RGB converter 1.1\n")
arg = argNext(argFirst)
if ^arg
while ^(arg + 1) == '-'
when toupper(^(arg + 2))
is 'B' // Set brightness
if ^arg > 2
^(arg + 2) = ^arg - 2
brightness = atoi(arg + 2)
fin
break
is 'C' // Disable hack for GREY remapping
flags = flags & ~GREY_HACK
break
is 'D' // Dump internal staet
flags = flags | DUMP_STATE
break
is 'E' // Set error strength
if ^arg > 2
errDiv = ^(arg + 3) - '0'
if ^arg > 3
errDiv = errDiv * 10 + ^(arg + 4) - '0'
fin
fin
break
is 'G' // Set gamma amount
if ^arg > 2
^(arg + 2) = ^arg - 2
gamma = atoi(arg + 2)
fin
break
is 'M' // Match RGB strategy
when toupper(^(arg + 3))
is 'N' // Match to next pixel
flags = flags | MATCH_NEXT
tint = tint - 22
break
is 'C' // Match to current cycle
flags = flags | MATCH_CYCLE
break
//is 'P' // Match to previous RGB
otherwise
break
wend
break
is 'P' // RGB phase angle
when toupper(^(arg + 3))
is 'I' // Use ideal 4 sub-phase angles
phase[RED] = RED_PHASE_IDEAL
phase[GRN] = GREEN_PHASE_IDEAL
phase[BLU] = BLUE_PHASE_IDEAL
break
is 'E' // Use equal 120 deg phase angles
phase[RED] = RED_PHASE_EQUAL
phase[GRN] = GREEN_PHASE_EQUAL
phase[BLU] = BLUE_PHASE_EQUAL
break
is 'S' // Use simplified 90 degree and opposite phase angles
phase[RED] = RED_PHASE_SIMPLE
phase[GRN] = GREEN_PHASE_SIMPLE
phase[BLU] = BLUE_PHASE_SIMPLE
break
//is 'N' // Use theoretical NTSC phase angles
otherwise
phase[RED] = RED_PHASE_NTSC
phase[GRN] = GREEN_PHASE_NTSC
phase[BLU] = BLUE_PHASE_NTSC
break
wend
break
is 'R' // Raw input mode - no PNM header
flags = flags | RAW_INFILE
break
is 'S' // Adjust saturation
if ^arg > 2
^(arg + 2) = ^arg - 2
saturation = saturation - atoi(arg + 2)
fin
break
is 'T' // Adjust tint
if ^arg > 2
^(arg + 2) = ^arg - 2
tint = tint + atoi(arg + 2)
fin
break
is 'U' // Adjust gamut
if ^arg > 3
when toupper(^(arg + 3))
is 'R'
^(arg + 1) = RED
break
is 'G'
^(arg + 1) = GRN
break
otherwise // B
^(arg + 1) = BLU
break
wend
^(arg + 3) = ^arg - 3
gamut[^(arg + 1)] = gamut[^(arg + 1)] - atoi(arg + 3)
fin
break
is 'V' // No video output, memory mode only (for portable VM)
flags = flags | MEM_MODE
break
otherwise
puts("? option:"); putc(^(arg + 2)); putln
wend
arg = argNext(arg)
loop
if ^arg
rgbImportExport(arg, argNext(arg))
fin
return 0
fin
puts("Usage:\n")
puts(" DHGRRGB\n")
puts(" [-B#] = Brightness: -255..255\n")
puts(" [-C] = Composite output\n")
puts(" [-D] = Dump state\n")
puts(" [-E#] = Error strength: 1..255\n")
puts(" 0 = no err\n")
puts(" [-G#] = Gamma: 2, 1, 0, -1, -2\n")
puts(" [-M<N,C,P>] = Match: Next, Current\n")
puts(" Previous\n")
puts(" [-P<I,E,S,N>] = Phase: Ideal, Equal\n")
puts(" Simple, NTSC\n")
puts(" [-R] = Raw image file, no header\n")
puts(" [-S#] = Saturation: -255..255\n")
puts(" [-T#] = Tint: -360..360 (in degrees)\n")
puts(" [-U<R,G,B>#] = gammUt: Red, Grn, Blu\n")
puts(" -255..255\n")
puts(" [-V] = no Video output, mem only\n")
puts(" IMAGEFILE [DHGRFILE]\n")
done

434
src/dhgr.tk/utils/dhgrrgb.c Normal file
View File

@@ -0,0 +1,434 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <memory.h>
#include <ctype.h>
/* CGA high resolution */
#define X_RES 560
#define Y_RES 192
/* According to what I could find out about the NTSC color wheel:
* Red maxes at 103.5 degrees
* Green maxes at 240.7 degrees
* Blue maxes at 347.1 degrees
*/
#define RED_PHASE_NTSC 104
#define GREEN_PHASE_NTSC 241
#define BLUE_PHASE_NTSC 347
/* Ideal phase angles for 4 phase */
#define RED_PHASE_IDEAL 90
#define GREEN_PHASE_IDEAL 270
#define BLUE_PHASE_IDEAL 360
/* Equal 120 deg phase angles */
#define RED_PHASE_EQUAL 120
#define GREEN_PHASE_EQUAL 240
#define BLUE_PHASE_EQUAL 360
/* Simplified phase angles: 90 deg between R and B, 135 between RG and BG */
#define RED_PHASE_SIMPLE 90
#define GREEN_PHASE_SIMPLE 225
#define BLUE_PHASE_SIMPLE 360
/* Flags */
#define GREY_HACK 1 /* Remap GREY1 to GREY2 */
#define DUMP_STATE 2 /* Dump internal state */
char flags = GREY_HACK;
/* Handy macros */
#ifndef min
#define min(a,b) ((a)<(b)?(a):(b))
#endif
#ifndef max
#define max(a,b) ((a)>(b)?(a):(b))
#endif
#define RED 0
#define GRN 1
#define BLU 2
#define DEG_TO_RAD 0.0174533
#define TRUE 1
#define FALSE 0
unsigned char ntscChroma[4][3];
int prevRed, prevBlu, prevGrn;
unsigned char gammaRed[256]; /* RED gamma correction */
unsigned char gammaGrn[256]; /* GREEN gamma correction */
unsigned char gammaBlu[256]; /* BLUE gamma correction */
int phase[3] = {RED_PHASE_NTSC, GREEN_PHASE_NTSC, BLUE_PHASE_NTSC};
int gammacorrect = 0; /* Gamma correction */
int brightness = 0;
int saturation = 255; /* 1.0 */
int tint = 22; /* imperically determined tint */
int orgmode;
int errDiv = 4;
unsigned char rgbScanline[X_RES * 3]; /* RGB scanline */
int rgbErr[(X_RES + 1) * 3]; /* Running color error array */
#define DHGR_SIZE 16384
unsigned char dhgrScreen[DHGR_SIZE];
int scanOffset[] = {0x0000,0x0400,0x0800,0x0C00,0x1000,0x1400,0x1800,0x1C00,
0x0080,0x0480,0x0880,0x0C80,0x1080,0x1480,0x1880,0x1C80,
0x0100,0x0500,0x0900,0x0D00,0x1100,0x1500,0x1900,0x1D00,
0x0180,0x0580,0x0980,0x0D80,0x1180,0x1580,0x1980,0x1D80,
0x0200,0x0600,0x0A00,0x0E00,0x1200,0x1600,0x1A00,0x1E00,
0x0280,0x0680,0x0A80,0x0E80,0x1280,0x1680,0x1A80,0x1E80,
0x0300,0x0700,0x0B00,0x0F00,0x1300,0x1700,0x1B00,0x1F00,
0x0380,0x0780,0x0B80,0x0F80,0x1380,0x1780,0x1B80,0x1F80,
0x0028,0x0428,0x0828,0x0C28,0x1028,0x1428,0x1828,0x1C28,
0x00A8,0x04A8,0x08A8,0x0CA8,0x10A8,0x14A8,0x18A8,0x1CA8,
0x0128,0x0528,0x0928,0x0D28,0x1128,0x1528,0x1928,0x1D28,
0x01A8,0x05A8,0x09A8,0x0DA8,0x11A8,0x15A8,0x19A8,0x1DA8,
0x0228,0x0628,0x0A28,0x0E28,0x1228,0x1628,0x1A28,0x1E28,
0x02A8,0x06A8,0x0AA8,0x0EA8,0x12A8,0x16A8,0x1AA8,0x1EA8,
0x0328,0x0728,0x0B28,0x0F28,0x1328,0x1728,0x1B28,0x1F28,
0x03A8,0x07A8,0x0BA8,0x0FA8,0x13A8,0x17A8,0x1BA8,0x1FA8,
0x0050,0x0450,0x0850,0x0C50,0x1050,0x1450,0x1850,0x1C50,
0x00D0,0x04D0,0x08D0,0x0CD0,0x10D0,0x14D0,0x18D0,0x1CD0,
0x0150,0x0550,0x0950,0x0D50,0x1150,0x1550,0x1950,0x1D50,
0x01D0,0x05D0,0x09D0,0x0DD0,0x11D0,0x15D0,0x19D0,0x1DD0,
0x0250,0x0650,0x0A50,0x0E50,0x1250,0x1650,0x1A50,0x1E50,
0x02D0,0x06D0,0x0AD0,0x0ED0,0x12D0,0x16D0,0x1AD0,0x1ED0,
0x0350,0x0750,0x0B50,0x0F50,0x1350,0x1750,0x1B50,0x1F50,
0x03D0,0x07D0,0x0BD0,0x0FD0,0x13D0,0x17D0,0x1BD0,0x1FD0};
void dhgrSet(int x, int y)
{
int pixbit, pixofst;
pixbit = 1 << (x % 7);
pixofst = x / 7;
pixofst = (DHGR_SIZE/2) * (pixofst & 1) + (pixofst >> 1);
dhgrScreen[scanOffset[y] + pixofst] |= pixbit;
}
void dhgrPlot(int x, int y, int clr)
{
int bit;
for (bit = 0; bit < 4; bit++)
{
if ((1 << bit) & clr)
dhgrSet(x + bit, y);
}
}
long int dist(int dr, int dg, int db)
{
long int rr, gg, bb;
rr = (long int)dr * (long int)dr;
gg = (long int)dg * (long int)dg;
bb = (long int)db * (long int)db;
return rr + gg + bb;
}
void calcChroma(int angle)
{
int r, g, b, i;
for (i = 0; i < 4; i++)
{
/* Calculate RGB for this NTSC subcycle pixel */
r = saturation + (int)(cos((angle - phase[RED]) * DEG_TO_RAD) * 255);
g = saturation + (int)(cos((angle - phase[GRN]) * DEG_TO_RAD) * 255);
b = saturation + (int)(cos((angle - phase[BLU]) * DEG_TO_RAD) * 255);
/* Make chroma add up to white */
ntscChroma[i][RED] = min(255, max(0, (r + 2) / 4));
ntscChroma[i][GRN] = min(255, max(0, (g + 2) / 4));
ntscChroma[i][BLU] = min(255, max(0, (b + 2) / 4));
/* Next NTSC chroma subcycle pixel */
angle = angle - 90;
}
}
int rgbMatchChroma(int r, int g, int b, int *errptr, int cx)
{
int currRed, currGrn, currBlu;
int errRed, errGrn, errBlu;
int pix;
/* Apply error propogation */
if (errDiv)
{
r += errptr[RED] / errDiv;
g += errptr[GRN] / errDiv;
b += errptr[BLU] / errDiv;
}
/* Previous RGB chroma subcycles */
prevRed = (prevRed * 3) / 4;
prevGrn = (prevGrn * 3) / 4;
prevBlu = (prevBlu * 3) / 4;
/* Current potential RGB subcycle */
currRed = prevRed + ntscChroma[cx][RED];
currGrn = prevGrn + ntscChroma[cx][GRN];
currBlu = prevBlu + ntscChroma[cx][BLU];
/* Match chroma subcycle */
pix = 0;
if (dist(r - currRed, g - currGrn, b - currBlu) < dist(r - prevRed, g - prevGrn, b - prevBlu))
{
/* RGB better matched with current chroma subcycle color */
prevRed = currRed;
prevGrn = currGrn;
prevBlu = currBlu;
pix = 1;
}
/* Propogate error down (overwrite error at this coordinate for next row) */
errRed = r - prevRed;
errGrn = g - prevGrn;
errBlu = b - prevBlu;
errptr[RED] = errRed;
errptr[GRN] = errGrn;
errptr[BLU] = errBlu;
/* And forward (add to previous row error for next match) */
errptr[RED + 3] += errRed;
errptr[GRN + 3] += errGrn;
errptr[BLU + 3] += errBlu;
return pix;
}
int rgbInit(void)
{
int i;
long int g32;
switch (gammacorrect)
{
case -1:
for (i = 0; i < 256; i++)
{
g32 = (255 - i + 255 - ((long int)i * (long int)i + 127)/255) / 2;
gammaRed[255 - i] = g32;
gammaGrn[255 - i] = g32;
gammaBlu[255 - i] = g32;
}
break;
case -2:
for (i = 0; i < 256; i++)
{
g32 = 255 - ((long int)i * (long int)i + 127)/255;
gammaRed[255 - i] = g32;
gammaGrn[255 - i] = g32;
gammaBlu[255 - i] = g32;
}
break;
case 2:
for (i = 0; i < 256; i++)
{
g32 = ((long int)i * (long int)i + 127) / 255;
gammaRed[i] = g32;
gammaGrn[i] = g32;
gammaBlu[i] = g32;
}
break;
case 1:
for (i = 0; i < 256; i++)
{
g32 = (i + ((long int)i * (long int)i + 127) / 255) / 2;
gammaRed[i] = g32;
gammaGrn[i] = g32;
gammaBlu[i] = g32;
}
break;
default:
for (i = 0; i < 256; i++)
{
gammaRed[i] = i;
gammaGrn[i] = i;
gammaBlu[i] = i;
}
}
if (brightness)
for (i = 0; i < 256; i++)
{
gammaRed[i] = max(0, min(255, gammaRed[i] + brightness));
gammaGrn[i] = max(0, min(255, gammaGrn[i] + brightness));
gammaBlu[i] = max(0, min(255, gammaBlu[i] + brightness));
}
calcChroma(tint);
if (flags & DUMP_STATE)
{
printf("Err Div = %d\n", errDiv);
printf("Gamma = %d\n", gammacorrect);
printf("Brightness = %d\n", brightness);
printf("Tint = %d\n", tint);
printf("Saturation = %d\n", saturation);
puts("Chroma cycle RGB =");
for (i = 0; i < 4; i++)
printf(" [%3d, %3d %3d]\n", ntscChroma[i][RED],
ntscChroma[i][GRN],
ntscChroma[i][BLU]);
}
return TRUE;
}
char *pnmReadElement(FILE *fp, char *bufptr)
{
char *endptr;
endptr = bufptr + 1;
while (fread(bufptr, 1, 1, fp) == 1 && *bufptr == '#') /* Comment */
while (fread(endptr, 1, 1, fp) == 1 && *endptr >= ' ');
while (fread(endptr, 1, 1, fp) == 1 && *endptr > ' ' && (endptr - bufptr < 80))
endptr++;
*endptr = '\0';
if (flags & DUMP_STATE)
puts(bufptr);
return bufptr;
}
int pnmVerifyHeader(FILE *fp)
{
char buf[128];
if (flags & DUMP_STATE)
printf("PNM = ");
pnmReadElement(fp, buf);
if (strcmp(buf, "P6"))
{
printf("Invalid PNM magic #: %c%c\n", buf[0], buf[1]);
return FALSE;
}
if (atoi(pnmReadElement(fp, buf)) != X_RES)
{
printf("Width not 640: %s\n", buf);
return FALSE;
}
if (atoi(pnmReadElement(fp, buf)) != Y_RES)
{
printf("Height not 192: %s\n", buf);
return FALSE;
}
if (atoi(pnmReadElement(fp, buf)) != 255)
{
printf("Depth not 255: %s\n", buf);
return FALSE;
}
return TRUE;
}
int rgbImportExport(char *pnmfile, char *dhgrfile)
{
FILE *fp;
unsigned char *scanptr;
unsigned char chromaBits, *rgbptr;
int scan, pix, chroma, r, g, b, *errptr;
if (flags & DUMP_STATE)
printf("PNM file = %s\n", pnmfile);
fp = fopen(pnmfile, "rb");
if (fp)
{
if (pnmVerifyHeader(fp) && rgbInit())
{
/* Clear screen memory */
memset(dhgrScreen, 0, DHGR_SIZE);
/* Init error propogation array */
memset(rgbScanline, 0, X_RES * 3);
memset(rgbErr, 0, X_RES * 3 * sizeof(int));
for (scan = 0; scan < Y_RES; scan++)
{
fread(rgbScanline, X_RES, 3, fp);
/* Reset prev RGB to neutral color */
prevRed = 96;
prevGrn = 96;
prevBlu = 96;
/* Reset pointers */
rgbptr = rgbScanline;
errptr = rgbErr;
for (pix = 0; pix < X_RES; pix += 4)
{
chromaBits = 0;
for (chroma = 0; chroma < 4; chroma++)
{
/* Calc best match */
r = gammaRed[rgbptr[RED]];
g = gammaGrn[rgbptr[GRN]];
b = gammaBlu[rgbptr[BLU]];
chromaBits |= rgbMatchChroma(r, g, b, errptr, chroma) << chroma;
rgbptr = rgbptr + 3;
errptr = errptr + 3;
}
if (chromaBits == 0x0A && flags & GREY_HACK)
chromaBits = 0x05;
dhgrPlot(pix, scan, chromaBits);
}
}
}
fclose(fp);
fp = fopen(dhgrfile, "wb");
if (fp)
{
fwrite(dhgrScreen, DHGR_SIZE, 1, fp);
fclose(fp);
return 0;
}
printf("Unable to open %s\n", dhgrfile);
}
printf("Unable to open %s\n", pnmfile);
return -1;
}
int main(int argc, char **argv)
{
puts("DHGR RGB converter 1.0");
while (*++argv && (*argv)[0] == '-')
{
switch (toupper((*argv)[1]))
{
case 'B': /* Set brightness */
brightness = atoi(*argv + 2);
break;
case 'C': /* No grey remapping*/
flags &= ~GREY_HACK;
case 'D': /* Dump internal state */
flags |= DUMP_STATE;
break;
case 'E': /* Set error strength */
errDiv = atoi(*argv + 2);
break;
case 'G': /* Set gamma amount */
gammacorrect = atoi(*argv + 2);
break;
case 'P': /* RGB phase angle */
switch (toupper((*argv)[2]))
{
case 'I': /* Use ideal 4 sub-phase angles */
phase[RED] = RED_PHASE_IDEAL;
phase[GRN] = GREEN_PHASE_IDEAL;
phase[BLU] = BLUE_PHASE_IDEAL;
break;
case 'E': /* Use equal 120 deg phase angles */
phase[RED] = RED_PHASE_EQUAL;
phase[GRN] = GREEN_PHASE_EQUAL;
phase[BLU] = BLUE_PHASE_EQUAL;
break;
case 'S': /* Use simplified 90 degree and opposite phase angles */
phase[RED] = RED_PHASE_SIMPLE;
phase[GRN] = GREEN_PHASE_SIMPLE;
phase[BLU] = BLUE_PHASE_SIMPLE;
break;
/* case 'N': Use theoretical NTSC phase angles */
default:
phase[RED] = RED_PHASE_NTSC;
phase[GRN] = GREEN_PHASE_NTSC;
phase[BLU] = BLUE_PHASE_NTSC;
break;
}
break;
case 'S': /* Adjust saturation */
saturation -= atoi(*argv + 2);
break;
case 'T': /* Adjust tint */
tint += atoi(*argv + 2);
break;
default:
printf("? option: %c\n", (*argv)[1]);
}
}
if (argv[0] && argv[1])
return rgbImportExport(argv[0], argv[1]);
puts("Usage:");
puts(" dhgrrgb");
puts(" [-b#] = Brightness: -255..255");
puts(" [-c] = Composite output (no grey remapping)");
puts(" [-d] = Dump state");
puts(" [-e#] = Error strength: 1..255");
puts(" 0 = no err");
puts(" [-g#] = Gamma: 2, 1, 0, -1, -2");
puts(" [-p<I,E,S,N>] = Phase: Ideal, Equal, Simple, NTSC");
puts(" [-s#] = Saturation: -255..255");
puts(" [-t#] = Tint: -360..360 (in degrees)");
puts(" <PNM file> <DHGR file>");
return 0;
}

BIN
src/dhgr.tk/utils/dhgrrgb.exe Executable file

Binary file not shown.

View File

@@ -0,0 +1,586 @@
include "inc/cmdsys.plh"
include "inc/args.plh"
include "inc/fileio.plh"
include "inc/int32.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags resxtxt1|reshgr1|resxhgr1
// Bit patterns and associated default NTSC colors
// NTSC_BLACK = 0000
// NTSC_DRKBLUE = 0001 73, 14, 116
// NTSC_DRKGREEN = 0010 0, 104, 100
// NTSC_BROWN = 0100 55, 113, 11
// NTSC_MAGENTA = 1000 127, 23, 27
// NTSC_PURPLE = 1001
// NTSC_MEDBLUE = 0011
// NTSC_LTBLUE = 1011
// NTSC_AQUA = 0111
// NTSC_GREEN = 0110
// NTSC_ORANGE = 1100
// NTSC_PINK = 1101
// NTSC_YELLOW = 1110
// NTSC_WHITE = 1111
const RED = 0
const GRN = 1
const BLU = 2
// According to what I could find out about the NTSC color wheel:
// Red maxes at 103.5 degrees
// Green maxes at 240.7 degrees
// Blue maxes at 347.1 degrees
const RED_PHASE_NTSC = 104
const GREEN_PHASE_NTSC = 241
const BLUE_PHASE_NTSC = 347
// Ideal phase angles for 4 phase
const RED_PHASE_IDEAL = 90
const GREEN_PHASE_IDEAL = 270
const BLUE_PHASE_IDEAL = 360
// Equal 120 deg phase angles
const RED_PHASE_EQUAL = 120
const GREEN_PHASE_EQUAL = 240
const BLUE_PHASE_EQUAL = 360
// Simplified phase angles: 90 deg between R and B, 135 between RG and BG
const RED_PHASE_SIMPLE = 90
const GREEN_PHASE_SIMPLE = 225
const BLUE_PHASE_SIMPLE = 360
const GREY_CHROMA = 32 * 4 / 3
// Flags
const GREY_HACK = $01 // Remap GREY1->GREY2 hack
const MEM_MODE = $02 // Render to memory surface
const DUMP_STATE = $04 // Dump internal state
const RAW_INFILE = $08 // Raw 560x192 24BPP RGB values
const MATCH_ONE = 8
const MATCH_ZERO = 0
byte clrRot = $00,$02,$04,$06,$08,$0A,$0C,$0E
byte = $01,$03,$05,$07,$09,$0B,$0D,$0F
var sin90[] // first 90 degrees of sin in fixed s.15 format
var = 0, 571, 1143, 1714, 2285, 2855, 3425, 3993
var = 4560, 5126, 5690, 6252, 6812, 7371, 7927, 8480
var = 9032, 9580, 10125, 10668, 11207, 11743, 12275, 12803
var = 13327, 13848, 14364, 14876, 15383, 15886, 16383, 16876
var = 17364, 17846, 18323, 18794, 19260, 19720, 20173, 20621
var = 21062, 21497, 21926, 22347, 22762, 23170, 23571, 23964
var = 24351, 24730, 25101, 25465, 25821, 26169, 26509, 26841
var = 27165, 27481, 27788, 28087, 28377, 28659, 28932, 29196
var = 29451, 29697, 29935, 30163, 30381, 30591, 30791, 30982
var = 31164, 31336, 31498, 31651, 31794, 31928, 32051, 32165
var = 32270, 32364, 32449, 32523, 32588, 32643, 32688, 32723
var = 32748, 32763, 32767
word hgrScan[] // HGR scanline order for saving memory buffer as DHGR
word = $0000,$0400,$0800,$0C00,$1000,$1400,$1800,$1C00
word = $0080,$0480,$0880,$0C80,$1080,$1480,$1880,$1C80
word = $0100,$0500,$0900,$0D00,$1100,$1500,$1900,$1D00
word = $0180,$0580,$0980,$0D80,$1180,$1580,$1980,$1D80
word = $0200,$0600,$0A00,$0E00,$1200,$1600,$1A00,$1E00
word = $0280,$0680,$0A80,$0E80,$1280,$1680,$1A80,$1E80
word = $0300,$0700,$0B00,$0F00,$1300,$1700,$1B00,$1F00
word = $0380,$0780,$0B80,$0F80,$1380,$1780,$1B80,$1F80
word = $0028,$0428,$0828,$0C28,$1028,$1428,$1828,$1C28
word = $00A8,$04A8,$08A8,$0CA8,$10A8,$14A8,$18A8,$1CA8
word = $0128,$0528,$0928,$0D28,$1128,$1528,$1928,$1D28
word = $01A8,$05A8,$09A8,$0DA8,$11A8,$15A8,$19A8,$1DA8
word = $0228,$0628,$0A28,$0E28,$1228,$1628,$1A28,$1E28
word = $02A8,$06A8,$0AA8,$0EA8,$12A8,$16A8,$1AA8,$1EA8
word = $0328,$0728,$0B28,$0F28,$1328,$1728,$1B28,$1F28
word = $03A8,$07A8,$0BA8,$0FA8,$13A8,$17A8,$1BA8,$1FA8
word = $0050,$0450,$0850,$0C50,$1050,$1450,$1850,$1C50
word = $00D0,$04D0,$08D0,$0CD0,$10D0,$14D0,$18D0,$1CD0
word = $0150,$0550,$0950,$0D50,$1150,$1550,$1950,$1D50
word = $01D0,$05D0,$09D0,$0DD0,$11D0,$15D0,$19D0,$1DD0
word = $0250,$0650,$0A50,$0E50,$1250,$1650,$1A50,$1E50
word = $02D0,$06D0,$0AD0,$0ED0,$12D0,$16D0,$1AD0,$1ED0
word = $0350,$0750,$0B50,$0F50,$1350,$1750,$1B50,$1F50
word = $03D0,$07D0,$0BD0,$0FD0,$13D0,$17D0,$1BD0,$1FD0
var surfMem, surfSpan
var[12] ntscChroma
var prevRed, prevBlu, prevGrn
byte[256] gammaRGB // RGB gamma correction
var[3] phase = RED_PHASE_NTSC, GREEN_PHASE_NTSC, BLUE_PHASE_NTSC
byte gamma = 0 // Gamma correction
var brightness = 0
var saturation = 255 // 1.0
var tint = 22 // = 45/2 deg
byte errDiv = 4
byte flags = GREY_HACK
var rgbErr // Running color error array
var arg
// Handy numeric functions
def min(a, b)#1
return a < b ?? a :: b
end
def max(a, b)#1
return a > b ?? a :: b
end
def sin(deg)#1
while deg > 360; deg = deg - 360; loop
while deg < 0; deg = deg + 360; loop
if deg <= 90
return sin90[deg]
elsif deg <= 180
return sin90[180 - deg]
elsif deg <= 270
return -sin90[deg - 180]
fin
return -sin90[360 - deg]
end
def cos(deg)#1
return sin(deg + 90)
end
def dist(dr, dg, db)#2 // Linear distance
res[t_i32] rr, gg
loadi16(dr)
muli16(dr)
store32(@rr)
loadi16(dg)
muli16(dg)
store32(@gg)
loadi16(db)
muli16(db)
add32(@gg)
add32(@rr)
store32(@rr)
return rr:[0], rr:[1]
end
def atoi(strptr)#1
var num, len, sign
sign = 1
num = 0
len = ^strptr
strptr++
if ^strptr == '-'
sign = -1
strptr++
len--
elsif ^strptr == '+'
strptr++
len--
fin
while len and ^strptr >= '0' and ^strptr <= '9'
num = num * 10 + ^strptr - '0'
strptr++
len--
loop
return num * sign
end
def calcChroma(angle)#0
var r, g, b
byte i
for i = 0 to 3
// Calculate RGB for this DHGR pixel
//r = max(0, (saturation + (cos(angle - phase[RED]) >> 7)))
//g = max(0, (saturation + (cos(angle - phase[GRN]) >> 7)))
//b = max(0, (saturation + (cos(angle - phase[BLU]) >> 7)))
r = saturation + (cos(angle - phase[RED]) >> 7)
g = saturation + (cos(angle - phase[GRN]) >> 7)
b = saturation + (cos(angle - phase[BLU]) >> 7)
// Make chroma add up to white
ntscChroma[i*3 + RED] = (r + 2) / 4
ntscChroma[i*3 + GRN] = (g + 2) / 4
ntscChroma[i*3 + BLU] = (b + 2) / 4
// Next NTSC chroma pixel
angle = angle - 90
next
end
def rgbMatch(r, g, b, errptr, cx)#1
var currRed, currGrn, currBlu
var er, eg, eb
byte pix,
res[t_i32] pd
// Previous RGB minus current chroma cycle
prevRed = (prevRed * 3) / 4
prevGrn = (prevGrn * 3) / 4
prevBlu = (prevBlu * 3) / 4
// Current potential RGB
cx = cx * 3
currRed = prevRed + ntscChroma[cx+RED]
currGrn = prevGrn + ntscChroma[cx+GRN]
currBlu = prevBlu + ntscChroma[cx+BLU]
// Match next chroma subcycle
pd:[0], pd:[1] = dist(r - prevRed, g - prevGrn, b - prevBlu)
dist(r - currRed, g - currGrn, b - currBlu)
if islt32(@pd)
// RGB better matched with next chroma color
prevRed = currRed
prevGrn = currGrn
prevBlu = currBlu
pix = MATCH_ONE
else
pix = MATCH_ZERO
fin
// Propogate error down and forward
er = r - prevRed
errptr=>[RED] = er
eg = g - prevGrn
errptr=>[GRN] = eg
eb = b - prevBlu
errptr=>[BLU] = eb
errptr=>[RED+3] = er + errptr=>[RED+3]
errptr=>[GRN+3] = eg + errptr=>[GRN+3]
errptr=>[BLU+3] = eb + errptr=>[BLU+3]
return pix
end
def rgbInit#0
var i
res[t_i32] g32
if flags & DUMP_STATE
puts("Gamma = "); puti(sext(gamma)); putln
fin
when gamma
is 255 // (i + 1 / i^2) / 2
for i = 0 to 255
loadi16(i)
muli16(i)
addi16(127)
divi16(255)
neg32
addi16(255)
addi16(255 - i)
divi16(2)
store32(@g32)
gammaRGB[255 - i] = g32
next
break
is 254 // 1 - i^2
for i = 0 to 255
loadi16(i)
muli16(i)
addi16(127)
divi16(255)
neg32
addi16(255)
store32(@g32)
gammaRGB[255 - i] = g32
next
break
is 2 // 1/(i^2)
for i = 0 to 255
loadi16(i)
muli16(i)
addi16(127)
divi16(255)
store32(@g32)
gammaRGB[i] = g32
next
break
is 1 // (i + i^2) / 2
for i = 0 to 255
loadi16(i)
muli16(i)
addi16(127)
divi16(255)
addi16(i)
divi16(2)
store32(@g32)
gammaRGB[i] = g32
next
break
otherwise // i
for i = 0 to 255
gammaRGB[i] = i
next
wend
if brightness
for i = 0 to 255
gammaRGB[i] = max(0, min(255, gammaRGB[i] + brightness))
next
fin
calcChroma(tint)
if flags & DUMP_STATE
puts("Err Div = "); puti(errDiv); putln
puts("Brightness = "); puti(brightness); putln
puts("Tint = "); puti(tint); putln
puts("Saturation = "); puti(saturation); putln
puts("Chroma cycle RGB =\n")
for i = 0 to 3
putc('[')
puti(ntscChroma[i*3 + RED]); putc(',')
puti(ntscChroma[i*3 + GRN]); putc(',')
puti(ntscChroma[i*3 + BLU]); puts("]\n")
next
if not (flags & MEM_MODE); getc; fin
fin
if flags & MEM_MODE
surfMem, surfSpan = dhgrAllocBl7Mem(SCR_WIDTH, SCR_HEIGHT)
dhgrSurfMem(OP_XOR, SCR_HEIGHT, surfMem, surfSpan)
dhgrOp(OP_SRC) // Force op recalc
dcgrColor(CLR_BLACK)
dhgrClearBl7(0, 0, surfSpan >> 2, SCR_HEIGHT)
else
dhgrMode(DHGR_COLOR_MODE)
fin
end
def rgbExit#0
heaprelease(rgbErr)
if not (flags & MEM_MODE)
dhgrMode(DHGR_TEXT_MODE)
fin
end
def pnmReadElement(refnum, bufptr)#1
var lenptr
lenptr = bufptr
repeat
^lenptr = 0
bufptr = lenptr + 1
if fileio:read(refnum, bufptr, 1) == 1 and ^bufptr == '#' // Comment
^lenptr++
bufptr++
while fileio:read(refnum, bufptr, 1) == 1 and ^bufptr >= ' '
loop
else
repeat // Read white space seperated element
^lenptr++
bufptr++
until fileio:read(refnum, bufptr, 1) <> 1 \
or ^bufptr <= ' ' \
or ^lenptr > 32
fin
until ^lenptr and ^(lenptr + 1) <> '#' // Repeat until not comment
if flags & DUMP_STATE; puts(lenptr); putc(' '); fin
return lenptr
end
def pnmVerifyHeader(refnum)#1
byte[128] buf
if flags & DUMP_STATE; puts("PNM = "); fin
pnmReadElement(refnum, @buf)
if buf[0] <> 2 and buf[1] <> 'P' and buf[2] <> '6'
puts("Invalid PNM magic #: "); putc(buf[1]); putc(buf[2]); putln
return FALSE
fin
if atoi(pnmReadElement(refnum, @buf)) <> 560
puts("Width not 560: "); puts(@buf); putln
return FALSE
fin
if atoi(pnmReadElement(refnum, @buf)) <> 192
puts("Height not 192: "); puts(@buf); putln
return FALSE
fin
if atoi(pnmReadElement(refnum, @buf)) <> 255
puts("Depth not 255: "); puts(@buf); putln
return FALSE
fin
if flags & DUMP_STATE; putln; fin
return TRUE
end
def rgbImportExport(rgbfile, dhgrfile)#0
byte refnum, chromaBits
var i, j, c, r, g, b
var rgbScanline, rgbptr, errptr
refnum = fileio:open(rgbfile)
if refnum
if not (flags & RAW_INFILE)
if not pnmVerifyHeader(refnum)
fileio:close(refnum)
return
fin
fin
rgbInit
rgbScanline = heapalloc(560 * 3)
rgbErr = heapalloc(561 * 3 * 2)
if rgbErr and rgbScanline
// Init error propogation array
memset(rgbErr, 0, 560 * 3 * 2)
memset(rgbScanline, 0, 560 * 3)
for j = 0 to 191
fileio:read(refnum, rgbScanline, 560 * 3)
prevRed, prevGrn, prevBLu = 96, 96, 96 // Reset prev RGB
rgbptr = rgbScanline
errptr = rgbErr
for i = 0 to 139
chromaBits = 0
for c = 0 to 3
// Calc best match
r = gammaRGB[rgbptr->[RED]]
g = gammaRGB[rgbptr->[GRN]]
b = gammaRGB[rgbptr->[BLU]]
if errDiv
r = r + errptr=>[RED] / errDiv
g = g + errptr=>[GRN] / errDiv
b = b + errptr=>[BLU] / errDiv
fin
chromaBits = (chromaBits >> 1) | rgbMatch(r, g, b, errptr, c)
rgbptr = rgbptr + 3
errptr = errptr + 3 * 2
next
if flags & GREY_HACK and chromaBits == $0A // Bits are reversed
// Map GREY1 -> GREY2
chromaBits = $05
fin
dcgrColor(clrRot[chromaBits])
dcgrPixel(i, j)
next
if flags & MEM_MODE; putc('.'); fin
if ^$C000 == $83
break
fin
next
fileio:close(refnum)
if ^dhgrfile
if flags & MEM_MODE
heaprelease(rgbScanline) // Free up some memory
if MACHID & $F0 <> $B0
// Use allocated buffer on non 128K //e
rgbScanline = heapalloc($2000)
else
// Use HGR memory (already reserved) on 128K //e
rgbScanline = $2000
fin
if rgbScanline
memset(rgbScanline, 0, $2000)
fileio:destroy(dhgrfile)
fileio:create(dhgrfile, $06, $2000)
refnum = fileio:open(dhgrfile)
if refnum
// Reorder scanlines into HGR format
rgbptr = surfMem
for i = 0 to SCR_HEIGHT-1
memcpy(rgbScanline+hgrScan[i], rgbptr, 40)
rgbptr = rgbptr + surfSpan
next
// Write AUX bytes
fileio:write(refnum, rgbScanline, $2000)
rgbptr = surfMem + surfSpan / 2
for i = 0 to SCR_HEIGHT-1
memcpy(rgbScanline+hgrScan[i], rgbptr, 40)
rgbptr = rgbptr + surfSpan
next
// Write MAIN bytes
fileio:write(refnum, rgbScanline, $2000)
fileio:close(refnum)
fin
putln
fin
else
screenWrite(dhgrfile)
fin
fin
if not (flags & MEM_MODE); getc; fin
rgbExit
fin
else
puts("Unable to open "); puts(rgbfile); putln
fin
end
puts("DHGR RGB converter 1.1\n")
arg = argNext(argFirst)
if ^arg
while ^(arg + 1) == '-'
when toupper(^(arg + 2))
is 'B' // Set brightness
if ^arg > 2
^(arg + 2) = ^arg - 2
brightness = atoi(arg + 2)
fin
break
is 'C' // Disable hack for GREY remapping
flags = flags & ~GREY_HACK
break
is 'D' // Dump internal staet
flags = flags | DUMP_STATE
break
is 'E' // Set error strength
if ^arg > 2
errDiv = ^(arg + 3) - '0'
if ^arg > 3
errDiv = errDiv * 10 + ^(arg + 4) - '0'
fin
fin
break
is 'G' // Set gamma amount
if ^arg > 2
^(arg + 2) = ^arg - 2
gamma = atoi(arg + 2)
fin
break
is 'P' // RGB phase angle
when toupper(^(arg + 3))
is 'I' // Use ideal 4 sub-phase angles
phase[RED] = RED_PHASE_IDEAL
phase[GRN] = GREEN_PHASE_IDEAL
phase[BLU] = BLUE_PHASE_IDEAL
break
is 'E' // Use equal 120 deg phase angles
phase[RED] = RED_PHASE_EQUAL
phase[GRN] = GREEN_PHASE_EQUAL
phase[BLU] = BLUE_PHASE_EQUAL
break
is 'S' // Use simplified 90 degree and opposite phase angles
phase[RED] = RED_PHASE_SIMPLE
phase[GRN] = GREEN_PHASE_SIMPLE
phase[BLU] = BLUE_PHASE_SIMPLE
break
//is 'N' // Use theoretical NTSC phase angles
otherwise
phase[RED] = RED_PHASE_NTSC
phase[GRN] = GREEN_PHASE_NTSC
phase[BLU] = BLUE_PHASE_NTSC
break
wend
break
is 'R' // Raw input mode - no PNM header
flags = flags | RAW_INFILE
break
is 'S' // Adjust saturation
if ^arg > 2
^(arg + 2) = ^arg - 2
saturation = saturation - atoi(arg + 2)
fin
break
is 'T' // Adjust tint
if ^arg > 2
^(arg + 2) = ^arg - 2
tint = tint + atoi(arg + 2)
fin
break
is 'V' // No video output, memory mode only (for portable VM)
flags = flags | MEM_MODE
break
otherwise
puts("? option:"); putc(^(arg + 2)); putln
wend
arg = argNext(arg)
loop
if ^arg
rgbImportExport(arg, argNext(arg))
fin
return 0
fin
puts("Usage:\n")
puts(" DHGRRGB\n")
puts(" [-B#] = Brightness: -255..255\n")
puts(" [-C] = Composite output\n")
puts(" [-D] = Dump state\n")
puts(" [-E#] = Error strength: 1..255\n")
puts(" 0 = no err\n")
puts(" [-G#] = Gamma: 2, 1, 0, -1, -2\n")
puts(" [-P<I,E,S,N>] = Phase: Ideal, Equal\n")
puts(" Simple, NTSC\n")
puts(" [-R] = Raw image file, no header\n")
puts(" [-S#] = Saturation: -255..255\n")
puts(" [-T#] = Tint: -360..360 (in degrees)\n")
puts(" [-V] = no Video output, mem only\n")
puts(" IMAGEFILE [DHGRFILE]\n")
done

View File

@@ -0,0 +1,162 @@
include "inc/cmdsys.plh"
include "inc/args.plh"
include "inc/fileio.plh"
include "inc/matchfiles.plh"
include "inc/lz4.plh"
include "inc/longjmp.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
include "inc/vblank.plh"
sysflags resxtxt1|reshgr1|resxhgr1|reshgr2|nojitc
const page1m = $C054
const page1x = $C055
byte dolz4, quit
var arg, srcfilelist, srcpath, srcexp, srccnt
var entrylist, entrycnt
var retval
var pause = 4
res[t_except] exit
//
// Copy string with upper case conversion
//
def struprcpy(dst, src)#0
byte i
if ^src
for i = 1 to ^src
dst->[i] = toupper(src->[i])
next
fin
^dst = ^src
end
def fail(msg)#0
dhgrMode(DHGR_TEXT_MODE)
puts(msg)
putln
throw(@exit, -1)
end
def screenShow(filestr)#0
if dolz4
^page1x // Decompress into AUX screen bytes
when lz4Read(filestr, $2000, $6000, $2000, $6000)
is LZ4_INVALID
fail("Not LZ4 file.\n")
is LZ4_WRONG_VERSION
fail("Wrong LZ4 version.\n")
is LZ4_NOT_64K
fail("Not 64K block size.\n")
wend
^page1m // Copy into MAIN screen bytes
memcpy($2000, $4000, $2000)
else
screenRead(filestr)
fin
end
def delay_getkey#1
var busywait, wastetime
for busywait = 0 to 60*pause
waitVBL
if ^$C000 > 127
return (^$C010 & $7F) == $03
fin
next
return FALSE
end
def atoi(strptr)#1
var num, len, sign
sign = 1
num = 0
len = ^strptr
strptr++
if ^strptr == '-'
sign = -1
strptr++
len--
elsif ^strptr == '+'
strptr++
len--
fin
while len and ^strptr >= '0' and ^strptr <= '9'
num = num * 10 + ^strptr - '0'
strptr++
len--
loop
return num * sign
end
arg = argNext(argFirst)
while ^arg and ^(arg + 1) == '-'
//
// Process flags
//
when toupper(^(arg + 2))
is 'Z' // decompress screens
dolz4 = TRUE
break
is 'P' // pause between screens
if ^arg > 2
^(arg + 2) = ^arg - 2
pause = atoi(arg + 2)
fin
break
wend
arg = argNext(arg)
loop
while ^arg
//
// Add to source list
//
srcpath, srcexp = splitPathFile(arg)
entrylist, entrycnt = matchList(srcpath, srcexp)
if not entrylist
puts(arg); puts(" ???\n")
else
if not srcfilelist
srcfilelist = entrylist
fin
srccnt = srccnt + entrycnt
while entrycnt
//
// Prepend path to filename
//
strcpy(entrylist, strcat(strcpy(heapmark, srcpath), entrylist))
entrylist = entrylist + t_fileentry
entrycnt--
loop
fin
arg = argNext(arg)
loop
if srccnt
dhgrMode(DHGR_COLOR_MODE)
retval = except(@exit)
if retval == 0
if srccnt == 1
screenShow(srcfilelist)
getc
else
repeat
entrylist = srcfilelist
entrycnt = srccnt
while entrycnt
screenShow(entrylist)
entrylist = entrylist + t_fileentry
entrycnt--
quit = delay_getkey
if quit; break; fin
loop
until quit
fin
dhgrMode(DHGR_TEXT_MODE)
fin
return retval
fin
puts("Usage: DHGRSHOW [-Z] <FILES>+\n")
done

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