Routines
| Prev: DB64 | Up: Map | Next: DBF7 |
DB67: Read an amount of pre-decimal money
|
'£n' gives pounds; then 'nS' is shillings, 'nD' pence, and 'n/m' shillings and pence ('n/-' for none). The total is worked out in pence - (pounds x 20 + shillings) x 12 + pence - and packed into BC seven bits per byte with bit 7 of both bytes set, which is what tells a sum of money from a time (requirement code 6, PAY TO, wants bit 7 set in the low byte; code 5, WAIT UNTIL, wants it clear).
|
||||||||||||||||
| DB67 | INC HL | After the '£' | ||||||||||||||
| DB68 | CALL $DBF7 | Call the routine "Read a decimal number at HL into A" (DBF7) - Pounds | ||||||||||||||
| DB6B | LD ($DB64),A | Store A in "Pounds, shillings and pence" (DB64) | ||||||||||||||
| DB6E | XOR A | Clear A to zero (and the carry flag) | ||||||||||||||
| DB6F | LD ($DB65),A | Store A in DB65 in "Pounds, shillings and pence" | ||||||||||||||
| DB72 | LD ($DB66),A | Store A in DB66 in "Pounds, shillings and pence" | ||||||||||||||
| DB75 | INC HL | Step HL on to the next byte | ||||||||||||||
| DB76 | LD A,(HL) | Read the byte HL points at into A | ||||||||||||||
| DB77 | CALL $DAE8 | Call the routine "Is A a digit? (carry if not)" (DAE8) | ||||||||||||||
| DB7A | DEC HL | Step HL back one byte | ||||||||||||||
| DB7B | JR C,$DBC0 | If the carry flag is set, jump on to DBC0 | ||||||||||||||
| DB7D | INC HL | Step HL on to the next byte | ||||||||||||||
| DB7E | CALL $DBF7 | Call the routine "Read a decimal number at HL into A" (DBF7) | ||||||||||||||
| DB81 | LD B,A | Copy A into B | ||||||||||||||
| DB82 | JR $DB88 | Skip ahead to DB88 | ||||||||||||||
|
This entry point is used by the routine at DAEF.
|
||||||||||||||||
| DB84 | XOR A | Clear A to zero (and the carry flag) - No pounds | ||||||||||||||
| DB85 | LD ($DB64),A | Store A in "Pounds, shillings and pence" (DB64) | ||||||||||||||
| DB88 | XOR A | Clear A to zero (and the carry flag) | ||||||||||||||
| DB89 | LD ($DB65),A | Store A in DB65 in "Pounds, shillings and pence" | ||||||||||||||
| DB8C | LD ($DB66),A | Store A in DB66 in "Pounds, shillings and pence" | ||||||||||||||
| DB8F | LD A,(HL) | Read the byte HL points at into A - S: shillings | ||||||||||||||
| DB90 | CP $53 | Compare A with $53 | ||||||||||||||
| DB92 | JR NZ,$DB9A | If A differs from $53, skip ahead to DB9A | ||||||||||||||
| DB94 | LD A,B | Copy B into A | ||||||||||||||
| DB95 | LD ($DB65),A | Store A in DB65 in "Pounds, shillings and pence" | ||||||||||||||
| DB98 | JR $DBBF | Skip ahead to DBBF | ||||||||||||||
| DB9A | CP $44 | Compare A with $44 - D: pence | ||||||||||||||
| DB9C | JR NZ,$DBA4 | If A differs from $44, skip ahead to DBA4 | ||||||||||||||
| DB9E | LD A,B | Copy B into A | ||||||||||||||
| DB9F | LD ($DB66),A | Store A in DB66 in "Pounds, shillings and pence" | ||||||||||||||
| DBA2 | JR $DB98 | Go back to DB98 | ||||||||||||||
| DBA4 | CP $2F | Compare A with $2F - /: shillings, then pence or - | ||||||||||||||
| DBA6 | JR NZ,$DB4F | If A differs from $2F, go back to DB4F | ||||||||||||||
| DBA8 | LD A,B | Copy B into A | ||||||||||||||
| DBA9 | LD ($DB65),A | Store A in DB65 in "Pounds, shillings and pence" | ||||||||||||||
| DBAC | INC HL | Step HL on to the next byte | ||||||||||||||
| DBAD | LD A,(HL) | Read the byte HL points at into A | ||||||||||||||
| DBAE | CP $2D | Compare A with $2D | ||||||||||||||
| DBB0 | JR Z,$DBBF | If A equals $2D, skip ahead to DBBF | ||||||||||||||
| DBB2 | CALL $DAE8 | Call the routine "Is A a digit? (carry if not)" (DAE8) | ||||||||||||||
| DBB5 | JR C,$DB4F | If the carry flag is set, go back to DB4F | ||||||||||||||
| DBB7 | CALL $DBF7 | Call the routine "Read a decimal number at HL into A" (DBF7) | ||||||||||||||
| DBBA | LD ($DB66),A | Store A in DB66 in "Pounds, shillings and pence" | ||||||||||||||
| DBBD | JR $DBC0 | Skip ahead to DBC0 | ||||||||||||||
| DBBF | INC HL | Step HL on to the next byte | ||||||||||||||
| DBC0 | PUSH HL | Save HL on the stack - Total in pence: pounds x 20... | ||||||||||||||
| DBC1 | LD A,($DB64) | Read "Pounds, shillings and pence" (DB64) into A | ||||||||||||||
| DBC4 | LD L,A | Copy A into L | ||||||||||||||
| DBC5 | LD H,$00 | Load H with $00 | ||||||||||||||
| DBC7 | ADD HL,HL | Double HL (shift it left one bit) | ||||||||||||||
| DBC8 | ADD HL,HL | Double HL (shift it left one bit) | ||||||||||||||
| DBC9 | LD E,L | Copy L into E | ||||||||||||||
| DBCA | LD D,H | Copy H into D | ||||||||||||||
| DBCB | ADD HL,HL | Double HL (shift it left one bit) | ||||||||||||||
| DBCC | ADD HL,HL | Double HL (shift it left one bit) | ||||||||||||||
| DBCD | ADD HL,DE | Add DE to HL | ||||||||||||||
| DBCE | LD A,($DB65) | Read DB65 in "Pounds, shillings and pence" into A - ...plus shillings... | ||||||||||||||
| DBD1 | LD E,A | Copy A into E | ||||||||||||||
| DBD2 | LD D,$00 | Load D with $00 | ||||||||||||||
| DBD4 | ADD HL,DE | Add DE to HL | ||||||||||||||
| DBD5 | ADD HL,HL | Double HL (shift it left one bit) - ...times 12... | ||||||||||||||
| DBD6 | ADD HL,HL | Double HL (shift it left one bit) | ||||||||||||||
| DBD7 | LD E,L | Copy L into E | ||||||||||||||
| DBD8 | LD D,H | Copy H into D | ||||||||||||||
| DBD9 | ADD HL,HL | Double HL (shift it left one bit) | ||||||||||||||
| DBDA | ADD HL,DE | Add DE to HL | ||||||||||||||
| DBDB | LD A,($DB66) | Read DB66 in "Pounds, shillings and pence" into A - ...plus pence | ||||||||||||||
| DBDE | LD E,A | Copy A into E | ||||||||||||||
| DBDF | LD D,$00 | Load D with $00 | ||||||||||||||
| DBE1 | ADD HL,DE | Add DE to HL | ||||||||||||||
| DBE2 | EX (SP),HL | Swap HL with the word on top of the stack | ||||||||||||||
| DBE3 | POP BC | Restore BC from the stack | ||||||||||||||
| DBE4 | LD A,B | Copy B into A - Too much? | ||||||||||||||
| DBE5 | CP $40 | Compare A with $40 | ||||||||||||||
| DBE7 | JP NC,$DB4F | If A is $40 or more, go back to DB4F | ||||||||||||||
| DBEA | SLA C | Shift C left (double it) - Pack it: 7 bits a byte, bit 7 set in both | ||||||||||||||
| DBEC | RL B | Rotate B left through the carry | ||||||||||||||
| DBEE | SRL C | Shift C right (halve it) | ||||||||||||||
| DBF0 | SET 7,C | Set bit 7 of C | ||||||||||||||
| DBF2 | SET 7,B | Set bit 7 of B | ||||||||||||||
| DBF4 | JP $DB3D | Go back to DB3D | ||||||||||||||
| Prev: DB64 | Up: Map | Next: DBF7 |