In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Peter Van der Zee wrote: Hi Ray; You are indeed very close. There are two addressable sections to the processor's memory; the RAM (variables) part and the ROM (program code) part. They are separate. The org $xx command is used to set the starting point of either section; the compiler understands the DS or DW assignments to imply RAM, and all other assignments as ROM. As Bean pointed out, every RAM assignment and every line of code increments the memory pointer, so it is usual to not inter-mix varable assignments inside of your code. If you do, you will need to specifically keep track yourself otherwise you will get a mess. So it is easiest to define ALL your variables at the beginning of your program after setting the org to $08 or $0A, followed by the code portion after setting org to $0, or $100, or whatever. The compiler will realize that code statements are not intended for the RAM section, and in ROM you need not "skip over" the area of $0 through $0A. RESET is the reserved word that references the start point of your program (any point you choose) on a power-up or reset. The org $00 location is somewhat special; only if you have interrupts enabled. That is the point where the processor goes to on detection of an interrupt, and it will be the first loction of any ISR routine you might have. That is why typically you see the "Main" programs starting at some point other than $00; for convenience often at a new page, say $100, but could be anywhere. Have fun. Cheers, Peter (pjv) ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=100433#m101005 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)