/* * Mimas conversion tools * * Copyright (C) 2010 Benjamin Moody * * 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 . */ #define PROGHEADER_TYPE 5 #define PROGHEADER_FLAGS 6 #define PROGHEADER_SYMBOL_START 8 #define PROGHEADER_SYMBOL_STRING_START 10 #define PROGHEADER_CONSTANT_START 12 #define PROGHEADER_IMPORT_START 14 #define PROGHEADER_SECTION_TABLE_START 16 #define PROGHEADER_SECTION_TABLE_END 18 #define PROGHEADER_LENGTH 20 #define PROGHEADER_CODE_END PROGHEADER_SYMBOL_START #define PROGHEADER_SYMBOL_END PROGHEADER_SYMBOL_STRING_START #define PROGHEADER_SYMBOL_STRING_END PROGHEADER_CONSTANT_START #define PROGHEADER_CONSTANT_END PROGHEADER_IMPORT_START #define PROGHEADER_IMPORT_END PROGHEADER_SECTION_TABLE_START #define PROGTYPE_GENERIC 0 #define PROGTYPE_TI83P 1 #define PROGFLAG_LOCKED 1 #define SECTHEADER_SECTION_TYPE 0 #define SECTHEADER_DATA_START 1 #define SECTHEADER_DATA_END 3 #define SECTHEADER_NAME 5 #define SECTHEADER_LENGTH 13 #define SECTION_HEADER 0 #define SECTION_CODE 1 #define SECTION_DATA 2 #define SECTION_FOOTER 3 #define SECTION_DISABLED 0x80 #define T_NORMAL 0x000 #define T_LABEL 0x040 #define T_COMMENT 0x080 #define T_SPECIAL 0x0C0 #define S_ASCII 0x81 #define S_ASCIZ 0x82 #define S_HEX 0x83 #define S_INCBIN 0x84 #define S_BCALL 0x05 #define S_BJUMP 0x06 #define S_BREAK 0x07 #define S_BREAK_ccc 0x08 #define S_EQU 0x09 #define S_JQ_n 0x0A #define S_JQ_cc_n 0x0B #define S_ALIGN 0x0C #define S_ASSERT 0x0D #define S_BLOCK 0x0E #define S_BYTE 0x0F #define S_ELSE 0x10 #define S_ENDIF 0x11 #define S_IF 0x12 #define S_IFDEF 0x13 #define S_IFNDEF 0x14 #define S_ORG 0x15 #define S_RORG 0x16 #define S_WORD 0x17 #define X_SYMBOL 0 #define X_SPECIAL 0x040 #define X_EXECPC X_SPECIAL #define X_LOADPC (X_SPECIAL + 1) #define X_PREV_ANON (X_SPECIAL + 2) #define X_NEXT_ANON (X_SPECIAL + 3) #define X_BYTE 0x50 #define X_DEC8 X_BYTE #define X_HEX8 (X_BYTE + 1) #define X_OCT8 (X_BYTE + 2) #define X_BIN8 (X_BYTE + 3) #define X_CHAR (X_BYTE + 4) #define X_ENUM8 (X_BYTE + 5) #define X_SYSFLAG X_ENUM8 #define X_SCANCODE (X_ENUM8 + 1) #define X_DATATYPE (X_ENUM8 + 2) #define X_KEY (X_ENUM8 + 3) #define X_KEY_FB (X_ENUM8 + 4) #define X_KEY_FC (X_ENUM8 + 5) #define X_WORD 0x60 #define X_DEC16 X_WORD #define X_HEX16 (X_WORD + 1) #define X_OCT16 (X_WORD + 2) #define X_BIN16 (X_WORD + 3) #define X_ROMCALL (X_WORD + 4) #define X_SYSADDR (X_WORD + 5) #define X_UNARY 0x090 #define X_LSB X_UNARY #define X_MSB (X_UNARY + 1) #define X_MINUS (X_UNARY + 2) #define X_COMPLEMENT (X_UNARY + 3) #define X_NOT (X_UNARY + 4) #define X_PAREN (X_UNARY + 5) #define X_REGVAL (X_UNARY + 6) #define X_ARGVAL (X_UNARY + 7) #define X_BINARY 0x0A0 #define X_MUL X_BINARY #define X_DIV (X_BINARY + 1) #define X_MOD (X_BINARY + 2) #define X_ADD (X_BINARY + 3) #define X_SUB (X_BINARY + 4) #define X_LSHIFT (X_BINARY + 5) #define X_RSHIFT (X_BINARY + 6) #define X_GREATER (X_BINARY + 7) #define X_LESS (X_BINARY + 8) #define X_GE (X_BINARY + 9) #define X_LE (X_BINARY + 10) #define X_EQUAL (X_BINARY + 11) #define X_NE (X_BINARY + 12) #define X_AND (X_BINARY + 13) #define X_XOR (X_BINARY + 14) #define X_OR (X_BINARY + 15) #define X_DEC6 0x0C0 #define X_REG_B X_DEC6 #define X_REG_C (X_DEC6 + 1) #define X_REG_D (X_DEC6 + 2) #define X_REG_E (X_DEC6 + 3) #define X_REG_H (X_DEC6 + 4) #define X_REG_L (X_DEC6 + 5) #define X_REG_iHL (X_DEC6 + 6) #define X_REG_A (X_DEC6 + 7) #define X_REG_BC (X_DEC6 + 0x08) #define X_REG_DE (X_DEC6 + 0x0A) #define X_REG_HL (X_DEC6 + 0x0C) #define X_REG_SP (X_DEC6 + 0x0E) #define X_REG_IX (X_DEC6 + 0x10) #define X_REG_IY (X_DEC6 + 0x12) #define X_REG_AF2 (X_DEC6 + 0x14) #define X_REG_AF (X_DEC6 + 0x16) #define X_REG_I (X_DEC6 + 0x18) #define X_REG_R (X_DEC6 + 0x19) #define X_REG_IXH (X_DEC6 + 0x1C) #define X_REG_IXL (X_DEC6 + 0x1D) #define X_REG_IYH (X_DEC6 + 0x24) #define X_REG_IYL (X_DEC6 + 0x25) #define X_COND_NZ (X_DEC6 + 0x28) #define X_COND_Z (X_DEC6 + 0x29) #define X_COND_NC (X_DEC6 + 0x2A) #define X_COND_C (X_DEC6 + 0x2B) #define X_COND_PO (X_DEC6 + 0x2C) #define X_COND_PE (X_DEC6 + 0x2D) #define X_COND_P (X_DEC6 + 0x2E) #define X_COND_M (X_DEC6 + 0x2F) #define AC_mask 0x3C #define AC_CONSTANT 0x00 #define AC_BCDEHLMA 0x04 #define AC_BCDEHLA 0x08 #define AC_BCDEA 0x0C #define AC_BDHS 0x10 #define AC_BDHA 0x14 #define AC_BDS 0x18 #define AC_IXHL 0x1C #define AC_IYHL 0x20 #define AC_ZCPS 0x24 #define AC_ZC 0x28