Board logo

标题: 用ADS汇编怎样实现打开一个文本的编程阿 [打印本页]

作者: liujianyong9    时间: 2006-4-24 16:13     标题: 用ADS汇编怎样实现打开一个文本的编程阿

我是一个初学者,有没有人知道,怎样用用ADS汇编怎样实现打开一个文本的编程阿,有高手吗?用到SWI


下面是问题:


Refer to the ARM System Calls document and read about the following system calls:fficeffice" />


SWI_Open, SWI_Flen, SWI_Read, SWI_Write. An example is given to show how you can write a short file on disk. Write a program to open the file turing.txt, and print its content on the screen. (More system calls information on http://www.arm.com, look for ADS 1.2 Debugger Target Guide) Two examples of system calls are attached at the end of this assignment specification. (One is outputting string to the debugger console, one is writing string to a file on the host debugger (PC).


例如:


AREA Hello_Word, CODE, READONLY ; name this block of code


 


; function ID codes to be put into r0


SWI_WriteC   EQU 0x03             ;output character address in r1


SWI_Exit       EQU 0x18             ;finish program


SWI_FUN             EQU       0x123456


             


              ENTRY   ;code entry point


START   LDR r1,=TEXT


              SUB r1,r1,#1 


              LDR  r0, = SWI_WriteC


ffice:smarttags" />LOOP     ADD r1,r1,#1


              LDRB r2, [r1]


              CMP r2, #0                 


              SWINE SWI_FUN             


              BNE LOOP                 


              LDR  r0, = SWI_Exit


           SWI  SWI_FUN      


TEXT DCB "Hello World!", &0a, &0d, 0 ; string + CR + LF + null


            END


作者: linuxarm    时间: 2006-4-25 17:17

这个倒还真没有试过... ...




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0