File tree 1 file changed +66
-4
lines changed
1 file changed +66
-4
lines changed Original file line number Diff line number Diff line change @@ -554,7 +554,66 @@ Flags:
554
554
1
555
555
.El
556
556
.Ss DAA
557
- Decimal Adjust Accumulator to get a correct BCD representation after an arithmetic instruction.
557
+ Decimal Adjust Accumulator.
558
+ .Pp
559
+ Designed to be used after performing an arithmetic instruction
560
+ .Pq Sy ADD , ADC , SUB , SBC
561
+ whose inputs were in Binary-Coded Decimal (BCD), adjusting the result to likewise be in BCD.
562
+ .Pp
563
+ The exact behavior of this instruction is as follows:
564
+ .Bl -tag -width Ds -offset indent
565
+ .It If the subtract flag Sy N No is set:
566
+ .Bl -enum -compact
567
+ .It
568
+ Initialize the adjustment to 0.
569
+ .It
570
+ If the half-carry flag
571
+ .Sy H
572
+ is set, then add
573
+ .Ad $6
574
+ to the adjustment.
575
+ .It
576
+ If the carry flag is set, then add
577
+ .Ad $60
578
+ to the adjustment.
579
+ .It
580
+ Subtract the adjustment from
581
+ .Sy A .
582
+ .It
583
+ Set the carry flag if borrow (i.e. if adjustment >
584
+ .Sy A ) .
585
+ .El
586
+ .It If the subtract flag Sy N No is not set:
587
+ .Bl -enum -compact
588
+ .It
589
+ Initialize the adjustment to 0.
590
+ .It
591
+ If the half-carry flag
592
+ .Sy H
593
+ is set or
594
+ .Sy A
595
+ &
596
+ .Ad $F
597
+ >
598
+ .Ad $9 ,
599
+ then add
600
+ .Ad $6
601
+ to the adjustment.
602
+ .It
603
+ If the carry flag is set or
604
+ .Sy A
605
+ >
606
+ .Ad $9F ,
607
+ then add
608
+ .Ad $60
609
+ to the adjustment.
610
+ .It
611
+ Add the adjustment to
612
+ .Sy A .
613
+ .It
614
+ Set the carry flag if overflow from bit 7.
615
+ .El
616
+ .El
558
617
.Pp
559
618
Cycles: 1
560
619
.Pp
@@ -1072,11 +1131,14 @@ Bytes: 3
1072
1131
Flags: None affected.
1073
1132
.Ss LD [n16],SP
1074
1133
Store
1075
- .Sy SP & $FF
1134
+ .Sy SP
1135
+ &
1136
+ .Ad $FF
1076
1137
at address
1077
1138
.Ar n16
1078
1139
and
1079
- .Sy SP >> 8
1140
+ .Sy SP
1141
+ >> 8
1080
1142
at address
1081
1143
.Ar n16
1082
1144
+ 1.
@@ -1859,7 +1921,7 @@ Set if result is 0.
1859
1921
.It Sy H
1860
1922
Set if borrow from bit 4.
1861
1923
.It Sy C
1862
- Set if borrow (set if
1924
+ Set if borrow (i.e. if
1863
1925
.Ar r8
1864
1926
>
1865
1927
.Sy A ) .
You can’t perform that action at this time.
0 commit comments