Skip to content

Commit

Permalink
[BASLOAD/X16EDIT] update BASLOAD and X16EDIT to upstream versions (X1…
Browse files Browse the repository at this point in the history
  • Loading branch information
mooinglemur authored Sep 5, 2024
1 parent 2f5e9c6 commit 8b91b45
Show file tree
Hide file tree
Showing 21 changed files with 586 additions and 231 deletions.
2 changes: 1 addition & 1 deletion basload/.git-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d325c2f72a42179a73cbc0fdc5d78cea98e40bf0
dde8cba3fc0702149467ffbf332a2a8e51677bc3
3 changes: 2 additions & 1 deletion basload/common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ KERNAL_ARYTAB = $03E3
KERNAL_STREND = $03E5
KERNAL_LINNUM = $d4
KERNAL_FETVEC = $ff74
KERNAL_SAVE = $ffd8

BASIC_CHRGET = $00e7
BASIC_IGONE = $0308
Expand All @@ -64,4 +65,4 @@ KERNAL_R3 = $08
.segment "VARS"
bridge_code: .res 42
rom_bank: .res 1
.CODE
.CODE
9 changes: 9 additions & 0 deletions basload/line.inc
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ symbol:
bne :+
jmp next

; Underscore chars are allowed in a symbol name, continue if found
: cmp #95
bne :+
jmp next

; A symbol ended by a colon is a possible label declaration - needs further checking
: cmp #':'
beq symbol_chk
Expand Down Expand Up @@ -674,6 +679,10 @@ symbol:
: cmp #'.'
beq symbol_cont

; Underscores are allowed in a symbol name, continue if found
cmp #95
beq symbol_cont

; Decimal numbers are allowed in symbol names, continue if found
cmp #'0'
bcc symbol_check1
Expand Down
54 changes: 52 additions & 2 deletions basload/loader.inc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,57 @@ exit:
jsr symfile_close
jsr file_init
bridge_setaddr KERNAL_CLRCHN
bridge_call
rts
bridge_call

saveas:
lda #BASLOAD_RAM1
sta RAM_SEL
lda saveas_len
beq :+

bridge_setaddr KERNAL_SETNAM
ldx #<saveas_name
ldy #>saveas_name
lda saveas_len
bridge_call

bridge_setaddr KERNAL_SETLFS
lda #1
ldx #8
ldy #1
bridge_call

bridge_setaddr KERNAL_SAVE
lda #$01
sta TEMP1
lda #$08
sta TEMP1+1
lda #TEMP1
ldx line_code
ldy line_code+1
bridge_call

jsr file_status
cmp #0
beq :+

bridge_setaddr KERNAL_CHROUT
lda #13
bridge_call
lda #<file_buf
sta TEMP1
lda #>file_buf
sta TEMP1+1
ldy #0
loop:
lda (TEMP1),y
cmp #0
beq :+
bridge_call
iny
bne loop

: rts

.endproc
7 changes: 6 additions & 1 deletion basload/main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ jmp main_entry
; Copy RAM code
jsr bridge_copy

; Clear saveas filename
lda #BASLOAD_RAM1
sta RAM_SEL
stz saveas_len

; Select RAM bank 0
stz RAM_SEL

Expand Down Expand Up @@ -189,4 +194,4 @@ exit:
.include "response.inc"
.include "pearson.inc"
.include "controlcode.inc"
.include "symfile.inc"
.include "symfile.inc"
54 changes: 50 additions & 4 deletions basload/option.inc
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ get_option:
bne :+
jmp controlcodes
: cmp #6
bne unknown
bne :+
jmp symfile
: cmp #7
bne unknown
jmp saveas

unknown:
lda #0
Expand Down Expand Up @@ -172,8 +175,9 @@ autonum:
controlcodes:
ldx index1
jsr option_get_int
bcs invalid
stx tmp
bcc :+
jmp invalid
: stx tmp
ora tmp
tya
ora tmp
Expand Down Expand Up @@ -227,6 +231,41 @@ symfile_err2:
lda #$fd
rts

saveas:
ldx index1
jsr option_get_string
sta saveas_len
cmp #0
bne :+

lda #RESPONSE_NO_FILENAME
clc
jsr response_set
lda #$fe
rts

: stx TEMP1
sty TEMP1+1
tay
dey

ldx RAM_SEL
phx
ldx #BASLOAD_RAM1
stx RAM_SEL

: lda (TEMP1),y
sta saveas_name,y
dey
cpy #$ff
bne :-

pla
sta RAM_SEL
rts

invalid:
lda #$fe
rts
Expand Down Expand Up @@ -314,6 +353,7 @@ options_tbl:
.byt "autonum", 0
.byt "controlcodes", 0
.byt "symfile", 0
.byt "saveas", 0
.byt 0

.segment "VARS"
Expand Down Expand Up @@ -456,5 +496,11 @@ eos:
index1: .res 1
quotes: .res 1
len: .res 1
.endproc

.segment "VARS"
saveas_len: .res 1

.segment "RAM1"
saveas_name: .res 256
.CODE
.endproc
2 changes: 2 additions & 0 deletions basload/response.inc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ RESPONSE_INVALID_PARAM = 11
RESPONSE_INVALID_CONTROLCODE = 12
RESPONSE_INVALID_SYMFILE = 13
RESPONSE_SYMFILE_IO_ERR = 14
RESPONSE_NO_FILENAME = 15

; Response messages
msg_ok: .byt "success", 0
Expand All @@ -58,6 +59,7 @@ msg_invalid_param: .byt "invalid parameter in ", 0
msg_invalid_controlcode: .byt "invalid control code in ",0
msg_invalid_symfile: .byt "symfile not allowed in ", 0
msg_symfile_io_err: .byt "couldn not open symfile in ", 0
msg_no_filename: .byt "filename not specified ", 0

; Response message pointers
msg_pointers:
Expand Down
8 changes: 4 additions & 4 deletions basload/symfile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ err:

msg:
.byt .sprintf("basload %u.%u.%u symbol file", appversion_major, appversion_minor, appversion_patch)
.byt 10, 10, 10, 10, "labels", 10, "------", 10, 0
.byt 10, 10, 10, 10, "labels", 10, "------", 0
.endproc

;******************************************************************************
Expand Down Expand Up @@ -197,7 +197,7 @@ err:
rts

msg:
.byt 10,10,10,10, "variables", 10, "---------", 10, 0
.byt 10,10,10,10, "variables", 10, "---------", 0
.endproc

;******************************************************************************
Expand Down Expand Up @@ -432,7 +432,7 @@ err:
rts

file_lbl:
.byt "file: ",0
.byt 10,10,"file: ",0
.endproc

;******************************************************************************
Expand Down Expand Up @@ -533,4 +533,4 @@ line_start:
symbol_start: .res 1
symbol_end: .res 1
.CODE
.endproc
.endproc
2 changes: 1 addition & 1 deletion x16-edit/.git-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d77d0002f62cd468c885449f45781222889ded56
f954dc8413222c7fb61ef2a30a77be3b31d07eaa
22 changes: 22 additions & 0 deletions x16-edit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,50 @@ SRC_FILES=$(wildcard *.asm) $(wildcard *.inc)
# Commands
ram: $(BUILD_DIR)/X16EDIT.PRG
rom: $(BUILD_DIR)/x16edit-rom.bin
ram_alt: $(BUILD_DIR)/X16EDIT-ALT.PRG
rom_alt: $(BUILD_DIR)/x16edit-alt-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 default help file
$(BUILD_DIR)/help_alt.bin: help_alt.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 that compresses condensed help file for low res screens (alternative shortcuts)
$(BUILD_DIR)/help_alt_short.bin: help_alt_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 -g -o $@ -u __EXEHDR__ -t cx16 -C $(CONF_DIR)/cx16-asm.cfg --mapfile $(BUILD_DIR)/x16edit-ram.map -Ln $(BUILD_DIR)/x16edit-ram.sym -l $(BUILD_DIR)/x16edit-ram.lst main.asm

# Target for RAM program (alternative shortcuts)
$(BUILD_DIR)/X16EDIT-ALT.PRG: $(BUILD_DIR)/help_alt.bin $(BUILD_DIR)/help_alt_short.bin $(SRC_FILES)
@mkdir -p $(BUILD_DIR)
cl65 --asm-args -Dtarget_mem=1 --asm-args -Dalt_shortcuts=1 -g -o $@ -u __EXEHDR__ -t cx16 -C $(CONF_DIR)/cx16-asm.cfg --mapfile $(BUILD_DIR)/x16edit-ram.map -Ln $(BUILD_DIR)/x16edit-ram.sym -l $(BUILD_DIR)/x16edit-ram.lst 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 -g -o $@ -t cx16 -C $(CONF_DIR)/x16edit-rom.cfg --mapfile $(BUILD_DIR)/x16edit-rom.map -Ln $(BUILD_DIR)/x16edit-rom.sym -l $(BUILD_DIR)/x16edit-rom.lst main.asm

# Target for ROM program (alternative shortcuts)
$(BUILD_DIR)/x16edit-alt-rom.bin: $(BUILD_DIR)/help_alt.bin $(BUILD_DIR)/help_alt_short.bin $(SRC_FILES)
@mkdir -p $(BUILD_DIR)
cl65 --asm-args -Dtarget_mem=2 --asm-args -Dalt_shortcuts=1 -g -o $@ -t cx16 -C $(CONF_DIR)/x16edit-rom.cfg --mapfile $(BUILD_DIR)/x16edit-rom.map -Ln $(BUILD_DIR)/x16edit-rom.sym -l $(BUILD_DIR)/x16edit-rom.lst main.asm

# Clean-up target
clean:
rm -f $(BUILD_DIR)/*
4 changes: 2 additions & 2 deletions x16-edit/appversion.inc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.define appversion_major 0
.define appversion_minor 8
.define appversion_patch 2
.define appversion_patch 3

.if target_mem=target_rom
.segment "APPSIG"
.byt "x16edit", appversion_major, appversion_minor, appversion_patch
.CODE
.endif
.endif
7 changes: 4 additions & 3 deletions x16-edit/clipboard.inc
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ full:
jsr clipboard_copy
bcs mem_full

lda clipboard_count
lda clipboard_count+1
stz selection_active
stx clipboard_count
sty clipboard_count+1

: lda clipboard_count
ora clipboard_count+1
Expand Down Expand Up @@ -275,4 +276,4 @@ exit:
.CODE

CLIPBOARD_SIZE = 12 ;In pages each of 256 bytes
CLIPBOARD_UNCUT = %00000001
CLIPBOARD_UNCUT = %00000001
Loading

0 comments on commit 8b91b45

Please sign in to comment.