diff options
| -rw-r--r-- | image_format.txt | 35 | ||||
| -rw-r--r-- | interrupts.asm.m4 | 17 | ||||
| -rw-r--r-- | loader.c | 1 |
3 files changed, 32 insertions, 21 deletions
diff --git a/image_format.txt b/image_format.txt index f2befa7..c96b5a7 100644 --- a/image_format.txt +++ b/image_format.txt @@ -10,14 +10,10 @@ the page files. This way multiple images can share the same data. 0x0680 ** Size (page only) 0x4000 -** Checksum - CRC-16 of the whole page -** Version - string-32, 0-terminated ** Page number - Byte + word ** Calculator model - Byte, some undefined enum + word, enum 'models' in image.h * Fields in the descriptor file: @@ -29,14 +25,25 @@ the page files. This way multiple images can share the same data. string-32, 0-terminated ** Data - List of these records: -*** Page number + Tagged list of these records: +*** Page number - 'PG' word - 0x00?? for a real page - 0xffff for final record -*** Checksum +*** Checksum - 'CK' word -*** Version - string-32, 0-term -*** Calculator model + CRC-16 of page, as in page image file +*** Version - 'VE' + string, 0-terminated +*** Calculator model - 'MD' Byte, same undefined enum +** Registers - 'RG' + Tagged list of registers +*** A - 'A' +*** F - 'F' +*** BC - 'BC' +*** DE - 'DE' +*** HL - 'HL' +*** SP - 'SP' +*** PC - 'PC' +*** I - 'I' +** Other state +*** Pages presently paged in - 'IN' diff --git a/interrupts.asm.m4 b/interrupts.asm.m4 index 404f02f..7b4e522 100644 --- a/interrupts.asm.m4 +++ b/interrupts.asm.m4 @@ -1,7 +1,7 @@ -;;; interrupt handling code +;;; interrupt handling code, in -*- asm -*- ;; Current interrupt mode. IM 1 and friends will modify - ;; this, it can be any of 0, 1, 2. + ;; this. It can be any of 0, 1, 2. int_mode: dc.b 0 ;; 0 if the emulated device doesn't want interrupts. @@ -24,18 +24,20 @@ int_enabled: dc.b 1 ;; This emulator, on the other hand, will fetch the immediate ;; argument from the JP instruction in the shim, and then ;; dance off into la-la land. -int_opcode: dc.b 0 +int0_opcode: dc.b 0 dc.b $c3 ; JP immed.w -int_return: dc.w 0 ; the destination address +int0_return: dc.w 0 ; the destination address ;; This is the interrupt routine. It can come at any point ;; during an instruction, though routines that use a5 (e.g. by - ;; calling C subroutines) will have to turn off interrupts. + ;; calling C subroutines) will have to turn off or hold + ;; interrupts. + ;; ;; Routines that call into TIOS will have to remove this ;; interrupt handler. int_handler: - sub.l #4,a5 + sub.l #INT_OFFSET,a5 rte @@ -67,9 +69,10 @@ do_interrupt: ;; IM 0: A byte is placed on the bus and executed as if it ;; were inline in the program. This emulator will put that - ;; byte into int_opcode and set epc (or int_jump) to point + ;; byte into int0_opcode and set epc (or int_jump) to point ;; there. int_do_mode0: + move epc,int0_opcode rts ;; This routine emulates a mode 1 interrupt. @@ -9,6 +9,7 @@ #include "asm_vars.h" #include "global.h" +#include "image.h" HANDLE page_handles[256]; |
