From: Bernard Blackham Date: Sun, 3 Aug 2003 14:39:50 +0000 (+0000) Subject: more changes - before applying the rol instruction fix X-Git-Tag: ROMW~120 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=99b908f4fecb30dabb8d518fb41ff34c0c522170;p=uccvend-snackrom.git more changes - before applying the rol instruction fix --- diff --git a/ROM-2003/vend.asm b/ROM-2003/vend.asm index c87edec..19de106 100644 --- a/ROM-2003/vend.asm +++ b/ROM-2003/vend.asm @@ -4,7 +4,7 @@ ;0005 number of motors we have ;0006 slot number ;0007 06 stored into it sometimes. -;0008 used exclusively in SCI interrupt +;0008 what byte of the packet we've read up to ;0009 ;000a ;000c @@ -85,8 +85,9 @@ ;0bdb init'd to 0x08 ;0bdc init'd to 0x10 ; -;0cbc serial number -;0ccc machine ID +;0cbc serial number (string) +;0ccc machine ID (string) +;0ce7 audit number (1-bit) ;0cd9 counter of something - reset to 4 on some serial input ;0cda counter of something - reset to 4 on some serial input ;0cdb also counts something - reset to 4 on some serial input @@ -1408,7 +1409,7 @@ jump17: 8A67 4F O clra 8A68 37 7 pshb 8A69 36 6 psha -8A6A CC 00 C7 ... ldd #00c7 +8A6A CC 00 C7 ... ldd #00c7 ; 199 8A6D BD FB BA ... jsr fbba ;jump38 8A70 B3 00 27 ..' subd 0027 8A73 24 05 $. bcc 05 @@ -1455,7 +1456,7 @@ goto8: 8AD2 4F O clra 8AD3 37 7 pshb 8AD4 36 6 psha -8AD5 CC 00 FA ... ldd #00fa +8AD5 CC 00 FA ... ldd #00fa ; 250 8AD8 BD FB BA ... jsr fbba ;jump38 8ADB FD 00 27 ..' std 0027 8ADE 20 38 8 bra 38 @@ -1468,7 +1469,7 @@ goto8: 8AEF 4F O clra 8AF0 37 7 pshb 8AF1 36 6 psha -8AF2 CC 00 C7 ... ldd #00c7 +8AF2 CC 00 C7 ... ldd #00c7 ; 199 8AF5 BD FB BA ... jsr fbba ;jump38 8AF8 FD 00 27 ..' std 0027 8AFB 20 1B . bra 1b @@ -1697,7 +1698,7 @@ jump18: 8D14 4F O clra 8D15 37 7 pshb 8D16 36 6 psha -8D17 CC 00 FA ... ldd #00fa +8D17 CC 00 FA ... ldd #00fa ; 250 8D1A BD FB BA ... jsr fbba ;jump38 8D1D B3 00 0D ... subd 000d 8D20 24 05 $. bcc 05 @@ -1716,7 +1717,7 @@ jump18: 8D3D 4F O clra 8D3E 37 7 pshb 8D3F 36 6 psha -8D40 CC 00 C7 ... ldd #00c7 +8D40 CC 00 C7 ... ldd #00c7 ; 199 8D43 BD FB BA ... jsr fbba ;jump38 8D46 B3 00 0D ... subd 000d 8D49 24 05 $. bcc 05 @@ -1757,7 +1758,7 @@ jump18: 8D9E 4F O clra 8D9F 37 7 pshb 8DA0 36 6 psha -8DA1 CC 00 FA ... ldd #00fa +8DA1 CC 00 FA ... ldd #00fa ; 250 8DA4 BD FB BA ... jsr fbba ;jump38 8DA7 FD 00 0D ... std 000d 8DAA 20 38 8 bra 38 @@ -1770,7 +1771,7 @@ jump18: 8DBB 4F O clra 8DBC 37 7 pshb 8DBD 36 6 psha -8DBE CC 00 C7 ... ldd #00c7 +8DBE CC 00 C7 ... ldd #00c7 ; 199 8DC1 BD FB BA ... jsr fbba ;jump38 8DC4 FD 00 0D ... std 000d 8DC7 20 1B . bra 1b @@ -2325,8 +2326,8 @@ jump22: 92F1 4F O clra 92F2 37 7 pshb 92F3 36 6 psha -92F4 CC 00 64 ..d ldd #0064 -92F7 BD FB BA ... jsr fbba ;jump38 +92F4 CC 00 64 ..d ldd #0064 ; 100 +92F7 BD FB BA ... jsr fbba ;jump38 - multiplication 92FA FD 0C E9 ... std 0ce9 92FD BD D6 F6 ... jsr d6f6 ;jump106 9300 FC 0C E9 ... ldd 0ce9 @@ -2382,7 +2383,7 @@ jump22: 936A F6 00 1F ... ldab 001f 936D C4 02 .. andb #02 936F 27 1F '. beq 1f -9371 BD 97 E9 ... jsr 97e9 ;jump147 +9371 BD 97 E9 ... jsr 97e9 ;jump147 - print the report 9374 CE 00 1F ... ldx #001f 9377 1D 00 02 ... bclr 00,x, #02 937A CE 00 1F ... ldx #001f @@ -2873,7 +2874,7 @@ jump147: 97E9 BD BE 4B ..K jsr be4b ;displayblank 97EC CC AF E7 ... ldd #afe7 ; "-PRINTING-" 97EF BD C0 BA ... jsr c0ba ;display: -97F2 BD F4 15 ... jsr f415 ;jump112 +97F2 BD F4 15 ... jsr f415 ;jump112 - print a report 97F5 39 9 rts jump27: @@ -9975,10 +9976,11 @@ jump48: ; CE48 F6 0B C4 ... ldab 0bc4 CE4B F1 0B C5 ... cmpb 0bc5 -CE4E 25 53 %S bcs 53 +CE4E 25 53 %S bcs 53 ; if 0bc4 < 0bc5 to cea3 CE50 F6 0B C5 ... ldab 0bc5 CE53 F1 0B C6 ... cmpb 0bc6 -CE56 25 4B %K bcs 4b +CE56 25 4B %K bcs 4b ; if 0bc5 < 0bc6 to cea3 +; so here we have 0bc6 < 0bc5 < 0bc4 CE58 F6 0B C4 ... ldab 0bc4 CE5B 4F O clra CE5C C3 0B C7 ... addd #0bc7 @@ -10012,13 +10014,15 @@ CE96 C6 08 .. ldab #08 CE98 F7 0B DB ... stab 0bdb CE9B C6 10 .. ldab #10 CE9D F7 0B DC ... stab 0bdc -CEA0 7E D0 66 ~.f jmp d066 ;goto58 - multiply +CEA0 7E D0 66 ~.f jmp d066 ;goto58 - multiply & exit +; CEA3 F6 0B C4 ... ldab 0bc4 CEA6 F1 0B C6 ... cmpb 0bc6 -CEA9 25 53 %S bcs 53 +CEA9 25 53 %S bcs 53 ; if 0bc4 < 0bc6 to cefe CEAB F6 0B C6 ... ldab 0bc6 CEAE F1 0B C5 ... cmpb 0bc5 -CEB1 25 4B %K bcs 4b +CEB1 25 4B %K bcs 4b ; if 0bc6 < 0bc5 to cefe +; so here we have 0bc5 < 0bc6 < 0bc4 CEB3 F6 0B C4 ... ldab 0bc4 CEB6 4F O clra CEB7 C3 0B C7 ... addd #0bc7 @@ -10052,13 +10056,15 @@ CEF1 C6 10 .. ldab #10 CEF3 F7 0B DB ... stab 0bdb CEF6 C6 08 .. ldab #08 CEF8 F7 0B DC ... stab 0bdc -CEFB 7E D0 66 ~.f jmp d066 ;goto58 +CEFB 7E D0 66 ~.f jmp d066 ;goto58 - multiply and exit +; CEFE F6 0B C5 ... ldab 0bc5 CF01 F1 0B C4 ... cmpb 0bc4 -CF04 25 53 %S bcs 53 +CF04 25 53 %S bcs 53 ; if 0bc5 < 0bc4 to cf59 CF06 F6 0B C4 ... ldab 0bc4 CF09 F1 0B C6 ... cmpb 0bc6 -CF0C 25 4B %K bcs 4b +CF0C 25 4B %K bcs 4b ; if 0bc4 < 0bc6 to cf59 +; so here we have 0bc6 < 0bc4 < 0bc5 CF0E F6 0B C5 ... ldab 0bc5 CF11 4F O clra CF12 C3 0B C7 ... addd #0bc7 @@ -10092,13 +10098,15 @@ CF4C C6 20 . ldab #20 CF4E F7 0B DB ... stab 0bdb CF51 C6 10 .. ldab #10 CF53 F7 0B DC ... stab 0bdc -CF56 7E D0 66 ~.f jmp d066 ;goto58 +CF56 7E D0 66 ~.f jmp d066 ;goto58 - multiply and exit +; CF59 F6 0B C5 ... ldab 0bc5 CF5C F1 0B C6 ... cmpb 0bc6 -CF5F 25 53 %S bcs 53 +CF5F 25 53 %S bcs 53 ; if 0bc5 < 0bc6 to cfb4 CF61 F6 0B C6 ... ldab 0bc6 CF64 F1 0B C4 ... cmpb 0bc4 -CF67 25 4B %K bcs 4b +CF67 25 4B %K bcs 4b ; if 0bc6 < 0bc4 to cfb4 +; so here we have 0bc4 < 0bc6 < 0bc5 CF69 F6 0B C5 ... ldab 0bc5 CF6C 4F O clra CF6D C3 0B C7 ... addd #0bc7 @@ -10132,13 +10140,15 @@ CFA7 C6 10 .. ldab #10 CFA9 F7 0B DB ... stab 0bdb CFAC C6 20 . ldab #20 CFAE F7 0B DC ... stab 0bdc -CFB1 7E D0 66 ~.f jmp d066 ;goto58 +CFB1 7E D0 66 ~.f jmp d066 ;goto58 - multiply and exit +; CFB4 F6 0B C6 ... ldab 0bc6 CFB7 F1 0B C4 ... cmpb 0bc4 -CFBA 25 52 %R bcs 52 +CFBA 25 52 %R bcs 52 ; if 0bc6 < 0bc4 to d00e CFBC F6 0B C4 ... ldab 0bc4 CFBF F1 0B C5 ... cmpb 0bc5 -CFC2 25 4A %J bcs 4a +CFC2 25 4A %J bcs 4a ; if 0bc4 < 0bc5 to d00e +; so here we have 0bc5 < 0bc4 < 0bc6 CFC4 F6 0B C6 ... ldab 0bc6 CFC7 4F O clra CFC8 C3 0B C7 ... addd #0bc7 @@ -10172,7 +10182,9 @@ D002 C6 20 . ldab #20 D004 F7 0B DB ... stab 0bdb D007 C6 08 .. ldab #08 D009 F7 0B DC ... stab 0bdc -D00C 20 58 X bra 58 ;goto58 +D00C 20 58 X bra 58 ;goto58 - multiply and exit +; +; we know that 0bc4 < 0bc5 < 0bc6 D00E F6 0B C6 ... ldab 0bc6 D011 F1 0B C5 ... cmpb 0bc5 D014 25 50 %P bcs 50 @@ -10211,7 +10223,8 @@ D059 F7 0B DA ... stab 0bda D05C C6 08 .. ldab #08 D05E F7 0B DB ... stab 0bdb D061 C6 20 . ldab #20 -D063 F7 0B DC ... stab 0bdc ;goto58 +D063 F7 0B DC ... stab 0bdc ;goto58 - multiply and exit +; goto58: D066 F6 0B AA ... ldab 0baa D069 4F O clra @@ -10278,11 +10291,11 @@ D0C9 C6 03 .. ldab #03 D0CB F7 0B C5 ... stab 0bc5 D0CE C6 02 .. ldab #02 D0D0 F7 0B C6 ... stab 0bc6 -D0D3 CC 00 19 ... ldd #0019 +D0D3 CC 00 19 ... ldd #0019 ; 25 D0D6 FD 0B DD ... std 0bdd -D0D9 CC 00 0A ... ldd #000a +D0D9 CC 00 0A ... ldd #000a ; 10 D0DC FD 0B DF ... std 0bdf -D0DF CC 00 05 ... ldd #0005 +D0DF CC 00 05 ... ldd #0005 ; 5 D0E2 FD 0B E1 ... std 0be1 D0E5 C6 01 .. ldab #01 D0E7 F7 0B D7 ... stab 0bd7 @@ -11094,31 +11107,32 @@ D6F2 BD C0 E0 ... jsr c0e0 ;jump94 D6F5 39 9 rts jump106: +; puts (0cdb+0bdd)+(0cda*0bdf)+(0cd9*0be1) => 0bef D6F6 F6 0C DB ... ldab 0cdb D6F9 4F O clra D6FA 37 7 pshb D6FB 36 6 psha D6FC FC 0B DD ... ldd 0bdd D6FF BD FB BA ... jsr fbba ;jump38 - multiply? -D702 FD 0C EB ... std 0ceb +D702 FD 0C EB ... std 0ceb ; 0cdb * 0bdd => 0ceb D705 F6 0C DA ... ldab 0cda D708 4F O clra D709 37 7 pshb D70A 36 6 psha D70B FC 0B DF ... ldd 0bdf D70E BD FB BA ... jsr fbba ;jump38 - multiply? -D711 FD 0C ED ... std 0ced +D711 FD 0C ED ... std 0ced ; 0cda * 0bdf => 0ced D714 F6 0C D9 ... ldab 0cd9 D717 4F O clra D718 37 7 pshb D719 36 6 psha D71A FC 0B E1 ... ldd 0be1 D71D BD FB BA ... jsr fbba ;jump38 - multiply? -D720 FD 0C EF ... std 0cef +D720 FD 0C EF ... std 0cef ; 0cd9 * 0be1 => 0cef D723 FC 0C EB ... ldd 0ceb D726 F3 0C ED ... addd 0ced D729 F3 0C EF ... addd 0cef -D72C FD 0B EF ... std 0bef +D72C FD 0B EF ... std 0bef ; 0ceb+0ced+0cef => 0bef D72F 39 9 rts jump202: @@ -11565,7 +11579,7 @@ DA71 02 . idiv DA72 8F . xgdx DA73 37 7 pshb DA74 36 6 psha -DA75 CC 00 C3 ... ldd #00c3 +DA75 CC 00 C3 ... ldd #00c3 ; 195 DA78 BD FB BA ... jsr fbba ;jump38 - multiply? DA7B B3 0B B9 ... subd 0bb9 DA7E 24 05 $. bcc 05 @@ -11575,7 +11589,7 @@ DA82 FD 0B B9 ... std 0bb9 DA85 FC 0B B9 ... ldd 0bb9 DA88 37 7 pshb DA89 36 6 psha -DA8A CC 00 0A ... ldd #000a +DA8A CC 00 0A ... ldd #000a ; 10 DA8D BD FB BA ... jsr fbba ;jump38 - multiply? DA90 37 7 pshb DA91 36 6 psha @@ -11589,7 +11603,7 @@ DA9C 02 . idiv DA9D 8F . xgdx DA9E 37 7 pshb DA9F 36 6 psha -DAA0 CC 00 0A ... ldd #000a +DAA0 CC 00 0A ... ldd #000a ; 10 DAA3 BD FB BA ... jsr fbba ;jump38 - multiply? DAA6 CE 00 0A ... ldx #000a DAA9 02 . idiv @@ -14381,9 +14395,9 @@ F152 CC 05 DC ... ldd #05dc F155 BD E5 71 ..q jsr e571 ;msdelay F158 7E EE 1C ~.. jmp ee1c ;goto81 -;send a byte to the printer? -;it calls c7e7, which does things with the serial port jump53: +;send a byte to the printer +;it calls c7e7, which does things with the serial port F15B 37 7 pshb F15C 36 6 psha F15D F6 00 19 ... ldab 0019 @@ -14546,17 +14560,16 @@ F294 BD F1 5B ..[ jsr f15b ;jump53 F297 38 8 pulx F298 39 9 rts -jump61 -jump61:: +jump61: F299 37 7 pshb F29A 36 6 psha -F29B F6 20 00 . . ldab 2000 -F29E C4 40 .@ andb #40 +F29B F6 20 00 . . ldab 2000 +F29E C4 40 .@ andb #40 ; printer DSR F2A0 27 7B '{ beq 7b F2A2 F6 00 17 ... ldab 0017 F2A5 C4 08 .. andb #08 F2A7 26 06 &. bne 06 -F2A9 CC 00 24 ..$ ldd #0024 +F2A9 CC 00 24 ..$ ldd #0024 ; "$" F2AC BD F1 5B ..[ jsr f15b ;jump53 F2AF CE 00 1D ... ldx #001d F2B2 1C 00 01 ... bset 00,x, #01 @@ -14565,42 +14578,42 @@ F2B6 EC 00 .. ldd 00,x F2B8 BD E7 45 ..E jsr e745 ;jump55 - number to string F2BB F6 00 57 ..W ldab 0057 F2BE 4F O clra -F2BF BD F1 5B ..[ jsr f15b ;jump53 +F2BF BD F1 5B ..[ jsr f15b ;jump53 - byte to printer F2C2 F6 00 5A ..Z ldab 005a F2C5 4F O clra -F2C6 BD F1 5B ..[ jsr f15b ;jump53 +F2C6 BD F1 5B ..[ jsr f15b ;jump53 - byte to printer F2C9 F6 00 13 ... ldab 0013 F2CC C1 08 .. cmpb #08 F2CE 26 0C &. bne 0c F2D0 CC 00 2E ... ldd #002e -F2D3 BD F1 5B ..[ jsr f15b ;jump53 +F2D3 BD F1 5B ..[ jsr f15b ;jump53 - byte to printer F2D6 CE 00 1D ... ldx #001d F2D9 1D 00 01 ... bclr 00,x, #01 F2DC F6 00 5D ..] ldab 005d F2DF 4F O clra -F2E0 BD F1 5B ..[ jsr f15b ;jump53 +F2E0 BD F1 5B ..[ jsr f15b ;jump53 - byte to printer F2E3 F6 00 13 ... ldab 0013 F2E6 C1 04 .. cmpb #04 F2E8 26 0C &. bne 0c F2EA CC 00 2E ... ldd #002e -F2ED BD F1 5B ..[ jsr f15b ;jump53 +F2ED BD F1 5B ..[ jsr f15b ;jump53 - byte to printer F2F0 CE 00 1D ... ldx #001d F2F3 1D 00 01 ... bclr 00,x, #01 F2F6 F6 00 5E ..^ ldab 005e F2F9 4F O clra -F2FA BD F1 5B ..[ jsr f15b ;jump53 +F2FA BD F1 5B ..[ jsr f15b ;jump53 - byte to printer F2FD F6 00 13 ... ldab 0013 F300 C1 02 .. cmpb #02 F302 26 06 &. bne 06 F304 CC 00 2E ... ldd #002e -F307 BD F1 5B ..[ jsr f15b ;jump53 +F307 BD F1 5B ..[ jsr f15b ;jump53 - byte to printer F30A CE 00 1D ... ldx #001d F30D 1D 00 01 ... bclr 00,x, #01 F310 F6 00 5F .._ ldab 005f F313 4F O clra -F314 BD F1 5B ..[ jsr f15b ;jump53 +F314 BD F1 5B ..[ jsr f15b ;jump53 - byte to printer F317 CC 00 0A ... ldd #000a -F31A BD F1 5B ..[ jsr f15b ;jump53 +F31A BD F1 5B ..[ jsr f15b ;jump53 - byte to printer F31D 38 8 pulx F31E 39 9 rts @@ -14610,14 +14623,14 @@ F320 37 7 pshb F321 36 6 psha F322 3C < pshx F323 F6 20 00 . . ldab 2000 -F326 C4 40 .@ andb #40 +F326 C4 40 .@ andb #40 ; printer dsr F328 26 03 &. bne 03 F32A 7E F3 BC ~.. jmp f3bc ;goto82 F32D F6 00 17 ... ldab 0017 F330 C4 08 .. andb #08 F332 26 06 &. bne 06 -F334 CC 00 24 ..$ ldd #0024 -F337 BD F1 5B ..[ jsr f15b ;jump53 +F334 CC 00 24 ..$ ldd #0024 ; "$" +F337 BD F1 5B ..[ jsr f15b ;jump53 - byte to printer F33A CE 00 1D ... ldx #001d F33D 1C 00 01 ... bset 00,x, #01 F340 30 0 tsx @@ -14724,6 +14737,7 @@ F413 38 8 pulx F414 39 9 rts jump112: +; print a report? F415 F6 0B C0 ... ldab 0bc0 F418 C4 02 .. andb #02 F41A 27 15 '. beq 15 @@ -14753,33 +14767,33 @@ F458 CC 00 18 ... ldd #0018 F45B BD F1 5B ..[ jsr f15b ;jump53 F45E CC B2 1B ... ldd #b21b " ROWE INTERNATIONAL" F461 BD F1 E8 ... jsr f1e8 ;jump57 -F464 CC 00 0A ... ldd #000a +F464 CC 00 0A ... ldd #000a ; new line F467 BD F1 5B ..[ jsr f15b ;jump53 F46A CC B2 38 ..8 ldd #b238 " -------------------" F46D BD F1 E8 ... jsr f1e8 ;jump57 -F470 CC 00 0A ... ldd #000a +F470 CC 00 0A ... ldd #000a ; new line F473 BD F1 5B ..[ jsr f15b ;jump53 -F476 CC B2 56 ..V ldd #b256 +F476 CC B2 56 ..V ldd #b256 ; "5900 SOFTWARE VER 5" F479 BD F1 E8 ... jsr f1e8 ;jump57 -F47C CC 00 0A ... ldd #000a +F47C CC 00 0A ... ldd #000a ; new line F47F BD F1 5B ..[ jsr f15b ;jump53 -F482 CC 00 0A ... ldd #000a +F482 CC 00 0A ... ldd #000a ; new line F485 BD F1 5B ..[ jsr f15b ;jump53 -F488 CC B2 75 ..u ldd #b275 +F488 CC B2 75 ..u ldd #b275 ; ACCOUNT RECORD F48B BD F1 E8 ... jsr f1e8 ;jump57 -F48E CC 00 0A ... ldd #000a +F48E CC 00 0A ... ldd #000a ; new line F491 BD F1 5B ..[ jsr f15b ;jump53 -F494 CC B2 38 ..8 ldd #b238 +F494 CC B2 38 ..8 ldd #b238 ; -------------------- F497 BD F1 E8 ... jsr f1e8 ;jump57 -F49A CC 00 0A ... ldd #000a +F49A CC 00 0A ... ldd #000a ; new line F49D BD F1 5B ..[ jsr f15b ;jump53 -F4A0 CC 00 0A ... ldd #000a +F4A0 CC 00 0A ... ldd #000a ; new line F4A3 BD F1 5B ..[ jsr f15b ;jump53 -F4A6 CC B2 90 ... ldd #b290 +F4A6 CC B2 90 ... ldd #b290 ; SERIAL # F4A9 BD F1 E8 ... jsr f1e8 ;jump57 F4AC CE 00 0A ... ldx #000a F4AF 3C < pshx -F4B0 CC 0C BC ... ldd #0cbc +F4B0 CC 0C BC ... ldd #0cbc ; serial number F4B3 BD F1 C1 ... jsr f1c1 ;jump59 F4B6 38 8 pulx F4B7 CC 00 0A ... ldd #000a @@ -14793,22 +14807,22 @@ F4CA BD F1 C1 ... jsr f1c1 ;jump59 F4CD 38 8 pulx F4CE CC 00 0A ... ldd #000a F4D1 BD F1 5B ..[ jsr f15b ;jump53 -F4D4 CC B2 B4 ... ldd #b2b4 +F4D4 CC B2 B4 ... ldd #b2b4 ; "AUDIT NUMBER" F4D7 BD F1 E8 ... jsr f1e8 ;jump57 F4DA FC 0C E7 ... ldd 0ce7 -F4DD BD F2 4D ..M jsr f24d ;jump58 +F4DD BD F2 4D ..M jsr f24d ;jump58 - convert to string F4E0 CC 00 0A ... ldd #000a F4E3 BD F1 5B ..[ jsr f15b ;jump53 F4E6 CC 00 0A ... ldd #000a F4E9 BD F1 5B ..[ jsr f15b ;jump53 -F4EC CC B2 C6 ... ldd #b2c6 +F4EC CC B2 C6 ... ldd #b2c6 ; "SALES (R) F4EF BD F1 E8 ... jsr f1e8 ;jump57 F4F2 FE 0D E9 ... ldx 0de9 F4F5 3C < pshx F4F6 FC 0D E7 ... ldd 0de7 F4F9 BD F3 1F ... jsr f31f ;jump60 F4FC 38 8 pulx -F4FD CC B2 D8 ... ldd #b2d8 +F4FD CC B2 D8 ... ldd #b2d8 ; "SALES (N) F500 BD F1 E8 ... jsr f1e8 ;jump57 F503 FE 0D ED ... ldx 0ded F506 3C < pshx @@ -15544,7 +15558,8 @@ FBB9 3B ; rti jump38: ; passed a u16 on the stack, i, and a u16 in D, j -; multiplication funciton of some sort? +; i *think* it multiplies i*j and returns it in D. +; but the assembly seems to have several off-by-one errors FBBA 3C < pshx FBBB 37 7 pshb FBBC 30 0 tsx @@ -15552,10 +15567,10 @@ FBBD E6 06 .. ldab 06,x ; lower 8-bits of i FBBF 3D = mul ; A*B => D FBC0 A6 00 .. ldaa 00,x FBC2 37 7 pshb -FBC3 E6 05 .. ldab 05,x +FBC3 E6 05 .. ldab 05,x ; upper byte of return address?? FBC5 3D = mul FBC6 32 2 pula -FBC7 1B . aba +FBC7 1B . aba ; a now contains ad+bc FBC8 33 3 pulb FBC9 36 6 psha FBCA A6 06 .. ldaa 06,x @@ -15563,8 +15578,8 @@ FBCC 3D = mul FBCD 37 7 pshb FBCE AB 00 .. adda 00,x FBD0 36 6 psha -FBD1 EC 03 .. ldd 03,x -FBD3 ED 05 .. std 05,x +FBD1 EC 03 .. ldd 03,x ; move saved value of X +FBD3 ED 05 .. std 05,x ; into the return address??? FBD5 38 8 pulx FBD6 8F . xgdx FBD7 83 00 00 ... subd #0000 @@ -15853,16 +15868,11 @@ goto91: FDA4 2B BC +. bmi bc FDA6 86 10 .. ldaa #10 FDA8 A7 05 .. staa 05,x -FDAA 69 i rol -FDAB 0D . sec -FDAC 69 i rol -FDAD 0C . clc -FDAE 69 i rol -FDAF 0B . sev -FDB0 69 i rol -FDB1 0A . clv -FDB2 69 i rol -FDB3 07 . tpa +FDAA 69 0D i rol 0d,x +FDAC 69 0C i rol 0c,x +FDAE 69 0B i rol 08,x +FDB0 69 0A i rol 0a,x +FDB2 69 07 i rol 07,x FDB4 EC 0A .. ldd 0a,x FDB6 A3 10 .. subd 10,x FDB8 ED 14 .. std 14,x