summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Smith2010-06-18 17:51:15 -0700
committerDuncan Smith2010-06-18 17:51:15 -0700
commita8c9d587df6b451656cceab48efb8c1667f19d67 (patch)
treecff7301488816b9ffd167986cec80aa89c8dbe25
parentc1ec4ca955149302b44a77d2a5405379dd64160f (diff)
Pseudocode for the carry generator written
-rw-r--r--flags.asm22
1 files changed, 19 insertions, 3 deletions
diff --git a/flags.asm b/flags.asm
index 0dceb2a..a718a42 100644
--- a/flags.asm
+++ b/flags.asm
@@ -100,6 +100,22 @@ f_calc_parity:
;; Routine to make both the Carry and Half-Carry flags valid.
f_calc_carries:
;; XXX do this
+ ;; if f_tmp_byte == 0 {
+ ;; return, shit is valid
+ ;; } else if f_tmp_byte == 1 {
+ ;; // it's a word
+ ;; add f_tmp_src_w to f_tmp_dst_w
+ ;; low bytes only, create a carry and save
+ ;; then high bytes, create a carry and output
+ ;; then 3rd nibble, create a half-carry and output
+ ;; } else if f_tmp_byte == 2 {
+ ;; // it's a byte
+ ;; add f_tmp_src_b to f_tmp_dst_b
+ ;; create a carry and output
+ ;; add low nybbles only
+ ;; create a half-carry and output
+ ;; }
+ ;; set f_tmp_byte = 0
rts
;; Normalize and return Sign bit (loaded into Z bit).
@@ -136,9 +152,9 @@ flags_all:
rts
flag_storage:
- ;; Numbers in comments are offsets from flag_storage, so use
- ;; offset(a3) to address.
- ;; 1 if tmp_???b is valid, 0 if tmp_???w is valid
+ ;; 0 if the flag is already valid
+ ;; 1 if tmp_???b is valid
+ ;; 2 if tmp_???w is valid
f_tmp_byte: dc.b 0
;; 2 if P is 0, 3 if P is 1, 4 if P is Parity, 5 if P is oVerflow
f_tmp_p_type: dc.b 0