Log in

View Full Version : picbaisc pro compiler routines "question!"



moud_man
- 22nd September 2005, 12:24
hi all

my question is:

picbasic pro has too many routines and built in functions so

if i use for ex. the routine "pause 20" in a line it will be placed in a program location ,if i reused a "pause 20" again will the compiler place another code in the program memory for that or use the previosly one used?

if i declared a sub-routine that i will use many times as:

delay:
pause 20
return

is that a solution and better than writting "pause 20" every time i need ?will it affect the program ?

thnx
bye

mister_e
- 22nd September 2005, 14:33
pause 5
pause 10
pause 20
pause 50
pause 100
pause 500

60 words





a var word

a=5:gosub DelayMs
a=10:gosub DelayMs
a=20:gosub DelayMs
a=50:gosub DelayMs
a=100:gosub DelayMs
a=500:gosub DelayMs


DelayMs:
pause a
return

83 words





a var word
asm
DelayMs macro Delay
MOVE?CW Delay,_a
L?CALL _DoDelay
endm
endasm


@ DelayMs 5
@ DelayMs 10
@ DelayMs 20
@ DelayMs 50
@ DelayMs 100
@ DelayMs 500

DoDelay:
pause a
return

83 words





@ Ifndef PAUSE?C
pause 0
@ endif

asm
DelayMs macro Delay
PAUSE?C Delay
endm
endasm


@ DelayMs 5
@ DelayMs 10
@ DelayMs 20
@ DelayMs 50
@ DelayMs 100
@ DelayMs 500

60 words