*
*
*               THERE IS NO INSTRUCTION THAT ADDS A to H:X
*               THE FOLLOWING PROGRAM ADDS A to H:X
*
RAMStart        EQU     $0040
RomStart        EQU     $E000
ResetVector     EQU     $FFFE

                ORG     ResetVector
                FDB     MAIN

                ORG     RAMStart


                ORG     RomStart

MAIN            RSP                   ; Reset stack pointer to FF
                LDA     #$05          ; Load A with $05
                LDHX    #$06FF        ; Load HX with $06FF
                JSR     ADDAX         ; Jump to subrputine ADDAX
                ADD     #$01          ; Accumulator value reserved
                NOP
                NOP


ADDAX           PSHX                  ; Push X to Stack
                PSHH                  ; Push H to Stack
                PSHA                  ; Push A to Stack
                TSX                   ; Transfer stack pointer to H:X
                ADD     2,X           ; Add value FF  to A (value FF at location X+2)
                STA     2,X           ; Store sum (04) at location, if overflow Carry=1
                CLRA                  ; Set A with 00
                ADC     1,X           ; Add carry to value 06 (at loc. X+1)
                STA     1,X           ; Store sum (07) at location, if overflow Carry=1
                PULA                  ; Pull A from stack
                PULH                  ; Pull H from stack
                PULX                  ; Pull X from stack
                RTS                   ; Return from subroutine

