Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

dooble and RAMPZ?

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
uga237

Bascom Member



Joined: 15 May 2012
Posts: 32

blank.gif
PostPosted: Sun Aug 11, 2019 4:12 pm    Post subject: dooble and RAMPZ? Reply with quote

No set RAMPZ for test Double with constant from CPU ROM(Flash)

$regfile = "xm256a3udef.dat"
$crystal = 32000000

Config Submode = New

$hwstack = 500
$swstack = 500
$framesize = 500

Config Osc = Enabled , 32mhzosc = Enabled
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1

!cli

Dim D As Double
D = 0
Dim S As Single
S = 0

If D <> 0 Then
D = 1
End If

If S <> 0 Then
S = 1
End If

Stop


Sub: set RAMPZ
000001C2 0b.bf OUT 0x3B,R16
000001C3 0f.91 POP R16
000001C4 88.94 CLC
000001C5 08.95 RET
000001C6 0f.93 PUSH R16
000001C7 00.27 CLR R16
000001C8 f9.cf RJMP PC-0x0006




Init double and single:
D = 0
00000135 a9.e2 LDI R26,0x29
00000136 b0.e2 LDI R27,0x20
D = 0
00000137 ea.e5 LDI R30,0x5A
00000138 f4.e0 LDI R31,0x04
D = 0
00000139 0e.94.c6.01 CALL 0x000001C6 Call set RAMPZ - OK
D = 0
0000013B 0e.94.fb.01 CALL 0x000001FB Set to 0(double 8 bytes) from ROM(ELPM)

S = 0
0000013D a1.e3 LDI R26,0x31
0000013E b0.e2 LDI R27,0x20
S = 0
0000013F ea.e5 LDI R30,0x5A
00000140 f4.e0 LDI R31,0x04
S = 0
00000141 0e.94.c6.01 CALL 0x000001C6 Call set RAMPZ - OK
S = 0
00000143 0e.94.b3.01 CALL 0x000001B3 Set to 0(single 4 bytes) from ROM(ELPM)


Test single:
If S <> 0 Then
00000156 0e.94.bb.01 CALL 0x000001BB
If S <> 0 Then
00000158 e1.e3 LDI R30,0x31
00000159 f0.e2 LDI R31,0x20
If S <> 0 Then
0000015A 0e.94.1b.02 CALL 0x0000021B
If S <> 0 Then
0000015C ea.e5 LDI R30,0x5A
0000015D f4.e0 LDI R31,0x04
If S <> 0 Then
0000015E 0e.94.c6.01 CALL 0x000001C6 Call set RAMPZ - OK
If S <> 0 Then
00000160 0e.94.20.02 CALL 0x00000220 Get 0(single 4 bytes) from ROM (ELPM)
If S <> 0 Then
00000162 0e.94.02.02 CALL 0x00000202 Compare
If S <> 0 Then
00000164 11.f4 BRNE PC+0x03
00000165 0c.94.6f.01 JMP 0x0000016F
S = 1
00000167 a1.e3 LDI R26,0x31
00000168 b0.e2 LDI R27,0x20
S = 1
00000169 ea.e6 LDI R30,0x6A
0000016A f4.e0 LDI R31,0x04
S = 1
0000016B 0e.94.c6.01 CALL 0x000001C6 Call set RAMPZ - OK
S = 1
0000016D 0e.94.b3.01 CALL 0x000001B3 Set to 1(single 4 bytes) from ROM(ELPM)


And now Test double:
If D <> 0 Then
00000145 a9.e2 LDI R26,0x29
00000146 b0.e2 LDI R27,0x20
If D <> 0 Then
00000147 ea.e5 LDI R30,0x5A
00000148 f4.e0 LDI R31,0x04
If D <> 0 Then
00000149 0e.94.d4.01 CALL 0x000001D4 Get 0(double 8 bytes) from ROM 0x045A(ELPM), compare with RAM 0x2029 and NO set RAMPZ!
If D <> 0 Then
0000014B 11.f4 BRNE PC+0x03 l
0000014C 0c.94.56.01 JMP 0x00000156
D = 1
0000014E a9.e2 LDI R26,0x29
0000014F b0.e2 LDI R27,0x20
D = 1
00000150 e2.e6 LDI R30,0x62
00000151 f4.e0 LDI R31,0x04
D = 1
00000152 0e.94.c6.01 CALL 0x000001C6 Call set RAMPZ - OK
D = 1
00000154 0e.94.fb.01 CALL 0x000001FB Set to 1(double 8 bytes) from ROM(ELPM)

(BASCOM-AVR version : 2.0.8.0 , Latest : 2.0.8.2 )
Back to top
View user's profile
uga237

Bascom Member



Joined: 15 May 2012
Posts: 32

blank.gif
PostPosted: Sun Aug 11, 2019 5:33 pm    Post subject: Reply with quote

UPD:
Is this corrected in 2.0.8.2?


If D <> 0 Then
00000145 a8.e0 LDI R26,0x08
00000146 b0.e2 LDI R27,0x20
If D <> 0 Then
00000147 ee.e5 LDI R30,0x5E
00000148 f4.e0 LDI R31,0x04
If D <> 0 Then
00000149 0e.94.c8.01 CALL 0x000001C8 Added in 2.0.8.2? or in 2.0.8.1?
If D <> 0 Then
0000014B 0e.94.d6.01 CALL 0x000001D6
If D <> 0 Then
0000014D 11.f4 BRNE PC+0x03
0000014E 0c.94.58.01 JMP 0x00000158
D = 1
00000150 a8.e0 LDI R26,0x08
00000151 b0.e2 LDI R27,0x20
D = 1
00000152 e6.e6 LDI R30,0x66
00000153 f4.e0 LDI R31,0x04
D = 1
00000154 0e.94.c8.01 CALL 0x000001C8
D = 1
00000156 0e.94.fd.01 CALL 0x000001FD
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum