⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datapage.lst

📁 freescale 协处理器应用相关实例
💻 LST
📖 第 1 页 / 共 5 页
字号:
  269:  }
  270:  
  271:  #endif /*  defined(__EPAGE__) */
  272:  #endif /*  defined(__PPAGE__) */
  273:  #endif /*  defined(__DPAGE__) */
  274:  
  275:  #endif /* USE_SEVERAL_PAGES */
  276:  
  277:  /*--------------------------- _SET_PAGE --------------------------------
  278:    Runtime routine to set the right page register. This routine is used if the compiler
  279:    does not know the right page register, i.e. if the option -Cp is used for more than
  280:    one page register or if the runtime option is used for one of the -Cp options.
  281:  
  282:    Arguments :
  283:    - offset part of an address in the Y register
  284:    - page part of an address in the B register
  285:  
  286:    Result :
  287:    - page part written into the correct page register.
  288:    - the old page register content is destroyed
  289:    - all processor registers remains unchanged
  290:    --------------------------- _SET_PAGE ----------------------------------*/
  291:  
  292:  #ifdef __cplusplus
  293:  extern "C"
  294:  #endif
  295:  #pragma NO_ENTRY
  296:  #pragma NO_EXIT
  297:  #pragma NO_FRAME
  298:  
  299:  void NEAR _SET_PAGE(void) {
  300:  #if USE_SEVERAL_PAGES
  301:    __asm {
  302:          PSHX                      ;// save X register
  303:          __PIC_JSR(_GET_PAGE_REG)
  304:          BEQ     L_NOPAGE
  305:          STAB    0,X               ;// set page register
  306:  L_NOPAGE:
  307:          PULX                      ;// restore X register
  308:          RTS
  309:    }
  310:  #else /* USE_SEVERAL_PAGES */
  311:    __asm {
  312:          STAB    PAGE_ADDR         ;// set page register
  313:          RTS
  314:    }
  315:  #endif /* USE_SEVERAL_PAGES */
  316:  }
  317:  
  318:  /*--------------------------- _LOAD_FAR_8 --------------------------------
  319:    This runtime routine is used to access paged memory via a runtime function.
  320:    It may also be used if the compiler option -Cp is not used with the runtime argument.
  321:  
  322:    Arguments :
  323:    - offset part of an address in the Y register
  324:    - page part of an address in the B register
  325:  
  326:    Result :
  327:    - value to be read in the B register
  328:    - all other registers remains unchanged
  329:    - all page register still contain the same value
  330:    --------------------------- _LOAD_FAR_8 ----------------------------------*/
  331:  
  332:  #ifdef __cplusplus
  333:  extern "C"
  334:  #endif
  335:  #pragma NO_ENTRY
  336:  #pragma NO_EXIT
  337:  #pragma NO_FRAME
  338:  
  339:  void NEAR _LOAD_FAR_8(void) {
  340:  #if USE_SEVERAL_PAGES
  341:    __asm {
  342:          PSHX                      ;// save X register
  343:          __PIC_JSR(_GET_PAGE_REG)
  344:          BEQ     L_NOPAGE
  345:          PSHA                      ;// save A register
  346:          LDAA    0,X               ;// save page register
  347:          STAB    0,X               ;// set page register
  348:          LDAB    0,Y               ;// actual load, overwrites page
  349:          STAA    0,X               ;// restore page register
  350:          PULA                      ;// restore A register
  351:          PULX                      ;// restore X register
  352:          RTS
  353:  L_NOPAGE:
  354:          LDAB    0,Y               ;// actual load, overwrites page
  355:          PULX                      ;// restore X register
  356:          RTS
  357:    }
  358:  #else /* USE_SEVERAL_PAGES */
  359:    __asm {
  360:          PSHA                      ;// save A register
  361:          LDAA    PAGE_ADDR         ;// save page register
  362:          STAB    PAGE_ADDR         ;// set page register
  363:          LDAB    0,Y               ;// actual load, overwrites page
  364:          STAA    PAGE_ADDR         ;// restore page register
  365:          PULA                      ;// restore A register
  366:          RTS
  367:    }
  368:  #endif /* USE_SEVERAL_PAGES */
  369:  }
  370:  
  371:  /*--------------------------- _LOAD_FAR_16 --------------------------------
  372:    This runtime routine is used to access paged memory via a runtime function.
  373:    It may also be used if the compiler  option -Cp is not used with the runtime argument.
  374:  
  375:    Arguments :
  376:    - offset part of an address in the Y register
  377:    - page part of an address in the B register
  378:  
  379:    Result :
  380:    - value to be read in the Y register
  381:    - all other registers remains unchanged
  382:    - all page register still contain the same value
  383:    --------------------------- _LOAD_FAR_16 ----------------------------------*/
  384:  
  385:  #ifdef __cplusplus
  386:  extern "C"
  387:  #endif
  388:  #pragma NO_ENTRY
  389:  #pragma NO_EXIT
  390:  #pragma NO_FRAME
  391:  
  392:  void NEAR _LOAD_FAR_16(void) {
  393:  #if USE_SEVERAL_PAGES
  394:    __asm {
  395:          PSHX                      ;// save X register
  396:          __PIC_JSR(_GET_PAGE_REG)
  397:          BEQ     L_NOPAGE
  398:          PSHA                      ;// save A register
  399:          LDAA    0,X               ;// save page register
  400:          STAB    0,X               ;// set page register
  401:          LDY     0,Y               ;// actual load, overwrites address
  402:          STAA    0,X               ;// restore page register
  403:          PULA                      ;// restore A register
  404:          PULX                      ;// restore X register
  405:          RTS
  406:  L_NOPAGE:
  407:          LDY     0,Y               ;// actual load, overwrites address
  408:          PULX                      ;// restore X register
  409:          RTS
  410:    }
  411:  #else /* USE_SEVERAL_PAGES */
  412:    __asm {
  413:          PSHA                      ;// save A register
  414:          LDAA    PAGE_ADDR         ;// save page register
  415:          STAB    PAGE_ADDR         ;// set page register
  416:          LDY     0,Y               ;// actual load, overwrites address
  417:          STAA    PAGE_ADDR         ;// restore page register
  418:          PULA                      ;// restore A register
  419:          RTS
  420:    }
  421:  #endif /* USE_SEVERAL_PAGES */
  422:  }
  423:  /*--------------------------- _LOAD_FAR_24 --------------------------------
  424:    This runtime routine is used to access paged memory via a runtime function.
  425:    It may also be used if the compiler  option -Cp is not used with the runtime argument.
  426:  
  427:    Arguments :
  428:    - offset part of an address in the Y register
  429:    - page part of an address in the B register
  430:  
  431:    Result :
  432:    - value to be read in the Y:B registers
  433:    - all other registers remains unchanged
  434:    - all page register still contain the same value
  435:    --------------------------- _LOAD_FAR_24 ----------------------------------*/
  436:  
  437:  #ifdef __cplusplus
  438:  extern "C"
  439:  #endif
  440:  #pragma NO_ENTRY
  441:  #pragma NO_EXIT
  442:  #pragma NO_FRAME
  443:  
  444:  void NEAR _LOAD_FAR_24(void) {
  445:  #if USE_SEVERAL_PAGES
  446:    __asm {
  447:          PSHX                      ;// save X register
  448:          __PIC_JSR(_GET_PAGE_REG)
  449:          BEQ     L_NOPAGE
  450:          PSHA                      ;// save A register
  451:          LDAA    0,X               ;// save page register
  452:          STAB    0,X               ;// set page register
  453:          LDAB    0,Y               ;// actual load, overwrites page of address
  454:          LDY     1,Y               ;// actual load, overwrites offset of address
  455:          STAA    0,X               ;// restore page register
  456:          PULA                      ;// restore A register
  457:          PULX                      ;// restore X register
  458:          RTS
  459:  L_NOPAGE:
  460:          LDAB    0,Y               ;// actual load, overwrites page of address
  461:          LDY     1,Y               ;// actual load, overwrites offset of address
  462:          PULX                      ;// restore X register
  463:          RTS
  464:    }
  465:  #else /* USE_SEVERAL_PAGES */
  466:    __asm {
  467:          PSHA                      ;// save A register
  468:          LDAA    PAGE_ADDR         ;// save page register
  469:          STAB    PAGE_ADDR         ;// set page register
  470:          LDAB    0,Y               ;// actual load, overwrites page of address
  471:          LDY     1,Y               ;// actual load, overwrites offset of address
  472:          STAA    PAGE_ADDR         ;// restore page register
  473:          PULA                      ;// restore A register
  474:          RTS
  475:    }
  476:  #endif /* USE_SEVERAL_PAGES */
  477:  
  478:  }
  479:  
  480:  /*--------------------------- _LOAD_FAR_32 --------------------------------
  481:    This runtime routine is used to access paged memory via a runtime function.
  482:    It may also be used if the compiler  option -Cp is not used with the runtime argument.
  483:  
  484:    Arguments :
  485:    - offset part of an address in the Y register
  486:    - page part of an address in the B register
  487:  
  488:    Result :
  489:    - low 16 bit of value to be read in the D registers
  490:    - high 16 bit of value to be read in the Y registers
  491:    - all other registers remains unchanged
  492:    - all page register still contain the same value
  493:    --------------------------- _LOAD_FAR_32 ----------------------------------*/
  494:  
  495:  #ifdef __cplusplus
  496:  extern "C"
  497:  #endif
  498:  #pragma NO_ENTRY
  499:  #pragma NO_EXIT
  500:  #pragma NO_FRAME
  501:  
  502:  void NEAR _LOAD_FAR_32(void) {
  503:  #if USE_SEVERAL_PAGES
  504:    __asm {
  505:          PSHX                      ;// save X register
  506:          __PIC_JSR(_GET_PAGE_REG)
  507:          BEQ     L_NOPAGE
  508:          LDAA    0,X               ;// save page register
  509:          PSHA                      ;// put it onto the stack
  510:          STAB    0,X               ;// set page register
  511:          LDD     2,Y               ;// actual load, low word
  512:          LDY     0,Y               ;// actual load, high word
  513:          MOVB    1,SP+,0,X         ;// restore page register
  514:          PULX                      ;// restore X register
  515:          RTS
  516:  L_NOPAGE:
  517:          LDD     2,Y               ;// actual load, low word
  518:          LDY     0,Y               ;// actual load, high word
  519:          PULX                      ;// restore X register
  520:          RTS
  521:    }
  522:  #else /* USE_SEVERAL_PAGES */
  523:    __asm {
  524:          LDAA    PAGE_ADDR         ;// save page register
  525:          PSHA                      ;// put it onto the stack
  526:          STAB    PAGE_ADDR         ;// set page register
  527:          LDD     2,Y               ;// actual load, low word
  528:          LDY     0,Y               ;// actual load, high word
  529:          MOVB    1,SP+,PAGE_ADDR   ;// restore page register
  530:          RTS
  531:    }
  532:  #endif /* USE_SEVERAL_PAGES */
  533:  }
  534:  
  535:  /*--------------------------- _STORE_FAR_8 --------------------------------
  536:    This runtime routine is used to access paged memory via a runtime function.
  537:    It may also be used if the compiler  option -Cp is not used with the runtime argument.
  538:  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -