Hi,
I am writing loader in assembler for S12ZVL device. I am trying to load 32bit registers D6 and D7 with address stored in RAM but without succes. Could you please help me?
definition of the comm. port:
ComPort equ PTT
Here is how my variables are defined:
; variable/data section
MY_EXTENDED_RAM: SECTION
; Insert here your data definition.
StartAddr ds.l 1
EndAddr ds.l 1
ActualPageAddr ds.b 1
WhichArea ds.b 1
the variables are filled wit this procedure: hdsk is step, where the data are set to port T from the master.
BSR hdsk
MOV.B ComPort,StartAddr+1
BSR hdsk
MOV.B ComPort,StartAddr+2
BSR hdsk
MOV.B ComPort,StartAddr+3
BSR hdsk
MOV.B ComPort,EndAddr+1
BSR hdsk
MOV.B ComPort,EndAddr+2
BSR hdsk
MOV.B ComPort,EndAddr+3
and the next step I would like to do is to load 32 bit value StartAddr to D7 register.
I try:
LD D7,StartAddr
but when I do it this way, only one byte is loaded to D7... bits 0-7 of the D7 with value on StartAddr.
How to load whole 32 bit value stored in StarAddr variable?
Hi Jozef,
I tested your code on our board and everything works fine on my side.
ComPort equ PTT
; variable/data section
MY_EXTENDED_RAM: SECTION
StartAddr ds.l 1
EndAddr ds.l 1
EndlessLoop:
LD D6, #$01234567 ;Start
ST D6, StartAddr ;Start
LD D6, #$76543210 ;End
ST D6, EndAddr ;end
; now StartAddr contains 0x01234567 and EndAddr contains 0x76543210
MOV.B ComPort,StartAddr+1
MOV.B ComPort,StartAddr+2
MOV.B ComPort,StartAddr+3
MOV.B ComPort,EndAddr+1
MOV.B ComPort,EndAddr+2
MOV.B ComPort,EndAddr+3
; since PTT has stable 0x00 value, it rewrites lowest 3 bytes from StartAddr and EndAddr addresses.
; now StartAddr contains 0x01000000 and EndAddr contains 0x76000000
LD D7,StartAddr ;Load Start
; now D7 contains 0x01000000
; when I comment out MOV.B instructions, D7 will contains 0x01234567
Could you please check whether described behavior is expected for your application?
Please check whether port T is in input mode (DDRTx=0).
Please check whether some of the pins are not affected by any externally connected circuit or whether they are not dedicated to any other function like timer (if you use output compare channels, please disconnect timer from pins by OCPD register)
The opcode for LD D7,StartAddr command is 0xB7001104 (StartAddr starts at address 0x1104).
Could you please check opcode on your side?
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------