mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-12-02 12:52:03 +00:00
9b12b6fd9b
- getting ready for major changes for 0.6.0. - be sure to download the 0.5.0 release to ensure proper functionality, as these rountines will not work together in the SRC or BIN folder during the transition - Beginning to significantly alter documentation
94 lines
2.1 KiB
NASM
94 lines
2.1 KiB
NASM
]NACCUM EQU VARTAB
|
|
]SIGN EQU VARTAB+4
|
|
]NINDEX EQU VARTAB+6
|
|
]STR EQU WPAR1
|
|
INTASC2HEX
|
|
LDY #0
|
|
LDA (]STR),Y
|
|
TAX
|
|
LDA #1
|
|
STA ]NINDEX ;
|
|
LDA #0
|
|
STA ]NACCUM
|
|
STA ]NACCUM+1
|
|
STA ]SIGN
|
|
TXA
|
|
BNE :INIT1
|
|
JMP :EREXIT
|
|
:INIT1
|
|
LDY ]NINDEX
|
|
LDA (]STR),Y
|
|
CMP #173
|
|
BNE :PLUS
|
|
LDA #$0FF
|
|
STA ]SIGN
|
|
INC ]NINDEX
|
|
DEX
|
|
BEQ :EREXIT
|
|
JMP :CNVERT
|
|
:PLUS
|
|
CMP #'+'
|
|
BNE :CHKDIG
|
|
|
|
INC ]NINDEX
|
|
DEX ; DEC COUNT
|
|
BEQ :EREXIT
|
|
|
|
:CNVERT
|
|
LDY ]NINDEX
|
|
LDA (]STR),Y
|
|
:CHKDIG
|
|
CMP #$B0
|
|
BMI :EREXIT
|
|
CMP #$BA ; '9'+1
|
|
BPL :EREXIT
|
|
PHA
|
|
ASL ]NACCUM
|
|
ROL ]NACCUM+1
|
|
LDA ]NACCUM
|
|
LDY ]NACCUM+1
|
|
ASL ]NACCUM
|
|
ROL ]NACCUM+1
|
|
ASL ]NACCUM
|
|
ROL ]NACCUM+1
|
|
CLC
|
|
ADC ]NACCUM
|
|
STA ]NACCUM
|
|
TYA
|
|
ADC ]NACCUM+1
|
|
STA ]NACCUM+1
|
|
PLA
|
|
SEC
|
|
SBC #$B0
|
|
CLC
|
|
ADC ]NACCUM
|
|
ST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