Hi, I just exposed myself to assembly language a few days ago so these questions might seem dumb but please bear with me 1) What does dc.b mean? It is used in the code in this context: dc.b "Enter your name." , CR, LF Does dc.b mean define constant.byte? If so how is this sentence a byte? 2) What does org mean? Any help would be highly appreciated. Thanks
You don't say what processor and assembler you're using so it could mean anything. Different processors use different languages, and different assemblers for each processor implement the language slightly differently, so for the answer to mean anything it has to be in the context of a specific processor (or processor family) and assembler. So it's entirely possible that dc.b means define constant byte, or possibly bytes, and that the particular assembler you're using allows you to define a series of bytes rather than making you do dc.b 'E' dc.b 'n' dc.b 't' etc, which would be really tedious. org again depends on the processor and assembler, but often it's short for "origin" and defines what address the program should be compiled to.
Thanks, I'm using Coldfire 5307 processor One more question: What is the difference between data and address register? The way I understand it is data register stores data like integers etc. and address register stores addresses. But then what does the foll. code mean: move.1 D1, -(A7) move #9, D1 jsr print_out move.l (A7)+, D1 Print_out is a subroutine in the code among several other subroutines and I notice that the code in intalics marks the near end and beginning of every subroutine. What does it mean? Thanks
Data and address registers are essentially the same thing; both store numbers, but some instructions will only work on data registers and some only on address registers. In general you should use data registers to store data and address registers to store addresses, but you can crossover if necessary. If you're doing pointer arithmetic you could use both types. move.l d1, -(A7) moves the contents of D1 to the memory location pointed to by A7-4 (or possibly A7-1; I'd have to RTFM to be sure, but A7-4 makes more sense than A7-1) move #9,D1 sets D1 to 9 jsr calls a function - I don't know what that does move.l (A7)+,d1 moves the contents of memory location pointed to by A7 to D1, and increases A7 by 4 (or 1). So A7 is probably being used as a stack for safe storage of whatever is in D1, and the references to -(A7) and (A7)+ are equivalent to push and pop instructions in other processors. It's a long time since I looked at 68000 programming (Amiga days...sigh...) but I have a vague idea that A7 is generally used as the processor stack pointer. If that's the case then jsr probably modifies A7 too; it'll push the return address onto the stack.
A1 is the register, (A1) is the memory location pointed to by A1. So if A1 contains 1000 and D1 contains 50, move D1,A1 sets A1 to 50, but move d1,(a1) sets memory location 1000 to 50 and doesn't change A1 itself.
Sorry I'm being slow but is this what you mean: move D1, A1 implies A1 is now not pointing to memory location 1000 but instead is pointing to memory location containing 50 move D1, (A1) implies memory location 1000 is set to contain 50. is 1000 the address or the contents? Thanks
> move D1, A1 implies A1 is now not pointing to memory location 1000 correct. > but instead is pointing to memory location containing 50 No, A1 is now pointing to memory location 50 > move D1, (A1) implies memory location 1000 is set to contain 50. is 1000 the address or the contents? Memory location/address 1000 contains the value/has contents 50. There is a 50 stored at address 1000. move 50,d1 move 1000,a1 move d1,(a1) // stores 50 at 1000 move 1000,d1 move 50,a1 move d1,(a1) // stores 1000 at 50 move 1000,d1 move d1,a1 move d1,(a1) // stores 1000 at 1000 Probably the best bet is to download an emulator and watch how memory is affected by simple code examples like the above. If you restrict all values to, say, less than 25, and the emulator has RAM at addresses 0-25, then you should be able to keep track of everything without taking up too much screen space or getting confused scrolling from one area to another trying to find the value.
Since Coldfire 5307 is based on the 68000 chip this may be of interest: http://www.easy68k.com/ It's something I keep meaning to try out but time shortages have prevented it so far.
Sorry i'm newbie here and like to learn.I had a problem here can anyone give a code/solution for this problem,i had try but fail. 8085 Question: Connect a DIP switch to port B and 7 segment(common Cathode) to port C.Write a program to read input from DIP switch connected to port B and display them on each segment of the 7 segment as show below: DIP SWITCH 7 segment 0000 - all segments off 0001 - segment A on,others off 0010 - segment B on,others off 0011 - segment C on, others off 0100 - segment D on,others off 0101 - segment E on, others off 0110 - segment F on,others off 0111 - segment G on, others off 1000 - segment DP on,others off 1001 - all segment on
The org means the beginning location in RAM.That is the location from which the code writing is beginning.