simplified the head alignment tool
This commit is contained in:
1 parent
f889281534
commit
2f2dda54c0
5 files changed
+36
-62
No files matched your search
@@ -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`.
|
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`
|
### `CONFIG_BCD_SAFE_INTERRUPTS`
|
||||||
|
|
||||||
|
|||||||
@@ -12,26 +12,21 @@
|
|||||||
// XXX for Mega65 it can be done more easily, by just disabling the badlines
|
// 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_start = 12 // starting row of the chart
|
||||||
.label __ha_rows = 11 // number of rows for scrolling
|
.label __ha_rows = 11 // number of rows for scrolling
|
||||||
|
|
||||||
// Helper tables
|
// Helper tables
|
||||||
|
|
||||||
.label __ha_offsets = $1000;
|
.label __ha_offsets = $1000;
|
||||||
.label __ha_masks = $1100;
|
.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
|
// Generated code location
|
||||||
|
|
||||||
.label __ha_scroll = $1300;
|
.label __ha_scroll = $1300;
|
||||||
|
|
||||||
|
// Flag for GFX effects
|
||||||
|
|
||||||
|
.label __ha_gfxflag = $1200; // 1 byte
|
||||||
|
|
||||||
|
|
||||||
tape_head_align:
|
tape_head_align:
|
||||||
@@ -144,14 +139,9 @@ tape_head_align:
|
|||||||
inx
|
inx
|
||||||
bne !--
|
bne !--
|
||||||
|
|
||||||
// Initialize flag for additional GFX effects and the pulse lengths
|
// Initialize flag for additional GFX effects
|
||||||
|
|
||||||
lda #$00
|
stx __ha_gfxflag // .X is 0 at this moment
|
||||||
ldx #$40
|
|
||||||
!:
|
|
||||||
sta __ha_pulses, x
|
|
||||||
dex
|
|
||||||
bpl !-
|
|
||||||
|
|
||||||
// Generate helper code for screen scrolling
|
// Generate helper code for screen scrolling
|
||||||
|
|
||||||
@@ -172,7 +162,7 @@ tape_head_align:
|
|||||||
and VIC_SCROLY // clear the highest bit of RASTER
|
and VIC_SCROLY // clear the highest bit of RASTER
|
||||||
sta VIC_SCROLY // $D011
|
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
|
sta VIC_RASTER
|
||||||
|
|
||||||
lda #%00000001 // enable raster interrupts
|
lda #%00000001 // enable raster interrupts
|
||||||
@@ -208,36 +198,10 @@ tape_head_align_loop_1:
|
|||||||
|
|
||||||
jsr tape_head_align_apply_gfx
|
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
|
// FALLTROUGH
|
||||||
|
|
||||||
tape_head_align_loop_2:
|
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
|
lda CIA1_TIMBLO
|
||||||
and CIA1_TIMBHI
|
and CIA1_TIMBHI
|
||||||
eor #$FF
|
eor #$FF
|
||||||
|
|||||||
@@ -10,6 +10,12 @@
|
|||||||
#if CONFIG_TAPE_HEAD_ALIGN
|
#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:
|
tape_head_align_gen_code:
|
||||||
|
|
||||||
// Setup generated code start address
|
// Setup generated code start address
|
||||||
|
|||||||
@@ -10,6 +10,11 @@
|
|||||||
#if CONFIG_TAPE_HEAD_ALIGN
|
#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:
|
tape_head_align_print_help:
|
||||||
|
|
||||||
// Make screen font visible
|
// Make screen font visible
|
||||||
|
|||||||
@@ -16,24 +16,19 @@ tape_head_align_irq:
|
|||||||
|
|
||||||
asl VIC_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
|
// Ignore 2 first pulses, they can be garbage
|
||||||
|
|
||||||
jsr tape_head_align_get_pulse
|
jsr tape_head_align_get_pulse
|
||||||
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
|
ldx #$00
|
||||||
!:
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
tape_head_align_irq_loop:
|
||||||
|
|
||||||
jsr tape_head_align_get_pulse
|
jsr tape_head_align_get_pulse
|
||||||
|
|
||||||
// If we approached badlines again - we cannot use this measurement anymore
|
// 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
|
cmp #$33 // first line where badline can occur
|
||||||
bcs tape_head_align_irq_end
|
bcs tape_head_align_irq_end
|
||||||
!:
|
!:
|
||||||
// Store measurement
|
// Draw pulse
|
||||||
|
|
||||||
|
cpy #$FF
|
||||||
|
beq !+
|
||||||
|
phx_trash_a
|
||||||
tya
|
tya
|
||||||
sta __ha_pulses, x
|
jsr tape_head_align_draw_pulse
|
||||||
|
plx_trash_a
|
||||||
|
!:
|
||||||
// Next iteration
|
// Next iteration
|
||||||
|
|
||||||
inx
|
inx
|
||||||
cpx #$40
|
cpx #$40
|
||||||
bne !--
|
bne tape_head_align_irq_loop
|
||||||
|
|
||||||
// FALLTROUGH
|
// FALLTROUGH
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user