Tapadjust: Vic-20 head alignment

Basic and Machine Language

Moderator: Moderators

Post Reply
yoyoregime
Vic 20 Newbie
Posts: 7
Joined: Fri Jul 17, 2020 6:25 pm

Tapadjust: Vic-20 head alignment

Post by yoyoregime »

Hi all.

I created Tapadjust, a head alignment program for the Vic-20. It is based on the Micro Head Align program for the C64. I created this for people who are having trouble loading tapes on a Vic-20. There are many programs like this on the C64, but not everybody who has a Vic also has a C64.

Maybe I shouldn't call it a "head alignment program", since the last thing to troubleshoot is the tape head. Tape load errors can be caused by deteriorated tapes, failing circuitry, dirty heads or rusty contacts. However, these sorts of programs can let you know if clean signals are being sent to the Vic-20. For example, one can start troubleshooting errors by comparing the outputs from Vice or a Tapuino, and a real Datassette.

Let me know what you think. This is my first machine language program and it runs on an unexpanded Vic-20. It's saved as a Basic program so that people who only have a Datassette can type it out and run it.

The attached zip file contains a D64, PRG and TXT file of the program.

Cheers
Attachments
tapadjust01.zip
zip containing prg, d64 and txt file of program
(5.03 KiB) Downloaded 93 times
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: Tapadjust: Vic-20 head alignment

Post by chysn »

What about documentation? I'd like to check alignment for my original C1N. When I press play, it draws some lines and stuff on the screen, but what kind of information is this giving me?
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
yoyoregime
Vic 20 Newbie
Posts: 7
Joined: Fri Jul 17, 2020 6:25 pm

Re: Tapadjust: Vic-20 head alignment

Post by yoyoregime »

Good question! I am working on that. There is sparse documentation for these programs even for the C64 versions of these programs.

I have some more information on my blog:
https://theokoulis.com/index.php/2020/1 ... he-vic-20/

I will add more info soon... I learned a lot about reading registers and flags on the Vic-20 so it is a good idea to document this for future reference.

More info to follow soon.

Thanks
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: Tapadjust: Vic-20 head alignment

Post by chysn »

Thanks, that's great information!

I'm sure I have other things to address before I start messing with the azimuth, but this should be a nice diagnostic tool regardless of the cause, right?

My original (childhood) C2N works for some of my old tapes, but not as well as a newer C2N. But I've never degaussed my original, and I've hardly ever cleaned the head. I'll give it a bit of attention, maybe even recap it, and see if I can whip it back into shape. It's all pretty low-risk because my second one works great, and renders (relatively) straight lines with your tool.
yoyoregime
Vic 20 Newbie
Posts: 7
Joined: Fri Jul 17, 2020 6:25 pm

Re: Tapadjust: Vic-20 head alignment

Post by yoyoregime »

That's correct. You can use the program as a diagnostic program. If the output is showing straight clean lines, then bytes are being detected by the Vic-20. A scatter of points is an indication that something is wrong.
User avatar
orion70
VICtalian
Posts: 4337
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Re: Tapadjust: Vic-20 head alignment

Post by orion70 »

Very simple and intuitive (well, once you know what's going on :)) tool. Thanks for that. Judging from the pictures in your blog, I understand that it's a matter not only of "scattered points", but also of how thick the vertical lines are: the thinner, the better. Right?
yoyoregime
Vic 20 Newbie
Posts: 7
Joined: Fri Jul 17, 2020 6:25 pm

Re: Tapadjust: Vic-20 head alignment

Post by yoyoregime »

Thanks, glad you like it. I should really work on some documentation for the program (my actual work is keeping me busy these days... the nerve!!!)

Yes, it's not only a matter of scattering of points. I had a C2N that was so giving me so much trouble, and I really thought the tape head was misaligned. No matter the adjustment of the tape head, I was not able to consistently load from tape.

But then I used the program on: (1) Vice emulator, (2) another c2n that was giving me consistent loads, and (3) the troublesome c2n. I noticed that the lines were much thicker on the troublesome c2n. That got me to look at the electronics. I replaced the electrolytic capacitors, and cleaned out all the left-over crusty flux on my board. In addition, I tried out some of the suggested changes from this memo. That improved the signals, and after a little adjustment of the tape head I am now able to consistently load from tape.
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Tapadjust: Vic-20 head alignment

Post by nippur72 »

very nice tool.

I have a related issue, that is finding the right level when you playback WAV files from the PC to the real VIC (I do that via a car-cassette adapter). I find the volume level is rather critical. I was about to write a tool of my own for that purpose. My idea was to create an audio signal where a fixed 32 bit number is encoded and repeated over and over. The VIC20 could read such number and display on the screen the bit error rate, so that you adjust the playback volume for lowest BER. Perhaps that idea could be also used for head alignment?
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: Tapadjust: Vic-20 head alignment

Post by nbla000 »

Wow, I've just noticed this useful tool!

Finally we have a tape head alignment program for the VIC!
Mega-Cart: the cartridge you plug in once and for all.
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: Tapadjust: Vic-20 head alignment

Post by nbla000 »

yoyoregime wrote:I should really work on some documentation for the program
yoyoregime wrote:it runs on an unexpanded Vic-20
Since I found the program very useful, I've adapted it to work for any memory configuration and I've added instructions/troubleshooting taken from the yoyoregime's blog, it include also a screen output example of a noisy datassette and clean datassette.
Also centered the screen output for both PAL/NTSC systems.

This is the patched yoyoregime code in assembler:

Code: Select all

ScreenAddrTop     = $fb
ScreenAddrBottom  = $fc

org $1D00  ; SYS7424

BLK1_patch = 1  ; 0 produce the original yoyoregime code, 1 the patched version

.1D00:
	;tapadjust 0.1 original code
	JSR $F894
	JSR $E55F
	SEI
	LDY #$7F
	STY $912E
	LDA #$82
	STA $912E
	LDA $911C
	AND #$F1
	ORA #$0C
	STA $911C

#if BLK1_patch == 0
	LDA #$94
	STA $9002
#else
	; Set number of columns, works for all Vic Configurations (Unexpanded, 3K, 8K+)
	lda $9002       ; #36866 bits 0-6 number of columns
			;        bits 7 serves as bit 9 of the 14-bit screen map address used by the VIC chip.
	and #%10000000  ; clean bits 0-6
	ora #%00010100  ; set bits 0-6 for 20 Columns
	sta $9002       ;

	INC $9000
	INC $9000       ; Center X screen (Both PAL/NTSC)
	ldx $288               ; Screen memory page ($1e for unexpanded/3k, $10 for 8k+)
	stx ScreenAddrTop      ; Top Screen memory page ($1e for unexpanded/3k, $10 for 8k+)
	inx
	stx ScreenAddrBottom   ; Bottom Screen memory page ($1f for unexpanded/3k, $11 for 8k+)
#endif

.1D20:
	LDA #$00
	STA $D3
#if BLK1_patch == 0
	LDA #$1E
#else
	LDA ScreenAddrTop
#endif
	STA $D4

.1D28:
	LDA $9004
	BPL .1D28
	LDX #$1E
.1D2F:
	LDY #$00
	LDA #$02
.1D33:
	INY
	BIT $912D
	BEQ .1D33
	LDA $9121
	LDA $900F
	EOR #$02
	STA $900F
	DEX
	CPX #$19
	BCS .1D2F
	CLC
	TYA
	LSR
	LSR
	TAY
	LDA ($D3),Y
	BCS .1D64
	CMP #$20
	BNE .1D5B
	LDA #$61
	JMP .1D73
.1D5B:
	CMP #$E1
	BNE .1D75
	LDA #$A0
	JMP .1D73
.1D64:
	CMP #$20
	BNE .1D6D
	LDA #$E1
	JMP .1D73
.1D6D:
	CMP #$61
	BNE .1D75
	LDA #$A0
.1D73:
	STA ($D3),Y
.1D75:
	CPX #$00
	BNE .1D2F
	LDA #$0B
	STA $900F
	LDA $D3
	CLC
	ADC #$14
	STA $D3
	BCC .1D89
	INC $D4
.1D89:
	LDA $D4
#if BLK1_patch == 0
	CMP #$1F
#else
	CMP ScreenAddrBottom ; Screen memory page to check ($1f for unexpanded/3k, $11 for 8k+)
#endif

	BEQ .1D93
	BCS .1D99
	BCC .1D28
.1D93:
	LDA $D3
	CMP #$CC
	BCC .1D28
.1D99:
	TSX
.1D9A:
	JSR $EF96
	DEX
	BNE .1D9A
	JSR $E55F
	JMP .1D20
tapadjust01b-1.png
tapadjust01b-1.png (16.45 KiB) Viewed 594 times
tapadjust01b-2.png
tapadjust01b-2.png (29.43 KiB) Viewed 594 times
tapadjust01b-3.png
tapadjust01b-3.png (30.91 KiB) Viewed 594 times
tapadjust01b-4.png
tapadjust01b-4.png (31.88 KiB) Viewed 594 times
tapadjust01b-5.png
tapadjust01b-5.png (13.4 KiB) Viewed 594 times
tapadjust01b-6.png
tapadjust01b-6.png (11.36 KiB) Viewed 594 times
tapadjust01b-7.png
tapadjust01b-7.png (9.99 KiB) Viewed 594 times
Attachments
tapadjust01b.zip
(1.71 KiB) Downloaded 46 times
Mega-Cart: the cartridge you plug in once and for all.
User avatar
orion70
VICtalian
Posts: 4337
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Re: Tapadjust: Vic-20 head alignment

Post by orion70 »

Very useful, thanks for having patched and provided instructions for it.
Post Reply