From 2f6520e8b41f0e5236073fd0047351d63bc0bed9 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Tue, 24 May 2011 21:44:20 +0000 Subject: Removed dependency to cflib, call EvntWindom only one time per sec. when active flag is set. svn path=/trunk/netsurf/; revision=12443 --- atari/Makefile.target | 17 +- atari/browser.c | 13 +- atari/global_evnt.c | 2 +- atari/gui.c | 19 +- atari/nkcc.h | 185 +++++++++ atari/nkcc.s | 1067 +++++++++++++++++++++++++++++++++++++++++++++++++ atari/nkccgc.c | 48 +++ atari/toolbar.c | 2 +- atari/treeview.c | 2 +- 9 files changed, 1334 insertions(+), 21 deletions(-) create mode 100755 atari/nkcc.h create mode 100755 atari/nkcc.s create mode 100755 atari/nkccgc.c diff --git a/atari/Makefile.target b/atari/Makefile.target index ebeaa72e5..e479a0783 100644 --- a/atari/Makefile.target +++ b/atari/Makefile.target @@ -5,10 +5,8 @@ $(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG/MNG/JNG (libmng))) $(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) )) -LDFLAGS += -lcflib - CFLAGS += -DATARI_USE_FREETYPE $(shell freetype-config --cflags) -LDFLAGS += $(shell freetype-config --libs) +LDFLAGS += -lfreetype # define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here NETSURF_FEATURE_RSVG_CFLAGS := -DWITH_RSVG @@ -16,10 +14,11 @@ NETSURF_FEATURE_HUBBUB_CFLAGS := -DWITH_HUBBUB NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF +#LDFLAGS += -lnsbmp -lnsgif $(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP)) $(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF)) -CFLAGS += -std=c99 -I. -Dsmall $(WARNFLAGS) -Dnsatari \ +CFLAGS += -U__STRICT_ANSI__ -std=c99 -I. -Dsmall $(WARNFLAGS) -Dnsatari \ -D_BSD_SOURCE \ -D_XOPEN_SOURCE=600 \ -D_POSIX_C_SOURCE=200112L \ @@ -27,9 +26,10 @@ CFLAGS += -std=c99 -I. -Dsmall $(WARNFLAGS) -Dnsatari \ $(shell xml2-config --cflags) \ $(shell curl-config --cflags) -LDFLAGS += $(shell curl-config --libs) -LDFLAGS += $(shell $(PKG_CONFIG) --libs libhubbub openssl libcss) -LDFLAGS += -L/usr/lib/ -lxml2 -lz -lHermes -liconv -L/usr/lib -lwindom -lgem -lm +LDFLAGS += -lcurl +LDFLAGS += -lhubbub -lcss -lparserutils -lwapcaplet +LDFLAGS += -lssl -lcrypto +LDFLAGS += -lxml2 -lz -liconv -lHermes -lwindom -lgem -lm # S_ATARI are sources purely for the Atari FreeMiNT build @@ -39,7 +39,8 @@ S_ATARI := gui.c findfile.c filetype.c misc.c bitmap.c schedule.c \ plot.c plot/plotter.c plot/plotter_vdi.c plot/eddi.s \ plot/font_vdi.c plot/font_freetype.c plot/font_internal.c \ browser_win.c toolbar.c statusbar.c browser.c \ - global_evnt.c osspec.c dragdrop.c system_colour.c + global_evnt.c osspec.c dragdrop.c system_colour.c \ + nkccgc.c nkcc.s S_ATARI := $(addprefix atari/,$(S_ATARI)) diff --git a/atari/browser.c b/atari/browser.c index e107b88cd..eb348c6f1 100755 --- a/atari/browser.c +++ b/atari/browser.c @@ -24,7 +24,6 @@ #include #include #include -#include #include "desktop/gui.h" #include "desktop/netsurf.h" @@ -44,6 +43,7 @@ #include "atari/plot/plotter.h" #include "atari/plot.h" #include "atari/font.h" +#include "atari/nkcc.h" extern browser_mouse_state bmstate; extern int mouse_click_time[3]; @@ -908,9 +908,14 @@ static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff ) )); current_redraw_browser = b->bw; - + struct rect a; + a.x0 = b->redraw.area.x0; + a.y0 = b->redraw.area.y0; + a.x1 = b->redraw.area.x1; + a.y1 = b->redraw.area.y1; + browser_window_redraw( b->bw, -b->scroll.current.x, - -b->scroll.current.y, &b->redraw.area ); + -b->scroll.current.y, &a ); current_redraw_browser = NULL; } @@ -1092,4 +1097,4 @@ static void __CDECL browser_evnt_redraw( COMPONENT * c, long buff[8], void * dat } return; -} \ No newline at end of file +} diff --git a/atari/global_evnt.c b/atari/global_evnt.c index 165208365..7dea214f2 100755 --- a/atari/global_evnt.c +++ b/atari/global_evnt.c @@ -24,7 +24,6 @@ #include #include #include -#include #include "desktop/gui.h" #include "desktop/netsurf.h" @@ -46,6 +45,7 @@ #include "atari/res/netsurf.rsh" #include "atari/search.h" #include "atari/options.h" +#include "atari/nkcc.h" extern const char * cfg_homepage_url; extern struct gui_window *input_window; diff --git a/atari/gui.c b/atari/gui.c index 1679a2226..53a70b870 100755 --- a/atari/gui.c +++ b/atari/gui.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include "content/urldb.h" @@ -75,6 +74,7 @@ #include "atari/clipboard.h" #include "atari/osspec.h" #include "atari/search.h" +#include "atari/nkcc.h" #define TODO() (0)/*printf("%s Unimplemented!\n", __FUNCTION__)*/ @@ -93,6 +93,7 @@ int mouse_click_time[3] = { INT_MAX, INT_MAX, INT_MAX }; int mouse_hold_start[3]; short last_drag_x; short last_drag_y; +long next_poll; browser_mouse_state bmstate; /* Comandline / Options: */ @@ -121,15 +122,13 @@ void gui_poll(bool active) short aestop; evnt.timer = schedule_run(); - if ( active || browser_reformat_pending ) - evnt.timer = 0; wind_get( 0, WF_TOP, &aestop, &winloc[1], &winloc[2], &winloc[3]); if( winloc[1] != _AESapid ){ aestop = 0; } - if(aestop > 0) { + if( (aestop > 0) && !active ) { flags |= MU_M1; wind_get( aestop, WF_WORKXYWH, &winloc[0], &winloc[1], &winloc[2], &winloc[3] ); @@ -152,10 +151,18 @@ void gui_poll(bool active) /*printf("time: %d, active: %d, pending: %d\n", evnt.timer, active, browser_reformat_pending );*/ - if( evnt.timer > 0 ) { + if( active ) { + if( clock() >= next_poll ) { + evnt.timer = 0; + flags |= MU_TIMER; + EvntWindom( flags ); + next_poll = clock() + CLOCKS_PER_SEC; + } + } else { flags |= MU_TIMER; - EvntWindom( flags ); + EvntWindom( flags ); } + struct gui_window * g; for( g = window_list; g != NULL; g=g->next ) { if( browser_redraw_required( g ) ){ diff --git a/atari/nkcc.h b/atari/nkcc.h new file mode 100755 index 000000000..c7b09595e --- /dev/null +++ b/atari/nkcc.h @@ -0,0 +1,185 @@ +/* + * $Id: nkcc.h,v 1.4 2010/10/16 21:21:51 hek Exp $ + * + * XaAES - XaAES Ain't the AES (c) 1992 - 1998 C.Graham + * 1999 - 2003 H.Robbers + * 2004 F.Naumann & O.Skancke + * + * A multitasking AES replacement for FreeMiNT + * + * This file is part of XaAES. + * + * XaAES 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 2 of the License, or + * (at your option) any later version. + * + * XaAES 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 XaAES; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * Project name : NORMALIZED KEY CODE CONVERTER (NKCC) + * Module name : Global definitions + * Symbol prefix: nkc + * + * Author : Harald Siegmund (HS) + * Co-Authors : Henk Robbers (Reductions for use in XaAES) + * Write access : HS + */ + +#ifndef _nkcc_h +#define _nkcc_h + +/* flags for NKCC initialization */ + +#define NKI_BUTHND 0x00000001UL /* install button event handler */ +#define NKI_BHTOS 0x00000002UL /* additional flag: only if TOS has */ + /* mouse click bug */ +#define NKI_NO200HZ 0x00000004UL /* don't install 200 Hz clock interrupt */ + /* (this flag is ignored if the button */ + /* event handler is being activated) */ + +/* flag combinations for compatibility with old versions of NKCC */ + +#define BE_ON NKI_BUTHND +#define BE_OFF 0 +#define BE_TOS (NKI_BUTHND | NKI_BHTOS) + + +/* flags for special key code handling */ + +#define NKS_ALTNUM 0x00000001UL /* Alt + numeric pad -> ASCII */ +#define NKS_CTRL 0x00000002UL /* Control key emulation */ + /* deadkey management: */ +#define NKS_D_CIRCUM 0x00010000UL /* ^ accent circumflex */ +#define NKS_D_TILDE 0x00020000UL /* ~ accent tilde */ +#define NKS_D_AGUI 0x00040000UL /* ' accent agui */ +#define NKS_D_GRAVE 0x00080000UL /* ` accent grave */ +#define NKS_D_UMLAUT 0x00100000UL /* umlaut */ +#define NKS_D_QUOTE 0x00200000UL /* " quote, synonym for umlaut */ +#define NKS_D_SMOERE 0x00400000UL /* smoerebroed */ +#define NKS_D_CEDIL 0x00800000UL /* , cedil */ +#define NKS_D_SLASH 0x01000000UL /* / slash, for scandinavian characters */ +#define NKS_DEADKEY 0xffff0000UL /* all deadkeys */ + +/* NKCC key code flags */ + +#define NKF_FUNC 0x8000 /* function */ +#define NKF_RESVD 0x4000 /* resvd, ignore it! */ +#define NKF_NUM 0x2000 /* numeric pad */ +#define NKF_CAPS 0x1000 /* CapsLock */ +#define NKF_ALT 0x0800 /* Alternate */ +#define NKF_CTRL 0x0400 /* Control */ +#define NKF_SHIFT 0x0300 /* any Shift key */ +#define NKF_LSH 0x0200 /* left Shift key */ +#define NKF_RSH 0x0100 /* right Shift key */ + +#define NKF_IGNUM NKF_RESVD /* special flag for nkc_cmp() */ + +/* special key codes for keys performing a function */ + +#define NK_INVALID 0x00 /* invalid key code */ +#define NK_UP 0x01 /* cursor up */ +#define NK_DOWN 0x02 /* cursor down */ +#define NK_RIGHT 0x03 /* cursor right */ +#define NK_LEFT 0x04 /* cursor left */ +#define NK_M_PGUP 0x05 /* MAC Page up */ +#define NK_M_PGDOWN 0x06 /* MAC Page down */ +#define NK_M_END 0x07 /* reserved! */ +#define NK_BS 0x08 /* Backspace */ +#define NK_TAB 0x09 /* Tab */ +#define NK_ENTER 0x0a /* Enter */ +#define NK_INS 0x0b /* Insert */ +#define NK_CLRHOME 0x0c /* Clr/Home */ +#define NK_HOME 0x0c /* Clr/Home */ +#define NK_RET 0x0d /* Return */ +#define NK_HELP 0x0e /* Help */ +#define NK_UNDO 0x0f /* Undo */ +#define NK_F1 0x10 /* function key #1 */ +#define NK_F2 0x11 /* function key #2 */ +#define NK_F3 0x12 /* function key #3 */ +#define NK_F4 0x13 /* function key #4 */ +#define NK_F5 0x14 /* function key #5 */ +#define NK_F6 0x15 /* function key #6 */ +#define NK_F7 0x16 /* function key #7 */ +#define NK_F8 0x17 /* function key #8 */ +#define NK_F9 0x18 /* function key #9 */ +#define NK_F10 0x19 /* function key #10 */ +#define NK_RVD1A 0x1a /* reserved! */ +#define NK_ESC 0x1b /* Esc */ +#define NK_RVD1C 0x1c /* reserved! */ +#define NK_RVD1D 0x1d /* reserved! */ +#define NK_RVD1E 0x1e /* reserved! */ +#define NK_DEL 0x1f /* Delete */ + + /* terminator for key code tables */ +#define NK_TERM ((int)(NKF_FUNC | NK_INVALID)) + +/* ASCII codes less than 32 */ + +#define NUL 0x00 /* Null */ +#define SOH 0x01 /* Start Of Header */ +#define STX 0x02 /* Start Of Text */ +#define ETX 0x03 /* End Of Text */ +#define EOT 0x04 /* End Of Transmission */ +#define ENQ 0x05 /* Enquiry */ +#define ACK 0x06 /* positive Acknowledgement */ +#define BEL 0x07 /* Bell */ +#define BS 0x08 /* BackSpace */ +#define HT 0x09 /* Horizontal Tab */ +#define LF 0x0a /* Line Feed */ +#define VT 0x0b /* Vertical Tab */ +#define FF 0x0c /* Form Feed */ +#define CR 0x0d /* Carriage Return */ +#define SO 0x0e /* Shift Out */ +#define SI 0x0f /* Shift In */ +#define DLE 0x10 /* Data Link Escape */ +#define DC1 0x11 /* Device Control 1 */ +#define XON 0x11 /* same as DC1 */ +#define DC2 0x12 /* Device Control 2 */ +#define DC3 0x13 /* Device Control 3 */ +#define XOFF 0x13 /* same as DC3 */ +#define DC4 0x14 /* Device Control 4 */ +#define NAK 0x15 /* Negative Acknowledgement */ +#define SYN 0x16 /* Synchronize */ +#define ETB 0x17 /* End of Transmission Block */ +#define CAN 0x18 /* Cancel */ +#define EM 0x19 /* End of Medium */ +#define SUB 0x1a /* Substitute */ +#define ESC 0x1b /* Escape */ +#define FS 0x1c /* Form Separator */ +#define GS 0x1d /* Group Separator */ +#define RS 0x1e /* Record Separator */ +#define US 0x1f /* Unit Separator */ + +/* XBRA vector link/unlink modes */ + +#define NKXM_NUM 0 /* by vector number */ +#define NKXM_ADR 1 /* by vector address */ + +/* additional flag in event mask */ + +#define MU_XTIMER 0x100 + + +/* deinstall NKCC */ +int nkc_exit(void); + +/* from cflib */ +short nkc_init(void); + +unsigned short nkc_tos2n(long toskey); +unsigned short gem_to_norm(short ks, short kr); + +/* XaAES used names */ +#define nkc_tconv nkc_tos2n +#define normkey gem_to_norm + +#endif /* _nkcc_h */ diff --git a/atari/nkcc.s b/atari/nkcc.s new file mode 100755 index 000000000..56a913160 --- /dev/null +++ b/atari/nkcc.s @@ -0,0 +1,1067 @@ +|* +|* $Id: nkcc-gc.S,v 1.2 2011/05/16 08:43:20 alanh Exp $ +|* +|* XaAES - XaAES Ain't the AES (c) 1992 - 1998 C.Graham +|* 1999 - 2003 H.Robbers +|* 2004 F.Naumann & O.Skancke +|* +|* A multitasking AES replacement for FreeMiNT +|* +|* This file is part of XaAES. +|* +|* XaAES 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 2 of the License, or +|* (at your option) any later version. +|* +|* XaAES 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 XaAES; if not, write to the Free Software +|* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +|* +|*************************************************************************** +| +| reduced NKCC for the CF-Lib +| GNU-C compatible version +| +|*************************************************************************** + +|*************************************************************************** +| ASSEMBLER CONTROL SECTION +|*************************************************************************** + +VERSION = 0x0294 | NKCC's version + +NKFf_FUNC = 0x8000 +NKFf_RESVD = 0x4000 +NKFf_NUM = 0x2000 +NKFf_CAPS = 0x1000 +NKFf_ALT = 0x0800 +NKFf_CTRL = 0x0400 +NKFf_SHIFT = 0x0300 | both shift keys + +NKFb_FUNC = 15 | function +NKFb_RESVD = 14 | reserved, ignore it! +NKFb_NUM = 13 | numeric pad +NKFb_CAPS = 12 | CapsLock +NKFb_ALT = 11 | Alternate +NKFb_CTRL = 10 | Control +NKFb_LSH = 9 | left Shift key +NKFb_RSH = 8 | right Shift key + +NK_UP = 0x01 | cursor up +NK_DOWN = 0x02 | cursor down +NK_RIGHT = 0x03 | cursor right +NK_LEFT = 0x04 | cursor left +NK_M_PGUP = 0x05 | Mac: page up +NK_M_PGDOWN = 0x06 | Mac: page down +NK_M_END = 0x07 | Mac: end +NK_INS = 0x0b | Insert +NK_CLRHOME = 0x0c | Clr/Home +NK_HELP = 0x0e | Help +NK_UNDO = 0x0f | Undo +NK_M_F11 = 0x1a | Mac: function key #11 +NK_M_F12 = 0x1c | Mac: function key #12 +NK_M_F14 = 0x1d | Mac: function key #14 +NK_ENTER = 0x0a | Enter +NK_DEL = 0x1f | Delete + +|*************************************************************************** +| EXPORT +|*************************************************************************** + + .globl _nkc_init | init NKCC + .globl _nkc_tos2n | TOS key code converter + .globl _nkc_n2tos | NKC to TOS key code converter + .globl _nkc_toupper | convert character to upper case + .globl _nkc_tolower | convert character to lower case + +|*************************************************************************** +| LOCAL TEXT SECTION +|*************************************************************************** + +|*************************************************************************** +| +| nk_findscan: find scan code +| +|*************************************************************************** + +nk_findscan: + btst #NKFb_NUM,d0 | on numeric keypad? + beqs search | no -> + + moveql #0x4a,d1 | yes: try all numeric keypad +#ifdef __mcoldfire__ + cmpb a0@(d1:l),d0 | scan codes first +#else + cmpb a0@(d1:w),d0 | scan codes first +#endif + beqs found1 | it matches -> + + moveql #0x4e,d1 +#ifdef __mcoldfire__ + cmpb a0@(d1:l),d0 +#else + cmpb a0@(d1:w),d0 +#endif + beqs found1 + + moveql #0x63,d1 | block starts at 0x63 + +numsearch: +#ifdef __mcoldfire__ + cmpb a0@(d1:l),d0 | match? +#else + cmpb a0@(d1:w),d0 | match? +#endif + beqs found1 | yes -> + +#ifdef __mcoldfire__ + addql #1,d1 | next scan code +#else + addqw #1,d1 | next scan code +#endif + cmpw #0x73,d1 | block end at 0x72 + bcss numsearch | continue search -> + +search: + moveql #1,d1 | start with first valid scan code + +mainsearch: +#ifdef __mcoldfire__ + cmpb a0@(d1:l),d0 | match? +#else + cmpb a0@(d1:w),d0 | match? +#endif + beqs found1 | yes -> + +#ifdef __mcoldfire__ + addql #1,d1 | next scan code +#else + addqb #1,d1 | next scan code +#endif + cmpb #0x78,d1 | 0x78 = last valid scan code + bcss mainsearch | continue search -> + + moveql #0,d1 | not found + rts + +found1: + tstw d1 | found set CCR + rts + +|*************************************************************************** +| GLOBAL TEXT SECTION +|*************************************************************************** + +|*************************************************************************** +| +| nkc_init: initialize NKCC +| +|*************************************************************************** + +_nkc_init: +|------------- fetch addresses of TOS' key scan code translation tables + + moveql #-1,d0 | the function is also used to + movel d0,sp@- | change the addresses| values + movel d0,sp@- | of -1 as new addresses tell + movel d0,sp@- | XBIOS not to change them + movew #0x10,sp@- | Keytbl + trap #14 | XBIOS + lea sp@(0xe),sp | clean stack + + movel d0,a0 | ^key table structure + movel a0@+,pkey_unshift | get ^unshifted table + movel a0@+,pkey_shift | get ^shifted table + movel a0@,pkey_caps | get ^CapsLock table + +exit1: + movew #VERSION,d0 | load version # + rts | bye + +|*************************************************************************** +| +| nkc_tconv: TOS key code converter +| +|*************************************************************************** + +_nkc_tos2n: + movel sp@(4), d0 | Parameter via Stack! +#ifdef __mcoldfire__ + lea sp@(-12),sp + movem.l d2-d4,sp@ | store registers +#else + movem.l d2-d4,sp@- | store registers +#endif + +|------------- separate TOS key code + + movel d0,d1 | TOS key code + swap d1 | .W = scan code and flags + movew d1,d2 | copy +#ifdef __mcoldfire__ + movel #0xff,d3 | and-mask + andl d3,d0 | .B = ASCII code + andl d3,d1 | .B = scan code +#else + movew #0xff,d3 | and-mask + andw d3,d0 | .B = ASCII code + andw d3,d1 | .B = scan code +#endif + beq tos306 | scancode=zero (key code created + | by ASCII input of TOS 3.06)? -> +#ifdef __mcoldfire__ + andl #0x1f00,d2 | .W = key flags (in high byte) +#else + andw #0x1f00,d2 | .W = key flags (in high byte) +#endif + +|------------- decide which translation table to use + + movew d2,d3 | key flags +#ifdef __mcoldfire__ + andl #NKFf_SHIFT,d3 | isolate bits for shift keys +#else + andw #NKFf_SHIFT,d3 | isolate bits for shift keys +#endif + beqs ktab11 | shift key pressed? no-> + + movel pkey_shift,a0 | yes: use shift table + bras ktab13 | -> + +ktab11: + btst #NKFb_CAPS,d2 | CapsLock? + beqs ktab12 | no-> + + movel pkey_caps,a0 | yes: use CapsLock table + bras ktab13 | -> + +ktab12: + movel pkey_unshift,a0 | use unshifted table + +|------------- check if scan code is out of range +| +| Illegal scancodes can be used to produce 'macro key codes'. Their format is: +| +| - the scancode must be 0x84 or larger (should be 0xff to work properly with old +| versions of Mag!x) +| - the ASCII code must be in the range 0x20...0xff (values below are set to 0x20 +| by NKCC) +| - Alternate and Control are not used for the normalized key code. However, +| if at least one of them is non-zero, then the numeric keypad flag will be +| set in the resulting key code. +| + +ktab13: + cmpb #0x84,d1 | illegal scan code? + bcss ktab14 | no -> + + movew d2,d1 | flags +| andw #NKFf_ALT|NKFf_CTRL,d1 | Alternate or Control? +#ifdef __mcoldfire__ + andl #0xc00,d1 | Alternate or Control? +#else + andw #0xc00,d1 | Alternate or Control? +#endif + beqs special | no -> + +#ifdef __mcoldfire__ + orl #NKFf_NUM,d0 | yes: set numeric keypad flag +#else + orw #NKFf_NUM,d0 | yes: set numeric keypad flag +#endif +| and #NKFf_CAPS|NKFf_SHIFT,d2 | mask off both flags +#ifdef __mcoldfire__ + andl #0x1300,d2 | mask off both flags +#else + andw #0x1300,d2 | mask off both flags +#endif + +special: +#ifdef __mcoldfire__ + orl d2,d0 | combine with ASCII code +#else + orw d2,d0 | combine with ASCII code +#endif +| orw #NKFf_FUNC|NKFf_RESVD,d0 | set function and resvd +#ifdef __mcoldfire__ + orl #0x1300,d0 | set function and resvd +#else + orw #0x1300,d0 | set function and resvd +#endif + cmpb #0x20,d0 | ASCII code in range? + bcc exit2 | yes -> + + moveb #0x20,d0 | no: use minimum + bra exit2 | -> + +|------------- check if Alternate + number: they have simulated scan codes + +ktab14: + cmpb #0x78,d1 | scan code of Alt + number? + bcss scan1 | no-> + +#ifdef __mcoldfire__ + subl #0x76,d1 | yes: calculate REAL scan code + moveb a0@(d1:l),d0 | fetch ASCII code + orl #NKFf_ALT,d2 | set Alternate flag +#else + subb #0x76,d1 | yes: calculate REAL scan code + moveb a0@(d1:w),d0 | fetch ASCII code + orw #NKFf_ALT,d2 | set Alternate flag +#endif + bra cat_codes | -> add flag byte and exit + +|------------- check if exception scan code from cursor keypad + +scan1: + lea xscantab,a1 | ^exception scan code table + +search_scan: + movew a1@+,d3 | NKC and scan code + bmis tabend | <0? end of table reached -> + + cmpb d1,d3 | scan code found? + bnes search_scan | no: continue search -> + +#ifdef __mcoldfire__ + lsrl #8,d3 | .B = NKC +#else + lsrw #8,d3 | .B = NKC +#endif + moveql #0,d0 | mark: key code found + bras scan2 | -> + +tabend: + moveql #0,d3 | no NKC found yet + +|------------- check if rubbish ASCII code and erase it, if so + +scan2: +#ifdef __mcoldfire__ + moveb a0@(d1:l),d4 | ASCII code from translation table +#else + moveb a0@(d1:w),d4 | ASCII code from translation table +#endif + cmpb #32,d0 | ASCII returned by TOS < 32? + bccs scan3 | no -> can't be rubbish + + cmpb d4,d0 | yes: compare with table entry + beqs scan3 | equal: that's ok -> + + moveql #0,d0 | not equal: rubbish! clear it + +|------------- check if ASCII code could only be produced via Alternate key +| combination + +scan3: + tstb d0 | ASCII code valid? + beqs scan4 | no -> + + cmpb d4,d0 | compare with table entry + beqs scan4 | equal: normal key -> + +| and #!NKFf_ALT,d2 | no: clear Alternate flag +#ifdef __mcoldfire__ + andl #0xF7FF,d2 | no: clear Alternate flag +#else + andw #0xF7FF,d2 | no: clear Alternate flag +#endif + +|------------- check if ASCII code found yet, and set it, if not + +scan4: + tstb d0 | found? + bnes scan5 | yes -> + + moveb d3,d0 | no: use code from exception table + bnes scan5 | now valid? yes -> + + moveb d4,d0 | no: use code from transl. table + +|------------- check special case: delete key + +scan5: + cmpb #127,d0 | ASCII code of Delete? + bnes scan6 | no -> + + moveb #NK_DEL,d0 | yes: set according NKC + +|------------- check if key is on numeric keypad (via scan code) + +scan6: + cmpb #0x4a,d1 | numeric pad scan code range? + beqs numeric | yes -> + + cmpb #0x4e,d1 + beqs numeric | yes -> + + cmpb #0x63,d1 + bcss scan7 | no -> + + cmpb #0x72,d1 + bhis scan7 | no -> + +numeric: +#ifdef __mcoldfire__ + orl #NKFf_NUM,d2 | yes: set numeric bit +#else + orw #NKFf_NUM,d2 | yes: set numeric bit +#endif + +|------------- check if "function key" and set bit accordingly + +scan7: + cmpb #32,d0 | ASCII code less than 32? + bccs scan8 | no -> + +#ifdef __mcoldfire__ + orl #NKFf_FUNC,d2 | yes: set function bit +#else + orw #NKFf_FUNC,d2 | yes: set function bit +#endif + +|------------- check special case: Return or Enter key + + cmpb #13,d0 | Return or Enter key? + bnes scan8 | no -> + + btst #NKFb_NUM,d2 | yes: from the numeric pad? + beqs scan8 | no -> it's Return, keep code + + moveql #NK_ENTER,d0 | yes: it's Enter| new code + +|------------- check if function key (F1-F10) via scan code + +scan8: + cmpb #0x54,d1 | shift + function key? + bcss scan9 | no -> + + cmpb #0x5d,d1 + bhis scan9 | no -> + +#ifdef __mcoldfire__ + subl #0x54-0x3b,d1 | yes: scan code for unshifted key +#else + subb #0x54-0x3b,d1 | yes: scan code for unshifted key +#endif + movew d2,d3 | shift flags +#ifdef __mcoldfire__ + andl #NKFf_SHIFT,d3 | any shift key flag set? +#else + andw #NKFf_SHIFT,d3 | any shift key flag set? +#endif + bnes scan9 | yes -> +#ifdef __mcoldfire__ + orl #NKFf_SHIFT,d2 | no: set both flags +#else + orw #NKFf_SHIFT,d2 | no: set both flags +#endif + +scan9: + cmpb #0x3b,d1 | (unshifted) function key? + bcss cat_codes | no -> + + cmpb #0x44,d1 + bhis cat_codes | no -> + + moveb d1,d0 | yes: calc NKC +#ifdef __mcoldfire__ + subl #0x2b,d0 +#else + subb #0x2b,d0 +#endif + +|------------- final flag handling| mix key code (low byte) and flag byte + +cat_codes: + movel pkey_shift,a0 | ^shifted table +#ifdef __mcoldfire__ + moveb a0@(d1:l),d3 | get shifted ASCII code + orl d2,d0 | mix flags with key code + tst.w d0 +#else + moveb a0@(d1:w),d3 | get shifted ASCII code + orw d2,d0 | mix flags with key code +#endif + bmis scan10 | result is "function key"? -> + +#ifdef __mcoldfire__ + andl #NKFf_CTRL+NKFf_ALT,d2 | Control or Alternate pressed? +#else + andw #NKFf_CTRL+NKFf_ALT,d2 | Control or Alternate pressed? +#endif + bnes scan11 | yes -> + +scan10: + movel pkey_unshift,a0 | ^unshifted table +#ifdef __mcoldfire__ + cmpb a0@(d1:l),d3 | shifted ASCII = unshifted ASCII? +#else + cmpb a0@(d1:w),d3 | shifted ASCII = unshifted ASCII? +#endif + beqs scan12 | yes -> + + bras exit2 | no -> + +scan11: +#ifdef __mcoldfire__ + orl #NKFf_FUNC,d0 | Alt/Ctrl + char: set function bit +#else + orw #NKFf_FUNC,d0 | Alt/Ctrl + char: set function bit +#endif + movel pkey_caps,a0 | ^CapsLock table +#ifdef __mcoldfire__ + cmpb a0@(d1:l),d3 | shifted ASCII = CapsLocked ASCII? +#else + cmpb a0@(d1:w),d3 | shifted ASCII = CapsLocked ASCII? +#endif + bnes exit2 | no -> + + moveb d3,d0 | yes: use shifted ASCII code + +scan12: +#ifdef __mcoldfire__ + orl #NKFf_RESVD,d0 | yes: nkc_cmp() has to check +#else + orw #NKFf_RESVD,d0 | yes: nkc_cmp() has to check +#endif + +|------------- restore registers and exit + +exit2: + tstw d0 | set CCR +#ifdef __mcoldfire__ + movem.l sp@,d2-d4 | restore registers + lea sp@(12),sp +#else + movem.l sp@+,d2-d4 | restore registers +#endif + rts | bye + +|------------- special handling for key codes created by TOS' 3.06 ASCII input + +tos306: +#ifdef __mcoldfire__ + andl #NKFf_CAPS,d2 | isolate CapsLock flag + orl d2,d0 | merge with ASCII code + movem.l sp@,d2-d4 | restore registers + lea sp@(12),sp +#else + andw #NKFf_CAPS,d2 | isolate CapsLock flag + orw d2,d0 | merge with ASCII code + movem.l sp@+,d2-d4 | restore registers +#endif + rts | bye + +|*************************************************************************** +| +| nkc_n2tos: convert normalized key codes back to TOS format +| +|*************************************************************************** + +_nkc_n2tos: + movel sp@(4),d0 | Parameter ber Stack! + + movew d0,d1 | normalized key code +| and #NKFf_FUNC|NKFf_ALT|NKFf_CTRL,d1| isolate flags +#ifdef __mcoldfire__ + andl #0x8c00,d1 | isolate flags +#else + andw #0x8c00,d1 | isolate flags +#endif + cmpw #NKFf_FUNC,d1 | only function flag set? + bnes ktab20 | no -> + + cmpb #0x20,d0 | ASCII code >= 0x20? + bcss ktab20 | no -> + +|------------- macro key + + movew d0,d1 | keep normalized key code +| andl #NKFf_CAPS|NKFf_SHIFT,d0 | isolate usable flags + andl #0x1300,d0 | mask off both flags + btst #NKFb_NUM,d1 | numeric keypad flag set? + beqs mackey | no -> + +| or #NKFf_ALT|NKFf_CTRL,d0 | yes: set Alternate + Control +#ifdef __mcoldfire__ + orl #0xc00,d1 | yes: set Alternate + Control? +#else + orw #0xc00,d1 | yes: set Alternate + Control? +#endif + +mackey: +#ifdef __mcoldfire__ + orl #0xff,d0 | scan code always 0xff +#else + orb #0xff,d0 | scan code always 0xff +#endif + swap d0 | flags and scan code in upper word + moveb d1,d0 | ASCII code + bra exit3 | -> + +|------------- select system key table to use + +ktab20: + movew d0,d1 | normalized key code +#ifdef __mcoldfire__ + andl #NKFf_SHIFT,d1 | isolate bits for shift keys +#else + andw #NKFf_SHIFT,d1 | isolate bits for shift keys +#endif + beqs ktab21 | shift key pressed? no-> + + lea n_to_scan_s,a1 | ^default translation table + movel pkey_shift,a0 | yes: use shift table + bras ktab23 | -> + +ktab21: + lea n_to_scan_u,a1 | ^unshifted translation table + btst #NKFb_CAPS,d0 | CapsLock? + beqs ktab22 | no-> + + movel pkey_caps,a0 | yes: use CapsLock table + bras ktab23 | -> + +ktab22: + movel pkey_unshift,a0 | use unshifted table + +|------------- handling for ASCII codes >= 32 + +ktab23: + cmpb #32,d0 | ASCII code < 32? + bcss lowascii | yes -> + + bsr nk_findscan | find scan code + bnes found2 | found -> + + btst #NKFb_FUNC,d0 | function flag set? + beqs notfound | no -> + + movel a0,d1 | save a0 + lea tolower,a0 | ^upper->lower case table + moveql #0,d2 | clear for word operation + moveb d0,d2 | ASCII code +#ifdef __mcoldfire__ + moveb a0@(d2:l),d0 | get lowercased ASCII code +#else + moveb a0@(d2:w),d0 | get lowercased ASCII code +#endif + movel d1,a0 | restore a0 + bsr nk_findscan | try to find scan code again + bnes found2 | found -> + +|------------- unknown source: treat key code as it was entered using the +| TOS 3.06 direct ASCII input + +notfound: + moveql #0,d1 | not found: clear for word op. + moveb d0,d1 | unchanged ASCII code +#ifdef __mcoldfire__ + andl #0x1f00,d0 | keep shift flags only +#else + andw #0x1f00,d0 | keep shift flags only +#endif + swap d0 | -> high word (scan code = 0) + movew d1,d0 | low word: ASCII code + bra exit3 | -> + +|------------- handling for ASCII codes < 32 + +lowascii: + btst #NKFb_FUNC,d0 | function key? + bnes func | yes -> + +#ifdef __mcoldfire__ + andl #0xffff10ff,d0 | clear all flags except CapsLock +#else + andw #0x10ff,d0 | clear all flags except CapsLock +#endif + bras notfound | -> + +func: + moveql #0,d1 | clear for word operation + moveb d0,d1 | ASCII code (0...0x1f) + movew d1,d2 | copy +#ifdef __mcoldfire__ + moveb a1@(d1:l),d1 | get scan code +#else + moveb a1@(d1:w),d1 | get scan code +#endif + bnes getascii | valid? -> + + moveq #0,d0 | invalid key code!! return 0 + bra exit3 | -> + +getascii: + lea n_to_scan_u,a1 | ^unshifted translation table +#ifdef __mcoldfire__ + moveb a1@(d2:l),d2 | get scan code from unshifted tab. + moveb a0@(d2:l),d0 | get ASCII from system's table +#else + moveb a1@(d2:w),d2 | get scan code from unshifted tab. + moveb a0@(d2:w),d0 | get ASCII from system's table +#endif + +| register contents: +| +| d0.b ASCII code +| d1.b scan code +| d0.hb NKCC flags +| + +found2: + movew d0,d2 | flags and ASCII code +#ifdef __mcoldfire__ + andl #0x1f00,d0 | isolate shift flags +#else + andw #0x1f00,d0 | isolate shift flags +#endif + moveb d1,d0 | merge with scan code + swap d0 | -> high byte + clrw d0 | erase low word + moveb d2,d0 | restore ASCII code + +|------------- handling for Control key flag + + btst #NKFb_CTRL,d2 | control key flag set? + beqs alternate | no -> + + cmpb #0x4b,d1 | scan code = "cursor left"? + bnes scanchk2 | no -> + + addl #0x280000,d0 | change scan code to 0x73 + clrb d0 | erase ASCII code + bras exit3 | -> + +scanchk2: + cmpb #0x4d,d1 | scan code = "cursor right"? + bnes scanchk3 | no -> + + addl #0x270000,d0 | change scan code to 0x74 + clrb d0 | erase ASCII code + bras exit3 | -> + +scanchk3: + cmpb #0x47,d1 | scan code = "ClrHome"? + bnes ascchk | no -> + + addl #0x300000,d0 | change scan code to 0x77 +| keep ASCII code in this case! What a mess... + bras exit3 | -> + +ascchk: + lea asc_trans,a0 | ^ASCII translation table + +ascloop: + movew a0@+,d1 | get next entry + beqs noctrlasc | end of table -> + + cmpb d0,d1 | ASCII code found? + bnes ascloop | no -> continue search + +#ifdef __mcoldfire__ + lsrl #8,d1 | yes: get translated code +#else + lsrw #8,d1 | yes: get translated code +#endif + moveb d1,d0 | use it + bras exit3 | -> + +noctrlasc: +#ifdef __mcoldfire__ + andl #0x1f,d0 | mask off upper 3 bits +#else + andb #0x1f,d0 | mask off upper 3 bits +#endif + bras exit3 | -> + +|------------- handling for Alternate key flag + +alternate: + btst #NKFb_ALT,d2 | alternate key flag set? + beqs exit3 | no -> + + cmpb #2,d1 | top row on main keyboard? + bcss alphachk | no -> + + cmpb #0xd,d1 + bhis alphachk | no -> + + addl #0x760000,d0 | yes: change scan code + clrb d0 | and erase ASCII code + bras exit3 | -> + +alphachk: + cmpb #65,d0 | alpha-characters? + bcss exit3 | no -> + + cmpb #122,d0 + bhis exit3 | no -> + + cmpb #90,d0 + blss ascii0 | yes -> + + cmpb #97,d0 + bcss exit3 | no -> + +ascii0: + clrb d0 | alpha-character: clear ASCII code + +exit3: + tstw d0 | set CCR + rts | bye + + +|*************************************************************************** +| +| nkc_toupper: convert character to upper case +| +|*************************************************************************** + +_nkc_toupper: + movel sp@(4),d1 | Parameter via Stack! + lea toupper,a0 | ^upper case translation table +#ifdef __mcoldfire__ + andl #0xff,d1 | high byte = 0 for word operation +#else + andw #0xff,d1 | high byte = 0 for word operation +#endif + moveb a0@(d1:l),d0 | convert + rts | bye + +|*************************************************************************** +| +| nkc_tolower: convert character to lower case +| +|*************************************************************************** + +_nkc_tolower: + movel sp@(4),d1 | Parameter via Stack! + lea tolower,a0 | ^lower case translation table +#ifdef __mcoldfire__ + andl #0xff,d1 | high byte = 0 for word operation +#else + andw #0xff,d1 | high byte = 0 for word operation +#endif + moveb a0@(d1:l),d0 | convert + rts | bye + +|*************************************************************************** +| LOCAL DATA SECTION +|*************************************************************************** + + .data + +| exception scan code table for cursor block keys +| +| first entry.B: NKCC key code +| second entry.B: scan code returned by TOS +| +| the table is terminated with both entries -1 + +xscantab: + .byte NK_UP , 0x48 | cursor up + .byte NK_DOWN , 0x50 | cursor down + .byte NK_LEFT , 0x4b | cursor left + .byte NK_LEFT , 0x73 | Control cursor left + .byte NK_RIGHT , 0x4d | cursor right + .byte NK_RIGHT , 0x74 | Control cursor right + .byte NK_M_PGUP , 0x49 | Mac: page up + .byte NK_M_PGDOWN , 0x51 | Mac: page down + .byte NK_M_END , 0x4f | Mac: end + .byte NK_INS , 0x52 | Insert + .byte NK_CLRHOME , 0x47 | ClrHome + .byte NK_CLRHOME , 0x77 | Control ClrHome + .byte NK_HELP , 0x62 | Help + .byte NK_UNDO , 0x61 | Undo + .byte NK_M_F11 , 0x45 | Mac: F11 + .byte NK_M_F12 , 0x46 | Mac: F12 + .byte NK_M_F14 , 0x37 | Mac: F14 + .word -1 + +| lower case to upper case conversion table +| (array of 256 unsigned bytes) +toupper: + .byte 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07 + .byte 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f + .byte 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17 + .byte 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f + .byte 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27 + .byte 0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F + .byte 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37 + .byte 0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F + .byte 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47 + .byte 0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F + .byte 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57 + .byte 0x58,0x59,0x5A,0x5B,0x5c,0x5D,0x5E,0x5F + .byte 0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47 + .byte 0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F + .byte 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57 + .byte 0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F + .byte 0x80,0x9A,0x90,0x83,0x8E,0xB6,0x8F,0x80 + .byte 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F + .byte 0x90,0x92,0x92,0x93,0x99,0x95,0x96,0x97 + .byte 0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F + .byte 0xA0,0xA1,0xA2,0xA3,0xA5,0xA5,0xA6,0xA7 + .byte 0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF + .byte 0xB7,0xB8,0xB2,0xB2,0xB5,0xB5,0xB6,0xB7 + .byte 0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF + .byte 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7 + .byte 0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF + .byte 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7 + .byte 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF + .byte 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7 + .byte 0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF + .byte 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7 + .byte 0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF + + +| upper case to lower case conversion table +| (array of 256 unsigned bytes) +tolower: + .byte 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07 + .byte 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f + .byte 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17 + .byte 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f + .byte 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27 + .byte 0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F + .byte 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37 + .byte 0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F + .byte 0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67 + .byte 0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F + .byte 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77 + .byte 0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F + .byte 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67 + .byte 0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F + .byte 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77 + .byte 0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F + .byte 0x87,0x81,0x82,0x83,0x84,0x85,0x86,0x87 + .byte 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x84,0x86 + .byte 0x82,0x91,0x91,0x93,0x94,0x95,0x96,0x97 + .byte 0x98,0x94,0x81,0x9B,0x9C,0x9D,0x9E,0x9F + .byte 0xA0,0xA1,0xA2,0xA3,0xA4,0xA4,0xA6,0xA7 + .byte 0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF + .byte 0xB0,0xB1,0xB3,0xB3,0xB4,0xB4,0x85,0xB0 + .byte 0xB1,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF + .byte 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7 + .byte 0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF + .byte 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7 + .byte 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF + .byte 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7 + .byte 0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF + .byte 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7 + .byte 0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF + + +| ASCII code translation table for Control key +| +| first entry.B: modified ASCII code returned by TOS +| second entry.B: original ASCII code as stored in key table +| +| The table is terminated with both entries 0 + +asc_trans: + .byte 0,0x32 | Control '2' becomes ASCII 0 + .byte 0x1e,0x36 | Control '6' becomes ASCII 0x1e + .byte 0x1f,0x2d | Control '-' becomes ASCII 0x1f + .byte 0xa,0xd | Control Return/Enter: 0xd -> 0xa + .word 0 | terminator + + +| normalized key code -> scan code translation table +| for unshifted key codes +| indexed by function code (NK_...) + +n_to_scan_u: + .byte 0x00 | invalid key code + .byte 0x48 | cursor up + .byte 0x50 | cursor down + .byte 0x4d | cursor right + .byte 0x4b | cursor left + .byte 0x49 | Mac: page up + .byte 0x51 | Mac: page down + .byte 0x4f | Mac: end + .byte 0x0e | Backspace + .byte 0x0f | Tab + .byte 0x72 | Enter + .byte 0x52 | Insert + .byte 0x47 | ClrHome + .byte 0x1c | Return + .byte 0x62 | Help + .byte 0x61 | Undo + .byte 0x3b | function key #1 + .byte 0x3c | function key #2 + .byte 0x3d | function key #3 + .byte 0x3e | function key #4 + .byte 0x3f | function key #5 + .byte 0x40 | function key #6 + .byte 0x41 | function key #7 + .byte 0x42 | function key #8 + .byte 0x43 | function key #9 + .byte 0x44 | function key #10 + .byte 0x45 | Mac: F11 + .byte 0x01 | Esc + .byte 0x46 | Mac: F12 + .byte 0x37 | Mac: F14 + .byte 0x00 | reserved! + .byte 0x53 | Delete + +| normalized key code -> scan code translation table +| for shifted key codes +| indexed by function code (NK_...) + +n_to_scan_s: + .byte 0x00 | invalid key code + .byte 0x48 | cursor up + .byte 0x50 | cursor down + .byte 0x4d | cursor right + .byte 0x4b | cursor left + .byte 0x49 | Mac: page up + .byte 0x51 | Mac: page down + .byte 0x4f | Mac: end + .byte 0x0e | Backspace + .byte 0x0f | Tab + .byte 0x72 | Enter + .byte 0x52 | Insert + .byte 0x47 | ClrHome + .byte 0x1c | Return + .byte 0x62 | Help + .byte 0x61 | Undo + .byte 0x54 | function key #1 + .byte 0x55 | function key #2 + .byte 0x56 | function key #3 + .byte 0x57 | function key #4 + .byte 0x58 | function key #5 + .byte 0x59 | function key #6 + .byte 0x5a | function key #7 + .byte 0x5b | function key #8 + .byte 0x5c | function key #9 + .byte 0x5d | function key #10 + .byte 0x45 | Mac: F11 + .byte 0x01 | Esc + .byte 0x46 | Mac: F12 + .byte 0x37 | Mac: F14 + .byte 0x00 | reserved! + .byte 0x53 | Delete + +|*************************************************************************** +| LOCAL BSS SECTION +|*************************************************************************** + +| .bss + +pkey_unshift: + .long 1 | ^unshifted key table + +pkey_shift: + .long 1 | ^shifted key table + +pkey_caps: + .long 1 | ^CapsLock table diff --git a/atari/nkccgc.c b/atari/nkccgc.c new file mode 100755 index 000000000..d068598aa --- /dev/null +++ b/atari/nkccgc.c @@ -0,0 +1,48 @@ +/* + * $Id: nkcc.c,v 1.4 2010/10/16 21:21:51 hek Exp $ + * + * XaAES - XaAES Ain't the AES (c) 1992 - 1998 C.Graham + * 1999 - 2003 H.Robbers + * 2004 F.Naumann & O.Skancke + * + * A multitasking AES replacement for FreeMiNT + * + * This file is part of XaAES. + * + * XaAES 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 2 of the License, or + * (at your option) any later version. + * + * XaAES 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 XaAES; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "atari/nkcc.h" +//#include "nkcc.h" + + +unsigned short +gem_to_norm (short ks, short kr) +{ + unsigned short knorm; + + knorm = nkc_tos2n (((long) (kr & 0xff) | /* ascii Bits 0-7 */ + (((long) kr & 0x0000ff00L) << 8L) | /* scan Bits 16-23 */ + ((long) (ks & 0xff) << 24L))); /* kstate Bits 24-31 */ + return knorm; +} + + +int +nkc_exit(void) +{ + /* dummy */ + return 0; +} diff --git a/atari/toolbar.c b/atari/toolbar.c index 360d2e66c..9a192b24b 100755 --- a/atari/toolbar.c +++ b/atari/toolbar.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -44,6 +43,7 @@ #include "atari/clipboard.h" #include "atari/misc.h" #include "atari/global_evnt.h" +#include "atari/nkcc.h" #include "atari/res/netsurf.rsh" #include "atari/plot/plotter.h" diff --git a/atari/treeview.c b/atari/treeview.c index 9f1ddb65c..85717ec86 100755 --- a/atari/treeview.c +++ b/atari/treeview.c @@ -22,7 +22,6 @@ #include #include #include -#include #include "content/urldb.h" #include "desktop/browser.h" @@ -38,6 +37,7 @@ #include "atari/treeview.h" #include "atari/plot.h" #include "atari/misc.h" +#include "atari/nkcc.h" extern int mouse_hold_start[3]; extern browser_mouse_state bmstate; -- cgit v1.2.3