ASM85: File = debh.a 16:59 9/24/2003 Page 1 1 0000: ; DEBH.a -- Debug Support 2 0000: ; intended to be executed at C000 3 0000: 4 0000: ; FSW Rev 7.0 -- debug serial port is on RST_3 5 0000: ; by itself, not shared with Day Sensor 6 0000: 7 0000: include ioports.i 1 0000: ; ioports.i -- definitions of ISUAL DPU I/O ports 2 0000: ; 3 0000: ; 19 FEB 2002 4 0000: ; CAI 5 0000: ; Revised 20 March 2002 6 0000: ; SPG 7 0000: ; 8 0000: ; _O = output port, _I = input port 9 0000: ; 10 0000: ; Ports 00-7Fh are in the ISDPGLU Actel: 11 0000: ; 12 0000: SOFTWARE_RESET_O EQU 00h ; forces hardware reset 13 0000: INTVECTOR_STS_I EQU 00h ; C7, CF, D7, ... , FF 14 0000: IRQ_ENABLE_O EQU 01h ; set RST[7:2] interrupt request enables 15 0000: IRQ_ENABLE_I EQU 01h ; read RST[7:2] interrupt request enables 16 0000: BANK_SELECT_O EQU 02h ; memory bank select for CPU addr 4000-7FFF 17 0000: BANK_SELECT_I EQU 02h ; memory bank select for CPU addr 4000-7FFF 18 0000: WATCHDOG_PET_O EQU 03h ; pet watchdog timer, data =xx 19 0000: WATCHDOG_STS_I EQU 03h ; [7:4]=bites, [3:0]=barks 20 0000: CMD_RX_I EQU 04h ; command UART rx data 21 0000: SOH_TX_O EQU 04h ; SOH UART tx data 22 0000: CMD_SOH_CTRL_O EQU 05h ; CMD/SOH UART control 23 0000: CMD_SOH_STS_I EQU 05h ; CMD/SOH UART status 24 0000: PROM_ENBL_O EQU 06h ; PROM enable 25 0000: STATUS6_I EQU 06h ; PROM/reset/CDI/HKP/PS16 status 26 0000: IRQ_LEVELS_I EQU 07h ; RST[7:2] raw levels 27 0000: ; 28 0000: MM_IM_DCM_CTL_O EQU 08h ; MM/Imager/DCM control 29 0000: MM_IM_DCM_STS_I EQU 08h ; MM/Imager/DCM status 30 0000: IDC_RESET_I EQU 09h ; IDC Reset 31 0000: IDC_RESET_O EQU 09h ; IDC Reset 32 0000: ; (0Ah-0Bh not used) 33 0000: RES_FLAG_CLR_O EQU 0Ch ; clear SWR, POR flags 34 0000: ONE_HZ_CLR_O EQU 0Dh ; clear 1-Hz IRQ latch 35 0000: TIMER_SET_L_O EQU 0Eh ; 1024-Hz countdown timer low byte 36 0000: TIMER_SET_H_O EQU 0Fh ; 1024-Hz countdown timer high byte 37 0000: ; 38 0000: ; (10h-3Fh not used) 39 0000: ; 40 0000: CDI_DAT_LO_O EQU 40h ; CDI data low byte 41 0000: CDI_DAT_HI_O EQU 41h ; CDI data high byte 42 0000: CDI_CMD_O EQU 42h ; CDI readback command (write last) 43 0000: CDI_DAT_LO_I EQU 40h ; CDI readback low byte 44 0000: CDI_DAT_HI_I EQU 41h ; CDI readback high byte 45 0000: PWR_STS_LO_I EQU 42h ; power service [7:0] status 46 0000: PWR_STS_HI_I EQU 43h ; power service [15:8] status Page 2 47 0000: ; (44h-5Fh not used) 48 0000: ; 49 0000: MM_BADR_0700_O EQU 60h ; mass mem block base address [7:0] 50 0000: MM_BADR_1508_O EQU 61h ; mass mem block base address [15:8] 51 0000: MM_BADR_2316_O EQU 62h ; mass mem block base address [23:16] 52 0000: MM_BADR_3124_O EQU 63h ; mass mem block base address [31:24] 53 0000: MM_WADR_0700_I EQU 60h ; mass mem working address [7:0] 54 0000: MM_WADR_1508_I EQU 61h ; mass mem working address [15:8] 55 0000: MM_WADR_2316_I EQU 62h ; mass mem working address [23:16] 56 0000: MM_WADR_3124_I EQU 63h ; mass mem working address [31:24] 57 0000: ; (64h-6Fh not used) 58 0000: ; 59 0000: SC_TIME_0_O EQU 70h ; set S/C time 2^-16 seconds (write 1st) 60 0000: SC_TIME_1_O EQU 71h ; set S/C time 2^-8 seconds 61 0000: SC_TIME_2_O EQU 72h ; set S/C time 2^0 seconds 62 0000: SC_TIME_3_O EQU 73h ; set S/C time 2^8 seconds 63 0000: SC_TIME_4_O EQU 74h ; set S/C time 2^16 seconds 64 0000: SC_TIME_5_O EQU 75h ; set S/C time 2^24 seconds (write last) 65 0000: ; 66 0000: SC_TIME_0_I EQU 70h ; read S/C time 2^-16 seconds (read 1st) 67 0000: SC_TIME_1_I EQU 71h ; read S/C time 2^-8 seconds 68 0000: SC_TIME_2_I EQU 72h ; read S/C time 2^0 seconds 69 0000: SC_TIME_3_I EQU 73h ; read S/C time 2^8 seconds 70 0000: SC_TIME_4_I EQU 74h ; read S/C time 2^16 seconds 71 0000: SC_TIME_5_I EQU 75h ; read S/C time 2^24 seconds (read last) 72 0000: ; 73 0000: SCIF_CTL_O EQU 76h ; S/C I/F control (NOM/RED, PPS) 74 0000: SCIF_STS_I EQU 76h ; S/C I/F status (NOM/RED, PPS, SCT fault) 75 0000: ISDPGLU_REV_I EQU 77h ; ISDPGLU Actel revision 76 0000: ; (78h-7Fh not used) 77 0000: ; 78 0000: ; Ports 80-BFh are in the ISDPPWR Actel: 79 0000: ; 80 0000: ISDPPWR_REV_I EQU 80h ; ISDPPWR Actel revision 81 0000: FW_STS_I EQU 81h ; filter wheel position status 82 0000: FW_CNTR_O EQU 82h ; set filter wheel counter (N-1 @ 1280 Hz) 83 0000: FW_CNTR_I EQU 83h ; read filter wheel counter (N-1 @ 1280 Hz) 84 0000: FW_CTL_O EQU 83h ; filter wheel & stepper motor control 85 0000: FW_CTL_I EQU 83h ; filter wheel & stepper motor status 86 0000: 87 0000: HKP_DAT_0_I EQU 84h ; 1st housekeeping byte from power controller 88 0000: HKP_DAT_1_I EQU 85h ; 2nd housekeeping byte from power controller 89 0000: HKP_DAT_2_I EQU 86h ; 3rd housekeeping byte from power controller 90 0000: HKP_DAT_3_I EQU 87h ; 4th housekeeping byte from power controller 91 0000: AP_PWR_NOM_O EQU 84h ; set AP to nominal power 92 0000: AP_PWR_RED_O EQU 85h ; set AP to redundant power 93 0000: AP_PWR_OFF_O EQU 86h ; set AP +28V power off 94 0000: AP_PWR_ON_O EQU 87h ; set AP +28V power on 95 0000: HKP_CTL_O EQU 88h ; housekeeping transfer control 96 0000: HKP_STS_I EQU 88h ; housekeeping transfer status 97 0000: STIM_CTL_I equ 89h 98 0000: STIM_CTL_O EQU 89h ; Imager, SP stim control 99 0000: HVERR_STS_I equ 8Ah 100 0000: HVERR_CLR_O equ 8Ah 101 0000: ; (unused) equ 8Bh 102 0000: DAY_LAT_STS_I EQU 8Ch ; day sensor latch status 103 0000: DAY_LAT_CLR_O EQU 8Ch ; clear day sensor latches 104 0000: DAY_SENS_CTL_O EQU 8Dh 105 0000: DAY_SENS_STS_I EQU 8Dh ; day sensor raw status 106 0000: DAY1_THR_I equ 8Eh Page 3 107 0000: DAY1_THR_O equ 8Eh 108 0000: DAY2_THR_I equ 8Fh 109 0000: DAY2_THR_O equ 8Fh 110 0000: MCP_DAY_I equ 90h 111 0000: MCP_DAY_O equ 90h 112 0000: MCP_NITE_1_I equ 91h 113 0000: MCP_NITE_1_O equ 91h 114 0000: MCP_NITE_2_I equ 92h 115 0000: MCP_NITE_2_O equ 92h 116 0000: MCP_NITE_3_I equ 93h 117 0000: MCP_NITE_3_O equ 93h 118 0000: MCP_NITE_4_I equ 94h 119 0000: MCP_NITE_4_O equ 94h 120 0000: MCP_NITE_5_I equ 95h 121 0000: MCP_NITE_5_O equ 95h 122 0000: MCP_NITE_6_I equ 96h 123 0000: MCP_NITE_6_O equ 96h 124 0000: MCP_NITE_7_I equ 97h 125 0000: MCP_NITE_7_O equ 97h 126 0000: MCP_MAX_I equ 98h 127 0000: MCP_MAX_O equ 98h 128 0000: MCP_DAC_I equ 99h 129 0000: HV_CNTR_I equ 9Ah 130 0000: HV_CNTR_O equ 9Ah 131 0000: HV_STS_I equ 9Bh 132 0000: HV_CTL_O equ 9Bh 133 0000: PHOS_DAY_I equ 9Ch 134 0000: PHOS_DAY_O equ 9Ch 135 0000: PHOS_SPR_AUR_I equ 9Dh 136 0000: PHOS_SPR_AUR_O equ 9Dh 137 0000: PHOS_MAX_I equ 9Eh 138 0000: PHOS_MAX_O equ 9Eh 139 0000: PHOS_DAC_I equ 9Fh 140 0000: SP1_DAY_I equ 0A0h 141 0000: SP1_DAY_O equ 0A0h 142 0000: SP1_SPR_I equ 0A1h 143 0000: SP1_SPR_O equ 0A1h 144 0000: SP1_AUR_I equ 0A2h 145 0000: SP1_AUR_O equ 0A2h 146 0000: SP1_DAC_I equ 0A3h 147 0000: HV_UNLOCK_0_O equ 0A3h 148 0000: SP2_DAY_I equ 0A4h 149 0000: SP2_DAY_O equ 0A4h 150 0000: SP2_SPR_I equ 0A5h 151 0000: SP2_SPR_O equ 0A5h 152 0000: SP2_AUR_I equ 0A6h 153 0000: SP2_AUR_O equ 0A6h 154 0000: SP2_DAC_I equ 0A7h 155 0000: HV_UNLOCK_1_O equ 0A7h 156 0000: SP3_DAY_I equ 0A8h 157 0000: SP3_DAY_O equ 0A8h 158 0000: SP3_SPR_I equ 0A9h 159 0000: SP3_SPR_O equ 0A9h 160 0000: SP3_AUR_I equ 0AAh 161 0000: SP3_AUR_O equ 0AAh 162 0000: SP3_DAC_I equ 0ABh 163 0000: HV_UNLOCK_2_O equ 0ABh 164 0000: SP4_DAY_I equ 0ACh 165 0000: SP4_DAY_O equ 0ACh 166 0000: SP4_SPR_I equ 0ADh Page 4 167 0000: SP4_SPR_O equ 0ADh 168 0000: SP4_AUR_I equ 0AEh 169 0000: SP4_AUR_O equ 0AEh 170 0000: SP4_DAC_I equ 0AFh 171 0000: HV_UNLOCK_3_O equ 0AFh 172 0000: SP5_DAY_I equ 0B0h 173 0000: SP5_DAY_O equ 0B0h 174 0000: SP5_SPR_I equ 0B1h 175 0000: SP5_SPR_O equ 0B1h 176 0000: SP5_AUR_I equ 0B2h 177 0000: SP5_AUR_O equ 0B2h 178 0000: SP5_DAC_I equ 0B3h 179 0000: SP6_DAY_I equ 0B4h 180 0000: SP6_DAY_O equ 0B4h 181 0000: SP6_SPR_I equ 0B5h 182 0000: SP6_SPR_O equ 0B5h 183 0000: SP6_AUR_I equ 0B6h 184 0000: SP6_AUR_O equ 0B6h 185 0000: SP6_DAC_I equ 0B7h 186 0000: ; (B8-BF unused) 187 0000: 188 0000: ; Ports C0-DFh are on DPU and not in Actels: 189 0000: ; (0C0h-0DFh not used) 190 0000: ; 191 0000: ; Ports E0-FFh are on DPU Test Pod: 192 0000: ; (0E0h-0E3h not used) 193 0000: DTP_RX_I EQU 0E4h ; debug UART rx data 194 0000: DTP_TX_O EQU 0E4h ; debug UART tx data 195 0000: DTP_CTRL_O EQU 0E5h ; debug UART control 196 0000: DTP_STS_I EQU 0E5h ; debug UART status 197 0000: DTP_SENSE_I EQU 0E6H ; debug Sense PB and PROM status 198 0000: DTP_SCOPE_TRG_O EQU 0E6H ; debug scope trigger 199 0000: ; (0E7h-0EFh not used) 200 0000: ; 201 0000: DTP_LCD_CTL_O EQU 0F0H ; LCD control 202 0000: DTP_LCD_DAT_O EQU 0F1H ; LCD write data 203 0000: DTP_LCD_STS_I EQU 0F2h ; LCD status 204 0000: DTP_LCD_DAT_I EQU 0F3h ; LCD read data 205 0000: ; (0F4h-0FFh not used) 206 0000: ; 207 0000: ; 208 0000: ; 209 0000: ; Restart vector addresses 210 0000: ; 211 0000: RST_0 equ 00h 212 0000: RST_1 equ 08h 213 0000: RST_2 equ 10h 214 0000: RST_3 equ 18h 215 0000: RST_4 equ 20h 216 0000: TRAP equ 24h 217 0000: RST_5 equ 28h 218 0000: RST_55 equ 2Ch 219 0000: RST_6 equ 30h 220 0000: RST_65 equ 34h 221 0000: RST_7 equ 38h 222 0000: RST_75 equ 3Ch 223 0000: ; 224 0000: JMP_OPCODE equ 0C3h 225 0000: Page 5 8 0000: include gbl.i 1 0000: ; GBL.i -- global memory allocations 2 0000: 3 0000: ; Revision History: 4 0000: ; 18-Dec-2002 - SPG - ISUAL Flight Software rev 7.3 5 0000: ; First Official Release 6 0000: ; 28-Dec-2002 7 0000: ; added GBL_720 8 0000: ; 11-Jan-2003 9 0000: ; added GBL_XGS, GBL_XGS_SP 10 0000: ; 12-Jan-2003 11 0000: ; added GBL_RO_IDLE 12 0000: ; added GBL_SOH_WAIT 13 0000: ; 15-Jan-2003 14 0000: ; added GBL_EEPROM 15 0000: ; added GBL_WAIT_TIMEOUT 16 0000: ; 14-Feb-2003 17 0000: ; added GBL_TRIGGER_DELAY 18 0000: ; added GBL_DOING_TRIG_DELAY 19 0000: ; removed GBL_ARMSW 20 0000: ; 19-May-2003 ; added GBL_FLUSH_REQUEST 21 0000: ; 9-Sep-2003 ; added GBL_MM_UPSET 22 0000: ; 16-Oct-2003 ; added GBL_PVSTART 23 0000: 24 0000: ; Layout of Global Memory -- ; top 32K of RAM (8000-FFFF) 25 0000: GBL equ 8000h+96 ; (allow 96 bytes for DMON) 26 0000: ; 27 0000: ; ==byte items 28 0000: GBL_CMD_GROUP equ GBL 29 0000: GBL_CURRENT_SC_BUFFER equ GBL+1 30 0000: GBL_SC_BUF1 equ GBL+2 31 0000: GBL_SC_BUF2 equ GBL+3 32 0000: GBL_MBR_REPLY equ GBL+4 33 0000: GBL_MM_Status equ GBL+5 34 0000: ; 0 - off 35 0000: ; 1 - on 36 0000: GBL_MMCB_Status equ GBL+6 37 0000: ; 0 - not Formatted 38 0000: ; 1 - Formatted 39 0000: GBL_TM_Status equ GBL+7 40 0000: ; 0 - not allocated 41 0000: ; 1 - telemetry being generated 42 0000: GBL_DCM_Status equ GBL+8 43 0000: ; FF- not used -- raw data sent to ground 44 0000: ; 0 - off 45 0000: ; other codes set by DCM_TASK 46 0000: GBL_TT_ABORT equ GBL+9 ; 1=SAFE command aborting time-tagged 47 0000: GBL_TM_IDLE equ GBL+10 ; =1 - TM task is idle 48 0000: GBL_TLM_CHANNEL equ GBL+11 49 0000: GBL_SCIENCE_MODE equ GBL+12 50 0000: MODE_STANDBY equ 0 51 0000: MODE_AUR equ 1 52 0000: MODE_SPRC equ 2 53 0000: MODE_SPRB equ 3 54 0000: MODE_DAYSIDE equ 4 55 0000: GBL_TLM_ILK equ GBL+13 ; 0=no, 1=ilk cmd rec, 2=switching 56 0000: GBL_PPS_CTR equ GBL+14 ; incremented by PPS interrupt 57 0000: GBL_SC_SENDING equ GBL+15 ; nonzero if PVCFs being sent to SC 58 0000: ;***GBL_ARMSW equ GBL+16 ; bits used to re-arm triggers Page 6 59 0000: GBL_MM_UPSET equ GBL+16 ; =1 if MM upset detected 60 0000: GBL_MULTIPLE equ GBL+17 ; =1 allows multiple (follow-on) triggers 61 0000: GBL_PVCF_ILK equ GBL+18 ; =1 DCM task not allowed to start compress 62 0000: GBL_DCM_IDLE equ GBL+19 ; =1 - DCM task is idle 63 0000: GBL_TEST equ GBL+20 64 0000: GBL_ECHO_DISABLE equ GBL+21 ; =1 disables command echoes 65 0000: GBL_DCTIMER equ GBL+22 ; =1 downcounter timer expired 66 0000: GBL_RO_IDLE equ GBL+23 ; =1 no readouts still to be processed 67 0000: GBL_SOH_WAIT equ GBL+24 ; =1 SOH finishing hskp output 68 0000: 69 0000: ; 1-byte up-counter, incremented by the internal 1-Hz interrupt 70 0000: GBL_SECONDS_CTR equ GBL+25 71 0000: 72 0000: ; switches which direct certain packets 73 0000: ; via SOH, TM or both (default is 0 - SOH-only) 74 0000: GBL_703 equ GBL+26 ; Command Echo 75 0000: GBL_705 equ GBL+27 ; TPA 76 0000: GBL_709 equ GBL+28 ; Memory Dump 77 0000: GBL_70B equ GBL+29 ; MM Bad Section packet 78 0000: GBL_719 equ GBL+30 ; Time-Tagged List Dump 79 0000: GBL_71A equ GBL+31 ; I_IN result 80 0000: GBL_71B equ GBL+32 ; CDI read result 81 0000: GBL_71C equ GBL+33 ; Monitor 82 0000: GBL_71D equ GBL+34 ; SOH 83 0000: GBL_71E equ GBL+35 ; Event Packet 84 0000: GBL_720 equ GBL+36 ; Debug packet 85 0000: 86 0000: GBL_FLUSH_REQUEST equ GBL+37 87 0000: ; 38..40 spare 88 0000: 89 0000: ; Camera Parameters 90 0000: GBL_CAM equ GBL+41 ; (30 bytes) 91 0000: GBL_CAM_EXPOSURE equ GBL_CAM ; milliseconds (2 bytes) 92 0000: GBL_CAM_INTERVAL equ GBL_CAM+2 ; interval between exposures (seconds) 93 0000: 94 0000: ; Monitor Packet (ApID=71C) Data array 95 0000: ; 170 bytes -- offset to "checksum" minus 10 (for sec hdr) 96 0000: GBL_MON_ARRAY equ GBL_CAM+30 97 0000: GBL_MON equ GBL_MON_ARRAY-10 ; data starting after 2ndary hdr 98 0000: ; (-10 makes offsets from GBL_MON agree with 8565 document) 99 0000: ; 100 0000: ; SOH Packet Data (ApID=71D) array 101 0000: ; 236 bytes -- offset to "checksum" minus 10 (for sec hdr) 102 0000: GBL_SOH_ARRAY equ GBL_MON_ARRAY+170 103 0000: GBL_SOH equ GBL_SOH_ARRAY-10 ; data starting after 2ndary hdr 104 0000: ; (-10 makes offsets from GBL_SOH agree with 8565 document) 105 0000: 106 0000: ; assembled command (see CMD_IN.A) 107 0000: ; (max command packet is 224 bytes) 108 0000: ; assembled data is 206 = 224 - 10(sec hdr) - 6(prihdr) - 2(CK, TLR) 109 0000: GBL_ASM equ GBL_SOH_ARRAY+236 110 0000: 111 0000: ; processed command (see CMD.A) -- 208 bytes 112 0000: GBL_CMD equ GBL_ASM+206 113 0000: 114 0000: ; Bracketting Pair of TPA data 115 0000: TPA_LENGTH equ 42 116 0000: GBL_TPA1 equ GBL_CMD+208 117 0000: GBL_TPA2 equ GBL_TPA1+TPA_LENGTH 118 0000: Page 7 119 0000: ; Place to build Science Headers (256 bytes) 120 0000: GBL_SCI_HDR equ GBL_TPA2+TPA_LENGTH 121 0000: 122 0000: ; Storage used in "mmcb.a" (100 bytes) 123 0000: GBL_MMCB_MISC equ GBL_SCI_HDR+256 124 0000: 125 0000: ; Storage used in "tm.a" (30 bytes) 126 0000: GBL_TM_MISC equ GBL_MMCB_MISC+100 127 0000: 128 0000: ; Queue allocations 129 0000: ; ----------------- 130 0000: GBL_QUEUES equ GBL_TM_MISC+30 131 0000: 132 0000: ; CMD bytes input (about 10 max-sized commands) 133 0000: GBL_CMD_IN_QUEUE equ GBL_QUEUES 134 0000: GBL_CMD_IN_QUEUE_WRAP equ GBL_CMD_IN_QUEUE+2640 135 0000: ; 136 0000: ; Event queue (each element is: code, 6-byte time) 137 0000: ; (has to cover at least an SOH sampling interval) 138 0000: ; Allocate 500 elements 139 0000: evqelt equ 500*7 140 0000: GBL_EVENT_QUEUE equ GBL_CMD_IN_QUEUE_WRAP 141 0000: GBL_EVENT_QUEUE_WRAP equ GBL_EVENT_QUEUE+evqelt 142 0000: GBL_EVENT_QUEUE_STORE_PTR equ GBL_EVENT_QUEUE_WRAP ; ds 2 143 0000: 144 0000: ; 256-byte temporary re-use area for building 145 0000: ; science packet headers, memory dumps etc. 146 0000: GBL_TEMP equ GBL_EVENT_QUEUE_STORE_PTR+2 147 0000: 148 0000: 149 0000: ; [these parameters have been moved into the GBL_SOH area] 150 0000: ; 151 0000: ; Parameters used to generate the MMCBs 152 0000: ; and allocate Mass Memory 153 0000: ; 4-byte big endian Buffer Allocation sizes 154 0000: GBL_CAM_NWB EQU GBL_SOH+223 ; IDH_CAM_NWB 155 0000: GBL_SPF_NWB EQU GBL_SOH+227 ; IDH_SPF_NWB 156 0000: GBL_SPS_NWB EQU GBL_SOH+231 ; IDH_SPS_NWB 157 0000: GBL_APH_NWB EQU GBL_SOH+235 ; IDH_AP_NWB 158 0000: ; 4-byte big endian Actual Readout sizes 159 0000: GBL_CAM_NWRO EQU GBL_SOH+180 ; IDH_CAM_NWRO 160 0000: GBL_SPF_NWRO EQU GBL_SOH+184 ; IDH_SPF_NWRO 161 0000: GBL_SPS_NWRO EQU GBL_SOH+188 ; IDH_SPS_NWRO 162 0000: GBL_APH_NWRO EQU GBL_SOH+192 ; IDH_AP_NWRO 163 0000: 164 0000: ; 2-byte little endian counts of 165 0000: ; how many MMCBs to allocate 166 0000: GBL_N_CAM_MMCBS EQU GBL_SOH+161 ; IDH_N_CAM_MMCBS 167 0000: GBL_N_SPF_MMCBS equ GBL_SOH+163 ; IDH_N_SPF_MMCBS 168 0000: GBL_N_SPS_MMCBS equ GBL_SOH+155 ; IDH_N_SPS_MMCBS 169 0000: GBL_N_APH_MMCBS equ GBL_SOH+157 ; IDH_N_AP_MMCBS 170 0000: 171 0000: ; number of samples per readout 172 0000: GBL_N_EXP equ GBL_SOH+103 ; IDH_N_EXP (1 byte) 173 0000: GBL_N_SPF equ GBL_SOH+174 ; IDH_N_SPF (2 bytes, bigE) 174 0000: GBL_N_SPS equ GBL_SOH+176 ; IDH_N_SPS (2 bytes, bigE) 175 0000: GBL_N_APH equ GBL_SOH+178 ; IDH_N_APH (2 bytes, bigE) 176 0000: 177 0000: 178 0000: ; 3-byte banked memory pointers to the first and last elements Page 8 179 0000: ; of the MMCB queues (these queues change in size) 180 0000: GBL_CAM_SUPPLY_Q equ GBL_TEMP+256 181 0000: GBL_CAM_SUPPLY_QTAIL equ GBL_CAM_SUPPLY_Q+3 182 0000: GBL_SPF_SUPPLY_Q equ GBL_CAM_SUPPLY_QTAIL+3 183 0000: GBL_SPF_SUPPLY_QTAIL equ GBL_SPF_SUPPLY_Q+3 184 0000: GBL_SPS_SUPPLY_Q equ GBL_SPF_SUPPLY_QTAIL+3 185 0000: GBL_SPS_SUPPLY_QTAIL equ GBL_SPS_SUPPLY_Q+3 186 0000: GBL_APH_SUPPLY_Q equ GBL_SPS_SUPPLY_QTAIL+3 187 0000: GBL_APH_SUPPLY_QTAIL equ GBL_APH_SUPPLY_Q+3 188 0000: GBL_DCM_QHEAD equ GBL_APH_SUPPLY_QTAIL+3 189 0000: GBL_DCM_QTAIL equ GBL_DCM_QHEAD+3 190 0000: GBL_TM_QHEAD equ GBL_DCM_QTAIL+3 191 0000: GBL_TM_QTAIL equ GBL_TM_QHEAD+3 192 0000: 193 0000: ; Stacks 194 0000: stack_size equ 180 195 0000: GBL_SUPPLY_STACK equ GBL_TM_QTAIL+3 196 0000: GBL_BG_STACK equ GBL_SUPPLY_STACK+stack_size 197 0000: GBL_TM_STACK equ GBL_BG_STACK+stack_size 198 0000: GBL_SOH_STACK equ GBL_TM_STACK+stack_size 199 0000: GBL_SC_STACK equ GBL_SOH_STACK+stack_size 200 0000: GBL_DCM_STACK equ GBL_SC_STACK+stack_size 201 0000: GBL_HTR_STACK equ GBL_DCM_STACK+stack_size 202 0000: GBL_CMD_PROC_STACK equ GBL_HTR_STACK+stack_size 203 0000: 204 0000: ; Place to build Event Packets 205 0000: ; count byte 206 0000: ; 8 event times 207 0000: GBL_EVENT_DATA equ GBL_CMD_PROC_STACK+stack_size 208 0000: evdta equ 8*10 209 0000: 210 0000: ; for building a PVCF 211 0000: GBL_BPVCF equ GBL_EVENT_DATA+1+evdta 212 0000: ; (allocate 1108 bytes, plus 1 extra) 213 0000: 214 0000: GBL_SCIENCE_START_TIME equ GBL_BPVCF+1109 215 0000: 216 0000: ; 1024 byte buffer used by /I_EEPROM_TO_MM 217 0000: GBL_DSP_BUF equ GBL_SCIENCE_START_TIME+6 218 0000: 219 0000: ; Copy of GBL_SOH_ARRAY used to hold data fixed 220 0000: ; while sending SOH packet (238 bytes) 221 0000: GBL_SOH_COPY equ GBL_DSP_BUF+1024 222 0000: 223 0000: ; 4 bytes of zero 224 0000: GBL_zero equ GBL_SOH_COPY+238 225 0000: 226 0000: ; MM addr of Base Parameter List (starts with status word) 227 0000: GBL_BPL_MMADDR equ GBL_zero+4 ; (4 bytes) 228 0000: ; Contents of Base Parameter List ( 5 4-byte items) 229 0000: GBL_BPL_STATUS equ GBL_BPL_MMADDR+4 230 0000: GBL_BPL_PLB equ GBL_BPL_STATUS+4 231 0000: GBL_BPL_CMD equ GBL_BPL_PLB+4 232 0000: GBL_BPL_MMCB equ GBL_BPL_CMD+4 233 0000: GBL_BPL_DEBUG equ GBL_BPL_MMCB+4 234 0000: 235 0000: ; addr of first readout area (not part of BPL) 236 0000: GBL_RO_BASE equ GBL_BPL_DEBUG+4 237 0000: 238 0000: ; Initialization parameter array sent to DCM Page 9 239 0000: ; for packet-to-PVCF processing 240 0000: GBL_PP_OP equ GBL_RO_BASE+4 241 0000: GBL_PP_MMSC1 equ GBL_PP_OP+4 242 0000: GBL_PP_MMSC2 equ GBL_PP_MMSC1+4 243 0000: GBL_PP_MAXNPVCFS equ GBL_PP_MMSC2+4 244 0000: GBL_PP_N_SC1 equ GBL_PP_MAXNPVCFS+4 245 0000: GBL_PP_N_SC2 equ GBL_PP_N_SC1+4 246 0000: GBL_PP_VCFC equ GBL_PP_N_SC2+4 247 0000: GBL_PP_MMHDRS equ GBL_PP_VCFC+4 248 0000: 249 0000: ; workspace (16 bytes) for CLOCK time converters 250 0000: GBL_CLOCKWORK equ GBL_PP_MMHDRS+4 251 0000: 252 0000: ; IDC control bits (2 bytes) 253 0000: GBL_IDC_CTRL equ GBL_CLOCKWORK+16 254 0000: 255 0000: ; IDC Lightning and Cosmic ray 256 0000: ; threshhold parameters (CDI's 40..49) 257 0000: GBL_IDC_LTHRESH equ GBL_IDC_CTRL+2 ; 10 16-bit words 258 0000: ; Lightning Detect Control (2 bytes) 259 0000: GBL_IDC_LDETECT equ GBL_IDC_LTHRESH+20 260 0000: ; IDC SPS scaling (4 bytes) 261 0000: GBL_IDC_SPS_SCALE equ GBL_IDC_LDETECT+2 262 0000: 263 0000: GBL_CCSDS equ GBL_IDC_SPS_SCALE+4 ; 100 bytes 264 0000: GBL_PVCF_PROM equ GBL_CCSDS+100 ; 60 bytes 265 0000: 266 0000: ; workspace in CMD.A 267 0000: GBL_CMD_WORKSPACE equ GBL_PVCF_PROM+60 ; 300 bytes 268 0000: 269 0000: ; workspace for PWR routines in PROM 270 0000: GBL_PWR equ GBL_CMD_WORKSPACE+300 ; 11 bytes 271 0000: 272 0000: ; work area for HTR routines 273 0000: GBL_HTR_WORK equ GBL_PWR+11 ; 40 bytes 274 0000: 275 0000: ; number of PVCFs last sent from SC buffers 276 0000: GBL_N1 equ GBL_HTR_WORK+40 ; 2 bytes 277 0000: GBL_N2 equ GBL_N1+2 278 0000: 279 0000: ; Analog Housekeeping Buffer (128 bytes) 280 0000: GBL_IAM equ GBL_N2+2 281 0000: 282 0000: ; 128 bytes for writing pages of EEPROM 283 0000: GBL_128BYTES equ GBL_IAM+128 284 0000: 285 0000: ; 4 push levels for I_XGROUP (12 bytes) 286 0000: GBL_XGS equ GBL_128BYTES+128 287 0000: ; XGS stack pointer (2 bytes) 288 0000: GBL_XGS_SP equ GBL_XGS+12 289 0000: 290 0000: ; for use by code in "EEPROM.A" 291 0000: GBL_EEPROM equ GBL_XGS_SP+2 ; 8 bytes 292 0000: 293 0000: GBL_WAIT_TIMEOUT equ GBL_EEPROM+8 ; 1 byte 294 0000: 295 0000: ; number of milliseconds delay between trigger events 296 0000: ; (little endian) 297 0000: GBL_TRIGGER_DELAY equ GBL_WAIT_TIMEOUT+1 ; 2-bytes 298 0000: GBL_DOING_TRIG_DELAY equ GBL_TRIGGER_DELAY+2 ; switch: 1 byte Page 10 299 0000: 300 0000: GBL_PVSTART equ GBL_DOING_TRIG_DELAY+1 301 0000: GBL_END equ GBL_PVSTART+1 302 0000: ; lxi h,GBL_END 303 0000: 304 0000: 305 0000: ; Note: C000-C5FF reserved for debugger (see DEBHP.a) 306 0000: 307 0000: ; Allocate Debug Output Queue (bytes) 308 0000: GBL_DTP_OUTQ equ 0C600h 309 0000: GBL_DTP_OUTQ_WRAP equ 0CA00h 310 0000: 311 0000: 312 0000: ; 4096 bytes at top of memory 313 0000: GBL_4K equ 0F000h 314 0000: 315 0000: 9 0000: org 0C000h; 10 C000: C214 dw DEBUG_INIT 11 C002: C01C dw DEBUG_PUTBYTE 12 C004: C310 dw DEBUG_SHOW 13 C006: C3D4 dw DEBUG_DUMP 14 C008: C05F dw DEBUG_ASC 15 C00A: C07C dw DEBUG_ASC_HL 16 C00C: C092 dw DEBUG_ASC_DEC 17 C00E: C3F0 dw DEBUG_SHOWMET 18 C010: C40A dw DEBUG_SHOWUT 19 C012: C0A8 dw DEBUG_SHOWA 20 C014: C424 dw DEBUG_ASSERT 21 C016: C3A5 dw DEBUG_REGSET 22 C018: CD 0000 debug_function: call 0 23 C01B: C9 ret 24 C01C: 25 C01C: ; send byte to output queue 26 C01C: ; A - the byte 27 C01C: DEBUG_PUTBYTE: 28 C01C: F5 push psw 29 C01D: C5 push b 30 C01E: D5 push d 31 C01F: E5 push h 32 C020: ; 33 C020: 47 mov b,a 34 C021: 3A C0CC lda dtp_present 35 C024: FE 00 cpi 0 36 C026: CA C04D jz pxit ; DTP not attached 37 C029: 38 C029: ; 39 C029: 3A C0D2 lda trap_flag 40 C02C: FE 01 cpi 1 41 C02E: CA C052 jz trapio ; special if we had a TRAP 42 C031: 43 C031: 2A C0CF lhld qpw ; pointer for writing into queue 44 C034: 70 mov M,b ; store byte in queue 45 C035: 23 inx h ; step pointer 46 C036: 11 CA00 lxi d,GBL_DTP_OUTQ_WRAP 47 C039: 7D mov a,l 48 C03A: BB cmp e 49 C03B: C2 C046 jnz nowrapw 50 C03E: 7C mov a,h Page 11 51 C03F: BA cmp d 52 C040: C2 C046 jnz nowrapw 53 C043: 21 C600 lxi h,GBL_DTP_OUTQ ; back to the beginning 54 C046: 22 C0CF nowrapw: shld qpw ; store the pointer 55 C049: ; now enable output interrupt 56 C049: 3E 03 mvi a,3 ; both in and out 57 C04B: D3 E5 out DTP_CTRL_O 58 C04D: 59 C04D: pxit: 60 C04D: E1 pop h 61 C04E: D1 pop d 62 C04F: C1 pop b 63 C050: F1 pop psw 64 C051: C9 ret 65 C052: ; 66 C052: ; if outputting within a TRAP, 67 C052: ; don't use the queues and interrupts; do programmed I/O 68 C052: trapio: 69 C052: DB E5 wll: in DTP_STS_I 70 C054: E6 01 ani 1 ; wait for xmtr ready 71 C056: CA C052 jz wll 72 C059: 78 mov a,b 73 C05A: D3 E4 out DTP_TX_O ; send out byte 74 C05C: C3 C04D jmp pxit 75 C05F: 76 C05F: 77 C05F: DEBUG_ASC: 78 C05F: ; text follows call: look for '$' or '~' in following string 79 C05F: ; (don't show '~' or '$') 80 C05F: E3 xthl ; exchange top of stack (TOS) with HL 81 C060: F5 push psw 82 C061: 7E a1: mov a,M ; get string byte 83 C062: FE 24 cpi '$' ; end of string? 84 C064: CA C073 jz a2 ; yes 85 C067: FE 7E cpi '~' ; end with no newline? 86 C069: CA C078 jz a2nl 87 C06C: CD C01C call debug_putbyte ; no send out byte 88 C06F: 23 inx h ; keep looking 89 C070: C3 C061 jmp a1 90 C073: 3E 0A a2: mvi a,10 ; send Newline 91 C075: CD C01C call debug_putbyte 92 C078: 23 a2nl: inx h 93 C079: F1 pop psw 94 C07A: E3 xthl ; set new return-address as TOS 95 C07B: C9 ret 96 C07C: ; 97 C07C: DEBUG_ASC_HL: 98 C07C: ; HL - data value to display in Hex 99 C07C: ; text follows call: look for '=' in following string 100 C07C: E3 xthl ; exchange top of stack (TOS) with HL 101 C07D: F5 push psw 102 C07E: 7E stl1: mov a,M ; get string byte 103 C07F: CD C01C call debug_putbyte ; send it out 104 C082: FE 3D cpi '=' ; end of string? 105 C084: CA C08B jz found_eq ; yes 106 C087: 23 inx h ; no; keep looking 107 C088: C3 C07E jmp stl1 108 C08B: found_eq: 109 C08B: 23 inx h 110 C08C: F1 pop psw Page 12 111 C08D: E3 xthl ; set new return-address as TOS 112 C08E: CD C359 call HEXOUT ; tell monitor to display (original) HL as hex 113 C091: C9 ret 114 C092: ; 115 C092: DEBUG_ASC_DEC: 116 C092: ; HL - data value to display in decimal 117 C092: ; text follows call: look for '=' in following string 118 C092: E3 xthl ; exchange top of stack (TOS) with HL 119 C093: F5 push psw 120 C094: 7E ttl1: mov a,M ; get string byte 121 C095: CD C01C call debug_putbyte ; send it out 122 C098: FE 3D cpi '=' ; end of string? 123 C09A: CA C0A1 jz fnd_eq ; yes 124 C09D: 23 inx h ; no; keep looking 125 C09E: C3 C094 jmp ttl1 126 C0A1: fnd_eq: 127 C0A1: 23 inx h 128 C0A2: F1 pop psw 129 C0A3: E3 xthl ; set new return-address as TOS 130 C0A4: CD C37F call DECOUT ; tell monitor to display (original) HL as decimal 131 C0A7: C9 ret 132 C0A8: 133 C0A8: ; show A= as 2-digit hex 134 C0A8: DEBUG_SHOWA: 135 C0A8: F5 push psw 136 C0A9: C5 push b 137 C0AA: 47 mov b,a 138 C0AB: CD C303 call send_packet_prefix 139 C0AE: 3E 03 mvi a,SHOW_HEXA 140 C0B0: CD C01C call debug_putbyte 141 C0B3: 78 mov a,b 142 C0B4: CD C01C call debug_putbyte 143 C0B7: C1 pop b 144 C0B8: F1 pop psw 145 C0B9: C9 ret 146 C0BA: ; 147 C0BA: ; show A as 2-digit hex 148 C0BA: DEBUG_SHOW_HEX1: 149 C0BA: F5 push psw 150 C0BB: C5 push b 151 C0BC: 47 mov b,a 152 C0BD: CD C303 call send_packet_prefix 153 C0C0: 3E 0D mvi a,SHOW_HEX1 154 C0C2: CD C01C call debug_putbyte 155 C0C5: 78 mov a,b 156 C0C6: CD C01C call debug_putbyte 157 C0C9: C1 pop b 158 C0CA: F1 pop psw 159 C0CB: C9 ret 160 C0CC: ; 161 C0CC: ; packet codes recognized by U 162 C0CC: include u.i 1 C0CC: ; u.i -- packet codes recognized by U 2 C0CC: ; 3 C0CC: SHOW_DECIMAL equ 1 4 C0CC: SHOW_HEX equ 2 5 C0CC: SHOW_HEXA equ 3 6 C0CC: SHOW_REGSET equ 4 7 C0CC: SHOW_DUMP equ 5 Page 13 8 C0CC: EXIT_U equ 6 9 C0CC: SHOW_HEXN equ 7 10 C0CC: SHOW_DECN equ 8 11 C0CC: SHOW_UT equ 11 12 C0CC: SHOW_MET equ 12 13 C0CC: SHOW_HEX1 equ 13 14 C0CC: ; 15 C0CC: ; 16 C0CC: ; command-codes recognized by DEBUG 17 C0CC: DC_F1 equ 4 18 C0CC: DC_READCLOCK equ 2 19 C0CC: DC_F3 equ 5 20 C0CC: DC_F4 equ 6 21 C0CC: DC_F5 equ 7 22 C0CC: DC_F6 equ 8 23 C0CC: DC_F8 equ 10 24 C0CC: DC_F9 equ 11 25 C0CC: DC_F10 equ 12 26 C0CC: DC_F7 equ 13 27 C0CC: DC_F11 equ 14 28 C0CC: DC_CF1 equ 15 29 C0CC: DC_CF2 equ 16 30 C0CC: DC_CF5 equ 17 31 C0CC: 32 C0CC: 163 C0CC: 164 C0CC: 00 dtp_present db 0 ; 1=DTP attached, 0=flight mode 165 C0CD: ; 166 C0CD: ; 167 C0CD: ; serial output queue 168 C0CD: qpr ds 2 ; pointer for reading the queue 169 C0CF: qpw ds 2 ; pointer for writing the queue 170 C0D1: idle_flag ds 1 ; 1 if no more interrupts will happen 171 C0D2: ; 172 C0D2: 00 trap_flag db 0 ; =1 if a TRAP has happened 173 C0D3: ; input processing state-machine 174 C0D3: in_state ds 2 175 C0D5: ; 176 C0D5: ; ================================ 177 C0D5: ; Serial Input or Output Handler 178 C0D5: ; ================================ 179 C0D5: public DEBUG_ISR 180 C0D5: DEBUG_ISR: 181 C0D5: F5 push psw 182 C0D6: C5 push b 183 C0D7: D5 push d 184 C0D8: E5 push h 185 C0D9: 186 C0D9: ; test UART status for output 187 C0D9: DB E5 in DTP_STS_I 188 C0DB: E6 01 ani 1 189 C0DD: C4 C17F cnz xmtr_ready 190 C0E0: ; 191 C0E0: ; test UART status for input 192 C0E0: DB E5 in DTP_STS_I 193 C0E2: E6 02 ani 2 194 C0E4: C4 C179 cnz rcvr_ready 195 C0E7: ; 196 C0E7: dismiss: Page 14 197 C0E7: E1 pop h 198 C0E8: D1 pop d 199 C0E9: C1 pop b 200 C0EA: F1 pop psw 201 C0EB: FB ei 202 C0EC: C9 ret 203 C0ED: 204 C0ED: 205 C0ED: ; ================== 206 C0ED: ; TRAP handler 207 C0ED: ; ================== 208 C0ED: prior_imask ds 1 209 C0EE: prior_bank ds 1 210 C0EF: where ds 2 211 C0F1: stack_pointer ds 2 212 C0F3: ; 213 C0F3: DEBUG_TRAP: 214 C0F3: F3 di ; no more interrupts 215 C0F4: E3 xthl ; exchange top-of-stack with HL 216 C0F5: 22 C0EF shld where ; this is where the Trap happened 217 C0F8: 21 0000 lxi h,0 218 C0FB: 39 dad sp 219 C0FC: 22 C0F1 shld stack_pointer 220 C0FF: E3 xthl 221 C100: F5 push psw 222 C101: C5 push b 223 C102: D5 push d 224 C103: E5 push h 225 C104: ; 226 C104: ; capture the bank registers 227 C104: DB 02 in BANK_SELECT_I 228 C106: 32 C0EE sta prior_bank 229 C109: ; 230 C109: 3E 01 mvi a,1 ; in a TRAP routine; use programmed I/O 231 C10B: 32 C0D2 sta trap_flag 232 C10E: 20 rim ; read (prior) interrupt mask 233 C10F: 32 C0ED sta prior_imask 234 C112: ; display "\nTRAP@addr" 235 C112: 21 C163 lxi h,trap_msg 236 C115: CD C310 call DEBUG_SHOW 237 C118: 2A C0EF lhld where ; get where the Trap happened 238 C11B: CD C36C call DEBUG_SHOW_HEXN 239 C11E: ; display " IMASK=xx\n" 240 C11E: 21 C16A lxi h,imaskmsg 241 C121: CD C310 call DEBUG_SHOW 242 C124: 3A C0ED lda prior_imask 243 C127: 6F mov l,a 244 C128: 26 00 mvi h,0 245 C12A: CD C36C call DEBUG_SHOW_HEXN ; show interrupt mask 246 C12D: 3E 20 mvi a,32 ; space 247 C12F: CD C01C call debug_putbyte 248 C132: ; display "SP=" 249 C132: 21 C15F lxi h,speq 250 C135: CD C310 call DEBUG_SHOW 251 C138: 2A C0F1 lhld stack_pointer 252 C13B: CD C36C call DEBUG_SHOW_HEXN 253 C13E: ; show Bank register 254 C13E: 21 C172 lxi h,bankmsg 255 C141: CD C310 call DEBUG_SHOW 256 C144: 3A C0EE lda prior_bank Page 15 257 C147: CD C0BA call DEBUG_SHOW_HEX1 258 C14A: 3E 0A mvi a,10 ; newline 259 C14C: CD C01C call debug_putbyte 260 C14F: ; show a register set 261 C14F: E1 pop h 262 C150: D1 pop d 263 C151: C1 pop b 264 C152: F1 pop psw 265 C153: CD C3A5 call DEBUG_REGSET 266 C156: D3 00 dogbite: out software_reset_o ; ***jmp dogbite 267 C158: ; switch to DMON4 EEPROM 268 C158: 3E 86 mvi a,86h 269 C15A: D3 02 out BANK_SELECT_O 270 C15C: C3 4000 jmp 4000h 271 C15F: 272 C15F: 273 C15F: 53 50 3D speq asc "SP=" 274 C162: 00 db 0 275 C163: 0D trap_msg db 13 276 C164: 54 52 41 50 asc "TRAP@" 40 277 C169: 00 db 0 278 C16A: 20 49 4D 41 imaskmsg asc " IMASK=" 53 4B 3D 279 C171: 00 db 0 280 C172: 20 42 61 6E bankmsg asc " Bank=" 6B 3D 281 C178: 00 db 0 282 C179: 283 C179: rcvr_ready: 284 C179: DB E4 in DTP_RX_I ; read input byte 285 C17B: 2A C0D3 lhld in_state ; get input state-machine address 286 C17E: E9 pchl ; jump there 287 C17F: ; 288 C17F: ; 289 C17F: xmtr_ready: 290 C17F: 291 C17F: ; send byte from output queue to serial port 292 C17F: ; 293 C17F: ; if the queue pointers are equal, nothing in queue 294 C17F: 2A C0CD lhld qpr 295 C182: EB xchg 296 C183: 2A C0CF lhld qpw 297 C186: 7D mov a,l 298 C187: BB cmp e 299 C188: C2 C19A jnz not_empty 300 C18B: 7C mov a,h 301 C18C: BA cmp d 302 C18D: C2 C19A jnz not_empty 303 C190: ; nothing else to send; declare idle state 304 C190: 3E 01 mvi a,1 305 C192: 32 C0D1 sta idle_flag 306 C195: ; disable output interrupt (bit 0) 307 C195: 3E 02 mvi a,2 ; leave input (bit 1) enabled 308 C197: D3 E5 out DTP_CTRL_O ; UART_SETUP 309 C199: C9 ret 310 C19A: ; 311 C19A: ; not empty; send out next byte 312 C19A: not_empty: 313 C19A: 3E 00 mvi a,0 Page 16 314 C19C: 32 C0D1 sta idle_flag ; not idle; queue is not empty 315 C19F: 2A C0CD lhld qpr ; pointer for reading queue 316 C1A2: 7E mov a,M ; get byte 317 C1A3: D3 E4 out DTP_TX_O ; send to serial port 318 C1A5: ; step queue 319 C1A5: 23 inx h ; step the pointer 320 C1A6: ; wrap queue pointer if neccessary 321 C1A6: 11 CA00 lxi d,GBL_DTP_OUTQ_WRAP 322 C1A9: 7D mov a,l 323 C1AA: BB cmp e 324 C1AB: C2 C1B6 jnz nowrapr 325 C1AE: 7C mov a,h 326 C1AF: BA cmp d 327 C1B0: C2 C1B6 jnz nowrapr 328 C1B3: 21 C600 lxi h,GBL_DTP_OUTQ ; wrap to start 329 C1B6: nowrapr: 330 C1B6: 22 C0CD shld qpr ; store the pointer 331 C1B9: C9 ret 332 C1BA: ; 333 C1BA: ; 334 C1BA: ; 335 C1BA: ; 336 C1BA: ; 337 C1BA: 01 0007 trap7: lxi b,7 338 C1BD: C3 C0F3 jmp debug_trap 339 C1C0: 01 0006 trap6: lxi b,6 340 C1C3: C3 C0F3 jmp debug_trap 341 C1C6: 01 0005 trap5: lxi b,5 342 C1C9: C3 C0F3 jmp debug_trap 343 C1CC: 01 0004 trap4: lxi b,4 344 C1CF: C3 C0F3 jmp debug_trap 345 C1D2: 01 0003 trap3: lxi b,3 346 C1D5: C3 C0F3 jmp debug_trap 347 C1D8: 01 0002 trap2: lxi b,2 348 C1DB: C3 C0F3 jmp debug_trap 349 C1DE: 01 0001 trap1: lxi b,1 350 C1E1: C3 C0F3 jmp debug_trap 351 C1E4: 01 00A5 trap05: lxi b,0a5h 352 C1E7: C3 C0F3 jmp debug_trap 353 C1EA: 01 0015 trap15: lxi b,15h 354 C1ED: C3 C0F3 jmp debug_trap 355 C1F0: 01 0025 trap25: lxi b,25h 356 C1F3: C3 C0F3 jmp debug_trap 357 C1F6: 01 0035 trap35: lxi b,35h 358 C1F9: C3 C0F3 jmp debug_trap 359 C1FC: 01 0045 trap45: lxi b,45h 360 C1FF: C3 C0F3 jmp debug_trap 361 C202: 01 0055 trap55: lxi b,55h 362 C205: C3 C0F3 jmp debug_trap 363 C208: 01 0065 trap65: lxi b,65h 364 C20B: C3 C0F3 jmp debug_trap 365 C20E: 01 0000 trap0: lxi b,0 366 C211: C3 C0F3 jmp debug_trap 367 C214: 368 C214: 369 C214: ; =================== 370 C214: ; Initialization 371 C214: DEBUG_INIT: 372 C214: F5 push psw 373 C215: E5 push h Page 17 374 C216: 375 C216: ; stuff all the interrupt vectors except 376 C216: ; RST 3 (used by this DTP serial port) 377 C216: ; 378 C216: ; this will make jumps to 0000 do a Trap 379 C216: 3E CD mvi a,0CDh ; "CALL" OPCODE 380 C218: 32 0000 sta RST_0 ; 0 381 C21B: 21 C20E lxi h,TRAP0 382 C21E: 22 0001 shld RST_0+1 383 C221: ; wild RST 7 is also a trap 384 C221: 32 0038 sta RST_7 385 C224: 21 C1BA lxi h,TRAP7 386 C227: 22 0039 shld RST_7+1 387 C22A: ; 388 C22A: 32 0004 sta RST_0+4 ; 0.5 389 C22D: 21 C1E4 lxi h,TRAP05 390 C230: 22 0005 shld RST_0+5 391 C233: ; 392 C233: 32 0008 sta RST_1 ; 1 393 C236: 21 C1DE lxi h,TRAP1 394 C239: 22 0009 shld RST_1+1 395 C23C: ; 396 C23C: 32 000C sta RST_1+4 ; 1.5 397 C23F: 21 C1EA lxi h,TRAP15 398 C242: 22 000D shld RST_1+5 399 C245: ; 400 C245: 32 0010 sta RST_2 ; 2 401 C248: 21 C1D8 lxi h,TRAP2 402 C24B: 22 0011 shld RST_2+1 403 C24E: ; 404 C24E: 32 0014 sta RST_2+4 ; 2.5 405 C251: 21 C1F0 lxi h,TRAP25 406 C254: 22 0015 shld RST_2+5 407 C257: ; 408 C257: 32 001C sta RST_3+4 ; 3.5 409 C25A: 21 C1F6 lxi h,TRAP35 410 C25D: 22 001D shld RST_3+5 411 C260: ; 412 C260: 32 0020 sta RST_4 ; 4 413 C263: 21 C1CC lxi h,TRAP4 414 C266: 22 0021 shld RST_4+1 415 C269: ; 416 C269: 32 0024 sta RST_4+4 417 C26C: 21 C1FC lxi h,TRAP45 418 C26F: 22 0025 shld RST_4+5 419 C272: ; 420 C272: 32 0028 sta RST_5 ; 5 421 C275: 21 C1C6 lxi h,TRAP5 422 C278: 22 0029 shld RST_5+1 423 C27B: ; 424 C27B: 32 0030 sta RST_6 425 C27E: 21 C1C0 lxi h,TRAP6 426 C281: 22 0031 shld RST_6+1 427 C284: ; 428 C284: 32 002C sta RST_55 429 C287: 21 C202 lxi h,TRAP55 430 C28A: 22 002D shld RST_55+1 431 C28D: ; 432 C28D: 32 0034 sta RST_65 433 C290: 21 C208 lxi h,TRAP65 Page 18 434 C293: 22 0035 shld RST_65+1 435 C296: ; 436 C296: 32 003C sta RST_75 437 C299: 21 C1C6 lxi h,TRAP5 438 C29C: 22 003D shld RST_75+1 439 C29F: ; 440 C29F: ; set TRAP vector 441 C29F: 3E C3 mvi a,JMP_OPCODE ; JMP opcode 442 C2A1: 32 0024 sta TRAP 443 C2A4: 21 C0F3 lxi h,DEBUG_TRAP ; address of Trap handler 444 C2A7: 22 0025 shld TRAP+1 ; set as JMP address 445 C2AA: 3E 00 mvi a,0 ; reset "trap happened" flag 446 C2AC: 32 C0D2 sta trap_flag 447 C2AF: ; 448 C2AF: ; Test for Diagnostic Test Pod (DTP) present 449 C2AF: 3E 00 mvi a,0 450 C2B1: 32 C0CC sta dtp_present ; assume no DTP 451 C2B4: 3E 03 mvi a,3 452 C2B6: D3 E5 out DTP_CTRL_O 453 C2B8: DB E5 in DTP_STS_I 454 C2BA: E6 60 ani 60h 455 C2BC: FE 60 cpi 60h 456 C2BE: C2 C2D3 jnz end_test 457 C2C1: 3E 00 mvi a,0 458 C2C3: D3 E5 out DTP_CTRL_O 459 C2C5: DB E5 in DTP_STS_I 460 C2C7: E6 60 ani 60h 461 C2C9: FE 00 cpi 0 462 C2CB: C2 C2D3 jnz end_test 463 C2CE: ; DTP was there! 464 C2CE: 3E 01 mvi a,1 465 C2D0: 32 C0CC sta dtp_present 466 C2D3: 467 C2D3: end_test: 468 C2D3: ; 469 C2D3: ; Set up debug serial port UART 470 C2D3: ; This is a custom UART, implemented in an ACTEL 471 C2D3: ; Setup bits sent to port E5: 472 C2D3: ; 7 : 1=Reset the UART 473 C2D3: ; 3 : 1=Modem Signals enabled 474 C2D3: ; 2 : 1=set loop-back on 475 C2D3: ; 1 : 1=receive interrupt enable 476 C2D3: ; 0 : 1=transmit interrupt enable 477 C2D3: 478 C2D3: ; enable only the input interrupt 479 C2D3: ; (the output interrupt stays on when the transmitter is idle) 480 C2D3: 3E 02 mvi a,2 481 C2D5: D3 E5 out DTP_CTRL_O 482 C2D7: ; 483 C2D7: ; clear any outstanding input status 484 C2D7: DB E6 in DTP_SENSE_I 485 C2D9: DB E4 in DTP_RX_I 486 C2DB: ; 487 C2DB: ; Setup and enable RST 3 488 C2DB: 3E C3 mvi A,JMP_OPCODE 489 C2DD: 32 0018 sta RST_3 490 C2E0: 21 C0D5 lxi h,DEBUG_ISR ; address of Interrupt handler 491 C2E3: 22 0019 shld RST_3+1 492 C2E6: ; 493 C2E6: ; enable interrupt Page 19 494 C2E6: DB 01 in IRQ_ENABLE_I 495 C2E8: F6 02 ori 02h ; bit 1 enables DTP serial port RST3 interrupt 496 C2EA: ; (DTP xmt and rec have not been enabled, so no DTP interrupt yet) 497 C2EA: D3 01 out IRQ_ENABLE_O 498 C2EC: ; Note: RST_3 is shared with "HKP Done", 499 C2EC: ; which is not used (and not enabled) 500 C2EC: 501 C2EC: ; 502 C2EC: ; setup output queue for serial port 503 C2EC: 21 C600 lxi h,GBL_DTP_OUTQ 504 C2EF: 22 C0CD shld qpr 505 C2F2: 22 C0CF shld qpw 506 C2F5: ; set the idle flag, so that PUT will fake an interrupt to start 507 C2F5: 3E 01 mvi a,1 508 C2F7: 32 C0D1 sta idle_flag 509 C2FA: ; 510 C2FA: ; Initialize the input state-machine 511 C2FA: 21 C329 lxi h,s0 512 C2FD: 22 C0D3 shld in_state 513 C300: ; 514 C300: ; 515 C300: E1 pop h 516 C301: F1 pop psw 517 C302: C9 ret 518 C303: ; 519 C303: ; 520 C303: ; 521 C303: ; 522 C303: ; 523 C303: send_packet_prefix: 524 C303: F5 push psw 525 C304: 3E FE mvi a,0FEh 526 C306: CD C01C call DEBUG_PUTBYTE 527 C309: 3E 7F mvi a,07Fh 528 C30B: CD C01C call DEBUG_PUTBYTE 529 C30E: F1 pop psw 530 C30F: C9 ret 531 C310: ; 532 C310: ; display message 533 C310: ; HL - points to null-terminated message string 534 C310: DEBUG_SHOW: 535 C310: F5 push psw 536 C311: E5 push h 537 C312: 7E l1: mov a,M ; get byte 538 C313: FE 00 cpi 0 ; null? 539 C315: CA C31F jz done ; yes, end of string 540 C318: CD C01C call DEBUG_PUTBYTE 541 C31B: 23 inx h ; next byte 542 C31C: C3 C312 jmp l1 543 C31F: E1 done: pop h 544 C320: F1 pop psw 545 C321: C9 ret 546 C322: ; 547 C322: ; 548 C322: ; 549 C322: ; ============================================= 550 C322: ; State-machine for debug input ... 551 C322: ; ============================================= 552 C322: start_over: 553 C322: 21 C329 lxi h,S0 Page 20 554 C325: 22 C0D3 shld in_state 555 C328: C9 ret 556 C329: ; 557 C329: ; look for sync pattern FE 7F 558 C329: CD C01C S0: call DEBUG_PUTBYTE ; echo 559 C32C: FE FE cpi 0FEh 560 C32E: C0 rnz 561 C32F: ; saw FE, now look for 7F 562 C32F: 21 C336 lxi h,S1 563 C332: 22 C0D3 shld in_state 564 C335: C9 ret 565 C336: CD C01C S1: call DEBUG_PUTBYTE ; echo 566 C339: FE 7F cpi 07Fh 567 C33B: C2 C322 jnz start_over 568 C33E: ; saw 7F, now get the command code 569 C33E: 21 C345 lxi h,S2 570 C341: 22 C0D3 shld in_state 571 C344: C9 ret 572 C345: ; 573 C345: ; Get command code; dispatch 574 C345: CD C01C S2: call DEBUG_PUTBYTE ; echo 575 C348: ; pass code to debug function 576 C348: CD C018 call DEBUG_FUNCTION 577 C34B: C3 C322 jmp start_over 578 C34E: ; 579 C34E: 580 C34E: FE 0A hex: cpi 10 581 C350: FA C356 jm low 582 C353: C6 37 adi 'A'-10 583 C355: C9 ret 584 C356: C6 30 low: adi '0' 585 C358: C9 ret 586 C359: ; 587 C359: ; make "U" packet to display number in HL as 4 Hex digits 588 C359: ; (with newline at end) 589 C359: HEXOUT: 590 C359: F5 push psw 591 C35A: CD C303 call send_packet_prefix 592 C35D: 3E 02 mvi a,SHOW_HEX ; function code for "U" program in PC 593 C35F: CD C01C call debug_putbyte 594 C362: 7C mov a,h 595 C363: CD C01C call debug_putbyte 596 C366: 7D mov a,l 597 C367: CD C01C call debug_putbyte 598 C36A: F1 pop psw 599 C36B: C9 ret 600 C36C: ; 601 C36C: ; make "U" packet to display number in HL as 4 Hex digits 602 C36C: ; (with no newline) 603 C36C: public DEBUG_SHOW_HEXN 604 C36C: DEBUG_SHOW_HEXN: 605 C36C: F5 push psw 606 C36D: CD C303 call send_packet_prefix 607 C370: 3E 07 mvi a,SHOW_HEXN ; function code for "U" program in PC 608 C372: CD C01C call debug_putbyte 609 C375: 7C mov a,h 610 C376: CD C01C call debug_putbyte 611 C379: 7D mov a,l 612 C37A: CD C01C call debug_putbyte 613 C37D: F1 pop psw Page 21 614 C37E: C9 ret 615 C37F: ; 616 C37F: ; make "U" packet to display number in HL as signed decimal 617 C37F: DECOUT: 618 C37F: F5 push psw 619 C380: CD C303 call send_packet_prefix 620 C383: 3E 01 mvi a,SHOW_DECIMAL 621 C385: CD C01C call debug_putbyte 622 C388: 7C mov a,h 623 C389: CD C01C call debug_putbyte 624 C38C: 7D mov a,l 625 C38D: CD C01C call debug_putbyte 626 C390: F1 pop psw 627 C391: C9 ret 628 C392: ; 629 C392: ; make "U" packet to display number in HL as signed decimal 630 C392: public DEBUG_SHOW_DECN 631 C392: DEBUG_SHOW_DECN 632 C392: F5 push psw 633 C393: CD C303 call send_packet_prefix 634 C396: 3E 08 mvi a,SHOW_DECN 635 C398: CD C01C call debug_putbyte 636 C39B: 7C mov a,h 637 C39C: CD C01C call debug_putbyte 638 C39F: 7D mov a,l 639 C3A0: CD C01C call debug_putbyte 640 C3A3: F1 pop psw 641 C3A4: C9 ret 642 C3A5: ; 643 C3A5: ; 644 C3A5: DEBUG_REGSET: 645 C3A5: F5 push psw 646 C3A6: C5 push b 647 C3A7: F5 push psw 648 C3A8: CD C303 call send_packet_prefix 649 C3AB: 3E 04 mvi a,SHOW_REGSET 650 C3AD: CD C01C call debug_putbyte 651 C3B0: C1 pop b 652 C3B1: 78 mov a,b 653 C3B2: CD C01C call debug_putbyte 654 C3B5: C1 pop b 655 C3B6: 79 mov a,c 656 C3B7: CD C01C call debug_putbyte 657 C3BA: 78 mov a,b 658 C3BB: CD C01C call debug_putbyte 659 C3BE: 79 mov a,c 660 C3BF: CD C01C call debug_putbyte 661 C3C2: 7A mov a,d 662 C3C3: CD C01C call debug_putbyte 663 C3C6: 7B mov a,e 664 C3C7: CD C01C call debug_putbyte 665 C3CA: 7C mov a,h 666 C3CB: CD C01C call debug_putbyte 667 C3CE: 7D mov a,l 668 C3CF: CD C01C call debug_putbyte 669 C3D2: F1 pop psw 670 C3D3: C9 ret 671 C3D4: ; 672 C3D4: DEBUG_DUMP: 673 C3D4: ; dump bytes pointed to by HL Page 22 674 C3D4: ; C gives number of bytes 675 C3D4: F5 push psw 676 C3D5: C5 push b 677 C3D6: E5 push h 678 C3D7: CD C303 call send_packet_prefix 679 C3DA: 3E 05 mvi a,SHOW_DUMP 680 C3DC: CD C01C call debug_putbyte 681 C3DF: 79 mov a,c ; number of bytes to follow 682 C3E0: CD C01C call debug_putbyte 683 C3E3: 7E ddl: mov a,M 684 C3E4: CD C01C call debug_putbyte 685 C3E7: 23 inx h 686 C3E8: 0D dcr c 687 C3E9: C2 C3E3 jnz ddl 688 C3EC: E1 pop h 689 C3ED: C1 pop b 690 C3EE: F1 pop psw 691 C3EF: C9 ret 692 C3F0: ; 693 C3F0: 694 C3F0: ; display spacecraft time as hh:mm:ss 695 C3F0: DEBUG_SHOWMET: 696 C3F0: ; HL - points to 6 bytes of MET 697 C3F0: F5 push psw 698 C3F1: C5 push b 699 C3F2: E5 push h 700 C3F3: CD C303 call send_packet_prefix 701 C3F6: 3E 0C mvi a,SHOW_MET 702 C3F8: CD C01C call debug_putbyte 703 C3FB: 0E 06 mvi c,6 704 C3FD: 7E sml: mov a,M 705 C3FE: CD C01C call debug_putbyte 706 C401: 23 inx h 707 C402: 0D dcr c 708 C403: C2 C3FD jnz sml 709 C406: E1 pop h 710 C407: C1 pop b 711 C408: F1 pop psw 712 C409: C9 ret 713 C40A: 714 C40A: ; display ISUAL 10-byte time as hh:mm:ss.xxx 715 C40A: DEBUG_SHOWUT: 716 C40A: ; HL - points to 10 bytes of UT 717 C40A: F5 push psw 718 C40B: C5 push b 719 C40C: E5 push h 720 C40D: CD C303 call send_packet_prefix 721 C410: 3E 0B mvi a,SHOW_UT 722 C412: CD C01C call debug_putbyte 723 C415: 0E 0A mvi c,10 724 C417: 7E sul: mov a,M 725 C418: CD C01C call debug_putbyte 726 C41B: 23 inx h 727 C41C: 0D dcr c 728 C41D: C2 C417 jnz sul 729 C420: E1 pop h 730 C421: C1 pop b 731 C422: F1 pop psw 732 C423: C9 ret 733 C424: ; Page 23 734 C424: 735 C424: ; Called from places the program shouldn't get to 736 C424: DEBUG_ASSERT: 737 C424: 21 C438 lxi h,ass 738 C427: CD C310 call debug_show 739 C42A: E1 pop h ; get return address 740 C42B: CD C359 call hexout 741 C42E: 21 C440 lxi h,asse 742 C431: CD C310 call debug_show 743 C434: D3 03 out WATCHDOG_PET_O ; let messages show 744 C436: ; Commit cyber-cuicide 745 C436: D3 00 oogh: out software_reset_o ; ****jmp oogh ; provoke Watchdog 746 C438: 41 53 53 45 ass: asc "ASSERT=" 52 54 3D 747 C43F: 00 db 0 748 C440: 0A 00 asse: db 10,0 749 C442: 750 C442: END_DPU ds 1 751 C443: 21 C442 lxi h,end_dpu 752 C446: