Merge pull request #53 from FeralChild64/master

MEGA65 80x50 screen mode
This commit is contained in:
FeralChild64 authored and GitHub committed 2020-09-04 18:01:57 +02:00
commit d939ed40fa
180 files changed
+4696 -724

No files matched your search

+6 -12
View File
@@ -84,7 +84,7 @@ It enables some speed/size code optimizations and allows C65 memory mapping to w
### `CONFIG_CPU_M65_45GS02`
Choose if you have a Mega65 FPGA board. It enables some speed/size code optimizations and allows Mega65 memory mapping to work.
Choose if you have a MEGA65 FPGA board. It enables some speed/size code optimizations and allows MEGA65 memory mapping to work.
### `CONFIG_CPU_WDC_65816`
@@ -111,7 +111,7 @@ These models additionaly use RAM under BASIC, and the 50K additionally takes ove
Uses RAM under BASIC, I/O and KERNAL, takes over `$C000`-`$CFFF` area requires special helper routines installed in `$2A7`-`$2FF` area (normally unused and free for the user). Gives the most free memory for BASIC programs, but it's the slowest (for example, forces disabling optimized LOAD loop for JiffyDOS) and the least compatible model.
It is currently not compatible with Mega65 extended ROMs.
It is currently not compatible with MEGA65 extended ROMs.
Comparing to standard memory model, it needs about 180 bytes in BASIC segment and 80 bytes in KERNAL segment - at the moment of doing the test, these values are expected to change often.
@@ -147,7 +147,7 @@ Causes screen blanking during JiffyDOS file loading to increase performance.
## Tape support
Note: for Mega65 most of the tape support code is placed in it's extended ROM; very little of the (tiny) KERNAL segment is used.
Note: for MEGA65 most of the tape support code is placed in it's extended ROM; very little of the (tiny) KERNAL segment is used.
### `CONFIG_TAPE_NORMAL`
@@ -175,12 +175,6 @@ Enable this option if you are using a tape interface adapter with some audio sig
Enable this option if you are using a tape interface adapter lacking tape motor control (most likely every adapter currently being sold) - this will eliminate the need to quickly press space when the program header information gets displayed. Note: if you are using a cassette player with REM port, and your adapter is connected to this port too, than you do not need this option.
### `CONFIG_TAPE_NO_ERROR_CORRECTION`
Normal tape format contains two copies of each data block - in case some bytes from the first one are damaged, they can be corrected by reading them from the second copy. Enabling this option omits the core to read the second block.
If used with `CONFIG_TAPE_NORMAL`, saves about 125 bytes in KERNAL segment. Not recommended when using real magnetic tapes.
## Multiple SID support
The SID is a sound chip - the original Commodore 64 had one installed. However, mods exists to add more of them for improved sound capabilities. Emulators and FPGA machines typically allow to simulate more than one too. Unfortunately, there is no standard regarding how these additional chips are visible in the processor address space, and there is no sane way to detect it - thus, it has to be configurable.
@@ -293,7 +287,7 @@ Feature needs several bytes in BASIC segment. If unsure - enable.
If enabled, embeds a tape head align tool into the ROM, it can be started with `←H`. Requires `CONFIG_TAPE_WEDGE`.
Feature needs about 800 bytes in KERNAL segment. Only recomended for machines with extended ROM, like Mega65.
Feature needs about 800 bytes in KERNAL segment. Only recomended for machines with extended ROM, like MEGA65.
### `CONFIG_BCD_SAFE_INTERRUPTS`
@@ -307,9 +301,9 @@ Feature needs 2 bytes in KERNAL segmment (for CPUs needing the patch), but at th
Tries to adjust the color scheme to the selected brand. Some brands might not support this.
### `CONFIG_BANNER_SIMPLE`, `CONFIG_BANNER_FANCY`, `CONFIG_BANNER_BRAND`
### `CONFIG_BANNER_SIMPLE`, `CONFIG_BANNER_FANCY`
Select startup banner - either a simple one, or with some colorful elements. `CONFIG_BANNER_BRAND` heavily depends on the selected brand, not all the brands support it.
Select startup banner - either a simple one, or with some colorful elements.
Richer banners need more BASIC segment, varies between brands.
+4 -2
View File
@@ -3,7 +3,7 @@
## for source code/assets we reused
* Retrofan - for his Mega65 banner artwork and PXLfont
* Retrofan - for his MEGA65 banner artwork and PXLfont
* TWW/CTR - for his keyboard handling code
* Graham - for his PAL/NTSC detection code and compact 8x8 multiplication routine
* enthusi/Onslaught - for his example Turbo Tape 64 compatible loader
@@ -26,8 +26,10 @@
## other
* Gábor Lénárt - for his work on [XEMU Mega65 emulator](https://github.com/lgblgblgb/xemu)
* Gábor Lénárt - for [his work](https://github.com/lgblgblgb/xemu) on XEMU MEGA65 emulator
* Hernán Di Pietro - for [his work](https://github.com/hernandp/xemu) on XEMU MEGA65 emulator
* Mads Nielsen - for the [Kick Assembler](http://www.theweb.dk/KickAssembler/Main.html#frontpage)
* Simon Jameson - for his Kick Assembler [pseudocommands](https://github.com/smnjameson/M65_KickAsm_PseudoCommands) for MEGA65 CPU support
<br />
+29 -16
View File
@@ -16,6 +16,7 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \
src/basic/basic_commands \
src/basic/basic_commands_01 \
src/basic/basic_commands_02 \
src/basic/basic_commands_03_m65 \
src/basic/basic_operators \
src/basic/basic_functions \
src/basic/board_m65 \
@@ -32,12 +33,16 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \
src/basic/rom_revision \
src/basic/wedge
SRCDIR_DOS_M65 = $(SRCDIR_COMMON) \
src/dos_m65 \
SRCDIR_KERNAL = $(SRCDIR_COMMON) \
src/kernal \
src/kernal/,stubs \
src/kernal/assets \
src/kernal/board_m65 \
src/kernal/board_x16 \
src/kernal/extapi_m65 \
src/kernal/iec \
src/kernal/iec_fast \
src/kernal/init \
@@ -50,17 +55,19 @@ SRCDIR_KERNAL = $(SRCDIR_COMMON) \
src/kernal/rom_revision \
src/kernal/rs232 \
src/kernal/screen \
src/kernal/screen_m65 \
src/kernal/tape \
src/kernal/time
SRC_BASIC = $(foreach dir,$(SRCDIR_BASIC),$(wildcard $(dir)/*.s))
SRC_KERNAL = $(foreach dir,$(SRCDIR_KERNAL),$(wildcard $(dir)/*.s))
SRC_TOOLS = $(wildcard tools/*.c,tools/*.cc)
SRC_BASIC = $(foreach dir,$(SRCDIR_BASIC),$(wildcard $(dir)/*.s))
SRC_DOS_M65 = $(foreach dir,$(SRCDIR_DOS_M65),$(wildcard $(dir)/*.s))
SRC_KERNAL = $(foreach dir,$(SRCDIR_KERNAL),$(wildcard $(dir)/*.s))
SRC_TOOLS = $(wildcard tools/*.c,tools/*.cc)
# Generated files
GEN_BASIC = build/,generated/float_constants.s
GEN_KERNAL =
GEN_BASIC = build/,generated/float_constants.s
GEN_KERNAL =
# List of build directories
@@ -91,8 +98,9 @@ GEN_STR_X16 = $(DIR_X16)/,generated/packed_strings.s
# Dependencies - helper variables
DEP_BASIC = $(SRC_BASIC) $(SRCDIR_BASIC) $(GEN_BASIC)
DEP_KERNAL = $(SRC_KERNAL) $(SRCDIR_KERNAL) $(GEN_KERNAL)
DEP_BASIC = $(SRC_BASIC) $(SRCDIR_BASIC) $(GEN_BASIC)
DEP_DOS_M65 = $(SRC_DOS_M65) $(SRCDIR_DOS_M65)
DEP_KERNAL = $(SRC_KERNAL) $(SRCDIR_KERNAL) $(GEN_KERNAL)
# List of tools
@@ -140,6 +148,7 @@ TARGET_LIST = build/chargen_openroms.rom \
SEG_LIST_M65 = $(DIR_M65)/basic.seg_0 \
$(DIR_M65)/basic.seg_1 \
$(DIR_M65)/dos.seg_1 \
$(DIR_M65)/kernal.seg_0 \
$(DIR_M65)/kernal.seg_1
@@ -204,7 +213,7 @@ build/chargen_openroms.patched: $(TOOL_PATCH_CHARGEN) build/chargen_openroms.rom
build/chargen_pxlfont.patched: $(TOOL_PATCH_CHARGEN) build/chargen_pxlfont.rom
$(TOOL_PATCH_CHARGEN) -i build/chargen_pxlfont.rom -o $@ -n 6px-PXLfont
# Dependencies - BASIC and KERNAL
# Dependencies - BASIC, DOS, and KERNAL
$(DIR_CUS)/OUTB_x.BIN $(DIR_CUS)/BASIC_combined.vs: \
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_CUS) $(GEN_STR_CUS) $(DIR_CUS)/KERNAL_combined.sym
@@ -236,6 +245,8 @@ $(DIR_X16)/OUTK_0.BIN $(DIR_X16)/KERNAL_0_combined.vs $(DIR_X16)/KERNAL_0_combin
$(DIR_M65)/basic.seg_1 $(DIR_M65)/BASIC_1_combined.vs $(DIR_M65)/BASIC_1_combined.sym: \
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_M65) $(GEN_STR_M65) $(DIR_M65)/KERNAL_0_combined.sym $(DIR_M65)/BASIC_0_combined.sym
$(DIR_M65)/dos.seg_1 $(DIR_M65)/DOS_1_combined.vs $(DIR_M65)/DOS_1_combined.sym: \
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_DOS) $(CFG_M65)
$(DIR_M65)/kernal.seg_1 $(DIR_M65)/KERNAL_1_combined.vs $(DIR_M65)/KERNAL_1_combined.sym: \
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_M65) $(GEN_STR_M65) $(DIR_M65)/KERNAL_0_combined.sym
@@ -315,7 +326,7 @@ build/target_%/OUTK_x.BIN build/target_%/KERNAL_combined.vs build/target_%/KERNA
@rm -f $@* build/target_$*/KERNAL*
@$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r STD -s KERNAL -i KERNAL-$* -o OUTK_x.BIN -d build/target_$* -l e4d3 -h ffff src/,,config_$*.s $(SRCDIR_KERNAL) $(GEN_KERNAL) $(GEN_STR_$*)
# Rules - BASIC and KERNAL intermediate files, for Mega65
# Rules - BASIC and KERNAL intermediate files, for MEGA65
$(DIR_M65)/OUTB_0.BIN $(DIR_M65)/BASIC_0_combined.vs $(DIR_M65)/BASIC_0_combined.sym:
@mkdir -p $(DIR_M65)
@@ -332,6 +343,11 @@ $(DIR_M65)/basic.seg_1 $(DIR_M65)/BASIC_1_combined.vs $(DIR_M65)/BASIC_1_combine
@rm -f $@* $(DIR_M65)/basic.seg_1 $(DIR_M65)/BASIC_1*
@$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r M65 -s BASIC_1 -i BASIC_1-mega65 -o basic.seg_1 -d $(DIR_M65) -l 4000 -h 7fff $(CFG_M65) $(GEN_STR_M65) $(SRCDIR_BASIC) $(GEN_BASIC)
$(DIR_M65)/dos.seg_1 $(DIR_M65)/DOS_1_combined.vs $(DIR_M65)/DOS_1_combined.sym:
@mkdir -p $(DIR_M65)
@rm -f $@* $(DIR_M65)/dos.seg_1 $(DIR_M65)/DOS_1*
@$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r M65 -s DOS_1 -i DOS_1-mega65 -o dos.seg_1 -d $(DIR_M65) -l 4000 -h 7fff $(CFG_M65) $(SRCDIR_DOS_M65)
$(DIR_M65)/kernal.seg_1 $(DIR_M65)/KERNAL_1_combined.vs $(DIR_M65)/KERNAL_1_combined.sym:
@mkdir -p $(DIR_M65)
@rm -f $@* $(DIR_M65)/kernal.seg_1 $(DIR_M65)/KERNAL_1*
@@ -407,18 +423,15 @@ build/kernal_hybrid.rom: kernal $(DIR_GEN)/OUTK_x.BIN
build/symbols_hybrid.vs: $(DIR_GEN)/KERNAL_combined.vs
sort $(DIR_GEN)/KERNAL_combined.vs | uniq | grep -v "__" > $@
# Rules - platform 'Mega65' specific
# Rules - MEGA65 platform specific
build/padding_16_KB:
@mkdir -p build
dd if=/dev/zero bs=8192 count=2 of=build/padding_16_KB
build/padding_64_KB:
@mkdir -p build
dd if=/dev/zero bs=8192 count=8 of=build/padding_64_KB
$(TARGET_M65_x) $(TARGET_M65_x_PXL): build/padding_16_KB build/padding_64_KB $(SEG_LIST_M65) build/chargen_openroms.rom build/chargen_openroms.patched build/chargen_pxlfont.rom build/chargen_pxlfont.patched
$(TARGET_M65_x) $(TARGET_M65_x_PXL): $(SEG_LIST_M65) build/padding_64_KB build/chargen_openroms.rom build/chargen_openroms.patched build/chargen_pxlfont.rom build/chargen_pxlfont.patched
@echo
cat build/padding_16_KB > $(TARGET_M65_x)
cat $(DIR_M65)/dos.seg_1 > $(TARGET_M65_x)
cat $(DIR_M65)/kernal.seg_1 >> $(TARGET_M65_x)
cat $(DIR_M65)/basic.seg_1 >> $(TARGET_M65_x)
cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x)
@@ -427,7 +440,7 @@ $(TARGET_M65_x) $(TARGET_M65_x_PXL): build/padding_16_KB build/padding_64_KB $(S
cat $(DIR_M65)/kernal.seg_0 >> $(TARGET_M65_x)
cat build/padding_64_KB >> $(TARGET_M65_x)
@echo
cat build/padding_16_KB > $(TARGET_M65_x_PXL)
cat $(DIR_M65)/dos.seg_1 > $(TARGET_M65_x_PXL)
cat $(DIR_M65)/kernal.seg_1 >> $(TARGET_M65_x_PXL)
cat $(DIR_M65)/basic.seg_1 >> $(TARGET_M65_x_PXL)
cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x_PXL)
+3 -2
View File
@@ -1,6 +1,7 @@
# Open ROMs
![screenshot demonstrating some features](./doc/screenshot-demo.png)
![screenshot generic build screenshot](./doc/screenshot-demo-generic.png)
![screenshot MEGA65 build screenshot](./doc/screenshot-demo-mega65.png)
A project to create unencumbered open-source ROMs for use on selected retro computers. Besides this manifest, the following documents are available:
@@ -21,7 +22,7 @@ which typically requires the inclusion of firmware, i.e, "ROMs", while respectin
the owners of the copyrights in the ROMs.
Therefore the goal of this project is to create a fully open-source and unencumbered set of ROMs for various systems.
The initial focus is the C64 and C65 computers, because of the desire to be able to include open ROMs with the MEGA65
The initial focus is the C64 and C65 computers, because of the desire to be able to include Open ROMs with the MEGA65
retro computer.
In short, this project exists precisely because we respect, and want to help others to respect the intellectual property
+15 -4
View File
@@ -22,7 +22,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8
* normal tape load error log is limited by free stack space only (no artificial limitation like in original ROMs)
* tape format autodetection; normal vs turbo is mostly transparent to user
* improved support for tape adapters (for using regular casette players and other audio devices instead of Datasette) and emulators
* built-in tape head align tool (only feasible to use on machines with extended memory, like Mega65)
* built-in tape head align tool (only feasible to use on machines with extended memory, like MEGA65)
* uses RAM under ROM and I/O: 51199 bytes free (up to `$CFFF`) by default, but 61438 is also possible
* cold/warm start silences multiple SID chips
@@ -58,7 +58,7 @@ The following ROM features are currently missing:
| :----------------: | :------: | :------------------------------------------------: |
| C64 | DONE | |
| C128 | DONE | |
| Mega65 | NOT DONE | code should be complete, but is not tested yet |
| MEGA65 | PARTIAL | code mostly complete, but not tested yet |
<br />
@@ -70,7 +70,7 @@ The following ROM features are currently missing:
| :----------------: | :------: | :------------------------------------------------: |
| VIC-II | DONE | |
| 80 columns, VDC | NOT DONE | |
| 80 columns, Mega65 | NOT DONE | |
| 80 columns, MEGA65 | PARTIAL | no windowing mode and C65/M65 extra keys support |
<br />
@@ -103,7 +103,7 @@ The following ROM features are currently missing:
| JiffyDOS | PARTIAL | LOAD needs improvement for better performance |
| DolphinDOS | DONE | |
| CIA burst mod | NOT DONE | |
| Mega65 burst | NOT DONE | |
| MEGA65 burst | NOT DONE | |
<br />
@@ -121,6 +121,17 @@ The following ROM features are currently missing:
<br />
## MEGA65 storage
<br />
| Driver | Status | Remarks |
| :----------------: | :------: | :-------------------------------------------------------------------------: |
| internal floppy | NOT DONE | try to reuse https://github.com/commanderx16/x16-rom/tree/master/dos |
| SD card access | NOT DONE | tryy to reuse https://github.com/commanderx16/x16-rom/tree/master/dos/fat32 |
<br />
## RS-232
* modems (telephone, WiFi)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
+14 -9
View File
@@ -18,16 +18,16 @@ Most important: always test your software on the original ROMs too. If your code
Please, do not use any internal/unofficial Open ROMs API. They WILL change in an incompatible way, you may believe me. Using unofficial API of the original ROMs is OK if the routine is marked as supported in the [implementation status](../STATUS.md) document.
### Compatibility with Open ROMs for Mega65
### Compatibility with Open ROMs for MEGA65
The Mega65 Open ROMs build aims to provide a C64-compatible memory map in range `$00000-$0FFFF`. For `$10000` and above, everything is still subject to change.
The MEGA65 Open ROMs build aims to provide a C64-compatible memory map in range `$00000-$0FFFF`. For `$10000` and above, everything is still subject to change.
Please note, that certain ROM routines are moved to additional Mega65 ROM area (2x8KB is not enough to implement full ROM functionality and additional features) - original locations contain just short compatibility code which remaps memory, calls the real routine, and restores default mapping (that means all blocks unmapped). This shouldn't be a problem for original C64 software, but can make a difference for Mega65-aware code; thus, please follow these simple rules:
Please note, that certain ROM routines are moved to additional MEGA65 ROM area (2x8KB is not enough to implement full ROM functionality and additional features) - original locations contain just short compatibility code which remaps memory, calls the real routine, and restores default mapping (that means all blocks unmapped). This shouldn't be a problem for original C64 software, but can make a difference for MEGA65-aware code; thus, please follow these simple rules:
- do not call ROM routines with .B set to anything other than 0 (and .B set to 0x40 or above is a receipe for disaster!)
- be aware that ROM routines may restore the default memory mapping by means of MAP/EOM
Open ROMs interrupt handlers do not touch the ROM mapping, range `0x4000-0xBFFF` can be freely mapped without disabling IRQ or NMI. The .Z register is mostly safe to use too - some routines might use it, but they will alwayys restore it's previous state. Please be aware, that for maximum compatibility our IRQ/NMI handlers DO NOT store/restore .Z register.
Open ROMs interrupt handlers do not touch the ROM mapping, range `0x4000-0xBFFF` can be freely mapped without disabling IRQ or NMI. The .Z register is mostly safe to use too - some routines might use it, but they will always restore it's previous state. Please be aware, that for maximum compatibility our IRQ/NMI handlers DO NOT store/restore .Z register.
### API extensions
@@ -63,10 +63,11 @@ Bits 3 and 4 are extension to the original variable, compatible with the C128 RO
Before modifying NMI vector, set it's high byte to 0. The ROM routine considers such address invalid and won't try to call the custom code, thus preventing a crash if interrupt happens in the worst possible moment.
#### Mega65 native mode
#### MEGA65 native mode
Mega65 build starts in legacy mode, which is intended to be reasonably compatible with the C64 ROMs. However, a native Mega65 mode is planned too, to make it easier to utilise extra features of this machine. Soo far the following has been done:
MEGA65 native mode imlementation has started. Important changes so far:
- Uses VIC-IV features to implement 80-column screen mode; the $0400-$07FF area is utilized by ROM to provide additional features.
- Slightly different chargen. On C64 machines pressing C= + G or C= + M key combinations produces the same visual result as C= + H or C= + N, respectively - despite keycap printing suggests they should produce tinner bars. This was intentional change in the C64 ROMs (compared to VIC-20), to prevent colour problems on 80s era TVs. Screen font used in the legacy mode duplicates this change, but the font intended for native mode has this change reverted back. Additionally, the π sign is available for lower/upper case set too.
## Tinkering with Open ROMs
@@ -86,7 +87,7 @@ List of the most important make targets:
| `test` | builds the 'custom' configuration, launches it using VICE emulator |
| `test_generic` | builds the default ROMs, for generic C64/C128, launches using VICE |
| `test_generic_x128` | as above, but launches C128 emulator instead |
| `test_mega65` | builds the Mega65 ROM, launches it using XEMU emulator |
| `test_mega65` | builds the MEGA65 ROM, launches it using XEMU emulator |
| `test_ultimate64` | builds the Ultimate 64 configuration, launches it using VICE emulator |
| `test_hybrid` | builds a hybrid ROM (Open ROMs Kernal + original BASIC), launches it using VICE |
| `test_testing` | builds a rather odd testing configuration, launches it using VICE emulator |
@@ -158,7 +159,7 @@ This can be found in a private (internal) vector table of `KERNAL_1` segment of
// #LAYOUT# * * #IGNORE
```
This is used for memory mapping helper routines, which are only needed for Mega65 build. They will be placed in `KERNAL_0` segment in such case. And the last example:
This is used for memory mapping helper routines, which are only needed for MEGA65 build. They will be placed in `KERNAL_0` segment in such case. And the last example:
```
// #LAYOUT# STD * #TAKE
@@ -167,7 +168,7 @@ This is used for memory mapping helper routines, which are only needed for Mega6
// #LAYOUT# * * #IGNORE
```
This is for the routine, that on Mega65 goes to `KERNAL_1` segment, but can still be transparently called using fixed location in `KERNAL_0` segment. The code might, for example, look this way:
This is for the routine, that on MEGA65 goes to `KERNAL_1` segment, but can still be transparently called using fixed location in `KERNAL_0` segment. The code might, for example, look this way:
```
ROUTINE_NAME:
@@ -187,6 +188,10 @@ ROUTINE_NAME:
Last, but not least - the `#TAKE-HIGH` is intended to be used for BASIC routines, which should still be available after the main BASIC ROM is banked out.
### MEGA65 computer-based DOS
TODO
### CPU-specific optimizations
TODO
+9 -7
View File
@@ -1,7 +1,7 @@
# Planned BASIC features, when V2 compatibility is reached
Ideas for the future, most of them suitable for Mega65 or other power machines only
Ideas for the future, most of them suitable for MEGA65 or other power machines only
* sound support
* 2D graphics support
@@ -18,16 +18,15 @@ Ideas for the future, most of them suitable for Mega65 or other power machines o
* `CGOTO` and `CGOSUB` - computatiuonal versions, should accept expressions
* `LABEL`, `LGOTO` and `LGOSUB` - jump to label
* some kind of subroutines with local variable namespace, possibly loaded from disc (like in Warsaw Basic 3.2)
* for Mega65 mode, move variables to a separate memory area, consider extending variable name length
* for MEGA65 mode, move variables to a separate memory area, consider extending variable name length
* `←V` (verify from tape) - if Kernal is extended to offer this feature
* modulo function or opeerator
* `DPEEK`, `DPOKE`, `QPEEK`, `QPOKE` - 2/4 byte `PEEK` and `POKE` variants
* all the functions/commands accepting memory addresses should be able to access the whole Mega65 memory
* all the functions/commands accepting memory addresses should be able to access the whole MEGA65 memory
* ability to limit memory used by basic to standard 38K or to 46K (memory model switch)
* `XOR` operator
* `AUTO` - line auto numbering
* `RENUMBER` for chanign the line numbers
* `IF ... THEN ... ELSE`, `BEGIN ... BEND`
* consider `BOOT` command
* possibly some commands for creating menus and dialog boxes
* more configurable `INPUT`
@@ -38,10 +37,8 @@ Ideas for the future, most of them suitable for Mega65 or other power machines o
* `DELETE` command to delete several BASIC lines, as in BASIC V10
* `FOR` loop should accept integer variable as index
* `FETCH`, `STASH`, `SWAP` - REU support
* `DMA` command for Mega65
* `DMA` command for MEGA65
* geoRAM support
* `GO 64` / `GO 65` should enable/disable C64 compatibility mode on Mega65
* `NSYS` for Mega65 - native `SYS` for Mega65, should not switch to C64 compatibilty mode
* `DO ... LOOP`, `DO ... UNTIL`, `DO ... WHILE`, `EXIT`
* `SEEK#` to read-and-forget n bytes
* `RECORD#` command from BASIC V10
@@ -63,3 +60,8 @@ Ideas for the future, most of them suitable for Mega65 or other power machines o
* function to generate string of n duplicated characters
* function to retrieve fractional part of a number
* command to fill text screen area with a character, inverse screen area, scroll, or change fg/bg color of screen area
# Features not planned
* `ELSE` - it would have slown down the execution, can be easily substituted
* `BEGIN ... BEND` - similarly, using these would hurt the performance
+20 -4
View File
@@ -1,7 +1,7 @@
# Extended BASIC
NOTE: Command syntax, behaviour details, and tokens are still subject to change! Currently the availability of some depends on the build configuration, in the future most (if not all) extended commands will be available only on machines with extended ROM, like the Mega65 or Ultimate 64.
NOTE: Command syntax, behaviour details, and tokens are still subject to change! Currently the availability of some depends on the build configuration, in the future most (if not all) extended commands will be available only on machines with extended ROM, like the MEGA65 or Ultimate 64.
## DOS Wedge
@@ -35,7 +35,7 @@ Loads the file from tape. Depending on the configuration, it tries to load the f
Like above, but merges a BASIC program to the one already stored in memory.
### `←H` (Mega65)
### `←H` (MEGA65)
Launches a built-in tape head alignment tool. Destroys program in memory. Press `RUN/STOP` to terminate the tool.
@@ -59,7 +59,7 @@ Saves the binary data from the given memory area. NOTE: for now syntax differs f
## Additional BASIC commands - misc
### `COLD` (Mega65)
### `COLD` (MEGA65)
Resets the machine. In direct mode asks for confirmation first.
@@ -75,7 +75,7 @@ Tries to switch the machine back to 1 MHz operation mode.
Tries to restore program destroyed by the `NEW` command or a reset.
### `MEM` (Mega65)
### `MEM` (MEGA65)
Displays BASIC memory usage information:
* `TEXT` - size of BASIC program text, always at least 2 bytes are used
@@ -84,6 +84,10 @@ Displays BASIC memory usage information:
* `STRS` - bytes occupied by strings, also the ones belonging to arrays
* `FREE` - unused space
### `SYSINFO` (MEGA65)
Displays various system information.
### `CLEAR` (all)
Clears the screen content.
@@ -91,3 +95,15 @@ Clears the screen content.
### `DISPOSE` (all)
Runs the garbage collector - disposes outdated strings.
### `GO SYS` (MEGA65)
Same as `SYS`, but does not switch to C64 compatibility mode.
### `GO 64`, `GO 65` (MEGA65)
Switches machine to C64 compatibility mode or to MEGA65 native mode. Performs `CLR`
### `IF MEGA65 THEN`, `IF MEGA65 GOTO` (MEGA65)
Special check for running under MEGA65. The `MEGA65` string is not tokenized, therefore it will be listed properly even under original BASIC V2. `MEGA65` is not a variable here - it is still possible to normally use the `ME` variable.
File renamed without changes.
Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

-3
View File
@@ -22,7 +22,6 @@
#define CONFIG_BRAND_CUSTOM_BUILD
// #define CONFIG_BRAND_GENERIC
// #define CONFIG_BRAND_TESTING
// #define CONFIG_BRAND_MEGA_65
// #define CONFIG_BRAND_ULTIMATE_64
.const CONFIG_CUSTOM_BRAND = @"CUSTOM BUILD"
@@ -61,7 +60,6 @@
#define CONFIG_TAPE_AUTODETECT
// #define CONFIG_TAPE_NO_KEY_SENSE
// #define CONFIG_TAPE_NO_MOTOR_CONTROL
// #define CONFIG_TAPE_NO_ERROR_CORRECTION
// #define CONFIG_RS232_UP2400 // please keep disabled for now
// #define CONFIG_RS232_UP9600 // please keep disabled for now
@@ -134,7 +132,6 @@
// #define CONFIG_COLORS_BRAND
// #define CONFIG_BANNER_SIMPLE
#define CONFIG_BANNER_FANCY
// #define CONFIG_BANNER_BRAND
#define CONFIG_SHOW_FEATURES
-3
View File
@@ -21,7 +21,6 @@
#define CONFIG_BRAND_CUSTOM_BUILD
// #define CONFIG_BRAND_GENERIC
// #define CONFIG_BRAND_TESTING
// #define CONFIG_BRAND_MEGA_65
// #define CONFIG_BRAND_ULTIMATE_64
.const CONFIG_CUSTOM_BRAND = @"FOR COMMANDER X16"
@@ -57,7 +56,6 @@
// #define CONFIG_TAPE_AUTODETECT
// #define CONFIG_TAPE_NO_KEY_SENSE
// #define CONFIG_TAPE_NO_MOTOR_CONTROL
// #define CONFIG_TAPE_NO_ERROR_CORRECTION
// Multiple SID support
@@ -128,7 +126,6 @@
// #define CONFIG_COLORS_BRAND
// #define CONFIG_BANNER_SIMPLE
#define CONFIG_BANNER_FANCY
// #define CONFIG_BANNER_BRAND
// #define CONFIG_SHOW_FEATURES
-3
View File
@@ -21,7 +21,6 @@
#define CONFIG_BRAND_GENERIC
// #define CONFIG_BRAND_TESTING
// #define CONFIG_BRAND_MEGA_65
// #define CONFIG_BRAND_ULTIMATE_64
@@ -55,7 +54,6 @@
#define CONFIG_TAPE_AUTODETECT
// #define CONFIG_TAPE_NO_KEY_SENSE
// #define CONFIG_TAPE_NO_MOTOR_CONTROL
// #define CONFIG_TAPE_NO_ERROR_CORRECTION
// Multiple SID support
@@ -126,7 +124,6 @@
#define CONFIG_COLORS_BRAND
// #define CONFIG_BANNER_SIMPLE
#define CONFIG_BANNER_FANCY
// #define CONFIG_BANNER_BRAND
#define CONFIG_SHOW_FEATURES
+7 -17
View File
@@ -12,18 +12,11 @@
// Hardware platform and brand
// Hardware platform
#define CONFIG_PLATFORM_COMMODORE_64
#define CONFIG_MB_MEGA_65
// #define CONFIG_MB_ULTIMATE_64
// #define CONFIG_BRAND_GENERIC
// #define CONFIG_BRAND_TESTING
#define CONFIG_BRAND_MEGA_65
// #define CONFIG_BRAND_ULTIMATE_64
// Processor instruction set
@@ -55,7 +48,6 @@
#define CONFIG_TAPE_AUTODETECT
#define CONFIG_TAPE_NO_KEY_SENSE
#define CONFIG_TAPE_NO_MOTOR_CONTROL
// #define CONFIG_TAPE_NO_ERROR_CORRECTION
// Multiple SID support
@@ -75,8 +67,8 @@
// #define CONFIG_LEGACY_SCNKEY
// #define CONFIG_KEYBOARD_C128
// #define CONFIG_KEYBOARD_C128_CAPS_LOCK
#define CONFIG_KEYBOARD_C65 // untested
#define CONFIG_KEYBOARD_C65_CAPS_LOCK // untested
// #define CONFIG_KEYBOARD_C65 // untested
// #define CONFIG_KEYBOARD_C65_CAPS_LOCK // untested
// #define CONFIG_KEY_REPEAT_DEFAULT
// #define CONFIG_KEY_REPEAT_ALWAYS
#define CONFIG_KEY_FAST_SCAN
@@ -121,13 +113,11 @@
#define CONFIG_BCD_SAFE_INTERRUPTS
// Eye candy
// Built-in DOS configuration
#define CONFIG_COLORS_BRAND
// #define CONFIG_BANNER_SIMPLE
// #define CONFIG_BANNER_FANCY
#define CONFIG_BANNER_BRAND
// #define CONFIG_SHOW_FEATURES
.const CONFIG_UNIT_SDCARD = 0 // do not change, DOS is not implemented yet
.const CONFIG_UNIT_FLOPPY = 0 // do not change, DOS is not implemented yet
.const CONFIG_UNIT_RAMDISK = 0 // do not change, DOS is not implemented yet
// Debug options
-3
View File
@@ -21,7 +21,6 @@
// #define CONFIG_BRAND_GENERIC
#define CONFIG_BRAND_TESTING
// #define CONFIG_BRAND_MEGA_65
// #define CONFIG_BRAND_ULTIMATE_64
@@ -55,7 +54,6 @@
// #define CONFIG_TAPE_AUTODETECT
// #define CONFIG_TAPE_NO_KEY_SENSE
// #define CONFIG_TAPE_NO_MOTOR_CONTROL
#define CONFIG_TAPE_NO_ERROR_CORRECTION
// Multiple SID support
@@ -126,7 +124,6 @@
// #define CONFIG_COLORS_BRAND
#define CONFIG_BANNER_SIMPLE
// #define CONFIG_BANNER_FANCY
// #define CONFIG_BANNER_BRAND
#define CONFIG_SHOW_FEATURES
-3
View File
@@ -21,7 +21,6 @@
// #define CONFIG_BRAND_GENERIC
// #define CONFIG_BRAND_TESTING
// #define CONFIG_BRAND_MEGA_65
#define CONFIG_BRAND_ULTIMATE_64
@@ -55,7 +54,6 @@
#define CONFIG_TAPE_AUTODETECT
// #define CONFIG_TAPE_NO_KEY_SENSE
// #define CONFIG_TAPE_NO_MOTOR_CONTROL
// #define CONFIG_TAPE_NO_ERROR_CORRECTION
// Multiple SID support
@@ -126,7 +124,6 @@
#define CONFIG_COLORS_BRAND
// #define CONFIG_BANNER_SIMPLE
#define CONFIG_BANNER_FANCY
// #define CONFIG_BANNER_BRAND
#define CONFIG_SHOW_FEATURES
+18 -16
View File
@@ -63,18 +63,21 @@
#if CONFIG_BRAND_TESTING
.eval selected++
#endif
#if CONFIG_BRAND_MEGA_65
.eval selected++
#endif
#if CONFIG_BRAND_ULTIMATE_64
.eval selected++
#endif
#if !CONFIG_MB_MEGA_65
.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_MEGA_65
.if (selected != 0) .error "Do not use CONFIG_BRAND_* options for MEGA65"
#endif
#if CONFIG_MB_MEGA_65 && CONFIG_SHOW_FEATURES
.if (selected != 0) .error "Do not use CONFIG_SHOW_FEATURES options for MEGA65"
#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
@@ -110,10 +113,10 @@
// 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"
.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"
.error "MEGA65 ROM layout requires CONFIG_MB_MEGA_65"
#endif
.var selected = 0;
@@ -218,18 +221,17 @@
#if CONFIG_BANNER_FANCY
.eval selected++
#endif
#if CONFIG_BANNER_BRAND
.eval selected++
#endif
#if !CONFIG_MB_MEGA_65
.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"
#if CONFIG_MB_MEGA_65
.if (selected != 0) .error "Do not use CONFIG_BANNER_* options for MEGA65"
#endif
#if CONFIG_MB_MEGA_65 && CONFIG_COLORS_BRAND
.error "Do not use CONFIG_COLORS_BRAND options for MEGA65"
#endif
}
+106 -1
View File
@@ -86,7 +86,7 @@
//
// Memory mapping for C65 and Mega65
// Memory mapping for C65 and MEGA65
//
#if HAS_OPCODES_4510
@@ -97,6 +97,16 @@
#endif
//
// Some additional 65C02 instructions
//
#if HAS_OPCODES_65C02
.pseudocommand inc_a { .byte $1A }
.pseudocommand dec_a { .byte $3A }
#endif
//
// Some additional 65CE02 instructions
@@ -261,6 +271,101 @@
.byte $22, mod(arg, $100), floor(arg / $100)
}
.pseudocommand jsr_ind_x addr
{
.var arg = addr.getValue()
.byte $23, mod(arg, $100), floor(arg / $100)
}
// Others, taken from https://github.com/smnjameson/M65_KickAsm_PseudoCommands
.const z = -999 // allows (base page),z addressing mode
.const sy = -998 // allows (base page, s),y addressing mode
.const AT_IZEROPAGEZ = 13 // adds a pseudo addressing mode
.const AT_INDIRECTX = -5 // adds a pseudo addressing mode
.function GetAdressingModeType(arg) {
.if(arg == AT_NONE) .return "AT_NONE"
.if(arg == AT_IMMEDIATE) .return "AT_IMMEDIATE"
.if(arg == AT_INDIRECT) .return "AT_INDIRECT"
.if(arg == AT_INDIRECTX) .return "AT_INDIRECTX"
.if(arg == AT_ABSOLUTE) .return "AT_ABSOLUTE"
.if(arg == AT_ABSOLUTEX) .return "AT_ABSOLUTEX"
.if(arg == AT_ABSOLUTEY) .return "AT_ABSOLUTEY"
.if(arg == AT_IZEROPAGEX) .return "AT_IZEROPAGEX"
.if(arg == AT_IZEROPAGEY) .return "AT_IZEROPAGEY"
.if(arg == AT_IZEROPAGEZ) .return "AT_IZEROPAGEZ"
.return arg
}
.pseudocommand cpz arg {
.var value = arg.getValue()
.var type = arg.getType()
.if(type == AT_IMMEDIATE) {
.byte $C2, value
} else .if(type == AT_ABSOLUTE) {
.if(value <= $FF ) {
.byte $D4, value
} else {
.byte $DC, <value, >value
}
} else {
.error "Invalid adressingmode. 'cpz' doesn't support "+GetAdressingModeType(type)+" mode"
}
}
.pseudocommand lda arg {
.var value = arg.getValue()
.var type = arg.getType()
.if(type != AT_IZEROPAGEZ) .error "':lda' only accepts AT_IZEROPAGEZ"
.if(value > $FF ) .error "':lda ($nn),z' requires zeropage address"
.byte $B2, value
}
.pseudocommand ldz arg
{
.var value = arg.getValue()
.var type = arg.getType()
.if(type == AT_IMMEDIATE) {
.byte $A3, value
} else .if(type == AT_ABSOLUTE) {
.byte $AB, <value, >value
} else .if(type == AT_ABSOLUTEX) {
.byte $BB, <value, >value
} else {
.error "Invalid adressingmode. 'ldz' doesn't support "+GetAdressingModeType(type)+" mode"
}
}
.pseudocommand sta arg {
.var value = arg.getValue()
.var type = arg.getType()
.if(type != AT_IZEROPAGEZ) .error "':sta' only accepts AT_IZEROPAGEZ"
.if(value > $FF ) .error "':sta ($nn),z' requires zeropage address"
.byte $92, value
}
// Flat memory access support
.pseudocommand lda_lp arg {
.var value = arg.getValue()
.var type = arg.getType()
.if(type != AT_IZEROPAGEZ) .error "'lda_lp' only accepts AT_IZEROPAGEZ"
.if(value > $FF ) .error "'lda_lp' requires zeropage address"
nop
.byte $B2, value
}
.pseudocommand sta_lp arg {
.var value = arg.getValue()
.var type = arg.getType()
.if(type != AT_IZEROPAGEZ) .error "'sta_lp' only accepts AT_IZEROPAGEZ"
.if(value > $FF ) .error "'sta_lp' requires zeropage address"
nop
.byte $92, value
}
#endif
+2 -9
View File
@@ -70,13 +70,6 @@
.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
@@ -190,9 +183,9 @@
.label C65_EXTKEYS_PR = $D607
.label C65_EXTKEYS_DDR = $D608
.label M65_BADL_SLI = $D710
#endif
#else
#if !CONFIG_MB_MEGA_65
// SuperCPU registers
+45
View File
@@ -0,0 +1,45 @@
//
// Names of hardware registers
//
// See https://github.com/MEGA65/mega65-core/blob/master/iomap.txt
//
#if CONFIG_MB_MEGA_65
// VIC-IV registers
.label VIC_KEY = $D02F
.label VIC_CTRLA = $D030
.label VIC_CTRLB = $D031
.label VIC_XPOS = $D050
.label VIC_CTRLC = $D054
.label VIC_CHARSTEP = $D058 // 2 bytes - logical characters per line
.label VIC_SRH = $D05D // - various flags, bit 7 = hot registers
.label VIC_SCRNPTR = $D060 // 4 bytes - pointer to start of screen memory
.label VIC_COLPTR = $D064 // 2 bytes - pointer to start of color memory
.label VIC_CHARPTR = $D068 // 3 bytes - pointer to start of character generator
// DMAgic
.label DMA_ADDRLSBTRIG = $D700
.label DMA_ADDRMSB = $D701
.label DMA_ADDRBANK = $D702
.label DMA_EN018B = $D703
.label DMA_ADDRMB = $D704
.label DMA_ETRIG = $D705
.label DMA_ADDRLSB = $D70E
// MISC registers
.label MISC_BOARDID = $D629 // board identification byte
.label MISC_EMU = $D710 // to enable badlines and slow interrupts
#endif
+27 -15
View File
@@ -17,7 +17,7 @@
.const KEY_FLAG_VENDOR = %00000010
.const KEY_FLAG_CTRL = %00000100
#if CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65
#if CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65 || ROM_LAYOUT_M65
.const KEY_FLAG_ALT = %00001000
#if CONFIG_KEYBOARD_C128_CAPS_LOCK || CONFIG_KEYBOARD_C65_CAPS_LOCK
.const KEY_CAPS_LOCK = %00010000
@@ -25,27 +25,35 @@
.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
// Note - the following PETSCII codes are currently unassigned, can be used for further extensions: $01, $04, $06, ($80 ?)
.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
.const KEY_C64_TAB_FW = $8F // CTRL+>, TAB - Open ROMs unofficial, original TAB conflicts with C64 PETSCII, XXX remove?
.const KEY_C64_TAB_BW = $80 // CTRL+<, SHIFT+TAB - Open ROMs unofficial, original TAB conflicts with C64 PETSCII, XXX remove?
// 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
#if CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65 || ROM_LAYOUT_M65
.const KEY_BELL = $07 // no key, originally CTRL+G // XXX implement, add to C65 keyboard matrix
.const KEY_ESC = $1B
#endif
#if CONFIG_KEYBOARD_C65 || ROM_LAYOUT_M65
.const KEY_TAB = $09 // XXX add to C65 keyboard matrix
.const KEY_LINE_FEED = $0A // XXX add to C65 keyboard matrix
.const KEY_TAB_SET_CLR = $18 // XXX add to C65 keyboard matrix
.const KEY_UNDERLINE_ON = $02 // XXX add to C65 keyboard matrix
.const KEY_UNDERLINE_OFF = $82 // XXX add to C65 keyboard matrix
.const KEY_FLASHING_ON = $0F // XXX add to C65 keyboard matrix
.const KEY_FLASHING_OFF = $8F // XXX add to C65 keyboard matrix
#endif
// PETSCII codes for programmable keys
@@ -61,7 +69,7 @@
.const KEY_F7 = $88
.const KEY_F8 = $8C
#if CONFIG_KEYBOARD_C65
#if CONFIG_KEYBOARD_C65 || ROM_LAYOUT_M65
.const KEY_F9 = $10
.const KEY_F10 = $15
.const KEY_F11 = $16
@@ -70,8 +78,8 @@
.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
#if CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65 || ROM_LAYOUT_M65
.const KEY_HELP = $84
#endif
@@ -109,10 +117,14 @@
// 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
.const KEY_C64_SHIFT_ON = $09 // no key
.const KEY_C64_SHIFT_OFF = $08 // no key
#if CONFIG_KEYBOARD_C65 || ROM_LAYOUT_M65
.const KEY_C65_SHIFT_OFF = $0B // no key
.const KEY_C65_SHIFT_ON = $0C // no key
#endif
.const KEY_TXT = $0E // no key
.const KEY_GFX = $8E // no key
// PETSCII codes for other non-printable characters
+21 -6
View File
@@ -103,11 +103,7 @@
.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 IECPROTO = $A3 // [!] IEC or pseudo-IEC protocol, >= $80 for unknown; originally named TSFCNT
.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 --
@@ -151,7 +147,7 @@
.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 CRSW = $D0 // whether to input from screen or keyboard (if from screen, stores input offset)
.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
@@ -290,6 +286,25 @@
// $3FC $3FC-$3FF -- UNUSED -- free for user software
//
// Definitions for extended IEC functionality
//
.const IEC_NORMAL = 0 // has to be 0, always!
#if CONFIG_IEC_JIFFYDOS
.const IEC_JIFFY = 1 // has to be 1, always!
#endif
#if CONFIG_IEC_DOLPHINDOS
.const IEC_DOLPHIN = 2
#endif
#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || ROM_LAYOUT_M65
.const IEC_BURST = 3
#endif
#if ROM_LAYOUT_M65
.const IEC_ROMDOS = 4
#endif
//
// Definitions for tape functionality
//
+76
View File
@@ -0,0 +1,76 @@
// #LAYOUT# M65 * #TAKE
// #LAYOUT# * * #IGNORE
//
// Names of ZP and low memory locations for the native MEGA65 mode
//
//
// Page 0 - reused LDTB1 and USER
//
.label M65_TMP__K1 = $D9 // $D9 -- UNUSED -- temporary value for various Kernal routines
.label M65_LPNT_BAS1 = $DA // $DA-$DD 4-byte pointer for temporary usage within BASIC
.label M65_LPNT_BAS2 = $DE // $DE-$E1 4-byte pointer for temporary usage within BASIC
.label M65_LPNT_SCR = $E2 // $E2-$E5 4-byte pointer for temporary usage within BASIC and screen editor
// E6 reserved for BASIC error handling routines, also in native mode
.label M65_MAGICSTR = $E7 // $E7-$E9 if equals 'M65' it means we are in native mode
// EA reserved for BASIC error handling routines, also in native mode
.label M65_LPNT_IRQ = $EB // $EB-$EE 4-byte pointer for temporary usage within interrupts
.label M65_LPNT_KERN = $EF // $EF-$F3 4-byte pointer for temporary usage by KERNAL
.label M65_TMP__K2 = $F4 // $F4 -- UNUSED -- temporary value for various Kernal routines
//
// Page 0 - other reused values
//
.label M65__TXTROW = TBLX // screen row
.label M65__TXTCOL = PNTR // screen column
.label M65__SCRINPUT = LSXP // pointer to the screen input, within the screen segment
//
// Pages 4-7 - reused screen memory
//
// $400-$57F - reserved for BASIC
// $400-$57F -- UNUSED -- reserved for BASIC
// $580-$5FF - reserved for KERNAL
.label M65_SCRSEG = $580 // $580-$581 segment address (2 higher bytes) of the screen memory
.label M65_SCRBASE = $582 // $582-$583 first byte of screen memory
.label M65_SCRGUARD = $584 // $584-$585 last byte of screen memory + 1 XXX is it needed?
.label M65_COLGUARD = $586 // $586-$587 last byte of colour memory + 1
.label M65_COLVIEW = $588 // $588-$589 first byte of color memory viewport
.label M65_COLVIEWMAX = $58A // $58A-$58B largest allowed value of M65_COLVIEW
.label M65_SCRMODE = $58C // 0 = 40x25, 1 = 80x25, 2 = 80x50
.label M65_SCRWINMODE = $58D // $00 = normal mode, $FF = window enabled
.label M65_TXTWIN_X0 = $58E // text window - top-left X coordinate, starting from 0
.label M65_TXTWIN_Y0 = $58F // text window - top-left Y coordinate, starting from 0
.label M65_TXTWIN_X1 = $590 // text window - bottom-right X coordinate + 1
.label M65_TXTWIN_Y1 = $591 // text window - bottom-right Y coordinate + 1
.label M65_TXTROW_OFF = $592 // $592-$593 offset to the current text row from the viewport start
.label M65_SCRCOLMAX = $594 // maximum allowed column
// $595-$5EB -- UNUSED --
.label M65_DMAGIC_LIST = $5EF // $5EF-$5FF reserved for DMAgic list, 17 bytes
.label M65_RS232_INBUF = $600 // $600-$6FF -- reserved for RS-232 input buffer --
.label M65_RS232_OUTBUF = $700 // $700-$7FF -- reserved for RS-232 output buffer --
//
// Addresses for configuring the DMA job
//
.label M65_DMAJOB_SIZE_0 = M65_DMAGIC_LIST + 7
.label M65_DMAJOB_SIZE_1 = M65_DMAGIC_LIST + 8
.label M65_DMAJOB_SRC_0 = M65_DMAGIC_LIST + 9
.label M65_DMAJOB_SRC_1 = M65_DMAGIC_LIST + 10
.label M65_DMAJOB_SRC_2 = M65_DMAGIC_LIST + 11
.label M65_DMAJOB_SRC_3 = M65_DMAGIC_LIST + 2
.label M65_DMAJOB_DST_0 = M65_DMAGIC_LIST + 12
.label M65_DMAJOB_DST_1 = M65_DMAGIC_LIST + 13
.label M65_DMAJOB_DST_2 = M65_DMAGIC_LIST + 14
.label M65_DMAJOB_DST_3 = M65_DMAGIC_LIST + 4
+24
View File
@@ -0,0 +1,24 @@
// #LAYOUT# M65 * #TAKE
// #LAYOUT# * * #IGNORE
// XXX target High RAM memory map concept - TODO: update current code
// $10000-$17FFF (32KB) - reserved for DOS
// $18000-$18FFF (4KB) - chargen copied to RAM, to allow character redefinition
.const MEMCONF_CHRBASE = $8000
// $19000-$1B7FF (10KB) - reserved for virtual text screen, 80x128
.const MEMCONF_SCRBASE = $9000
.const MEMCONF_SCRROWS = 128
// $1B800-$1DFFF (10KB) - reserved for a color RAM backup when switchin between text/graphics modes
// (4KB) - reserved for sprites
// (2KB) - reserved for future use
// (2KB) - color RAM mirror, not useable
// $20000-$2FFFF (64KB) - ROM, the essential part
// $30000-$4FFFF (64KB) - ROM, additions
// $50000-$57FFF (32KB) - reserved for graphics screen
// $58000-... - extended BASIC variables, RAM disk, etc.
+10
View File
@@ -51,3 +51,13 @@
#endif
.label filename_any = KERNAL().filename_any
.label SELDEV = KERNAL().SELDEV
#if ROM_LAYOUT_M65
.label M65_MODEGET = KERNAL().M65_MODEGET
.label M65_MODESET = KERNAL().M65_MODESET
.label M65_SLOW = KERNAL().M65_SLOW
.label M65_FAST = KERNAL().M65_FAST
.label M65_SETWIN_Y = KERNAL().M65_SETWIN_Y
#endif
+12
View File
@@ -0,0 +1,12 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# M65 BASIC_1 #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
#if ROM_LAYOUT_M65
packed_freq_keywords_03:
put_packed_freq_keywords_03()
#endif
+56
View File
@@ -0,0 +1,56 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Startup banner, to be displayed during cold start
//
.encoding "petscii_upper"
.macro BANNER_TEXT() {
#if CONFIG_BRAND_CUSTOM_BUILD
.text "OPEN ROMS "
.text CONFIG_CUSTOM_BRAND
#elif CONFIG_BRAND_GENERIC
.text "OPEN ROMS GENERIC BUILD"
#elif CONFIG_BRAND_TESTING
.text "OPEN ROMS TESTING BUILD"
#elif CONFIG_BRAND_ULTIMATE_64
.text "OPEN ROMS FOR ULTIMATE 64"
#endif
}
startup_banner:
#if CONFIG_BANNER_SIMPLE
.text " "
BANNER_TEXT()
.byte $00
#elif CONFIG_BANNER_FANCY
BANNER_TEXT()
.byte $00
rainbow_logo:
{
.var SET_COLOR_0 = $05
.var SET_COLOR_1 = $1C
.var SET_COLOR_2 = $9E
.var SET_COLOR_3 = $1E
.var SET_COLOR_4 = $9F
.byte SET_COLOR_1, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $0D
.byte SET_COLOR_2, $12, $A4, $A4, $A4, $A4, $A4, $A4, $0D
.byte SET_COLOR_3, $12, $A4, $A4, $A4, $A4, $A4, $0D
.byte SET_COLOR_4, $12, $A4, $A4, $A4, $A4, $92
.byte SET_COLOR_0, $00
}
#endif
@@ -1,6 +1,4 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# M65 BASIC_1 #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
@@ -10,96 +8,33 @@
.encoding "petscii_upper"
.macro BANNER_TEXT() {
#if CONFIG_BRAND_CUSTOM_BUILD
.text "OPEN ROMS "
.text CONFIG_CUSTOM_BRAND
#elif CONFIG_BRAND_GENERIC
.text "OPEN ROMS GENERIC BUILD"
#elif CONFIG_BRAND_TESTING
.text "OPEN ROMS TESTING BUILD"
#elif CONFIG_BRAND_MEGA_65
.text "OPEN ROMS FOR MEGA65"
#elif CONFIG_BRAND_ULTIMATE_64
.text "OPEN ROMS FOR ULTIMATE 64"
#endif
}
startup_banner:
#if CONFIG_BANNER_SIMPLE
// Fancy MEGA65 banner - from Retrofan, slightly tweaked
.text " "
BANNER_TEXT()
.byte $00
#elif CONFIG_BANNER_FANCY
// remove unneeded $1F's (blue) and $9A's (light blue)
BANNER_TEXT()
.byte $00
rainbow_logo:
{
#if CONFIG_COLORS_BRAND && CONFIG_BRAND_MEGA_65
.var SET_COLOR_0 = $05
.var SET_COLOR_1 = $9A
.var SET_COLOR_2 = $1E
.var SET_COLOR_3 = $9E
.var SET_COLOR_4 = $96
#else
.var SET_COLOR_0 = $05
.var SET_COLOR_1 = $1C
.var SET_COLOR_2 = $9E
.var SET_COLOR_3 = $1E
.var SET_COLOR_4 = $9F
#endif
.byte SET_COLOR_1, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $0D
.byte SET_COLOR_2, $12, $A4, $A4, $A4, $A4, $A4, $A4, $0D
.byte SET_COLOR_3, $12, $A4, $A4, $A4, $A4, $A4, $0D
.byte SET_COLOR_4, $12, $A4, $A4, $A4, $A4, $92
.byte SET_COLOR_0, $00
}
#if !CONFIG_BRAND_CUSTOM_BUILD
pre_revision_string:
.text "RELEASE "
.byte $00
#endif // no CONFIG_BRAND_CUSTOM_BUILD
#elif CONFIG_BANNER_BRAND && CONFIG_BRAND_MEGA_65
// Fancy Mega65 banner - from Retrofan, slightly tweaked
.byte $9A, $12, $20, $20, $7F, $A9, $20, $20, $1F, $20, $9A, $20, $20, $20, $20, $1F
.byte $20, $9A, $A9, $20, $20, $20, $92, $A1, $1F, $12, $20, $9A, $A9, $20, $20, $20
.byte $7F, $1F, $20, $20, $9A, $A3, $A3, $A3, $A3, $A3, $A3, $A3, $1F
.byte $9A, $12, $20, $20, $7F, $A9, $20, $20, $92, $20, $12, $20, $20, $20, $20, $92
.byte $20, $12, $A9, $20, $20, $20, $92, $A1, $20, $12, $A9, $20, $20, $20, $7F, $92
.byte $20, $20, $12, $A3, $A3, $A3, $A3, $A3, $A3, $A3
.byte $0D
.byte $9A, $12, $20, $20, $20, $20, $20
.byte $20, $1F, $20, $9A, $20, $20, $92, $A2, $bb, $1F, $12, $20, $9A, $20, $20, $92
.byte $Ac, $A2, $A2, $1F, $12, $20, $9A, $20, $20, $1F, $20, $9A, $20, $20, $1F, $20
.byte $20, $1e, $A3, $A3, $A3, $A3, $A3, $A3, $1F
.byte $20, $92, $20, $12, $20, $20, $92, $A2, $BB, $92, $20, $12, $20, $20, $92, $AC
.byte $A2, $A2, $20, $9A, $12, $20, $20, $92, $20, $12, $20, $20, $92, $20, $20, $12
.byte $1E, $A3, $A3, $A3, $A3, $A3, $A3
.byte $0D
.byte $9A, $12, $20, $20, $92, $7F, $A9, $12, $20, $20, $1F, $20, $9A, $20, $20, $A2
.byte $92, $be, $1F, $12, $20, $9A, $20, $20, $92, $bc, $12, $20, $20, $1F, $20, $9A
.byte $20, $20, $20, $20, $20, $1F, $20, $20, $9e, $A3, $A3, $A3, $A3, $A3, $1F
.byte $9A, $12, $20, $20, $92, $7F, $A9, $12, $20, $20, $92, $20, $12, $20, $20, $A2
.byte $92, $BE, $92, $20, $12, $20, $20, $92, $BC, $12, $20, $20, $92, $20, $12, $20
.byte $20, $20, $20, $20, $92, $20, $20, $12, $9E, $A3, $A3, $A3, $A3, $A3
.byte $0D
.byte $9A, $12, $20, $20, $1F, $20, $20, $9A, $20, $20, $1F, $20, $9A, $20, $20, $20
.byte $20, $1F, $20, $9A, $20, $20, $20, $20, $20, $1F, $20, $9A, $20, $20, $1F, $20
.byte $9A, $20, $20, $1F, $20, $20, $96, $A3, $A3, $A3, $A3, $1F, $92
.byte $9A, $12, $20, $20, $92, $20, $20, $12, $20, $20, $92, $20, $12, $20, $20, $20
.byte $20, $92, $20, $12, $20, $20, $20, $20, $20, $92, $20, $12, $20, $20, $92, $20
.byte $12, $20, $20, $92, $20, $20, $12, $96, $A3, $A3, $A3, $A3, $1F, $92
.byte $0D, $0D, $05, $00
// Fancy Mega65 banner - from Retrofan
// Fancy MEGA65 banner - from Retrofan
//
// .byte $9a, $12, $20, $20, $7f, $a9, $20, $20, $1f, $20, $9a, $20, $20, $20
// .byte $20, $1f, $20, $9a, $a9, $20, $20, $20, $92, $a1, $1f, $12, $20, $9a, $a9, $20
@@ -117,7 +52,7 @@ pre_revision_string:
// .byte $20, $20, $1f, $20, $20, $96, $a3, $a3, $a3, $a3, $1f
// .byte $92, $0D, $0D, $05, $00
// Original Mega65 banner - supplied by Deft
// Original MEGA65 banner - supplied by Deft
//
// .byte $9A,$12,$A3,$A3,$A3,$A3,$A3,$A3,$DF,$9B,$92,$20,$05,$12,$A0,$A0
// .byte $DF,$9B,$92,$20,$05,$12,$A0,$A0,$DF,$9B,$92,$20,$05,$12,$A0,$A0
@@ -134,16 +69,3 @@ pre_revision_string:
// .byte $12,$A0,$A0,$9B,$92,$20,$9A,$7F,$12,$A0,$A0,$9B,$92,$20,$9A,$7F
// .byte $12,$DF,$92,$7F,$9B,$20,$9A,$20,$9B,"0.2.0.0",$0D
// .byte $0D,$05,$92,$00
#if ROM_LAYOUT_M65
text_mode_64:
.text "LEGACY"
.byte $11, $9D, $9D, $9D, $9D, $9D
.text "MODE"
.byte $00
#endif
#endif
+2 -4
View File
@@ -55,14 +55,12 @@
cmd_tab, // XXX this token probably does not belong here
do_SYNTAX_error, // 'TO' is not a standalone command
do_SYNTAX_error, // 'FN' is not a standalone command
cmd_spc, // XXX this token probably does not belong here
cmd_spc // XXX this token probably does not belong here
// 'THEN' ($A7) and 'STEP' ($A9) are not standalone commands
// 'NOT' ($A8) is an operator, not a command
// $CB, but remapped to $A7
cmd_go
// 'GO' ($CB) is handled separately
)
@@ -21,8 +21,6 @@ cmd_input:
nop
cmd_read:
nop
cmd_if:
nop
cmd_gosub:
nop
cmd_return:
@@ -51,8 +49,6 @@ cmd_tab:
nop
cmd_spc:
nop
cmd_go:
nop
// Unimplemented tokens
@@ -3,6 +3,77 @@
// #LAYOUT# * * #IGNORE
cmd_go:
jsr fetch_character_skip_spaces
cmp #$A4 // 'TO' keyword
beq cmd_goto
#if !ROM_LAYOUT_M65
// FALLTROUGH
cmd_go_syntax_error:
jmp do_SYNTAX_error
#else
cmp #$9E // 'SYS' keyword, for 'GO SYS'
beq_16 cmd_gosys
dew TXTPTR // unconsume character
// Fetch desired mode
jsr fetch_uint8
cmp #64
bne !+
// If in native mode - switch to C64 compatibilty
jsr M65_MODEGET
bcs cmd_go_rts
jsr helper_ask_if_sure
bcs_16 cmd_end
sec
jsr M65_MODESET // Carry set = switch to C64 mode
jmp_8 cmd_go_switchmode_clr_banner
!:
cmp #65
bne_16 do_ILLEGAL_QUANTITY_error
// If in C64 compatibility mode - switch to native mode
jsr M65_MODEGET
bcc cmd_go_rts
jsr helper_ask_if_sure
bcs_16 cmd_end
jsr M65_MODESET // Carry clear = switch to M65 mode
// FALLTROUGH
cmd_go_switchmode_clr_banner:
jsr do_clr
ldx CURLIN+1
inx
beq_16 INITMSG
lda #147
jmp JCHROUT
cmd_go_rts:
rts
#endif
cmd_run:
// RUN clears all variables
@@ -25,9 +96,15 @@ cmd_run:
cmd_goto:
// GOTO requires line number
// XXX in case of no parameter, go to line 0 - checked with original ROMs
jsr fetch_line_number
#if !ROM_LAYOUT_M65
bcs cmd_go_syntax_error
#else
bcs_16 do_SYNTAX_error
#endif
// Check for direct mode
+40
View File
@@ -0,0 +1,40 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_if:
#if ROM_LAYOUT_M65
jsr helper_if_mega65
bcc cmd_if_true
#endif
// Calculate expression
jsr FRMEVL
// Check the result - either string size or floating point 0 vs non-0
lda FAC1_exponent
beq_16 cmd_rem
// FALLTROUGH
cmd_if_true:
// Condition fulfilled - look for GOTO or THEN
jsr fetch_character_skip_spaces
cmp #$89 // 'GOTO'
beq_16 cmd_goto
cmp #$A7 // 'THEN'
bne_16 do_SYNTAX_error
pla
pla
jmp execute_statements
+2
View File
@@ -7,6 +7,8 @@
cmd_rem:
// XXX do we need these PHA's?
pha
pha
jmp execute_statements_end_of_line
+32 -6
View File
@@ -3,15 +3,41 @@
// #LAYOUT# * * #IGNORE
#if ROM_LAYOUT_M65
cmd_gosys:
// NSYS requires an argument
jsr is_end_of_statement
bcs_16 do_SYNTAX_error
bra cmd_sys_nsys_common
#endif
cmd_sys:
jsr is_end_of_statement
bcc !+
// SYS requires an argument
jmp do_SYNTAX_error
!:
jsr is_end_of_statement
bcs_16 do_SYNTAX_error
#if ROM_LAYOUT_M65
// Make sure we are in C64 compatibility mode
jsr M65_MODEGET
bcs cmd_sys_nsys_common
sec
jsr M65_MODESET // set legacy C64 compatibility mode
jsr INITMSG_autoswitch
// FALLTROUGH
cmd_sys_nsys_common:
#endif
//
// XXX Temporary ugly hack to support 'SYS PI*656'
//
@@ -0,0 +1,52 @@
// #LAYOUT# M65 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
#if CONFIG_MEMORY_MODEL_38K
helper_if_mega65:
// Injest all spaces
ldy #$00
!:
lda (TXTPTR), Y
cmp #$20
bne !+
inw TXTPTR
bra !-
!:
// Check for MEGA65 untokenized keyword
ldy #$05
!:
lda (TXTPTR), Y
cmp str_mega65, Y
bne_16 helper_if_mega65_fail
dey
bpl !-
// Increment TXTPTR by 6
clc
lda TXTPTR+0
adc #$06
sta TXTPTR+0
bcc !+
inc TXTPTR+1
!:
// Report successful check
clc
rts
helper_if_mega65_fail:
sec
rts
str_mega65:
.byte $4D, $45, $47, $41, $36, $35
#endif
@@ -0,0 +1,54 @@
// #LAYOUT# M65 BASIC_0 #TAKE-HIGH
// #LAYOUT# * * #IGNORE
// This has to go $E000 or above - routine below banks out the main BASIC ROM!
#if CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
helper_if_mega65:
// Unmap BASIC lower ROM
lda #$26
sta CPU_R6510
// Injest all spaces
ldy #$00
!:
lda (TXTPTR), Y
cmp #$20
bne !+
inw TXTPTR
bra !-
!:
// Check for MEGA65 untokenized keyword
ldy #$05
!:
lda (TXTPTR), Y
cmp str_mega65, Y
bne_16 remap_BASIC_sec_rts
dey
bpl !-
// Increment TXTPTR by 6
clc
lda TXTPTR+0
adc #$06
sta TXTPTR+0
bcc !+
inc TXTPTR+1
!:
// Report successful check
jmp remap_BASIC_clc_rts
str_mega65:
.byte $4D, $45, $47, $41, $36, $35
#endif
@@ -22,6 +22,6 @@ helper_load_init_params_no_VERCKB:
// Set default device, set secondary address to 0
jsr select_device
jsr SELDEV
ldy #$00 // secondary address
jmp JSETFLS
@@ -9,8 +9,14 @@
.const command_01_list = List().add(
#if CONFIG_MB_MEGA_65
M65_SLOW,
M65_FAST,
#else
cmd_slow,
cmd_fast,
#endif
cmd_old,
// NOTE! These commands are temporarily placed here, they should be a part of list 02!
+1 -17
View File
@@ -5,23 +5,7 @@
#if CONFIG_MB_MEGA_65
// Command implementation for Mega65
// XXX - I think there are some bit-set instructions in 65CE02...
cmd_slow:
lda #$40
skip_2_bytes_trash_nvz
// FALLTROUGH
cmd_fast:
lda #$41
sta CPU_D6510
rts
// For MEGA65 Kernal routines are called directly
#elif CONFIG_MB_ULTIMATE_64
@@ -22,7 +22,8 @@
// varstr_garbage_collect, // cmd_dispose
cmd_cold,
cmd_mem
cmd_mem,
cmd_sysinfo
)
+145
View File
@@ -0,0 +1,145 @@
// #LAYOUT# M65 * #TAKE
// #LAYOUT# * * #IGNORE
#if SEGMENT_BASIC_0
cmd_sysinfo:
jsr map_BASIC_1
jsr_ind VB1__cmd_sysinfo
jmp map_NORMAL
#else
cmd_sysinfo:
jsr print_return
// Print mode and build information
ldx #IDX__STR_SI_HEADER
jsr print_packed_misc_str
jsr M65_MODEGET
bcc !+
ldx #IDX__STR_SI_MODE64
skip_2_bytes_trash_nvz
!:
ldx #IDX__STR_SI_MODE65
jsr print_packed_misc_str
ldx #IDX__STR_SI_HDR_REL
jsr print_packed_misc_str
lda #<rom_revision_basic_string
ldy #>rom_revision_basic_string
jsr STROUT
jsr print_return
jsr M65_MODEGET
bcs print_sysinfo_video
jsr print_return
// FALLTROUGH
print_sysinfo_banner:
// Print board type (information not accessible in native mode)
ldx #IDX__STR_SI_HDR_HW
jsr print_packed_misc_str
lda MISC_BOARDID
ldy #(__cmd_sysinfo_hw_ids_end - cmd_sysinfo_hw_ids - 1)
!:
cmp cmd_sysinfo_hw_ids, y
beq !+
dey
bpl !-
ldy #(__cmd_sysinfo_hw_ids_end - cmd_sysinfo_hw_ids)
!:
ldx cmd_sysinfo_hw_str, y
phx
jsr print_packed_misc_str
plx
cpx #IDX__STR_SI_HW_XX
bne !+
lda MISC_BOARDID
jsr print_hex_byte
!:
// FALLTROUGH
print_sysinfo_video:
// Print video system information
ldx #IDX__STR_SI_HDR_VID
jsr print_packed_misc_str
jsr JSCREEN
phy
lda #$00
jsr print_integer
lda #$58
jsr JCHROUT
ply
tya
tax
lda #$00
jsr print_integer
jsr print_space
ldx #IDX__STR_NTSC
lda TVSFLG
beq !+
ldx #IDX__STR_PAL
!:
jsr print_packed_misc_str
// Print build featires information
ldx #IDX__STR_SI_FEATURES
jmp print_packed_misc_str
cmd_sysinfo_hw_ids:
.byte $01
.byte $02
.byte $03
.byte $21
.byte $40
.byte $41
.byte $42
.byte $FD
.byte $FE
__cmd_sysinfo_hw_ids_end:
cmd_sysinfo_hw_str:
.byte IDX__STR_SI_HW_01
.byte IDX__STR_SI_HW_02
.byte IDX__STR_SI_HW_03
.byte IDX__STR_SI_HW_21
.byte IDX__STR_SI_HW_40
.byte IDX__STR_SI_HW_41
.byte IDX__STR_SI_HW_42
.byte IDX__STR_SI_HW_FD
.byte IDX__STR_SI_HW_FE
.byte IDX__STR_SI_HW_XX
#endif
@@ -0,0 +1,17 @@
// #LAYOUT# M65 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Jumptable for BASIC commands with tokens prefixed by $03
//
.const command_03_list = List().add(
cmd_rem // XXX just for testing
)
command_03_jumptable:
// Note: 65C02 has the page boundary vector bug fixed!
put_jumptable(command_03_list)
@@ -3,7 +3,7 @@
// #LAYOUT# * * #IGNORE
//
// Definitions for communication with Mega65 segment BASIC_1 from BASIC_0
// Definitions for communication with MEGA65 segment BASIC_1 from BASIC_0
//
@@ -13,20 +13,22 @@
// Label definitions
.label VB1__INITMSG = $4000 + 2 * 0
.label VB1__LINKPRG = $4000 + 2 * 1
.label VB1__tokenise_line = $4000 + 2 * 2
.label VB1__list_single_line = $4000 + 2 * 3
.label VB1__print_packed_error = $4000 + 2 * 4
.label VB1__print_packed_misc_str = $4000 + 2 * 5
.label VB1__do_new = $4000 + 2 * 6
.label VB1__do_clr = $4000 + 2 * 7
.label VB1__do_restore = $4000 + 2 * 8
.label VB1__cmd_mem_cont = $4000 + 2 * 9
.label VB1__prepare_direct_execution = $4000 + 2 * 10
.label VB1__helper_ask_if_sure = $4000 + 2 * 11
.label VB1__INITMSG_autoswitch = $4000 + 2 * 1
.label VB1__LINKPRG = $4000 + 2 * 2
.label VB1__tokenise_line = $4000 + 2 * 3
.label VB1__list_single_line = $4000 + 2 * 4
.label VB1__print_packed_error = $4000 + 2 * 5
.label VB1__print_packed_misc_str = $4000 + 2 * 6
.label VB1__do_new = $4000 + 2 * 7
.label VB1__do_clr = $4000 + 2 * 8
.label VB1__do_restore = $4000 + 2 * 9
.label VB1__cmd_mem_cont = $4000 + 2 * 10
.label VB1__cmd_sysinfo = $4000 + 2 * 11
.label VB1__prepare_direct_execution = $4000 + 2 * 12
.label VB1__helper_ask_if_sure = $4000 + 2 * 13
#if CONFIG_DOS_WEDGE
.label VB1__wedge_dos = $4000 + 2 * 12
.label VB1__wedge_dos = $4000 + 2 * 14
#endif
#else
@@ -34,6 +36,7 @@
// Vector table (Open ROMs private!)
.word INITMSG
.word INITMSG_autoswitch
.word LINKPRG
.word tokenise_line
.word list_single_line
@@ -43,6 +46,7 @@
.word do_clr
.word do_restore
.word cmd_mem_cont
.word cmd_sysinfo
.word prepare_direct_execution
.word helper_ask_if_sure
+11 -4
View File
@@ -2,7 +2,7 @@
// #LAYOUT# * * #IGNORE
//
// Definitions for calling Mega65 segments BASIC_0 and KERNAL_0 routines from BASIC_1
// Definitions for calling MEGA65 segments BASIC_0 and KERNAL_0 routines from BASIC_1
//
#import "BASIC_0_combined.sym"
@@ -12,6 +12,7 @@
.label poke_via_OLDTXT = BASIC_0.proxy_B1_poke_via_OLDTXT
.label JCHROUT = BASIC_0.proxy_B1_JCHROUT
.label JCLALL = BASIC_0.proxy_B1_JCLALL
.label plot_set = BASIC_0.proxy_B1_plot_set
#if CONFIG_DOS_WEDGE
.label JCLOSE = BASIC_0.proxy_B1_JCLOSE
.label JOPEN = BASIC_0.proxy_B1_JOPEN
@@ -20,10 +21,16 @@
.label JSETFLS = KERNAL_0.JSETFLS
.label JSETNAM = KERNAL_0.JSETNAM
.label JGETIN = KERNAL_0.JGETIN
.label JCHKIN = KERNAL_0.JCHKIN
.label JCHRIN = KERNAL_0.JCHRIN
.label JCHKIN = BASIC_0.proxy_B1_JCHKIN
.label JCHRIN = BASIC_0.proxy_B1_JCHRIN
.label JREADST = KERNAL_0.JREADST
.label plot_set = KERNAL_0.plot_set
.label JSCREEN = KERNAL_0.JSCREEN
.label SELDEV = KERNAL_0.SELDEV
.label M65_MODEGET = KERNAL_0.M65_MODEGET
.label M65_SETWIN_XY = KERNAL_0.M65_SETWIN_XY
.label M65_SETWIN_WH = KERNAL_0.M65_SETWIN_WH
.label M65_SETWIN_Y = BASIC_0.proxy_B1_M65_SETWIN_Y
.label M65_SETWIN_N = KERNAL_0.M65_SETWIN_N
.label init_oldtxt = BASIC_0.init_oldtxt
.label tmpstr_free_all_reset = BASIC_0.tmpstr_free_all_reset
.label rom_revision_basic_string = BASIC_0.rom_revision_basic_string
+2 -2
View File
@@ -2,7 +2,7 @@
// #LAYOUT# * * #IGNORE
//
// ROM mapping routines for Mega65
// ROM mapping routines for MEGA65
//
// Available memory maps:
@@ -23,6 +23,6 @@ map_BASIC_1:
taz
lda #$20
ldx #$C2 // 0x4000 <- map 16KB from 0x22000
ldx #$C2 // $4000 <- map 16KB from $22000
jmp map_end
+35 -22
View File
@@ -2,13 +2,14 @@
// #LAYOUT# * * #IGNORE
//
// Proxies for calling Mega65 segment BASIC_0 and KERNAL_0 routines from BASIC_1
// Proxies for calling MEGA65 segment BASIC_0 and KERNAL_0 routines from BASIC_1
//
proxy_B1_peek_via_OLDTXT:
jsr map_NORMAL
#if CONFIG_MEMORY_MODEL_60K
.error "not implemented"
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
@@ -17,6 +18,7 @@ proxy_B1_peek_via_OLDTXT:
#else // CONFIG_MEMORY_MODEL_38K
lda (OLDTXT),y
#endif
!:
jmp map_BASIC_1
proxy_B1_poke_via_OLDTXT:
@@ -27,14 +29,14 @@ proxy_B1_poke_via_OLDTXT:
#else // CONFIG_MEMORY_MODEL_38K || CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
sta (OLDTXT),y
#endif
!:
jmp map_BASIC_1
proxy_B1_JCLALL:
jsr map_NORMAL
jsr JCLALL
jmp map_BASIC_1
jmp_8 !-
#if CONFIG_DOS_WEDGE
@@ -42,59 +44,69 @@ proxy_B1_JCLOSE:
jsr map_NORMAL
jsr JCLOSE
jmp map_BASIC_1
jmp_8 !-
proxy_B1_JOPEN:
jsr map_NORMAL
jsr JOPEN
jmp map_BASIC_1
jmp_8 !-
#endif
proxy_B1_JCHKIN:
jsr map_NORMAL
jsr JCHKIN
jmp_8 !-
proxy_B1_JCHRIN:
jsr map_NORMAL
jsr JCHRIN
jmp_8 !-
proxy_B1_JCHROUT:
jsr map_NORMAL
jsr JCHROUT
jmp map_BASIC_1
jmp_8 !-
proxy_B1_print_hex_byte:
jsr map_NORMAL
jsr print_hex_byte
jmp map_BASIC_1
jmp_8 !-
proxy_B1_print_integer:
jsr map_NORMAL
jsr print_integer
jmp map_BASIC_1
jmp_8 !-
proxy_B1_print_return:
jsr map_NORMAL
jsr print_return
jmp map_BASIC_1
jmp_8 !-
proxy_B1_print_space:
jsr map_NORMAL
jsr print_space
jmp map_BASIC_1
jmp_8 !-
#if CONFIG_SHOW_FEATURES
proxy_B1_print_features:
proxy_B1_plot_set:
jsr map_NORMAL
jsr print_features
jmp map_BASIC_1
jsr plot_set
jmp_8 !-
#endif
proxy_B1_M65_SETWIN_Y:
jsr map_NORMAL
jsr M65_SETWIN_Y
jmp_8 !-
#if CONFIG_DOS_WEDGE
@@ -102,18 +114,19 @@ proxy_B1_fetch_character:
jsr map_NORMAL
jsr fetch_character
jmp map_BASIC_1
jmp_8 !+
proxy_B1_fetch_character_skip_spaces:
jsr map_NORMAL
jsr fetch_character_skip_spaces
jmp map_BASIC_1
jmp_8 !+
proxy_B1_fetch_uint8:
jsr map_NORMAL
jsr fetch_uint8
!:
jmp map_BASIC_1
proxy_B1_shell_main_loop:
+25
View File
@@ -98,6 +98,18 @@ tokenise_line_loop:
jsr tk_search
bcc tokenise_line_keyword_02 // branch if keyword identified
#endif
#if ROM_LAYOUT_M65
lda #<packed_freq_keywords_03
sta FRESPC+0
lda #>packed_freq_keywords_03
sta FRESPC+1
jsr tk_search
bcc tokenise_line_keyword_03 // branch if keyword identified
#endif
// Shorten packed keyword candidate and try again
@@ -173,6 +185,19 @@ tokenise_line_char:
// Support for extended keyword lists
#if ROM_LAYOUT_M65
tokenise_line_keyword_03:
// Store the token list index
lda #$03
skip_2_bytes_trash_nvz
// FALLTROUGH
#endif
#if !HAS_SMALL_BASIC
tokenise_line_keyword_02:
+1 -1
View File
@@ -163,7 +163,7 @@ do_error_fetch:
// $E6 has even part
asl
ora $EA
and #$7f
and #$7F
tax
// Restore $EA to correct value in case the NOP above is used
@@ -46,7 +46,11 @@ execute_statements:
#else
#if ROM_LAYOUT_M65
cpx #$04
#else
cpx #$03
#endif
bcc execute_statements_extended
#endif
@@ -57,6 +61,9 @@ execute_statements:
cpx #$7F
bcc_16 execute_statements_var_assign // not a token - try variable assign
cpx #$A7
bcs_16 do_SYNTAX_error
#if !HAS_OPCODES_65C02
// Get the jump table entry for it, push it on the stack, and then RTS to start it.
@@ -93,6 +100,13 @@ execute_statements_extended:
cpx #$02
beq execute_statements_02
#if ROM_LAYOUT_M65
cpx #$03
beq execute_statements_03
#endif
jmp do_SYNTAX_error
#endif
@@ -171,6 +185,27 @@ execute_statements_02:
#endif // !HAS_SMALL_BASIC
#if ROM_LAYOUT_M65
execute_statements_03:
// Get the sub-token, check that it is valid
jsr fetch_character
cmp #$00
beq_16 do_SYNTAX_error
cmp #(TK__MAXTOKEN_keywords_03+1)
bcs_16 do_SYNTAX_error
// Use jumptable to go to the command routine
asl
tax
jmp (command_03_jumptable - 2, x)
#endif // ROM_LAYOUT_M65
execute_statements_end_of_line:
// First check, if we are in direct mode - if so,
@@ -41,5 +41,8 @@ basic_cold_start_internal:
// Print startup messages
jsr INITMSG
// Initialize other variables by performing NEW
jsr do_new
// jump into warm start loop
jmp basic_warm_start
+7
View File
@@ -16,8 +16,15 @@ INITMSG:
jsr map_BASIC_1
jsr_ind VB1__INITMSG
!:
jmp map_NORMAL
INITMSG_autoswitch:
jsr map_BASIC_1
jsr_ind VB1__INITMSG_autoswitch
bra !-
#else
jmp initmsg_real
-6
View File
@@ -55,12 +55,6 @@ initmsg_bytes_free:
#endif
sta MEMSIZ+0
// XXX move the part above to a more suitable place
// Initialize other variables by performing NEW
jsr do_new
// Print number of bytes free
sec
+101
View File
@@ -0,0 +1,101 @@
// #LAYOUT# M65 BASIC_1 #TAKE
// #LAYOUT# * * #IGNORE
// Routine is too long to fit in the original location
// XXX banner-related code needs cleanup, move MEGA65 stuff to a separate file
INITMSG:
jsr INITMSG_main_banner
// Display additional information, depending on the mode
jsr M65_MODEGET
bcc !+
// Legacy C64 compatibility mode
jsr INITMSG_partial
ldx #IDX__STR_ORS_LEGACY_2
jsr print_packed_misc_str
bra INITMSG_end
!:
// Native mode
ldx #48
ldy #0
jsr M65_SETWIN_XY
ldx #32
ldy #9
jsr M65_SETWIN_WH
jsr M65_SETWIN_Y
jsr print_sysinfo_banner
jsr M65_SETWIN_N
// Native mode - display revision and available memory
ldx #$05
ldy #$00
jsr plot_set
ldx #IDX__STR_ORS
jsr print_packed_misc_str
jsr INITMSG_revision
jsr print_return
jsr print_return
// FALLTROUGH
INITMSG_end:
jsr initmsg_bytes_free
ldx #$09
ldy #$00
jmp plot_set
INITMSG_main_banner:
// Clear the screen first, some cartridges (like IEEE-488) are leaving a mess on the screen
lda #147
jsr JCHROUT
// Display main banner
lda #<startup_banner
ldy #>startup_banner
jmp STROUT
INITMSG_autoswitch: // entry point for 'SYS command'
jsr INITMSG_main_banner
jsr INITMSG_partial
jsr print_return
jmp print_return
INITMSG_partial:
ldx #IDX__STR_ORS_LEGACY_1
jsr print_packed_misc_str
// FALLTROUGH
INITMSG_revision:
ldx #IDX__STR_PRE_REV
jsr print_packed_misc_str
lda #<rom_revision_basic_string
ldy #>rom_revision_basic_string
jmp STROUT
+2 -58
View File
@@ -1,5 +1,4 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# M65 BASIC_1 #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
@@ -7,16 +6,8 @@
// Routine is too long to fit in the original location
#if ROM_LAYOUT_M65
INITMSG:
#else
initmsg_real:
#endif
// Clear the screen first, some cartridges (like IEEE-488) are leaving a mess on the screen
lda #147
jsr JCHROUT
@@ -82,9 +73,8 @@ initmsg_real:
ldy #$0A
jsr plot_set
lda #<pre_revision_string
ldy #>pre_revision_string
jsr STROUT
ldx #IDX__STR_PRE_REV
jsr print_packed_misc_str
lda #<rom_revision_basic_string
ldy #>rom_revision_basic_string
@@ -115,50 +105,4 @@ initmsg_real:
jmp plot_set
#endif
#elif CONFIG_BANNER_BRAND && CONFIG_BRAND_MEGA_65
lda #<startup_banner
ldy #>startup_banner
jsr STROUT
#if ROM_LAYOUT_M65
// XXX make it different for future Mega65 native mode
ldx #$02
ldy #$21
jsr plot_set
lda #<text_mode_64
ldy #>text_mode_64
jsr STROUT
#endif
ldx #$05
ldy #$00
jsr plot_set
lda #<rom_revision_basic_string
ldy #>rom_revision_basic_string
jsr STROUT
ldx #$05
ldy #$12
jsr plot_set
jsr initmsg_bytes_free
#if CONFIG_SHOW_FEATURES
ldx #$08
ldy #$00
jsr plot_set
jmp print_features
#else
ldx #$07
ldy #$00
jmp plot_set
#endif
#endif
+22
View File
@@ -94,6 +94,10 @@ list_not_quote:
cmp #$02
beq list_display_token_02
#endif
#if ROM_LAYOUT_M65
cmp #$03
beq list_display_token_03
#endif
// Check for literals
cmp #$7F
@@ -228,6 +232,24 @@ list_display_token_02:
#endif
#if ROM_LAYOUT_M65
list_display_token_03:
// Display a 2-byte token - for extended BASIC
jsr list_fetch_subtoken
// Check if token is known
cpx #TK__MAXTOKEN_keywords_03
bcs list_is_unknown
// Now ask for it to be printed
phy_trash_a
jsr print_packed_keyword_03
jmp_8 list_display_token_ext_done
#endif
list_fetch_subtoken:
// Fetch the sub-token
@@ -55,6 +55,16 @@ print_packed_keyword_02: // .X - token number
#endif
#if ROM_LAYOUT_M65
print_packed_keyword_03: // .X - token number
lda #<packed_freq_keywords_03
ldy #>packed_freq_keywords_03
bne print_freq_packed_string // branch always
#endif
print_packed_keyword_V2: // .X - token number
lda #<packed_freq_keywords_V2
+16 -4
View File
@@ -4,8 +4,20 @@
// #LAYOUT# * * #IGNORE
// Computes Mapping the 64, p89
// 8 character name
// MEGABAS2 = "MEGA BASIC 2"
// Computes Mapping the 64, p89 - 8 character name
.byte $4D,$45,$47,$41,$42,$41,$53,$32
#if ROM_LAYOUT_M65
// 'M65BASIC'
.byte $4D, $36, $35 // 'M65'
#else
// 'ORGBASIC', Open ROMs Generic BASIC
.byte $4F, $52, $47 // 'ORG'
#endif
.byte $42, $41, $53, $49, $43 // 'BASIC'
+1 -1
View File
@@ -28,7 +28,7 @@ wedge_dos:
jsr JCLALL
// Set file parameters, channel 15 is a typical one for commands
jsr select_device // sets .X register
jsr SELDEV // sets .X register
lda #$0F
ldy #$0F
jsr JSETFLS
+19
View File
@@ -0,0 +1,19 @@
//
// Memory locations for the DOS
//
//
// Page 0
//
.label MAGICSTR = $00 // magic string; if not matching, DOS considered non-functional
.label UNIT_SDCARD = $05
.label UNIT_FLOPPY = $06
.label UNIT_RAMDISK = $07
// NOTES:
// - DOS zeropage is mirrored at $8000
// - starting from $8000, 16KB RAM is available (starting from $10000 in C65 address space)
// - additional 16KB RAM is reserved for DOS too ($14000-$17FFF), and can be banked-in if needed
+14
View File
@@ -0,0 +1,14 @@
// A vector table to integrate DOS with the MEGA65 Kernal
.word dos_INIT
.word dos_CHKUNIT
.word dos_SETUNIT
.word dos_ACPTR
.word dos_CIOUT
.word dos_LISTEN
.word dos_SECOND
.word dos_TALK
.word dos_TKSA
.word dos_UNTLK
.word dos_UNLSN
+63
View File
@@ -0,0 +1,63 @@
//
// Unit number handling. For detailed description see 'm65dos_bridge.s' file
//
dos_CHKUNIT:
// Check for magic string
pha
phx
ldx #$04
!:
lda MAGICSTR, x
cmp dos_magicstr, x
bne dos_CHKUNIT_mem_fail
dex
bpl !-
plx
pla
// Check for unit
cmp UNIT_SDCARD
beq dos_CHKUNIT_sdcard
cmp UNIT_FLOPPY
beq dos_CHKUNIT_floppy
cmp UNIT_RAMDISK
beq dos_CHKUNIT_ramdisk
sec
rts
dos_CHKUNIT_sdcard:
lda #$00
skip_2_bytes_trash_nvz
// FALLTROUGH
dos_CHKUNIT_floppy:
lda #$01
skip_2_bytes_trash_nvz
// FALLTROUGH
dos_CHKUNIT_ramdisk:
lda #$02
clc
rts
dos_CHKUNIT_mem_fail:
plx
pla
sec
rts
+35
View File
@@ -0,0 +1,35 @@
//
// Initializes DOS. For detailed description see 'm65dos_bridge.s' file
//
dos_INIT:
// Set the magic string 'CBDOS'
phx
ldx #$04
!:
lda dos_magicstr, x
sta MAGICSTR, x
dex
bpl !-
plx
// Set default device numbers
lda #CONFIG_UNIT_SDCARD
sta UNIT_SDCARD
lda #CONFIG_UNIT_FLOPPY
sta UNIT_FLOPPY
lda #CONFIG_UNIT_RAMDISK
sta UNIT_RAMDISK
// XXX initialize drivers, etc.
rts
dos_magicstr: // 'CBDOS'
.byte $43, $42, $44, $4F, $53
+42
View File
@@ -0,0 +1,42 @@
//
// Unit number handling. For detailed description see 'm65dos_bridge.s' file
//
dos_SETUNIT:
// XXX check if .X is valid
cmp #$00
beq dos_SETUNIT_sdcard
cmp #$01
beq dos_SETUNIT_floppy
cmp #$02
beq dos_SETUNIT_ramdisk
sec
rts
dos_SETUNIT_sdcard:
stx UNIT_SDCARD
skip_2_bytes_trash_nvz
// FALLTROUGH
dos_SETUNIT_floppy:
stx UNIT_FLOPPY
skip_2_bytes_trash_nvz
// FALLTROUGH
dos_SETUNIT_ramdisk:
stx UNIT_RAMDISK
// FALLTROUGH
clc
rts
+22
View File
@@ -0,0 +1,22 @@
// Dummy implementations - XXX to be replaced with real ones
dos_ACPTR:
nop
dos_CIOUT:
nop
dos_LISTEN:
nop
dos_SECOND:
nop
dos_TALK:
nop
dos_TKSA:
nop
dos_UNTLK:
nop
dos_UNLSN:
nop
sec
rts
@@ -3,7 +3,7 @@
// #LAYOUT# * * #IGNORE
//
// Definitions for communication with Mega65 segment KERNAL_1 from KERNAL_0
// Definitions for communication with MEGA65 segment KERNAL_1 from KERNAL_0
//
@@ -11,13 +11,21 @@
// Label definitions
.label VK1__IOINIT = $4000 + 2 * 0
.label VK1__RAMTAS = $4000 + 2 * 1
.label VK1__setup_vicii = $4000 + 2 * 2
.label VK1__load_tape_normal = $4000 + 2 * 3
.label VK1__load_tape_turbo = $4000 + 2 * 4
.label VK1__load_tape_auto = $4000 + 2 * 5
.label VK1__tape_head_align = $4000 + 2 * 6
.label VK1__IOINIT = $4000 + 2 * 0
.label VK1__RAMTAS = $4000 + 2 * 1
.label VK1__vicii_init = $4000 + 2 * 2
.label VK1__load_tape_normal = $4000 + 2 * 3
.label VK1__load_tape_turbo = $4000 + 2 * 4
.label VK1__load_tape_auto = $4000 + 2 * 5
.label VK1__tape_head_align = $4000 + 2 * 6
.label VK1__m65_chrout_screen = $4000 + 2 * 7
.label VK1__m65_chrin_keyboard = $4000 + 2 * 8
.label VK1__M65_MODESET = $4000 + 2 * 9
.label VK1__M65_SCRMODEGET = $4000 + 2 * 10
.label VK1__M65_SCRMODESET = $4000 + 2 * 11
.label VK1__M65_CLRSCR = $4000 + 2 * 12
.label VK1__M65_CLRWIN = $4000 + 2 * 13
.label VK1__m65_screen_upd_txtrow_off = $4000 + 2 * 14
#else
@@ -25,7 +33,7 @@
.word IOINIT
.word RAMTAS
.word setup_vicii
.word vicii_init
#if CONFIG_TAPE_NORMAL && !CONFIG_TAPE_AUTODETECT
.word load_tape_normal
@@ -51,4 +59,14 @@
.word $0000
#endif
.word m65_chrout_screen
.word m65_chrin_keyboard
.word M65_MODESET
.word M65_SCRMODEGET
.word M65_SCRMODESET
.word M65_CLRSCR
.word M65_CLRWIN
.word m65_screen_upd_txtrow_off
#endif
+139
View File
@@ -0,0 +1,139 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
// Helper routines for DMAgic usage
// See:
// - https://c65gs.blogspot.com/2019/03/auto-detecting-required-revision-of.html
// - https://c65gs.blogspot.com/2018/01/improving-dmagic-controller-interface.html
m65_dmagic_oper_fill:
// To configure job parameters, use:
// - M65_DMAJOB_SIZE_*
// - M65_DMAJOB_DST_*
// - .A - byte for filling
// Afterwards, consider M65_DMAJOB_*_2 and M65_DMAJOB_*_3 destroyed.
// Set fill address
sta M65_DMAJOB_SRC_0
// Set operation type
lda #($03 + $08) // operation: FILL + allow interrupts
sta M65_DMAGIC_LIST+6
// Adapt the addresses, launch the job
jsr m65_dmagic_adapt_dst
jmp_8 m65_dmagic_launch
m65_dmagic_oper_copy:
// To configure job parameters, use:
// - M65_DMAJOB_SIZE_*
// - M65_DMAJOB_SRC_*
// - M65_DMAJOB_DST_*
// Afterwards, consider M65_DMAJOB_DST_2 and M65_DMAJOB_DST_3 destroyed.
// Set operation type
lda #($00 + $08) // operation: COPY + allow interrupts
sta M65_DMAGIC_LIST+6
// Adapt the addresses, launch the job
jsr m65_dmagic_adapt_src
jsr m65_dmagic_adapt_dst
// XXX prepare separate version for the opposite direction - change direction
// by setting bit 6 of M65_DMAJOB_*_2
// FALLTROUGH
m65_dmagic_launch:
// Launch the DMA list
lda #$00
sta DMA_ADDRBANK // $D702
sta DMA_ADDRMB // $D704
lda #>M65_DMAGIC_LIST
sta DMA_ADDRMSB // $D701
lda #<M65_DMAGIC_LIST
sta DMA_ETRIG // $D705
rts
m65_dmagic_adapt_src:
// We need to adapt the addresses:
// - M65_DMAJOB_SRC_2 - contain bits 16-23, should contain 16-19
// - M65_DMAJOB_SRC_3 - contain bits 24-27, should contain 20-27
lda M65_DMAJOB_SRC_2
pha
asl
rol M65_DMAJOB_SRC_3
asl
rol M65_DMAJOB_SRC_3
asl
rol M65_DMAJOB_SRC_3
asl
rol M65_DMAJOB_SRC_3
pla
and #%00001111
sta M65_DMAJOB_SRC_2
rts
m65_dmagic_adapt_dst:
// We need to adapt the addresses:
// - M65_DMAJOB_DST_2 - contain bits 16-23, should contain 16-19
// - M65_DMAJOB_DST_3 - contain bits 24-27, should contain 20-27
lda M65_DMAJOB_DST_2
pha
asl
rol M65_DMAJOB_DST_3
asl
rol M65_DMAJOB_DST_3
asl
rol M65_DMAJOB_DST_3
asl
rol M65_DMAJOB_DST_3
pla
and #%00001111
sta M65_DMAJOB_DST_2
rts
m65_dmagic_init:
// Set common job parameters
lda #$0A
sta M65_DMAGIC_LIST+0 // <- $0A = use F018A list format (it is shorter by 1 byte)
lda #$80
sta M65_DMAGIC_LIST+1 // <- $80 = next byte is highest 8 bits of source address
inc_a
sta M65_DMAGIC_LIST+3 // <- $81 = next byte is highest 8 bits of destination address
lda #$00
sta M65_DMAGIC_LIST+5 // <- end of options
sta M65_DMAGIC_LIST+15 // <- set modulo to 0
sta M65_DMAGIC_LIST+16
rts
+35 -2
View File
@@ -2,22 +2,55 @@
// #LAYOUT# * * #IGNORE
//
// Definitions for calling Mega65 segment KERNAL_0 routines from KERNAL_1
// Definitions for calling MEGA65 segment KERNAL_0 routines from KERNAL_1
//
#import "KERNAL_0_combined.sym"
.label CHROUT = KERNAL_0.proxy_K1_CHROUT
.label STOP = KERNAL_0.STOP
.label M65_SLOW = KERNAL_0.M65_SLOW
.label M65_FAST = KERNAL_0.M65_FAST
.label M65_MODEGET = KERNAL_0.M65_MODEGET
.label M65_SETWIN_XY = KERNAL_0.M65_SETWIN_XY
.label M65_SETWIN_WH = KERNAL_0.M65_SETWIN_WH
.label M65_SETWIN_N = KERNAL_0.M65_SETWIN_N
.label M65_SETWIN_Y = KERNAL_0.M65_SETWIN_Y
#if (CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO) || (CONFIG_IEC_JIFFYDOS && !CONFIG_MEMORY_MODEL_60K)
.label screen_on = KERNAL_0.screen_on
.label screen_off = KERNAL_0.screen_off
#endif
.label hw_entry_reset = KERNAL_0.hw_entry_reset
.label return_from_interrupt = KERNAL_0.return_from_interrupt
.label clrchn_reset = KERNAL_0.clrchn_reset
.label udtim_keyboard = KERNAL_0.udtim_keyboard
.label chrout_to_screen_code = KERNAL_0.chrout_to_screen_code
.label colour_codes = KERNAL_0.colour_codes
.label screen_check_toggle_quote = KERNAL_0.screen_check_toggle_quote
.label screen_code_to_petscii = KERNAL_0.screen_code_to_petscii
.label setup_irq_timer = KERNAL_0.setup_irq_timer
.label wait_x_bars = KERNAL_0.wait_x_bars
.label viciv_unhide = KERNAL_0.viciv_unhide
.label viciv_init = KERNAL_0.viciv_init
.label viciv_shutdown = KERNAL_0.viciv_shutdown
.label viciv_hotregs_on = KERNAL_0.viciv_hotregs_on
.label viciv_hotregs_off = KERNAL_0.viciv_hotregs_off
.label m65_clr_magictstr = KERNAL_0.m65_clr_magictstr
.label m65_scrtab_txtwidth = KERNAL_0.m65_scrtab_txtwidth
.label m65_scrtab_txtheight = KERNAL_0.m65_scrtab_txtheight
.label m65_screen_set_indx = KERNAL_0.m65_screen_set_indx
.label cursor_enable = KERNAL_0.cursor_enable
.label cursor_undraw_cont = KERNAL_0.cursor_undraw_cont
.label cursor_timer_reset = KERNAL_0.cursor_timer_reset
.label cursor_show_if_enabled = KERNAL_0.cursor_show_if_enabled
.label chrin_programmable_keys = KERNAL_0.proxy_K1_chrin_programmable_keys
.label pop_keyboard_buffer = KERNAL_0.pop_keyboard_buffer
#if CONFIG_IEC
@@ -28,7 +61,6 @@
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
.label mega65_unhide = KERNAL_0.mega65_unhide
.label tape_motor_on = KERNAL_0.tape_motor_on
.label tape_motor_off = KERNAL_0.tape_motor_off
@@ -37,6 +69,7 @@
.label lvs_return_last_address = KERNAL_0.proxy_K1_lvs_return_last_address
.label lvs_device_not_found_error = KERNAL_0.proxy_K1_lvs_device_not_found_error
.label lvs_load_verify_error = KERNAL_0.proxy_K1_lvs_load_verify_error
.label m65_load_autoswitch_tape = KERNAL_0.proxy_K1_m65_load_autoswitch_tape
.label lvs_check_EAL = KERNAL_0.lvs_check_EAL
.label lvs_STAL_to_MEMUSS = KERNAL_0.lvs_STAL_to_MEMUSS
@@ -0,0 +1,44 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Automatic switching to legacy C64 mode if loading anything below $0800
//
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
m65_load_autoswitch_tape:
lda VERCKK
bne m65_load_autoswitch_done // no autoswitch for VERIFY
lda STAL+1
#endif
m65_load_autoswitch:
lda VERCKK
bne m65_load_autoswitch_done // no autoswitch for VERIFY
lda EAL+1
// FALLTROUGH
m65_load_autoswitch_check:
cmp #$08
bcs m65_load_autoswitch_done // no autoswitch if loading above $07FF
jsr M65_MODEGET
bcs m65_load_autoswitch_done // no autoswitch if already in legacy mode
sec
jmp M65_MODESET
// XXX consider displaying something here
m65_load_autoswitch_done:
rts
+50 -5
View File
@@ -2,12 +2,14 @@
// #LAYOUT# * * #IGNORE
//
// ROM mapping routines for Mega65
// ROM mapping routines for MEGA65
//
// Available memory maps:
// - NORMAL - nothing mapped in
// - KERNAL_1 - for calling KERNAL_1 segment code
// - NORMAL - nothing mapped in
// - KERNAL_1 - for calling KERNAL_1 segment code
// - DOS_1 - for swiching to DOS context
// - NORMAL_from_DOS_1 - for switching bact from DOS context
map_NORMAL:
@@ -19,6 +21,11 @@ map_NORMAL:
phz
lda #$00
// FALLTROUGH
map_NORMAL_common:
tax
tay
taz
@@ -30,6 +37,10 @@ map_end:
map
eom
// FALLTROUGH
map_end_no_eom:
plz
ply
plx
@@ -51,6 +62,40 @@ map_KERNAL_1:
tay
taz
ldx #$42 // 0x4000 <- map 8KB from 0x20000
ldx #$42 // $4000 <- map 8KB from $20000
bne map_end
jmp_8 map_end
map_DOS_1:
php
pha
phx
phy
phz
lda #$80
tab // from now on, zeropage starts from $C000
ldy #$80
lda #$30
taz // $8000 <- map 16KB RAM from $10000
lda #$C0
ldx #$C1 // $4000 <- map 16KB ROM from $20000
map
jmp_8 map_end_no_eom // no EOM, we do not want interrupts within DOS!
map_NORMAL_from_DOS_1:
php
pha
phx
phy
phz
lda #$00
tab
jmp_8 map_NORMAL_common
@@ -0,0 +1,42 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
m65_native_meminit:
// Prepare generic DMAgic list
jsr m65_dmagic_init
// Copy MEGA65 charset to target location - set size
lda #$00
sta M65_DMAJOB_SIZE_0
lda #$10
sta M65_DMAJOB_SIZE_1
// Set destination
lda #$00
sta M65_DMAJOB_DST_3
lda #$01
sta M65_DMAJOB_DST_2
lda #>MEMCONF_CHRBASE
sta M65_DMAJOB_DST_1
lda #<MEMCONF_CHRBASE
sta M65_DMAJOB_DST_0
// Set source
lda #$00
sta M65_DMAJOB_SRC_3
lda #$02
sta M65_DMAJOB_SRC_2
lda #$D0
sta M65_DMAJOB_SRC_1
lda #$00
sta M65_DMAJOB_SRC_0
// Launch the DMA job
jmp m65_dmagic_oper_copy
+24 -9
View File
@@ -2,30 +2,41 @@
// #LAYOUT# * * #IGNORE
//
// Proxies for calling Mega65 segment KERNAL_0 routines from KERNAL_1
// Proxies for calling MEGA65 segment KERNAL_0 routines from KERNAL_1
//
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
proxy_K1_chrin_programmable_keys:
jsr map_NORMAL
jsr chrin_programmable_keys
jmp_8 !+
proxy_K1_CHROUT:
jsr map_NORMAL
jsr CHROUT
!:
jmp map_KERNAL_1
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
proxy_K1_kernalerror_ROUTINE_TERMINATED:
jsr map_NORMAL
jmp kernalerror_ROUTINE_TERMINATED
proxy_K1_lvs_display_loading_verifying:
jsr map_NORMAL
jsr lvs_display_loading_verifying
jmp map_KERNAL_1
jmp_8 !-
proxy_K1_lvs_display_done:
jsr map_NORMAL
jsr lvs_display_done
jmp map_KERNAL_1
jmp_8 !-
proxy_K1_lvs_return_last_address:
@@ -42,28 +53,32 @@ proxy_K1_lvs_load_verify_error:
jsr map_NORMAL
jmp lvs_load_verify_error
proxy_K1_m65_load_autoswitch_tape:
jsr map_NORMAL
jsr m65_load_autoswitch_tape
jmp_8 !-
proxy_K1_print_kernal_message:
jsr map_NORMAL
jsr print_kernal_message
jmp map_KERNAL_1
jmp_8 !-
proxy_K1_print_return:
jsr map_NORMAL
jsr print_return
jmp map_KERNAL_1
jmp_8 !-
#endif
#if CONFIG_TAPE_HEAD_ALIGN
proxy_K1_CLALL:
jsr map_NORMAL
jsr CLALL
jmp map_KERNAL_1
jmp_8 !-
#endif
@@ -0,0 +1,41 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// ROM routine call redirect for MEGA65 API routines
//
M65_MODESET:
jsr map_KERNAL_1
jsr_ind VK1__M65_MODESET
bra m65_api_end
M65_SCRMODEGET:
jsr map_KERNAL_1
jsr_ind VK1__M65_SCRMODEGET
bra m65_api_end
M65_SCRMODESET:
jsr map_KERNAL_1
jsr_ind VK1__M65_SCRMODESET
bra m65_api_end
M65_CLRSCR:
jsr map_KERNAL_1
jsr_ind VK1__M65_CLRSCR
bra m65_api_end
M65_CLRWIN:
jsr map_KERNAL_1
jsr_ind VK1__M65_CLRWIN
// FALLTROUGH
m65_api_end:
jmp map_NORMAL
@@ -0,0 +1,26 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// ROM routine call redirect for MEGA65 screen routines
//
m65_chrout_screen:
jsr map_KERNAL_1
jsr_ind VK1__m65_chrout_screen
jsr map_NORMAL
jmp chrout_done_success
m65_chrin_keyboard:
jsr map_KERNAL_1
jsr_ind VK1__m65_chrin_keyboard
jmp map_NORMAL
m65_screen_upd_txtrow_off:
jsr map_KERNAL_1
jsr_ind VK1__m65_screen_upd_txtrow_off
jmp map_NORMAL
+26
View File
@@ -0,0 +1,26 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
// MEGA65 specific part of the hardware
m65_reset_part:
jsr map_NORMAL // we want normal memory mapping
jsr viciv_shutdown // by default we do not want the VIC-IV
jsr M65_MODEGET
bcs !+
// Clear MEAGA65 native mode mark, it might cause confusion
m65_clr_magictstr: // entry point for mode switching routine
lda #$00
sta M65_MAGICSTR+0
sta M65_MAGICSTR+1
sta M65_MAGICSTR+2
// FALLTROUGH
!:
rts
-24
View File
@@ -1,24 +0,0 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Routine to unhide Mega65 extra registers
//
#if CONFIG_KEYBOARD_C65 || (CONFIG_MB_MEGA_65 && (CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO))
mega65_unhide:
lda #$A5
sta VIC_KEY
lda #$96
sta VIC_KEY
rts
#endif
+42
View File
@@ -0,0 +1,42 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Routine to initialize VIC-IV for entering MEGA65 native mode
//
viciv_init:
// Switch VIC to VIC-IV mode
jsr viciv_unhide
// Disable badlines and slow interrupt emulation
lda #$00
sta MISC_EMU
// Set misc VIC-IV flags
lda #%01000000 // enable C65 character set
sta VIC_CTRLA
// Disable hot registers
// FALLTROUGH
viciv_hotregs_off:
lda VIC_SRH
and #$7F
!:
sta VIC_SRH
rts
viciv_hotregs_on:
lda VIC_SRH
ora #$80
bra !-
@@ -0,0 +1,33 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Routine to shutdown VIC-IV for leaving MEGA65 native mode
//
viciv_shutdown:
// Switch VIC to VIC-IV mode, temporarily
jsr viciv_unhide
// Reenable badlines and slow interrupt emulation
lda #$03
sta MISC_EMU
// Set misc VIC-IV flags
lda #%00000000
sta VIC_CTRLA // enable C64 character set
sta VIC_CTRLB // disable extended resolution and attributes
// Reenable hot registers
jsr viciv_hotregs_on
// Hide VIC-IV registers and quit
sta VIC_KEY
rts
@@ -0,0 +1,16 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Routine to unhide MEGA65 extra registers
//
viciv_unhide:
lda #$47
sta VIC_KEY
lda #$53
sta VIC_KEY
rts
+1 -1
View File
@@ -10,7 +10,7 @@ scnkey_set_keytab:
clear_screen:
STUB_IMPLEMENTATION()
setup_vicii:
vicii_init:
STUB_IMPLEMENTATION()
cursor_blink:
+44
View File
@@ -0,0 +1,44 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Not this is not an official Kernal API extension (yet)! It is subject to change!
//
// XXX consider turning this into vector table, the only jumptable extension
// would copy the vector table to given memory location
M65_JMODEGET:
jsr M65_MODEGET
M65_JISMODESET:
jsr M65_MODESET
M65_JSLOW:
jsr M65_SLOW
M65_JFAST:
jsr M65_FAST
M65_JSELDEV:
jsr SELDEV
M65_JCLRSCR:
jsr M65_CLRSCR
M65_JCLRWIN: // XXX consider combining with M65_JCLRSCR
jsr M65_CLRWIN
M65_JSETWIN_XY:
jsr M65_SETWIN_XY
M65_JSETWIN_WH: // XXX combine this with M65_JSETWIN_N, M65_JSETWIN_Y, and possibly M65_JSETWIN_XY
jsr M65_SETWIN_WH
M65_JSETWIN_N:
jsr M65_SETWIN_N
M65_JSETWIN_Y:
jsr M65_SETWIN_Y
// XXX add M65_HOME
+31
View File
@@ -0,0 +1,31 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
M65_MODEGET:
// Checks if mode is native M65 one; Carry clear = native mode, Carry set = legacy mode
pha
lda M65_MAGICSTR+0
cmp #$4D // 'M'
bne !+
lda M65_MAGICSTR+1
cmp #$36 // '6'
bne !+
lda M65_MAGICSTR+2
cmp #$35 // '5'
bne !+
// M65 native mode
clc
pla
rts
!:
// C64 compatibility mode
sec
pla
rts
+72
View File
@@ -0,0 +1,72 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
M65_MODESET:
// Carry clear = set native mode; Carry set = set legacy mode
bcc m65_mode65
// FALLTROUGH
m65_mode64:
// Disable interrupts, they might interfere
sei
// Set the magic string to mark legacy mode
jsr m65_clr_magictstr
// Restore VIC-II configuration
jsr viciv_shutdown
jsr vicii_init
// Reenable interrupts
cli
// Switch CPU speed back to slow and quit
jmp M65_SLOW
m65_mode65:
// Disable interrupts, they might interfere
sei
// Switch CPU speed to fast
jsr M65_FAST
// Set the magic string to mark native mode
lda #$4D // 'M'
sta M65_MAGICSTR+0
lda #$36 // '6'
sta M65_MAGICSTR+1
lda #$35 // '5'
sta M65_MAGICSTR+2
// Initialize VIC-IV
jsr vicii_init
jsr viciv_init
// Initialize various memory structures
jsr m65_native_meminit
// Set screen mode to 80x50
lda #$02
jsr m65_scrmodeset_internal
// Clear the screen
jmp M65_CLRSCR
+16
View File
@@ -0,0 +1,16 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
M65_SLOW: // set CPU speed to 1 MHz
lda #$40
skip_2_bytes_trash_nvz
// FALLTROUGH
M65_FAST: // set CPU speed to 40 MHz
lda #$41
sta CPU_D6510
rts
+5
View File
@@ -22,6 +22,11 @@ ACPTR:
rts
!:
#if ROM_LAYOUT_M65
jsr m65dos_check
bcc_16 m65dos_acptr // branch if device is handeld by internal DOS
#endif
#if CONFIG_IEC
#if CONFIG_IEC_JIFFYDOS
jmp iec_rx_dispatch
+1 -1
View File
@@ -20,7 +20,7 @@ chkin_iec:
// Send TALK + TKSA first
lda FAT,Y
jsr TALK
bcs_16 chkinout_device_not_present
+5
View File
@@ -35,6 +35,11 @@ ciout_store_in_buffer:
ciout_send_byte:
#if ROM_LAYOUT_M65
jsr m65dos_check
bcc_16 m65dos_ciout // branch if device is handeld by internal DOS
#endif
clc // send without EOI
#if CONFIG_IEC_JIFFYDOS
jsr iec_tx_dispatch
+7
View File
@@ -20,6 +20,13 @@ iec_cmd_close:
!:
ora #$E0
#if ROM_LAYOUT_M65
jsr m65dos_check
bcc_16 m65dos_second // branch if device is handeld by internal DOS
#endif
jmp common_open_close_unlsn_second
+7
View File
@@ -20,6 +20,13 @@ iec_cmd_open: // similar to TKSA, but without turnaround
!:
ora #$F0
#if ROM_LAYOUT_M65
jsr m65dos_check
bcc_16 m65dos_second // branch if device is handeld by internal DOS
#endif
#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_MEGA_65
pha
jsr burst_advertise
+1 -1
View File
@@ -20,7 +20,7 @@ iec_pull_atn_clk_release_data:
lda CIA2_PRA
ora #BIT_CIA2_PRA_ATN_OUT // pull
sta CIA2_PRA
// FALLTROUGH
iec_pull_clk_release_data:
+2 -2
View File
@@ -17,7 +17,7 @@
iec_rx_dispatch:
lda IECPROTO
cmp #$01
cmp #IEC_JIFFY
beq_16 jiffydos_rx_byte
// FALLTROUGH
@@ -54,7 +54,7 @@ iec_rx_byte:
// Check if DolphinDOS was detected
lda IECPROTO
cmp #$02
cmp #IEC_DOLPHIN
bne iec_rx_no_dolphindos
// For DolphinDOS just fetch the byte from parallel port
+2 -2
View File
@@ -19,7 +19,7 @@ iec_tx_dispatch:
php // preserve C flag for EOI indication
lda IECPROTO
cmp #$01
cmp #IEC_JIFFY
bne !+
plp
@@ -71,7 +71,7 @@ iec_tx_common:
// Check if DolphinDOS was detected
lda IECPROTO
cmp #$02
cmp #IEC_DOLPHIN
bne iec_tx_no_dolphindos
// For DolphinDOS just push the byte to parallel port (set it to output first)
+12 -1
View File
@@ -16,11 +16,22 @@
LISTEN:
#if CONFIG_IEC
#if CONFIG_IEC || ROM_LAYOUT_M65
// According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
jsr iec_tx_flush
#endif
#if ROM_LAYOUT_M65
jsr m65dos_detect
bcc_16 m65dos_listen // branch if device is handeld by internal DOS
#endif
#if CONFIG_IEC
// Check whether device number is correct
jsr iec_check_devnum_oc
bcc !+
+11 -2
View File
@@ -95,7 +95,16 @@ load_iec:
lda STAL+1
sta EAL+1
!:
#if ROM_LAYOUT_M65
// Switch to legacy mode if needed
jsr m65_load_autoswitch
#endif
// Display start address
jsr lvs_display_loading_verifying
#if (CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS) && !CONFIG_MEMORY_MODEL_60K
@@ -107,12 +116,12 @@ load_iec:
lda IECPROTO
#if CONFIG_IEC_JIFFYDOS
cmp #$01
cmp #IEC_JIFFY
beq_16 jiffydos_load // branch if JiffyDOS
#endif
#if CONFIG_IEC_DOLPHINDOS
cmp #$02
cmp #IEC_DOLPHIN
beq_16 dolphindos_load // branch if DolphinDOS
#endif
+10 -2
View File
@@ -13,8 +13,18 @@
//
// XXX cleanup: iec_cmd_open and iec_cmd_close should just do ORA and jump directly here
SECOND:
#if ROM_LAYOUT_M65
jsr m65dos_check
bcc_16 m65dos_second // branch if device is handeld by internal DOS
#endif
#if CONFIG_IEC
// Due to OPEN/CLOSE/TKSA/SECOND command encoding, allowed channels are 0-15; it is the caller
@@ -22,8 +32,6 @@ SECOND:
// - https://www.lemon64.com/forum/viewtopic.php?t=57694&sid=531ba3592bcffadef2ac8b9162f2e529
// - https://www.pagetable.com/?p=1031 (Kernal API description)
// XXX consider checking whether value is in range (contrary to original ROM implementation)
jmp common_open_close_unlsn_second
#else
Loaded 100 of 180 files, more files were not shown because too many files have changed in this diff. Show more