Files
BAS2.4/equates.inc
T
2026-10-26 13:21:10 +03:00

218 lines
6.7 KiB
HTML

; ==================================================
; Orion BASIC v2.4 for Orion-128 computer
;
; Equates, constants
; Disassembled by Romychs @ 2026-10-19
; ==================================================
; --------------------------------------------------
; ASCII control codes supported by MONITOR v2
; --------------------------------------------------
ASCII_NUL EQU 0x00 ; NUL (null)
;ASCII_EOT EQU 0x04 ; EOT (End of transmission)
ASCII_BELL EQU 0x07 ; 7
ASCII_BS EQU 0x08 ; Move cursor left
ASCII_TAB EQU 0x09 ; HT (Horizontal tab)
ASCII_LF EQU 0x0A ; 10 - LF (Line feed)
ASCII_FF EQU 0x0C ; Set cursor to top left position
ASCII_CR EQU 0x0D ; 13 - CR, move cursor to first column
ASCII_CAN EQU 0x18 ; Move cursor right
ASCII_EOM EQU 0x19 ; Move cursor up
ASCII_ESC EQU 0x1B ; Escape
ASCII_SP EQU 0x20 ; Space
ASCII_SUB EQU 0x1A ; Move cursor down
ASCII_US EQU 0x1F ; Clear screen and move cursor to top left position
INVERSE EQU 0x7F ; Inverser output
ASCII_CUR EQU 0x24 ; $
ASCII_SQ EQU 0x27 ; '
ASCII_BKSL EQU 0x5C ; \
AP2_KEY EQU 0x1B ; AP2 key
CTRL_C EQU 0x03
KEY_LEFT EQU 0x08
KEY_RIGHT EQU 0x18
KEY_UP EQU 0x19
KEY_DOWN EQU 0x1A ; Move cursor down
; --------------------------------------------------
; Statement tokens
; --------------------------------------------------
ENDTK EQU 0x80
; -- 0x80..0x8F
_CLS EQU 0x80
_FOR EQU 0x81
_NEXT EQU 0x82
_DATA EQU 0x83
_INPUT EQU 0x84
_DIM EQU 0x85
_READ EQU 0x86
_CUR EQU 0x87
_GOTO EQU 0x88
_RUN EQU 0x89
_IF EQU 0x8A
_RESTORE EQU 0x8B
_GOSUB EQU 0x8C
_RETURN EQU 0x8D
_REM EQU 0x8E
_STOP EQU 0x8F
; -- 0x90..0x9F
_DPL EQU 0x90
_ON EQU 0x91
_PSET EQU 0x92
_LINE EQU 0x93
_POKE EQU 0x94
_PRINT EQU 0x95
_DEF EQU 0x96
_CONT EQU 0x97
_LIST EQU 0x98
_CLEAR EQU 0x99
_LLIST EQU 0x9A
_LPRINT EQU 0x9B
_NEW EQU 0x9C
_EDIT EQU 0x9D
_COLOR EQU 0x9E
_BOX EQU 0x9F
; -- 0xA0..0xAF
_SCREEN EQU 0xA0
_PAINT EQU 0xA1
_SYSTEM EQU 0xA2
_SAVE EQU 0xA3
_LOAD EQU 0xA4
_FILES EQU 0xA5
_KILL EQU 0xA6
NUMCMD EQU _KILL - _CLS + 1
_TAB EQU 0xA7
_TO EQU 0xA8
_SPC EQU 0xA9
_FN EQU 0xAA
_THEN EQU 0xAB
_NOT EQU 0xAC
_STEP EQU 0xAD
; Simple operation tokens
PLUSTK EQU 0xAE ; +
MINUTK EQU 0xAF ; -
MULTK EQU 0xB0 ; *
DIVTK EQU 0xB1 ; /
EXPTK EQU 0xB2 ; ^
; Other tokens
_AND EQU 0xB3
_OR EQU 0xB4
GREATK EQU 0xB5 ; >
EQUTK EQU 0xB6 ; =
LESSTK EQU 0xB7 ; <
NMREL EQU LESSTK - GREATK + 1
ONEFUN EQU 0xB8 ; first function number
; Function tokens
_SGN EQU 0xB8
_INT EQU 0xB9
_ABS EQU 0xBA
_USR EQU 0xBB
_FRE EQU 0xBC
_INP EQU 0xBD
_POS EQU 0xBE
_SQR EQU 0xBF
; -- 0xC0..0xCF
_RND EQU 0xC0
_LOG EQU 0xC1
_EXP EQU 0xC2
_COS EQU 0xC3
_SIN EQU 0xC4
_TAN EQU 0xC5
_ATN EQU 0xC6
_PEEK EQU 0xC7
_LEN EQU 0xC8
_STR EQU 0xC9
_VAL EQU 0xCA
_ASC EQU 0xCB
_CHR EQU 0xCC
NUMGFN EQU 2*_CHR - 2*ONEFUN + 1
; 2-3 param functions
_LEFT EQU 0xCD
_RIGHT EQU 0xCE
_MID EQU 0xCF
; -- 0xD0..0xDF
_GET EQU 0xD0
_PUT EQU 0xD1
; Extra tokens (v2.4)
_SOUND EQU 0xD2
_DELETE EQU 0xD3
_AUTO EQU 0xD4
_RENUM EQU 0xD5
_MERGE EQU 0xD6
_ELSE EQU 0xD7
INCSTR EQU 2
; --------------------------------------------------
; CPU Operations
; --------------------------------------------------
LD_BC_nn EQU 0x01
LD_B_n EQU 0x06
LD_C_n EQU 0x0e
LD_DE_nn EQU 0x11
LD_D_n EQU 0x16
LD_E_n EQU 0x1e
LD_HL_nn EQU 0x21
LD_L_n EQU 0x2e
LD_SP_nn EQU 0x31
LD_A_n EQU 0x3e
JP_nn EQU 0xc3
JP_NC_nn EQU 0xd2
JP_P_nn EQU 0xf2
OR_n EQU 0xf6
CP_n EQU 0xfe
; --------------------------------------------------
; Other constants
; --------------------------------------------------
FORSIZ EQU 13
CLMWID EQU 14
LSTOPK EQU 7
NUMLEV EQU 19 ; num safe of levels on stack
STRSIZ EQU 4
NUMTMP EQU 3
BUFLEN EQU 37 ; length of buffer by definition, but 130 = 0x82 can be used
COLUMNS EQU 64 ; screen columns
SCR_ADDR EQU 0xC000
SCR_WIDTH EQU 384
SCR_HEIGHT EQU 256
; --------------------------------------------------
; Error codes
; --------------------------------------------------
ERRNF EQU 0x00 ; 0 Next w/o for
ERRSN EQU 0x02 ; 2 Syntax Error
ERRRG EQU 0x04 ; 4 Return w/o GOSUB
ERROD EQU 0x06 ; 6 Out of DATA
ERRFC EQU 0x08 ; 8 Illegal function call
ERROV EQU 0x0a ; 10 Overflow
ERROM EQU 0x0c ; 12 Out of memory
ERRUS EQU 0x0e ; 14 Undefined line number
ERRBS EQU 0x10 ; 16 Subscript out of range
ERRDD EQU 0x12 ; 18 Double dimensioned error
ERRDV0 EQU 0x14 ; 20 Division by zero
ERRID EQU 0x16 ; 22 Illegal direct
ERRTM EQU 0x18 ; 24 Type mismatch
ERRSO EQU 0x1a ; 26 Out of string space
ERRLS EQU 0x1c ; 28 String too long
ERRST EQU 0x1e ; 30 String temporary error
ERRCN EQU 0x20 ; 32 Can't continue
ERRUF EQU 0x22 ; 34 Undefined user function