Technical discussions about Freescale Microcontrollers: M68HC11. (Freescale Semiconductor is a Subsidiary of Motorola).
|
Hi, I am trying to use the FCC command to send ASCII code to port B. I can assemble it fine but when it comes to running it it says " Illegal opcode at C001 ^Q". If the 'H' is by itself it works fine. Any suggestions much appreciated! org $c000 message fcc 'HELLO' ldy #message loop lda $00,y staa $1004 iny jmp loop WAI Bal |
|
|
|
Unless you are jumping to past 'message' you are trying to execute the message as CODE. 0x48 'H' may be a valid opcode and 0x45 'E' is not. I'm not going to bother looking it up. Put 'message' at the END of your code. And since you have no termination test for 'jmp loop' you will output your entire memory space at maximum speed as Y steps through all possible values. If $1004 is a UART you will see nothing but gibberish as every n'th memory location gets output. R bal_gill21 wrote: > Hi, > I am trying to use the FCC command to send ASCII code to port B. I > can assemble it fine but when it comes to running it it says " > Illegal opcode at C001 ^Q". If the 'H' is by itself it works fine. > Any suggestions much appreciated! > > org $c000 > message fcc 'HELLO' > ldy #message > loop lda $00,y > staa $1004 > iny > jmp loop > WAI > > Bal |
|
|
|
Yes, I am actually single stepping the code so that I don't output the entire memory space. The original code had a test for the jump loop but it never got that far. Bal --- In , Robert Rolf <robert.rolf@u...> wrote: > Unless you are jumping to past 'message' you are trying to > execute the message as CODE. 0x48 'H' may be a valid opcode > and 0x45 'E' is not. I'm not going to bother looking it up. > Put 'message' at the END of your code. > And since you have no termination test for 'jmp loop' > you will output your entire memory space at maximum speed > as Y steps through all possible values. > If $1004 is a UART you will see nothing but gibberish > as every n'th memory location gets output. > > R > > bal_gill21 wrote: > > > > > Hi, > > I am trying to use the FCC command to send ASCII code to port B. I > > can assemble it fine but when it comes to running it it says " > > Illegal opcode at C001 ^Q". If the 'H' is by itself it works fine. > > Any suggestions much appreciated! > > > > org $c000 > > message fcc 'HELLO' > > ldy #message > > loop lda $00,y > > staa $1004 > > iny > > jmp loop > > WAI > > > > Bal |
|
|
|
I think the question was How do you expect control to pass to the ldy instuction? you need to branch around the character storage declaraction. once compiled, there is no real difference between storage values set by FCC or FCB and storage initialized by assembler instructions. The key difference is whether the MCU can execute it. Try: org $c000 bra instr message fcc 'Hello' instr ldy #message .... Jim bal_gill21 wrote: >Yes, I am actually single stepping the code so that I don't output >the entire memory space. The original code had a test for the jump >loop but it never got that far. > >Bal >--- In , Robert Rolf <robert.rolf@u...> wrote: >>Unless you are jumping to past 'message' you are trying to >>execute the message as CODE. 0x48 'H' may be a valid opcode >>and 0x45 'E' is not. I'm not going to bother looking it up. >>Put 'message' at the END of your code. >>And since you have no termination test for 'jmp loop' >>you will output your entire memory space at maximum speed >>as Y steps through all possible values. >>If $1004 is a UART you will see nothing but gibberish >>as every n'th memory location gets output. >> >>R >> >>bal_gill21 wrote: >> >> >> >>>Hi, >>>I am trying to use the FCC command to send ASCII code to port B. >>> >>> >I >>>can assemble it fine but when it comes to running it it says " >>>Illegal opcode at C001 ^Q". If the 'H' is by itself it works >>> >>> >fine. >>>Any suggestions much appreciated! >>> >>> org $c000 >>>message fcc 'HELLO' >>> ldy #message >>>loop lda $00,y >>> staa $1004 >>> iny >>> jmp loop >>> WAI >>> >>>Bal >>> >> > > >Yahoo! Groups Links [Non-text portions of this message have been removed] |
|
|
|
Thank you Jim, it worked just fine! I see it just needed to be manipulated slightly. Bal --- In , Jim Peterson <jimcp@m...> wrote: > I think the question was How do you expect control to pass to the ldy > instuction? you need to branch around the character storage > declaraction. once compiled, there is no real difference between storage > values set by FCC or FCB and storage initialized by assembler > instructions. The key difference is whether the MCU can execute it. > > Try: > > org $c000 > bra instr > message fcc 'Hello' > instr ldy #message > .... > > Jim > > bal_gill21 wrote: > > >Yes, I am actually single stepping the code so that I don't output > >the entire memory space. The original code had a test for the jump > >loop but it never got that far. > > > >Bal > >--- In , Robert Rolf <robert.rolf@u...> wrote: > > > > > >>Unless you are jumping to past 'message' you are trying to > >>execute the message as CODE. 0x48 'H' may be a valid opcode > >>and 0x45 'E' is not. I'm not going to bother looking it up. > >>Put 'message' at the END of your code. > >>And since you have no termination test for 'jmp loop' > >>you will output your entire memory space at maximum speed > >>as Y steps through all possible values. > >>If $1004 is a UART you will see nothing but gibberish > >>as every n'th memory location gets output. > >> > >>R > >> > >>bal_gill21 wrote: > >> > >> > >> > >>>Hi, > >>>I am trying to use the FCC command to send ASCII code to port B. > >>> > >>> > >I > > > > > >>>can assemble it fine but when it comes to running it it says " > >>>Illegal opcode at C001 ^Q". If the 'H' is by itself it works > >>> > >>> > >fine. > > > > > >>>Any suggestions much appreciated! > >>> > >>> org $c000 > >>>message fcc 'HELLO' > >>> ldy #message > >>>loop lda $00,y > >>> staa $1004 > >>> iny > >>> jmp loop > >>> WAI > >>> > >>>Bal > >>> > >>> > > > > > > > > > > > > > > > >Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > [Non-text portions of this message have been removed] |
|
|
|
Bal, Except for the previously noted loop frfom here to end of memory aspect of the loop. In general, you will probably want to search the 68HC11 Reference Manual for a code sample with the instruction you are interested in. A typical convention is to use a "stopper character" to identify the end of a string for such a loop. that is: message fcc 'hello' fcb $00 then your loop will stop on its own with: lda $00,y ; next character to a bz lp_exit ; end of string? exit Jim bal_gill21 wrote: >Thank you Jim, it worked just fine! I see it just needed to be >manipulated slightly. > >Bal > >--- In , Jim Peterson <jimcp@m...> wrote: >>I think the question was How do you expect control to pass to the >> >> >ldy >>instuction? you need to branch around the character storage >>declaraction. once compiled, there is no real difference between >> >> >storage >>values set by FCC or FCB and storage initialized by assembler >>instructions. The key difference is whether the MCU can execute it. >> >>Try: >> >> org $c000 >> bra instr >>message fcc 'Hello' >>instr ldy #message >> .... >> >>Jim >> >>bal_gill21 wrote: >> >> >> >>>Yes, I am actually single stepping the code so that I don't output >>>the entire memory space. The original code had a test for the jump >>>loop but it never got that far. >>> >>>Bal >>>--- In , Robert Rolf <robert.rolf@u...> >>> >>> >wrote: >>> >>> >>> >>> >>>>Unless you are jumping to past 'message' you are trying to >>>>execute the message as CODE. 0x48 'H' may be a valid opcode >>>>and 0x45 'E' is not. I'm not going to bother looking it up. >>>>Put 'message' at the END of your code. >>>>And since you have no termination test for 'jmp loop' >>>>you will output your entire memory space at maximum speed >>>>as Y steps through all possible values. >>>>If $1004 is a UART you will see nothing but gibberish >>>>as every n'th memory location gets output. >>>> >>>>R >>>> >>>>bal_gill21 wrote: >>>> >>>> >>>> >>>> >>>> >>>>>Hi, >>>>>I am trying to use the FCC command to send ASCII code to port B. >>>>> >>>>> >>>>> >>>>> >>>I >>> >>> >>> >>> >>>>>can assemble it fine but when it comes to running it it says " >>>>>Illegal opcode at C001 ^Q". If the 'H' is by itself it works >>>>> >>>>> >>>>> >>>>> >>>fine. >>> >>> >>> >>> >>>>>Any suggestions much appreciated! >>>>> >>>>> org $c000 >>>>>message fcc 'HELLO' >>>>> ldy #message >>>>>loop lda $00,y >>>>> staa $1004 >>>>> iny >>>>> jmp loop >>>>> WAI >>>>> >>>>>Bal >>>>> >>>>> >>>>> >>>>> >>> >>> >>> >>> >>> >>>Yahoo! Groups Links >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>[Non-text portions of this message have been removed] >> > > > >Yahoo! Groups Links [Non-text portions of this message have been removed] |