School of computer science

Georgia Institute of Technology

CS4803/CS8803PGC, Spring 2012
Programming Assignment #1
Due: Monday, January 30, 12:00 pm (Demo after the class time. )
Hyesoon Kim, Instructor

Introduction
You should submit your code and report at T-square as well. In this assignment, you will learn how to read touch screen coordinates.


Assignment In this assignment you are building a simple touch screen coordinate reading program using Nintendo DS Assembly programming with NDS library. Similar to class task #2, you modify the x, y value using the keys. X and Y value computation should be also written by assembly code.
A: Turn on touch screen reading feature
B: Turn off touch screen reading feature
Up: Y value is incremented by 1
Down: Y value is decremented by 1
Left: X value is decremented by 1
Right: X value is incremented by 1


You have to set up SPI and read SPI data correctly. Use Arm 7 to read and use Arm 9 to display the coordinates. Just like the class task #2, you will use assembly code. Your screen needs to be updated every 1/60th seconds and the screen should says
"Touch screen reader x=%4X y=%4X your name"
Please see the lecture notes (3.lec_arm_prog2.pptx) file to get some initial starting code.


Grading
You demo your screen and then submit the code in the T-square.
The demo will be during the classroom.
C-code version: 40%
Assembly code version: 50%
Report: 10%
Report should include commented code and simple descriptions. Any problems encountered and solutions


Useful links
ARM GCC Iline Assembler Cookbook
NDS/Tutorials (Especially Day 2)
NDS Programming manual
SPI settings


Compilation
You have to compile ARM7 and ARM9 codes.
This a very basic build script which assumes that arm9.c will run on arm9 and arm7.c will run on arm7 processors respectively. These 2 files should be in a folder called "source". It produces touch_without_api.nds. The -O0 option is used when compiling the arm7 code to turn off optimization. This script also assumes that you installed devKitPro with the default path

 
arm-eabi-gcc -O0 -c source\arm7.c -o source\arm7.o -I C:\devKitPro\libnds\include -DARM7
arm-eabi-gcc -o source\arm7.elf source\arm7.o -LC:\devKitPro\libnds\lib -lnds7 -specs=ds_arm7.specs
arm-eabi-objcopy -O binary source\arm7.elf source\arm7.bin
arm-eabi-gcc -c source\arm9.c -o source\arm9.o -I C:\devKitPro\libnds\include -DARM9 
arm-eabi-gcc -o source\arm9.elf source\arm9.o -LC:\devKitPro\libnds\lib -lnds9 -specs=ds_arm9.specs
arm-eabi-objcopy -O binary source\arm9.elf source\arm9.bin
 
ndstool -7 source\arm7.bin -9 source\arm9.bin -c touch_without_api_in_asm.nds
rm source\arm7.o
rm source\arm7.elf
rm source\arm7.bin
rm source\arm9.o
rm source\arm9.elf
rm source\arm9.bin
 
if you have a problem with path follow the direction to set up your path in windows.