Revert "very experimental head align tool"

This reverts commit 7227370907.
This commit is contained in:
FeralChild64 committed 2019-12-20 22:07:18 +01:00
1 parent 7227370907
commit f16aaf015a
15 files changed
+41 -359

No files matched your search

-1
View File
@@ -15,6 +15,5 @@ build/*
# Various IDE project files, temporary files, etc.
dump.mem
uart.sock
*project
.*swp
-1
View File
@@ -114,7 +114,6 @@
#define CONFIG_PANIC_SCREEN
#define CONFIG_DOS_WEDGE
#define CONFIG_TAPE_WEDGE
#define CONFIG_HEAD_FIT_TOOL // ver experimental!
#define CONFIG_BCD_SAFE_INTERRUPTS
-4
View File
@@ -26,7 +26,3 @@
#if CONFIG_SHOW_PAL_NTSC
.label print_pal_ntsc = KERNAL.print_pal_ntsc
#endif
#if CONFIG_HEAD_FIT_TOOL
.label head_fit = KERNAL.head_fit
#endif
+2 -2
View File
@@ -64,7 +64,7 @@ rsl_l1:
// Check if a wedge should take over
#if CONFIG_DOS_WEDGE || CONFIG_TAPE_WEDGE || CONFIG_HEAD_FIT_TOOL
#if CONFIG_DOS_WEDGE || CONFIG_TAPE_WEDGE
ldx __tokenise_work1 // here is the size of input
@@ -75,7 +75,7 @@ rsl_l1:
cmp #$40 // '@'
beq_far wedge_dos
#endif
#if CONFIG_TAPE_WEDGE || CONFIG_HEAD_FIT_TOOL
#if CONFIG_TAPE_WEDGE
cmp #$1F // left arrow
beq_far wedge_tape
#endif
+2 -15
View File
@@ -1,5 +1,5 @@
#if CONFIG_TAPE_WEDGE || CONFIG_HEAD_FIT_TOOL
#if CONFIG_TAPE_WEDGE
// .X has to contain size of the buffer
@@ -13,19 +13,6 @@ wedge_tape:
bne_far do_SYNTAX_error
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'
bne_far do_SYNTAX_error
@@ -44,4 +31,4 @@ wedge_tape:
jmp cmd_load_got_secondaryaddress
#endif
#endif // CONFIG_TAPE_WEDGE
-201
View File
@@ -1,201 +0,0 @@
//
// 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
-15
View File
@@ -1,15 +0,0 @@
//
// Screen character table for head alignemnt tool
//
#if CONFIG_HEAD_FIT_TOOL
head_fit_gfx_table:
.byte $20, $61, $E1, $A0
#endif
-20
View File
@@ -1,20 +0,0 @@
//
// 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
-31
View File
@@ -1,31 +0,0 @@
//
// 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
+15 -2
View File
@@ -38,8 +38,21 @@ load_tape_normal:
jsr tape_ditch_verify // only LOAD is supported, no VERIFY
// Setup CIA #2 timers
jsr tape_normal_setup_timers
// Setup CIA #2 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
jsr tape_ask_play
+19
View File
@@ -34,6 +34,25 @@ tape_break_error:
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),
// store/restore screen color
-25
View File
@@ -1,25 +0,0 @@
//
// 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
+1 -1
View File
@@ -20,7 +20,7 @@ tape_normal_get_byte:
// First we need a byte marker - (L,M)
!:
jsr tape_normal_get_pulse
cmp #($FF - $95 - $04)
cmp #($100 - $95 - $04)
bcs !- // too short for a long pulse
jsr tape_normal_get_pulse
bcs !- // too short for a medium pulse
+2 -7
View File
@@ -6,7 +6,7 @@
//
#if CONFIG_TAPE_NORMAL || CONFIG_HEAD_FIT_TOOL
#if CONFIG_TAPE_NORMAL
tape_normal_get_pulse:
@@ -26,8 +26,6 @@ tape_normal_get_pulse:
ldx #%01010001 // start timer, force latch reload, count timer A underflows
stx CIA2_CRB // $DD0F
#if CONFIG_TAPE_NORMAL
// Since the signal appeared to the point of timer restart we used:
// bit - 4 cycles
// beq - 2 cycles
@@ -39,10 +37,7 @@ 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
// every time we check the pulse length
cmp #($FF - $6C - $04) // short vs medium is the default check
#endif
cmp #($100 - $6C - $04) // short vs medium is the default check
rts
@@ -1,34 +0,0 @@
//
// 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