Compare commits

...

14 Commits

Author SHA1 Message Date
Thomas Cherryhomes
dd38d9ed95 add config bits. 2019-02-03 12:40:11 -06:00
Thomas Cherryhomes
fa9a8a4a32 Merge branch 'master' of github.com:tschak909/platotermClassicMac 2019-02-03 12:39:28 -06:00
Thomas Cherryhomes
674904814e put in rest of menu update code. 2019-02-03 12:39:12 -06:00
Thomas Cherryhomes
0b691cbdf7
Create README.md 2019-02-01 23:16:17 -06:00
Thomas Cherryhomes
bce4bb82fb Add About dialog. 2019-02-01 17:07:52 -06:00
Thomas Cherryhomes
b3610d1484 Add PLTO creator code, so icon works. Add more menu items to resource file. Temporarily comment out mono paint. 2019-02-01 16:16:58 -06:00
Thomas Cherryhomes
0b77f5bf80 Add fill patterns to rsrc. Add mono fill, but commented until it can be debugged. 2019-02-01 14:31:40 -06:00
Thomas Cherryhomes
f865bef335 implement touch. add one pixel to window X. 2019-01-31 16:51:28 -06:00
Thomas Cherryhomes
a7bbae82e0 fix key mapping. Work on exit code. Implement beep. Ensure that character size not accidentally reset after initial sizing. 2019-01-31 11:16:20 -06:00
Thomas Cherryhomes
e5f56c5b72 Only attach AppleEvents on System 7.0 and greater. 2019-01-29 22:29:00 -06:00
Thomas Cherryhomes
df05c53db3 Flesh out apple events, add an update event stub. Hopefully this will make the window behave better in multitasking systems. 2019-01-29 20:25:42 -06:00
Thomas Cherryhomes
227f948745 Baud rate back to 57600. Do not paint if mono. Scale characters for 384 and 480 line displays. 2019-01-29 18:51:50 -06:00
Thomas Cherryhomes
2a6d0bb34e Fold in Steve Peltz's text output routines from original MacPad, cleaned up for GCC. Much faster now. 2019-01-29 01:03:22 -06:00
Thomas Cherryhomes
87fdbb7dd5 Try to add the icon to the resource file. grrr... 2019-01-28 23:44:15 -06:00
14 changed files with 1069 additions and 223 deletions

View File

@ -18,6 +18,8 @@ add_application(PLATOTERM
terminal.c
touch.c
trace.c
config.c
CREATOR "PLTO"
)
target_link_libraries(PLATOTERM "-lm")

View File

@ -1 +1,365 @@
#include "Processes.r" #include "Menus.r" #include "Windows.r" #include "MacTypes.r" resource 'MENU' (128) { 128, textMenuProc; allEnabled, enabled; apple; { "About PLATOTERM", noIcon, noKey, noMark, plain; "-", noIcon, noKey, noMark, plain; } }; resource 'MENU' (129) { 129, textMenuProc; allEnabled, enabled; "File"; { "Quit", noIcon, "Q", noMark, plain; } }; resource 'MENU' (130) { 130, textMenuProc; 0, enabled; "Edit"; { "Undo", noIcon, "Z", noMark, plain; "-", noIcon, noKey, noMark, plain; "Cut", noIcon, "X", noMark, plain; "Copy", noIcon, "C", noMark, plain; "Paste", noIcon, "V", noMark, plain; "Clear", noIcon, noKey, noMark, plain; } }; resource 'MBAR' (128) { { 128, 129, 130 }; }; resource 'SIZE' (-1) { dontSaveScreen, acceptSuspendResumeEvents, enableOptionSwitch, canBackground, multiFinderAware, backgroundAndForeground, dontGetFrontClicks, ignoreChildDiedEvents, is32BitCompatible, isHighLevelEventAware, onlyLocalHLEvents, notStationeryAware, reserved, reserved, reserved, reserved, 100 * 1024, 100 * 1024 };
#include "Processes.r"
#include "Menus.r"
#include "Windows.r"
#include "MacTypes.r"
#include "Finder.r"
type 'PLTO' as 'STR ';
resource 'PLTO' (0, purgeable) {
"PLATOTerm 0.5"
};
resource 'MENU' (128) {
128, textMenuProc;
allEnabled, enabled;
apple;
{
"About PLATOTERM", noIcon, noKey, noMark, plain;
"-", noIcon, noKey, noMark, plain;
}
};
resource 'MENU' (129) {
129, textMenuProc;
allEnabled, enabled;
"Terminal";
{
"PLATO Mode", noIcon, "P", noMark, plain;
"TTY Mode", noIcon, "T", noMark, plain;
"-",noIcon, noKey, noMark, plain;
"Hang Up",noIcon, "H", noMark, plain;
"Quit", noIcon, "Q", noMark, plain;
}
};
resource 'MENU' (130) {
130, textMenuProc;
0, enabled;
"Edit";
{
"Undo", noIcon, "Z", noMark, plain;
"-", noIcon, noKey, noMark, plain;
"Cut", noIcon, "X", noMark, plain;
"Copy", noIcon, "C", noMark, plain;
"Paste", noIcon, "V", noMark, plain;
"Clear", noIcon, noKey, noMark, plain;
}
};
resource 'MENU' (131) {
131, textMenuProc;
allEnabled, enabled;
"Settings";
{
"300 baud", noIcon, "3", noMark, Plain;
"1200 baud", noIcon, "1", noMark, plain;
"2400 baud", noIcon, "2", noMark, plain;
"9600 baud", noIcon, "6", noMark, plain;
"19200 baud", noIcon, "9", noMark, plain;
"38400 baud", noIcon, "8", noMark, plain;
"57600 baud", noIcon, "7", noMark, plain;
}
};
resource 'MBAR' (128) {
{ 128, 129, 130, 131 };
};
resource 'SIZE' (-1) {
dontSaveScreen,
acceptSuspendResumeEvents,
enableOptionSwitch,
canBackground,
multiFinderAware,
backgroundAndForeground,
dontGetFrontClicks,
ignoreChildDiedEvents,
is32BitCompatible,
isHighLevelEventAware,
onlyLocalHLEvents,
notStationeryAware,
reserved,
reserved,
reserved,
reserved,
256 * 1024,
256 * 1024
};
data 'ICN#' (128, purgeable) {
$"0000 0000 0000 7E00 0003 89FC 001E 222C" /* ......~...‰ü..", */
$"007F C8F4 0055 7F84 007A AA04 005F D604" /* ..Èô.U..zª.._Ö. */
$"006A BE04 00D5 5404 00BE AC04 00DF F408" /* .j¾..ÕT..¾¬..ßô. */
$"00BF EC08 00DF D808 01BF E808 017F D808" /* .¿ì..ßØ..¿è...Ø. */
$"01BF E808 017F D808 01BF B008 0157 D008" /* .¿è...Ø..¿°..WÐ. */
$"03AA B008 03F5 5010 031E B060 05E1 E080" /* °..õP...°`.áà*/
$"091E 2300 3223 D400 2444 F800 1C89 4000" /* Æ.#.2#Ô.$Dø..‰@. */
$"0392 8000 0075 0000 000E 0000 0000 0000" /* ...u.......... */
$"0000 0000 0000 7E00 0003 FFFC 001F FFFC" /* ......~...ÿü..ÿü */
$"007F FFFC 007F FFFC 007F FFFC 007F FFFC" /* ..ÿü..ÿü..ÿü..ÿü */
$"007F FFFC 00FF FFFC 00FF FFFC 00FF FFF8" /* ..ÿü.ÿÿü.ÿÿü.ÿÿø */
$"00FF FFF8 00FF FFF8 01FF FFF8 01FF FFF8" /* .ÿÿø.ÿÿø.ÿÿø.ÿÿø */
$"01FF FFF8 01FF FFF8 01FF FFF8 01FF FFF8" /* .ÿÿø.ÿÿø.ÿÿø.ÿÿø */
$"03FF FFF8 03FF FFF0 03FF FFE0 07FF FF80" /* .ÿÿø.ÿÿð.ÿÿà.ÿÿ*/
$"0FFF FF00 3FFF FC00 3FFF F800 1FFF C000" /* .ÿÿ.?ÿü.?ÿø..ÿÀ. */
$"03FF 8000 007F 0000 000E 0000 0000 0000" /* .ÿ............. */
};
data 'ics#' (128, purgeable) {
$"0000 0000 1FF8 7FFE 7FFE E183 EEEF EEEF" /* .....ø.þ.þáƒîïîï */
$"E1EF EFEF EFEF 7FFE 7FFE 1FF8 0000 0000" /* áïïïïï.þ.þ.ø.... */
$"0000 0000 1FF8 7FFE 7FFE FFFF FFFF FFFF" /* .....ø.þ.þÿÿÿÿÿÿ */
$"FFFF FFFF FFFF 7FFE 7FFE 1FF8 0000 0000" /* ÿÿÿÿÿÿ.þ.þ.ø.... */
};
data 'icl4' (128, purgeable) {
$"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
$"0000 0000 0000 0000 0FFF FFF0 0000 0000" /* .........ÿÿð.... */
$"0000 0000 0000 00FF F000 B00F FFFF FF00" /* .......ÿð.°.ÿÿÿ. */
$"0000 0000 000F FFF0 00B0 00B0 00B0 FF00" /* ......ÿð.°.°.°ÿ. */
$"0000 0000 0FFF FFFF FF00 B000 FFFF BF00" /* .....ÿÿÿÿ.°.ÿÿ¿. */
$"0000 0000 0FBB BBBB BFFF FFFF FB0B 0F00" /* .....»»»¿ÿÿÿû... */
$"0000 0000 0FFB BBBB BBBB BBF0 B0B0 BF00" /* .....û»»»»»ð°°¿. */
$"0000 0000 0FBF FFFF FFBB BFFB 0B0B 0F00" /* .....¿ÿÿÿ»¿û.... */
$"0000 0000 0FBB BBBB BBFF FFF0 B0B0 BF00" /* .....»»»»ÿÿð°°¿. */
$"0000 0000 FFBB BBBB BBBB BF0B 0B0B 0F00" /* ....ÿ»»»»»¿..... */
$"0000 0000 FBBF FFFB BBBB BFB0 B0B0 BF00" /* ....û¿ÿû»»¿°°°¿. */
$"0000 0000 FBBF FFFF FFFB BF0B 0B0B F000" /* ....û¿ÿÿÿû¿...ð. */
$"0000 0000 FBBF 22FF FFFB BFB0 B0B0 F000" /* ....û¿"ÿÿû¿°°°ð. */
$"0000 0000 FBBF F2F2 2FBB FB0B 0B0B F000" /* ....û¿òò/»û...ð. */
$"0000 000F FBFF FFF2 FFBB F0B0 B0B0 F000" /* ....ûÿÿòÿ»ð°°°ð. */
$"0000 000F BBFF FFFF FFBB FB0B 0B0B F000" /* ....»ÿÿÿÿ»û...ð. */
$"0000 000F BBFF 2FFF FFBB F0B0 B0B0 F000" /* ....»ÿ/ÿÿ»ð°°°ð. */
$"0000 000F BBFF 2222 FFBB FB0B 0B0B F000" /* ....»ÿ""ÿ»û...ð. */
$"0000 000F BBFF FFFF FBBF B0B0 B0B0 F000" /* ....»ÿÿÿû¿°°°°ð. */
$"0000 000F BBBB BFFF FBBF 0B0B 0B0B F000" /* ....»»¿ÿû¿....ð. */
$"0000 00FF BBBB BBBB BBBF B0B0 B0B0 F000" /* ...ÿ»»»»»¿°°°°ð. */
$"0000 00FF FFFF BBBB BBBF 0B0B 0B0F 0000" /* ...ÿÿÿ»»»¿...... */
$"0000 00FF FAAF FFFB BBBF B0B0 BFF0 0000" /* ...ÿú¯ÿû»¿°°¿ð.. */
$"0000 0FBF FFFA AAAF FFFB 0B0B F000 0000" /* ...¿ÿúª¯ÿû..ð... */
$"0000 FBBB BBBF FFFA AAF0 B0FF 0000 0000" /* ..û»»¿ÿúªð°ÿ.... */
$"00FF BBCC 0CCB BBFF FF0F 0F00 0000 0000" /* .ÿ»Ì»ÿÿ....... */
$"00FB BB0C CC0C BBBB FFFF F000 0000 0000" /* ».Ì.»»ÿÿð..... */
$"000F FFBB 0CCC 0CCB BF00 0000 0000 0000" /* ..ÿ».Ì.Ë¿....... */
$"0000 00FF FB0C CCFB B000 0000 0000 0000" /* ...ÿû.Ìû°....... */
$"0000 0000 0FFF BBFF 0000 0000 0000 0000" /* .....ÿ»ÿ........ */
$"0000 0000 0000 FFF0 0000 0000 0000 0000" /* ......ÿð........ */
$"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
};
data 'ics4' (128, purgeable) {
$"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
$"000F FFFF FFFF F000 0FFF FFFF FFFF FFF0" /* ..ÿÿÿÿð..ÿÿÿÿÿÿð */
$"0FFF FFFF FFFF FFF0 FFF2 222F F222 22FF" /* .ÿÿÿÿÿÿðÿò"/ò""ÿ */
$"FFF2 FFF2 FFF2 FFFF FFF2 FFF2 FFF2 FFFF" /* ÿòÿòÿòÿÿÿòÿòÿòÿÿ */
$"FFF2 222F FFF2 FFFF FFF2 FFFF FFF2 FFFF" /* ÿò"/ÿòÿÿÿòÿÿÿòÿÿ */
$"FFF2 FFFF FFF2 FFFF 0FFF FFFF FFFF FFF0" /* ÿòÿÿÿòÿÿ.ÿÿÿÿÿÿð */
$"0FFF FFFF FFFF FFF0 000F FFFF FFFF F000" /* .ÿÿÿÿÿÿð..ÿÿÿÿð. */
$"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
};
resource 'FREF' (128, purgeable) {
'APPL',
0,
""
};
resource 'BNDL' (128, purgeable) {
'PLTO',
0, /*resource ID of signature resource: should be 0*/
{
'ICN#', { /*mapping local IDs in 'FREF's to 'ICN#' IDs*/
0, 128 /*'FREF' w/ local ID 0 maps to 'ICN#' res ID 128*/
},
'ics#', { /*mapping local IDs in 'FREF's to 'ICN#' IDs*/
0, 128 /*'FREF' w/ local ID 0 maps to 'ICN#' res ID 128*/
},
'icl4', { /*mapping local IDs in 'FREF's to 'ICN#' IDs*/
0, 128 /*'FREF' w/ local ID 0 maps to 'ICN#' res ID 128*/
},
'ics4', { /*mapping local IDs in 'FREF's to 'ICN#' IDs*/
0, 128 /*'FREF' w/ local ID 0 maps to 'ICN#' res ID 128*/
},
'FREF', { /*local res IDs for 'FREF's: no duplicates*/
0, 128
}
}
};
data 'ppat' (128) {
$"0001 0000 001C 0000 004E 0000 0000 FFFF" /* .........N....ÿÿ */
$"0000 0000 AA55 AA55 AA55 AA55 0000 0000" /* ....ªUªUªUªU.... */
$"8001 0000 0000 0008 0008 0000 0000 0000" /*............... */
$"0000 0048 0000 0048 0000 0000 0001 0001" /* ...H...H........ */
$"0001 0000 0000 0000 0056 0000 0000 AA55" /* .........V....ªU */
$"AA55 AA55 AA55 0000 0000 0000 0001 0000" /* ªUªUªU.......... */
$"FFFF FFFF FFFF 0001 0000 0000 0000" /* ÿÿÿÿÿÿ........ */
};
data 'ppat' (129) {
$"0001 0000 001C 0000 004E 0000 0000 FFFF" /* .........N....ÿÿ */
$"0000 0000 9224 4992 2449 9224 0000 0000" /* ....$I$I$.... */
$"8001 0000 0000 0008 0008 0000 0000 0000" /*............... */
$"0000 0048 0000 0048 0000 0000 0001 0001" /* ...H...H........ */
$"0001 0000 0000 0000 0056 0000 0000 9224" /* .........V....$ */
$"4992 2449 9224 0000 0000 0000 0001 0000" /* I$I$.......... */
$"FFFF FFFF FFFF 0001 0000 0000 0000" /* ÿÿÿÿÿÿ........ */
};
data 'ppat' (130) {
$"0001 0000 001C 0000 004E 0000 0000 FFFF" /* .........N....ÿÿ */
$"0000 0000 DD77 DD77 DD77 DD77 0000 0000" /* ....ÝwÝwÝwÝw.... */
$"8001 0000 0000 0008 0008 0000 0000 0000" /*............... */
$"0000 0048 0000 0048 0000 0000 0001 0001" /* ...H...H........ */
$"0001 0000 0000 0000 0056 0000 0000 DD77" /* .........V....Ýw */
$"DD77 DD77 DD77 0000 0000 0000 0001 0000" /* ÝwÝwÝw.......... */
$"FFFF FFFF FFFF 0001 0000 0000 0000" /* ÿÿÿÿÿÿ........ */
};
data 'ppat' (131) {
$"0001 0000 001C 0000 004E 0000 0000 FFFF" /* .........N....ÿÿ */
$"0000 0000 AAAA AAAA AAAA AAAA 0000 0000" /* ....ªªªªªªªª.... */
$"8001 0000 0000 0008 0008 0000 0000 0000" /*............... */
$"0000 0048 0000 0048 0000 0000 0001 0001" /* ...H...H........ */
$"0001 0000 0000 0000 0056 0000 0000 AAAA" /* .........V....ªª */
$"AAAA AAAA AAAA 0000 0000 0000 0001 0000" /* ªªªªªª.......... */
$"FFFF FFFF FFFF 0001 0000 0000 0000" /* ÿÿÿÿÿÿ........ */
};
data 'ppat' (132) {
$"0001 0000 001C 0000 004E 0000 0000 FFFF" /* .........N....ÿÿ */
$"0000 0000 FF00 FF00 FF00 FF00 0000 0000" /* ....ÿ.ÿ.ÿ.ÿ..... */
$"8001 0000 0000 0008 0008 0000 0000 0000" /*............... */
$"0000 0048 0000 0048 0000 0000 0001 0001" /* ...H...H........ */
$"0001 0000 0000 0000 0056 0000 0000 FF00" /* .........V....ÿ. */
$"FF00 FF00 FF00 0000 0000 0000 0001 0000" /* ÿ.ÿ.ÿ........... */
$"FFFF FFFF FFFF 0001 0000 0000 0000" /* ÿÿÿÿÿÿ........ */
};
data 'ppat' (133) {
$"0001 0000 001C 0000 004E 0000 0000 FFFF" /* .........N....ÿÿ */
$"0000 0000 8822 8822 8822 8822 0000 0000" /* ....ˆ"ˆ"ˆ"ˆ".... */
$"8001 0000 0000 0008 0008 0000 0000 0000" /*............... */
$"0000 0048 0000 0048 0000 0000 0001 0001" /* ...H...H........ */
$"0001 0000 0000 0000 0056 0000 0000 8822" /* .........V....ˆ" */
$"8822 8822 8822 0000 0000 0000 0001 0000" /* ˆ"ˆ"ˆ".......... */
$"FFFF FFFF FFFF 0001 0000 0000 0000" /* ÿÿÿÿÿÿ........ */
};
data 'ppat' (134) {
$"0001 0000 001C 0000 004E 0000 0000 FFFF" /* .........N....ÿÿ */
$"0000 0000 0022 0088 0022 0088 0000 0000" /* .....".ˆ.".ˆ.... */
$"8001 0000 0000 0008 0008 0000 0000 0000" /*............... */
$"0000 0048 0000 0048 0000 0000 0001 0001" /* ...H...H........ */
$"0001 0000 0000 0000 0056 0000 0000 0022" /* .........V....." */
$"0088 0022 0088 0000 0000 0000 0001 0000" /* .ˆ.".ˆ.......... */
$"FFFF FFFF FFFF 0001 0000 0000 0000" /* ÿÿÿÿÿÿ........ */
};
data 'ppat' (135) {
$"0001 0000 001C 0000 004E 0000 0000 FFFF" /* .........N....ÿÿ */
$"0000 0000 00DD 0077 00BD 00ED 0000 0000" /* .....Ý.w.½.í.... */
$"8001 0000 0000 0008 0008 0000 0000 0000" /*............... */
$"0000 0048 0000 0048 0000 0000 0001 0001" /* ...H...H........ */
$"0001 0000 0000 0000 0056 0000 0000 00DD" /* .........V.....Ý */
$"0077 00BD 00ED 0000 0000 0000 0001 0000" /* .w.½.í.......... */
$"FFFF FFFF FFFF 0001 0000 0000 0000" /* ÿÿÿÿÿÿ........ */
};
data 'DLOG' (128) {
$"0028 0028 0108 0119 0003 0100 0000 0000" /* .(.(............ */
$"0000 0080 00" /* .... */
};
data 'DITL' (128) {
$"0007 0000 0000 000D 005B 001D 00A6 8809" /* .......Â.[...¦ˆÆ */
$"504C 4154 4F54 4552 4D00 0000 0000 000E" /* PLATOTERM....... */
$"000B 002E 002B 2002 0080 0000 0000 0026" /* .....+ .......& */
$"0047 0037 00BA 8810 4120 504C 4154 4F20" /* .G.7.ºˆ.A PLATO */
$"5465 726D 696E 616C 0000 0000 0040 003D" /* Terminal.....@.= */
$"004F 00C3 8812 466F 7220 796F 7572 204D" /* .O.È.For your M */
$"6163 696E 746F 7368 0000 0000 006C 0034" /* acintosh.....l.4 */
$"008F 00CC 8827 5468 6F6D 6173 2043 6865" /* .<2E>.̈'Thomas Che */
$"7272 7968 6F6D 6573 0D20 2020 2020 2020" /* rryhomes */
$"2020 5374 6576 6520 5065 6C74 7A00 0000" /* Steve Peltz... */
$"0000 00C1 0067 00D5 00A1 0402 4F4B 0000" /* ...Á.g.Õ.¡..OK.. */
$"0000 0055 0072 0068 008F 8802 4279 0000" /* ...U.r.h.<EFBFBD>ˆ.By.. */
$"0000 0095 0021 00B7 00DF 8837 436F 7079" /* ....!.·ˆ7Copy */
$"6C65 6674 2032 3031 3820 4952 4154 412E" /* left 2018 IRATA. */
$"4F4E 4C49 4E45 0D53 6565 2066 696C 6520" /* ONLINEÂSee file */
$"434F 5059 494E 4720 666F 7220 6465 7461" /* COPYING for deta */
$"696C 7300" /* ils. */
};
data 'cicn' (128) {
$"0000 0000 8010 0000 0000 0020 0020 0000" /* .......... . .. */
$"0000 0000 0000 0048 0000 0048 0000 0000" /* .......H...H.... */
$"0004 0001 0004 0000 0000 0000 0000 0000" /* ................ */
$"0000 0000 0000 0004 0000 0000 0020 0020" /* ............. . */
$"0000 0000 0004 0000 0000 0020 0020 0000" /* ........... . .. */
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF" /* ..ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ */
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" /* ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ */
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" /* ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ */
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" /* ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ */
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" /* ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ */
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" /* ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ */
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" /* ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ */
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" /* ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ */
$"FFFF 0000 0000 0000 7E00 0003 89FC 001E" /* ÿÿ......~...‰ü.. */
$"222C 007F C8F4 0055 7F84 007A AA04 005F" /* ",..Èô.U..zª.._ */
$"D604 006A BE04 00D5 5404 00BE AC04 00DF" /* Ö..j¾..ÕT..¾¬..ß */
$"F408 00BF EC08 00DF D808 01BF E808 017F" /* ô..¿ì..ßØ..¿è... */
$"D808 01BF E808 017F D808 01BF B008 0157" /* Ø..¿è...Ø..¿°..W */
$"D008 03AA B008 03F5 5010 031E B060 05E1" /* Ð..ª°..õP...°`.á */
$"E080 091E 2300 3223 D400 2444 F800 1C89" /* à€Æ.#.2#Ô.$Dø..‰ */
$"4000 0392 8000 0075 0000 000E 0000 0000" /* @..’€..u........ */
$"0000 0000 0000 0000 0005 0000 FFFF FFFF" /* ............ÿÿÿÿ */
$"FFFF 0001 FFFF 6666 3333 0002 CCCC CCCC" /* ÿÿ..ÿÿff33..ÌÌÌÌ */
$"CCCC 0003 7777 7777 7777 0004 2222 2222" /* ÌÌ..wwwwww.."""" */
$"2222 000F 0000 0000 0000 0000 0000 0000" /* "".............. */
$"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
$"0000 0FFF FFF0 0000 0000 0000 0000 0000" /* ...ÿÿð.......... */
$"00FF F000 300F FFFF FF00 0000 0000 000F" /* .ÿð.0.ÿÿÿ....... */
$"FFF0 0030 0030 0030 FF00 0000 0000 0FFF" /* ÿð.0.0.0ÿ......ÿ */
$"FFFF FF00 3000 FFFF 3F00 0000 0000 0F33" /* ÿÿÿ.0.ÿÿ?......3 */
$"3333 3FFF FFFF F303 0F00 0000 0000 0FF3" /* 33?ÿÿÿó........ó */
$"3333 3333 33F0 3030 3F00 0000 0000 0F3F" /* 33333ð00?......? */
$"FFFF FF33 3FF3 0303 0F00 0000 0000 0F33" /* ÿÿÿ3?ó.........3 */
$"3333 33FF FFF0 3030 3F00 0000 0000 FF33" /* 333ÿÿð00?.....ÿ3 */
$"3333 3333 3F03 0303 0F00 0000 0000 F33F" /* 3333?.........ó? */
$"FFF3 3333 3F30 3030 3F00 0000 0000 F33F" /* ÿó33?000?.....ó? */
$"FFFF FFF3 3F03 0303 F000 0000 0000 F33F" /* ÿÿÿó?...ð.....ó? */
$"11FF FFF3 3F30 3030 F000 0000 0000 F33F" /* .ÿÿó?000ð.....ó? */
$"F1F1 1F33 F303 0303 F000 0000 000F F3FF" /* ññ.3ó...ð.....óÿ */
$"FFF1 FF33 F030 3030 F000 0000 000F 33FF" /* ÿñÿ3ð000ð.....3ÿ */
$"FFFF FF33 F303 0303 F000 0000 000F 33FF" /* ÿÿÿ3ó...ð.....3ÿ */
$"1FFF FF33 F030 3030 F000 0000 000F 33FF" /* .ÿÿ3ð000ð.....3ÿ */
$"1111 FF33 F303 0303 F000 0000 000F 33FF" /* ..ÿ3ó...ð.....3ÿ */
$"FFFF F33F 3030 3030 F000 0000 000F 3333" /* ÿÿó?0000ð.....33 */
$"3FFF F33F 0303 0303 F000 0000 00FF 3333" /* ?ÿó?....ð....ÿ33 */
$"3333 333F 3030 3030 F000 0000 00FF FFFF" /* 333?0000ð....ÿÿÿ */
$"3333 333F 0303 030F 0000 0000 00FF F44F" /* 333?.........ÿôO */
$"FFF3 333F 3030 3FF0 0000 0000 0F3F FFF4" /* ÿó3?00?ð.....?ÿô */
$"444F FFF3 0303 F000 0000 0000 F333 333F" /* DOÿó..ð.....ó33? */
$"FFF4 44F0 30FF 0000 0000 00FF 3322 0223" /* ÿôDð0ÿ.....ÿ3".# */
$"33FF FF0F 0F00 0000 0000 00F3 3302 2202" /* 3ÿÿ........ó3.". */
$"3333 FFFF F000 0000 0000 000F FF33 0222" /* 33ÿÿð.......ÿ3." */
$"0223 3F00 0000 0000 0000 0000 00FF F302" /* .#?..........ÿó. */
$"22F3 3000 0000 0000 0000 0000 0000 0FFF" /* "ó0............ÿ */
$"33FF 0000 0000 0000 0000 0000 0000 0000" /* 3ÿ.............. */
$"FFF0 0000 0000 0000 0000 0000 0000 0000" /* ÿð.............. */
$"0000 0000 0000 0000 0000" /* .......... */
};
data 'ICON' (128) {
$"0000 0000 0000 7E00 0003 89FC 001E 222C" /* ......~...‰ü..", */
$"007F C8F4 0055 7F84 007A AA04 005F D604" /* ..Èô.U..zª.._Ö. */
$"006A BE04 00D5 5404 00BE AC04 00DF F408" /* .j¾..ÕT..¾¬..ßô. */
$"00BF EC08 00DF D808 01BF E808 017F D808" /* .¿ì..ßØ..¿è...Ø. */
$"01BF E808 017F D808 01BF B008 0157 D008" /* .¿è...Ø..¿°..WÐ. */
$"03AA B008 03F5 5010 031E B060 05E1 E080" /* °..õP...°`.áà*/
$"091E 2300 3223 D400 2444 F800 1C89 4000" /* Æ.#.2#Ô.$Dø..‰@. */
$"0392 8000 0075 0000 000E 0000 0000 0000" /* ...u.......... */
};

175
README.md Normal file
View File

@ -0,0 +1,175 @@
PLATOTerm for Classic Macintosh
===============================
PLATOTerm is a terminal emulator to access CYBIS services now available
on the Internet utilizing a WIFI Modem.
For the purposes of this documentation. PLATO and CYBIS are interchangeable
names for the same platform.
Requirements
------------
* Classic 68000 or PPC based Apple Macintosh
* 1MB of RAM
* System 6.0.3 or greater
* WIFI Modem or computer acting as WIFI modem, attached to MODEM port
--------------------------------------------------------------
What services are currently available to access via PLATOTerm?
--------------------------------------------------------------
As of writing this preliminary documentation (February 2019), there are
two major CYBIS systems running. CYBER1.ORG and IRATA.ONLINE.
---------------------------
WHAT IS PLATO? (aka CYBIS?)
---------------------------
(from the PLATO wikipedia page:)
PLATO (Programmed Logic for Automatic Teaching Operations), was the first
generalized computer-asisted instruction system. Starting in 1960, it ran
on the University of Illinois ILLIAC I computer. By the late 1970s, it
supported several thousand graphics terminals distributed worldwide, running
on nearly a dozen different networked mainframe computers. Many modern
concepts in multi-user computing were originally developed on PLATO, including
forums, message boards, online testing, e-mail, chat rooms, picture languages,
instant messaging, remote screen sharing, and multi-player games.
-------------------
What is CYBER1.ORG?
-------------------
CYBER1.ORG is a CYBIS system initially set up in 2004, as a haven for
ex-PLATO users to experience a classic PLATO author experience.
CYBER1.ORG is home to many thousands of classic PLATO lessons and
notesfiles which have been restored from various sources, and have
been made available in the interests of preserving PLATO.
---------------------
What is IRATA.ONLINE?
---------------------
IRATA.ONLINE is a CYBIS system that has been set up for the benefit of
the greater vintage computing community, in the interest to provide
a unique experience that can be accessed on a wide variety of
vintage computers with a bitmapped graphics display. To this end,
IRATA.ONLINE develops PLATOTerm for dozens of platforms, so that they
can access CYBIS systems, as well as provide a community and learning
infrastructure for vintage computing users of all types, in the hopes
that as a cohesive community, something unique can hopefully
emerge.
-----------------------------------------------------------
What is the connection between IRATA.ONLINE and CYBER1.ORG?
-----------------------------------------------------------
CYBER1.ORG and IRATA.ONLINE are independent of one another. With that said,
the reason IRATA.ONLINE and PLATOTerm exist, are because of the efforts of
CYBER1.ORG to not only preserve a running PLATO system, and provide the
necessary information for interested parties to write terminal software
to access CYBIS systems, but also in their effort to produce a publically
available distribution of CYBIS that others who are interested may also
run their own CYBIS installation. IRATA.ONLINE is a direct result of the
public release of this distribution.
Loading PLATOTerm
-----------------
PLATOTerm can be loaded by clicking on the PLATOTerm icon from the Finder.
Default Settings
----------------
This Pre-release version of PLATOTerm99 is configured for the following settings:
* MODEM port
* 57600 Baud
* No Parity
* 8 Data Bits
* 1 Stop Bit
Connecting to IRATA.ONLINE
--------------------------
Once PLATOTerm is started, you can connect to CYBER1.ORG using your WIFI modem,
using a command such as:
```
ATDTIRATA.ONLINE:8005
```
Connecting to CYBER1.ORG
------------------------
Once PLATOTerm is started, you can connect to CYBER1.ORG using your WIFI modem,
using a command such as:
```
ATDTCYBERSERV.ORG:8005
```
PLATO Keyboard
-------------------
The PLATO keyboard is mapped to the Atari keys, like so:
(TODO: Map all the keys)
| PLATO KEY | X68000 Key |
|--- |--- |
| ANS | CTRL A |
| BACK | CTRL B |
| SHIFT-BACK | SHIFT CTRL B |
| COPY | CTRL C |
| SHIFT-COPY | SHIFT CTRL 1 |
| DATA | CTRL D |
| SHIFT-DATA | SHIFT CTRL D |
| EDIT | CTRL E |
| SHIFT-EDIT | SHIFT CTRL E |
| ERASE | BACKSPACE |
| SHIFT-ERASE | SHIFT BACKSPACE |
| FONT | CTRL F |
| &#247; | CTRL G |
| HELP | CTRL H |
| SHIFT-HELP | SHIFT CTRL H |
| LAB | CTRL L |
| SHIFT-LAB | SHIFT CTRL L |
| MICRO | CTRL M |
| NEXT | ENTER |
| SHIFT-NEXT | SHIFT ENTER |
| SUPER | CTRL P |
| SHIFT-SUPER | SHIFT CTRL P |
| SQUARE | CTRL Q |
| ACCESS | SHIFT CTRL Q |
| STOP | CTRL S |
| SHIFT-STOP | SHIFT CTRL S |
| TERM | CTRL T |
| &#215; | CTRL X |
| SUB | CTRL Y |
| SHIFT-SUB | SHIFT CTRL Y |
| SIGMA | CTRL + |
| DELTA | CTRL - |
| ASSIGN | ESC |
| UNION | SHIFT CTRL + |
| INTERSECT | SHIFT CTRL - |
TTY Mode Keys
-------------
In addition, the following keys are available in TTY mode:
| Key | Function |
|--- |--- |
| Command-P | PLATO Mode |
| Command-T | TTY Mode |
| Command-Q | Quit |
| Command-H| Hang Up |
| Command-3 | 300 Baud |
| Command-1 | 1200 Baud |
| Command-2 | 2400 Baud |
| Command-6 | 9600 Baud |
| Command-9 | 19200 Baud |
| Command-8 | 38400 Baud |
| Command-7 | 57600 Baud |
Credits
=======
* '''Thomas Cherryhomes''' - Terminal coding, sleepless nights.
* '''Steve Peltz''' - original PAD protocol decoder from MacPAD.

26
config.c Normal file
View File

@ -0,0 +1,26 @@
#include "config.h"
#define true 1
#define false 0
ConfigInfo config;
void config_set_defaults(void)
{
config.baud=baud57600;
}
void config_init(void)
{
config_load();
}
void config_load(void)
{
config_set_defaults();
}
void config_save(void)
{
}

11
config.h Normal file
View File

@ -0,0 +1,11 @@
#include <Serial.h>
typedef struct _configInfo {
int baud;
} ConfigInfo;
void config_init(void);
void config_load(void);
void config_save(void);

26
io.c
View File

@ -1,8 +1,10 @@
#include <Devices.h>
#include <Serial.h>
#include <OSUtils.h>
#include "io.h"
#include "protocol.h"
#include "terminal.h"
#include "config.h"
#define true 1
#define false 0
@ -10,12 +12,14 @@
#define SERIAL_BUFFER_SIZE 16000
extern unsigned char trace_active;
extern ConfigInfo config;
extern void done(void);
short driverIn;
short driverOut;
SerShk handshake;
Ptr serial_buffer;
CntrlParam paramBlock;
void io_init(void)
{
@ -25,19 +29,16 @@ void io_init(void)
done();
handshake.fXOn=0;
handshake.fCTS=0;
handshake.fCTS=1;
handshake.errs=0;
handshake.evts=0;
handshake.fInX=0;
SerHShake(driverIn,&handshake);
SerReset(driverOut,baud1200+stop10+noParity+data8);
io_set_baud(config.baud);
serial_buffer=NewPtr(SERIAL_BUFFER_SIZE);
if (serial_buffer!=noErr)
done();
SerSetBuf(driverIn,serial_buffer,SERIAL_BUFFER_SIZE);
SerSetBuf(driverIn,serial_buffer,SERIAL_BUFFER_SIZE);
}
void io_send_byte(unsigned char b)
@ -74,6 +75,13 @@ void io_send_string(const char* str, int len)
*/
void io_set_baud(int baud)
{
SerReset(driverOut,baud+stop10+noParity+data8);
paramBlock.ioCRefNum=driverIn;
paramBlock.csCode=kSERDHandshakeRS232;
PBControl((ParmBlkPtr)&paramBlock,false);
paramBlock.csCode=kSERDAssertDTR;
PBControl((ParmBlkPtr)&paramBlock,false);
config.baud=baud;
}
/**
@ -81,6 +89,11 @@ void io_set_baud(int baud)
*/
void io_hang_up(void)
{
paramBlock.csCode=kSERDNegateDTR;
PBControl((ParmBlkPtr)&paramBlock,false);
Delay(100,NULL);
paramBlock.csCode=kSERDAssertDTR;
PBControl((ParmBlkPtr)&paramBlock,false);
}
/**
@ -108,6 +121,7 @@ void io_done()
{
if (serial_buffer!=NULL)
{
io_hang_up();
SerSetBuf(driverIn,NULL,0);
DisposePtr(serial_buffer);
serial_buffer=NULL;

2
key.h
View File

@ -14,7 +14,7 @@ int key_to_pkey[]={
PKEY_NOKEY, /* 0x05 CTRL-E */
PKEY_NOKEY, /* 0x06 CTRL-F */
PKEY_NOKEY, /* 0x07 CTRL-G */
PKEY_NOKEY, /* 0x08 CTRL-H */
PKEY_ERASE, /* 0x08 CTRL-H */
PKEY_TAB, /* 0x09 CTRL-I */
PKEY_NOKEY, /* 0x0a CTRL-J */
PKEY_NOKEY, /* 0x0b CTRL-K */

View File

@ -4,6 +4,7 @@
#include "io.h"
#include "screen.h"
#include "trace.h"
#include "terminal.h"
#define true 1
#define false 0
@ -32,19 +33,73 @@ void keyboard_out(int platoKey)
void keyboard_main(EventRecord* e)
{
unsigned char key;
unsigned char code;
key=e->message&0x7F;
code=((e->message)>>8)&0x7F;
if (TTY)
{
keyboard_out_tty(key);
if (e->modifiers & cmdKey)
{
if (key=='h')
{
TTY=padT;
io_hang_up();
}
else if (key=='t')
{
terminal_set_tty();
}
else if (key=='p')
{
terminal_set_plato();
}
}
else
keyboard_out_tty(key);
}
else
{
if (e->modifiers & 4096) /* CTRL key*/
if (e->modifiers & cmdKey)
{
if (key=='h')
{
terminal_set_tty();
io_hang_up();
}
else if (key=='t')
{
terminal_set_tty();
}
else if (key=='p')
{
terminal_set_plato();
}
}
else if (e->modifiers & 4096) /* CTRL key*/
{
if (e->modifiers & 512)
key|=0x80;
keyboard_out(ctrl_key_to_pkey[key]);
}
else if ((e->modifiers & 512) && key==0x0d)
{
keyboard_out(PKEY_NEXT1);
}
else if ((e->modifiers & 512) && key==0x08)
{
keyboard_out(PKEY_ERASE1);
}
else if ((e->modifiers & 4096) && code==0x04)
{
if (e->modifiers & 512)
keyboard_out(PKEY_HELP1);
else
keyboard_out(PKEY_HELP);
}
else if ((e->modifiers & 4096) && code==0x2E)
{
keyboard_out(PKEY_MICRO);
}
else
keyboard_out(key_to_pkey[key]);
}

6
main.c
View File

@ -5,7 +5,7 @@
#include "keyboard.h"
#include "touch.h"
#include "splash.h"
#include "help.h"
#include "config.h"
#define true 1
#define false 0
@ -22,19 +22,21 @@ void done(void)
void main(void)
{
config_init();
screen_init();
touch_init();
help_init();
NoEcho=padT;
ShowPLATO(splash,sizeof(splash));
NoEcho=padF;
terminal_initial_position();
io_init();
screen_update_menus();
running=true;
while (running==true)
{
screen_main(); /* keyboard_main() and touch_main() are called in here. */
io_main();
}
done();
}

588
screen.c
View File

@ -9,11 +9,15 @@
#include <NumberFormatting.h>
#include <Devices.h>
#include <Palettes.h>
#include <Gestalt.h>
#include "screen.h"
#include "font.h"
#include "protocol.h"
#include "io.h"
#include "keyboard.h"
#include "touch.h"
#include "config.h"
#include "terminal.h"
#define true 1
#define false 0
@ -37,6 +41,36 @@ SysEnvRec environment;
Handle menuBar;
RGBColor current_foreground;
RGBColor current_background;
int windowWidth;
int windowHeight;
static AEEventHandlerUPP oappUPP, odocUPP, pdocUPP, quitUPP;
extern unsigned char running;
static long sysv;
extern void done(void);
extern ConfigInfo config;
/* Apple Event Handler callbacks */
static pascal OSErr AEOpenApplication(const AppleEvent *theAE, AppleEvent *reply, UInt32 refCon)
{
return noErr;
}
static pascal OSErr AEOpenDocuments(const AppleEvent *theAE, AppleEvent *reply, UInt32 refCon)
{
return errAEEventNotHandled;
}
static pascal OSErr AEPrintDocuments(const AppleEvent *theAE, AppleEvent *reply, UInt32 refCon)
{
return errAEEventNotHandled;
}
static pascal OSErr AEQuitApplication(const AppleEvent *theAE, AppleEvent *reply, UInt32 refCon)
{
running=false;
return noErr;
}
/**
* screen_init() - Set up the screen
@ -48,7 +82,24 @@ void screen_init(void)
InitWindows();
InitMenus();
InitPalettes();
TEInit();
InitDialogs(NULL);
InitCursor();
/* Attach Apple Event handler callbacks */
Gestalt('sysv',&sysv);
if (sysv>0x6FF)
{
oappUPP = NewAEEventHandlerUPP(AEOpenApplication);
AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, oappUPP, 0L, false);
odocUPP = NewAEEventHandlerUPP(AEOpenDocuments);
AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, odocUPP, 0L, false);
pdocUPP = NewAEEventHandlerUPP(AEPrintDocuments);
AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, pdocUPP, 0L, false);
quitUPP = NewAEEventHandlerUPP(AEQuitApplication);
AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, quitUPP, 0L, false);
}
current_foreground.red=255;
current_foreground.green=255;
current_foreground.blue=255;
@ -62,7 +113,7 @@ void screen_init(void)
screenRect=qd.screenBits.bounds;
windowRect.left=0;
windowRect.right=511;
windowRect.right=512;
/* Set window size depending on screen size. */
if (screenRect.bottom < 468)
@ -70,12 +121,14 @@ void screen_init(void)
/* Mac Plus sized screen */
windowRect.top=20;
windowRect.bottom=windowRect.top+320;
CharHigh=10;
}
else if (screenRect.bottom < 532)
{
/* 640x480 screen */
windowRect.top=20;
windowRect.bottom=windowRect.top+448;
CharHigh=14;
}
else
{
@ -86,6 +139,8 @@ void screen_init(void)
windowRect.right+=5; /* scooch */
}
windowWidth=windowRect.right-windowRect.left;
windowHeight=windowRect.bottom-windowRect.top;
verticalScaleFactor=((double)windowRect.bottom-(double)windowRect.top)/(double)512.0;
if (SysEnvirons(1,&environment) == noErr)
@ -94,23 +149,78 @@ void screen_init(void)
is_mono=true;
if (is_mono==true)
{
win = NewWindow(NULL, &windowRect, "\pPLATOTerm", true, 0, (WindowPtr)-1, false, 0);
}
win = NewWindow(NULL, &windowRect, "\pPLATOTerm", true, 0, (WindowPtr)-1, false, 0);
else
{
win = NewCWindow(NULL, &windowRect, "\pColor PLATOTerm", true, 0, (WindowPtr)-1, false, 0);
}
win = NewCWindow(NULL, &windowRect, "\pColor PLATOTerm", true, 0, (WindowPtr)-1, false, 0);
SetPort(win);
}
/**
* screen_about_dialog() - Do dialog box
*/
void screen_about_dialog(void)
{
DialogPtr dlg = GetNewDialog(128,0,(WindowPtr)-1);
short item;
while (item != 6)
{
ModalDialog(NULL, &item);
}
DisposeDialog(dlg);
}
/**
* screen_update_menus() - Update menu state
*/
void screen_update_menus(void)
{
int i;
/* Update PLATO/TTY mode selector. */
CheckItem(GetMenuHandle(129),1,false);
CheckItem(GetMenuHandle(129),2,false);
if (TTY)
{
CheckItem(GetMenuHandle(129),2,true);
}
else
{
CheckItem(GetMenuHandle(129),1,true);
}
/* Update baud rate selector. */
for (i=1;i<8;i++)
{
CheckItem(GetMenuHandle(131),i,false);
}
switch (config.baud)
{
case 300:
CheckItem(GetMenuHandle(131),1,true);
break;
case 1200:
CheckItem(GetMenuHandle(131),2,true);
break;
case 2400:
CheckItem(GetMenuHandle(131),3,true);
break;
case 9600:
CheckItem(GetMenuHandle(131),4,true);
break;
case 19200:
CheckItem(GetMenuHandle(131),5,true);
break;
case 38400:
CheckItem(GetMenuHandle(131),6,true);
break;
case 57600:
CheckItem(GetMenuHandle(131),7,true);
break;
}
}
/**
@ -126,6 +236,7 @@ void screen_menu_command(long menu_command)
{
if(menuItem == 1)
{
screen_about_dialog();
}
else
{
@ -137,14 +248,75 @@ void screen_menu_command(long menu_command)
{
switch(menuItem)
{
case 1:
ExitToShell();
terminal_set_plato();
break;
case 2:
terminal_set_tty();
break;
case 4:
io_hang_up();
break;
case 5:
done();
break;
}
}
else if (menuID == 131)
{
switch(menuItem)
{
case 1:
io_set_baud(300);
break;
case 2:
io_set_baud(1200);
break;
case 3:
io_set_baud(2400);
break;
case 4:
io_set_baud(9600);
break;
case 5:
io_set_baud(19200);
break;
case 6:
io_set_baud(38400);
break;
case 7:
io_set_baud(57600);
break;
}
}
HiliteMenu(0);
screen_update_menus();
}
/**
* screen_handle_touch(where) - Handle touch events
*/
void screen_handle_touch(Point* where)
{
padPt temp;
SetPort(win);
GlobalToLocal(where);
temp.x = ((long)where->h * PLATOSize.x) / windowWidth;
temp.y = (PLATOSize.y - 1) - (((long)where->v * PLATOSize.y) /
windowHeight);
touch_main(&temp);
}
/**
* screen_show_cursor - Hide mouse cursor
*/
void screen_show_cursor(padBool show)
{
if (show==padT)
ShowCursor();
else if (show==padF)
ObscureCursor();
}
/**
@ -173,7 +345,10 @@ void screen_main(void)
screen_menu_command(MenuSelect(theEvent.where));
break;
case inContent:
SelectWindow(currentWindow);
if (FrontWindow()!=currentWindow)
SelectWindow(currentWindow);
else
screen_handle_touch(&theEvent.where);
break;
case inSysWindow:
SystemClick(&theEvent,currentWindow);
@ -181,10 +356,15 @@ void screen_main(void)
}
case keyDown:
case autoKey:
screen_show_cursor(padF);
keyboard_main(&theEvent);
break;
case updateEvt:
/* To be implemented, somehow... */
BeginUpdate((WindowPtr)theEvent.message);
EndUpdate((WindowPtr)theEvent.message);
case kHighLevelEvent:
if (sysv>0x6FF)
AEProcessAppleEvent(&theEvent);
break;
}
}
@ -219,6 +399,7 @@ void screen_wait(void)
*/
void screen_beep(void)
{
SysBeep(5);
}
/**
@ -318,213 +499,137 @@ void screen_line_draw(padPt* Coord1, padPt* Coord2)
*/
void screen_char_draw(padPt* Coord, unsigned char* ch, unsigned char count)
{
short offset; /* due to negative offsets */
unsigned short x; /* Current X and Y coordinates */
unsigned short y;
unsigned short* px; /* Pointers to X and Y coordinates used for actual plotting */
unsigned short* py;
unsigned char i; /* current character counter */
unsigned char a; /* current character byte */
unsigned char j,k; /* loop counters */
char b; /* current character row bit signed */
unsigned char width=8;
unsigned char height=16;
unsigned char FONT_SIZE_X=8;
unsigned char FONT_SIZE_Y=16;
unsigned short deltaX=1;
unsigned short deltaY=1;
RGBColor mainColor;
RGBColor altColor;
unsigned char *p;
unsigned char* curfont;
switch(CurMem)
{
case M0:
curfont=font;
offset=-32;
break;
case M1:
curfont=font;
offset=64;
break;
case M2:
curfont=fontm23;
offset=-32;
break;
case M3:
curfont=fontm23;
offset=32;
break;
}
BitMap drawMap;
char drawBits[64][16];
char* chPt;
char* drawFrom;
char* drawTo;
int offset;
short Mode;
Point charSize;
Rect fromRect;
Rect toRect;
int chNum;
int direction;
int row;
SetPort(win);
if (CurMode==ModeRewrite)
{
altColor.red=current_background.red;
altColor.green=current_background.green;
altColor.blue=current_background.blue;
}
else if (CurMode==ModeInverse)
{
altColor.red=current_foreground.red;
altColor.green=current_foreground.green;
altColor.blue=current_foreground.blue;
/* Set up staging bitmap */
drawMap.baseAddr=&drawBits[0][0];
drawMap.rowBytes=64;
drawMap.bounds.top=0;
drawMap.bounds.bottom=16;
drawMap.bounds.left=0;
drawMap.bounds.right=512;
}
if (CurMode==ModeErase || CurMode==ModeInverse)
/* Select appropriate font memory */
switch (CurMem)
{
mainColor.red=current_background.red;
mainColor.green=current_background.green;
mainColor.blue=current_background.blue;
}
else
{
mainColor.red=current_foreground.red;
mainColor.green=current_foreground.green;
mainColor.blue=current_foreground.blue;
case M0:
chPt = font;
offset = -32;
break;
case M1:
chPt = font;
offset = 64;
break;
case M2:
chPt = fontm23;
offset = -32;
break;
case M3:
chPt = fontm23;
offset = 32;
break;
}
x=screen_scale_x(Coord->x&0x1FF);
/* Select appropriate bitmap transfer mode */
switch(CurMode)
{
case ModeWrite:
Mode = srcOr;
break;
case ModeRewrite:
Mode = srcCopy;
break;
case ModeErase:
Mode = srcBic;
break;
case ModeInverse:
Mode = notSrcCopy;
break;
}
/* Set up character size */
charSize.h = CharWide;
charSize.v = CharHigh;
if (ModeBold)
y=screen_scale_y((Coord->y)+30&0x1FF);
else
y=screen_scale_y((Coord->y)+15&0x1FF);
if (FastText==padF)
{
goto chardraw_with_fries;
charSize.h<<=1;
charSize.v<<=1;
}
/* the diet chardraw routine - fast text output. */
for (i=0;i<count;++i)
/* Set up transfer rects */
fromRect.top=0;
fromRect.bottom=16;
fromRect.left=0;
fromRect.right = count << 3;
toRect.bottom = screen_scale_y(Coord->y+1);
toRect.top = toRect.bottom - charSize.v;
if (Reverse)
{
a=*ch;
++ch;
a+=offset;
p=&curfont[FONTPTR(a)];
for (j=0;j<FONT_SIZE_Y;++j)
{
b=*p;
for (k=0;k<FONT_SIZE_X;++k)
{
if (b<0) /* check sign bit. */
{
RGBForeColor(&mainColor);
MoveTo(x,y);
Line(0,0);
}
++x;
b<<=1;
}
++y;
x-=width;
++p;
}
x+=width;
y-=height;
chNum = count - 1;
direction = -1;
toRect.right = screen_scale_x(Coord->x);
toRect.left = toRect.right - charSize.h * count;
}
else /* forward */
{
chNum=0;
direction = 1;
toRect.left = screen_scale_x(Coord->x);
toRect.right = toRect.left + charSize.h * count;
}
return;
chardraw_with_fries:
if (Rotate)
/* plot the bitmap. */
while (count--)
{
deltaX=-abs(deltaX);
width=-abs(width);
px=&y;
py=&x;
}
else
{
px=&x;
py=&y;
}
if (ModeBold)
{
deltaX = deltaY = 2;
width<<=1;
height<<=1;
}
for (i=0;i<count;++i)
{
a=*ch;
++ch;
a+=offset;
p=&curfont[FONTPTR(a)];
for (j=0;j<FONT_SIZE_Y;++j)
{
b=*p;
if (Rotate)
{
px=&y;
py=&x;
}
else
{
px=&x;
py=&y;
}
for (k=0;k<FONT_SIZE_X;++k)
{
if (b<0) /* check sign bit. */
{
if (ModeBold)
{
RGBForeColor(&mainColor);
MoveTo(*px+1,*py);
Line(0,0);
MoveTo(*px,*py+1);
Line(0,0);
MoveTo(*px+1,*py+1);
Line(0,0);
}
MoveTo(*px,*py);
}
else
{
if (CurMode==ModeInverse || CurMode==ModeRewrite)
{
if (ModeBold)
{
RGBForeColor(&altColor);
MoveTo(*px+1,*py);
MoveTo(*px,*py+1);
MoveTo(*px+1,*py+1);
}
MoveTo(*px,*py);
}
}
x += deltaX;
b<<=1;
}
y+=deltaY;
x-=width;
++p;
}
Coord->x+=width;
x+=width;
y-=height;
drawFrom = chPt + ((*ch++ + offset) << 4);
drawTo = &drawBits[0][chNum];
chNum+=direction;
for (row=1; row <= 16; row++)
{
*drawTo = *drawFrom++;
drawTo += 64;
}
}
return;
/* Finally, blit it to the window. */
CopyBits(&drawMap, &(win->portBits), &fromRect, &toRect, Mode, NULL);
if (toRect.top < 0)
{
toRect.top = windowHeight;
toRect.bottom+=windowHeight;
CopyBits(&drawMap, &(win->portBits), &fromRect, &toRect, Mode, NULL);
}
if (toRect.right > windowWidth)
{
toRect.right -= windowWidth;
toRect.left -= windowWidth;
CopyBits(&drawMap, &(win->portBits), &fromRect, &toRect, Mode, NULL);
if (toRect.bottom > windowHeight)
{
toRect.bottom -= windowHeight;
toRect.top -= windowHeight;
CopyBits(&drawMap, &(win->portBits), &fromRect, &toRect, Mode, NULL);
}
}
}
/**
@ -595,6 +700,83 @@ unsigned char screen_pixel_colors_same(RGBColor* firstColor, RGBColor* secondCol
* screen_paint - Called to paint at location.
*/
void screen_paint(padPt* Coord)
{
if (is_mono==1)
screen_mono_paint(Coord);
else
screen_color_paint(Coord);
}
/**
* color_screen_paint - Called to paint at location.
*/
void screen_mono_paint(padPt* Coord)
{
/* static unsigned short xStack[512]; */
/* static unsigned short yStack[512]; */
/* int x=screen_scale_x(Coord->x); */
/* int y=screen_scale_y(Coord->y); */
/* unsigned char stackentry = 1; */
/* unsigned short spanAbove, spanBelow; */
/* unsigned char oldColor=GetPixel(x,y); */
/* if (oldColor==1) */
/* return; */
/* do */
/* { */
/* unsigned short startx; */
/* while (x > 0 && GetPixel(x-1,y)==oldColor) */
/* --x; */
/* spanAbove = spanBelow = false; */
/* startx=x; */
/* while(GetPixel(x,y)==oldColor) */
/* { */
/* if (y < (512)) */
/* { */
/* unsigned char belowColor=GetPixel(x,y); */
/* if (!spanBelow && belowColor==oldColor) */
/* { */
/* xStack[stackentry] = x; */
/* yStack[stackentry] = y+1; */
/* ++stackentry; */
/* spanBelow = true; */
/* } */
/* else if (spanBelow && belowColor!=oldColor) */
/* spanBelow = false; */
/* } */
/* if (y > 0) */
/* { */
/* unsigned char aboveColor=GetPixel(x,y); */
/* if (!spanAbove && aboveColor==oldColor) */
/* { */
/* xStack[stackentry] = x; */
/* yStack[stackentry] = y-1; */
/* ++stackentry; */
/* spanAbove = true; */
/* } */
/* else if (spanAbove && aboveColor!=oldColor) */
/* spanAbove = false; */
/* } */
/* ++x; */
/* } */
/* MoveTo(startx,y); */
/* LineTo(x-1,y); */
/* --stackentry; */
/* x = xStack[stackentry]; */
/* y = yStack[stackentry]; */
/* } */
/* while (stackentry); */
}
/**
* color_screen_paint - Called to paint at location.
*/
void screen_color_paint(padPt* Coord)
{
static unsigned short xStack[512];
static unsigned short yStack[512];
@ -603,6 +785,7 @@ void screen_paint(padPt* Coord)
unsigned char stackentry = 1;
unsigned short spanAbove, spanBelow;
RGBColor oldColor;
GetCPixel(x,y,&oldColor);
if ((oldColor.red == current_foreground.red) &&
@ -668,4 +851,5 @@ void screen_paint(padPt* Coord)
*/
void screen_done(void)
{
ExitToShell();
}

View File

@ -27,6 +27,10 @@ void screen_update_menus(void);
*/
void screen_menu_command(long menu_command);
/**
* screen_show_cursor - Hide mouse cursor
*/
void screen_show_cursor(padBool show);
/**
* screen_main(void)
@ -115,9 +119,14 @@ void screen_foreground(padRGB* theColor);
void screen_background(padRGB* theColor);
/**
* screen_paint - Called to paint at location.
* color_screen_paint - Called to paint at location.
*/
void screen_paint(padPt* Coord);
void screen_color_paint(padPt* Coord);
/**
* mono_screen_paint - Called to paint at location.
*/
void screen_mono_paint(padPt* Coord);
/**
* screen_show_status(msg)

View File

@ -87,7 +87,7 @@ void terminal_set_tty(void)
CurMem=M0;
CurMode=ModeRewrite;
CharWide=8;
CharHigh=16;
/* CharHigh=16; */
TTYLoc.x = 0;
TTYLoc.y = 495;
}

14
touch.c
View File

@ -21,14 +21,18 @@ void touch_init(void)
*/
void touch_allow(padBool allow)
{
isAllowed=allow;
if (isAllowed==padT)
screen_show_cursor(padT);
else
screen_show_cursor(padF);
}
padBool touch_lmb(void)
{
}
void touch_main(void)
void touch_main(padPt* Coord)
{
if (isAllowed==padF)
return;
Touch(Coord);
}
/**

View File

@ -22,7 +22,7 @@ padBool touch_lmb(void);
/**
* Get mouse position, and if LMB pressed, send touch event.
*/
void touch_main(void);
void touch_main(padPt* coord);
/**
* touch done