very experimental head align tool
This commit is contained in:
1 parent
9392728750
commit
7227370907
15 files changed
+359
-41
No files matched your search
@@ -15,5 +15,6 @@ build/*
|
|||||||
# Various IDE project files, temporary files, etc.
|
# Various IDE project files, temporary files, etc.
|
||||||
|
|
||||||
dump.mem
|
dump.mem
|
||||||
|
uart.sock
|
||||||
*project
|
*project
|
||||||
.*swp
|
.*swp
|
||||||
@@ -114,6 +114,7 @@
|
|||||||
#define CONFIG_PANIC_SCREEN
|
#define CONFIG_PANIC_SCREEN
|
||||||
#define CONFIG_DOS_WEDGE
|
#define CONFIG_DOS_WEDGE
|
||||||
#define CONFIG_TAPE_WEDGE
|
#define CONFIG_TAPE_WEDGE
|
||||||
|
#define CONFIG_HEAD_FIT_TOOL // ver experimental!
|
||||||
#define CONFIG_BCD_SAFE_INTERRUPTS
|
#define CONFIG_BCD_SAFE_INTERRUPTS
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,3 +26,7 @@
|
|||||||
#if CONFIG_SHOW_PAL_NTSC
|
#if CONFIG_SHOW_PAL_NTSC
|
||||||
.label print_pal_ntsc = KERNAL.print_pal_ntsc
|
.label print_pal_ntsc = KERNAL.print_pal_ntsc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_HEAD_FIT_TOOL
|
||||||
|
.label head_fit = KERNAL.head_fit
|
||||||
|
#endif
|
||||||
@@ -64,7 +64,7 @@ rsl_l1:
|
|||||||
|
|
||||||
// Check if a wedge should take over
|
// Check if a wedge should take over
|
||||||
|
|
||||||
#if CONFIG_DOS_WEDGE || CONFIG_TAPE_WEDGE
|
#if CONFIG_DOS_WEDGE || CONFIG_TAPE_WEDGE || CONFIG_HEAD_FIT_TOOL
|
||||||
|
|
||||||
ldx __tokenise_work1 // here is the size of input
|
ldx __tokenise_work1 // here is the size of input
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ rsl_l1:
|
|||||||
cmp #$40 // '@'
|
cmp #$40 // '@'
|
||||||
beq_far wedge_dos
|
beq_far wedge_dos
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_TAPE_WEDGE
|
#if CONFIG_TAPE_WEDGE || CONFIG_HEAD_FIT_TOOL
|
||||||
cmp #$1F // left arrow
|
cmp #$1F // left arrow
|
||||||
beq_far wedge_tape
|
beq_far wedge_tape
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+15
-2
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#if CONFIG_TAPE_WEDGE
|
#if CONFIG_TAPE_WEDGE || CONFIG_HEAD_FIT_TOOL
|
||||||
|
|
||||||
|
|
||||||
// .X has to contain size of the buffer
|
// .X has to contain size of the buffer
|
||||||
@@ -13,6 +13,19 @@ wedge_tape:
|
|||||||
bne_far do_SYNTAX_error
|
bne_far do_SYNTAX_error
|
||||||
|
|
||||||
lda BUF+1
|
lda BUF+1
|
||||||
|
|
||||||
|
#if CONFIG_HEAD_FIT_TOOL
|
||||||
|
|
||||||
|
cmp #$48 // 'H'
|
||||||
|
beq_far head_fit
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#if !CONFIG_TAPE_WEDGE
|
||||||
|
|
||||||
|
jmp do_SYNTAX_error
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
cmp #$4C // 'L'
|
cmp #$4C // 'L'
|
||||||
bne_far do_SYNTAX_error
|
bne_far do_SYNTAX_error
|
||||||
|
|
||||||
@@ -31,4 +44,4 @@ wedge_tape:
|
|||||||
jmp cmd_load_got_secondaryaddress
|
jmp cmd_load_got_secondaryaddress
|
||||||
|
|
||||||
|
|
||||||
#endif // CONFIG_TAPE_WEDGE
|
#endif
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Simple text mode head alignment tool
|
||||||
|
//
|
||||||
|
|
||||||
|
// XXX this is experimental only - make it useable!
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_HEAD_FIT_TOOL
|
||||||
|
|
||||||
|
|
||||||
|
head_fit:
|
||||||
|
|
||||||
|
// Start by disabling interrupts and preparing screen
|
||||||
|
|
||||||
|
sei
|
||||||
|
jsr clear_screen
|
||||||
|
|
||||||
|
// Now we need to create screen pointers on zero page, we can safely reuse some BASIC variables
|
||||||
|
// The 6 vectors below completely fills variables: TEMPPT, LASTPT, TEMPST
|
||||||
|
|
||||||
|
.var HF_SCREEN_PTR1_A = TEMPPT+0 // $16-$17
|
||||||
|
.var HF_SCREEN_PTR1_B = TEMPPT+2 // $18-$19
|
||||||
|
.var HF_SCREEN_PTR2_A = TEMPPT+4 // $1A-$1B
|
||||||
|
.var HF_SCREEN_PTR2_B = TEMPPT+6 // $1C-$1D
|
||||||
|
.var HF_SCREEN_PTR3_A = TEMPPT+8 // $1E-$1F
|
||||||
|
.var HF_SCREEN_PTR3_B = TEMPPT+10 // $20-$21
|
||||||
|
|
||||||
|
ldx #11
|
||||||
|
!:
|
||||||
|
lda head_fit_ptr_table, x
|
||||||
|
clc
|
||||||
|
adc HIBASE
|
||||||
|
sta HF_SCREEN_PTR1_A, x
|
||||||
|
|
||||||
|
dex
|
||||||
|
lda head_fit_ptr_table, x
|
||||||
|
sta HF_SCREEN_PTR1_A, x
|
||||||
|
|
||||||
|
dex
|
||||||
|
bpl !-
|
||||||
|
|
||||||
|
// Reuse BASIC variable for Normal/Turbo switching
|
||||||
|
|
||||||
|
.var HF_IS_TURBO = RESHO+0
|
||||||
|
|
||||||
|
inx // puts 0 into .X
|
||||||
|
sta HF_IS_TURBO
|
||||||
|
|
||||||
|
// Setup CIA #2 timers (this will provide desired resolution), start motor
|
||||||
|
|
||||||
|
jsr head_fit_setup_timers
|
||||||
|
jsr tape_motor_on
|
||||||
|
|
||||||
|
// Again, reuse 3 BASIC variables
|
||||||
|
|
||||||
|
.var HF_TMP = RESHO+1
|
||||||
|
.var HF_SCROLL_CNT = RESHO+2
|
||||||
|
.var HF_RASTER_MARK = RESHO+3
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
head_fit_loop:
|
||||||
|
|
||||||
|
// Store raster mark
|
||||||
|
|
||||||
|
lda VIC_SCROLY
|
||||||
|
and #%10000000
|
||||||
|
sta HF_RASTER_MARK
|
||||||
|
|
||||||
|
lda #$80
|
||||||
|
sta HF_SCROLL_CNT
|
||||||
|
|
||||||
|
jsr tape_normal_get_pulse // ignore this pulse - too much time passed
|
||||||
|
|
||||||
|
head_fit_loop_inner:
|
||||||
|
|
||||||
|
jsr tape_normal_get_pulse
|
||||||
|
|
||||||
|
// Normalize pulse length value to 0-79
|
||||||
|
sec
|
||||||
|
adc #$08
|
||||||
|
|
||||||
|
sta HF_TMP
|
||||||
|
lda #$FF
|
||||||
|
sec
|
||||||
|
sbc HF_TMP
|
||||||
|
|
||||||
|
cmp #80
|
||||||
|
bcc !+
|
||||||
|
lda #79
|
||||||
|
!:
|
||||||
|
|
||||||
|
// Display value
|
||||||
|
|
||||||
|
tax
|
||||||
|
|
||||||
|
clc
|
||||||
|
ror
|
||||||
|
tay // .Y now contains character offset
|
||||||
|
|
||||||
|
lda (HF_SCREEN_PTR1_A), y
|
||||||
|
cmp #$A0 // is inversed space?
|
||||||
|
beq head_fit_char_displayed // if so, do not display anything
|
||||||
|
cmp #$20
|
||||||
|
bne !+
|
||||||
|
lda #$00
|
||||||
|
beq head_fit_store_bits
|
||||||
|
!:
|
||||||
|
cmp #$61
|
||||||
|
bne !+
|
||||||
|
lda #$01
|
||||||
|
bne head_fit_store_bits
|
||||||
|
!:
|
||||||
|
// Has to be #$E1
|
||||||
|
lda #$02
|
||||||
|
|
||||||
|
// FALLROUGH
|
||||||
|
|
||||||
|
head_fit_store_bits:
|
||||||
|
|
||||||
|
sta HF_TMP
|
||||||
|
|
||||||
|
txa
|
||||||
|
and #$01
|
||||||
|
asl
|
||||||
|
bne !+
|
||||||
|
lda #$01
|
||||||
|
!: // .A is now %10 or %01 - depending on the desired pulse position
|
||||||
|
ora HF_TMP
|
||||||
|
tax // .X contains now character index, 0-4
|
||||||
|
|
||||||
|
lda head_fit_gfx_table, x
|
||||||
|
sta (HF_SCREEN_PTR1_A), y
|
||||||
|
|
||||||
|
head_fit_char_displayed:
|
||||||
|
|
||||||
|
// Check whether to decrement scroll countdown
|
||||||
|
|
||||||
|
lda VIC_SCROLY
|
||||||
|
and #%10000000 // retrieve highest bit of raster
|
||||||
|
cmp HF_RASTER_MARK
|
||||||
|
beq head_fit_loop_inner
|
||||||
|
|
||||||
|
// Decrement scroll countdown
|
||||||
|
|
||||||
|
dec HF_SCROLL_CNT
|
||||||
|
bne head_fit_loop_inner
|
||||||
|
|
||||||
|
// Scan keys
|
||||||
|
|
||||||
|
jsr udtim_keyboard
|
||||||
|
lda STKEY
|
||||||
|
bmi !+
|
||||||
|
|
||||||
|
// Stop pressed - quit
|
||||||
|
|
||||||
|
jsr tape_motor_off
|
||||||
|
jsr clear_screen
|
||||||
|
cli
|
||||||
|
rts
|
||||||
|
!:
|
||||||
|
// If space, toggle system
|
||||||
|
|
||||||
|
cmp #$EF
|
||||||
|
bne !+
|
||||||
|
jsr head_fit_switch_system
|
||||||
|
!:
|
||||||
|
// Scroll down the screen
|
||||||
|
|
||||||
|
ldy #240
|
||||||
|
!:
|
||||||
|
lda (HF_SCREEN_PTR3_A), y
|
||||||
|
sta (HF_SCREEN_PTR3_B), y
|
||||||
|
|
||||||
|
lda (HF_SCREEN_PTR2_A), y
|
||||||
|
sta (HF_SCREEN_PTR2_B), y
|
||||||
|
|
||||||
|
lda (HF_SCREEN_PTR1_A), y
|
||||||
|
sta (HF_SCREEN_PTR1_B), y
|
||||||
|
|
||||||
|
dey
|
||||||
|
cpy #$FF
|
||||||
|
bne !-
|
||||||
|
|
||||||
|
// Clear the first line
|
||||||
|
|
||||||
|
lda #$20
|
||||||
|
ldy #39
|
||||||
|
!:
|
||||||
|
sta (HF_SCREEN_PTR1_A), y
|
||||||
|
dey
|
||||||
|
cpy #$FF
|
||||||
|
bne !-
|
||||||
|
|
||||||
|
// Continue
|
||||||
|
|
||||||
|
jmp head_fit_loop
|
||||||
|
|
||||||
|
|
||||||
|
#endif // CONFIG_HEAD_FIT_TOOL
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Screen character table for head alignemnt tool
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_HEAD_FIT_TOOL
|
||||||
|
|
||||||
|
|
||||||
|
head_fit_gfx_table:
|
||||||
|
|
||||||
|
.byte $20, $61, $E1, $A0
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Screen pointer table for head alignemnt tool
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_HEAD_FIT_TOOL
|
||||||
|
|
||||||
|
|
||||||
|
head_fit_ptr_table:
|
||||||
|
|
||||||
|
.word ( 40 * 0 )
|
||||||
|
.word ( 40 * 1 )
|
||||||
|
.word ( 40 * 6 )
|
||||||
|
.word ( 40 * 7 )
|
||||||
|
.word ( 40 * 12 )
|
||||||
|
.word ( 40 * 13 )
|
||||||
|
|
||||||
|
|
||||||
|
#endif // CONFIG_HEAD_FIT_TOOL
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Save system switcher for head alignment tool
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_HEAD_FIT_TOOL
|
||||||
|
|
||||||
|
|
||||||
|
head_fit_switch_system:
|
||||||
|
|
||||||
|
lda #$01
|
||||||
|
eor HF_IS_TURBO
|
||||||
|
sta HF_IS_TURBO
|
||||||
|
|
||||||
|
// FALLTROUNG
|
||||||
|
|
||||||
|
head_fit_setup_timers:
|
||||||
|
|
||||||
|
ldx #$08
|
||||||
|
lda HF_IS_TURBO
|
||||||
|
beq !+
|
||||||
|
ldx #$04
|
||||||
|
!:
|
||||||
|
|
||||||
|
jsr tape_normal_setup_timers_custom
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -38,21 +38,8 @@ load_tape_normal:
|
|||||||
|
|
||||||
jsr tape_ditch_verify // only LOAD is supported, no VERIFY
|
jsr tape_ditch_verify // only LOAD is supported, no VERIFY
|
||||||
|
|
||||||
// Setup CIA #2 timers
|
// Setup CIA #2 timers
|
||||||
|
jsr tape_normal_setup_timers
|
||||||
ldx #$03 // set timer A to 4 ticks
|
|
||||||
stx CIA2_TIMALO // $DD04
|
|
||||||
ldx #$00
|
|
||||||
stx CIA2_TIMAHI // $DD05
|
|
||||||
|
|
||||||
stx CIA2_TIMBHI // $DD07
|
|
||||||
dex // puts $FF - for running timer B as long as possible
|
|
||||||
stx CIA2_TIMBLO // $DD06
|
|
||||||
|
|
||||||
// Let timer A run continuously
|
|
||||||
|
|
||||||
ldx #%00010001 // start timer, force latch reload
|
|
||||||
stx CIA2_CRA // $DD0E
|
|
||||||
|
|
||||||
// Start playing
|
// Start playing
|
||||||
jsr tape_ask_play
|
jsr tape_ask_play
|
||||||
|
|||||||
@@ -34,25 +34,6 @@ tape_break_error:
|
|||||||
jmp kernalerror_ROUTINE_TERMINATED
|
jmp kernalerror_ROUTINE_TERMINATED
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Handle tape deck motor
|
|
||||||
//
|
|
||||||
|
|
||||||
tape_motor_off:
|
|
||||||
|
|
||||||
lda CPU_R6510
|
|
||||||
ora #$20
|
|
||||||
bne !+ // branch always
|
|
||||||
|
|
||||||
tape_motor_on:
|
|
||||||
|
|
||||||
lda CPU_R6510
|
|
||||||
and #($FF - $20)
|
|
||||||
!:
|
|
||||||
sta CPU_R6510
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Handle screen (visible/blanked) + tape deck motor (on/off),
|
// Handle screen (visible/blanked) + tape deck motor (on/off),
|
||||||
// store/restore screen color
|
// store/restore screen color
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Handle tape deck motor
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO || CONFIG_HEAD_FIT_TOOL
|
||||||
|
|
||||||
|
|
||||||
|
tape_motor_off:
|
||||||
|
|
||||||
|
lda CPU_R6510
|
||||||
|
ora #$20
|
||||||
|
bne !+ // branch always
|
||||||
|
|
||||||
|
tape_motor_on:
|
||||||
|
|
||||||
|
lda CPU_R6510
|
||||||
|
and #($FF - $20)
|
||||||
|
!:
|
||||||
|
sta CPU_R6510
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -20,7 +20,7 @@ tape_normal_get_byte:
|
|||||||
// First we need a byte marker - (L,M)
|
// First we need a byte marker - (L,M)
|
||||||
!:
|
!:
|
||||||
jsr tape_normal_get_pulse
|
jsr tape_normal_get_pulse
|
||||||
cmp #($100 - $95 - $04)
|
cmp #($FF - $95 - $04)
|
||||||
bcs !- // too short for a long pulse
|
bcs !- // too short for a long pulse
|
||||||
jsr tape_normal_get_pulse
|
jsr tape_normal_get_pulse
|
||||||
bcs !- // too short for a medium pulse
|
bcs !- // too short for a medium pulse
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#if CONFIG_TAPE_NORMAL
|
#if CONFIG_TAPE_NORMAL || CONFIG_HEAD_FIT_TOOL
|
||||||
|
|
||||||
|
|
||||||
tape_normal_get_pulse:
|
tape_normal_get_pulse:
|
||||||
@@ -26,6 +26,8 @@ tape_normal_get_pulse:
|
|||||||
ldx #%01010001 // start timer, force latch reload, count timer A underflows
|
ldx #%01010001 // start timer, force latch reload, count timer A underflows
|
||||||
stx CIA2_CRB // $DD0F
|
stx CIA2_CRB // $DD0F
|
||||||
|
|
||||||
|
#if CONFIG_TAPE_NORMAL
|
||||||
|
|
||||||
// Since the signal appeared to the point of timer restart we used:
|
// Since the signal appeared to the point of timer restart we used:
|
||||||
// bit - 4 cycles
|
// bit - 4 cycles
|
||||||
// beq - 2 cycles
|
// beq - 2 cycles
|
||||||
@@ -37,7 +39,10 @@ tape_normal_get_pulse:
|
|||||||
// this is total 17 cycles, or $4 periods of 4 ticks (timer A) each - we need to take it into account
|
// this is total 17 cycles, or $4 periods of 4 ticks (timer A) each - we need to take it into account
|
||||||
// every time we check the pulse length
|
// every time we check the pulse length
|
||||||
|
|
||||||
cmp #($100 - $6C - $04) // short vs medium is the default check
|
cmp #($FF - $6C - $04) // short vs medium is the default check
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Helper routine to setup CIA #2 timers
|
||||||
|
//
|
||||||
|
|
||||||
|
#if CONFIG_TAPE_NORMAL
|
||||||
|
|
||||||
|
tape_normal_setup_timers:
|
||||||
|
|
||||||
|
ldx #$03 // set timer A to 4 ticks
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#if CONFIG_TAPE_NORMAL || CONFIG_HEAD_FIT_TOOL
|
||||||
|
|
||||||
|
tape_normal_setup_timers_custom: // entry for the head fit tool
|
||||||
|
|
||||||
|
stx CIA2_TIMALO // $DD04
|
||||||
|
ldx #$00
|
||||||
|
stx CIA2_TIMAHI // $DD05
|
||||||
|
|
||||||
|
stx CIA2_TIMBHI // $DD07
|
||||||
|
dex // puts $FF - for running timer B as long as possible
|
||||||
|
stx CIA2_TIMBLO // $DD06
|
||||||
|
|
||||||
|
// Let timer A run continuously
|
||||||
|
|
||||||
|
ldx #%00010001 // start timer, force latch reload
|
||||||
|
stx CIA2_CRA // $DD0E
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in new issue
Block a user