ORCA-Pascal/cgc.pas

1 line
9.5 KiB
ObjectPascal
Raw Normal View History

{$optimize -1} {---------------------------------------------------------------} { } { ORCA Code Generator Common } { } { This unit contains the command constants, types, } { variables and procedures used throughout the code } { generator, but which are not available to the compiler. } { } {---------------------------------------------------------------} { } { These routines are defined in the compiler, but used from } { the code generator. } { } { Error - flag an error } { CMalloc - Clear and allocate memory from a pool. } { Malloc - Allocate memory from a pool. } { } {---------------------------------------------------------------} unit CGC; interface {$LibPrefix '0/obj/'} uses PCommon, CGI; {$segment 'cg'} const {Code Generation} {---------------} maxCBuff = 191; {length of constant buffer} {65816 native code generation} {----------------------------} {instruction modifier flags} shift8 = 1; {shift operand left 8 bits} shift16 = 2; {shift operand left 16 bits} toolCall = 4; {generate a tool call} stringReference = 8; {generate a string reference} usertoolCall = 16; {generate a usertool call} isPrivate = 32; {is the label private?} constantOpnd = 64; {the absolute operand is a constant} localLab = 128; {the operand is a local lab} sub1 = 256; {subtract 1 from the operand} m_adc_abs = $6D; {op code #s for 65816 instructions} m_adc_dir = $65; m_adc_imm = $69; m_adc_s = $63; m_and_abs = $2D; m_and_dir = $25; m_and_imm = $29; m_and_s = $23; m_asl_a = $0A; m_bcc = $90; m_bcs = $B0; m_beq = $F0; m_bit_imm = $89; m_bmi = $30; m_bne = $D0; m_bpl = $10; m_bra = $80; m_brl = $82; m_bvs = $70; m_clc = $18; m_cmp_abs = $CD; m_cmp_dir = $C5; m_cmp_dirX = $D5; m_cmp_imm = $C9; m_cmp_long = $CF; m_cmp_s = $C3; m_cop = $02; m_cpx_abs = 236; m_cpx_dir = 228; m_cpx_imm = 224; m_dea = 58; m_dec_abs = 206; m_dec_absX = $DE; m_dec_dir = 198; m_dec_dirX = 214; m_dex = 202; m_dey = 136; m_eor_abs = 77; m_eor_dir = 69; m_eor_imm = 73; m_eor_s = 67; m_ina = 26; m_inc_abs = 238; m_inc_absX = $FE; m_inc_dir = 230; m_inc_dirX = 246; m_inx = 232; m_iny = 200; m_jml