Jupiter Ace - The ROM --------------------- based on the FAQ worked on by kio 2005-11-14 Throughout the entire ROM IX points to the start of available memory at $3C00 and IY points to the execute next vector, $04C2. Almost all machine code words end in LD PC,IY. I am currently translating a German disassembly of the ACE Rom kindly provided by the ZXTEAM in Germany, which is far more comprehensive than what I have done below (basically I did enough for the emulation) The Z80 Restart Vectors: RST 0h Restart the Jupiter ACE (Cold Start) RST 8h Print character in A on screen RST 10h Push Word DE on the Data Stack RST 18h Pop Word DE off the Data Stack RST 20h Stop execution with error A / Warm Start RST 28h Not available RST 30h Not available RST 38h Interrupt Routine Memory Locations and Code (as far as currently known) Note: see the disassembly (German) 0028-002B Cold Boot - Check Memory Size 0033-0041 Initialise RAM Data 3C24-3C4F 004B-0052 Clear Screen and Edit Buffer 0052-006D Define 64 x 48 pixel graphics characters 006E-008D Copy Character Set from ROM to Memory 008E Enable Interrupt and goto QUIT 013A Interrupt Routine 013A-013F Save CPU Registers 0140-0144 Short Delay , no idea why. 0144-014A Increment Timer 014B Call Interrupt, Read Keys 014E-016D Handle Caps/Graphic/Reverse modes 016E-0175 Edit processing (?) 0176-017D Tidy up and Exit 0310 Interrupt Routine - Keyboard Read 0310 Call Keyboard Scanner 0310-0335 (?) 0336 Return in A Current Key Pressed 0336-036C Get Virtual Key Number to DE 036D-036F Return zero if none pressed 0370-0375 Look up ASCII value 0376-039D ASCII Lookup Table 044D-0457 For address words - pushes (*DE) [byte] + 3C00 on data stack 07FA-0806 Clear Memory between DE and HL (set to 20 hex, space) 0808-0810 Make A Upper Case 084E-0858 Pop word from data stack to BC 0859-085E End of code for RST 18h 0A24-0A42 Clear Screen code 18A7-192C Read in one data block or header. 1A75-1AB6 Load / Bload code. Scans through tape for given file name 1AB9-1AF2 Physically loads an image into memory Memory locations in RAM and the value they represent 3C18 Top of Memory + 1 (word) 3C1C Screen write position (word) 3C24 Start of Editing position (word) 3C26 Status word, unknown function 3C28 Shift Status: Bit 0 = Edit allowed, Bit 1 = Caps Lock, Bit 2 = Graphics, Bit 3 = Reverse 3C2B Clock (double word) 3C31 CURRENT (word) 3C33 CONTEXT (word) 3C37 HERE (word) 3C3B Data Stack Pointer (word) 3C3D Error Code (Byte) 3C3F Base (Byte) 3C40 FORTH word (first in memory,installed by ROM) 3C51 Start of user program memory ROM Dictionary Layout This describes the format of the dictionary for a word at address 'n'. The 'centre point' of the word header is based around the length byte. The last word in the ROM dictionary is at address 1D58. NOTE: The dictionary format for RAM words is slightly different, having a further word between the name and the previous word link. I am not sure to what this refers. n - 2 - Length First letter of name n - 3 Last letter of name (bit 7 set) n - 2 Address of previous word in list (word) n Length (bits 0..5). Bit 6 set if word is compile-only. n + 1, n + 2 Address to jump to to execute word n + 3 Start of word code. In DE when jump through n+1,n+2 is done. Error Codes The Ace returns error codes rather than text messages. This section explains what they mean. Error 1 Out of Memory Error 2 Stack Underflow Error 3 Break from program (Shift+Space) Error 4 Compile mode only. Error 5 Structure Imbalance Error 6 Name too long Error 7 Illegal Pick Value Error 8 Floating Point division by zero (no error for integers,returns -1) Error 9 Erroneous 'AT' command Error 10 Verify/Save failed Error 11 Redefine/Forget word missing Error 12 (not sure) (?) Error 13 Unknown word Error 14 Word not listable Usage of some of the Forth words Some of the Ace's Forth is not intuitively obvious, varying from the Forth-79 and Forth-83 specifications. Redefine If a word has been edited there will be two copies of it in the dictionary. redefine replaces the earlier word with the later one, and makes sure all references of the delete word refer to the replaced word. The sequence edit redefine can be used to change a word without wasting memory. Edit edit allows a word definition to be edited, return ending the edit. However, another copy of the word is added to the dictionary, and any words referring to the edited word will refer to the original one. It is a good idea to redefine afterwards. List list lists one of the words in the dictionary, decoding it. Definitions (unknown) Base Base is the address of the current base (e.g. to work in hex do 16 base c!). However, this is only an 8 bit value. Doing 8 base ! may cause other problems. Vocabulary (unknown) Vlist vlist lists the words defined in the Forth dictionary. Runs> (unknown) Definer..... Does> ; definer along with does> defines an immediate word used to create dictionary entries . The section between definer and does > is used to build the entry, the section after does> is done when the word is executed, assuming the address of the first data item is pushed on the stack. example : constant definer constant , does> @ ; defines a word 'constant' which compiles the number on the top of the data stack into the word : when the word is run that word is read 4 constant x define a word constant - the word will have the 4 compiled (via ,) and will read it when executed x . will print '4'.