more sane directory name, updated binaries

This commit is contained in:
FeralChild64 committed 2020-06-26 19:44:01 +02:00
1 parent d4d32095d1
commit 76aaf298b8
697 files changed
+56 -56

No files matched your search

+366
View File
@@ -0,0 +1,366 @@
//
// Various configuration dependent aliases/macros/checks
//
.encoding "petscii_upper"
// Check that platform configuration is correct
{
.var selected = 0;
#if CONFIG_PLATFORM_COMMODORE_64
.eval selected++
#endif
#if CONFIG_PLATFORM_COMMANDER_X16
.eval selected++
#endif
.if (selected != 1) .error "Please select exactly one CONFIG_PLATFORM_* option"
}
// Check that motherboard extras configuration is correct
{
.var selected = 0;
#if CONFIG_MB_MEGA_65
.eval selected++
#endif
#if CONFIG_MB_ULTIMATE_64
.eval selected++
#endif
.if (selected > 1) .error "Please select at most one CONFIG_MB_* option"
#if !CONFIG_PLATFORM_COMMODORE_64 && CONFIG_BRAND_MEGA_65 &&
.error "CONFIG_BRAND_MEGA_65 can only be used with CONFIG_PLATFORM_COMMODORE_64"
#endif
#if !CONFIG_PLATFORM_COMMODORE_64 && CONFIG_BRAND_ULTIMATE_64 &&
.error "CONFIG_BRAND_ULTIMATE_64 can only be used with CONFIG_PLATFORM_COMMODORE_64"
#endif
#if CONFIG_MB_MEGA_65 && (CONFIG_SID_2ND || CONFIG_SID_3RD || CONFIG_SID_D4XX || CONFIG_SID_D5XX)
.error "CONFIG_MB_MEGA_65 cannot be used with CONFIG_SID_*"
#endif
}
// Check that brand configuration is correct
{
.var selected = 0;
#if CONFIG_BRAND_CUSTOM_BUILD
.eval selected++
#endif
#if CONFIG_BRAND_GENERIC
.eval selected++
#endif
#if CONFIG_BRAND_TESTING
.eval selected++
#endif
#if CONFIG_BRAND_MEGA_65
.eval selected++
#endif
#if CONFIG_BRAND_ULTIMATE_64
.eval selected++
#endif
.if (selected != 1) .error "Please select exactly one CONFIG_BRAND_* option"
#if CONFIG_MB_MEGA_65 && !(CONFIG_BRAND_MEGA_65 || CONFIG_BRAND_TESTING || CONFIG_BRAND_CUSTOM_BUILD)
.error "Please select brand either matching the CONFIG_MB_*, or a testing/custom one"
#endif
#if CONFIG_MB_ULTIMATE_64 && !(CONFIG_BRAND_ULTIMATE_64 || CONFIG_BRAND_TESTING || CONFIG_BRAND_CUSTOM_BUILD)
.error "Please select brand either matching the CONFIG_MB_*, or a testing/custom one"
#endif
}
// Check that processor configuration is correct
{
.var selected = 0;
#if CONFIG_CPU_MOS_6502
.eval selected++
#endif
#if CONFIG_CPU_WDC_65C02
.eval selected++
#endif
#if CONFIG_CPU_CSG_65CE02
.eval selected++
#endif
#if CONFIG_CPU_M65_45GS02
.eval selected++
#endif
#if CONFIG_CPU_WDC_65816
.eval selected++
#endif
.if (selected != 1) .error "Please select exactly one CONFIG_CPU_* option"
}
// Check that memory model and ROM layout configurations is correct
{
#if ROM_LAYOUT_M65 && !CONFIG_CPU_M65_45GS02
.error "Mega65 ROM layout requires CONFIG_CPU_M65_45GS02"
#endif
#if ROM_LAYOUT_M65 && !CONFIG_MB_MEGA_65
.error "Mega65 ROM layout requires CONFIG_MB_MEGA_65"
#endif
.var selected = 0;
#if CONFIG_MEMORY_MODEL_38K
.eval selected++
#endif
#if CONFIG_MEMORY_MODEL_46K
.eval selected++
#endif
#if CONFIG_MEMORY_MODEL_50K
.eval selected++
#endif
#if CONFIG_MEMORY_MODEL_60K
.eval selected++
#endif
.if (selected != 1) .error "Please select exactly one CONFIG_MEMORY_MODEL_* option"
}
// Check that IEC configuration is correct
{
#if CONFIG_IEC_JIFFYDOS && !CONFIG_IEC
.error "CONFIG_IEC_JIFFYDOS requires CONFIG_IEC"
#endif
#if CONFIG_IEC_JIFFYDOS_BLANK && !CONFIG_IEC_JIFFYDOS
.error "CONFIG_IEC_JIFFYDOS_BLANK requires CONFIG_IEC_JIFFYDOS"
#endif
#if CONFIG_IEC_DOLPHINDOS && !CONFIG_IEC
.error "CONFIG_IEC_DOLPHINDOS requires CONFIG_IEC"
#endif
#if CONFIG_IEC_DOLPHINDOS_FAST && !CONFIG_IEC_DOLPHINDOS
.error "CONFIG_IEC_DOLPHINDOS_FAST requires CONFIG_IEC_DOLPHINDOS"
#endif
#if (CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_MEGA_65) && !CONFIG_IEC
.error "CONFIG_IEC_BURST_* requires CONFIG_IEC"
#endif
#if CONFIG_IEC_BURST_MEGA_65 && !CONFIG_MB_MEGA_65
.error "CONFIG_IEC_BURST_MEGA_65 requires CONFIG_MB_MEGA_65"
#endif
.var selected_iec_burst = 0;
#if CONFIG_IEC_BURST_CIA1
.eval selected_iec_burst++
#endif
#if CONFIG_IEC_BURST_CIA2
.eval selected_iec_burst++
#endif
#if CONFIG_IEC_BURST_MEGA_65
.eval selected_iec_burst++
#endif
.if (selected_iec_burst > 1) .error "Please select at most one CONFIG_IEC_BURST_* option"
}
// Check that tape configuration is correct
{
#if (!CONFIG_TAPE_NORMAL || !CONFIG_TAPE_TURBO) && CONFIG_TAPE_AUTODETECT
.error "CONFIG_TAPE_AUTODETECT requires both CONFIG_TAPE_NORMAL and CONFIG_TAPE_TURBO"
#endif
}
// Check that RS-232 configuration is correct
{
#if CONFIG_RS232_UP9600 && (CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO)
.error "CONFIG_RS232_UP9600 is not compatible with CONFIG_TAPE_*"
#endif
.var selected_rs232 = 0;
#if CONFIG_RS232_UP2400
.eval selected_rs232++
#endif
#if CONFIG_RS232_UP9600
.eval selected_rs232++
#endif
.if (selected_rs232 > 1) .error "Please select at most one CONFIG_RS232_* option"
}
// Check that startup banner configuration is correct
{
.var selected = 0;
#if CONFIG_BANNER_SIMPLE
.eval selected++
#endif
#if CONFIG_BANNER_FANCY
.eval selected++
#endif
#if CONFIG_BANNER_BRAND
.eval selected++
#endif
.if (selected != 1) .error "Please select exactly one CONFIG_BANNER_* option"
#if CONFIG_BANNER_BRAND && !CONFIG_BRAND_MEGA_65
.error "CONFIG_BANNER_BRAND is not supported for your CONFIG_BRAND_*"
#endif
#if CONFIG_MB_MEGA_65 && CONFIG_SHOW_PAL_NTSC
.error "MEGA65 can switch PAL/NTSC during run-time, CONFIG_SHOW_PAL_NTSC makes no sense"
#endif
}
// Check if keyboard options are correct
.function CHECK_KEYCMD(keycmd)
{
.if (keycmd.size() > 0) .return 1
.return 0
}
{
#if CONFIG_LEGACY_SCNKEY && CONFIG_RS232_UP9600
.error "CONFIG_LEGACY_SCNKEY is not compatible with CONFIG_RS232_UP9600"
#endif
#if CONFIG_LEGACY_SCNKEY && CONFIG_TAPE_NORMAL
.error "CONFIG_LEGACY_SCNKEY is not compatible with CONFIG_TAPE_NORMAL"
#endif
#if CONFIG_LEGACY_SCNKEY && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C128_CAPS_LOCK || CONFIG_KEYBOARD_C65 || CONFIG_KEYBOARD_C65_CAPS_LOCK)
.error "CONFIG_LEGACY_SCNKEY and CONFIG_KEYBOARD_C128* / CONFIG_KEYBOARD_C65* are mutually exclusive"
#endif
#if (CONFIG_MB_MEGA_65 || CONFIG_MB_ULTIMATE_64) && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C128_CAPS_LOCK)
.error "Selected CONFIG_MB_* is not compatible with CONFIG_KEYBOARD_C128*"
#endif
#if CONFIG_MB_ULTIMATE_64 && (CONFIG_KEYBOARD_C65 || CONFIG_KEYBOARD_C65_CAPS_LOCK)
.error "Selected CONFIG_MB_* is not compatible with CONFIG_KEYBOARD_C65*"
#endif
.var num_pkeys_base = 0
.var num_pkeys_ext1 = 0
.var num_pkeys_ext2 = 0
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_RUN)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F1)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F2)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F3)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F4)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F5)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F6)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F7)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F8)
.eval num_pkeys_ext1 += CHECK_KEYCMD(CONFIG_KEYCMD_HELP)
.eval num_pkeys_ext2 += CHECK_KEYCMD(CONFIG_KEYCMD_F9)
.eval num_pkeys_ext2 += CHECK_KEYCMD(CONFIG_KEYCMD_F10)
.eval num_pkeys_ext2 += CHECK_KEYCMD(CONFIG_KEYCMD_F11)
.eval num_pkeys_ext2 += CHECK_KEYCMD(CONFIG_KEYCMD_F12)
.eval num_pkeys_ext2 += CHECK_KEYCMD(CONFIG_KEYCMD_F13)
.eval num_pkeys_ext2 += CHECK_KEYCMD(CONFIG_KEYCMD_F14)
.var num_pkeys = num_pkeys_base
#if !CONFIG_LEGACY_SCNKEY && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65)
.eval num_pkeys += num_pkeys_ext1
#endif
#if !CONFIG_LEGACY_SCNKEY && CONFIG_KEYBOARD_C65
.eval num_pkeys += num_pkeys_ext2
#endif
#if CONFIG_PROGRAMMABLE_KEYS
.if (num_pkeys == 0) .error "CONFIG_PROGRAMMABLE_KEYS requires at least one defined key"
#endif
}
// Check that features are configured correctly
{
#if CONFIG_TAPE_WEDGE && !CONFIG_TAPE_TURBO && !CONFIG_TAPE_NORMAL
.error "CONFIG_TAPE_WEDGE requires CONFIG_TAPE_TURBO or CONFIG_TAPE_NORMAL"
#endif
#if !CONFIG_TAPE_WEDGE && CONFIG_TAPE_HEAD_ALIGN
.error "CONFIG_TAPE_HEAD_ALIGN requires CONFIG_TAPE_WEDGE"
#endif
}
// Handle I/O configuration
#if CONFIG_RS232_UP2400 || CONFIG_RS232_UP9600
#define HAS_RS232
#endif
// Handle configuration of various features
#if CONFIG_BCD_SAFE_INTERRUPTS
#define HAS_BCD_SAFE_INTERRUPTS
#endif
// Handle configuration of debug infrastructure
.macro STUB_IMPLEMENTATION_RTS() {
rts
}
.macro STUB_IMPLEMENTATION_BRK() {
.break
brk
brk
jmp *-2
}
.macro STUB_IMPLEMENTATION()
{
#if CONFIG_DBG_STUBS_BRK
STUB_IMPLEMENTATION_BRK()
#else
STUB_IMPLEMENTATION_RTS()
#endif
}
// Setup colors
#if CONFIG_COLORS_BRAND && CONFIG_BRAND_ULTIMATE_64
.const CONFIG_COLOR_BG = $00
.const CONFIG_COLOR_TXT = $01
#else
.const CONFIG_COLOR_BG = $06
.const CONFIG_COLOR_TXT = $01
#endif
+427
View File
@@ -0,0 +1,427 @@
//
// Provide pseudocommands (and other goodies) to make CPU optimizations easier
//
#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_CSG_4510 || CONFIG_CPU_M65_45GS02 || CONFIG_CPU_WDC_65816
.cpu _65c02
#define HAS_OPCODES_65C02
#define HAS_BCD_SAFE_INTERRUPTS
#endif
#if CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_CSG_4510 || CONFIG_CPU_M65_45GS02
#define HAS_OPCODES_65CE02
#endif
#if CONFIG_CPU_CSG_4510 || CONFIG_CPU_M65_45GS02
#define HAS_OPCODES_4510
#endif
#if CONFIG_CPU_M65_45GS02
#define HAS_OPCODES_45GS02
#endif
#if CONFIG_CPU_WDC_65816
#define HAS_OPCODES_65816
#endif
//
// These are not exactly for optimization - but to encourage proper usage of panic screen
//
.pseudocommand panic code
{
// If case no panic screen is used, we can skip providing error codes within Kernal
#if CONFIG_PANIC_SCREEN
lda code
#endif
jmp ($E4B7)
}
//
// Macros for generating jumptables
//
.macro put_jumptable_lo(list)
{
.for (var i = 0; i < list.size(); i++)
{
.byte mod((list.get(i) - 1), $100)
}
}
.macro put_jumptable_hi(list)
{
.for (var i = 0; i < list.size(); i++)
{
.byte floor((list.get(i) - 1) / $100)
}
}
#if HAS_OPCODES_65C02
.macro put_jumptable(list)
{
.for (var i = 0; i < list.size(); i++)
{
.word list.get(i)
}
}
#endif
//
// Trick to skip a 2-byte instruction
//
.pseudocommand skip_2_bytes_trash_nvz { .byte $2C }
//
// Memory mapping for C65 and Mega65
//
#if HAS_OPCODES_4510
.pseudocommand map { .byte $5C }
.pseudocommand eom { .byte $EA }
#endif
//
// Some additional 65CE02 instructions
//
#if HAS_OPCODES_65CE02
// CPU flags support
.pseudocommand cle { .byte $02 }
.pseudocommand see { .byte $03 }
// .B register support
.pseudocommand tab { .byte $5B }
.pseudocommand tba { .byte $7B }
// .Z register support
.pseudocommand inz { .byte $1B }
.pseudocommand dez { .byte $3B }
.pseudocommand phz { .byte $DB }
.pseudocommand plz { .byte $FB }
.pseudocommand taz { .byte $4B }
.pseudocommand tza { .byte $6B }
// 16-bit data processing
.pseudocommand dew addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "DEW requires zeropage address"
.byte $C3, arg
}
.pseudocommand inw addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "INW requires zeropage address"
.byte $E3, arg
}
// Zero page bit handling
.pseudocommand rmb0 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "RMB0 requires zeropage address"
.byte $07, arg
}
.pseudocommand rmb1 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "RMB1 requires zeropage address"
.byte $17, arg
}
.pseudocommand rmb2 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "RMB2 requires zeropage address"
.byte $27, arg
}
.pseudocommand rmb3 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "RMB3 requires zeropage address"
.byte $37, arg
}
.pseudocommand rmb4 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "RMB4 requires zeropage address"
.byte $47, arg
}
.pseudocommand rmb5 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "RMB5 requires zeropage address"
.byte $57, arg
}
.pseudocommand rmb6 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "RMB6 requires zeropage address"
.byte $67, arg
}
.pseudocommand rmb7 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "RMB7 requires zeropage address"
.byte $77, arg
}
.pseudocommand smb0 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "SMB0 requires zeropage address"
.byte $87, arg
}
.pseudocommand smb1 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "SMB1 requires zeropage address"
.byte $97, arg
}
.pseudocommand smb2 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "SMB2 requires zeropage address"
.byte $A7, arg
}
.pseudocommand smb3 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "SMB3 requires zeropage address"
.byte $B7, arg
}
.pseudocommand smb4 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "SMB4 requires zeropage address"
.byte $C7, arg
}
.pseudocommand smb5 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "SMB5 requires zeropage address"
.byte $D7, arg
}
.pseudocommand smb6 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "SMB6 requires zeropage address"
.byte $E7, arg
}
.pseudocommand smb7 addr
{
.var arg = addr.getValue()
.if (arg > $FF) .error "SMB7 requires zeropage address"
.byte $F7, arg
}
// Additional addressing modes
.pseudocommand jsr_ind addr
{
.var arg = addr.getValue()
.byte $22, mod(arg, $100), floor(arg / $100)
}
#endif
//
// Calculation shortcuts
//
.pseudocommand lda_zero // WARNING: do not use within interrupts
{
#if HAS_OPCODES_65CE02
tba
#else
lda #$00
#endif
}
//
// Stack manipulation - some CPUs will leave .A unchanged, some will use it as temporary storage, so consider .A trashed
//
.pseudocommand phx_trash_a
{
#if HAS_OPCODES_65C02
phx
#else
txa
pha
#endif
}
.pseudocommand phy_trash_a
{
#if HAS_OPCODES_65C02
phy
#else
tya
pha
#endif
}
.pseudocommand plx_trash_a
{
#if HAS_OPCODES_65C02
plx
#else
pla
tax
#endif
}
.pseudocommand ply_trash_a
{
#if HAS_OPCODES_65C02
ply
#else
pla
tay
#endif
}
//
// Branches with far offsets, substitutes by Bxx + JMP for CPUs not supporting the instruction
//
.pseudocommand bcs_16 dst
{
#if HAS_OPCODES_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000) -2
.byte $B3, mod(offset, $100), floor(offset / $100)
#else
bcc __l
jmp dst
__l:
#endif
}
.pseudocommand bcc_16 dst
{
#if HAS_OPCODES_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000) -2
.byte $93, mod(offset, $100), floor(offset / $100)
#else
bcs __l
jmp dst
__l:
#endif
}
.pseudocommand beq_16 dst
{
#if HAS_OPCODES_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000) -2
.byte $F3, mod(offset, $100), floor(offset / $100)
#else
bne __l
jmp dst
__l:
#endif
}
.pseudocommand bne_16 dst
{
#if HAS_OPCODES_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000) -2
.byte $D3, mod(offset, $100), floor(offset / $100)
#else
beq __l
jmp dst
__l:
#endif
}
.pseudocommand bmi_16 dst
{
#if HAS_OPCODES_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000) -2
.byte $33, mod(offset, $100), floor(offset / $100)
#else
bpl __l
jmp dst
__l:
#endif
}
.pseudocommand bpl_16 dst
{
#if HAS_OPCODES_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000) -2
.byte $13, mod(offset, $100), floor(offset / $100)
#else
bmi __l
jmp dst
__l:
#endif
}
.pseudocommand bvc_16 dst
{
#if HAS_OPCODES_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000) -2
.byte $53, mod(offset, $100), floor(offset / $100)
#else
bvs __l
jmp dst
__l:
#endif
}
.pseudocommand bvs_16 dst
{
#if HAS_OPCODES_65CE02
.var offset = mod($10000 + dst.getValue() - *, $10000) -2
.byte $73, mod(offset, $100), floor(offset / $100)
#else
bvc __l
jmp dst
__l:
#endif
}
+69
View File
@@ -0,0 +1,69 @@
// Error codes for 'panic' pseudocommand
.const P_ERR_NONE = $00
.const P_ERR_ROM_MISMATCH = $01 // this value has to be stable as long as possible
// Kernal error codes - returned in the A register
// Described in 'Commodore 64 Programmer's Reference Guide', page 306
.const K_ERR_ROUTINE_TERMINATED = $00
.const K_ERR_TOO_MANY_OPEN_FILES = $01
.const K_ERR_FILE_ALREADY_OPEN = $02
.const K_ERR_FILE_NOT_OPEN = $03
.const K_ERR_FILE_NOT_FOUND = $04
.const K_ERR_DEVICE_NOT_FOUND = $05
.const K_ERR_FILE_NOT_INPUT = $06
.const K_ERR_FILE_NOT_OUTPUT = $07
.const K_ERR_FILE_NAME_MISSING = $08
.const K_ERR_ILLEGAL_DEVICE_NUMBER = $09
.const K_ERR_TOP_MEM_RS232 = $F0
// Kernal status codes for READST routine (IOSTATUS)
// Described in 'Commodore 64 Programmer's Reference Guide', page 292
// For IEC devices
.const K_STS_TIMEOUT_WRITE = $01
.const K_STS_TIMEOUT_READ = $02
.const K_STS_EOI = $40
.const K_STS_DEVICE_NOT_FOUND = $80
// For tape deck
.const K_STS_SHORT_BLOCK = $04
.const K_STS_LONG_BLOCK = $08
.const K_STS_READ_ERROR = $10
.const K_STS_CHECKSUM_ERROR = $20
.const K_STS_END_OF_FILE = $40
.const K_STS_END_OF_TAPE = $80
// BASIC error codes, taken from http://sta.c64.org/cbm64baserr.html
.const B_ERR_TOO_MANY_FILES = $01
.const B_ERR_FILE_OPEN = $02
.const B_ERR_FILE_NOT_OPEN = $03
.const B_ERR_FILE_NOT_FOUND = $04
.const B_ERR_DEVICE_NOT_PRESENT = $05
.const B_ERR_NOT_INPUT_FILE = $06
.const B_ERR_NOT_OUTPUT_FILE = $07
.const B_ERR_MISSING_FILENAME = $08
.const B_ERR_ILLEGAL_DEVICE_NUMBER = $09
.const B_ERR_NEXT_WITHOUT_FOR = $0A
.const B_ERR_SYNTAX = $0B
.const B_ERR_RETURN_WITHOUT_GOSUB = $0C
.const B_ERR_OUT_OF_DATA = $0D
.const B_ERR_ILLEGAL_QUANTITY = $0E
.const B_ERR_OVERFLOW = $0F
.const B_ERR_OUT_OF_MEMORY = $10
.const B_ERR_UNDEFD_STATEMENT = $11
.const B_ERR_BAD_SUBSCRIPT = $12
.const B_ERR_REDIMD_ARRAY = $13
.const B_ERR_DIVISION_BY_ZERO = $14
.const B_ERR_ILLEGAL_DIRECT = $15
.const B_ERR_TYPE_MISMATCH = $16
.const B_ERR_STRING_TOO_LONG = $17
.const B_ERR_FILE_DATA = $18
.const B_ERR_FORMULA_TOO_COMPLEX = $19
.const B_ERR_CANT_CONTINUE = $1A
.const B_ERR_UNDEFD_FUNCTION = $1B
.const B_ERR_VERIFY = $1C
.const B_ERR_LOAD = $1D
.const B_ERR_BREAK = $1E
+205
View File
@@ -0,0 +1,205 @@
//
// Names of hardware registers - names from C64 Programmer's Reference Guide, sometimes slightly modified
//
#if CONFIG_PLATFORM_COMMODORE_64
// CPU memory registers
.label CPU_D6510 = $00
.label CPU_R6510 = $01
// VIC-II registers
.label __VIC_BASE = $D000 // base address of the chip
.label VIC_SP0X = $D000
.label VIC_SP0Y = $D001
.label VIC_SP1X = $D002
.label VIC_SP1Y = $D003
.label VIC_SP2X = $D004
.label VIC_SP2Y = $D005
.label VIC_SP3X = $D006
.label VIC_SP3Y = $D007
.label VIC_SP4X = $D008
.label VIC_SP4Y = $D009
.label VIC_SP5X = $D00A
.label VIC_SP5Y = $D00B
.label VIC_SP6X = $D00C
.label VIC_SP6Y = $D00D
.label VIC_SP7X = $D00E
.label VIC_SP7Y = $D00F
.label VIC_MSIGX = $D010
.label VIC_SCROLY = $D011
.label VIC_RASTER = $D012
.label VIC_LPENX = $D013
.label VIC_LPENY = $D014
.label VIC_SPENA = $D015
.label VIC_SCROLX = $D016
.label VIC_YXPAND = $D017
.label VIC_YMCSB = $D018
.label VIC_IRQ = $D019
.label VIC_IRQMSK = $D01A
.label VIC_SPBGPR = $D01B
.label VIC_SPMC = $D01C
.label VIC_XXPAND = $D01D
.label VIC_SPSPCL = $D01E
.label VIC_SPBGCL = $D01F
.label VIC_EXTCOL = $D020
.label VIC_BGCOL0 = $D021
.label VIC_BGCOL1 = $D022
.label VIC_BGCOL2 = $D023
.label VIC_BGCOL3 = $D024
.label VIC_SPMC0 = $D025
.label VIC_SPMC1 = $D026
.label VIC_SP0COL = $D027
.label VIC_SP1COL = $D028
.label VIC_SP2COL = $D029
.label VIC_SP3COL = $D02A
.label VIC_SP4COL = $D02B
.label VIC_SP5COL = $D02C
.label VIC_SP6COL = $D02D
.label VIC_SP7COL = $D02E
#if !CONFIG_MB_MEGA_65 && !CONFIG_MB_ULTIMATE_64
.label VIC_XSCAN = $D02F // C128 only
.label VIC_CLKRATE = $D030 // C128 only
#endif
#if CONFIG_MB_MEGA_65
.label VIC_KEY = $D02F
.label VIC_XPOS = $D050
#endif
// SID registers
.label __SID_BASE = $D400 // base address of the chip
#if CONFIG_MB_MEGA_65
.label __SID_R1_OFFSET = $00 // right SID 1, $D400
.label __SID_R2_OFFSET = $20 // right SID 2, $D420
.label __SID_L1_OFFSET = $40 // left SID 1, $D440
.label __SID_L2_OFFSET = $60 // left SID 2, $D460
#endif
.label SID_FRELO1 = $D400
.label SID_FREHI1 = $D401
.label SID_PWLO1 = $D402
.label SID_PWHI1 = $D403
.label SID_VCREG1 = $D404
.label SID_ATDCY1 = $D405
.label SID_SUREL1 = $D406
.label SID_FRELO2 = $D407
.label SID_FREHI2 = $D408
.label SID_PWLO2 = $D409
.label SID_PWHI2 = $D40A
.label SID_VCREG2 = $D40B
.label SID_ATDCY2 = $D40C
.label SID_SUREL2 = $D40D
.label SID_FRELO3 = $D40E
.label SID_FREHI3 = $D40F
.label SID_PWLO3 = $D410
.label SID_PWHI3 = $D411
.label SID_VCREG3 = $D412
.label SID_ATDCY3 = $D413
.label SID_SUREL3 = $D414
.label SID_CUTLO = $D415
.label SID_CUTHI = $D416
.label SID_RESON = $D417
.label SID_SIGVOL = $D418
.label SID_POTX = $D419
.label SID_POTY = $D41A
.label SID_RANDOM = $D41B
.label SID_ENV3 = $D41C
// Color COLOR_RAM
.label COLOR_RAM = $D800
// CIA #1 registers
.label __CIA1_BASE = $DC00 // base address of the chip
.label CIA1_PRA = $DC00
.label CIA1_PRB = $DC01
.label CIA1_DDRA = $DC02
.label CIA1_DDRB = $DC03
.label CIA1_TIMALO = $DC04
.label CIA1_TIMAHI = $DC05
.label CIA1_TIMBLO = $DC06
.label CIA1_TIMBHI = $DC07
.label CIA1_TODTEN = $DC08
.label CIA1_TODSEC = $DC09
.label CIA1_TODMIN = $DC0A
.label CIA1_TODHRS = $DC0B
.label CIA1_SDR = $DC0C
.label CIA1_ICR = $DC0D
.label CIA1_CRA = $DC0E
.label CIA1_CRB = $DC0F
// CIA #2 registers
.label __CIA2_BASE = $DD00 // base address of the chip
.label CIA2_PRA = $DD00 // VIC bank switching and IEC port
.label CIA2_PRB = $DD01
.label CIA2_DDRA = $DD02
.label CIA2_DDRB = $DD03
.label CIA2_TIMALO = $DD04
.label CIA2_TIMAHI = $DD05
.label CIA2_TIMBLO = $DD06
.label CIA2_TIMBHI = $DD07
.label CIA2_TODTEN = $DD08
.label CIA2_TODSEC = $DD09
.label CIA2_TODMIN = $DD0A
.label CIA2_TODHRS = $DD0B
.label CIA2_SDR = $DD0C
.label CIA2_ICR = $DD0D
.label CIA2_CRA = $DD0E
.label CIA2_CRB = $DD0F
// CIA #2 helper bits - IEC bus
.const BIT_CIA2_PRA_ATN_OUT = $08 // 1 - low (pulled), 0 - high (released)
.const BIT_CIA2_PRA_CLK_OUT = $10 // 1 - low (pulled), 0 - high (released)
.const BIT_CIA2_PRA_DAT_OUT = $20 // 1 - low (pulled), 0 - high (released)
.const BIT_CIA2_PRA_CLK_IN = $40 // 0 - low (pulled), 1 - high (released)
.const BIT_CIA2_PRA_DAT_IN = $80 // 0 - low (pulled), 1 - high (released)
#if CONFIG_MB_MEGA_65
.label C65_EXTKEYS_PR = $D607
.label C65_EXTKEYS_DDR = $D608
.label M65_BADL_SLI = $D710
#else
// SuperCPU registers
.label SCPU_SPEED_NORMAL = $D07A
.label SCPU_SPEED_TURBO = $D07B
#endif
#endif
+73
View File
@@ -0,0 +1,73 @@
//
// Names of hardware registers
//
#if CONFIG_PLATFORM_COMMANDER_X16
// VERA registers
.label __VERA_BASE = $9F20 // base address of the chip
.label VERA_ADDR_LO = $9F20
.label VERA_ADDR_MID = $9F21
.label VERA_ADDR_HI = $9F22
.label VERA_DATA0 = $9F23
.label VERA_DATA1 = $9F24
.label VERA_CTRL = $9F25
.label VERA_IEN = $9F26
.label VERA_ISR = $9F27
// VIA #1 registers
.label __VIA1_BASE = $9F60 // base address of the chip
.label VIA1_PRB = $9F60
.label VIA1_PRA = $9F61
.label VIA1_DDRB = $9F62
.label VIA1_DDRA = $9F63
.label VIA1_T1C_L = $9F64
.label VIA1_T1C_H = $9F65
.label VIA1_T1L_L = $9F66
.label VIA1_T1L_H = $9F67
.label VIA1_T2C_L = $9F68
.label VIA1_T2C_H = $9F69
.label VIA1_SR = $9F6A
.label VIA1_ACR = $9F6B
.label VIA1_PCR = $9F6C
.label VIA1_IFR = $9F6D
.label VIA1_IER = $9F6E
.label VIA1_PRA_NH = $9F6F
// VIA #2 registers
.label __VIA2_BASE = $9F70 // base address of the chip
.label VIA2_PRB = $9F70
.label VIA2_PRA = $9F71
.label VIA2_DDRB = $9F72
.label VIA2_DDRA = $9F73
.label VIA2_T1C_L = $9F74
.label VIA2_T1C_H = $9F75
.label VIA2_T1L_L = $9F76
.label VIA2_T1L_H = $9F77
.label VIA2_T2C_L = $9F78
.label VIA2_T2C_H = $9F79
.label VIA2_SR = $9F7A
.label VIA2_ACR = $9F7B
.label VIA2_PCR = $9F7C
.label VIA2_IFR = $9F7D
.label VIA2_IER = $9F7E
.label VIA2_PRA_NH = $9F7F
#endif
+164
View File
@@ -0,0 +1,164 @@
//
// PETSCII codes for all the supported keys, for all the keyboards
//
// - [CM64] Compute's Mapping the Commodore 64
// - [CM128] Compute's Mapping the Commodore 128
// - https://github.com/MEGA65/c65-specifications/blob/master/c65manualupdated.txt
// - https://en.wikipedia.org/wiki/PETSCII
//
// Not really PETSCII codes, but bitmask values for SHFLAG variable
// [CM64] page 68, [CM128] page 212
.const KEY_FLAG_SHIFT = %00000001
.const KEY_FLAG_VENDOR = %00000010
.const KEY_FLAG_CTRL = %00000100
#if CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65
.const KEY_FLAG_ALT = %00001000
#if CONFIG_KEYBOARD_C128_CAPS_LOCK || CONFIG_KEYBOARD_C65_CAPS_LOCK
.const KEY_CAPS_LOCK = %00010000
#endif
.const KEY_FLAG_NO_SCRL = %00100000 // Open ROMs unofficial
#endif
// Note - the following PETSCII codes are currently unassigned, can be used for further extensions:
//
// $01, $02, $04, $06, $0A, $0B, $0C, $0F, $18, $82
.const KEY_NA = $00 // to indicate that no key is presed
// PETSCII codes for our extended screen editor
.const KEY_TAB_FW = $8F // CTRL+>, TAB - Open ROMs unofficial, original TAB conflicts with C64 PETSCII
.const KEY_TAB_BW = $80 // CTRL+<, SHIFT+TAB - Open ROMs unofficial, original TAB conflicts with C64 PETSCII
// PETSCII codes for certain C128 and C65 functionalities
#if CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65
.const KEY_BELL = $07 // no key, originally CTRL+G // XXX implement BELL
.const KEY_ESC = $1B
#endif
// PETSCII codes for programmable keys
.const KEY_STOP = $03
.const KEY_RUN = $83
.const KEY_F1 = $85
.const KEY_F2 = $89
.const KEY_F3 = $86
.const KEY_F4 = $8A
.const KEY_F5 = $87
.const KEY_F6 = $8B
.const KEY_F7 = $88
.const KEY_F8 = $8C
#if CONFIG_KEYBOARD_C65
.const KEY_F9 = $10
.const KEY_F10 = $15
.const KEY_F11 = $16
.const KEY_F12 = $17
.const KEY_F13 = $19
.const KEY_F14 = $1A
#endif
#if CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65
.const KEY_HELP = $84 // normally C65 only, also used for our C128 support
#endif
// PETSCII codes for cursor keys
.const KEY_CRSR_UP = $91
.const KEY_CRSR_DOWN = $11
.const KEY_CRSR_LEFT = $9D
.const KEY_CRSR_RIGHT = $1D
// PETSCII codes for colors
.const KEY_RVS_ON = $12 // CTRL+9
.const KEY_RVS_OFF = $92 // CTRL+0
.const KEY_BLACK = $90 // CTRL+1
.const KEY_WHITE = $05 // CTRL+2
.const KEY_RED = $1C // CTRL+3
.const KEY_CYAN = $9F // CTRL+4
.const KEY_PURPLE = $9C // CTRL+5
.const KEY_GREEN = $1E // CTRL+6
.const KEY_BLUE = $1F // CTRL+7
.const KEY_YELLOW = $9E // CTRL+8
.const KEY_ORANGE = $81 // VENDOR+1
.const KEY_BROWN = $95 // VENDOR+2
.const KEY_LT_RED = $96 // VENDOR+3
.const KEY_GREY_1 = $97 // VENDOR+4
.const KEY_GREY_2 = $98 // VENDOR+5
.const KEY_LT_GREEN = $99 // VENDOR+6
.const KEY_LT_BLUE = $9A // VENDOR+7
.const KEY_GREY_3 = $9B // VENDOR+8
// PETSCII codes for case toggle
.const KEY_SHIFT_ON = $09 // no key
.const KEY_SHIFT_OFF = $08 // no key
.const KEY_TXT = $0E // no key
.const KEY_GFX = $8E // no key
// PETSCII codes for other non-printable characters
.const KEY_RETURN = $0D
.const KEY_CLR = $93
.const KEY_HOME = $13
.const KEY_INS = $94
.const KEY_DEL = $14
// PETSCII codes for printable characters
.const KEY_SPACE = $20
.const KEY_EXCLAMATION = $21
.const KEY_QUOTE = $22
.const KEY_HASH = $23
.const KEY_DOLLAR = $24
.const KEY_PERCENT = $25
.const KEY_AMPERSAND = $26
.const KEY_APOSTROPHE = $27
.const KEY_R_BRACKET_L = $28
.const KEY_R_BRACKET_R = $29
.const KEY_ASTERISK = $2A
.const KEY_PLUS = $2B
.const KEY_COMA = $2C
.const KEY_MINUS = $2D
.const KEY_FULLSTOP = $2E
.const KEY_SLASH = $2F
.const KEY_0 = $30
.const KEY_1 = $31
.const KEY_2 = $32
.const KEY_3 = $33
.const KEY_4 = $34
.const KEY_5 = $35
.const KEY_6 = $36
.const KEY_7 = $37
.const KEY_8 = $38
.const KEY_9 = $39
.const KEY_COLON = $3A
.const KEY_SEMICOLON = $3B
.const KEY_LT = $3C
.const KEY_EQ = $3D
.const KEY_GT = $3E
.const KEY_QUESTION = $3F
// XXX finish this: $4x, $5x, $6x, $7x, $Ax, $Bx, $Cx, $Dx, $Ex, $Fx
+314
View File
@@ -0,0 +1,314 @@
//
// Names of ZP and low memory locations:
// - Computes Mapping the Commodore 64
// - https://www.c64-wiki.com/wiki/Zeropage
// - http://unusedino.de/ec64/technical/project64/memory_maps.html
//
// $00-$01 - 6502 CPU registers are here
//
// Page 0 - BASIC area ($02-$8F)
//
// $02 -- UNUSED -- free for user software
.label ADRAY1 = $03 // $03-$04
.label ADRAY2 = $05 // $05-$06
.label CHARAC = $07 // [!] our implementation might be different XXX give more details
.label ENDCHR = $08 // [!] our implementation might be different XXX give more details
.label TRMPOS = $09 // -- NOT IMPLEMENTED --
.label VERCKB = $0A // flag used by BASIC, 0 - LOAD, 1 - VERIFY
.label COUNT = $0B // [!] our implementation might be different XXX give more details
.label DIMFLG = $0C // [!] our implementation might be different XXX give more details
.label VALTYP = $0D // expression eveluation result; $00 - float, $FF - string
.label INTFLG = $0E // -- NOT IMPLEMENTED --
.label GARBFL = $0F // [!] our implementation might be different XXX give more details
.label SUBFLG = $10 // -- NOT IMPLEMENTED --
.label INPFLG = $11 // -- NOT IMPLEMENTED --
.label TANSGN = $12 // -- NOT IMPLEMENTED --
.label CHANNL = $13 // -- NOT IMPLEMENTED --
.label LINNUM = $14 // $14-$15 BASIC line number, [!] also used by DOS Wedge
.label TEMPPT = $16 // pointer to the first available slot in the temporary string descriptor stack
.label LASTPT = $17 // $17-$18 pointer to the last used slot in the temporary string descriptor
.label TEMPST = $19 // $19-$21 temporary string stack descriptors
.label INDEX = $22 // $22-$25 temporary variables, [!] our usage might be different
.label RESHO = $26 // $26-$2A -- NOT IMPLEMENTED --
.label TXTTAB = $2B // $2B-$2C start of BASIC code
.label VARTAB = $2D // $2D-$2E end of BASIC code, start of variables
.label ARYTAB = $2F // $2F-$30 -- NOT IMPLEMENTED --
.label STREND = $31 // $31-$32 -- NOT IMPLEMENTED --
.label FRETOP = $33 // $33-$34 -- NOT IMPLEMENTED --
.label FRESPC = $35 // $35-$36 [!] our implementation uses this as temporary string pointer
.label MEMSIZ = $37 // $37-$38 highest address of BASIC memory + 1
.label CURLIN = $39 // $39-$3A current BASIC line number
.label OLDLIN = $3B // $3B-$3C previous BASIC line number
.label OLDTXT = $3D // $3D-$3E current BASIC line pointer
.label DATLIN = $3F // $3F-$40 -- NOT IMPLEMENTED --
.label DATPTR = $41 // $41-$42 -- NOT IMPLEMENTED --
.label INPPTR = $43 // $43-$44 -- NOT IMPLEMENTED --
.label VARNAM = $45 // $45-$46 -- NOT IMPLEMENTED --
.label VARPNT = $47 // $47-$48 -- NOT IMPLEMENTED --
.label FORPNT = $49 // $49-$4A -- NOT IMPLEMENTED --
.label OPPTR = $4B // $4B-$4C helper variable for expression computation, [!] our usage details are different
.label OPMASK = $4D // -- NOT IMPLEMENTED --
.label DEFPNT = $4E // $4E-$4F -- NOT IMPLEMENTED --
.label DSCPNT = $50 // $50-$52 -- NOT IMPLEMENTED --
.label FOUR6 = $53 // -- NOT IMPLEMENTED --
.label JMPER = $54 // $54-$56 -- NOT IMPLEMENTED --
.label TEMPF1 = $57 // $57-$5B BASIC numeric work area
.label TEMPF2 = $5C // $5C-$60 BASIC numeric work area
.label __FAC1 = $61 // $61-$66 floating point accumulator 1
.label FAC1_exponent = $61
.label FAC1_mantissa = $62 // $62 - $65
.label FAC1_sign = $66
.label SGNFLG = $67 // -- NOT IMPLEMENTED --
.label BITS = $68 // FAC1 overflow
.label __FAC2 = $69 // $69-$6E floating point accumulator 2 [!] also used for memory move pointers
.label FAC2_exponent = $69
.label FAC2_mantissa = $6A // $6A - $6D
.label FAC2_sign = $6E
.label ARISGN = $6F // -- NOT IMPLEMENTED --
.label FACOV = $70 // FAC1 low order mantissa
.label FBUFPT = $71 // $71-$72 -- NOT IMPLEMENTED --
.label CHRGET = $73 // $73-$8A -- NOT IMPLEMENTED --
.label TXTPTR = $7A // $7A-$7B current BASIC statement pointer
.label RNDX = $8B // $8B-$8F random number seed
//
// Page 0 - Kernal area ($90-$FF)
//
.label IOSTATUS = $90
.label STKEY = $91 // keys down clears bits. STOP - bit 7, C= - bit 6, SPACE - bit 4, CTRL - bit 2
.label SVXT = $92 // tape reading constant [!] our tape routines use it differently
.label VERCKK = $93 // 0 = LOAD, 1 = VERIFY
.label C3PO = $94 // flag - is BSOUR content valid
.label BSOUR = $95 // serial bus buffered output byte
.label SYNO = $96 // temporary tape routines storage, [!] our usage differs
.label XSAV = $97 // temporary register storage for ASCII/tape related routines [!] usage details might differ
.label LDTND = $98 // number of entries in LAT / FAT / SAT tables
.label DFLTN = $99 // default input device
.label DFLTO = $9A // default output device
.label PRTY = $9B // tape storage for parity/checksum
#if !CONFIG_TAPE_NORMAL && !CONFIG_TAPE_TURBO
.label DPSW = $9C // -- NOT IMPLEMENTED --
#else
.label COLSTORE = $9C // [!] screen border storage for tape routines
#endif
.label MSGFLG = $9D // bit 6 = error messages, bit 7 = control message
.label PTR1 = $9E // for tape support, counter of errorneous bytes
.label PTR2 = $9F // for tape support, counter for errorneous bytes correction
.label TIME = $A0 // $A0-$A2 jiffy clock
#if !CONFIG_IEC_JIFFYDOS && !CONFIG_IEC_DOLPHINDOS && !CONFIG_IEC_BURST_CIA1 && !CONFIG_IEC_BURST_CIA2 && !CONFIG_IEC_BURST_MEGA_65
.label TSFCNT = $A3 // temporary variable for tape and IEC, [!] our usage differs
#else
.label IECPROTO = $A3 // -- WIP -- [!] 0 = normal, 1 = JiffyDOS, >= $80 for unknown
#endif
.label TBTCNT = $A4 // temporary variable for tape and IEC, [!] our usage probably differs in details
.label CNTDN = $A5 // -- NOT IMPLEMENTED --
.label BUFPNT = $A6 // -- NOT IMPLEMENTED --
.label INBIT = $A7 // temporary storage for tape / RS-232 received bits
#if !CONFIG_LEGACY_SCNKEY
.label BITCI = $A8 // -- NOT IMPLEMENTED --
.label RINONE = $A9 // -- WIP -- (UP9600 only) RS-232 check for start bit flag
.label RIDDATA = $AA // -- NOT IMPLEMENTED --
.label RIPRTY = $AB // -- WIP -- checksum while reading tape
#endif
.label SAL = $AC // $AC-$AD -- XXX: describe -- (implemented screen part)
.label EAL = $AE // $AE-$AF -- XXX: describe -- [!] used also by screen editor, for temporary color storage when scrolling
.label CMP0 = $B0 // $B0-$B1 temporary tape storage, [!] here used for BRK instruction address
.label TAPE1 = $B2 // $B2-$B3 tape buffer pointer
#if !CONFIG_LEGACY_SCNKEY
.label BITTS = $B4 // -- NOT IMPLEMENTED --
#endif
.label NXTBIT = $B5 // -- NOT IMPLEMENTED --
#if !CONFIG_LEGACY_SCNKEY
.label RODATA = $B6 // -- NOT IMPLEMENTED --
#endif
.label FNLEN = $B7 // current file name length
.label LA = $B8 // current logical_file number
.label SA = $B9 // current secondary address
.label FA = $BA // current device number
.label FNADDR = $BB // $BB-$BC current file name pointer
.label ROPRTY = $BD // -- NOT IMPLEMENTED -- tape / RS-232 temporary storage
.label FSBLK = $BE // -- NOT IMPLEMENTED -- tape / RS-232 temporary storage
.label MYCH = $BF // -- NOT IMPLEMENTED --
.label CAS1 = $C0 // tape motor interlock
.label STAL = $C1 // $C1-$C2 LOAD/SAVE start address
.label MEMUSS = $C3 // $C3-$C4 temporary address for tape LOAD/SAVE
.label LSTX = $C5 // last key matrix position [!] our usage probably differs in details
.label NDX = $C6 // number of chars in keyboard buffer
.label RVS = $C7 // flag, whether to print reversed characters
.label INDX = $C8 // end of logical line (column, 0-79)
.label LSXP = $C9 // $C9-$CA start of input, X/Y position (typo in Mapping the C64, fixed in Mapping the C128)
.label SFDX = $CB // -- NOT IMPLEMENTED --
.label BLNSW = $CC // cursor blink disable flag
.label BLNCT = $CD // cursor blink countdown
.label GDBLN = $CE // cursor saved character
.label BLNON = $CF // cursor visibility flag
.label CRSW = $D0 // whether to input from screen or keyboard
.label PNT = $D1 // $D1-$D2 pointer to the current screen line
.label PNTR = $D3 // current screen X position (logical column), 0-79
.label QTSW = $D4 // quote mode flag
.label LNMX = $D5 // logical line length, 39 or 79
.label TBLX = $D6 // current screen Y position (row), 0-24
.label SCHAR = $D7 // ASCII value of the last printed character
.label INSRT = $D8 // insert mode flag/counter
.label LDTB1 = $D9 // $D9-$F2 screen line link table, [!] our usage is different XXX give more details
.label USER = $F3 // $F3-$F4 pointer to current color RAM location
.label KEYTAB = $F5 // $F5-$F6 pointer to keyboard lookup table
.label RIBUF = $F7 // $F7-$F8 -- WIP -- RS-232 receive buffer pointer
.label ROBUF = $F9 // $F9-$FA -- WIP -- RS-232 send buffer pointer
// $FB $FB-$FE -- UNUSED -- free for user software
.label BASZPT = $FF // -- NOT IMPLEMENTED --
//
// Page 1
//
.label STACK = $100 // $100-$1FF, processor stack
//
// Pages 2 & 3
//
.label BUF = $200 // $200-$250, BASIC line editor input buffer (81 bytes)
// $250-$258 is the 81st - 88th characters in BASIC input, a carry over from VIC-20
// and not used on C64 - they are used if CONFIG_LEGACY_SCNKEY is enabled.
// [!] XXX document $251-$258 usage
.label LAT = $259 // $259-$262, logical file numbers (table, 10 bytes)
.label FAT = $263 // $263-$26C, device numbers (table, 10 bytes)
.label SAT = $26D // $26D-$276, secondary addresses (table, 10 bytes)
.label KEYD = $277 // $277-$280, keyboard buffer
.label MEMSTR = $281 // $281-$282, start of BASIC memory
.label MEMSIZK = $283 // $283-$284, NOTE: Mapping the 64 erroneously has the hex as $282 (DEC is correct)
.label TIMOUT = $285 // IEEE-488 timeout
.label COLOR = $286 // current text foreground color
.label GDCOL = $287 // color of character under cursor
.label HIBASE = $288 // high byte of start of screen
.label XMAX = $289 // max keyboard buffer size
.label RPTFLG = $28A // whether to repeat keys (highest bit set = repeat)
.label KOUNT = $28B // key repeat counter
.label DELAY = $28C // -- NOT IMPLEMENTED --
.label SHFLAG = $28D // bucky keys (SHIFT/CTRL/C=) flags
.label LSTSHF = $28E // last bucky key flags
.label KEYLOG = $28F // $28F-$290 routine to setup keyboard decoding
.label MODE = $291 // flag, is case switch allowed
.label AUTODN = $292 // -- NOT IMPLEMENTED -- screen scroll disable
#if !CONFIG_LEGACY_SCNKEY
.label M51CRT = $293 // -- NOT IMPLEMENTED -- mock 6551
.label M51CDR = $294 // -- NOT IMPLEMENTED -- mock 6551
.label M51AJB = $295 // $295-$296 -- NOT IMPLEMENTED -- mock 6551
.label RSSTAT = $297 // -- WIP -- (UP9600 only) mock 6551, RS-232 status
.label BITNUM = $298 // -- NOT IMPLEMENTED --
.label BAUDOF = $299 // $299-$29A -- NOT IMPLEMENTED --
#endif
.label RIDBE = $29B // -- WIP -- write pointer into RS-232 receive buffer
.label RIDBS = $29C // -- WIP -- read pointer into RS-232 receive buffer
.label RODBS = $29D // -- WIP -- read pointer into RS-232 send buffer
.label RODBE = $29E // -- WIP -- write pointer into RS-232 send buffer
.label IRQTMP = $29F // $29F-$2A0 temporary IRQ vector storage [!] we use it for tape speed calibration instead
.label ENABL = $2A1 // -- NOT IMPLEMENTED --
.label TODSNS = $2A2 // -- NOT IMPLEMENTED --
.label TRDTMP = $2A3 // -- NOT IMPLEMENTED --
.label TD1IRQ = $2A4 // -- NOT IMPLEMENTED --
.label TLNIDX = $2A5 // -- NOT IMPLEMENTED --
.label TVSFLG = $2A6 // 0 = NTSC, 1 = PAL
// [!] $2A7-$2FF is normally free, but in our case some extra functionality uses it
#if CONFIG_MEMORY_MODEL_60K
// IRQs are disabled when doing such accesses, and a default NMI handler only increments
// a counter, so that if an NMI occurs, it does not crash the machine, but can be captured.
.label missed_nmi_flag = $2A7
.label tiny_nmi_handler = $2A8
.label peek_under_roms = tiny_nmi_handler + peek_under_roms_routine - tiny_nmi_handler_routine
.label poke_under_roms = tiny_nmi_handler + poke_under_roms_routine - tiny_nmi_handler_routine
.label memmap_allram = tiny_nmi_handler + memmap_allram_routine - tiny_nmi_handler_routine
.label memmap_normal = tiny_nmi_handler + memmap_normal_routine - tiny_nmi_handler_routine
#if SEGMENT_BASIC
.label shift_mem_up = tiny_nmi_handler + shift_mem_up_routine - tiny_nmi_handler_routine
.label shift_mem_down = tiny_nmi_handler + shift_mem_down_routine - tiny_nmi_handler_routine
#endif
#endif // CONFIG_MEMORY_MODEL_60K
// BASIC vectors
.label IERROR = $300 // $300-$301
.label IMAIN = $302 // $302-$303
.label ICRNCH = $304 // $304-$305
.label IQPLOP = $306 // $306-$307
.label IGONE = $308 // $308-$309
.label IEVAL = $30A // $30A-$30B
.label SAREG = $30C // .A storage, for SYS call
.label SXREG = $30D // .X storage, for SYS call
.label SYREG = $30E // .Y storage, for SYS call
.label SPREG = $30F // .P storage, for SYS call
.label USRPOK = $310 // -- NOT IMPLEMENTED -- JMP instruction
.label USRADD = $311 // $311-$312 -- NOT IMPLEMENTED --
// $313 -- UNUSED -- free for user software
// Kernal vectors - interrupts
.label CINV = $314 // $314-$315
.label CBINV = $316 // $316-$317
.label NMINV = $318 // $318-$319
// Kernal vectors - routines
.label IOPEN = $31A // $31A-$31B
.label ICLOSE = $31C // $31C-$31D
.label ICHKIN = $31E // $31E-$31F
.label ICKOUT = $320 // $320-$321
.label ICLRCH = $322 // $322-$323
.label IBASIN = $324 // $324-$325
.label IBSOUT = $326 // $326-$327
.label ISTOP = $328 // $328-$329
.label IGETIN = $32A // $32A-$32B
.label ICLALL = $32C // $32C-$32D
.label USRCMD = $32E // $32E-$32F
.label ILOAD = $330 // $330-$331
.label ISAVE = $332 // $332-$333
// $314 $334-$33B -- UNUSED -- free for user software
#if !CONFIG_RS232_UP9600
.label TBUFFR = $33C // $33C-$3FB [!] tape buffer, our usage details differ
#else
.label REVTAB = $37C // $37C-$3FB -- WIP -- [!] RS-232 precalculated data
#endif
// $3FC $3FC-$3FF -- UNUSED -- free for user software
//
// Definitions for tape functionality
//
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
.label __normal_time_S = IRQTMP+0 // duration of the short pulse
.label __normal_time_M = IRQTMP+1 // duration of the medium pulse
.label __turbo_half_S = IRQTMP+0 // half-duration of the short pulse
.label __turbo_half_L = IRQTMP+1 // half-duration of the long pulse
.label __pulse_threshold = SVXT // pulse classification threshold
.label __pulse_threshold_ML = SYNO // M/L pulse classification threshold, for normal only
#endif
#if CONFIG_TAPE_TURBO
.label __tape_turbo_bytestore = STACK // location of byte storage helper routine
#endif
+15
View File
@@ -0,0 +1,15 @@
// BASIC startup vectors
#if ROM_LAYOUT_X16
.label IBASIC_COLD_START = $C000
.label IBASIC_WARM_START = $C002
#else
.label IBASIC_COLD_START = $A000
.label IBASIC_WARM_START = $A002
#endif
+10
View File
@@ -0,0 +1,10 @@
#if CONFIG_PLATFORM_COMMODORE_64
// Cartridge ROM locations
.label ICART_COLD_START = $8000 // $8000-$8001, cartridge cold start vector
.label ICART_WARM_START = $8002 // $8002-$8003, cartridge warm start vector (RESTORE key)
.label CART_SIG = $8004 // $8004-$8008, signature for cartridge detection
#endif
+44
View File
@@ -0,0 +1,44 @@
// #LAYOUT# * BASIC_1 #IGNORE
// #LAYOUT# * * #TAKE
// Kernal jump table
.label JCINT = $FF81
.label JIOINIT = $FF84
.label JRAMTAS = $FF87
.label JRESTOR = $FF8A
.label JVECTOR = $FF8D
.label JSETMSG = $FF90
.label JSECOND = $FF93
.label JTKSA = $FF96
.label JMEMTOP = $FF99
.label JMEMBOT = $FF9C
.label JSCNKEY = $FF9F
.label JSETTMO = $FFA2
.label JACPTR = $FFA5
.label JCIOUT = $FFA8
.label JUNTLK = $FFAB
.label JUNLSN = $FFAE
.label JLISTEN = $FFB1
.label JTALK = $FFB4
.label JREADST = $FFB7
.label JSETFLS = $FFBA
.label JSETNAM = $FFBD
.label JOPEN = $FFC0
.label JCLOSE = $FFC3
.label JCHKIN = $FFC6
.label JCKOUT = $FFC9
.label JCLRCHN = $FFCC
.label JCHRIN = $FFCF
.label JCHROUT = $FFD2
.label JLOAD = $FFD5
.label JSAVE = $FFD8
.label JSETTIM = $FFDB
.label JRDTIM = $FFDE
.label JSTOP = $FFE1
.label JGETIN = $FFE4
.label JCLALL = $FFE7
.label JUDTIM = $FFEA
.label JSCREEN = $FFED
.label JPLOT = $FFF0
.label JIOBASE = $FFF3