can someone help, im needing to do some inline assembly, not really getting anywhere, i just need to count to 480 in assemby been messing with a lot of code but start to get lost in the amount of decfz's and goto $ etc.
all im looking to do is the equiv of "repeat until x = 480",but its not easy, can some one give me just a pointer please? thanks in advance
assembly
Re: assembly
im just using a 16f84 at this point, the project is a vga sync chip, so i think
this chip is all i will need, ive used some hex from the net for a vga project, but, it doesnt
work with all monitors i have as the timing is out a bit looking on the scope, so im starting from scratch.
just need to count the lines then break out of the routine give a v sync and back to the counting again.
this chip is all i will need, ive used some hex from the net for a vga project, but, it doesnt
work with all monitors i have as the timing is out a bit looking on the scope, so im starting from scratch.
just need to count the lines then break out of the routine give a v sync and back to the counting again.
Re: assembly
If all you need is 'repeat until x = 480' then why don't you just write it in mP and look at the assembly the compiler produced?
BTW, 'repeat until x = 480' comes to a comparison rather than to any counting requiring decfz's and goto $. Or do you 'count' the lines by a time delay? (In such case simply write delay_us(required_time_in_microseconds) and see what the compiler produced with the processor clock you've chosen.)
BTW, 'repeat until x = 480' comes to a comparison rather than to any counting requiring decfz's and goto $. Or do you 'count' the lines by a time delay? (In such case simply write delay_us(required_time_in_microseconds) and see what the compiler produced with the processor clock you've chosen.)
Re: assembly
hi mate,
i tried to copy the asm produced,there were 14 lines and when i debugged the code it didnt appear to do anything but loop around, i set x to 10 just to see it exit the loop when x =10.
is there something else i could try?
i tried to copy the asm produced,there were 14 lines and when i debugged the code it didnt appear to do anything but loop around, i set x to 10 just to see it exit the loop when x =10.
is there something else i could try?
Re: assembly
Post the code you tried so we'll be able to know what do you exactly need.
Re: assembly
the pascal is
program x1;
var
x:integer;
begin
x :=0;
repeat
until x = 10;
end.
the copied asm after taking addresses out is
when debugging it just goes round and round without changing val of X
program x1;
var
x:integer;
begin
x :=0;
asm
BCF STATUS, RP1
BCF STATUS, RP0
CLRF _x
CLRF _x+1
;x1.ppas,9 :: repeat
x1_L_1:
;x1.ppas,10 :: until x = 10;
x1_L_2:
MOVLW 0
XORWF _x+1, 0
BTFSS STATUS, Z
GOTO L_main_0
MOVLW 10
XORWF _x, 0
L_main_0:
BTFSS STATUS, Z
GOTO x1_L_4
x1_L_5:
GOTO x1_L_3
x1_L_4:
GOTO x1_L_1
x1_L_3:
end;
end.
program x1;
var
x:integer;
begin
x :=0;
repeat
until x = 10;
end.
the copied asm after taking addresses out is
when debugging it just goes round and round without changing val of X
program x1;
var
x:integer;
begin
x :=0;
asm
BCF STATUS, RP1
BCF STATUS, RP0
CLRF _x
CLRF _x+1
;x1.ppas,9 :: repeat
x1_L_1:
;x1.ppas,10 :: until x = 10;
x1_L_2:
MOVLW 0
XORWF _x+1, 0
BTFSS STATUS, Z
GOTO L_main_0
MOVLW 10
XORWF _x, 0
L_main_0:
BTFSS STATUS, Z
GOTO x1_L_4
x1_L_5:
GOTO x1_L_3
x1_L_4:
GOTO x1_L_1
x1_L_3:
end;
end.
Re: assembly
Well, what did you expect? x stays 0, you do not modify it inside the loop. Add inc(x) to the Pascal code, and the loop will end after x reaches set limit.trigstig wrote:when debugging it just goes round and round without changing val of X
To tell the truth, I still don't really know what you want to achieve and why do you need assembly.
Re: assembly
yeah sorry didnt see that, is it possible write a vga sync signal in pascal?
everyone seems to use assembly
ive always had this impression that assembly is faster than a high level language.
everyone seems to use assembly
ive always had this impression that assembly is faster than a high level language.
Re: assembly
That's because assembly has fully predictable timing.trigstig wrote:yeah sorry didnt see that, is it possible write a vga sync signal in pascal?
everyone seems to use assembly
Assembly may be faster, depending on who writes it .ive always had this impression that assembly is faster than a high level language.
As I told you before, you may write needed code in Pascal, then take the resulting assembly and optimize it. At the least you'll learn how to write assembly inserts under mP.
And search the forums, somebody might have already done what you need.