How To Read Hex Values for Mask Functions

Software questions and issues with the FV-1

Moderator: frank

Post Reply
HammerheadAudio
Posts: 11
Joined: Wed Apr 14, 2021 3:19 pm

How To Read Hex Values for Mask Functions

Post by HammerheadAudio »

Hi, I am currently analyzing a reverse delay program (found here, thanks forum user igorp: http://www.spinsemi.com/forum/viewtopic ... 0&start=30), and the question came up of how to translate hex values given as opcode arguments to more human readable decimal integers / floating points. I am specifically looking at the section here:

Code: Select all

;{ REVERSE read
	or 	0xFFFE00
	rdax	ad_reg , 1
	skp 	gez , ok1
	ldax	ad_fbk
	wrax	ad_reg , 1
ok1:
	and	0x7FFFFF

	wrax	ad_reg ,  -1   	; +1 = орган, -1 = обратка (+1 = octave up , -1 = reverse read)
	wrax	addr_ptr,   0   ; посчитать кроссфэйд . Если адрес 32767-256 или 0..256 - убавлять громкость.
				; здесь отмасштабировать память 
	rmpa	1
	mulx	f5
	wrax	out_bwd , 0
;}
The 'or' opcode here is clearly being used to insert a specific value into the accumulator, and I it looks like the 'and' opcode is being used to invert the sign of the accumulator (force it to positive?). I've looked in the FV-1 datasheet / programming guide for how to read the hex values and can't find anything on the subject. What do the values 0xFFFE00 and 0x7FFFFF correspond to, and what is the general rule for how hex values are read by the accumulator?
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Re: How To Read Hex Values for Mask Functions

Post by frank »

It all depends on how the value is used. In the OR case 0xFFFE00 is loaded into the ACC but what that means depends on the next instructions. In this case it is a RDAX so the instruction considers values in the S.23 format for the ACC, the value 0xFFFE00 is in 2's comp and range -1.0 to (almost)+1.0 so the decimal equivalent is -3.052E-05 but that doesn't really mean anything here as it appears they are actually manipulating an address pointer so they appear to be subtracting 1/32768 from ad_reg to decrement a pointer.

So no simple answer, you have to look at the surrounding code and understand what the code is trying to do. Writing the value as decimal wouldn't help make it any clearer, writing as a fraction like -1/32768 may make it clearer but you risk rounding issues in the assembler as it solves the fraction. Writing in hex allows the coder to control it to the lsb and avoid rounding errors.
Frank Thomson
Experimental Noize
Post Reply