Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Bascom - feature request 2

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
hacker007

Bascom Member



Joined: 11 Apr 2004
Posts: 44
Location: Slovenia

slovenia.gif
PostPosted: Fri Oct 15, 2004 12:29 pm    Post subject: Bascom - feature request 2 Reply with quote

Hi Mark. I would like to see in AVR Bascom next feature. "Overlay" variable for free registers. Why? Let's see.
We have:
Code:

for I=1 to 10
   f=xx(i)*4+xx(i+1)
next
 

This does not compile, so I have to use:
Code:

t1=xx(i)
t1=t1*4
...
 


So this compiles into lots of code and as I know bascom has some free registers (i.e. that are not used), we could use them to spare some code space and step-results would not have to be stored into memory like now. So it would look like:
Code:

dim q1 as free_register
...
q1=xx(i)
q1=q1*4
...
 


You know, it would space some of those LDS, STS or whatever they are...

Is this possible?
Rok Rodic

_________________
www.rodic.si - Medicine, electronics - home automation system ROSA, homemade stuff, programming...
Back to top
View user's profile Visit poster's website
oe9vfj

Moderator



Joined: 17 Jun 2004
Posts: 269
Location: Austria, Hard

austria.gif
PostPosted: Fri Oct 15, 2004 2:24 pm    Post subject: Reply with quote

Hi Rok,

BASCOM-AVR has no free registers in the way, you want to use it. Crying or Very sad

Registers r0 to r9 are used for BASCOM internal information at runtime.
You can read details about that in the help file.
r28,r29 (yl, yh) are used too for the Soft-Stack pointer.

The other registers (r10 to r27 and r30,r31) are used as working registers for each bascom statement. Depending of the statement some or all of this registers are used.

If you want to use registers for step results you have to know, which registers are not used from that statements you are working Question . If there are registers you can use, the BASCOM statement have to copy this step result registers to its working registers and back at the end. You will not save a lot of flash space.
If you want to reduce code space to lowest possible amount, you have to write critical parts in ASM.

_________________
regards Josef

DOS - File System for BASCOM-AVR on http://members.aon.at/voegel
Back to top
View user's profile Visit poster's website
hacker007

Bascom Member



Joined: 11 Apr 2004
Posts: 44
Location: Slovenia

slovenia.gif
PostPosted: Fri Oct 15, 2004 2:46 pm    Post subject: Reply with quote

Hi.
What I meant:
1. Bascom should have a lookup table for registers used, so programmers could see which ones are available.
2. As examples above - they are calculated into working registers (WR), by DIM programmer should define their "reservation" purpose (RR) and bascom should use this RR instead of WR. See:

$regfile = "m128def.dat"
$crystal = 8000000
$baud = 4800

Dim X As Byte
Dim Y As Byte
Dim E As Byte
For X = 1 To 10
'E = E + X * 3 + Y
Dim F As Byte
F = X * 3
F = F + Y
E = E + F
Next
End



Does This:

ldi r24,k01
sts D0100,r24
L0069:
lds r16,D0100
cpi r16,k0A
brcs L0070
breq L0070
jmp L008F
L0070:
lds r16,D0100
ldi r20,k03
mul r16,r20
ldi r26,k03
ldi r27,k01
st X,r0
lds r16,D0103
lds r20,D0101
add r16,r20
ldi r26,k03
ldi r27,k01
st X,r16
lds r16,D0102
lds r20,D0103
add r16,r20
ldi r26,k02
ldi r27,k01
st X,r16
ldi r26,k00
ldi r27,k01
ld r24,X
subi r24,kFF
st X,r24
breq L008F
jmp L0069
L008F:
cli
L0090:
rjmp L0090


BUT If I define (in future) Dim F as free_register
(free_register is up to bascom to define - I don't care, I just one all the things which I calculate with this F register to be read or stored to a register) the code would be very small. (I do not want to duscuss here what happens if I override 255 boundery of byte- that is up to programmer if he want to use byte variable)

So I know what compiler does, You do not have to tell me that... I know what are the registers used for, but just at looking what comes from the code above, you should get it, there are plenty of odd registers...

_________________
www.rodic.si - Medicine, electronics - home automation system ROSA, homemade stuff, programming...
Back to top
View user's profile Visit poster's website
hacker007

Bascom Member



Joined: 11 Apr 2004
Posts: 44
Location: Slovenia

slovenia.gif
PostPosted: Fri Oct 15, 2004 2:52 pm    Post subject: Reply with quote

By figure 1. I mean bascom should provide info at certain points in programm which are free. Not in generally. But this would not matter if we could just reservate either register by DIM.
_________________
www.rodic.si - Medicine, electronics - home automation system ROSA, homemade stuff, programming...
Back to top
View user's profile Visit poster's website
hacker007

Bascom Member



Joined: 11 Apr 2004
Posts: 44
Location: Slovenia

slovenia.gif
PostPosted: Sat Oct 16, 2004 10:25 am    Post subject: Reply with quote

Other feature request is a line somewhere in the menus or icon in toolbar which whould start my browser and go to this forum.
_________________
www.rodic.si - Medicine, electronics - home automation system ROSA, homemade stuff, programming...
Back to top
View user's profile Visit poster's website
hacker007

Bascom Member



Joined: 11 Apr 2004
Posts: 44
Location: Slovenia

slovenia.gif
PostPosted: Sun Oct 17, 2004 9:44 am    Post subject: Reply with quote

To add something more. I would like to have an integrated calculator in bascom supporting hex,dec,bin in bascom syntax allowing copy/paste and switching between it and bascom IDE itself.
_________________
www.rodic.si - Medicine, electronics - home automation system ROSA, homemade stuff, programming...
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 6198
Location: Holland

blank.gif
PostPosted: Sun Oct 24, 2004 9:34 pm    Post subject: Reply with quote

Registers are always free between 2 program statements.(except the mentioned R6,r8-r9 and r28/r29)
This means you can use the others when you like.
So between 2 statements, bascom does not depends on the registers.

For enhancement requests : it is good to ask for them here.
Most of them will not be put in the current IDE however but they will find their way into the new IDE.
Sorry, I do not release info on the new IDE as my work has been stolen before. Which means you see it when it is ready.

Maybe it is a good idea to start a separate forum for enhancements.

_________________
Mark
Back to top
View user's profile Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive 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