|
DataMuseum.dkPresents historical artifacts from the history of: Jet Computer Jet80 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Jet Computer Jet80 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 1792 (0x700) Types: TextFile Names: »MPRR.MAC«
└─⟦01b5c9619⟧ Bits:30005906 Microsoft Multiplan v1.05 og HELP └─ ⟦this⟧ »MPRR.MAC«
; ; ; Title Multiple-Precision Rotate Right ; Name: MPRR ; ; ; Purpose: Rotate right a multi-byte operand N bits ; ; Entry: Register pair HL = base address of operand ; Register B = lenght of operand in bytes ; Register C = number of bits to rotate ; ; The operand is stored with ARRAYÆ0Å as its ; least significant byte and ARRAYÆLENGHT-1Å ; its most significant byte, where ARRAY ; is its base address. ; ; Exit: Operand rotated right ; CARRY := last bit shifted from least ; significant position ; ; Registers used: AF,BC,DE,HL ; ; Time: 83 cycles overhead plus ; ((34 * lenght) + 58) cycles per rotate ; ; Size: Program 33 bytes ; ; ; MPRR: ;Exit if number of rotates or lenght of operand is 0 ;Or clears carry in eighter case ld a,c or a ret z ;Return if number of rotates is 0 ld a,b or a ret z ;Return if lenght of operand is 0 ;Calculate address of most significant (last) byte push hl pop ix ;IX points to LSB (first byte) ld e,b ;Address of MSB = base + lenght - 1 ld d,0 add hl,de dec hl ;HL points to MSB (last byte) ;C = number of rotates ;A = lenght of operand ;Loop on number of rotates to perform ;CARRY = least significant bit of entire operand loop: ld b,(ix+0) ;Get LSB rr b ;CARRY = bit 0 of LSB ld b,a ;B = lenght of operand in bytes ld e,l ;Save address of MSB ld d,h ;Rotate bytes right starting with most significant rrlp: rr (hl) ;Rotate a byte right dec hl ;Decrement to less significant byte djnz rrlp ld l,e ;Restore address of MSB ld h,d dec c ;Decrement number of rotates jr nz,loop ret «eof»