Re: 請問一下~有關ASM30~MACRO的寫法
|
||||
---|---|---|---|---|
初級會員
|
這幾天我自己又在試了一下
發現 只要我的MACRO裡面有label 然後在主程式只要連續使用此macro 二次 就會發生以下的錯誤訊息 macro_main.s: Assembler messages: macro_main.s:0: Warning: end of file not at end of a line; newline inserted macro_main.s:28: Error: symbol `test1' is already defined macro_main.s:28: Error: symbol `test2' is already defined 如果只使用一次的話是可以使用的 我想問~是不是要額外的對macro裡面的label做什麼定義 請有經驗的人可以幫我解答一下
發表於: 2009/1/5 10:31
|
|||
|
Re: 請問一下~有關ASM30~MACRO的寫法
|
||||
---|---|---|---|---|
初級會員
|
參照:
發表於: 2009/1/3 2:16
|
|||
|
Re: 請問一下~有關ASM30~MACRO的寫法
|
||||
---|---|---|---|---|
初級會員
|
其實我主要的目的~是想將常用的應用程式
變成一個指令 這樣可以讓我寫程式更快速以及除錯更容易 目前我的進度已經連結好了 那又發生另外一個問題了 就是我定好的MACRO無法在主程式連續用2次 .nolist .macro OK_int input fb result mov \input,w0 goto lala test1: mov \fb,w1 goto popop test2: sub w0,w1,w2 mov w2,\result .endm 以上是我的MACRO 以下是我的主程式 __reset: MOV #__SP_init,w15 MOV #__SPLIM_init,W0 MOV W0,SPLIM CLR aaa clr yang MOV #100,W3 MOV W3,aaa mov #50,w4 OK_int aaa w4 yang OK_int w4 aaa yang loop: nop nop nop bra loop 組譯的時候會發生以下的錯誤訊息 macro_main.s: Assembler messages: macro_main.s:0: Warning: end of file not at end of a line; newline inserted macro_main.s:29: Error: symbol `test1' is already defined macro_main.s:29: Error: symbol `test2' is already defined 請有經驗的人可以幫我看一下要怎麼改嗎 謝謝
發表於: 2009/1/2 18:27
|
|||
|
Re: 請問一下~有關ASM30~MACRO的寫法
|
||||
---|---|---|---|---|
資深會員
|
include 應該就可以了,但(執行的)code size問題並不會解決.
(還是你說的"程式很大",是說(source code)"檔案很大"問題--這你已解決)
發表於: 2009/1/2 13:24
|
|||
|
Re: 請問一下~有關ASM30~MACRO的寫法
|
||||
---|---|---|---|---|
初級會員
|
恩~我知道
但是重複的程式太多了 又不想用CALL的方式 所以要用MACRO 那現在我MACRO的語法會了 但是現在我是寫在同一個.s檔裡 要是寫在不同的.s檔~我不知道要如何做連結 我貼上我目前的測試程式 .equ __30f2023,1 .include "p30f2023.inc" .global __reset .macro OK_int input mov \input,w0 .endm .section .plplp,bss,address(0x850) aaa: .space 2 .text __reset: MOV #__SP_init,w15 MOV #__SPLIM_init,W0 MOV W0,SPLIM CLR aaa MOV #100,W3 MOV W3,aaa OK_int aaa loop: nop bra loop 目前我的想法是想把.MACRO的部分寫在另外的*.s檔 但是我試了之後沒辦法執行 所以想請會的人幫我寫一下 謝謝
發表於: 2008/12/31 15:45
|
|||
|
Re: 請問一下~有關ASM30~MACRO的寫法
|
||||
---|---|---|---|---|
版主
|
程式大的話用 MARCO 並不會減少Code Size,應該是改用呼叫副程式的方式,可以的話將你的 Marco 或一些重覆動作的程式改成副程式,這樣才能減少 Code Size 的。
MARCO 是標準的語法,只要打開 ASM30 User's Guide 用 Search 找一下marco 就知道怎樣用了。
發表於: 2008/12/29 22:06
|
|||
|
請問一下~有關ASM30~MACRO的寫法
|
||||
---|---|---|---|---|
初級會員
|
如題
因為程式很大 所以想把部分的程式MACRO化 不過我找不到範例可以參考 希望有誰幫我指引個方向 或者是可以告訴我該如何寫 PS: 我用的是組語~不是C 謝謝
發表於: 2008/12/29 20:24
|
|||
|