piclist 2000\11\06\181436a >
Thread: Memory layout?
www.piclist.com/techref/ubicom/lib/mem/index.htm?key=memory
face picon face BY : jamesnewton@piclist.com



You sure? If you have an SX Key, try these out... I was playing around while
I was waiting for responses:

Subroutine MACRO
noexpand
;Usage: Define a Global lable, execute Subroutine, assign :Entry to the
value now
;set in SubEntryAddr. Continue the definition of the subroutine. Elsewhere,
call
;@Sub:Entry where Sub is the global lable you defined for the subroutine.
;Example
;SUB1   Subroutine
;:Entry = SubEntryAddr
;....
;       Call SUB1:Entry
_SubAddr = $
org LowHalfPage
SubEntryAddr = $
;if we got here, the pagesel bits must be set for here
IF ($ / $100) = (_SubAddr / $100)
jmp _SubAddr
ELSE
jmp @_SubAddr
 ENDIF
LowHalfPage = $
IF $+1 & $100
  ERROR 'Out of LowHalfPage Space'
  ENDIF
org _SubAddr
ENDM

GotoW MACRO
noexpand
_SaveAddr = $
org LowHalfPage
_GotoWPage = \1
REPT \0
 IF (\% / $100) <> (_GotoWPage / $100)
  _GotoWPage = \%;
  ENDIF
 ENDR
IF ($ / $100) = (_SaveAddr / $100)
cja WReg,\0,_SaveAddr
ELSE
CJA WReg,\0,@_SaveAddr
 ENDIF
IF _GotoWPage <> \1 ;has to be a big table
rl WReg
 IF \0 > 128
jc :TableMiddle
jmp PC+W
  REPT \0
   IF \% < 128
jmp @\%
    ENDIF
   IF $+1 & $100
    ERROR 'Out of LowHalfPage Space'
    ENDIF
   ENDR
  ENDIF ;\0 > 128
 ENDIF ;_GotoWPage <> \1
:TableMiddle
jmp PC+W
REPT \0
 IF _GotoWPage <> \1
  IF \% >= 128
jmp @\%
   ENDIF
 ELSE
jmp \%
  ENDIF
IF $+1 & $100
  ERROR 'Out of LowHalfPage Space'
  ENDIF
 ENDR
LowHalfPage = $
org _SaveAddr
:TableEnd
ENDM

LookupW MACRO
noexpand
;Defines an in-line DW/IREAD lookup table returns the 12 bit value indexed
by W in M:W.
;Affects M and W.
jmp @:TableEnd
:TableBegin
REPT \0
DW \%
ENDR
:TableEnd
MOV M,#:TableBegin>>8  ;upper 4-bits of table address
IREAD                  ;Retrieve data
;{use the data}
ENDM

       org 0
ISR ;Put the ISR here (or just a jump to the ISR somewere eles in memory.
:Out

;Jump tables are assembled here by the SUBROUTINE, and GOTOW macros.
LowHalfPage = $

       org 100
SUB1    Subroutine
:Entry = SubEntryAddr
       jmp :Out
:test
       ;so something
:Out

Main
       GotoW Main, ISR, SUB1
       LookupW Main, ISR, SUB1, 1, 2, 3
       call @SUB1:Entry        ;global call to subroutine
       call SUB1               ;local call to subroutine

---
James Newton 1-619-652-0593
EraseMEjamesnewtonRemoveMEspamsxlist.com
SX FAQ: http://www.sxlist.com

{Original Message removed}
<000801c04847$6bac3660$0600a8c0@efplus.com> 7bit

In reply to: <3A073571.EB5EADF1@home.com>
See also: www.piclist.com/techref/ubicom/lib/mem/index.htm?key=memory
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Memory layout?

month overview.

new search...