mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-11-30 15:49:55 +00:00
129 lines
2.8 KiB
Plaintext
129 lines
2.8 KiB
Plaintext
|
*``````````````````````````````*
|
||
|
* HEX2BINASC :: *
|
||
|
* *
|
||
|
*- -*
|
||
|
*- -*
|
||
|
* CLOBBERS: *
|
||
|
* *
|
||
|
* FLAGS: ????---- REG: AXYM *
|
||
|
*- -*
|
||
|
* CYCLES: ??? *
|
||
|
* SIZE: *
|
||
|
*- -*
|
||
|
* USAGE: *
|
||
|
* *
|
||
|
*- -*
|
||
|
* ENTRY *
|
||
|
* *
|
||
|
* TOP OF STACK *
|
||
|
* *
|
||
|
* LOW BYTE OF RETURN ADDRESS *
|
||
|
* HI BYTE OF RETURN ADDRESS *
|
||
|
*- -*
|
||
|
* EXIT *
|
||
|
* *
|
||
|
* TOP OF STACK *
|
||
|
* *
|
||
|
* LOW BYTE OF RETURN ADDRESS *
|
||
|
* HI BYTE OF RETURN ADDRESS *
|
||
|
* *
|
||
|
* .Y = COUNTER; TRASH *
|
||
|
* .X = COUNTER; TRASH *
|
||
|
* .A = LOW BYTE OF RET ADDR *
|
||
|
* *
|
||
|
* [RETURN] = STRING VALUE *
|
||
|
* [RETLEN] = LENGTH OF STRING *
|
||
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||
|
*
|
||
|
HEX2BINASC
|
||
|
*
|
||
|
** SAVE RETURN ADDRESS
|
||
|
*
|
||
|
PLA
|
||
|
STA RETADR
|
||
|
PLA
|
||
|
STA RETADR+1
|
||
|
*
|
||
|
** GET PARAMETERS
|
||
|
*
|
||
|
PLA
|
||
|
STA :HBYTE
|
||
|
*
|
||
|
** MASK RIGHT
|
||
|
*
|
||
|
AND #$F0
|
||
|
LSR
|
||
|
LSR
|
||
|
LSR
|
||
|
LSR
|
||
|
STA :LEFT
|
||
|
LDA :HBYTE
|
||
|
*
|
||
|
** MASK LEFT
|
||
|
*
|
||
|
AND #$0F
|
||
|
STA :RIGHT
|
||
|
*
|
||
|
** GET LEFT FROM LOOKUP TABLE
|
||
|
*
|
||
|
ASL :LEFT
|
||
|
ASL :LEFT ; MUL BY 4
|
||
|
LDX :LEFT
|
||
|
LDA :BINTAB,X
|
||
|
STA RETURN
|
||
|
LDA :BINTAB,X+1
|
||
|
STA RETURN+1
|
||
|
LDA :BINTAB,X+2
|
||
|
STA RETURN+2
|
||
|
LDA :BINTAB,X+3
|
||
|
STA RETURN+3
|
||
|
*
|
||
|
** NOW GET RIGHT
|
||
|
*
|
||
|
ASL :RIGHT
|
||
|
ASL :RIGHT ; MUL BY 4
|
||
|
LDX :RIGHT
|
||
|
LDA :BINTAB,X
|
||
|
STA RETURN+4
|
||
|
LDA :BINTAB,X+1
|
||
|
STA RETURN+5
|
||
|
LDA :BINTAB,X+2
|
||
|
STA RETURN+6
|
||
|
LDA :BINTAB,X+3
|
||
|
STA RETURN+7
|
||
|
*
|
||
|
LDA #8
|
||
|
STA RETLEN
|
||
|
*
|
||
|
** RESTORE RETURN ADDRESS
|
||
|
*
|
||
|
LDA RETADR+1
|
||
|
PHA
|
||
|
LDA RETADR
|
||
|
PHA
|
||
|
*
|
||
|
RTS ; RETURN
|
||
|
*
|
||
|
** DATA
|
||
|
*
|
||
|
:BINTAB ASC "0000" ; 0
|
||
|
ASC "0001" ; 1
|
||
|
ASC "0010" ; 2
|
||
|
ASC "0011" ; 3
|
||
|
ASC "0100" ; 4
|
||
|
ASC "0101" ; 5
|
||
|
ASC "0110" ; 6
|
||
|
ASC "0111" ; 7
|
||
|
ASC "1000" ; 8
|
||
|
ASC "1001" ; 9
|
||
|
ASC "1010" ; A
|
||
|
ASC "1011" ; B
|
||
|
ASC "1100" ; C
|
||
|
ASC "1101" ; D
|
||
|
ASC "1110" ; E
|
||
|
ASC "1111" ; F
|
||
|
*
|
||
|
:LEFT DS 1
|
||
|
:RIGHT DS 1
|
||
|
:HBYTE DS 1
|