From: Bernard Blackham Date: Sun, 3 Aug 2003 16:14:59 +0000 (+0000) Subject: long math discoveries! X-Git-Tag: ROMW~117 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=3bff8d09599d85b76a54a7f328bdcbd3b6c3b32c;p=uccvend-snackrom.git long math discoveries! --- diff --git a/ROM-2003/vend.asm b/ROM-2003/vend.asm index 0757d0a..38c7145 100644 --- a/ROM-2003/vend.asm +++ b/ROM-2003/vend.asm @@ -42,9 +42,8 @@ ;0054 0..100 ;0056 last known keypad row 1 state ;005b last known keypad row 0 state -;005d dollars -;005e Y in location XY (row?) cents1 -;005f X in location XY (column?) cents2 +;005a - result of number to string operations (jump55) +; 005f ;0073 ;0076-0077 word ;007f @@ -4047,6 +4046,7 @@ A2D2 38 8 pulx A2D3 39 9 rts jump79: +; displays a price on screen? A2D4 37 7 pshb A2D5 36 6 psha A2D6 30 0 tsx @@ -4067,12 +4067,12 @@ A2FB E6 05 .. ldab 05,x A2FD 27 14 '. beq 14 A2FF F6 00 17 ... ldab 0017 A302 C4 08 .. andb #08 -A304 26 05 &. bne 05 -A306 C6 24 .$ ldab #24 +A304 26 05 &. bne 05 ; to a30b +A306 C6 24 .$ ldab #24 ; "$" A308 F7 0B 95 ... stab 0b95 A30B CC 00 01 ... ldd #0001 A30E BD A2 5C ..\ jsr a25c ;jump82 -A311 20 05 . bra 05 +A311 20 05 . bra 05 ; return A313 5F _ clrb A314 4F O clra A315 BD A2 5C ..\ jsr a25c ;jump82 @@ -4113,12 +4113,12 @@ A349 36 6 psha A34A EC 02 .. ldd 02,x A34C BD E6 21 ..! jsr e621 ;jump56 A34F 38 8 pulx -A350 C6 20 . ldab #20 +A350 C6 20 . ldab #20 ; " " A352 F7 0B 99 ... stab 0b99 A355 F6 00 17 ... ldab 0017 A358 C4 08 .. andb #08 A35A 26 05 &. bne 05 -A35C C6 24 .$ ldab #24 +A35C C6 24 .$ ldab #24 ; "$" A35E F7 0B 98 ... stab 0b98 A361 CC 00 01 ... ldd #0001 A364 BD A2 5C ..\ jsr a25c ;jump82 @@ -12993,6 +12993,7 @@ E61D F7 00 31 ..1 stab 0031 E620 39 9 rts jump56: +; writes a really big number to the display E621 38 8 pulx E622 37 7 pshb E623 36 6 psha @@ -13005,14 +13006,15 @@ E62C 36 6 psha E62D EC 02 .. ldd 02,x E62F 37 7 pshb E630 36 6 psha -E631 CE 96 80 ... ldx #9680 +E631 CE 96 80 ... ldx #9680 ;38528 E634 3C < pshx -E635 CC 00 98 ... ldd #0098 +E635 CC 00 98 ... ldd #0098 ;152 E638 BD FC 4C ..L jsr fc4c ;jump83 E63B 31 1 ins E63C 33 3 pulb -E63D CB 30 .0 addb #30 +E63D CB 30 .0 addb #30 ; make it a digit E63F F7 0B 97 ... stab 0b97 +; E642 30 0 tsx E643 EC 04 .. ldd 04,x E645 37 7 pshb @@ -13020,20 +13022,21 @@ E646 36 6 psha E647 EC 02 .. ldd 02,x E649 37 7 pshb E64A 36 6 psha -E64B CE 96 80 ... ldx #9680 +E64B CE 96 80 ... ldx #9680 ;38528 E64E 3C < pshx -E64F CC 00 98 ... ldd #0098 +E64F CC 00 98 ... ldd #0098 ;152 E652 BD FC 5C ..\ jsr fc5c ;jump82 E655 37 7 pshb E656 36 6 psha -E657 CE 42 40 .B@ ldx #4240 +E657 CE 42 40 .B@ ldx #4240 ;16960 E65A 3C < pshx -E65B CC 00 0F ... ldd #000f +E65B CC 00 0F ... ldd #000f ;15 E65E BD FC 4C ..L jsr fc4c ;jump83 E661 31 1 ins E662 33 3 pulb E663 CB 30 .0 addb #30 E665 F7 0B 96 ... stab 0b96 +; E668 30 0 tsx E669 EC 04 .. ldd 04,x E66B 37 7 pshb @@ -13041,20 +13044,21 @@ E66C 36 6 psha E66D EC 02 .. ldd 02,x E66F 37 7 pshb E670 36 6 psha -E671 CE 42 40 .B@ ldx #4240 +E671 CE 42 40 .B@ ldx #4240 ;16960 E674 3C < pshx -E675 CC 00 0F ... ldd #000f +E675 CC 00 0F ... ldd #000f ;15 E678 BD FC 5C ..\ jsr fc5c ;jump82 E67B 37 7 pshb E67C 36 6 psha -E67D CE 86 A0 ... ldx #86a0 +E67D CE 86 A0 ... ldx #86a0 ;34464 E680 3C < pshx -E681 CC 00 01 ... ldd #0001 +E681 CC 00 01 ... ldd #0001 ;1 E684 BD FC 4C ..L jsr fc4c ;jump83 E687 31 1 ins E688 33 3 pulb E689 CB 30 .0 addb #30 E68B F7 0B 95 ... stab 0b95 +; E68E 30 0 tsx E68F EC 04 .. ldd 04,x E691 37 7 pshb @@ -13062,13 +13066,13 @@ E692 36 6 psha E693 EC 02 .. ldd 02,x E695 37 7 pshb E696 36 6 psha -E697 CE 86 A0 ... ldx #86a0 +E697 CE 86 A0 ... ldx #86a0 ;34464 E69A 3C < pshx -E69B CC 00 01 ... ldd #0001 +E69B CC 00 01 ... ldd #0001 ;1 E69E BD FC 5C ..\ jsr fc5c ;jump82 E6A1 37 7 pshb E6A2 36 6 psha -E6A3 CE 27 10 .'. ldx #2710 +E6A3 CE 27 10 .'. ldx #2710 ;10000 E6A6 3C < pshx E6A7 CC 00 00 ... ldd #0000 E6AA BD FC 4C ..L jsr fc4c ;jump83 @@ -13076,6 +13080,7 @@ E6AD 31 1 ins E6AE 33 3 pulb E6AF CB 30 .0 addb #30 E6B1 F7 0B 94 ... stab 0b94 +; E6B4 30 0 tsx E6B5 EC 04 .. ldd 04,x E6B7 37 7 pshb @@ -13083,13 +13088,13 @@ E6B8 36 6 psha E6B9 EC 02 .. ldd 02,x E6BB 37 7 pshb E6BC 36 6 psha -E6BD CE 27 10 .'. ldx #2710 +E6BD CE 27 10 .'. ldx #2710 ;10000 E6C0 3C < pshx E6C1 CC 00 00 ... ldd #0000 E6C4 BD FC 5C ..\ jsr fc5c ;jump82 E6C7 37 7 pshb E6C8 36 6 psha -E6C9 CE 03 E8 ... ldx #03e8 +E6C9 CE 03 E8 ... ldx #03e8 ;1000 E6CC 3C < pshx E6CD CC 00 00 ... ldd #0000 E6D0 BD FC 4C ..L jsr fc4c ;jump83 @@ -13097,6 +13102,8 @@ E6D3 31 1 ins E6D4 33 3 pulb E6D5 CB 30 .0 addb #30 E6D7 F7 0B 93 ... stab 0b93 +; +; E6DA 30 0 tsx E6DB EC 04 .. ldd 04,x E6DD 37 7 pshb @@ -13104,13 +13111,13 @@ E6DE 36 6 psha E6DF EC 02 .. ldd 02,x E6E1 37 7 pshb E6E2 36 6 psha -E6E3 CE 03 E8 ... ldx #03e8 +E6E3 CE 03 E8 ... ldx #03e8 ;1000 E6E6 3C < pshx E6E7 CC 00 00 ... ldd #0000 E6EA BD FC 5C ..\ jsr fc5c ;jump82 E6ED 37 7 pshb E6EE 36 6 psha -E6EF CE 00 64 ..d ldx #0064 +E6EF CE 00 64 ..d ldx #0064 ;100 E6F2 3C < pshx E6F3 CC 00 00 ... ldd #0000 E6F6 BD FC 4C ..L jsr fc4c ;jump83 @@ -13118,6 +13125,7 @@ E6F9 31 1 ins E6FA 33 3 pulb E6FB CB 30 .0 addb #30 E6FD F7 0B 92 ... stab 0b92 +; E700 30 0 tsx E701 EC 04 .. ldd 04,x E703 37 7 pshb @@ -13125,13 +13133,13 @@ E704 36 6 psha E705 EC 02 .. ldd 02,x E707 37 7 pshb E708 36 6 psha -E709 CE 00 64 ..d ldx #0064 +E709 CE 00 64 ..d ldx #0064 ;100 E70C 3C < pshx E70D CC 00 00 ... ldd #0000 E710 BD FC 5C ..\ jsr fc5c ;jump82 E713 37 7 pshb E714 36 6 psha -E715 CE 00 0A ... ldx #000a +E715 CE 00 0A ... ldx #000a ;10 E718 3C < pshx E719 CC 00 00 ... ldd #0000 E71C BD FC 4C ..L jsr fc4c ;jump83 @@ -13139,6 +13147,7 @@ E71F 31 1 ins E720 33 3 pulb E721 CB 30 .0 addb #30 E723 F7 0B 91 ... stab 0b91 +; E726 30 0 tsx E727 EC 04 .. ldd 04,x E729 37 7 pshb @@ -13146,7 +13155,7 @@ E72A 36 6 psha E72B EC 02 .. ldd 02,x E72D 37 7 pshb E72E 36 6 psha -E72F CE 00 0A ... ldx #000a +E72F CE 00 0A ... ldx #000a ;10 E732 3C < pshx E733 CC 00 00 ... ldd #0000 E736 BD FC 5C ..\ jsr fc5c ;jump82 @@ -13154,6 +13163,7 @@ E739 31 1 ins E73A 33 3 pulb E73B CB 30 .0 addb #30 E73D F7 0B 90 ... stab 0b90 +; E740 38 8 pulx E741 31 1 ins E742 31 1 ins @@ -15668,6 +15678,16 @@ FC49 31 1 ins FC4A 31 1 ins FC4B 39 9 rts + + +; jump83: and jump82: are the same function, but jump82 seeds a local +; +; the number in D is prepended to the number at the top of the stack +; eg, 0x0f in D and 0x4240 on stack => 0x0f4240 = 1000000 +; +; could it be a 16-bit division function??? +; (observing where its called from in jump56) +; jump83: FC4C 3C < pshx FC4D 3C < pshx @@ -15695,6 +15715,7 @@ FC65 30 0 tsx FC66 86 01 .. ldaa #01 FC68 A7 04 .. staa 04,x FC6A 7E FC 6D ~.m jmp fc6d ;goto88 +; goto88: FC6D 1A EE 0E ... ldy 0e,x FC70 EC 08 .. ldd 08,x @@ -15710,26 +15731,30 @@ FC81 ED 08 .. std 08,x FC83 ED 06 .. std 06,x FC85 EC 0A .. ldd 0a,x FC87 1A A3 0E ... cmpd 0e,x -FC8A 22 23 "# bhi 23 -FC8C 27 15 '. beq 15 +FC8A 22 23 "# bhi 23 ; to fcaf +FC8C 27 15 '. beq 15 ; to fca3 +; FC8E 1E 04 01 08 .... brset 04,x 01 08 FC92 CC 00 00 ... ldd #0000 FC95 ED 14 .. std 14,x -FC97 7E FE 04 ~.. jmp fe04 ;goto89 +FC97 7E FE 04 ~.. jmp fe04 ;goto89 - return FC9A EC 0C .. ldd 0c,x FC9C ED 14 .. std 14,x FC9E EC 0A .. ldd 0a,x FCA0 7E FD E3 ~.. jmp fde3 ;goto90 +; FCA3 83 00 00 ... subd #0000 -FCA6 27 12 '. beq 12 +FCA6 27 12 '. beq 12 ; to fcba FCA8 EC 0C .. ldd 0c,x FCAA 1A A3 10 ... cmpd 10,x -FCAD 25 DF %. bcs df +FCAD 25 DF %. bcs df ; to fc8e +; FCAF 6D 0E m. tst 0e,x -FCB1 26 70 &p bne 70 +FCB1 26 70 &p bne 70 ; to fd23 FCB3 6D 0F m. tst 0f,x -FCB5 27 1A '. beq 1a +FCB5 27 1A '. beq 1a ; to fcd1 FCB7 7E FD A4 ~.. jmp fda4 ;goto91 +; FCBA 3C < pshx FCBB 3C < pshx FCBC 18 38 .8 puly @@ -15743,6 +15768,7 @@ FCCA ED 14 .. std 14,x FCCC 4F O clra FCCD 5F _ clrb FCCE 7E FD E3 ~.. jmp fde3 ;goto90 +; FCD1 3C < pshx FCD2 3C < pshx FCD3 18 38 .8 puly @@ -15757,7 +15783,8 @@ FCE0 03 . fdiv FCE1 CD EF 0E ... stx 02x,y FCE4 38 8 pulx FCE5 18 E3 0C ... addd 0c,y -FCE8 24 1B $. bcc 1b +FCE8 24 1B $. bcc 1b ; to fd05 +; FCEA 18 ED 0C ... std 0c,y FCED 4F O clra FCEE C6 01 .. ldab #01 @@ -15771,8 +15798,9 @@ FCFB 18 ED 0E ... std 0e,y FCFE 8F . xgdx FCFF 38 8 pulx FD00 18 E3 0C ... addd 0c,y -FD03 25 E5 %. bcs e5 +FD03 25 E5 %. bcs e5 ; to fcea FD05 02 . idiv +; FD06 8F . xgdx FD07 18 E3 0E ... addd 0e,y FD0A 24 03 $. bcc 03 @@ -15785,8 +15813,9 @@ FD1B 38 8 pulx FD1C ED 14 .. std 14,x FD1E EC 0A .. ldd 0a,x FD20 7E FD E3 ~.. jmp fde3 ;goto90 -FD23 86 08 .. ldaa #08 -FD25 A7 05 .. staa 05,x +; +FD23 86 08 .. ldaa #08 ; for i = 8 +FD25 A7 05 .. staa 05,x ; do FD27 69 0D i. rol 0d,x FD29 69 0C i. rol 0c,x FD2B 69 0B i. rol 0b,x @@ -15798,26 +15827,29 @@ FD35 ED 14 .. std 14,x FD37 EC 09 .. ldd 09,x FD39 E2 0F .. sbcb 0f,x FD3B A2 0E .. sbca 0e,x -FD3D 25 06 %. bcs 06 +FD3D 25 06 %. bcs 06 ; to fd45 FD3F ED 09 .. std 09,x FD41 EC 14 .. ldd 14,x FD43 ED 0B .. std 0b,x -FD45 6A 05 j. dec 05,x -FD47 26 DE &. bne de +FD45 6A 05 j. dec 05,x ; i-- +FD47 26 DE &. bne de ; to fd27 +; FD49 69 0D i. rol 0d,x -FD4B 1F 04 01 09 .... brclr 04,x 01 09 +FD4B 1F 04 01 09 .... brclr 04,x 01 09 ; to fd58 FD4F EC 0B .. ldd 0b,x FD51 ED 14 .. std 14,x FD53 EC 09 .. ldd 09,x FD55 7E FD E3 ~.. jmp fde3 ;goto90 +; FD58 4F O clra FD59 E6 0D .. ldab 0d,x FD5B 53 S comb FD5C ED 14 .. std 14,x FD5E 5F _ clrb FD5F 7E FD E3 ~.. jmp fde3 ;goto90 -FD62 86 10 .. ldaa #10 -FD64 A7 05 .. staa 05,x +; +FD62 86 10 .. ldaa #10 ; for i = 16 +FD64 A7 05 .. staa 05,x ; do FD66 69 0D i. rol 0d,x FD68 69 0C i. rol 0c,x FD6A 69 0B i. rol 0b,x @@ -15830,30 +15862,31 @@ FD76 ED 14 .. std 14,x FD78 EC 08 .. ldd 08,x FD7A E2 0F .. sbcb 0f,x FD7C 82 00 .. sbca #00 -FD7E 25 06 %. bcs 06 +FD7E 25 06 %. bcs 06 ; continue FD80 ED 08 .. std 08,x FD82 EC 14 .. ldd 14,x FD84 ED 0A .. std 0a,x -FD86 6A 05 j. dec 05,x -FD88 26 DC &. bne dc +FD86 6A 05 j. dec 05,x ; i-- +FD88 26 DC &. bne dc ; to fd66 +; FD8A 69 0D i. rol 0d,x FD8C 69 0C i. rol 0c,x FD8E 1F 04 01 08 .... brclr 04,x 01 08 FD92 EC 0A .. ldd 0a,x FD94 ED 14 .. std 14,x FD96 EC 08 .. ldd 08,x -FD98 20 49 I bra 49 +FD98 20 49 I bra 49 ;goto90 FD9A EC 0C .. ldd 0c,x FD9C 43 C coma FD9D 53 S comb FD9E ED 14 .. std 14,x FDA0 4F O clra FDA1 5F _ clrb -FDA2 20 3F ? bra 3f +FDA2 20 3F ? bra 3f ;goto90 goto91: -FDA4 2B BC +. bmi bc -FDA6 86 10 .. ldaa #10 -FDA8 A7 05 .. staa 05,x +FDA4 2B BC +. bmi bc ; to fd62 if minus +FDA6 86 10 .. ldaa #10 ; for i = 16 +FDA8 A7 05 .. staa 05,x ; do FDAA 69 0D i rol 0d,x FDAC 69 0C i rol 0c,x FDAE 69 0B i rol 08,x @@ -15864,20 +15897,22 @@ FDB6 A3 10 .. subd 10,x FDB8 ED 14 .. std 14,x FDBA A6 07 .. ldaa 07,x FDBC A2 0F .. sbca 0f,x -FDBE 25 06 %. bcs 06 +FDBE 25 06 %. bcs 06 ;continue FDC0 A7 07 .. staa 07,x FDC2 EC 14 .. ldd 14,x FDC4 ED 0A .. std 0a,x FDC6 6A 05 j. dec 05,x -FDC8 26 E0 &. bne e0 +FDC8 26 E0 &. bne e0 ;reloop +; FDCA 69 0D i. rol 0d,x FDCC 69 0C i. rol 0c,x -FDCE 1F 04 01 09 .... brclr 04,x 01 09 +FDCE 1F 04 01 09 .... brclr 04,x 01 09 ;to fddb FDD2 EC 0A .. ldd 0a,x FDD4 ED 14 .. std 14,x FDD6 4F O clra FDD7 E6 07 .. ldab 07,x -FDD9 20 08 . bra 08 +FDD9 20 08 . bra 08 ;goto90 +; FDDB EC 0C .. ldd 0c,x FDDD 43 C coma FDDE 53 S comb