User Tools

A PCRE internal error occured. This might be caused by a faulty plugin

====== Function DPB ====== ====Syntax==== * **dpb** //newbyte bytespec integer// → //result-integer// ====Arguments and Values==== * //newbyte// - an //[[CL:Glossary:integer]]//. * //bytespec// - a //[[CL:Glossary:byte specifier]]//. * //integer// - an //[[CL:Glossary:integer]]//. * //result-integer// - an //[[CL:Glossary:integer]]//. ====Description==== **dpb** (deposit byte) is used to replace a field of bits within //integer//. **dpb** returns an //[[CL:Glossary:integer]]// that is the same as //integer// except in the bits specified by //bytespec//. Let ''s'' be the size specified by //bytespec//; then the low ''s'' bits of //newbyte// appear in the result in the byte specified by //bytespec//. //newbyte// is interpreted as being right-justified, as if it were the result of **[[CL:Functions:ldb]]**. ====Examples==== <blockquote> (dpb 1 ([[CL:Functions:byte]] 1 10) 0) <r>1024</r> (dpb -2 ([[CL:Functions:byte]] 2 10) 0) <r>2048</r> (dpb 1 ([[CL:Functions:byte]] 2 10) 2048) <r>1024</r> </blockquote> ====Side Effects==== None. ====Affected By==== None. ====Exceptional Situations==== None. ====See Also==== * **[[CL:Functions:byte|Function BYTE]]** * **[[CL:Functions:deposit-field|Function DEPOSIT-FIELD]]** * **[[CL:Functions:ldb|Function LDB]]** ====Notes==== <blockquote> ([[CL:Functions:logbitp]] //j// (dpb //m// ([[CL:Functions:byte]] //s// //p//) //n//)) ≡ ([[CL:Special Operators:if]] ([[CL:Macros:and]] ([[CL:Functions:math-not-less|>=]] //j// //p//) ([[CL:Functions:math-less|<]] //j// (+ //p// //s//))) ([[CL:Functions:logbitp]] (- //j// //p//) //m//) ([[CL:Functions:logbitp]] //j// //n//)) </blockquote> In general: <blockquote> (dpb //x// ([[CL:Functions:byte]] 0 //y//) //z//) <r>//z//</r> </blockquote> for all valid values of //x//, //y//, and //z//. Historically, the name "dpb" comes from a DEC PDP-10 assembly language instruction meaning "deposit byte."