3 ; Copyright (C) 2010,2012,2013 Leo C.
5 ; This file is part of avrcpm.
7 ; avrcpm is free software: you can redistribute it and/or modify it
8 ; under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation, either version 3 of the License, or
10 ; (at your option) any later version.
12 ; avrcpm is distributed in the hope that it will be useful,
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ; GNU General Public License for more details.
17 ; You should have received a copy of the GNU General Public License
18 ; along with avrcpm. If not, see <http://www.gnu.org/licenses/>.
23 ;------------------------------------------------
33 ;------------------------------------------------
43 ;------------------------------------------------
54 ;------------------------------------------------
55 ; load 16 bit constant to register pair
62 ;------------------------------------------------
63 ; load 16 bit direct from data space
70 ;------------------------------------------------
71 ; store 16 bit direct to data space
78 ;------------------------------------------------
79 ; add 16 bit constant to register pair
86 ;------------------------------------------------
87 ; sub 16 bit constant from register pair
94 ;------------------------------------------------
95 ; Move single bit between two registers
97 ; bmov dstreg,dstbit,srcreg.srcbit
104 ;------------------------------------------------
109 .set pos_ = PC ;save current position
110 .org @0 ;vector address
111 .set dist_ = pos_ - (PC+1)
115 .elif (dist_ - (FLASHEND+1)) > -2048
116 .set disp_ = (dist_ - (FLASHEND+1)) & 0xFFF
117 ; rjmp pos_ - (FLASHEND+1)
120 jmp pos_ ;jump to handler
123 .org pos_ ;restore PC
126 ;------------------------------------------------
133 .if FLASHEND > 0x0fff
135 .set dist_ = @0 - (PC+1)
139 .elif dist_ < -(FLASHEND+1-2048)
140 .dw 0xC000 | (dist_ + (FLASHEND+1)) & 0xFFF
147 .elif dist_ > (FLASHEND+1-2048)
148 .dw 0xC000 | (dist_ - (FLASHEND+1)) & 0xFFF
164 .if FLASHEND > 0x0fff
166 .if abs(PC - @0) > 2047
180 ;------------------------------------------------
184 .if FLASHEND > 0x0fff
186 .set dist_ = @0 - (PC+1)
190 .elif dist_ < -(FLASHEND+1-2048)
191 .dw 0xC000 | (dist_ + (FLASHEND+1)) & 0xFFF
198 .elif dist_ > (FLASHEND+1-2048)
199 .dw 0xC000 | (dist_ - (FLASHEND+1)) & 0xFFF
212 ;------------------------------------------------
214 ; printstring "String"
225 ;------------------------------------------------
235 ;------------------------------------------------
238 ; where F is the flag to print
255 ;------------------------------------------------
256 ; db_version VMAJOR, VMINOR
267 .db maj1_+'0',maj0_+'0','.',min1_+'0',min0_+'0',0
269 .db maj1_+'0',maj0_+'0','.', min0_+'0',0,0
273 .db maj0_+'0','.',min1_+'0',min0_+'0',0,0
275 .db maj0_+'0','.', min0_+'0',0
280 ; vim:set ts=8 noet nowrap