One simple thing you can do is to combine commonly occurring sequences into a sub, for example
Code:
hl2:
pause x
high two
low one
return
doing that (and making variables 'byte' instead of 'word') drops it down from 1K to 330
Code:
'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 15.05.2014 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
'device=PIC12F683
'Include "Modedefs.bas"
Define OSC 8 ' Set Xtal Frequency
cik var byte 'loop variable
x var byte 'delay variable
sub var byte 'intracounter variable
ZERO var GPIO.0
ONE VAR GPIO.4
TWO VAR GPIO.1
TRE VAR GPIO.2
ANSEL = %00000000
CMCON0 = 7
TRISIO = %00001000
OSCCON = %01110111
sub=9
x=30
'INIT tube and reset to 0
inika:
LOW ONE
LOW TWO
LOW TRE
HIGH ZERO
PAUSE x
LOW ZERO
tavi:
'stage 1______________________________________________
sub=9
gosub sub9
high one 'proper finish? one and two
gosub hl2
gosub hl0
pause 1000 'delay for display
low zero
'stage 2 ______________________________________________
gosub sub9
gosub subzero
pause 1000
low one
'stage 3____________________________________________
gosub sub9
gosub subzero
gosub hl2
pause 1000
gosub hl3
low tre
'stage 4____________________________________________
sub=8
gosub sub9
gosub subzero
gosub hl2
gosub hl3
pause 1000
low tre
'stage 5____________________________________________
gosub sub9
gosub subzero
gosub hl2
gosub hl3
gosub hl1
pause 1000
low one
'stage 6____________________________________________
gosub sub9
gosub subzero
gosub hl2
gosub hl3
gosub hl1
gosub hl2
pause 1000
high tre
low two
'stage 7____________________________________________
pause x
low tre
sub=7
gosub sub9
gosub subzero
gosub hl2
gosub hl3
gosub hl1
high two
low one
gosub hl3
pause 1000
low tre
'stage 8____________________________________________
gosub sub9
gosub subzero
gosub hl2
gosub hl3
gosub hl1
gosub hl2
gosub hl3
gosub hl1
pause 1000
low one
'stage 9____________________________________________
'X=100
gosub sub9
gosub subzero
gosub hl2
gosub hl3
gosub hl1
gosub hl2
gosub hl3
gosub hl1
gosub hl2
pause 1000
high tre
low two
pause x
'stage 10____________________________________________
low tre
sub=6
gosub sub9
gosub subzero
gosub hl2
gosub hl3
gosub hl1
gosub hl2
gosub hl3
gosub hl1
gosub hl2
gosub hl3
pause 1000
low tre
goto tavi
hl0:
pause x'delay for display
high zero
low two
return
hl1:
pause x
high one
low tre
return
hl2:
pause x
high two
low one
return
hl3:
pause x
high tre
low two
return
sub9: 'subroutine for spinning
for cik=1 to sub 'amount needed for full loop
gosub hl1
gosub hl2
gosub hl3
next
low tre
return
subzero:
high one 'proper finish? one and two
gosub hl2
high zero
low two
pause x'delay for display
high one
low zero 'subzero here
return
I've bound to have goofed that up somewhere so it's up to you to fix whatever I screwed up, but you get the idea.
Bookmarks