+ 6
Is there any challenges in C Language or assembly language 8086?
I think C language should be available for challenges and I have forgotten everything of html, CSS, JavaScript ,C++,SQL,VB and Assembly 8086 what I had learnt past 12 years due to lack of usage. The only language what I had learnt recently in 7 days was C. This is like learning again for the 2nd time due to lack of usage due to over time work schedule I have been facing for many years. Now finally it has gone and don't know when will it be back.So want to take advantage of the time.
34 odpowiedzi
+ 5
Aman Kumar Challenge accepted for 8085 microprocessor.
Assembly program for mp 8085:-
LXI B, 1A0H /* 10 T-states */
DELAY : DCX B /* 6 T-states */
MOV A,C /* 4 T-states */
ORA B. /* 4 T-states */
JNZ DELAY /* 10 T-states */
Time delay from label DELAY till JNZ DELAY = sum of all T-states of all the instructions within the Label delay.
It can also be said as:-
Time delay for the loop (TL) =((6T+4T+4T+10T) * 416) - 3
=9981 T-states
Now,
Time delay for outside the loop(TO)=sum of T-states outside the loop or label DELAY
= 10T
Now for 2Mhz frequency crystal oscillator the frequency of the microprocessor is equal to half of crystal oscillator frequency.
fm = ½ fc
fm = 2/2
Microprocessor inside frequency = 1Mhz
Now frequency is inversely proportional to time.Therefore,
Tm=1/fm
= 1 microseconds
Now,
Total time delay = Time delay outside loop+ Time delay inside loop
Time delay = (TO + TL)* Tm
=(10+9981)*(1 *10 ^ -6)
= 0.009991
= 9.99 ms
= approx. 10ms
+ 4
Aman Kumar Dear brother Aman Kumar,
Do you mean in reference to T- states?If so then here it is.
The time delay is based on the t-states of all the instructions. So for 2Mhz frequency of crystal oscillator the clock time period is 1 microsecond inside the 8085 mp. So if you want to the answer in clock states (i.e) T-states then you don't need to multiply with clock time period for 1 clock state...
Now for the above example total time delay is 9991 t-states and in some books they leave it till here only.So answer is correct provide you need to write T-states after 9991.
And if you want time delay in ms(milliseconds) then you need to multiply with the duration of 1 clock period of the clock state (i.e) 1 microseconds for 2Mhz frequency crystal oscillator.
Therefore,
TD= (9991)*(10^-6)
= 0.009991 microseconds
= 9.99 milliseconds.
So in some books they multiply with 1/2 crystal osillator frequency's time period which is correct and in some books they write total time delay without the crystal oscillator frequency (i.e) in t-states which is also correct provided one must write "T-states" after the delay.
+ 4
Aman Kumar I think this formula should work for creating the required delay in ms. using register pair method of 16bit (the above example).
Load register = (required time delay)/ { (sum of all T-states within the loop)*(time period of the 1/2 crystal oscillator frequency) }
for the above example,
Required time delay = 10*(10^-3) sec.
sum of all T-states within the Label DELAY = 24*(10^-6)
Load register =10*(10^-3)/{24*(10^-6)}
= 416.66
Ignore the decimal and convert it to hexadecimal which is 1A0.
load 1A0 in B register and you get the output.
So you see crystal oscillator frequency is not ignored as it is required to calculate the load register B.
So the answers of some books stops till the total time delay in T-states which is correct and some books they include the crystal oscillator frequency to display in ms( milliseconds) which is obviously correct..This case pertains to only in display of answers.
While in the method of generating required time delay it should include crystal oscillator frequency to get the value to load register B.
Apart from that if the method is to find time delay of any program then it can be excluded or included provided the conditions I have mentioned above.
Hope you understood!!
Check out my codings:- Here goes Tower of Hanoi with detail explanation...
https://code.sololearn.com/cP85gj7Vyz9Q/?ref=app
+ 4
You answer is in the description of my question I posted...
Briefing:-
We all learn everyday and everywhere.But what differs is how we approach to certain situation, I mean how we want to learn.
For example consider a situation,
if the sky is cloudy and it's time to rain.
Some people won't be bothered and continue their work.
Some people will work and continue to bothered about weather and blindly forecasting ignoring out many aspects.
And some people will pause for a moment see the direction of clouds and see the direction of winds and determine the speed of wind by the leaves of tree and calculate the relative difference of the two velocities rate and find an approximation to a weather forecasting and the result will be at least 60% true.The 40% is beyond human approach.
So what I mean is we learn every day and every time irrespective of age provided the time bends with the time you approach. In other words the relative difference between you and the situation which is space is always negative to the time. But since time cannot be negative in reality.The space which comprises of age and all earthly things inside and outside human body is independent of time thus resulting in 3-D space.
So you see that every human till death is always accustomed to learning provided what curiosity instinct's one.
Therefore we keep learning and learn what we need to apply it logically.
So you see we don't have a constant for GENIUS when people refer them as GENIUS.The Knowledge of GENIUS is just a singularity of black hole.So one can be referred closer to the term GENIUS but not exactly GENIUS.
+ 4
Aman Kumar Brother Aman Kumar,
Your Challenge is accepted to generate delay of 1 min for counting 0-10 in C language for Turbo C++.
I will write the code here directly so that you can copy and paste it and run it directly on turbo C++ ide. I will take 5mins,please run and check the result and inform me.
#include <studio.h>
#include <time.h>
int main()
{
int i;
for (i=0;i<=10;i++)
{
delay(60000);
printf("\n\n %d",i);
}
getch();
return 0;
}
Happy coding 😊
+ 4
Aman Kumar
"well, as per my knowledge in c++, this program will not work in turbo c++. The reason behind is that:
1) you don't use any looping statement then how it will work fine.
2) wrong ascii value of up and down keys.
...
..."
For your information up arrow is 72 and down arrow is 80. which you said wrong.Now those are called ANSI keyboard extended codes. NUM lock on ASCII with E02A for up arrow as 72.Please learn properly and do research.Yes it's very good you are doing research but learn properly...I think you should know what extended bytes are 😔....Those are ANSI extended bytes .Your values are also correct.And I think you should know the concept of INTERRUPT VECTOR HANDLER TABLE working and how it is linked to the handler..and how it works.
As a part of proof my program is correct with those extended byte values, I am attaching you this proof...😱.
http://microvga.com/ansi-keycodes.
So I think you need to correct your statement of blind judgement of that program.Because I wrote it at a great pace by mining some time from my hectic schedule.So I accepted the challenge also and participated and You blindly telling it wont work.And when I checked by executing in Turbo C++ after recieving your reply, it was working well.. you did research with the ASCII keys but forgot about ANSI extended values of keyboard whereas you are Turbo C++ user but I am not.I get the rarest luck to use that.I hardly get time to sit on Turbo C++ and learn.So make sure before you make this kind of judgement.
My values 72 for up arrow and 80 for down arrow which I wrote in that program are ANSI keyboard extended values and they are correct.Heres the proof.So you see, you must not judge blindly by assuming something of yourself.
http://microvga.com/ansi-keycodes.
+ 3
Shudarshan Rai Thank you for your information.😃.I know there are other languages but I wanted C language.
+ 3
Aman Kumar If you like it upvote the answer to let it reach everyone and let everybody learn.
+ 3
Aman Kumar Here is the code for delay countdown provided delay given by the user.
https://code.sololearn.com/c1bsCR3o9XNU/?ref=app
+ 3
Aman Kumar What I meant was,I have touched or came back to programming after 12 years of gap.I have directly started here and this is my first touch after 12 years of gap. I think you know the scenarios before 12 years and how difficult it was to learn anything. Thanks again @sololearn team for providing this platform.
When you asked me the question challenge of 8085 I had acall to hippocampus of the brain @ 9600 baud rate with 34 t-states.
Yes definitely for sure if I have doubt I will ask you.Thank you for your support and kindness 😊
Curiosity teaches as better as experience.
Curiosity creates innovation and experience creates wisdom. Combining both we get the divine knowledge.
And if you don't mind I think I need to close myself and remain low because everything is going public here.
FOLLOW ME IF YOU LIKE MY UPDATES AND CODES in C Language.
If you like my code for the challenge in c-language please share it and like it so that everybody can learn.
Once again Happy coding!!
+ 3
Aman Kumar What??😞 I got lots of other work...please keep away any challenges for at least 6 months.Please Remember this 6 months matter 🙂.Well for shortening the time will write just roughly.
CHALLENGE ACCEPTED! HERE'S YOUR CODE.JUST WRITING IT ROUGHLY.
SO YOUR PROGRAMS SAY SELECT USING ARROW KEYS.
IF it is defined with its hexadecimal address then it's easy to write.However the decimal values are easier I think.
Brief working:-
So I am writing the program like I am disabling the side arrow keys and only enabling up and down arrow keys. and when it's selected and if you press enter it will get executed.For pressing enter Key I am putting simply message.you can put your code here.Also I am not scanning for escape characters for whole program but for exit if you press enter it exits.How ever I am not writing that database part because it's out of the challenge part and it becomes length to write within 10 mins. So here's the code....I am writing now.Give me 25mins because my hands are tired.And I will link it here!
+ 3
CHALLENGE ACCEPTED:- HERES YOUR CODE
https://code.sololearn.com/cIfI0YogWjq2/?ref=app
+ 3
Aman Kumar I wrote that program roughly now. posted it.
NOW TILL 6 MONTHS I WILL BE HAVING A HARD SCHEDULE. SO PLEASE KEEP THE CHALLENGES OFF FOR THOSE MONTHS.
NOW CHALLENGE FOR YOU:-
#1 CHALLENGE :-
Write the same Challenge #3 for C program (Turbo C++)which you gave it to me for
1) Create Record
2) Delete
3)Display
4) Update
5) Exit
Using File pointers to manipulate the database.Use binary write/read/append to manipulate database.Use Account information like name,id,address,pan no. and other information.
Happy Coding 🙂
+ 3
Aman Kumar
Aman ,I will be very busy for 6 months so no challenges till that time but I will be giving you challenges. I am pasting my rough code directly here so that you can run it in your TurboC++ by copy paste and easier for you.As per your challenge I have written this and already posted above.Check the previous comments. But for the convenience I will paste here. I wrote it in a hurry and this is not compiled.I have directly written here and it's rough as I wrote in a hurry due to other work. So the coding is rough!! But according to the logic it should be correct!Here's the code........
CHALLENGE ACCEPTED
Program to make selection using arrow keys and other in C using IDE.
//© Coded/Created by Gaurav Nath aka D-Key on 18-05-2018.
// This program uses your keyboard console of PC or laptop to select input from the option list.This program is designed to work only for up and down arrow keys and enter key.If any other key is pressed it exists.Select the menu option using down arrow keys or up arrow keys and hit enter to get the detail of that option.However this program is made to use only select arrows and enter key as a part of the challenge given.So I have left some hint on each option to link your function or code.
//If you like upvote to get new C updates🙂.
//This program is made for Turbo C++ IDE.So it won't run here and one may get error for void main and clrscr() function.For minGW and Visual studio C++ users need to use _getch() as get character function.
+ 3
Aman Kumar
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
void main()
{
int ch,hc,cr,ds,up,de;
// note that this clrscr() is a clear screen function to clear your screen for turbo c++ in Dos shell.Its not supported here.Turbo C++ has some very old libraries.
clrscr();
printf("\n\n -----MAIN MENU-----");
printf("\n\n1) Create Account");
printf("\n\n2) Display");
printf("\n\n3) Update");
printf("\n\n4) Delete");
printf("\n\n5) Exit");
// Just prevent that escape character and prevent double tap of up or down arrow for only once.
ch=getch();
if (ch==0)
ch=getch();
+ 3
Aman Kumar
// get the values of required keys(DOS) and compare of the keys to be true. Invoke the DOS interrupt of Assembly.
if(ch==72 || ch==80)
{
ch=getch();
ch=getch();
printf("\n1)Create Account");
}
else
exit(0);
cr=getch();
if(cr==0)
cr=getch();
// If you press Enter(in DOS) then the option gets execute with what code or function it has.Here it is just a print message.
if(cr==13)
printf("\n Your Create Account link here");
if(ch==72 || ch==80)
{
ch=getch();
ch=getch();
printf("\n2)Display");
}
else
exit(0);
ds=getch();
if(ds==0)
ds=getch();
if(ds==13)
printf("\nYour Display code link here");
if(ch==72 || ch==80)
{
ch=getch();
ch=getch();
printf ("\n3) Update");
}
else
exit(0);
up=getch();
if(up==0)
up=getch();
if(up==13)
printf("\n Your Update link here");
if(ch==72 || ch== 80)
{
ch=getch();
ch=getch();
printf ("\n4) Delete");
}
else
exit(0);
de=getch();
if(de==0)
de=getch();
if(de==13);
printf("\n Your Delete code link here");
if(ch==72 || ch==80)
{
ch=getch();
ch=getch();
printf("\n5)Exit);
hc=getch();
if(hc==0)
hc=gectch();
//Function exits on enter key in DOS shell
if(hc ==13)
exit(0);
}
else
exit(0);
getch();
}
If you like upvote all replies and comment to spread knowledge so that others can learn too.
https://code.sololearn.com/cIfI0YogWjq2/?ref=app
+ 3
Aman Kumar
Secondly please note before you speak anything just verify.I wrote it in English and it's directly understandable.You just need to read it.😂
Hey I checked just now. I typed and checked and it's working in my turbo C++.This is a C program bdw F.Y.I.
Secondly you don't need to loop anything.
Those values are correct and I determined and check the return values.
I think you didn't understand what I said.Please read all my replies.
My program does exactly what you said.You just looping your statement for nothing...I think you should check before you see. And BDW I am using Neutron's Turbo C++.
So when I used to work with assembly,I used those values to input but with obviously hexadecimal for LCD input and display on MP/MC plugins,robotic low eye vision.and that was working for me!!!
And secondly I don't know how you are doing research.But I verified it's working.
Your must learn more Aman!!
And I checked just now.Its working!!!
+ 3
Aman Kumar what is your logic in using loop???You can do without loop also.If you want that menu to appear again and again then loop it using do while. I mean that's common sense. I didn't use loop and used directly and used if statements.If you want you can use.If you want to repeat the whole then use do while loop....I even had to verify Now because you told it's not working. But its working beautifully!! How come your all replies are so hasty.
Now to give you an example of your hastiness see your reply.... "well,as per my knowledge in c++, this program will not work in turbo c++."
I mean that challenge was given in c so why do you need to apply your c++ knowledge???
Well a special note to you:- "Before judging someone that it's wrong see that you have efficient knowledge in that matter so that you can literally say its wrong".
I wrote all the instructions in my program,go through it.
And I know you are not free for three weeks but this Challenge is needed to be completed as it's your 1st challenge from my side.And you see even I'm very busy but I accepted your Challenge and after completing only I gave you the suggestion to stop giving challenges here.So I think you can see the difference.
+ 3
Aman Kumar Please see that I wrote that program in Neutron's Turbo C++ and I got correct answer and it does what the Challenge was given to.Secondly I think you should stop giving those Turbo C++ challenges, nit because there is no Turbo C++ here but there is no proper way to judge and prove here in this community as it doesnot support that.
And for the greater fair judgement we must use the C compiler of the solo learn.So that there is no case like this...And being a programmer you can't afford hastiness.Again I'm telling you, I'm sitting in front of that blue screen of Neutron's Turbo C++ and when I run it executes.See these keys are working!! I got the return values of the keys.
+ 3
I didn't mean to insult you.And yes I'm very busy provided I do work both the ways.Multi tasking.And yes you cannot define the amount of time one is busy just by checking how much time one spends here☺️. Because you have no idea about the time I get busy and how do I manage.I try to keep both sides open.So please don't analyse others time as it's a variable bro.And I am not wasting time here because I am learning and helping others here who wants to learn. Anyways can you refer your statement as what example you are talking about??? Please paste it in your reply.And at least write properly what is it you are talking about because my program is working and the challenge what you gave me is also working.So I am not getting what are you talking about.And please check my all replies because I may have written it there.