music |
| | OSdata.com |
transfer functions
summary
A transfer function is used to transfer information between variables of different types.
Many older programming languages refer to these as type conversions, data conversions, or just, conversions.
stub section
This subchapter is a stub section. It will be filled in with instructional material later. For now it serves the purpose of a place holder for the order of instruction.
Professors are invited to give feedback on both the proposed contents and the propsed order of this text book. Send commentary to Milo, PO Box 1361, Tustin, California, 92781, USA.
transfer functions
This subchapter looks at transfer functions.
A transfer function is used to transfer information between variables of different types.
Many older programming languages refer to these as type conversions, data conversions, or just, conversions.
integer and real transfers
entier(E) ALGOL-60 library function that returns the largest integer not greater than the expression.
INT(x) BASIC library function that returns the integer portion of an expression. The result is the largest whole number (integer) that is not greater than the expression.
integer and character/string transfers
VAL(x) BASIC library function that returns the integer value of a character string or expression. Note that some versions of VAL will strip out leading blanks..
CHR$(x) BASIC library function that returns the single element character string containing the ASCII character equivalent of an integer expression in the range of 0 to 255.
char(x) Pascal standard function that returns the CHAR character that matches the position in the collating sequence of an argument x.
ASC(x) BASIC library function that returns the decimal ASCII value of a string variable..
The following material is from the unclassified Computer Programming Manual for the JOVIAL (J73) Language, RADC-TR-81-143, Final Technical Report of June 1981.
Since JOVIAL has quite a few kinds of values, it must have many
ways of converting one kind of value into another kind. In most
cases, you must explicitly indicate the conversion. An example
is:
ITEM MARK U 10;
ITEM TIME F;
...
MARK = (* U 16 *) (TIME);
The value of the floating item TIME is converted to a ten-bit
integer value before it is assigned to the ten-bit integer item
MARK. If you leave the conversion operator out of this
assignment, the compiler will report an error. The compiler
catches situations in which one type of value is uninetentionally
assigned to or combined with a different type of variable.
Chapter 1 Introduction, page 7
assembly language instructions
Data conversion instructions change data from one format to another.
A sign extension operation takes a small value and sign extends it to a larger storage format (such as byte to word).
A type conversion operation changes data from one format to another (such as signed twos complement integer into binary coded decimal).
- EXT Sign Extend; Motorola 680x0, Motorola 68300; sign extends a byte (8 bits) in a data register to a word (16 bits) or sign extends a word (16 bits) in a data register to a longword (32 bits); sets or clears flags
- CVT Convert; DEC VAX; converts a signed quantity to a different signed data type, source and destination in register or memory, special rounded versions for certain floating conversions; sets or clears flags
- CVTBW Convert Byte to Word; sign extend
- CVTBL Convert Byte to Long; sign extend
- CVTWB Convert Word to Byte; truncated
- CVTWL Convert Word to Long; sign extend
- CVTLB Convert Long to Byte; truncated
- CVTLW Convert Long to Word; truncated
- CVTBF Convert Byte to Floating; exact
- CVTBD Convert Byte to Double float; exact
- CVTWF Convert Word to Floating; exact
- CVTWD Convert Word to Double float; exact
- CVTLF Convert Long to Floating; rounded
- CVTLD Convert Long to Double float; exact
- CVTFB Convert Floating to Byte; truncated
- CVTDB Convert Double float to Byte; truncated
- CVTFW Convert Floating to Word; truncated
- CVTDW Convert Double float to Word; truncated
- CVTFL Convert Floating to Long; truncated
- CVTRFL Convert Rounded Floating to Long; rounded
- CVTDL Convert Double float to Long; truncated
- CVTRDL Convert Rounded Double float to Long; rounded
- CVTFD Convert Floating to Double float; exact
- CVTDF Convert Double float to Floating; rounded
- CBW Convert Byte to Word; Intel 80x86; sign extends a byte (8 bits) in register AL to create a word (16 bits) in the AX register; does not affect flags
- CWD Convert Word to Doubleword; Intel 80x86; sign extends a word (16 bits) in register AX throughout the DX register to create a doubleword (32 bits); does not affect flags
- CWDE Convert Word to Doubleword Extended; Intel 80386; sign extends a word (16 bits) in register AX to create a doubleword (32 bits) in the EAX register; does not affect flags
- CDQ Convert Doubleword to Quadword; Intel 80386; sign extends a doubleword (32 bits) in register EAX to create a quadword (64 bits) in the EDX register; does not affect flags
- EXTB Sign Extend Byte; Motorola 680x0, Motorola 68300; sign extends a byte (8 bits) in a data register to a longword (32 bits); sets or clears flags
- MOVSX Move with Sign Extension; Intel 80x86; moves data from a register or memory to a register, with a sign extension (conversion to larger binary integer: byte to word, byte to doubleword, or word to doubleword); does not affect flags
- MOVZX Move with Zero Extension; Intel 80x86; moves data from a register or memory to a register, with a zero extension (conversion to larger binary integer: byte to word, byte to doubleword, or word to doubleword); does not affect flags
- MOVZ Move Zero Extended; DEC VAX; converts an unsigned integer to a larger unsigned integer, source and destination in register or memory (MOVZBW Byte to Word, MOVZBL Byte to Long, MOVZWL Word to Long); sets or clears flags
- NUM Convert to Numeric; MIX; converts byte encoded character code (MIX character code) in A-register/X-register pair to numeric data in the A-register (accumulator), does not change sign, overflow possible
- CHAR Convert to Characters; MIX; converts numeric data in the A-register (accumulator) into byte encoded character code (MIX character code) in A-register/X-register pair, does not change signs
- PACK Pack; Motorola 680x0; converts byte encoded numeric data (such as ASCII or EBCDIC characters) into binary coded decimals using an adjustment field ($3030 for ASCII, $F0F0 for EBCDIC), either from data register to data register or memory location to memory location with predecrement of address pointers; does not modify flags
- UNPK Unpack; Motorola 680x0; converts binary coded decimals into byte encoded numeric data (such as ASCII or EBCDIC characters) using an adjustment field ($3030 for ASCII, $F0F0 for EBCDIC), either from data register to data register or memory location to memory location with predecrement of address pointers; does not modify flags
See also Data Conversion Instructions in Assembly Language
free music player coding example
Coding example: I am making heavily documented and explained open source code for a method to play music for free almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).
View music player in action: www.musicinpublic.com/.
Create your own copy from the original source code/ (presented for learning programming).
Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.
Names and logos of various OSs are trademarks of their respective owners.