CCR Flags Using 68HC11

Discussion in 'Programmer's Corner' started by Jimmy Faulks, Mar 25, 2015.

  1. Jimmy Faulks

    Thread Starter New Member

    Mar 25, 2015
    5
    0
    Code (Text):
    1. ***********************
    2. * Program starts here *
    3. ***********************
    4.   ORG  $2400
    5.  
    6. START
    7. *  LDS  #$23FF    set stack pointer, DO NOT set when running under monitor
    8.    JSR  ONSCI    initialize serial port
    9.   LDX  #MSG    get message string
    10.   JSR  OUTSTRG    send it out serial port
    11.    
    12.  
    13.  
    14. ** PART 3A
    15.    SEV
    16.    CLV
    17.    SEI
    18.    CLI
    19.    SEC
    20.    CLC
    21.    LDAA #$01
    22.    NEGA
    23.    NEGA
    24.    CLRA
    25.  
    26. ** PART 3B
    27.    LDAA #$10
    28.    LDAB #$0F
    29.    LDD    #$FEEF
    30.    LDX #$4D
    31.    TAB
    32.    CLRA
    33.    CLRB
    34.    
    35.  
    36. ** PART 3C
    37.  
    38.    ADDA #$F0
    39.    SUBB #$B0
    40.    INCA
    41.    DECB
    42.    CLRA
    43.    CLRB
    44.  
    45. ** PART 3D
    46.    LDAA #$01
    47.    LDAB #$01
    48.    ANDA
    49.    ORB
    50.    EORA
    51.    ORA
    52.    CLRA
    53.    CLRB
    54.  
    55. ** PART 3E
    56.    LDAA #$2F
    57.    LDAB #$CF
    58.    LSLA
    59.    ASLB
    60.    RORB
    61.    ROLA
    62.  
    63.    CLRA
    64.    CLRB
    65.  
    66. *** PART 3F
    67.    LDAA #05
    68.    LDAB #04
    69.    BITA #06
    70.    CMPB #07
    71.    TSTA
    72.    CPD #$FF22
    73.    CLRA
    74.    CLRB
    75.  
    76. ** PART 3G
    77.    LDAA #05
    78.    LDAB #04
    79.    SBA
    80.    BLT   SOMEWHERE
    81.    BGE   SOMEWHERE2
    82.    BEQ SOMEWHERE3
    83.    BRA   SOMEWHERE4
    84.  
    85. TWOE
    86.    LDAA #04
    87.    LDAB #05
    88.    SBA
    89.    BLT   SOMEWHERE
    90.    BGE   SOMEWHERE2
    91.    BEQ SOMEWHERE3
    92.    BRA   SOMEWHERE4  
    93.  
    94. THREEE
    95.    LDAA #05
    96.    LDAB #05
    97.    SBA
    98.    BLT   SOMEWHERE
    99.    BGE   SOMEWHERE2
    100.    BEQ SOMEWHERE3
    101.    BRA   SOMEWHERE4
    102.  
    103. FOURE
    104.    LDAA #04
    105.    LDAB #05
    106.    SBA
    107.    BRA   SOMEWHERE4
    108.  
    109. SOMEWHERE   CLRA
    110.        CLRB
    111.        JSR TWOE
    112. SOMEWHERE2   CLRA
    113.        CLRB
    114.        JSR THREEE
    115. SOMEWHERE3   CLRA
    116.        CLRB
    117.        JSR FOURE
    118. SOMEWHERE4   CLRA
    119.        CLRB
    120.  
    121. ** PART 3H
    122.    JMP SOMEWHERE5
    123.  
    124. SOMEWHERE5
    125.    JSR HOWDY
    126.  
    127. HOWDY
    128.    BRA   HOWDY2
    129.  
    130. HOWDY2
    131.    BRN
    132.  
    133.  
    134.  
    135. eloop  nop     endless loop
    136.   bra   eloop
    137.   RTS
    138. **********
    139. *  ONSCI() - Initialize the SCI for 9600
    140. *  baud at 8 MHz Extal.
    141. **********
    142. ONSCI  LDAA #$30
    143.   STAA BAUD  baud register
    144.   LDAA #$00
    145.   STAA SCCR1
    146.   LDAA #$0C
    147.   STAA SCCR2  enable
    148.   RTS
    149. **********
    150. *  OUTSTRG(x) - Output string of ASCII bytes
    151. * starting at x until end of text ($04).
    152. **********
    153. OUTSTRG  JSR  OUTCRLF
    154. OUTSTRG0 PSHA
    155. OUTSTRG1 LDAA 0,X  read char into a
    156.   CMPA #EOT
    157.   BEQ  OUTSTRG3  jump if eot
    158.   JSR  OUTPUT  output character
    159.   INX  incriment pointer
    160.   BRA  OUTSTRG1  loop
    161. OUTSTRG3 PULA
    162.   RTS
    163. **********
    164. *  OUTCRLF() - Output a Carriage return and
    165. * a line feed.  Returns a = cr.
    166. **********
    167. OUTCRLF  LDAA #$0D  cr
    168.   JSR  OUTPUT  output a
    169.   LDAA #$00
    170.   JSR  OUTPUT  output padding
    171.   LDAA #$0D
    172.   RTS
    173. **********
    174. *  OUTPUT() - Output A to sci.
    175. **********
    176. OUTPUT
    177. OUTSCI2  LDAB SCSR  read status
    178.   BITB #$80
    179.   BEQ  OUTSCI2  loop until tdre=1
    180.   ANDA #$7F  mask parity
    181.   STAA SCDAT  send character
    182. OUTSCI3  RTS
    183. *** TEXT TABLES ***
    184. *MSG  FCC  ''
    185.   FCB  EOT
    186. *  org  $FFFE  set the reset vector
    187. *  fdb  START
    188.  
    189.   END
    190.  

    I have written my different codes that is classified as a)condition b)data transfer c)arithmetic d)logical e)shift/rotate f)compare/test g)conditional branch h)unconditional branch

    The next step to to Trace this. when opening the Tera Term and typing "T" Only three lines are being displayed repeating over and over. Am I now using the Trace command correctly? I'm trying to demonstrate and verify that my operations to each part works.
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    We have no idea what IDE you are using.
     
  3. Jimmy Faulks

    Thread Starter New Member

    Mar 25, 2015
    5
    0
    Sorry, I assumed it was clear with a Microprocessor 68HC11. Assembly language.
     
  4. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    I can see it is 68HC11 assembly language. What software package are you running?
     
  5. Jimmy Faulks

    Thread Starter New Member

    Mar 25, 2015
    5
    0
    There is no software being ran with the MP. Just writing a short code that steps down from a-g and then I am to Trace it.
    A student only trying to learn not requiring coding only possible explanations of error.
     
  6. Jimmy Faulks

    Thread Starter New Member

    Mar 25, 2015
    5
    0
    upload_2015-3-25_20-42-47.png
     
  7. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    Are you using the 68HC11 for the first time?

    You have to use some kind of hardware and software.

    Firstly, you have to type the code using some kind of editor.
    Next, you need an assembler to translate the text file into machine code.
    Then you need either hardware or a simulator to run the code.

    There are already numerous errors in your code. The assembler will flag these errors for you. You cannot proceed unless you correct these errors.
     
  8. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    Ah, I see. So you are using BUFFALO. It will take me a long while to set up BUFFALO, which I have never used for any practical purpose.

    Let's back up for a moment. Why are you doing this? Why have you chosen 68HC11?

    What is the full part number printed on the 68HC11 chip?
    Can you post a photo of the board so that we can see what this dinosaur looks like?
     
    Last edited: Mar 25, 2015
  9. Jimmy Faulks

    Thread Starter New Member

    Mar 25, 2015
    5
    0
    When using the notepad ++, there isn't any errors. After this DosBox gives me my .s19 file with bytes in it.
    And again, after this I am trying to Trace the code I just wrote. It isn't meant to do anything special. Although this is my first experience with the MP, I fail to understand what the intent of you asking what simulator or editor I am using. None of this matters with the question I have asked.
     
Loading...