Introduction to 68000 Programming Environment Using Metro Werks

  • Slides: 24
Download presentation
Introduction to 68000 Programming Environment Using Metro. Werks Code. Warrior and Palm Emulator 1

Introduction to 68000 Programming Environment Using Metro. Werks Code. Warrior and Palm Emulator 1

Contents 1. Differences between standard 68000 assembly language and Palm-based assembly language 2. Overview

Contents 1. Differences between standard 68000 assembly language and Palm-based assembly language 2. Overview of Metro. Werks Code. Warrior and Palm Emulator 3. Download and Instrall 4. Using Metro. Werks Code. Warrior to 5. - edit a program 6. - compile a program 7. - make (link) and program 8. - load a program 5. Palm Emulator 2

Differences between standard 68000 assembly language and Palm-based assembly language Standard Assembly program Palm

Differences between standard 68000 assembly language and Palm-based assembly language Standard Assembly program Palm Emulator Assembly program embedded in C Hexadecimal: $FF 20 Hexadecimal: 0 x. FF 20 Label MTCH Label must have a colon MTCH: Assembly directives ORG, EQU, DC, DS Assembly directives DC Number. B, . W, . L Number. W, . L Comments after * or 4 th column Comments in C format after // or in /*. . . */ 3

Overview editor C & 68000 assembly program 68000 Assembler executable binary of a specific

Overview editor C & 68000 assembly program 68000 Assembler executable binary of a specific machine linker Metro. Werks Code. Warrior Programming Environment 68000 machine code Embedded in C compiler . . . other 68000 code Bring Up to Date Make executable code PDA or Emulator Palm De. Bugger 4

Download and Install Palm Emulator and Metro. Werks Download and install Palm Emulator and

Download and Install Palm Emulator and Metro. Werks Download and install Palm Emulator and Metro. Werks Demo version on your PC. 1) Go to the following URL for the steps needed to install Code. Warrior. The Palm Emulator comes with the demo version 8. 0. http: //www. palmos. com/dev/training/online/course_p_1 -r. html 2) The links are provided for the Code. Warrior download. When selecting the link: http: //www. metrowerks. com/contact/secure/palmdemo/ you are taken to the download area of the metrowerks website. If you scroll down to the bottom of the screen you will see fields for your name and email address. You will need to fill in this information and send it in order to receive an email with a password in order to install the demo. 3) Next you need to register with palm in order to access the ROM images. It takes one or two business days to process the request in order to download. The link to join is, http: //www. palmos. com/dev/programs/pdp/join. html 5

Download and install (contd. ) 4) After installing the Code. Warrior demo, all the

Download and install (contd. ) 4) After installing the Code. Warrior demo, all the items that you will need are in the Code. Warrior folder in 5) C: Program FilesMetrowerksCode. Warrior. 6) The Palm Emulator is in 7) . . . Code. WarriorPalm ToolsPalm OS 4. 0 SDKOther Tools. 5) Download the sample package Sample. Project. zip 6) Unzip and start the project. 6

Using GWC 167 Lab for CSE 225 You could do the sample project in

Using GWC 167 Lab for CSE 225 You could do the sample project in CSE 225 lab, or follow the same steps to do it on your PC. In GWC 167, you must save your work into a floppy disk, or into your M drive, or email it to your email account. Your work will be automatically removed after you log off your account. Please note, Code. Warrior Demo and Palm Emulator have been installed in the machines in GWC 167. 7

Using Code. Warrior • Go to Homework 5CSE 225 Lab 0 • Open the

Using Code. Warrior • Go to Homework 5CSE 225 Lab 0 • Open the project file "Lab 0. mcp" • Close the "project message" window if it occurs • Click the "File" in the "Lab 0. mcp" window. • Open the "Palm Lab 0. c" file in "Assembly" folder in the Lab 0. mcp window. 8

Using Code. Warrior – contd. • Goto the Metro. Werks Code. Warrior menu: Project

Using Code. Warrior – contd. • Goto the Metro. Werks Code. Warrior menu: Project Compile, and then Project Bring Up To Date, and then Project Make to build the project • You are now ready to load the program on to Palm OS Emulator and execute it. 9

Put the Executable into the Device Folder • • • After the "Make" (link)

Put the Executable into the Device Folder • • • After the "Make" (link) operation, a lab 0 p 1. prc file (the final executable file) is created. If the "target" of your project is the set to the following directory "C: Program FilesMetrowerksCode. WarriorPalm ToolsPalm OS Other SDK ToolsPalm DebuggerDevice" the. prc file (executable) gets created in this directory, overwriting previous existing files. This target path should have been set. If not, you can set the project target settings accessible from the project main window. The path can be an absolute one or relative to your project folder. If you still do not know how to set this target path then manually copy the. prc file from its current location to the above location. Most likely, the current location is the "CSE 225 Lab folder". You can also use "search" to find it). Then do the following: – Copy the lab 0 p 1. prc file from your project folder – Go to folder "CSE 225" folder (on the desktop) – Go to Palm OS folder – Go to Palm Debugger folder – Go to Device folder – Paste the lab 0 p 1. prc file into the Device folder. 10

Using Palm OS Emulator • Go to folder "CSE 225" on the desktop •

Using Palm OS Emulator • Go to folder "CSE 225" on the desktop • Go to Palm OS folder • Open the Palm OS Emulator application (Emulator. exe) • You will see the following screen 11

Using Palm OS Emulator – cont. • Click on the New button. This will

Using Palm OS Emulator – cont. • Click on the New button. This will start a new Emulator session for you. • The following screen will appear. 12

Using Palm OS Emulator – cont. • Click on the drop-down list labeled ‘ROM

Using Palm OS Emulator – cont. • Click on the drop-down list labeled ‘ROM file’ • Select the option ‘Other’ • This will allow you to choose a particular ROM file. • Go to the folder ‘Popular ROM Downloads’ • Select the file ‘Palm OS 3. 5 -en-ezdbg’ 13

Using Palm OS Emulator – cont. • Click on Open button on the File

Using Palm OS Emulator – cont. • Click on Open button on the File Choose Dialog Box. • Now, you will see the following screen 14

Using Palm OS Emulator – cont. • Click on the drop-down list labeled ‘Device’

Using Palm OS Emulator – cont. • Click on the drop-down list labeled ‘Device’ • Select the option ‘Palm Vx’ • Click on the drop-down list labeled ‘RAM Size’ • Select the option ’ 16, 384 K’. • Click on the OK button. 15

Using Palm OS PDA/Emulator – cont. • The following screen will appear Application icon

Using Palm OS PDA/Emulator – cont. • The following screen will appear Application icon 16

Using Palm Debugger • Now, go to folder CSE 225 on the desktop •

Using Palm Debugger • Now, go to folder CSE 225 on the desktop • Go to Palm OS folder • Go to Palm Debugger folder • Open the Palm Debugger (Palm. Debugger. exe) This will allow you to download your application to the Palm OS Emulator 17

Using Palm Debugger – contd. • After doing the steps outlined in the previous

Using Palm Debugger – contd. • After doing the steps outlined in the previous slide, you should be able to see the Palm Debugger Application. • Now, go to Connection menu: • Select the "Emulator" option (If you see a " ", it is already selected). • Select the "USB" option if you have connected a Palm PDA (hand-held computer) through a USB cable. 18

Download the executable to the Palm Emulator • Go to Console window • Type

Download the executable to the Palm Emulator • Go to Console window • Type the following command: import 0 Lab 0 p 1. prc Note that Palm Emulator must be running before you execute the command. • If no errors occur, the debugger will indicate that your application has been downloaded to the Palm OS Emulator. Skip the next slide. 19

Download the executable to the Palm Emulator (contd. ) • If an error occurs,

Download the executable to the Palm Emulator (contd. ) • If an error occurs, close the Palm Emulator • Re-start the Palm Emulator • Redo the steps in the previous slide • If an error still occurs, close the Palm OS Emulator and Palm Debugger. • Redo the whole procedure 20

Download the executable to the Palm PDA • Make sure that your Palm Hotsync

Download the executable to the Palm PDA • Make sure that your Palm Hotsync manager is running (you should see the icon in the system trap. • Start the “Palm Desktop” application. • Click on the tool icon “install”. A dialog box will appear. • Click “Add” and browse to the location of the executable “Lab 0 p 1. prc”. It should be in your Device folder at: MetrowerksCode. WarriorPalm ToolsPalm OS 4. 0 SDK Other ToolsPalm. DebuggerDevice • After you have added the executable, push the Hotsync icon on the Cradle of the PDA. • The executable should be downloaded into the folder “unfiled”. • Start the application. Note, you must use the Stylus to enter the command. You can find how to write different 21 characters under “Graffiti” – “Try It”.

Set Breakpoints to Debug Your Programs • Add an debugging directive _Dbg. Break in

Set Breakpoints to Debug Your Programs • Add an debugging directive _Dbg. Break in your program to insert a breakpoint. • Then use g command in the Debugger Window of Palm Debugger to allow the program to execute up to its next breakpoint. • If there is no other breakpoint after this one, then the program will run to its completion. • When the program stops at the breakpoint, you can see the CPU registers in the window named ‘CPU Registers’ [lower right portion]. • When the program stops at the breakpoint, you can use the commands under menu "Source" to execute single 22 steps.

Printing to the Emulator Screen • You can use three library functions to print

Printing to the Emulator Screen • You can use three library functions to print memory or register contents - JSR Write. String: It will write a string starting from [M([A 0])] - JSR Write. Char: It will write a character stored in D 0 - JSR Write. Num: It will write a number stored in D 0 23

Back to Palm OS Emulator • Go back to Palm OS Emulator. • Click

Back to Palm OS Emulator • Go back to Palm OS Emulator. • Click on ‘Applications’ icon on the Palm screen. • You will see an icon that has your file name. • Click on it to execute your application Lab 0 p 1. 24