I am simulating the DS80C400 and have an access error. Thanks in advance, Clayton. First off, I am new to Keil and the DS80C400. I am using the eval uVision v2.38a with C51 V7.06, LX51 V3.58 until my real PK51 kit comes in. The error *** error 65: access violation at X:0x400003 : no 'write' permission. This occurs at the line at the location between quotes "<<- PROBLEM ACCESS" The extsp=0x0003 <- - Is this the problem, I am placing function calling return bytes to exec read territory? This error occurs at entry point to init_rom() from main(). I used LX51, 16M Continuous Mode Access. The register ACON=0xFE which is correct. Main() is close to the end of this email where invokes init_rom() Am I corrupting the interrupt vectors? I thought I read somewhere that there is an issue with Keil interrupt vectors and DS80C400 interrupt vectors. (I have a similar problem if I don't use this function init_rom(), where I call a simple function that right upon entering the same access problem happens.) From the Output Window some diagnostics: Map I:0x00 - I:0xFF read write C:0x000000 - C:0x00FFFF exec read C:0x400000 - C:0x4004D5 exec read X:0x000000 - X:0x00FFFF read write X:0x100000 - X:0x10000F read write X:0xFFDB00 - X:0xFFFFFF read write Scope Tgroup 'unnamed': Module '?C_STARTUP', source := 'startup400.a51' Function '?C_CPURESET?0_AP0006_400000', range C:0x400000-C:0x400047 Module 'MAIN', source := 'main.c' Function 'main', range C:0x400496-C:0x4004D5 Module 'ROM400_LIB_INIT', source := 'rom400_lib_init.a51' Function '?PR?INIT_VERSION?ROM400_LIB_INIT_AP000F_000000', range C:0x40048D-C:0x400492 Module '?C?LSTXDATA', source := 'unknown' This is the main() code:
#include "rom400_init.h" #include <stdio.h> // leave 4000h bytes for function parameters #define RAM_START 0x14000 #define RAM_END 0x5FFFF //void fun1(int x); //void fun1(void); /* * Main entry point. Initialize the ROM. */ void main() { int data i; int data j; init_rom(RAM_START, RAM_END); i = 0; j = 0; while(i<4) { j = j + i; i = i + 1; } } This is the Startup400.A51 and a main() disassembly. 121: ?C_STARTUP: sjmp past_loader_tag 122: db 'TINI' ; Tag for TINI Environment 1.02c 123: ; or later (ignored in 1.02b) 124: $if (USE_MONITOR = 0) 125: db 40H ; Target bank 126: $endif 127: $if (USE_MONITOR = 1) 128: db 20H ; Target bank 129: $endif 130: 131: past_loader_tag: C:0x400000 8005 SJMP PAST_LOADER_TAG(C:0007) C:0x400002 5449 ANL A,#0x49 C:0x400004 4E ORL A,R6 C:0x400005 49 ORL A,R1 C:0x400006 40C2 JC C:FFCA C:0x400008 AF75 MOV R7,0x75 C:0x40000A C7 XCH A,@R1 C:0x40000B AA75 MOV R2,0x75 C:0x40000D C7 XCH A,@R1 C:0x40000E 5543 ANL A,0x43 C:0x400010 9D SUBB A,R5 C:0x400011 020240 LJMP C:0240 C:0x400014 00 NOP C:0x400015 16 DEC @R0 142: mov ta, #0xAA ; Enable access to MCON C:0x400016 75C7AA MOV TA(0xC7),#SADDR1(0xAA) 143: mov ta, #0x55 C:0x400019 75C755 MOV TA(0xC7),#0x55 144: mov mcon, #0xAF ; Relocate RAM, data memory C:0x40001C 75C6AF MOV MCON(0xC6),#C0M5C(0xAF) 145: mov ta, #0xAA ; Enable access to ACON C:0x40001F 75C7AA MOV TA(0xC7),#SADDR1(0xAA) 146: mov ta, #0x55 C:0x400022 75C755 MOV TA(0xC7),#0x55 147: orl acon, #0x04 ; Extended stack 148: 149: ; 150: ; Make sure we are in a known state with respect to 151: ; our fancy data pointers and register banks 152: ; C:0x400025 439D04 ORL ACON(0x9D),#0x04 153: mov dps, #0 C:0x400028 758600 MOV DPS(0x86),#init_rom?BYTE(0x00) 154: mov psw, #0 155: 156: ; 157: ; Set stack to 0 (we lose one byte, but don't 158: ; have to know the size)