📄 datapage.lst
字号:
539: Arguments :
540: - offset part of an address in the Y register
541: - page part of an address in the B register
542: - value to be stored in the B register
543:
544: Result :
545: - value stored at the address
546: - all registers remains unchanged
547: - all page register still contain the same value
548: --------------------------- _STORE_FAR_8 ----------------------------------*/
549:
550: #ifdef __cplusplus
551: extern "C"
552: #endif
553: #pragma NO_ENTRY
554: #pragma NO_EXIT
555: #pragma NO_FRAME
556:
557: void NEAR _STORE_FAR_8(void) {
558: #if USE_SEVERAL_PAGES
559: __asm {
560: PSHX ;// save X register
561: __PIC_JSR(_GET_PAGE_REG)
562: BEQ L_NOPAGE
563: PSHB ;// save B register
564: LDAB 0,X ;// save page register
565: MOVB 0,SP, 0,X ;// set page register
566: STAA 0,Y ;// store the value passed in A
567: STAB 0,X ;// restore page register
568: PULB ;// restore B register
569: PULX ;// restore X register
570: RTS
571: L_NOPAGE:
572: STAA 0,Y ;// store the value passed in A
573: PULX ;// restore X register
574: RTS
575: }
576: #else /* USE_SEVERAL_PAGES */
577: __asm {
578: PSHB ;// save A register
579: LDAB PAGE_ADDR ;// save page register
580: MOVB 0,SP,PAGE_ADDR ;// set page register
581: STAA 0,Y ;// store the value passed in A
582: STAB PAGE_ADDR ;// restore page register
583: PULB ;// restore B register
584: RTS
585: }
586: #endif /* USE_SEVERAL_PAGES */
587: }
588:
589: /*--------------------------- _STORE_FAR_16 --------------------------------
590: This runtime routine is used to access paged memory via a runtime function.
591: It may also be used if the compiler option -Cp is not used with the runtime argument.
592:
593: Arguments :
594: - offset part of an address in the Y register
595: - page part of an address in the B register
596: - value to be stored in the X register
597:
598: Result :
599: - value stored at the address
600: - all registers remains unchanged
601: - all page register still contain the same value
602: --------------------------- _STORE_FAR_16 ----------------------------------*/
603:
604: #ifdef __cplusplus
605: extern "C"
606: #endif
607: #pragma NO_ENTRY
608: #pragma NO_EXIT
609: #pragma NO_FRAME
610:
611: void NEAR _STORE_FAR_16(void) {
612: #if USE_SEVERAL_PAGES
613: __asm {
614: PSHX ;// save X register
615: __PIC_JSR(_GET_PAGE_REG)
616: BEQ L_NOPAGE
617:
618: PSHA
619: LDAA 0,X ;// save page register
620: STAB 0,X ;// set page register
621: MOVW 1,SP,0,Y ;// store the value passed in X
622: STAA 0,X ;// restore page register
623: PULA ;// restore A register
624: PULX ;// restore X register
625: RTS
626:
627: L_NOPAGE:
628: STX 0,Y ;// store the value passed in X
629: PULX ;// restore X register
630: RTS
631: }
632: #else /* USE_SEVERAL_PAGES */
633: __asm {
634: PSHA ;// save A register
635: LDAA PAGE_ADDR ;// save page register
636: STAB PAGE_ADDR ;// set page register
637: STX 0,Y ;// store the value passed in X
638: STAA PAGE_ADDR ;// restore page register
639: PULA ;// restore A register
640: RTS
641: }
642: #endif /* USE_SEVERAL_PAGES */
643: }
644: /*--------------------------- _STORE_FAR_24 --------------------------------
645: This runtime routine is used to access paged memory via a runtime function.
646: It may also be used if the compiler option -Cp is not used with the runtime argument.
647:
648: Arguments :
649: - offset part of an address in the Y register
650: - page part of an address in the B register
651: - value to be stored in the X:A registers (X : low 16 bit, A : high 8 bit)
652:
653: Result :
654: - value stored at the address
655: - all registers remains unchanged
656: - all page register still contain the same value
657: --------------------------- _STORE_FAR_24 ----------------------------------*/
658:
659: #ifdef __cplusplus
660: extern "C"
661: #endif
662: #pragma NO_ENTRY
663: #pragma NO_EXIT
664: #pragma NO_FRAME
665:
666: void NEAR _STORE_FAR_24(void) {
667: #if USE_SEVERAL_PAGES
668: __asm {
669: PSHX ;// save X register
670: __PIC_JSR(_GET_PAGE_REG)
671: BEQ L_NOPAGE
672:
673: PSHA
674: LDAA 0,X ;// save page register
675: STAB 0,X ;// set page register
676: MOVW 1,SP, 1,Y ;// store the value passed in X
677: MOVB 0,SP, 0,Y ;// store the value passed in A
678: STAA 0,X ;// restore page register
679: PULA ;// restore A register
680: PULX ;// restore X register
681: RTS
682:
683: L_NOPAGE:
684: STX 1,Y ;// store the value passed in X
685: STAA 0,Y ;// store the value passed in X
686: PULX ;// restore X register
687: RTS
688: }
689: #else /* USE_SEVERAL_PAGES */
690: __asm {
691: PSHA ;// save A register
692: LDAA PAGE_ADDR ;// save page register
693: STAB PAGE_ADDR ;// set page register
694: MOVB 0,SP, 0,Y ;// store the value passed in A
695: STX 1,Y ;// store the value passed in X
696: STAA PAGE_ADDR ;// restore page register
697: PULA ;// restore A register
698: RTS
699: }
700: #endif /* USE_SEVERAL_PAGES */
701: }
702: /*--------------------------- _STORE_FAR_32 --------------------------------
703: This runtime routine is used to access paged memory via a runtime function.
704: It may also be used if the compiler option -Cp is not used with the runtime argument.
705:
706: Arguments :
707: - offset part of an address in the Y register
708: - page part of an address is on the stack at 3,SP (just below the return address)
709: - value to be stored in the X:D registers (D : low 16 bit, X : high 16 bit)
710:
711: Result :
712: - value stored at the address
713: - all registers remains unchanged
714: - the page part is removed from the stack
715: - all page register still contain the same value
716: --------------------------- _STORE_FAR_32 ----------------------------------*/
717:
718: #ifdef __cplusplus
719: extern "C"
720: #endif
721: #pragma NO_ENTRY
722: #pragma NO_EXIT
723: #pragma NO_FRAME
724:
725: void NEAR _STORE_FAR_32(void) {
726: #if USE_SEVERAL_PAGES
727: __asm {
728: PSHX ;// save X register
729: __PIC_JSR(_GET_PAGE_REG)
730: BEQ L_NOPAGE
731:
732: PSHD
733: LDAA 0,X ;// save page register
734: MOVB 6,SP, 0,X ;// set page register
735: MOVW 2,SP, 0,Y ;// store the value passed in X (high word)
736: MOVW 0,SP, 2,Y ;// store the value passed in D (low word)
737: STAA 0,X ;// restore page register
738: PULD ;// restore A register
739: BRA done
740:
741: L_NOPAGE:
742: MOVW 0,SP, 0,Y ;// store the value passed in X (high word)
743: STD 2,Y ;// store the value passed in D (low word)
744: done:
745: PULX ;// restore X register
746: MOVW 0,SP, 1,+SP ;// move return address
747: RTS
748: }
749: #else /* USE_SEVERAL_PAGES */
750: __asm {
751: PSHD ;// save D register
752: LDAA PAGE_ADDR ;// save page register
753: LDAB 4,SP ;// load page part of address
754: STAB PAGE_ADDR ;// set page register
755: STX 0,Y ;// store the value passed in X
756: MOVW 0,SP, 2,Y ;// store the value passed in D (low word)
757: STAA PAGE_ADDR ;// restore page register
758: PULD ;// restore D register
759: MOVW 0,SP, 1,+SP ;// move return address
760: RTS
761: }
762: #endif /* USE_SEVERAL_PAGES */
763: }
764:
765: /*--------------------------- _FAR_COPY_RC --------------------------------
766: This runtime routine is used to access paged memory via a runtime function.
767: It may also be used if the compiler option -Cp is not used with the runtime argument.
768:
769: Arguments :
770: - offset part of the source int the X register
771: - page part of the source in the A register
772: - offset part of the dest int the Y register
773: - page part of the dest in the B register
774: - number of bytes to be copied is defined by the next 2 bytes after the return address.
775:
776: Result :
777: - memory area copied
778: - no registers are saved, i.e. all registers may be destroyed
779: - all page register still contain the same value as before the call
780: - the function returns after the constant defining the number of bytes to be copied
781:
782:
783: stack-structure at the loop-label:
784: 0,SP : destination offset
785: 2,SP : source page
786: 3,SP : destination page
787: 4,SP : source offset
788: 6,SP : points to length to be copied. This function returns after the size
789:
790: A usual call to this function looks like:
791:
792: struct Huge src, dest;
793: ; ...
794: LDX #src
795: LDAA #PAGE(src)
796: LDY #dest
797: LDAB #PAGE(dest)
798: JSR _FAR_COPY_RC
799: DC.W sizeof(struct Huge)
800: ; ...
801:
802: --------------------------- _FAR_COPY_RC ----------------------------------*/
803:
804: #ifdef __cplusplus
805: extern "C"
806: #endif
807: #pragma NO_ENTRY
808: #pragma NO_EXIT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -