Would appreciate if someone can tell/show me how to combine C and assembly code in the Uvision 2?
Do you mean you want uVision to display both the C source code and ASM at the same time as you debug? - Mark
yes thank u. what must be done with i want to combine both language. must i save both language in different file name?? If not, what should i include in the program. thank for your reply. thank u.
You still haven't said exactly what you want to do: 1. In your 'C' source file, include a little bit of assembler for some "tricky" task; 2. Make a project which contains both 'C' and assembler source files; 3. In the listing file, view the assembler code generated by the compiler for your 'C' source; 4. While debugging, view both 'C' source and corresponding assembler. So here we go: 1. To include some assembler within a 'C' source file, use the #pragma asm - as described on p12 of the C51 User's Guide [1]. Note that you also need to specify the SRC directive to make the Compiler emit assembler source, and then pass that to the assembler to generate the object! (in uVision2, just check the 'Generate Assembler SRC File' and 'Assemble SRC File' options in the file properties for the 'C' source) 2. To make a project comprising both 'C' and assembler files: just add the sources to your Project. uVision will ensure that the appropriate translator (compiler or assembler) is used to generate the object, and then the linker just links all the objects. See the C51 User's Guide p141 for details of interfacing 'C' and Assembler. See also the uVision User's Guide [2] 3. View both source & assembler in the compiler listfile: use the CODE directive - see User's Guide p15. Or check 'Assembly Code' in the uVision 'Listing' options for your Project. (Unfortunately this gives the 'C' and assembler in separate parts of the listing - Keil C51 does not produce an "interleaved" C+Assembler listing). 4. View both source & assembler while debugging: With uVision in Debug mode (Debug/Start Debug Session), use View/Disassembly window. In this case you do get "interleaved" C+Assembler Note that you must have enable Debug Info generation for this to work (Project's 'Output' options). References: [1] C51 User's Guide 03.2000 [2] uVision User's Guide 06.2000, "Getting Started and Creating Applications" All the manuals are on the free CD in PDF format.