Добавлено: 01 фев 2017, 17:35
shiny
Titus, ходи сюда. Поясни плз, в чем разница умножения?
1.
;A=E*D
LD A,E:XOR D:AND #80
EXA
bit 7,e:jr z,no_e
ld a,e:neg:ld e,a
no_e:
bit 7,d:jr z,no_d
ld a,d:neg:ld d,a
no_d:
xor a
dup 8
RR E:JR NC,$+3:ADD A,D:RRA
edup
EXA
JR Z,ALLPL
EXA
NEG
EXA
ALLPL EXA
RET
2.
; IN : E and D are to be multiplied
; OUT: HL is result
; CHANGES : AF,BC,E,HL
;
;LDE,A
ld a,e
SUBD
LDH,MULTAB/256
LDL,A
LDC,(HL)
INCH
LDB,(HL)
LDA,E
ADDA,D
LDL,A
LDE,(HL)
DECH
LDL,(HL)
LDH,E
ORA
SBCHL,BC
ld a,l
RET
ORG #8000
;ML-listing: MULTAB.ASC
MULTABDB0, 0, 1, 2, 4, 6, 9, 12, 16, 20
DB25, 30, 36, 42, 49, 56, 64, 72, 81, 90
DB100, 110, 121, 132, 144, 156, 169, 182, 196, 210
DB225, 240, 0, 16, 33, 50, 68, 86, 105, 124
DB144, 164, 185, 206, 228, 250, 17, 40, 64, 88
DB113, 138, 164, 190, 217, 244, 16, 44, 73, 102
DB132, 162, 193, 224, 0, 32, 65, 98, 132, 166
DB201, 236, 16, 52, 89, 126, 164, 202, 241, 24
DB64, 104, 145, 186, 228, 14, 57, 100, 144, 188
DB233, 22, 68, 114, 161, 208, 0, 48, 97, 146
DB196, 246, 41, 92, 144, 196, 249, 46, 100, 154
DB209, 8, 64, 120, 177, 234, 36, 94, 153, 212
DB16, 76, 137, 198, 4, 66, 129, 192
DB0, 192, 129, 66, 4, 198, 137, 76, 16, 212
DB153, 94, 36, 234, 177, 120, 64, 8, 209, 154
DB100, 46, 249, 196, 144, 92, 41, 246, 196, 146
DB97, 48, 0, 208, 161, 114, 68, 22, 233, 188
DB144, 100, 57, 14, 228, 186, 145, 104, 64, 24
DB241, 202, 164, 126, 89, 52, 16, 236, 201, 166
DB132, 98, 65, 32, 0, 224, 193, 162, 132, 102
DB73, 44, 16, 244, 217, 190, 164, 138, 113, 88
DB64, 40, 17, 250, 228, 206, 185, 164, 144, 124
DB105, 86, 68, 50, 33, 16, 0, 240, 225, 210
DB196, 182, 169, 156, 144, 132, 121, 110, 100, 90
DB81, 72, 64, 56, 49, 42, 36, 30, 25, 20
DB16, 12, 9, 6, 4, 2, 1, 0
DB0, 0, 0, 0, 0, 0, 0, 0, 0, 0
DB0, 0, 0, 0, 0, 0, 0, 0, 0, 0
DB0, 0, 0, 0, 0, 0, 0, 0, 0, 0
DB0, 0, 1, 1, 1, 1, 1, 1, 1, 1
DB1, 1, 1, 1, 1, 1, 2, 2, 2, 2
DB2, 2, 2, 2, 2, 2, 3, 3, 3, 3
DB3, 3, 3, 3, 4, 4, 4, 4, 4, 4
DB4, 4, 5, 5, 5, 5, 5, 5, 5, 6
DB6, 6, 6, 6, 6, 7, 7, 7, 7, 7
DB7, 8, 8, 8, 8, 8, 9, 9, 9, 9
DB9, 9, 10, 10, 10, 10, 10, 11, 11, 11
DB11, 12, 12, 12, 12, 12, 13, 13, 13, 13
DB14, 14, 14, 14, 15, 15, 15, 15
DB16, 15, 15, 15, 15, 14, 14, 14, 14, 13
DB13, 13, 13, 12, 12, 12, 12, 12, 11, 11
DB11, 11, 10, 10, 10, 10, 10, 9, 9, 9
DB9, 9, 9, 8, 8, 8, 8, 8, 7, 7
DB7, 7, 7, 7, 6, 6, 6, 6, 6, 6
DB5, 5, 5, 5, 5, 5, 5, 4, 4, 4
DB4, 4, 4, 4, 4, 3, 3, 3, 3, 3
DB3, 3, 3, 2, 2, 2, 2, 2, 2, 2
DB2, 2, 2, 1, 1, 1, 1, 1, 1, 1
DB1, 1, 1, 1, 1, 1, 1, 0, 0, 0
DB0, 0, 0, 0, 0, 0, 0, 0, 0, 0
DB0, 0, 0, 0, 0, 0, 0, 0, 0, 0
DB0, 0, 0, 0, 0, 0, 0, 0