|
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: 1280 (0x500) Types: TextFile Names: »MPDSUB.MAC«
└─⟦01b5c9619⟧ Bits:30005906 Microsoft Multiplan v1.05 og HELP └─ ⟦this⟧ »MPDSUB.MAC«
; ; ; Title Multiple-Precision Decimal Subtraction ; Name: MPDSUB ; ; ; Purpose: Subtract 2 arrays of BCD bytes ; Minuend = minuend - subtrahend ; ; Entry: Register pair HL = Base address of minuend ; Register pair DE = Base address of subtrahend ; Register B = Lenght of array in bytes ; ; The array are unsigned BCD numbers with a ; maximum lenght of 255 bytes, ARRAYÆ0Å is the ; least significant byte, and ARRAYÆLENGHT-1Å ; the most significant byte. ; ; Exit: Minuend := minuend - subtrahend ; ; Registers used: AF,B,DE,HL ; ; Time: 50 cycles per byte plus 22 cycles overhead ; ; Size: Program 13 bytes ; ; ; MPDSUB: ;Test array lenght for zero, clear carry ld a,b or a ;Test array lenght, clear carry ret z ;Exit if lenght is 0 ex de,hl ;HL = Subtrahend ;DE = Minuend ;Subtract operands 2 digits at a time ; note carry is initialy 0 loop: ld a,(de) ;Get byte of minuend sbc a(hl) ;Subtract byte of subtrahend daa ;Change to Decimal ld (de),a ;Store byte of difference inc hl ;Increment to next byte inc de djnz loop ;Continue until all bytes subtracted ret «eof»