No exact or substring matches. trying for part
PICList
Thread
'[PICLIST] Macros for automatic banks management - '
2000\09\05@151637
by
wzab
|
part 1 1278 bytes content-type:text/plain; charset=us-asciiHi All,
Being tired of continuous watching of active bank, I've got an idea of
macros for automatic bank management. (see the attached pictest.asm source)
I wanted to keep the currently active bank in a symbol "xb_cur".
When using any variable, I check the bank this var belongs to, and
if necessary change the RP0 & RP1 bits, updating the "xb_cur".
The macro "xmovwf" adds the necessary checks to the "movwf" instruction.
Similar macros should be written to wrap other instructions.
Certainly there is a problem with "entry points". When any label may be a
target of "goto" or "call" instruction, one must take care to assure
that bank 0 is active:
xbank_set 0
target1
[...]
xbank_set 0
goto target1
Well, everything works fine, when compiled with MPASM, but doesn't with
gpasm (see the attached "lst" files). Does anybody know how to fix my macros
for gpasm?
Maybe someone knows a better way to implement this functionality?
--
TIA & Greetings
Wojciech Zabolotny
http://www.ise.pw.edu.pl/~wzab
http://www.debian.org Use Linux - an OS without "trojan horses" inside
part 2 831 bytes content-type:text/plain; charset=us-ascii
list p=16f877
include "p16f877.inc"
xb_cur set 0
xbank_set macro xb_new
IF (xb_new & 1) && !(xb_cur & 1)
bsf STATUS,RP0
ENDIF
IF (xb_cur & 1) && !(xb_new & 1)
bcf STATUS,RP0
ENDIF
IF (xb_new & 2) && !(xb_cur & 2)
bsf STATUS,RP1
ENDIF
IF (xb_cur & 2) && !(xb_new & 2)
bcf STATUS,RP1
ENDIF
xb_cur set xb_new
ENDM
xbank_vset macro xvar
xbank_set (xvar/0x80)
ENDM
xmovwf macro xvar
xbank_vset xvar
movwf xvar
endm
org 0x10
xbank_set 0
movlw 0x34
xmovwf PORTB
xmovwf PORTA
xmovwf TRISB
xmovwf TRISA
xmovwf PORTB
end
part 3 2123 bytes content-type:application/octet-stream (decode)
part 4 2699 bytes content-type:application/octet-stream (decode)
part 5 142 bytes (decode)
'[PIC]: Macros for automatic banks management - pro'
2000\09\05@163115
by
wzab
On Tue, Sep 05, 2000 at 12:45:51PM -0700, James Newton wrote:
>
> Its really more than a macro should have to handle. It SHOULD be done by the
> assembler.
>
But does any of the available assemblers make it? AFAIK it is the user's
responsibility to watch the proper bank switching :-(.
The high level languages (C, JAL, SIL) do it, but this is another story.
--
Wojciech Zabolotny
http://www.ise.pw.edu.pl/~wzab
http://www.freedos.org Free DOS for free people!
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics
2000\09\05@163122
by
wzab
|
part 1 1352 bytes content-type:text/plain; charset=us-ascii[I'm resending this letter withe the proper [PIC]: label in the subject]
Hi All,
Being tired of continuous watching of active bank, I've got an idea of
macros for automatic bank management. (see the attached pictest.asm source)
I wanted to keep the currently active bank in a symbol "xb_cur".
When using any variable, I check the bank this var belongs to, and
if necessary change the RP0 & RP1 bits, updating the "xb_cur".
The macro "xmovwf" adds the necessary checks to the "movwf" instruction.
Similar macros should be written to wrap other instructions.
Certainly there is a problem with "entry points". When any label may be a
target of "goto" or "call" instruction, one must take care to assure
that bank 0 is active:
xbank_set 0
target1
[...]
xbank_set 0
goto target1
Well, everything works fine, when compiled with MPASM, but doesn't with
gpasm (see the attached "lst" files). Does anybody know how to fix my macros
for gpasm?
Maybe someone knows a better way to implement this functionality?
--
TIA & Greetings
Wojciech Zabolotny
http://www.ise.pw.edu.pl/~wzab
http://www.debian.org Use Linux - an OS without "trojan horses" inside
part 2 831 bytes content-type:text/plain; charset=us-ascii
list p=16f877
include "p16f877.inc"
xb_cur set 0
xbank_set macro xb_new
IF (xb_new & 1) && !(xb_cur & 1)
bsf STATUS,RP0
ENDIF
IF (xb_cur & 1) && !(xb_new & 1)
bcf STATUS,RP0
ENDIF
IF (xb_new & 2) && !(xb_cur & 2)
bsf STATUS,RP1
ENDIF
IF (xb_cur & 2) && !(xb_new & 2)
bcf STATUS,RP1
ENDIF
xb_cur set xb_new
ENDM
xbank_vset macro xvar
xbank_set (xvar/0x80)
ENDM
xmovwf macro xvar
xbank_vset xvar
movwf xvar
endm
org 0x10
xbank_set 0
movlw 0x34
xmovwf PORTB
xmovwf PORTA
xmovwf TRISB
xmovwf TRISA
xmovwf PORTB
end
part 3 2123 bytes content-type:application/octet-stream (decode)
part 4 2699 bytes content-type:application/octet-stream (decode)
part 5 142 bytes (decode)
More... (looser matching)
- Last day of these posts
- In 2000
, 2001 only
- Today
- New search...