DeskTop: Check block count when treating BIN as FOT

This commit is contained in:
Joshua Bell 2019-04-22 21:44:37 -07:00
parent 4eb5057831
commit 6a14ad7bf0
2 changed files with 47 additions and 26 deletions

View File

@ -886,8 +886,9 @@ begin:
rts rts
;; Check file type. ;; Check file type.
: lda get_file_info_params::file_type : copy get_file_info_params::file_type, fto_type
ldxy get_file_info_params::aux_type copy16 get_file_info_params::aux_type, fto_auxtype
copy16 get_file_info_params::blocks_used, fto_blocks
jsr check_file_type_overrides jsr check_file_type_overrides
cmp #FT_BASIC cmp #FT_BASIC
@ -6665,16 +6666,11 @@ L7767: .byte $14
beq is_generic ; treat as generic beq is_generic ; treat as generic
;; Handle several classes of overrides ;; Handle several classes of overrides
pha ; Load auxtype into X,Y sta fto_type
ldy #FileRecord::aux_type ldy #FileRecord::aux_type
lda (file_entry),y ; lo copy16in (file_entry),y, fto_auxtype
pha ldy #FileRecord::blocks
iny copy16in (file_entry),y, fto_blocks
lda (file_entry),y ; hi
tay ; hi
pla
tax ; lo
pla
jsr check_file_type_overrides jsr check_file_type_overrides
cmp #FT_SYSTEM ; Other system? cmp #FT_SYSTEM ; Other system?
@ -6841,32 +6837,45 @@ file_type:
;;; ============================================================ ;;; ============================================================
;;; Check file type for possible overrides ;;; Check file type for possible overrides
;;; TODO: Make this data driven. ;;; TODO: Make this data driven.
;;; TODO: Also check length for BIN overrides.
;;; Input: A is filetype, X,Y is auxtype ;;; Input: fto_type, fto_auxtype, fto_blocks populated
;;; Output: A is filetype to use ;;; Output: A is filetype to use
.proc check_file_type_overrides .proc check_file_type_overrides
stxy auxtype ;; Binary - treat certain auxtypes/sizes as Graphics
lda fto_type
;; Binary - treat certain auxtypes as Graphics
cmp #FT_BINARY cmp #FT_BINARY
bne :+ bne check_da
ldxy #$5800 ; minipix ldxy #$5800 ; minipix
jsr check_aux jsr compare_aux
bne :+
ldxy #3 ; blocks
jsr compare_blocks
beq is_graphics beq is_graphics
ldxy #$2000 ; hires :
jsr check_aux
ldxy #$2000 ; hires / double hires
jsr compare_aux
bne :+
ldxy #17 ; blocks
jsr compare_blocks
beq is_graphics beq is_graphics
ldxy #33 ; blocks
jsr compare_blocks
beq is_graphics
:
;; DA - treat as generic *unless* auxtypes are correct ;; DA - treat as generic *unless* auxtypes are correct
: cmp #DA_FILE_TYPE check_da:
lda fto_type
cmp #DA_FILE_TYPE
bne :+ bne :+
ldxy #DA_AUX_TYPE ldxy #DA_AUX_TYPE
jsr check_aux jsr compare_aux
beq :+ beq :+
ldxy #DA_AUX_TYPE | $8000 ldxy #DA_AUX_TYPE | $8000
jsr check_aux jsr compare_aux
bne is_generic bne is_generic
: rts : rts
@ -6882,10 +6891,17 @@ is_graphics:
auxtype: auxtype:
.word 0 .word 0
.proc check_aux .proc compare_aux
cpx auxtype cpx fto_auxtype
bne :+ bne :+
cpy auxtype+1 cpy fto_auxtype+1
: rts
.endproc
.proc compare_blocks
cpx fto_blocks
bne :+
cpy fto_blocks+1
: rts : rts
.endproc .endproc

View File

@ -1401,6 +1401,11 @@ date: .word 0
hex_digits: hex_digits:
.byte "0123456789ABCDEF" .byte "0123456789ABCDEF"
;;; Params for check_file_type_overrides
fto_type: .byte 0
fto_auxtype: .word 0
fto_blocks: .word 0
;;; -------------------------------------------------- ;;; --------------------------------------------------
PAD_TO $ED00 PAD_TO $ED00