simplified the head alignment tool

This commit is contained in:
FeralChild64 committed 2020-06-06 14:37:33 +02:00
1 parent f889281534
commit 2f2dda54c0
5 files changed
+36 -62

No files matched your search

+1 -1
View File
@@ -291,7 +291,7 @@ Feature needs few bytes in BASIC segment. If unsure - enable.
If enabled, embeds a tape head align tool into the ROM, it can be started with `←H`. Requires `CONFIG_TAPE_WEDGE`.
Feature needs nearly 1 KB bytes in KERNAL segment. Only recomended for machines with extended ROM, like Mega65.
Feature needs about 800 bytes in KERNAL segment. Only recomended for machines with extended ROM, like Mega65.
### `CONFIG_BCD_SAFE_INTERRUPTS`
+10 -46
View File
@@ -12,26 +12,21 @@
// XXX for Mega65 it can be done more easily, by just disabling the badlines
.label __ha_start = 12 // starting row of the chart
.label __ha_rows = 11 // number of rows for scrolling
.label __ha_start = 12 // starting row of the chart
.label __ha_rows = 11 // number of rows for scrolling
// Helper tables
.label __ha_offsets = $1000;
.label __ha_masks = $1100;
// Helper variables
.label __ha_lda_addr = $1200; // 2 bytes, for code generator
.label __ha_sta_addr = $1202; // 2 bytes, for code generator
.label __ha_pulses = $1204; // 64 bytes
.label __ha_gfxflag = $1244; // 1 byte
.label __ha_storage = $1245; // 1 byte
// Generated code location
.label __ha_scroll = $1300;
.label __ha_scroll = $1300;
// Flag for GFX effects
.label __ha_gfxflag = $1200; // 1 byte
tape_head_align:
@@ -144,14 +139,9 @@ tape_head_align:
inx
bne !--
// Initialize flag for additional GFX effects and the pulse lengths
// Initialize flag for additional GFX effects
lda #$00
ldx #$40
!:
sta __ha_pulses, x
dex
bpl !-
stx __ha_gfxflag // .X is 0 at this moment
// Generate helper code for screen scrolling
@@ -172,7 +162,7 @@ tape_head_align:
and VIC_SCROLY // clear the highest bit of RASTER
sta VIC_SCROLY // $D011
lda #$F3 // the last raster where badline can occur, this is 100% safe start
lda #$FB // we want no badlines during the interrupt, this raster is 100% safe
sta VIC_RASTER
lda #%00000001 // enable raster interrupts
@@ -208,36 +198,10 @@ tape_head_align_loop_1:
jsr tape_head_align_apply_gfx
// Skip 2 pulses, these measurements will be too imprecise
jsr tape_head_align_get_pulse
jsr tape_head_align_get_pulse
// FALLTROUGH
tape_head_align_loop_2:
// Draw pulses
ldx #$00
!:
stx __ha_storage
lda __ha_pulses, x
cmp #$FF
beq tape_head_align_drawn // $FF - end of pulses to draw
jsr tape_head_align_draw_pulse
ldx __ha_storage
inx
cpx #$40
bne !-
// FALLTROUGH
tape_head_align_drawn:
lda CIA1_TIMBLO
and CIA1_TIMBHI
eor #$FF
@@ -10,6 +10,12 @@
#if CONFIG_TAPE_HEAD_ALIGN
// Helper variables - reuse BASIC numeric work area on zero page
.label __ha_lda_addr = TEMPF1 + 0; // 2 bytes, for code generator
.label __ha_sta_addr = TEMPF1 + 2; // 2 bytes, for code generator
tape_head_align_gen_code:
// Setup generated code start address
+5
View File
@@ -10,6 +10,11 @@
#if CONFIG_TAPE_HEAD_ALIGN
// Helper variable - reuse BASIC numeric work area on zero page
.label __ha_storage = TEMPF1; // 1 byte
tape_head_align_print_help:
// Make screen font visible
+14 -15
View File
@@ -16,24 +16,19 @@ tape_head_align_irq:
asl VIC_IRQ
// Clear table of pulses stored
lda #$FF
ldy #$3F
!:
sta __ha_pulses, y
dey
bpl !-
// Ignore 2 first pulses, they can be garbage
jsr tape_head_align_get_pulse
jsr tape_head_align_get_pulse
// Now, we can retrieve a pulse for the charts
// Now, we can retrieve pulses for the chart
ldx #$00
!:
// FALLTROUGH
tape_head_align_irq_loop:
jsr tape_head_align_get_pulse
// If we approached badlines again - we cannot use this measurement anymore
@@ -45,16 +40,20 @@ tape_head_align_irq:
cmp #$33 // first line where badline can occur
bcs tape_head_align_irq_end
!:
// Store measurement
// Draw pulse
cpy #$FF
beq !+
phx_trash_a
tya
sta __ha_pulses, x
jsr tape_head_align_draw_pulse
plx_trash_a
!:
// Next iteration
inx
cpx #$40
bne !--
bne tape_head_align_irq_loop
// FALLTROUGH