forked from X16Community/x16-rom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[X16EDIT] initial commit, in-rom build
- Loading branch information
1 parent
ea02bbf
commit fc17315
Showing
42 changed files
with
14,140 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
BUILD_DIR=build | ||
CONF_DIR=conf | ||
|
||
SRC_FILES=$(wildcard *.asm) $(wildcard *.inc) | ||
|
||
# Commands | ||
ram: $(BUILD_DIR)/X16EDIT.PRG | ||
rom: $(BUILD_DIR)/x16edit-rom.bin | ||
all: $(BUILD_DIR)/X16EDIT.PRG $(BUILD_DIR)/x16edit-rom.bin | ||
|
||
# Target that compresses default help file | ||
$(BUILD_DIR)/help.bin: help.txt | ||
@mkdir -p $(BUILD_DIR) | ||
lzsa -r -f2 $? $@ | ||
|
||
# Target that compresses condensed help file for low res screens | ||
$(BUILD_DIR)/help_short.bin: help_short.txt | ||
@mkdir -p $(BUILD_DIR) | ||
lzsa -r -f2 $? $@ | ||
|
||
# Target for RAM program | ||
$(BUILD_DIR)/X16EDIT.PRG: $(BUILD_DIR)/help.bin $(BUILD_DIR)/help_short.bin $(SRC_FILES) | ||
@mkdir -p $(BUILD_DIR) | ||
cl65 --asm-args -Dtarget_mem=1 -o $@ -u __EXEHDR__ -t cx16 -C $(CONF_DIR)/cx16-asm.cfg --mapfile $(BUILD_DIR)/x16edit-ram.map -Ln $(BUILD_DIR)/x16edit-ram.sym main.asm | ||
|
||
# Target for ROM program | ||
$(BUILD_DIR)/x16edit-rom.bin: $(BUILD_DIR)/help.bin $(BUILD_DIR)/help_short.bin $(SRC_FILES) | ||
@mkdir -p $(BUILD_DIR) | ||
cl65 --asm-args -Dtarget_mem=2 -o $@ -t cx16 -C $(CONF_DIR)/x16edit-rom.cfg --mapfile $(BUILD_DIR)/x16edit-rom.map main.asm | ||
|
||
# Clean-up target | ||
clean: | ||
rm -f $(BUILD_DIR)/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# X16 Edit | ||
|
||
X16 Edit is a simple text editor for the Commander X16 platform inspired by GNU Nano. | ||
|
||
The program's primary design goal is to handle large text files with good performance. | ||
The text buffer is stored in banked RAM (512 KB, expandable to 2 MB). | ||
|
||
# Building | ||
|
||
The program is written in 65c02 assembly for the ca65 compiler. To build the project | ||
you also need the lzsa compression and Makefile utilities. | ||
|
||
Currently, there are three build targets. | ||
|
||
* **make** or **make ram** builds the standard version that is loaded into RAM and | ||
started in the same way as a BASIC program. | ||
|
||
* **make hiram** builds a version of the program that is to be loaded into RAM address | ||
$6000. | ||
|
||
* **make rom** builds an image to be stored in the X16 ROM (32 kB). | ||
|
||
|
||
# Required Kernal/Emulator version | ||
|
||
The current version of the editor requires Kernal/Emulator version R43 or later. | ||
|
||
|
||
# Running the RAM version | ||
|
||
Run the RAM version with the following command: | ||
|
||
x16emu -prg X16EDIT.PRG -run | ||
|
||
|
||
# Running the HI RAM version | ||
|
||
The HI RAM version can be loaded and started with the following commands: | ||
|
||
In host computer terminal: x16emu -prg X16EDIT.PRG,6000 | ||
On the X16: SYS $6000 | ||
|
||
# Running the ROM version | ||
|
||
There are a few more steps to set up and try the ROM version. | ||
|
||
Please see the supplemented manual for details. | ||
|
||
|
||
# Further reading | ||
|
||
Refer to the X16 Edit Manual for further help using the program. | ||
|
||
|
||
# X16 Community | ||
|
||
You may read more about the Commander X16 Platform on the website | ||
|
||
https://www.commanderx16.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.define appversion_major 0 | ||
.define appversion_minor 7 | ||
.define appversion_patch 1 | ||
|
||
.if target_mem=target_rom | ||
.segment "APPSIG" | ||
.byt "x16edit", appversion_major, appversion_minor, appversion_patch | ||
.CODE | ||
.endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
;******************************************************************************* | ||
;Copyright 2022-2023, Stefan Jakobsson | ||
; | ||
;Redistribution and use in source and binary forms, with or without modification, | ||
;are permitted provided that the following conditions are met: | ||
; | ||
;1. Redistributions of source code must retain the above copyright notice, this | ||
; list of conditions and the following disclaimer. | ||
; | ||
;2. Redistributions in binary form must reproduce the above copyright notice, | ||
; this list of conditions and the following disclaimer in the documentation | ||
; and/or other materials provided with the distribution. | ||
; | ||
;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” | ||
;AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
;IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
;DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
;FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
;DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
;SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
;CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
;OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
;OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
;******************************************************************************* | ||
|
||
;****************************************************************************** | ||
;Function name.......: bridge_copy | ||
;Purpose.............: Copies bridge code to RAM, necessary to make the program | ||
; run in ROM | ||
;Input...............: Nothing | ||
;Returns.............: Nothing | ||
;Error returns.......: None | ||
.proc bridge_copy | ||
ldx #bridge_end-bridge_kernal | ||
: lda bridge_kernal-1,x | ||
sta bridge_code-1,x | ||
dex | ||
bne :- | ||
rts | ||
.endproc | ||
|
||
;****************************************************************************** | ||
;Function name.......: bridge_kernal | ||
;Purpose.............: Bridge code to be copied to RAM on program startup. | ||
; Necessary to make the program run in ROM | ||
;Input...............: Use macro BRIDGE_SETADDR to set the Kernal address | ||
; to call before using this function | ||
;Returns.............: Nothing | ||
;Error returns.......: None | ||
|
||
;Bridge for Kernal function calls | ||
bridge_kernal: | ||
stz ROM_SEL ;Kernal is ROM bank 0 | ||
jsr $ffff ;$ffff is just placeholder | ||
pha | ||
lda rom_bank ;Set ROM select to our bank again | ||
sta ROM_SEL | ||
pla | ||
rts ;Size: 13 bytes | ||
|
||
|
||
;Bridge for calling functions in another ROM bank | ||
bridge_jsrfar: | ||
sta tempvars | ||
lda rom_bank | ||
pha | ||
lda #$ff | ||
sta rom_bank | ||
sta ROM_SEL | ||
lda tempvars | ||
jsr $ffff | ||
pla | ||
sta rom_bank | ||
sta ROM_SEL | ||
rts ;Size: 27 bytes | ||
|
||
;Bridge for interrupt handling, called by the Kernal | ||
;on interrupt, switches to X16 Edit's ROM bank and then | ||
;calls the custom interrupt handler stored in ROM | ||
bridge_irq: | ||
lda ROM_SEL | ||
pha | ||
lda rom_bank | ||
sta ROM_SEL | ||
jsr irq_handler | ||
pla | ||
sta ROM_SEL | ||
jmp (irq_default_handler) ;Size: 17 bytes | ||
|
||
;Bridge for custom keyboard scan code handler | ||
bridge_scancode: | ||
php | ||
pha | ||
|
||
lda ROM_SEL | ||
sta bridge_temp | ||
lda rom_bank | ||
sta ROM_SEL | ||
pla | ||
plp | ||
jsr scancode_handler | ||
php | ||
pha | ||
|
||
lda bridge_temp | ||
sta ROM_SEL | ||
|
||
pla | ||
plp | ||
rts ;Size: 27 bytes | ||
|
||
bridge_end: ;Total size: 84 bytes | ||
|
||
.segment "VARS" | ||
bridge_temp: .res 1 | ||
.CODE | ||
|
||
.segment "IRQ" | ||
.byt $ff, $ff, $ff, $ff, $8b, $03 | ||
.CODE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
;******************************************************************************* | ||
;Copyright 2022-2023, Stefan Jakobsson | ||
; | ||
;Redistribution and use in source and binary forms, with or without modification, | ||
;are permitted provided that the following conditions are met: | ||
; | ||
;1. Redistributions of source code must retain the above copyright notice, this | ||
; list of conditions and the following disclaimer. | ||
; | ||
;2. Redistributions in binary form must reproduce the above copyright notice, | ||
; this list of conditions and the following disclaimer in the documentation | ||
; and/or other materials provided with the distribution. | ||
; | ||
;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” | ||
;AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
;IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
;DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
;FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
;DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
;SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
;CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
;OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
;OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
;******************************************************************************* | ||
|
||
bridge_call = bridge_code | ||
bridge_addr = bridge_call+3 | ||
|
||
.if target_mem=target_rom | ||
bridge_jsrfar_call = bridge_code+bridge_jsrfar-bridge_kernal | ||
bridge_jsrfar_bank = bridge_jsrfar_call+8 | ||
bridge_jsrfar_addr = bridge_jsrfar_call+18 | ||
.endif | ||
|
||
.if target_mem=target_rom | ||
.macro bridge_setaddr addr | ||
lda #<addr | ||
sta bridge_addr | ||
lda #>addr | ||
sta bridge_addr+1 | ||
.endmacro | ||
|
||
.macro bridge_jsrfar_setaddr addr | ||
sta bridge_jsrfar_bank | ||
lda #<addr | ||
sta bridge_jsrfar_addr | ||
lda #>addr | ||
sta bridge_jsrfar_addr+1 | ||
.endmacro | ||
.else | ||
.macro bridge_setaddr addr | ||
;Do nothing | ||
.endmacro | ||
|
||
.macro bridge_jsrfar_setaddr addr | ||
;Do nothing | ||
.endmacro | ||
.endif | ||
|
||
.if target_mem=target_ram | ||
.macro bridge_call addr | ||
jsr addr | ||
.endmacro | ||
|
||
.macro bridge_jsrfar_call addr | ||
jsr addr | ||
.endmacro | ||
|
||
.else | ||
.macro bridge_call addr | ||
jsr bridge_call | ||
.endmacro | ||
|
||
.macro bridge_jsrfar_call addr | ||
jsr bridge_jsrfar_call | ||
.endmacro | ||
.endif |
Oops, something went wrong.