Merge pull request #60 from FeralChild64/master

MEGA65 DevKit updates
This commit is contained in:
FeralChild64 authored and GitHub committed 2020-11-28 17:22:48 +01:00
commit e7c6212ec7
11 files changed
+197 -34

No files matched your search

+24 -8
View File
@@ -169,8 +169,8 @@ TARGET_U64CRT_K = build/kernal_ultimate64_crt.rom
TARGET_GENCRT_X = build/extrom_generic_crt.crt
TARGET_U64CRT_X = build/extrom_ultimate64_crt.crt
TARGET_M65_x_ORF = build/mega65.rom
TARGET_M65_x_PXL = build/mega65_pxlfont.rom
TARGET_M65_x_ORF = build/mega65_orfont.rom
TARGET_M65_x_PXL = build/mega65.rom
TARGET_X16_x = build/cx16-dummy.rom
TARGET_LIST_CUS = $(TARGET_CUS_B) $(TARGET_CUS_K)
@@ -505,7 +505,7 @@ $(DIR_M65)/OUTK_0.BIN $(DIR_M65)/KERNAL_0_combined.vs $(DIR_M65)/KERNAL_0_combin
$(DIR_M65)/basic.seg_1 $(DIR_M65)/BASIC_1_combined.vs $(DIR_M65)/BASIC_1_combined.sym:
@mkdir -p $(DIR_M65)
@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)
@$(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 6fff $(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)
@@ -679,11 +679,25 @@ $(TARGET_U64CRT_X): $(SEG_LIST_U64CRT) $(CRT_BIN_LIST) build/padding_8_KB
# Rules - MEGA65 platform specific
# $0:$0000 - 16 KB - DOS
# $0:$4000 - 8 KB - KERNAL segment 1
# $0:$6000 - 12 KB - BASIC segment 1
# $0:$9000 - 4 KB - native mode chargen
# $0:$A000 - 8 KB - BASIC segment 0
# $0:$C000 - 4 KB - unused for now, padding
# $0:$D000 - 4 KB - legacy mode chargen
# $0:$E000 - 9 KB - KERNAL segment 0
# $1:$0000 - 64 KB - unused for now, padding
build/padding_64_KB:
@mkdir -p build
@dd if=/dev/zero bs=8192 count=8 of=$@ status=none
$(TARGET_M65_x_ORF) $(TARGET_M65_x_PXL): $(SEG_LIST_M65) build/padding_64_KB $(TARGET_CHR_ORF) build/chargen_openroms.patched $(TARGET_CHR_PXL) build/chargen_pxlfont.patched
build/padding_4_KB:
@mkdir -p build
@dd if=/dev/zero bs=4096 count=1 of=$@ status=none
$(TARGET_M65_x_ORF) $(TARGET_M65_x_PXL): $(SEG_LIST_M65) build/padding_64_KB build/padding_4_KB $(TARGET_CHR_ORF) build/chargen_openroms.patched $(TARGET_CHR_PXL) build/chargen_pxlfont.patched
@echo
@echo
@echo
@@ -693,9 +707,10 @@ $(TARGET_M65_x_ORF) $(TARGET_M65_x_PXL): $(SEG_LIST_M65) build/padding_64_KB $(T
@cat $(DIR_M65)/dos.seg_1 > $(TARGET_M65_x_ORF)
@cat $(DIR_M65)/kernal.seg_1 >> $(TARGET_M65_x_ORF)
@cat $(DIR_M65)/basic.seg_1 >> $(TARGET_M65_x_ORF)
@cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x_ORF)
@cat $(TARGET_CHR_ORF) >> $(TARGET_M65_x_ORF)
@cat build/chargen_openroms.patched >> $(TARGET_M65_x_ORF)
@cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x_ORF)
@cat build/padding_4_KB >> $(TARGET_M65_x_ORF)
@cat $(TARGET_CHR_ORF) >> $(TARGET_M65_x_ORF)
@cat $(DIR_M65)/kernal.seg_0 >> $(TARGET_M65_x_ORF)
@cat build/padding_64_KB >> $(TARGET_M65_x_ORF)
@echo
@@ -707,9 +722,10 @@ $(TARGET_M65_x_ORF) $(TARGET_M65_x_PXL): $(SEG_LIST_M65) build/padding_64_KB $(T
@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)
@cat $(TARGET_CHR_PXL) >> $(TARGET_M65_x_PXL)
@cat build/chargen_pxlfont.patched >> $(TARGET_M65_x_PXL)
@cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x_PXL)
@cat build/padding_4_KB >> $(TARGET_M65_x_PXL)
@cat $(TARGET_CHR_PXL) >> $(TARGET_M65_x_PXL)
@cat $(DIR_M65)/kernal.seg_0 >> $(TARGET_M65_x_PXL)
@cat build/padding_64_KB >> $(TARGET_M65_x_PXL)
@echo
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -101,7 +101,7 @@ Currently there are 4 ROM layouts defined:
- `STD` - with 2 code segments: `BASIC` (`$A000-$E4D2`, where `$C000-$DFFF` is a skip-gap for RAM and I/O area) and `KERNAL` (`$E4D3 - $FFFF`)
- `CRT` - where `BASIC` becames `BASIC_0` and `KERNAL` becames `KERNAL_0`, with additional `BASIC`/`KERNAL` segments are placed on the required cartridge image
- `M65` - where `BASIC` becames `BASIC_0` and `KERNAL` becames `KERNAL_0`, additional segments might be added to the build system in the future; at the moment of writing this document additional 16KB of ROM is defined as `BASIC_1` segment and additional 8KB of ROM is defined as `KERNAL_1` segment
- `M65` - where `BASIC` becames `BASIC_0` and `KERNAL` becames `KERNAL_0`, additional segments might be added to the build system in the future; at the moment of writing this document additional 12KB of ROM is defined as `BASIC_1` segment and additional 8KB of ROM is defined as `KERNAL_1` segment
- `X16` - memory layout for the Commander X16 machine
Expect at least one more, `U64`, if the planned additional ROM banks support for Ultimate 64 gets implemented. To check for current ROM layout or code segment use KickAssembler preprocessor defines, like `ROM_LAYOUT_STD`, `SEGMENT_M65_BASIC_0`, `SEGMENT_X16_KERNAL_1`.
+5
View File
@@ -110,3 +110,8 @@
; --- Other
;; #CONFIG# COMPRESSION_LVL_2 NO
; --- Temporary hotfixes
;; #CONFIG# HOTFIX_CHARPTR YES ; workaround for https://github.com/MEGA65/mega65-core/issues/308
+2 -2
View File
@@ -31,8 +31,8 @@
!addr CARD_TMP_STEP = $12 ; 4 bytes
!addr CARD_TMP_RETRIES = $16 ; 1 byte
!addr CARD_BUFPNT = $FC ; 4 bytes - pointer to hardware sector buffer XXX replace copy routines with DMAgic
!addr CARD_BUFPNT1 = $17 ; 4 bytes - pointer to hardware sector buffer XXX replace copy routines with DMAgic
!addr CARD_BUFPNT2 = $1B ; 4 bytes - as above, but points to the 2nd page of the hardware buffer
;
+124 -17
View File
@@ -18,13 +18,18 @@ sdcard_init:
sta CARD_IS_SDHC
lda #SD_SECBUF_0
sta CARD_BUFPNT+0
sta CARD_BUFPNT1+0
sta CARD_BUFPNT2+0
lda #SD_SECBUF_1
sta CARD_BUFPNT+1
sta CARD_BUFPNT1+1
inc
sta CARD_BUFPNT2+1
lda #SD_SECBUF_2
sta CARD_BUFPNT+2
sta CARD_BUFPNT1+2
sta CARD_BUFPNT2+2
lda #SD_SECBUF_3
sta CARD_BUFPNT+3
sta CARD_BUFPNT1+3
sta CARD_BUFPNT2+3
; Reset the card
@@ -39,11 +44,7 @@ sdcard_init:
sta SD_ADDR+3
jsr sdcard_init_read
bcc sdcard_init_operable
; XXX if we are here, mark card as not operable and quit
sdcard_init_operable:
bcs sdcard_init_getsize_fail ; if failure, mark card as not operable and quit
; Work out if this is SD or SDHC card - SD cards can't read at non-sector aligned addresses
@@ -83,22 +84,128 @@ sdcard_init_getsize:
; (binary search of sector numbers is NOT safe for some reason.
; It frequently reports bigger than the size of the card)
lda #$00
; step (and first sector) = 16*2048
sta CARD_TMP_STEP+0
sta CARD_SECNUM+0
sta CARD_TMP_STEP+2
sta CARD_SECNUM+2
sta CARD_TMP_STEP+3
sta CARD_SECNUM+3
lda #$08
sta CARD_TMP_STEP+1
sta CARD_SECNUM+1
; FALLTROUGH
sdcard_init_getsize_read:
; Try to read sector
jsr sdcard_readsector
bcc sdcard_init_getsize_next ; XXX original code checks PEEK(sd_ctl)&0x63;...
; Failed to read - restore card state and sector number
jsr sdcard_reset
sec
lda CARD_SECNUM+0
sbc CARD_TMP_STEP+0
sta CARD_SECNUM+0
lda CARD_SECNUM+1
sbc CARD_TMP_STEP+1
sta CARD_SECNUM+1
lda CARD_SECNUM+2
sbc CARD_TMP_STEP+2
sta CARD_SECNUM+2
lda CARD_SECNUM+3
sbc CARD_TMP_STEP+3
sta CARD_SECNUM+3
; Divide step by 2, skip bytes which are always 0
clc
; ror CARD_TMP_STEP+3
; ror CARD_TMP_STEP+2
ror CARD_TMP_STEP+1
ror CARD_TMP_STEP+0
; FALLTROUGH
sdcard_init_getsize_next:
; Increment sector number by step
clc
lda CARD_SECNUM+0
adc CARD_TMP_STEP+0
sta CARD_SECNUM+0
lda CARD_SECNUM+1
adc CARD_TMP_STEP+1
sta CARD_SECNUM+1
lda CARD_SECNUM+2
adc CARD_TMP_STEP+2
sta CARD_SECNUM+2
lda CARD_SECNUM+3
adc CARD_TMP_STEP+3
sta CARD_SECNUM+3
; If sector number is 0 - report failure
lda CARD_SECNUM+0
ora CARD_SECNUM+1
ora CARD_SECNUM+2
ora CARD_SECNUM+3
beq sdcard_init_getsize_fail
; If step is 0 - this is the end, we know maximum size
lda CARD_TMP_STEP+0
ora CARD_TMP_STEP+1
ora CARD_TMP_STEP+2
ora CARD_TMP_STEP+3
beq sdcard_init_getsize_done
; Check sector number, should be below $10:$00:$00:$00
lda CARD_SECNUM+3
and #$F0
bne sdcard_init_getsize_read
; It is not - report maximum size
lda #$FF
sta CARD_SECNUM+0
sta CARD_SECNUM+1
sta CARD_SECNUM+2
lda #$0F
sta CARD_SECNUM+3
; step = 16*2048
; FALLTROUGH
sta CARD_TMP_STEP+0
sta CARD_TMP_STEP+2
sta CARD_TMP_STEP+3
lda #$08
sta CARD_TMP_STEP+1
sdcard_init_getsize_done:
; XXX finish the implementation
; Return sector number as maximum readable sector
lda CARD_SECNUM+0
sta CARD_SIZE+0
lda CARD_SECNUM+1
sta CARD_SIZE+1
lda CARD_SECNUM+2
sta CARD_SIZE+2
lda CARD_SECNUM+3
sta CARD_SIZE+3
clc
rts
sdcard_init_getsize_fail:
; XXX mark card as inoperable
sec
rts
+37 -5
View File
@@ -99,13 +99,47 @@ sdcard_writesector_verify:
and #$03
bne @3
; XXX verify - compare buffer
; FALLTROUGH
sdcard_writesector_verify_loop:
; Compare buffers
phx
phz
ldx #$00
ldz #$00
lda [CARD_BUFPNT1],z
cmp CARD_BUF, x
bne sdcard_writesector_verify_fail
lda [CARD_BUFPNT2],z
cmp CARD_BUF+$100, x
bne sdcard_writesector_verify_fail
inz
inx
bne sdcard_writesector_verify_loop
; FALLTROUGH
sdcard_writesector_verify_success:
plz
plx
clc
rts
sdcard_writesector_verify_fail:
plz
plx
sec
rts
;
@@ -124,11 +158,9 @@ sdcard_writesector_copy_data:
@1:
lda CARD_BUF,x
sta [CARD_BUFPNT],z
inc CARD_BUFPNT+1
sta [CARD_BUFPNT1],z
lda CARD_BUF+$100,x
sta [CARD_BUFPNT],z
dec CARD_BUFPNT+1
sta [CARD_BUFPNT2],z
inz
inx
+1 -1
View File
@@ -32,7 +32,7 @@ m65_native_meminit:
sta M65_DMAJOB_SRC_3
lda #$02
sta M65_DMAJOB_SRC_2
lda #$D0
lda #$90
sta M65_DMAJOB_SRC_1
lda #$00
sta M65_DMAJOB_SRC_0
@@ -91,6 +91,8 @@ m65_scrmodeset_internal: ; entry point for M65_MODE65
stx VIC_COLPTR+0
stx VIC_COLPTR+1
!ifndef CONFIG_HOTFIX_CHARPTR {
; Set the following location:
; - VIC_CHARPTR - for character generator location
@@ -100,6 +102,7 @@ m65_scrmodeset_internal: ; entry point for M65_MODE65
sta VIC_CHARPTR+1
lda #$01
sta VIC_CHARPTR+2
}
; Set the following locations:
; - M65_SCRGUARD, M65_COLGUARD - guards for virtual screen end