BIT DATA FORMAT --------------- INPUT bits: abc nibble: jklm read: pqrstuvw NEED NIB BIT READ RESULT NIB BIT 8 * * Y pqrstuvw MODE DATA STRUCTURES -------------------- COMMON BYTE BITS USAGE 0 6-7 type of mode: 0=menu 1=text 2=entry 3=func 0 0-5 byte count of entire mode (including this byte) TEXT 40 #ofBits USAGE 8 common 8 # lines-1 15 first string NOTE: hi bit of nextmode is in hi bit of str 9 next mode MENU 00 #ofBits USAGE 8 common 8 # menu items 16 title string (others follow title string) 9 next mode 0 9 next mode 1 ... ENTRY #ofBits USAGE 8 common 80 4 mask (upper|lower|digit|space) 4 prompt string 8 function index 8 parm0 (optional) 8 parm1 (optional) ... FUNC #ofBits USAGE 8 common c0 8 function index 8 parm0 (optional) 8 parm1 (optional) ... NEXT MODE FORMAT 0 = POP N = (N = 1-255) PUSH mode N 512+N = (N = 1-255) SET mode N STRING FORMATS -------------- ALPHA MODE (default) - 5 bits 0-25 a-z 26 space 27 ->caps 28 ->alpha 29 ->num 30 special follows 31 8 bit ASCII char follows CAPS MODE - 5 bits 0-25 A-Z 26 space 27 ->caps 28 ->alpha 29 ->num 30 special follows 31 8 bit ASCII char follows NUM MODE - 4 bits 0-9 0-9 10 space 11 ->caps 12 ->alpha 13 ->num 14 special follows 15 8 bit ASCII char follows SPECIAL STRING CHARS CODE PARM(BITS) DESCIP - clear screen - backspace - cursor on - cursor off - ir look char(8) graphic character - game time - real time - current clue title - current clue time elapsed - CHARACTER DEFINITION ; this causes char to be defined AND displayed at current cursor loc 28 bits total SIZE DESCRIP 3 which char to use 5 pixels 5 pixels 5 pixels 5 pixels 5 pixels CODE FORMAT ----------- BITS DESC 4 length of code (characters) N*6 code characters 1 function parm 1 function index CONVERTING A STRING TO A CODE NUMBER: int filter(int c) { A-K ==> 0-10 L ==> 9 (same as I) M-Z ==> 11-24 0 ==> 13 (same as O) 1 ==> 9 (same as I) 2-9 ==> 25-32 c = toupper(c); ASSERT(isdigit(c) || isupper(c)); c -= 'A' } int convert(char *code) { char *s = code int num = 0; for (; *s; s++) { if (*s != A-Z0-9) continue num *= 33; num += filer(*s); } return num; } GET NEXT CODE NUMBER 6 digit codes: MAX = 33^6 = 1291467969 = 0x4cfa3cc1 ADD = 0x0632d80f int inc_code(int num) { num = swap_each_nibble_pair(num) num += ADD; num %= MAX } |
This file Copyright (C) 2004 by Nathan (Acorn) Pooley
Go to DRUID Development page
Go to DRUID page
Go to JU Gadgets page
Go to Justice Unlimited homepage
Go to Acorn's personal webpage
Contact Acorn
See comments from others
Post your own comments
File created by do_doc at Wed Aug 4 18:08:33 2004