Keil Logo

C166: Running Code From IDATA


Information in this article applies to:

  • C166 Version 3.12 and later

QUESTION

I'm using the Siemens 80C166/C167 and I want to copy code (that changes bus modes) from ROM to the on-chip RAM and execute it there. How can I do this?

ANSWER

The following code example executes code in the on-chip RAM to switch CPU modes from 8 to 16 bit and/or mux to non-mux. According to Siemens specification, this must be executed in on-chip RAM. The code copied can only contain relative addressing.

;----------------------------------------------------------
; This copies the mode switch subroutine to internal RAM
; (it must be executed there as per Siemens spec)
;
; The following code is written into internal RAM
;
;$FC2E:
;  AND P2,01FFh                 ; set output port on PRO166/7
;  MOV SYSCON,  04FFh           ; set CPU mode
;  NOP                          ; give it time to settle (REQUIRED)
;  RET                          ; return to external memory execution
;----------------------------------------------------------

                MOV     R6,#0FC2EH              ; destination in on-chip RAM

                MOV     R5,#0E066H              ; Opcode: AND P2,
                MOV     [R6],R5
                ADD     R6,#02H

                MOV     R5,# 0001111111111111b  ; Data: Port 2 non-mux,16-bit, norom
                MOV     [R6],R5
                ADD     R6,#02H

                MOV     R5,#086E6H              ; Opcode: MOV SYSCON,
                MOV     [R6],R5
                ADD     R6,#02H

                MOV     R5,#04FFH               ; Data: Fast 16-bit non-mux
                MOV     [R6],R5
                ADD     R6,#02H

                MOV     R5,#0CCH                ; Opcode: NOP
                MOV     [R6],R5
                ADD     R6,#02H

                MOV     R5,#0CBH                ; Opcode: RET
                MOV     [R6],R5

                CALLA   cc_UC,0FC2Eh            ; execute snippet in internal RA

MORE INFORMATION

SEE ALSO


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.