URL
https://opencores.org/ocsvn/System09/System09/trunk
Subversion Repositories System09
[/] [System09/] [tags/] [pre_mkfiles_rev1_merge/] [src/] [sys09bug/] [sys09swt.lst] - Rev 146
Go to most recent revision | Compare with Previous | Blame | View Log
Assembler release DWC_2.0 version 2.11
May 6, 2004 (c) Motorola (free ware)
0001 NAM SYS09BUG FOR SWTPc
0000 INCLUDE "opt_swt.txt"
0001 *
0002 ***************************************************
0003 * OPTION SWITCHES
0004 ***************************************************
0005 *
0006 *
0007 ** THE CONTROL PORT CAN ONLY BE ONE OF THESE
0008 ** NOTE THAT THE ACIA WILL ALWAYS BE PRESET
0009 ** FOR LOADING AND SAVING S1 RECORDS
0010 *
0011 *S3EOPT EQU $FF SPARTAN3E STARTER
0012 *S3SOPT EQU $FF SPARTAN3 STARTER FPGA VIDEO & PS2 KEYBOARD
0013 *B5XOPT EQU $FF B5-X300 FPGA VIDEO & PS2 KEYBOARD
0014 *XESOPT EQU $FF XESS XSA-3S100 & XST-3.0
0015 *ADSOPT EQU $FF ADS6809 & DG640 VIDEO DISPAY
0016 00FF SWTOPT EQU $FF SWTP ACIA SERIAL CONTROL PORT
0017 *
0002 END
0000 INCLUDE "sys09equ.txt"
0001 *
0002 ***************************************************
0003 * MEMORY MAP EQUATES *
0004 ***************************************************
0005 E000 MONIO EQU $E000 I/O SPACE
0006 IFD S3EOPT
0007 MONRAM EQU $7FC0
0008 ELSE
0009 DFC0 MONRAM EQU $DFC0 STACK SPACE
0010 ENDIF S3EOPT
0011 F800 MONROM EQU $F800 START OF ROM
0012 IFD S3SOPT
0013 MONEXT EQU $F000 START OF EXTENDED COMMANDS
0014 EXTCMD EQU $00 EXTENDED OFFSET
0015 ENDIF S3SOPT
0015 ENDIF S3SOPT
0016 IFD XESOPT
0017 MONEXT EQU $F000 START OF EXTENDED COMMANDS
0018 EXTCMD EQU $00 EXTENDED OFFSET
0019 ENDIF XESOPT
0019 ENDIF XESOPT
0020 ***************************************************
0021
0022 IFD S3EOPT
0023 *
0024 * DIGILENT SPARTAN 3E STARTER
0025 *
0026 ACIAOPT EQU $FF ACIA AT PORT 0
0027 PS2OPT EQU $FF PS2 KEYBOARD AT $E020
0028 VDUOPT EQU $FF VDU AT $E030
0029 TRAOPT EQU $FF PIA TRACE TIMER
0030 ENDIF S3EOPT
0030 ENDIF S3EOPT
0031 *
0032 IFD S3SOPT
0033 *
0034 * DIGILENT SPARTAN 3 STARTER
0035 *
0036 ACIAOPT EQU $FF ACIA AT PORT 0
0037 PS2OPT EQU $FF PS2 KEYBOARD AT $E020
0038 VDUOPT EQU $FF VDU AT $E030
0039 CF8OPT EQU $FF COMPACT FLASH AT $E040
0040 DATOPT EQU $FF DYNAMIC ADDRESS TRANSLATION
0041 EXTOPT EQU $FF EXTENDED COMMANDS
0042 ENDIF S3SOPT
0042 ENDIF S3SOPT
0043 *
0044 IFD B5XOPT
0045 *
0046 * BURCHED B5-X300
0047 *
0048 ACIAOPT EQU $FF ACIA AT PORT 0
0049 PS2OPT EQU $FF PS2 KEYBOARD AT $E020
0050 VDUOPT EQU $FF VDU AT $E030
0051 CF8OPT EQU $FF COMPACT FLASH AT $E040
0052 DATOPT EQU $FF DYNAMIC ADDRESS TRANSLATION
0053 ENDIF B5XOPT
0053 ENDIF B5XOPT
0054 *
0055 IFD XESOPT
0056 *
0057 * XESS XSA-3S1000 & XST-3.0
0058 *
0059 ACIAOPT EQU $FF ACIA AT PORT 0
0060 PS2OPT EQU $FF PS2 KEYBOARD AT $E020
0061 VDUOPT EQU $FF VDU AT $E030
0062 IDEOPT EQU $FF XESS IDE AT $E100
0063 DATOPT EQU $FF DYNAMIC ADDRESS TRANSLATION
0064 EXTOPT EQU $FF EXTENDED COMMANDS
0065 ENDIF XESOPT
0065 ENDIF XESOPT
0066 *
0067 IFD ADSOPT
0068 *
0069 * ACKERMAN DIGITAL ADS6809
0070 *
0071 DG640OPT EQU $FF DG640 VDU AT $E800
0072 *RTCOPT EQU $FF REAL TIME CLOCK
0073 PRTOPT EQU $FF PRINTER DRIVERS
0074 MFDCOPT EQU $FF MINIFLOPPY 5.25" DISK BOOT
0075 ENDIF ADSOPT
0075 ENDIF ADSOPT
0076 *
0077 IFD SWTOPT
0078 *
0079 * SOUTH WEST TECHNICAL PRODUCTS COMPUTER
0080 *
0081 00FF ACIAOPT EQU $FF ACIA AT PORT 0
0082 00FF DMAFOPT EQU $FF DMAF2 8" FLOPPY DISK BOOT
0083 00FF MFDCOPT EQU $FF MINIFLOPPY 5.25" DISK BOOT
0084 00FF DATOPT EQU $FF DYNAMIC ADDRESS TRANSLATION
0085 ENDIF
0086 *
0087 IFD ACIAOPT
0088 *
0089 ***************************************************
0090 * SERIAL PORT *
0091 ***************************************************
0092 *
0093 ** ACIA SITS ON PORT 0
0094 *
0095 E000 ACIAS EQU MONIO+$00 CONTROL PORT
0096 *
0097 ENDIF ACIAOPT
0098 IFD MFDCOPT
0099 *
0100 ***************************************************
0101 * MINIFLOPPY DRIVE *
0102 ***************************************************
0103 *
0104 ** FLOPPY DISK CONTROLLER SITS ON PORT 1
0105 *
0106 E014 DRVFDC EQU MONIO+$14
0107 E018 CMDFDC EQU MONIO+$18
0108 E01A SECFDC EQU MONIO+$1A
0109 E01B DATFDC EQU MONIO+$1B
0110 ENDIF MFDCOPT
0111 IFD PS2OPT
0112 *
0113 ***************************************************
0114 * VDU8 PS/2 KEYBOARD PORT *
0115 ***************************************************
0116 *
0117 ** KEYBOARD SITS ON PORT 2
0118 *
0119 PS2KBD EQU MONIO+$20 PS/2 KEYBOARD PORT
0120 ENDIF PS2OPT
0120 ENDIF PS2OPT
0121 IFD VDUOPT
0122 *
0123 ***************************************************
0124 * VDU8 DISPLAY DRIVER EQUATES *
0125 ***************************************************
0126 *
0127 ** VDU8 DISPLAY SITS ON PORT 3
0128 *
0129 VDU EQU MONIO+$30
0130 VDUCHR EQU 0 CHARACTER REGISTER
0131 VDUATT EQU 1 ATTRIBUTE REGISTER
0132 VDUCOL EQU 2 CURSOR COLUMN
0133 VDUROW EQU 3 CURSOR ROW
0134 VDUOFF EQU 4 ROW OFFSET
0135 *
0136 LINLEN EQU 80 LENGTH OF A LINE
0137 NUMLIN EQU 25 NUMBER OF LINES
0138 ENDIF VDUOPT
0138 ENDIF VDUOPT
0139 *
0140 IFD CF8OPT
0141 *
0142 ***************************************************
0143 * COMPACT FLASH EQUATES 8 BIT TRANSFER *
0144 ***************************************************
0145 *
0146 ** COMPACT FLASH SITS AT PORT 4
0147 *
0148 CF_BASE EQU MONIO+$40
0149 CF_DATA EQU CF_BASE+0
0150 CF_ERROR EQU CF_BASE+1 ; read error
0151 CF_FEATURE EQU CF_BASE+1 ; write feature
0152 CF_SECCNT EQU CF_BASE+2
0153 CF_SECNUM EQU CF_BASE+3
0154 CF_CYLLO EQU CF_BASE+4
0155 CF_CYLHI EQU CF_BASE+5
0156 CF_HEAD EQU CF_BASE+6
0157 CF_STATUS EQU CF_BASE+7 ; read status
0158 CF_COMAND EQU CF_BASE+7 ; write command
0159 *
0160 * Command Equates
0161 *
0162 CMDREAD EQU $20 ; Read Single sector
0163 CMDWRITE EQU $30 ; Write Single sector
0164 CMDFEATURE EQU $EF
0165 FEAT8BIT EQU $01 ; enable 8 bit transfers
0166 HEADLBA EQU $E0
0167 *
0168 * Status bit equates
0169 *
0170 BUSY EQU $80
0171 DRDY EQU $40
0172 DRQ EQU $08
0173 ERR EQU $01
0174 *
0175 ENDIF CF8OPT
0175 ENDIF CF8OPT
0176 *
0177 IFD IDEOPT
0178 *
0179 ***************************************************
0180 * COMPACT FLASH EQUATES 16 BIT TRANSFER (XESS) *
0181 ***************************************************
0182 *
0183 ** COMPACT FLASH SITS AT PORT 4
0184 *
0185 CF_BASE EQU MONIO+$0100
0186 CF_DATA EQU CF_BASE+0
0187 CF_ERROR EQU CF_BASE+2 ; read error
0188 CF_FEATURE EQU CF_BASE+2 ; write feature
0189 CF_SECCNT EQU CF_BASE+4
0190 CF_SECNUM EQU CF_BASE+6
0191 CF_CYLLO EQU CF_BASE+8
0192 CF_CYLHI EQU CF_BASE+10
0193 CF_HEAD EQU CF_BASE+12
0194 CF_STATUS EQU CF_BASE+14 ; read status
0195 CF_COMAND EQU CF_BASE+14 ; write command
0196 CF_AUX EQU CF_BASE+30
0197 *
0198 * Command Equates
0199 *
0200 CMDREAD EQU $20 ; Read Single sector
0201 CMDWRITE EQU $30 ; Write Single sector
0202 AUXRESET EQU $06 ; Reset IDE
0203 AUXRSTREL EQU $02 ; Reset release IRQ masked
0204 HEADLBA EQU $E0
0205 *
0206 * Status bit equates
0207 *
0208 BUSY EQU $80
0209 DRDY EQU $40
0210 DRQ EQU $08
0211 ERR EQU $01
0212 *
0213 ENDIF CF8OPT
0213 ENDIF CF8OPT
0214 *
0215 IFD RTCOPT
0216 *
0217 **************************************************
0218 * MM58167A REAL TIME CLOCK MEMORY MAP:
0219 **************************************************
0220 *
0221 ** REAL TIME CLOCK SITS ON PORT 4 AND PORT 5
0222 *
0223 CLOCK EQU MONIO+$40 CLOCK BASE ADDRESS AND REGISTERS
0224 *
0225 * COUNTER AND COMPARITOR REGISTERS:
0226 *
0227 * Both the Clock Counter and Clock Comparitor
0228 * consist of 8 registers for holding the time.
0229 * The register offsets from the Counter and
0230 * Comparitor registers are listed above.
0231 *
0232 COUNTR EQU CLOCK+0
0233 CMPRAM EQU CLOCK+8 COMPARITOR REGISTERS
0234 *
0235 * CLOCK REGISTER OFFSETS:
0236 * These register offsets are used for the CLOCK
0237 * and comparitor ram CMPRAM.
0238 *
0239 S10000 EQU 0 TEN THOUNSANDTHS OF SECONDS
0240 S100 EQU 1 HUNDRETHS AND TENTHS OF SECONDS
0241 SECOND EQU 2
0242 MINUIT EQU 3
0243 HOUR EQU 4
0244 WKDAY EQU 5
0245 MTHDAY EQU 6
0246 MONTH EQU 7
0247 *
0248 * INTERRUPT OUTPUT REGISTERS:
0249 *
0250 * An interrupt output may be generated at the
0251 * following rates by setting the appropriate bit
0252 * in the Interrupt Control Register (CINTCR).
0253 * The Interrupt Status Register (CINTSR) must be
0254 * read to clear the interrupt and will return
0255 * the source of the interrupt.
0256 *
0257 * 1/Month Bit 7
0258 * 1/Week Bit 6
0259 * 1/Day Bit 5
0260 * 1/Hour Bit 4
0261 * 1/Minuite Bit 3
0262 * 1/Second Bit 2
0263 * 10/Second Bit 1
0264 * Comparitor Bit 0
0265 *
0266 CINTSR EQU CLOCK+16 INTERRUPT STATUS REGISTER
0267 CINTCR EQU CLOCK+17 INTERRUPT CONTROL REGISTER
0268 *
0269 * COUNTER AND RAM RESETS; GO COMMAND.
0270 *
0271 * The counter and comparitor may be reset
0272 * by writing $FF into CTRRES and CMPRES
0273 * respectivly.
0274 * A write to the Go command register (GOCMND)
0275 * will reset the 1/1000ths, 1/100ths and 1/10ths
0276 * of a second counter.
0277 *
0278 CTRRES EQU CLOCK+18 COUNTER RESET
0279 CMPRES EQU CLOCK+19 COMPARITOR RAM RESET
0280 GOCMND EQU CLOCK+21 GO COMMAND
0281 *
0282 * CLOCK STATUS REGISTER.
0283 *
0284 * The counter takes 61 usec. to rollover for
0285 * every 1KHz clock pulse. If the Status bit is
0286 * set after reading the counter, the counter
0287 * should be re-read to ensure the time is correct.
0288 *
0289 CLKSTA EQU CLOCK+20 STATUS BIT
0290 SBYINT EQU CLOCK+22 STANDBY INTERRUPT
0291 TSTMOD EQU CLOCK+31 TEST MODE REGISTER
0292 ENDIF RTCOPT
0292 ENDIF RTCOPT
0293 *
0294 IFD TRAOPT
0295 *
0296 **************************************************
0297 * PIA INTERRUPT TIMER
0298 **************************************************
0299 *
0300 ** PIA INTERRUPT TIMER SITS ON PORT 7
0301 *
0302 ** PIA TIMER FOR SINGLE STEP / TRACE
0303 *
0304 * TADATA = Output = Timer preset register
0305 * TACTRL - CA1 = input = rising edge = NMI
0306 * - CA2 = Output = Timer Reset (Active High)
0307 * TBDATA = Input = Timer read back register
0308 * TBCTRL - CB1 = input = rising edge = FIRQ
0309 * - CB2 = output = strobe low on write to TBDATA = Timer Preset
0310 *
0311 * CRA0 = 0 CA1 IRQ DISAB, CRA0 = 1 CA1 IRQ ENAB
0312 * CRA1 = 1 CA1 Rising edge IRQ
0313 * CRA2 = 0 TADATA = Data Direction, CRA2 = 1 TADATA = I/O Register
0314 * CRA3 = 0 CA2 = 0 output, CRA3 = 1 CA2 = 1
0315 * CRA4 = 1 ] CA2 = Set/Reset output
0316 * CRA5 = 1 ]
0317 * CRA6 = X CA2 Input Interrupt Flag
0318 * CRA7 = X CA1 Interrupt Flag
0319 *
0320 * CRB0 = 0 CB1 IRQ DISAB, CRB0 = 1 CA1 IRQ ENAB
0321 * CRB1 = 1 CB1 Rising edge IRQ
0322 * CRB2 = 0 TBDATA = Data Direction, CRB2 = 1 TBDATA = I/O Register
0323 * CRB3 = 0 CB2 = 0 output, CRB3 = 1 CB2 = 1
0324 * CRB4 = 1 ] CB2 = Set/Reset output
0325 * CRB5 = 1 ]
0326 * CRB6 = X CB2 Input Interrupt Flag
0327 * CRB7 = X CB1 Interrupt Flag
0328 *
0329 * DDRA = 0 TADATA = Input, DDRA = 1 TADATA = Output
0330 * DDRB = 0 TBDATA = Input, DDRB = 1 TBDATA = Output
0331 *
0332 TADATA EQU MONIO+$70 Timer preset port
0333 TACTRL EQU MONIO+$71
0334 TBDATA EQU MONIO+$72 Timer read back port
0335 TBCTRL EQU MONIO+$73
0336 *
0337 TRADEL EQU 13 Number of E cycles for RTI (May need to be fudged)
0338 *
0339 ENDIF TRAOPT
0339 ENDIF TRAOPT
0340 IFD ADSOPT
0341 *
0342 ***************************************************
0343 * SERIAL PORT FOR DG640 *
0344 ***************************************************
0345 *
0346 ** SET UP FOR ACKERMAN DIGITAL ADS6809
0347 ** THE ADS6809 S100 BOAD HAS AN ON BOARD ACIA
0348 *
0349 ACIAS EQU MONIO+$400 CONTROL PORT
0350 *
0351 ENDIF ADSOPT
0351 ENDIF ADSOPT
0352 IFD PRTOPT
0353 *
0354 ***************************************************
0355 * PRINTER INTERFACE *
0356 ***************************************************
0357 *
0358 PADATA EQU MONIO+$404
0359 PACTRL EQU MONIO+$405
0360 PBDATA EQU MONIO+$406
0361 PBCTRL EQU MONIO+$407
0362 *
0363 ** CB1 ACK. I/P
0364 ** CB2 STB. O/P
0365 ** PB0 - PB7 DATA 1 - 8 O/P
0366 ** PORT A BIT ASSIGNMENT
0367 *
0368 PBUSY EQU $80 I/P
0369 PEMPTY EQU $40 I/P
0370 SELECT EQU $20 I/P
0371 PERROR EQU $10 I/P
0372 PRESET EQU %00000100 O/P PA3 = 0
0373 AUTOFD EQU %00001000 O/P PA2 = 0
0374 DIRMSK EQU %00001100
0375 ENDIF PRTOPT
0375 ENDIF PRTOPT
0376 IFD DG640OPT
0377 *
0378 ***************************************************
0379 * DG640 MEMORY MAPPED DISPLAY DRIVER VARIABLES *
0380 ***************************************************
0381 *
0382 ** VIDEO DISPLAY DEFINITIONS
0383 *
0384 SCREEN EQU MONIO+$0800 START OF SCREEN MEMORY
0385 LINLEN EQU 64 LENGTH OF A LINE
0386 NUMLIN EQU 16 NUMBER OF LINES
0387 SCNLEN EQU $400 LENGTH OF SCREEN
0388 ENDIF DG640OPT
0388 ENDIF DG640OPT
0389 *
0390 IFD DMAFOPT
0391 *
0392 ***************************************************
0393 * DMAF2 8" DRIVE *
0394 ***************************************************
0395 *
0396 F000 ADDREG EQU $F000 ADDRESS REGISTER
0397 F002 CNTREG EQU $F002 COUNT REGISTER
0398 F010 CCREG EQU $F010 CHANNEL CONTROL REGISTER
0399 F014 PRIREG EQU $F014 DMA PRIORITY REGISTER
0400 F015 AAAREG EQU $F015 ???
0401 F016 BBBREG EQU $F016 ???
0402 F020 COMREG EQU $F020 1791 COMMAND REGISTER
0403 F022 SECREG EQU $F022 SECTOR REGISTER
0404 F024 DRVREG EQU $F024 DRIVE SELECT LATCH
0405 F040 CCCREG EQU $F040 ???
0406 ENDIF DMAFOPT
0407 IFD DATOPT
0408 **************************************************
0409 * DYNAMIC ADDRESS TRANSLATION REGISTERS *
0410 **************************************************
0411 *
0412 FFF0 IC11 EQU $FFF0 DAT RAM CHIP
0413 55AA TSTPAT EQU $55AA TEST PATTERN
0414 ENDIF DATOPT
0415 *
0003 END
0000 INCLUDE "sys09bug.txt"
0001 * NAM SYS09BUG12 SYSTEM09 MONITOR
0002 OPT l
sys09bug.txt page 2
0004 *
0005 * MONITOR PROGRAM FOR THE SOUTHWEST TECHNICAL
0006 * PRODUCTS MP-09 CPU BOARD AS COMMENTED BY....
0007 *
0008 * ALLEN CLARK WALLACE WATSON
0009 * 2502 REGAL OAKS LANE 4815 EAST 97th AVE.
0010 * LUTZ, FLA. 33549 TEMPLE TERRACE, FLA. 33617
0011 * PH. 813-977-0347 PH. 813-985-1359
0012 *
0013 * MODIFIED TO SBUG09 VER 1.8 BY: RANDY JARRETT
0014 * 2561 NANTUCKET DR APT. E
0015 * ATLANTA, GA 30345
0016 * PH. 404-320-1043
0017 *
0018 * MODIFIED TO SYS09BUG VER 1.0
0019 * FOR: SYSTEM09 FPGA SYSTEM
0020 * BY: JOHN KENT
0021 * DATE: 21ST NOVEMBER 2006
0022 * REMOVED: DISK BOOTS
0023 * MEMORY TEST
0024 * ADDED: ADM3A VDU DRIVER
0025 *
0026 * MODIFIED TO SYS09BUG VER 1.1
0027 * FOR: SYSTEM09 FPGA SYSTEM
0028 * BY: JOHN KENT
0029 * DATE: 7TH JANUARY 2007
0030 * ADDED: 'U' USER EXTENTION COMMANDS AT $F000
0031 * CONDITIONAL ASSEMBLY OF FLOPPY BOOTS
0032 * AND REALTIME CLOCK
0033 *
0034 * MODIFIED TO SYS09BUG VER 1.2
0035 * FOR: SYSTEM09 FPGA SYSTEM
0036 * BY: JOHN KENT
0037 * DATE: 21ST MAY 2007
0038 * ADDED: COMPACT FLASH BOOT TO FPGA VERSION
0039 * REMOVED PORT REDIRECTION ON PUNCH & LOAD
0040 *
0041 * Modified to SYS09BUG VER 1.3
0042 * FOR: SYSTEM09 FPGA SYSTEM
0043 * BY: JOHN KENT
0044 * DATE: 8TH JAN 2008
0045 * ADDED: CONDITIONALS FOR SPARTAN3E STARTER BOARD
0046 * WITH ONLY 32K OF RAM
0047 *
0048 * Modified to SYS09BUG VER 1.4
0049 * FOR: SYSTEM09 FPGA SYSTEM
0050 * BY: JOHN KENT
0051 * DATE: 3RD FEB 2008
0052 * ADDED: CONDITIONALS FOR XESS BOARD WITH IDE
0053 * SEPERATE CONDITIONAL FOR S3 STARTER AND B5-X300
0054 * 16 BIT IDE DISK BOOT STRAP ROUTINE
0055 * CHANGED: SEPARARTED OPTIONS EQUATES AND BODY INTO SEPARATE FILES
0056 *
0057 * *** COMMANDS ***
0058 *
0059 * CONTROL A = ALTER THE "A" ACCUMULATOR
0060 * CONTROL B = ALTER THE "B" ACCUMULATOR
0061 * CONTROL C = ALTER THE CONDITION CODE REGISTER
0062 * CONTROL D = ALTER THE DIRECT PAGE REGISTER
0063 * CONTROL P = ALTER THE PROGRAM COUNTER
0064 * CONTROL U = ALTER USER STACK POINTER
0065 * CONTROL X = ALTER "X" INDEX REGISTER
0066 * CONTROL Y = ALTER "Y" INDEX REGISTER
0067 * B hhhh = SET BREAKPOINT AT LOCATION $hhhh
0068 * D = 5.25" MINIFLOPPY BOOT
0069 * E ssss-eeee = EXAMINE MEMORY
0070 * FROM STARTING ADDRESS ssss
0071 * TO ENDING ADDRESS eeee.
0072 * G = CONTINUE EXECUTION FROM BREAKPOINT OR SWI
0073 * L = LOAD TAPE
0074 * M hhhh = EXAMINE AND CHANGE MEMORY LOCATION hhhh
0075 * P ssss-eeee = PUNCH TAPE, START ssss TO END eeee ADDR.
0076 * R = DISPLAY REGISTER CONTENTS
0077 * S = DISPLAY STACK FROM ssss TO $DFC0
0078 * U = 8" DMAF2 FLOPPY BOOT
0079 * U = USER EXTENSION COMMANDS AT $F000
0080 * X = REMOVE ALL BREAKPOINTS
0081 *
0082 *
0083 ***************************************************
0084 * SYS09BUG VARIABLE SPACE
0085 ***************************************************
0086 *
0087 DFC0 ORG MONRAM
0088 DFC0 STACK EQU * TOP OF INTERNAL STACK
0089 DFC0 NMI RMB 2 USER NMI VECTOR
0090 DFC2 SWI3 RMB 2 SOFTWARE INTERRUPT VECTOR #3
0091 DFC4 SWI2 RMB 2 SOFTWARE INTERRUPT VECTOR #2
0092 DFC6 FIRQ RMB 2 FAST INTERRUPT VECTOR
0093 DFC8 IRQ RMB 2 INTERRUPT VECTOR
0094 DFCA SWI RMB 2 SOFTWARE INTERRUPT VECTOR
0095 DFCC SVCVO RMB 2 SUPERVISOR CALL VECTOR ORGIN
0096 DFCE SVCVL RMB 2 SUPERVISOR CALL VECTOR LIMIT
0097 IFD DATOPT
0098 DFD0 LRARAM RMB 16 LRA ADDRESSES
0099 ENDIF DATOPT
0100 DFE0 CPORT RMB 2 RE-VECTORABLE CONTROL PORT
0101 DFE2 ECHO RMB 1 ECHO FLAG
0102 DFE3 BPTBL RMB 24 BREAKPOINT TABLE BASE ADDR
0103 IFD TRAOPT
0104 NMISAV RMB 2 NMI Jump Vector Backup
0105 TRACNT RMB 2 Trace Count
0106 ENDIF TRAOPT
0106 ENDIF TRAOPT
0107 IFD VDUOPT
0108 *
0109 **************************************************
0110 * VDU8 DISPLAY DRIVER VARIABLES *
0111 **************************************************
0112 *
0113 **** ALWAYS KEEP COLADX AND ROWADX TOGETHER ******
0114 COLADX RMB 1 CURSOR COLUMN
0115 ROWADX RMB 1 CURSOR ROW
0116 **************************************************
0117 *
0118 NEWROW RMB 1 NEW ROW TEMP FOR ESCAPE
0119 ESCFLG RMB 1 ESCAPE SEQUENCE ACTIVE
0120 ENDIF VDUOPT
0120 ENDIF VDUOPT
0121 IFD DG640OPT
0122 *
0123 ***************************************************
0124 * DG640 MEMORY MAPPED DISPLAY DRIVER VARIABLES *
0125 ***************************************************
0126 *
0127 ***** ALWAYS KEEP THESE TWO BYTES TOGETHER *****
0128 COLADX RMB 1 CURSOR COLUMN
0129 ROWADX RMB 1 CURSOR ROW
0130 *************************************************
0131 CURSOR RMB 2 ABSOLUTE SCREEN ADDRESS
0132 NEWROW RMB 1 NEW ROW TEMP FOR ESCAPE
0133 ESCFLG RMB 1 ESCAPE SEQUENCE ACTIVE
0134 ENDIF DG640OPT
0134 ENDIF DG640OPT
0135 *
0136 *
0137 ***************************************************
0138 * START OF ROM *
0139 ***************************************************
0140 *
0141 F800 ORG MONROM
0142 F800 F8 14 FDB MONITOR
0143 F802 F8 61 FDB NEXTCMD
0144 F804 FD 25 FDB INCH
0145 F806 FD 1F FDB INCHE
0146 F808 FD 34 FDB INCHEK
0147 F80A FD 42 FDB OUTCH
0148 F80C FC 17 FDB PDATA
0149 F80E FB A6 FDB PCRLF
0150 F810 FB A2 FDB PSTRNG
0151 F812 FA B6 FDB LRA
0152 *
0153 IFD ADSOPT
0154 FDB PCHK CHECK FOR PRINTER INPUT
0155 FDB PINIZ INITIATE PRINTER
0156 FDB POUTCH OUTPUT CH. TO PRINTER
0157 FDB VINIZ
0158 FDB VOUTCH
0159 FDB ACINIZ
0160 FDB AOUTCH
0161 ENDIF ADSOPT
0161 ENDIF ADSOPT
0162 *
0163 * MONITOR
0164 *
0165 * VECTOR ADDRESS STRING IS.....
0166 * $F8A1-$F8A1-$F8A1-$F8A1-$F8A1-$FAB0-$FFFF-$FFFF
0167 *
0168 F814 8E FD 9F MONITOR LDX #RAMVEC POINT TO VECTOR ADDR. STRING
0169 F817 10 8E DF C0 LDY #STACK POINT TO RAM VECTOR LOCATION
0170 F81B C6 10 LDB #$10 BYTES TO MOVE = 16
0171 F81D A6 80 LOOPA LDA ,X+ GET VECTOR BYTE
0172 F81F A7 A0 STA ,Y+ PUT VECTORS IN RAM / $DFC0-$DFCF
0173 F821 5A DECB SUBTRACT 1 FROM NUMBER OF BYTES TO MOVE
0174 F822 26 F9 BNE LOOPA CONTINUE UNTIL ALL VECTORS MOVED
0175 *
0176 * CONTENTS FROM TO FUNCTION
0177 * $F8A1 $FE40 $DFC0 USER-V
0178 * $F8A1 $FE42 $DFC2 SWI3-V
0179 * $F8A1 $FE44 $DFC4 SWI2-V
0180 * $F8A1 $FE46 $DFC6 FIRQ-V
0181 * $F8A1 $FE48 $DFC8 IRQ-V
0182 * $FAB0 $FE4A $DFCA SWI-V
0183 * $FFFF $FE4C $DFCC SVC-VO
0184 * $FFFF $FE4E $DFCE SVC-VL
0185 *
0186 F824 8E E0 00 LDX #ACIAS
0187 F827 BF DF E0 STX CPORT STORE ADDR. IN RAM
0188 F82A 17 01 5B LBSR XBKPNT CLEAR OUTSTANDING BREAKPOINTS
0189 F82D C6 0C LDB #12 CLEAR 12 BYTES ON STACK
0190 F82F 6F E2 CLRSTK CLR ,-S
0191 F831 5A DECB
0192 F832 26 FB BNE CLRSTK
0193 F834 30 8C DD LEAX MONITOR,PCR SET PC TO SBUG-E ENTRY
0194 F837 AF 6A STX 10,S ON STACK
0195 F839 86 D0 LDA #$D0 PRESET CONDITION CODES ON STACK
0196 F83B A7 E4 STA ,S
0197 F83D 1F 43 TFR S,U
0198 F83F 17 05 11 LBSR IOINIZ INITIALIZE CONTROL PORT
0199 F842 8E FD AF LDX #MSG1 POINT TO MONITOR MESSAGE
0200 F845 17 03 CF LBSR PDATA PRINT MSG
0201 *
0202 IFD DATOPT
0203 F848 8E DF D0 LDX #LRARAM POINT TO LRA RAM STORAGE AREA
0204 F84B 4F CLRA START TOTAL AT ZERO
0205 F84C C6 0D LDB #13 TOTAL UP ALL ACTIVE RAM MEMORY
0206 F84E 6D 85 FNDREL TST B,X TEST FOR RAM AT NEXT LOC.
0207 F850 27 03 BEQ RELPAS IF NO RAM GO TO NEXT LOC.
0208 F852 8B 04 ADDA #4 ELSE ADD 4K TO TOTAL
0209 F854 19 DAA ADJ. TOTAL FOR DECIMAL
0210 F855 5A RELPAS DECB SUB. 1 FROM LOCS. TO TEST
0211 F856 2A F6 BPL FNDREL PRINT TOTAL OF RAM
0212 F858 17 04 94 LBSR OUT2H OUTPUT HEX BYTE AS ASCII
0213 F85B 8E FD CF LDX #MSG2 POINT TO MSG 'K' CR/LF + 3 NULS
0214 F85E 17 03 B6 LBSR PDATA PRINT MSG
0215 ENDIF DATOPT
0216 *
0217 IFD TRAOPT
0218 LBSR TRAINZ
0219 ENDIF TRAOPT
0219 ENDIF TRAOPT
0220 *
0221 ***** NEXTCMD *****
0222 *
0223 F861 8E FD D6 NEXTCMD LDX #MSG3 POINT TO MSG ">"
0224 F864 17 03 3B LBSR PSTRNG PRINT MSG
0225 F867 17 04 BB LBSR INCH GET ONE CHAR. FROM TERMINAL
0226 F86A 84 7F ANDA #$7F STRIP PARITY FROM CHAR.
0227 F86C 81 0D CMPA #$0D IS IT CARRIAGE RETURN ?
0228 F86E 27 F1 BEQ NEXTCMD IF CR THEN GET ANOTHER CHAR.
0229 F870 1F 89 TFR A,B PUT CHAR. IN "B" ACCUM.
0230 F872 81 20 CMPA #$20 IS IT CONTROL OR DATA CHAR ?
0231 F874 2C 09 BGE PRTCMD IF CMD CHAR IS DATA, PRNT IT
0232 F876 86 5E LDA #'^ ELSE CNTRL CHAR CMD SO...
0233 F878 17 04 C7 LBSR OUTCH PRINT "^"
0234 F87B 1F 98 TFR B,A RECALL CNTRL CMD CHAR
0235 F87D 8B 40 ADDA #$40 CONVERT IT TO ASCII LETTER
0236 F87F 17 04 C0 PRTCMD LBSR OUTCH PRNT CMD CHAR
0237 F882 17 04 BB LBSR OUT1S PRNT SPACE
0238 F885 C1 60 CMPB #$60
0239 F887 2F 02 BLE NXTCH0
0240 F889 C0 20 SUBB #$20
0241 *
0242 ***** DO TABLE LOOKUP *****
0243 * FOR COMMAND FUNCTIONS
0244 *
0245 F88B 8E FD 66 NXTCH0 LDX #JMPTAB POINT TO JUMP TABLE
0246 F88E E1 80 NXTCHR CMPB ,X+ DOES COMMAND MATCH TABLE ENTRY ?
0247 F890 27 0F BEQ JMPCMD BRANCH IF MATCH FOUND
0248 F892 30 02 LEAX 2,X POINT TO NEXT ENTRY IN TABLE
0249 F894 8C FD 9F CMPX #TABEND REACHED END OF TABLE YET ?
0250 F897 26 F5 BNE NXTCHR IF NOT END, CHECK NEXT ENTRY
0251 F899 8E FD D8 LDX #MSG4 POINT TO MSG "WHAT?"
0252 F89C 17 03 78 LBSR PDATA PRINT MSG
0253 F89F 20 C0 BRA NEXTCMD IF NO MATCH, PRMPT FOR NEW CMD
0254 F8A1 AD 94 JMPCMD JSR [,X] JUMP TO COMMAND ROUTINE
0255 F8A3 20 BC BRA NEXTCMD PROMPT FOR NEW COMMAND
0256 *
0257 * "G" GO OR CONTINUE
0258 *
0259 F8A5 1F 34 GO TFR U,S
0260 F8A7 3B RTI RTI
0261 *
0262 ***** "M" MEMORY EXAMINE AND CHANGE *****
0263 *
0264 F8A8 17 03 F3 MEMCHG LBSR IN1ADR INPUT ADDRESS
0265 F8AB 29 2D BVS CHRTN IF NOT HEX, RETURN
0266 F8AD 1F 12 TFR X,Y SAVE ADDR IN "Y"
0267 F8AF 8E FD DE MEMC2 LDX #MSG5 POINT TO MSG " - "
0268 F8B2 17 02 ED LBSR PSTRNG PRINT MSG
0269 F8B5 1F 21 TFR Y,X FETCH ADDRESS
0270 F8B7 17 04 2D LBSR OUT4H PRINT ADDR IN HEX
0271 F8BA 17 04 83 LBSR OUT1S OUTPUT SPACE
0272 F8BD A6 A4 LDA ,Y GET CONTENTS OF CURRENT ADDR.
0273 F8BF 17 04 2D LBSR OUT2H OUTPUT CONTENTS IN ASCII
0274 F8C2 17 04 7B LBSR OUT1S OUTPUT SPACE
0275 F8C5 17 03 E6 LBSR BYTE LOOP WAITING FOR OPERATOR INPUT
0276 F8C8 28 11 BVC CHANGE IF VALID HEX GO CHANGE MEM. LOC.
0277 F8CA 81 08 CMPA #8 IS IT A BACKSPACE (CNTRL H)?
0278 F8CC 27 E1 BEQ MEMC2 PROMPT OPERATOR AGAIN
0279 F8CE 81 18 CMPA #$18 IS IT A CANCEL (CNTRL X)?
0280 F8D0 27 DD BEQ MEMC2 PROMPT OPERATOR AGAIN
0281 F8D2 81 5E CMPA #'^ IS IT AN UP ARROW?
0282 F8D4 27 17 BEQ BACK DISPLAY PREVIOUS BYTE
0283 F8D6 81 0D CMPA #$D IS IT A CR?
0284 F8D8 26 0F BNE FORWRD DISPLAY NEXT BYTE
0285 F8DA 39 CHRTN RTS EXIT ROUTINE
0286 *
0287 *
0288 F8DB A7 A4 CHANGE STA ,Y CHANGE BYTE IN MEMORY
0289 F8DD A1 A4 CMPA ,Y DID MEMORY BYTE CHANGE?
0290 F8DF 27 08 BEQ FORWRD $F972
0291 F8E1 17 04 5C LBSR OUT1S OUTPUT SPACE
0292 F8E4 86 3F LDA #'? LOAD QUESTION MARK
0293 F8E6 17 04 59 LBSR OUTCH PRINT IT
0294 F8E9 31 21 FORWRD LEAY 1,Y POINT TO NEXT HIGHER MEM LOCATION
0295 F8EB 20 C2 BRA MEMC2 PRINT LOCATION & CONTENTS
0296 F8ED 31 3F BACK LEAY -1,Y POINT TO LAST MEM LOCATION
0297 F8EF 20 BE BRA MEMC2 PRINT LOCATION & CONTENTS
0298 *
0299 * "S" DISPLAY STACK
0300 * HEX-ASCII DISPLAY OF CURRENT STACK CONTENTS FROM
0301 ** CURRENT STACK POINTER TO INTERNAL STACK LIMIT.
0302 *
0303 F8F1 17 03 2A DISSTK LBSR PRTSP PRINT CURRENT STACK POINTER
0304 F8F4 1F 32 TFR U,Y
0305 F8F6 8E DF C0 LDX #STACK LOAD INTERNAL STACK AS UPPER LIMIT
0306 F8F9 30 1F LEAX -1,X POINT TO CURRENT STACK
0307 F8FB 20 05 BRA MDUMP1 ENTER MEMORY DUMP OF STACK CONTENTS
0308 *
0309 * "E" DUMP MEMORY FOR EXAMINE IN HEX AND ASCII
0310 * AFTER CALLING 'IN2ADR' LOWER ADDRESS IN Y-REG.
0311 * UPPER ADDRESS IN X-REG.
0312 * IF HEX ADDRESSES ARE INVALID (V)=1.
0313 *
0314 F8FD 17 03 93 MEMDUMP LBSR IN2ADR INPUT ADDRESS BOUNDRIES
0315 F900 29 06 BVS EDPRTN NEW COMMAND IF ILLEGAL HEX
0316 F902 34 20 MDUMP1 PSHS Y COMPARE LOWER TO UPPER BOUNDS
0317 F904 AC E1 CMPX ,S++ LOWER BOUNDS > UPPER BOUNDS?
0318 F906 24 01 BCC AJDUMP IF NOT, DUMP HEX AND ASCII
0319 F908 39 EDPRTN RTS ;
0320 *
0321 * ADJUST LOWER AND UPPER ADDRESS LIMITS
0322 * TO EVEN 16 BYTE BOUNDRIES.
0323 *
0324 * IF LOWER ADDR = $4532
0325 * LOWER BOUNDS WILL BE ADJUSTED TO = $4530.
0326 *
0327 * IF UPPER ADDR = $4567
0328 * UPPER BOUNDS WILL BE ADJUSTED TO = $4570.
0329 *
0330 * ENTER WITH LOWER ADDRESS IN X-REG.
0331 * -UPPER ADDRESS ON TOP OF STACK.
0332 *
0333 F909 1F 10 AJDUMP TFR X,D GET UPPER ADDR IN D-REG
0334 F90B C3 00 10 ADDD #$10 ADD 16 TO UPPER ADDRESS
0335 F90E C4 F0 ANDB #$F0 MASK TO EVEN 16 BYTE BOUNDRY
0336 F910 34 06 PSHS A,B SAVE ON STACK AS UPPER DUMP LIMIT
0337 F912 1F 20 TFR Y,D $F9A5 GET LOWER ADDRESS IN D-REG
0338 F914 C4 F0 ANDB #$F0 MASK TO EVEN 16 BYTE BOUNDRY
0339 F916 1F 01 TFR D,X PUT IN X-REG AS LOWER DUMP LIMIT
0340 F918 AC E4 NXTLIN CMPX ,S COMPARE LOWER TO UPPER LIMIT
0341 F91A 27 05 BEQ SKPDMP IF EQUAL SKIP HEX-ASCII DUMP
0342 F91C 17 04 15 LBSR INCHEK CHECK FOR INPUT FROM KEYBOARD
0343 F91F 27 03 BEQ EDUMP
0344 F921 32 62 SKPDMP LEAS 2,S READJUST STACK IF NOT DUMPING
0345 F923 39 RTS ;
0346 *
0347 * PRINT 16 HEX BYTES FOLLOWED BY 16 ASCII CHARACTERS
0348 * FOR EACH LINE THROUGHOUT ADDRESS LIMITS.
0349 *
0350 F924 34 10 EDUMP PSHS X PUSH LOWER ADDR LIMIT ON STACK
0351 F926 8E FD DE LDX #MSG5 POINT TO MSG " - "
0352 F929 17 02 76 LBSR PSTRNG PRINT MSG
0353 F92C AE E4 LDX ,S LOAD LOWER ADDR FROM TOP OF STACK
0354 F92E 17 03 B6 LBSR OUT4H PRINT THE ADDRESS
0355 F931 17 04 0A LBSR OUT2S 2 SPACES
0356 F934 C6 10 LDB #$10 LOAD COUNT OF 16 BYTES TO DUMP
0357 F936 A6 80 ELOOP LDA ,X+ GET FROM MEMORY HEX BYTE TO PRINT
0358 F938 17 03 B4 LBSR OUT2H OUTPUT HEX BYTE AS ASCII
0359 F93B 17 04 02 LBSR OUT1S OUTPUT SPACE
0360 F93E 5A DECB $F9D1 DECREMENT BYTE COUNT
0361 F93F 26 F5 BNE ELOOP CONTINUE TIL 16 HEX BYTES PRINTED
0362 *
0363 * PRINT 16 ASCII CHARACTERS
0364 * IF NOT PRINTABLE OR NOT VALID
0365 * ASCII PRINT A PERIOD (.)
0366 F941 17 03 FA LBSR OUT2S 2 SPACES
0367 F944 AE E1 LDX ,S++ GET LOW LIMIT FRM STACK - ADJ STACK
0368 F946 C6 10 LDB #$10 SET ASCII CHAR TO PRINT = 16
0369 F948 A6 80 EDPASC LDA ,X+ GET CHARACTER FROM MEMORY
0370 F94A 81 20 CMPA #$20 IF LESS THAN $20, NON-PRINTABLE?
0371 F94C 25 04 BCS PERIOD IF SO, PRINT PERIOD INSTEAD
0372 F94E 81 7E CMPA #$7E IS IT VALID ASCII?
0373 F950 23 02 BLS PRASC IF SO PRINT IT
0374 F952 86 2E PERIOD LDA #'. LOAD A PERIOD (.)
0375 F954 17 03 EB PRASC LBSR OUTCH PRINT ASCII CHARACTER
0376 F957 5A DECB DECREMENT COUNT
0377 F958 26 EE BNE EDPASC
0378 F95A 20 BC BRA NXTLIN
0379 *
0380 ***** "B" SET BREAKPOINT *****
0381 *
0382 F95C 17 03 3F BRKPNT LBSR IN1ADR GET BREAKPOINT ADDRESS
0383 F95F 29 1E BVS EXITBP EXIT IF INVALID HEX ADDR.
0384 F961 8C DF C0 CMPX #STACK ADDRESS ILLEGAL IF >=$DFC0
0385 F964 24 1A BCC BPERR IF ERROR PRINT (?), EXIT
0386 F966 34 10 PSHS X $FA82 PUSH BP ADDRESS ON STACK
0387 F968 8E FF FF LDX #$FFFF LOAD DUMMY ADDR TO TEST BP TABLE
0388 F96B 8D 55 BSR BPTEST TEST BP TABLE FOR FREE SPACE
0389 F96D 35 10 PULS X POP BP ADDRESS FROM STACK
0390 F96F 27 0F BEQ BPERR (Z) SET, OUT OF BP TABLE SPACE
0391 F971 A6 84 LDA ,X GET DATA AT BREAKPOINT ADDRESS
0392 F973 81 3F CMPA #$3F IS IT A SWI?
0393 F975 27 09 BEQ BPERR IF SWI ALREADY, INDICATE ERROR
0394 F977 A7 A0 STA ,Y+ SAVE DATA BYTE IN BP TABLE
0395 F979 AF A4 STX ,Y SAVE BP ADDRESS IN BP TABLE
0396 F97B 86 3F LDA #$3F LOAD A SWI ($3F)
0397 F97D A7 84 STA ,X SAVE SWI AT BREAKPOINT ADDRESS
0398 F97F 39 EXITBP RTS ;
0399 *
0400 * INDICATE ERROR SETTING BREAKPOINT
0401 *
0402 F980 17 03 BD BPERR LBSR OUT1S OUTPUT SPACE
0403 F983 86 3F LDA #'? LOAD (?), INDICATE BREAKPOINT ERROR
0404 F985 16 03 BA LBRA OUTCH PRINT "?"
0405 *
0406 *** "X" CLEAR OUTSTANDING BREAKPOINTS ***
0407 *
0408 F988 10 8E DF E3 XBKPNT LDY #BPTBL POINT TO BREAKPOINT TABLE
0409 F98C C6 08 LDB #8 LOAD BREAKPOINT COUNTER
0410 F98E 8D 18 XBPLP BSR RPLSWI REMOVE USED ENTRY IN BP TABLE
0411 F990 5A DECB $FAAC DECREMENT BP COUNTER
0412 F991 26 FB BNE XBPLP END OF BREAKPOINT TABLE?
0413 F993 39 RTS
0414 *
0415 ***** SWI ENTRY POINT *****
0416 *
0417 F994 1F 43 SWIE TFR S,U TRANSFER STACK TO USER POINTER
0418 F996 AE 4A LDX 10,U LOAD PC FROM STACK INTO X-REG
0419 F998 30 1F LEAX -1,X ADJUST ADDR DOWN 1 BYTE.
0420 F99A 8D 26 BSR BPTEST FIND BREAKPOINT IN BP TABLE
0421 F99C 27 04 BEQ REGPR IF FOUND, REPLACE DATA AT BP ADDR
0422 F99E AF 4A STX 10,U SAVE BREAKPOINT ADDR IN STACK
0423 F9A0 8D 06 BSR RPLSWI GO REPLACE SWI WITH ORIGINAL DATA
0424 F9A2 17 02 D0 REGPR LBSR REGSTR GO PRINT REGISTERS
0425 *
0426 IFD TRAOPT
0427 LDX #0
0428 STX TRACNT
0429 ENDIF TRAOPT
0429 ENDIF TRAOPT
0430 *
0431 F9A5 16 FE B9 LBRA NEXTCMD GET NEXT COMMAND
0432 *
0433 F9A8 AE 21 RPLSWI LDX 1,Y LOAD BP ADDRESS FROM BP TABLE
0434 F9AA 8C DF C0 CMPX #STACK COMPARE TO TOP AVAILABLE USER MEMORY
0435 F9AD 24 0A BCC FFSTBL GO RESET TABLE ENTRY TO $FF'S
0436 F9AF A6 84 LDA ,X GET DATA FROM BP ADDRESS
0437 F9B1 81 3F CMPA #$3F IS IT SWI?
0438 F9B3 26 04 BNE FFSTBL IF NOT, RESET TABLE ENTRY TO $FF'S
0439 F9B5 A6 A4 LDA ,Y GET ORIGINAL DATA FROM BP TABLE
0440 F9B7 A7 84 STA ,X $FAD3 RESTORE DATA AT BP ADDRESS
0441 F9B9 86 FF FFSTBL LDA #$FF LOAD $FF IN A-ACC
0442 F9BB A7 A0 STA ,Y+ RESET BREAKPOINT TABLE DATA TO $FF'S
0443 F9BD A7 A0 STA ,Y+ RESET BREAKPOINT TABLE ADDR TO $FF'S
0444 F9BF A7 A0 STA ,Y+
0445 F9C1 39 RTS
0446 *
0447 ** SEARCH BREAKPOINT TABLE FOR MATCH **
0448 *
0449 F9C2 10 8E DF E3 BPTEST LDY #BPTBL POINT TO BREAKPOINT TABLE
0450 F9C6 C6 08 LDB #8 LOAD BREAKPOINT COUNTER
0451 F9C8 A6 A0 FNDBP LDA ,Y+ LOAD DATA BYTE
0452 F9CA AC A1 CMPX ,Y++ COMPARE ADDRESS, IS IT SAME?
0453 F9CC 27 04 BEQ BPADJ IF SO, ADJUST POINTER FOR TABLE ENTRY
0454 F9CE 5A DECB IF NOT, DECREMENT BREAKPOINT COUNTER
0455 F9CF 26 F7 BNE FNDBP AND LOOK FOR NEXT POSSIBLE MATCH
0456 F9D1 39 RTS ;
0457 *
0458 *
0459 F9D2 31 3D BPADJ LEAY -3,Y MOVE POINTER TO BEGIN OF BP ENTRY
0460 F9D4 39 RTS
0461 *
0462 IFD TRAOPT
0463 *
0464 ** TRACE from address AAAA BB bytes
0465 *
0466 TRACE LBSR ALTPC1 SET UP NEW PC
0467 BVS TREXIT ADDRESS ERROR, EXIT
0468 LBSR OUT1S
0469 LBSR IN1ADR Fetch Byte Count
0470 BVS TREXIT Byte Count error, EXIT
0471 STX TRACNT
0472 *
0473 LDX NMI Save NMI Vector
0474 STX NMISAV
0475 LDX #NMIE Set up NMI for Tracing
0476 STX NMI
0477 LBSR TRAINZ Initialise Hardware
0478 BRA TRACEG Start Trace
0479 TREXIT RTS
0480 *
0481 * CRA0 = 0 CA1 IRQ DISAB, CRA0 = 1 CA1 IRQ ENAB
0482 * CRA1 = 1 CA1 Rising edge IRQ
0483 * CRA2 = 0 TADATA = Data Direction, CRA2 = 1 TADATA = I/O Register
0484 * CRA3 = 0 CA2 = 0 output, CRA3 = 1 CA2 = 1
0485 * CRA4 = 1 ] CA2 = Set/Reset output
0486 * CRA5 = 1 ]
0487 * CRA6 = X CA2 Input Interrupt Flag
0488 * CRA7 = X CA1 Interrupt Flag
0489 *
0490 * CRB0 = 0 CB1 IRQ DISAB, CRB0 = 1 CA1 IRQ ENAB
0491 * CRB1 = 1 CB1 Rising edge IRQ
0492 * CRB2 = 0 TBDATA = Data Direction, CRB2 = 1 TBDATA = I/O Register
0493 * CRB3 = 0 CB2 = 0 output, CRB3 = 1 CB2 = 1
0494 * CRB4 = 1 ] CB2 = Set/Reset output
0495 * CRB5 = 1 ]
0496 * CRB6 = X CB2 Input Interrupt Flag
0497 * CRB7 = X CB1 Interrupt Flag
0498 *
0499 *
0500 ** TRACE NMI ENTRY POINT
0501 *
0502 NMIE TFR S,U
0503 LDA #$36 Disable Interrupt, CA2 Low
0504 STA TACTRL
0505 LDA TADATA Clear Interrupt flag by reading data port
0506 *
0507 LBSR REGSTR DUMP REGISTERS
0508 *
0509 LDX 10,U TEST IF NEXT INSTRUCTION IS A SWI
0510 LDA ,X
0511 CMPA #$3F
0512 BEQ TRACEX EXIT ON SWI
0513 *
0514 LDX TRACNT CHECK IF TRACE COUNT EXPIRED
0515 BEQ TRACEX YES, GO BACK TO THE MONITOR
0516 LEAX -1,X DECREMENT TRACE COUNT
0517 STX TRACNT
0518 *
0519 ** TRACE GO (RESUME SINGLE STEP)
0520 *
0521 TRACEG TFR U,S SET UP PROGRAM STACK POINTER
0522 LDA #TRADEL SET UP TIMER DELAY (NUMB CYCLES FOR RTI+1)
0523 STA TADATA
0524 LDA #$36 LOAD STROBE LOW
0525 STA TACTRL
0526 LDA TADATA CLEAR INTERRUPT
0527 LDA #$36 RELEASE RESET
0528 STA TBCTRL
0529 LDA #$3F RELEASE LOAD, ENABLE CA1 NMI, CA1 RISING EDGE
0530 STA TACTRL
0531 RTI GO EXECUTE INSTRUCTION
0532 *
0533 TRACEX LDX NMISAV Restore NMI vector
0534 STX NMI
0535 LBRA NEXTCMD Jump back to the command loop.
0536 *
0537 ** TRACE HARDWARE INITIALISATION
0538 *
0539 TRAINZ LDA #$32 SELECT DDRA, CA2 LOW, NMI DISABLED
0540 STA TACTRL
0541 LDA #$3A SELECT DDRB, CB2 HIGH, FIRQ DISABLED
0542 STA TBCTRL
0543 LDA #$FF PORTA = OUTPUT
0544 STA TADATA
0545 LDA #$00 PORTB = INPUT
0546 STA TBDATA
0547 LDA #$36 SELECT OUTPUT REGISTER A, CA2 LOW
0548 STA TACTRL
0549 LDA #$3E SELECT OUTPUT REGISTER B, CB2 HIGH
0550 STA TBCTRL
0551 RTS
0552 *
0553 ENDIF TRAOPT
0553 ENDIF TRAOPT
0554 IFD MFDCOPT
0555 *
0556 ** "U" MINI DISK BOOT
0557 *
0558 F9D5 7D E0 18 MINBOOT TST CMDFDC
0559 F9D8 7F E0 14 CLR DRVFDC
0560 F9DB 8E 00 00 LDX #$0000
0561 F9DE 30 01 LOOP LEAX $01,X
0562 F9E0 8C 00 00 CMPX #$0000
0563 F9E3 26 F9 BNE LOOP
0564 F9E5 86 0F LDA #$0F
0565 F9E7 B7 E0 18 STA CMDFDC
0566 F9EA 8D 37 BSR DELAY
0567 F9EC F6 E0 18 LOOP1 LDB CMDFDC
0568 F9EF C5 01 BITB #$01
0569 F9F1 26 F9 BNE LOOP1
0570 F9F3 86 01 LDA #$01
0571 F9F5 B7 E0 1A STA SECFDC
0572 F9F8 8D 29 BSR DELAY
0573 F9FA 86 8C LDA #$8C
0574 F9FC B7 E0 18 STA CMDFDC
0575 F9FF 8D 22 BSR DELAY
0576 FA01 8E C0 00 LDX #$C000
0577 FA04 20 09 BRA LOOP3
0578 FA06 C5 02 LOOP2 BITB #$02
0579 FA08 27 05 BEQ LOOP3
0580 FA0A B6 E0 1B LDA DATFDC
0581 FA0D A7 80 STA ,X+
0582 FA0F F6 E0 18 LOOP3 LDB CMDFDC
0583 FA12 C5 01 BITB #$01
0584 FA14 26 F0 BNE LOOP2
0585 FA16 C5 2C BITB #$2C
0586 FA18 27 01 BEQ LOOP4
0587 FA1A 39 RTS
0588 *
0589 FA1B 8E C0 00 LOOP4 LDX #$C000
0590 FA1E AF 4A STX $0A,U
0591 FA20 1F 34 TFR U,S
0592 FA22 3B RTI
0593 *
0594 FA23 C6 04 DELAY LDB #$04
0595 FA25 5A LOOP5 DECB
0596 FA26 26 FD BNE LOOP5
0597 FA28 39 RTS
0598 ENDIF MFDCOPT
0599 *
0600 IFD DMAFOPT
0601 *
0602 *** "D" DISK BOOT FOR DMAF2 ***
0603 *
0604 FA29 86 DE DBOOT LDA #$DE
0605 FA2B B7 F0 24 STA DRVREG
0606 FA2E 86 FF LDA #$FF
0607 FA30 B7 F0 14 STA PRIREG $FAF8
0608 FA33 B7 F0 10 STA CCREG
0609 FA36 B7 F0 15 STA AAAREG
0610 FA39 B7 F0 16 STA BBBREG
0611 FA3C 7D F0 10 TST CCREG
0612 FA3F 86 D8 LDA #$D8
0613 FA41 B7 F0 20 STA COMREG
0614 FA44 17 00 96 LBSR DLY
0615 FA47 B6 F0 20 DBOOT0 LDA COMREG
0616 FA4A 2B FB BMI DBOOT0
0617 FA4C 86 09 LDA #$09
0618 FA4E B7 F0 20 STA COMREG
0619 FA51 17 00 89 LBSR DLY
0620 *
0621 FA54 B6 F0 20 DISKWT LDA COMREG FETCH DRIVE STATUS
0622 FA57 85 01 BITA #1 TEST BUSY BIT
0623 FA59 26 F9 BNE DISKWT LOOP UNTIL NOT BUSY
0624 *
0625 FA5B 85 10 BITA #$10
0626 FA5D 26 CA BNE DBOOT
0627 *
0628 FA5F 8E C0 00 LDX #$C000 LOGICAL ADDR. = $C000
0629 FA62 8D 52 BSR LRA GET 20 BIT PHYSICAL ADDR. OF LOG. ADDR.
0630 FA64 8A 10 ORA #$10
0631 FA66 B7 F0 40 STA CCCREG
0632 FA69 1F 10 TFR X,D
0633 FA6B 43 COMA ;
0634 FA6C 53 COMB ;
0635 FA6D FD F0 00 STD ADDREG
0636 FA70 8E FE FF LDX #$FEFF LOAD DMA BYTE COUNT = $100
0637 FA73 BF F0 02 STX CNTREG STORE IN COUNT REGISTER
0638 FA76 86 FF LDA #$FF LOAD THE CHANNEL REGISTER
0639 FA78 B7 F0 10 STA CCREG
0640 FA7B 86 FE LDA #$FE SET CHANNEL 0
0641 FA7D B7 F0 14 STA PRIREG
0642 FA80 86 01 LDA #1 SET SECTOR TO "1"
0643 FA82 B7 F0 22 STA SECREG ISSUE COMMAND
0644 FA85 86 8C LDA #$8C SET SINGLE SECTOR READ
0645 FA87 B7 F0 20 STA COMREG ISSUE COMMAND
0646 FA8A 8D 51 BSR DLY
0647 *
0648 * THE FOLLOWING CODE TESTS THE STATUS OF THE
0649 * CHANNEL CONTROL REGISTER. IF "D7" IS NOT
0650 * ZERO THEN IT WILL LOOP WAITING FOR "D7"
0651 * TO GO TO ZERO. IF AFTER 65,536 TRIES IT
0652 * IS STILL A ONE THE BOOT OPERATION WILL
0653 * BE STARTED OVER FROM THE BEGINING.
0654 *
0655 FA8C 5F CLRB ;
0656 FA8D 34 04 DBOOT1 PSHS B $FB55
0657 FA8F 5F CLRB ;
0658 FA90 7D F0 10 DBOOT2 TST CCREG
0659 FA93 2A 0A BPL DBOOT3
0660 FA95 5A DECB ;
0661 FA96 26 F8 BNE DBOOT2
0662 FA98 35 04 PULS B
0663 FA9A 5A DECB
0664 FA9B 26 F0 BNE DBOOT1
0665 FA9D 20 8A BRA DBOOT
0666 FA9F 35 04 DBOOT3 PULS B
0667 FAA1 B6 F0 20 LDA COMREG
0668 FAA4 85 1C BITA #$1C
0669 FAA6 27 01 BEQ DBOOT4
0670 FAA8 39 RTS ;
0671 *
0672 *
0673 FAA9 C6 DE DBOOT4 LDB #$DE
0674 FAAB F7 F0 24 STB DRVREG
0675 FAAE 8E C0 00 LDX #$C000
0676 FAB1 AF 4A STX 10,U
0677 FAB3 1F 34 TFR U,S $FB7B
0678 FAB5 3B RTI ;
0679 ENDIF DMAFOPT
0680 *
0681 IFD CF8OPT
0682 *
0683 * COMPACT FLASH BOOT
0684 *
0685 CFBOOT BSR WAITRDY
0686 LDA #HEADLBA
0687 STA CF_HEAD
0688 BSR WAITRDY
0689 LDA #FEAT8BIT
0690 STA CF_FEATURE
0691 LDA #CMDFEATURE
0692 STA CF_COMAND
0693 BSR WAITRDY
0694 *
0695 * READ SECTORS FROM CF
0696 *
0697 CFREAD LDA #$01
0698 STA CF_SECCNT
0699 CLRA
0700 STA CF_SECNUM
0701 STA CF_CYLLO
0702 STA CF_CYLHI
0703 *
0704 LDA #CMDREAD ; IDE READ MULTIPLE
0705 STA CF_COMAND
0706 BSR WAITRDY
0707 LDX #$C000
0708 *
0709 * READ LOOP
0710 *
0711 RDLOOP BSR WAITDRQ
0712 LDA CF_DATA
0713 STA ,X+
0714 CMPX #$C200
0715 BNE RDLOOP
0716 *
0717 LDX #$C000
0718 STX $0A,U
0719 TFR U,S
0720 RTI
0721 *
0722 * WAIT UNTIL READY
0723 *
0724 WAITRDY LDA CF_STATUS
0725 BITA #BUSY
0726 BNE WAITRDY
0727 LDA CF_STATUS
0728 BITA #DRDY
0729 BEQ WAITRDY
0730 RTS
0731 *
0732 * WAIT FOR DATA REQUEST
0733 *
0734 WAITDRQ LDA CF_STATUS
0735 BITA #DRQ
0736 BEQ WAITDRQ
0737 RTS
0738 ENDIF CF8OPT
0738 ENDIF CF8OPT
0739 *
0740 IFD IDEOPT
0741 *
0742 * XESS 16 BIT IDE BOOT
0743 *
0744 IDEBOOT LDD #AUXRESET
0745 STD CF_AUX
0746 LDD #AUXRSTREL
0747 STD CF_AUX
0748 LDD #HEADLBA
0749 STD CF_HEAD
0750 BSR WAITRDY
0751 *
0752 * READ SECTORS FROM CF
0753 *
0754 LDD #$01
0755 STD CF_SECCNT
0756 CLRB
0757 STD CF_SECNUM
0758 STD CF_CYLLO
0759 STD CF_CYLHI
0760 *
0761 LDB #CMDREAD ; IDE READ MULTIPLE
0762 STD CF_COMAND
0763 BSR WAITRDY
0764 LDX #$C000
0765 *
0766 * READ LOOP
0767 *
0768 RDLOOP BSR WAITDRQ
0769 LDD CF_DATA
0770 STB ,X+
0771 CMPX #$C100
0772 BNE RDLOOP
0773 *
0774 LDX #$C000
0775 STX $0A,U
0776 TFR U,S
0777 RTI
0778 *
0779 * WAIT UNTIL READY
0780 *
0781 WAITRDY LDD CF_STATUS
0782 BITB #BUSY
0783 BNE WAITRDY
0784 LDD CF_STATUS
0785 BITB #DRDY
0786 BEQ WAITRDY
0787 RTS
0788 *
0789 * WAIT FOR DATA REQUEST
0790 *
0791 WAITDRQ LDD CF_STATUS
0792 BITB #DRQ
0793 BEQ WAITDRQ
0794 RTS
0795 ENDIF IDEOPT
0795 ENDIF IDEOPT
0796 *
0797 IFD RTCOPT
0798 *
0799 * CLOCK INTER FACE UTILITY
0800 *
0801 * TIME <Hours> <Minuits> <Seconds>
0802 * If no argument is specified, the current time
0803 * will be displayed.
0804 *
0805 * READ A REGISTER FROM THE COUNTER.
0806 * The X Index rgister points to the register
0807 * to be read. The Status Register is checked
0808 * before and after the register is read before
0809 * returning a value in accumulator A
0810 *
0811 RDCLK TST CLKSTA
0812 BNE RDCLK
0813 RDCLK1 LDA 0,X
0814 TST CLKSTA
0815 BNE RDCLK1
0816 RTS
0817 *
0818 * MAIN PROGRAM:
0819 *
0820 TIMSET LDX #COUNTR POINT TO TIMER
0821 LBSR BYTE READ HOURS
0822 BVS SHOWTM NO ARG, DISP TIME
0823 STA HOUR,X
0824 LBSR OUT1S
0825 LBSR BYTE READ MINUITES
0826 BVS SHOWTM
0827 STA MINUIT,X
0828 LBSR OUT1S
0829 LBSR BYTE SECONDS.
0830 BVS SHOWTM
0831 STA SECOND,X
0832 *
0833 * DISPLAY CURRENT TIME
0834 *
0835 SHOWTM LBSR PCRLF
0836 LDX #COUNTR+HOUR
0837 LDB #3
0838 SHOWLP BSR RDCLK
0839 LBSR OUT2H
0840 LDA #':
0841 LBSR OUTCH
0842 LEAX -1,X
0843 DECB
0844 BNE SHOWLP
0845 RTS
0846 *
0847 * INITIATE CLOCK.
0848 * MASK INTERRUPTS.
0849 *
0850 CLKINZ CLR CINTCR MASK ALL INTERRUPTS
0851 TST CINTSR CLEAR ANY INTERRUPTS
0852 RTS
0853 ENDIF RTCOPT
0853 ENDIF RTCOPT
0854 IFD DATOPT
0855 *
0856 ***** LRA LOAD REAL ADDRESS *****
0857 *
0858 * THE FOLLOWING CODE LOADS THE 20-BIT
0859 * PHYSICAL ADDRESS OF A MEMORY BYTE
0860 * INTO THE "A" AND "X" REGISTERS. THIS
0861 * ROUTINE IS ENTERED WITH THE LOGICAL
0862 * ADDRESS OF A MEMORY BYTE IN THE "IX"
0863 * REGISTER. EXIT IS MADE WITH THE HIGH-
0864 * ORDER FOUR BITS OF THE 20-BIT PHYSICAL
0865 * ADDRESS IN THE "A" REGISTER, AND THE
0866 * LOW-ORDER 16-BITS OF THE 20-BIT
0867 * PHYSICAL ADDRESS IN THE "IX" REGISTER.
0868 * ALL OTHER REGISTERS ARE PRESERVED.
0869 * THIS ROUTINE IS REQUIRED SINCE THE
0870 * DMAF1 AND DMAF2 DISK CONTROLLERS MUST
0871 * PRESENT PHYSICAL ADDRESSES ON THE
0872 * SYSTEM BUS.
0873 *
0874 FAB6 34 36 LRA PSHS A,B,X,Y PUSH REGISTERS ON STACK
0875 FAB8 A6 62 LDA 2,S GET MSB LOGICAL ADDR FRM X REG ON STACK
0876 FABA 44 LSRA ;
0877 FABB 44 LSRA ADJ FOR INDEXED INTO
0878 FABC 44 LSRA CORRESPONDING LOCATION
0879 FABD 44 LSRA IN LRA TABLE
0880 FABE 10 8E DF D0 LDY #LRARAM LOAD LRA TABLE BASE ADDRESS
0881 FAC2 E6 A6 LDB A,Y GET PHYSICAL ADDR. DATA FROM LRA TABLE
0882 FAC4 54 LSRB ADJ. REAL ADDR. TO REFLECT EXTENDED
0883 FAC5 54 LSRB PHYSICAL ADDRESS.
0884 FAC6 54 LSRB EXTENDED MS 4-BITS ARE RETURNED
0885 FAC7 54 LSRB IN THE "A" ACCUMULATOR
0886 FAC8 E7 E4 STB ,S MS 4 BITS IN A ACCUM. STORED ON STACK
0887 FACA E6 A6 LDB A,Y LOAD REAL ADDRESS DATA FROM LRA TABLE
0888 FACC 53 COMB COMP TO ADJ FOR PHYSICAL ADDR. IN X REG
0889 FACD 58 ASLB ADJ DATA FOR RELOCATION IN X REG
0890 FACE 58 ASLB ;
0891 FACF 58 ASLB $FB97
0892 FAD0 58 ASLB ;
0893 FAD1 A6 62 LDA 2,S GET MS BYTE OF LOGICAL ADDR.
0894 FAD3 84 0F ANDA #$0F MASK MS NIBBLE OF LOGICAL ADDRESS
0895 FAD5 A7 62 STA 2,S SAVE IT IN X REG ON STACK
0896 FAD7 EA 62 ORB 2,S SET MS BYTE IN X REG TO ADJ PHY ADDR.
0897 *
0898 * PLUS LS NIBBLE OF LOGICAL ADDRESS
0899 FAD9 E7 62 STB 2,S SAVE AS LS 16 BITS OF PHY ADDR IN X REG
0900 * ON STACK
0901 FADB 35 B6 PULS A,B,X,Y,PC POP REGS. FROM STACK
0902 ENDIF DATOPT
0903 *
0904 * DELAY LOOP
0905 *
0906 FADD 34 04 DLY PSHS B SAVE CONTENTS OF "B"
0907 FADF C6 20 LDB #$20 GET LOOP DELAY VALUE
0908 FAE1 5A SUB1 DECB SUBTRACT ONE FROM VALUE
0909 FAE2 26 FD BNE SUB1 LOOP UNTIL ZERO
0910 FAE4 35 84 PULS B,PC RESTORE CONTENTS OF "B"
0911 * RTS ;
0912 *
0913 ***** "L" LOAD MIKBUG TAPE *****
0914 *
0915 FAE6 BD FD 53 LOAD JSR ACINIZ
0916 FAE9 86 11 LDA #$11 LOAD 'DC1' CASS. READ ON CODE
0917 FAEB 17 02 54 LBSR OUTCH OUTPUT IT TO TERMINAL PORT
0918 FAEE 7F DF E2 CLR ECHO TURN OFF ECHO FLAG
0919 FAF1 17 02 26 LOAD1 LBSR ECHON INPUT 8 BIT BYTE WITH NO ECHO
0920 FAF4 81 53 LOAD2 CMPA #'S IS IT AN "S", START CHARACTER ?
0921 FAF6 26 F9 BNE LOAD1 IF NOT, DISCARD AND GET NEXT CHAR.
0922 FAF8 17 02 1F LBSR ECHON
0923 FAFB 81 39 CMPA #'9 IS IT A "9" , END OF FILE CHAR ?
0924 FAFD 27 3D BEQ LOAD21 IF SO, EXIT LOAD
0925 FAFF 81 31 CMPA #'1 IS IT A "1" , FILE LOAD CHAR ?
0926 FB01 26 F1 BNE LOAD2 IF NOT, LOOK FOR START CHAR.
0927 FB03 17 01 A8 LBSR BYTE INPUT BYTE COUNT
0928 FB06 34 02 PSHS A PUSH COUNT ON STACK
0929 FB08 29 26 BVS LODERR (V) C-CODE SET, ILLEGAL HEX
0930 FB0A 17 01 91 LBSR IN1ADR INPUT LOAD ADDRESS
0931 FB0D 29 21 BVS LODERR (V) C-CODE SET, ADDR NOT HEX
0932 FB0F 34 10 PSHS X PUSH ADDR ON STACK
0933 FB11 E6 E0 LDB ,S+ LOAD MSB OF ADDR AS CHECKSUM BYTE
0934 FB13 EB E0 ADDB ,S+ ADD LSB OF ADDR TO CHECKSUM
0935 FB15 EB E4 ADDB ,S ADD BYTE COUNT BYTE TO CHECKSUM
0936 FB17 6A E4 DEC ,S $FC37 DECREMENT BYTE COUNT 2 TO BYPASS
0937 FB19 6A E4 DEC ,S ADDRESS BYTES.
0938 FB1B 34 04 LOAD10 PSHS B PUSH CHECKSUM ON STACK
0939 FB1D 17 01 8E LBSR BYTE INPUT DATA BYTE (2 HEX CHAR)
0940 FB20 35 04 PULS B POP CHECKSUM FROM STACK
0941 FB22 29 0C BVS LODERR (V) SET, DATA BYTE NOT HEX
0942 FB24 34 02 PSHS A PUSH DATA BYTE ON STACK
0943 FB26 EB E0 ADDB ,S+ ADD DATA TO CHECKSUM, AUTO INC STACK
0944 FB28 6A E4 DEC ,S DECREMENT BYTE COUNT 1
0945 FB2A 27 05 BEQ LOAD16 IF BYTE COUNT ZERO, TEST CHECKSUM
0946 FB2C A7 80 STA ,X+ SAVE DATA BYTE IN MEMORY
0947 FB2E 20 EB BRA LOAD10 GET NEXT DATA BYTE
0948 FB30 5F LODERR CLRB ;ERROR CONDITION, ZERO CHECKSUM ;
0949 FB31 35 02 LOAD16 PULS A ADJUST STACK (REMOVE BYTE COUNT)
0950 FB33 C1 FF CMPB #$FF CHECKSUM OK?
0951 FB35 27 BA BEQ LOAD1 IF SO, LOAD NEXT LINE
0952 FB37 86 3F LDA #'? LOAD (?) ERROR INDICATOR
0953 FB39 17 02 06 LBSR OUTCH OUTPUT IT TO TERMINAL
0954 FB3C 73 DF E2 LOAD21 COM ECHO TURN ECHO ON
0955 FB3F 86 13 LDA #$13 $FC5F LOAD 'DC3' CASS. READ OFF CODE
0956 FB41 16 01 FE LBRA OUTCH OUTPUT IT
0957 *
0958 ***** "P" PUNCH MIKBUG TAPE *****
0959 *
0960 FB44 6F E2 PUNCH CLR ,-S CLEAR RESERVED BYTE ON STACK
0961 FB46 17 01 4A LBSR IN2ADR GET BEGIN AND END ADDRESS
0962 FB49 34 30 PSHS X,Y SAVE ADDRESSES ON STACK
0963 FB4B 29 4D BVS PUNEXT (V) C-CODE SET, EXIT PUNCH
0964 FB4D AC 62 CMPX 2,S COMPARE BEGIN TO END ADDR
0965 FB4F 25 49 BCS PUNEXT IF BEGIN GREATER THAN END, EXIT PUNCH
0966 FB51 30 01 LEAX 1,X INCREMENT END ADDRESS
0967 FB53 AF E4 STX ,S STORE END ADDR ON STACK
0968 FB55 BD FD 53 JSR ACINIZ
0969 FB58 86 12 LDA #$12 LOAD 'DC2' PUNCH ON CODE
0970 FB5A 17 01 E5 LBSR OUTCH OUTPUT IT TO TERMINAL
0971 FB5D EC E4 PUNCH2 LDD ,S LOAD END ADDR IN D-ACC
0972 FB5F A3 62 SUBD 2,S SUBTRACT BEGIN FROM END
0973 FB61 27 06 BEQ PUNCH3 SAME, PUNCH 32 BYTES DEFAULT
0974 FB63 10 83 00 20 CMPD #$20 LESS THAN 32 BYTES?
0975 FB67 23 02 BLS PUNCH4 PUNCH THAT MANY BYTES
0976 FB69 C6 20 PUNCH3 LDB #$20 LOAD BYTE COUNT OF 32.
0977 FB6B E7 64 PUNCH4 STB 4,S STORE ON STACK AS BYTE COUNT
0978 FB6D 8E FE 1F LDX #MSG20 POINT TO MSG "S1"
0979 FB70 17 00 2F LBSR PSTRNG PRINT MSG
0980 FB73 CB 03 ADDB #3 ADD 3 BYTES TO BYTE COUNT
0981 FB75 1F 98 TFR B,A GET BYTE COUNT IN A-ACC TO PUNCH
0982 FB77 17 01 75 LBSR OUT2H OUTPUT BYTE COUNT
0983 FB7A AE 62 LDX 2,S LOAD BEGIN ADDRESS
0984 FB7C 17 01 68 LBSR OUT4H PUNCH ADDRESS
0985 FB7F EB 62 ADDB 2,S ADD ADDR MSB TO CHECKSUM
0986 FB81 EB 63 ADDB 3,S ADD ADDR LSB TO CHECKSUM
0987 FB83 EB 84 PUNCHL ADDB ,X ADD DATA BYTE TO CHECKSUM
0988 FB85 A6 80 LDA ,X+ LOAD DATA BYTE TO PUNCH
0989 FB87 17 01 65 LBSR OUT2H OUTPUT DATA BYTE
0990 FB8A 6A 64 DEC 4,S DECREMENT BYTE COUNT
0991 FB8C 26 F5 BNE PUNCHL NOT DONE, PUNCH NEXT BYTE
0992 FB8E 53 COMB 1's COMPLIMENT CHECKSUM BYTE
0993 FB8F 1F 98 TFR B,A GET IT IN A-ACC TO PUNCH
0994 FB91 17 01 5B LBSR OUT2H OUTPUT CHECKSUM BYTE
0995 FB94 AF 62 STX 2,S SAVE X-REG IN STACK AS NEW PUNCH ADDR
0996 FB96 AC E4 CMPX ,S COMPARE IT TO END ADDR
0997 FB98 26 C3 BNE PUNCH2 $FCB5 PUNCH NOT DONE, CONT.
0998 FB9A 86 14 PUNEXT LDA #$14 LOAD 'DC4' PUNCH OFF CODE
0999 FB9C 17 01 A3 LBSR OUTCH OUTPUT IT
1000 FB9F 32 65 LEAS 5,S READJUST STACK POINTER
1001 FBA1 39 RTS ;
1002 *
1003 * PRINT STRING PRECEEDED BY A CR & LF.
1004 *
1005 FBA2 8D 02 PSTRNG BSR PCRLF PRINT CR/LF
1006 FBA4 20 71 BRA PDATA PRINT STRING POINTED TO BY IX
1007 *
1008 * PCRLF
1009 *
1010 FBA6 34 10 PCRLF PSHS X SAVE IX
1011 FBA8 8E FD D0 LDX #MSG2+1 POINT TO MSG CR/LF + 3 NULS
1012 FBAB 17 00 69 LBSR PDATA PRINT MSG
1013 FBAE 35 90 PULS X,PC RESTORE IX & RETURN
1014 *
1015 * LONG BRANCHES TO COMMON ROUTINES
1016 *
1017 FBB0 16 01 8D JOUT1S LBRA OUT1S
1018 FBB3 16 00 F8 JBYTE LBRA BYTE
1019 FBB6 16 00 E5 JIN1ADR LBRA IN1ADR
1020 *
1021 * ALTER "PC" PROGRAM COUNTER
1022 *
1023 FBB9 17 00 91 ALTRPC LBSR PRTPC $FCF5 PRINT MSG " PC = "
1024 FBBC 8D F2 ALTPC1 BSR JOUT1S OUTPUT SPACE
1025 FBBE 8D F6 BSR JIN1ADR GET NEW CONTENTS FOR "PC"
1026 FBC0 29 02 BVS ALTPCD EXIT IF INVALID HEX
1027 FBC2 AF 4A STX 10,U POKE IN NEW CONTENTS
1028 FBC4 39 ALTPCD RTS ;
1029 *
1030 * ALTER "U" USER STACK POINTER
1031 *
1032 FBC5 8D 61 ALTRU BSR PRTUS $FCCA PRINT MSG " US = "
1033 FBC7 8D E7 BSR JOUT1S OUTPUT SPACE
1034 FBC9 8D EB BSR JIN1ADR
1035 FBCB 29 02 BVS ALTUD
1036 FBCD AF 48 STX 8,U
1037 FBCF 39 ALTUD RTS ;
1038 *
1039 * ALTER "Y" INDEX REGISTER
1040 *
1041 FBD0 8D 72 ALTRY BSR PRTIY PRINT MSG " IY = "
1042 FBD2 8D DC BSR JOUT1S OUTPUT SPACE
1043 FBD4 8D E0 BSR JIN1ADR
1044 FBD6 29 02 BVS ALTYD
1045 FBD8 AF 46 STX 6,U $F8F0
1046 FBDA 39 ALTYD RTS ;
1047 *
1048 * ALTER "X" INDEX REGISTER
1049 *
1050 FBDB 8D 5E ALTRX BSR PRTIX $FCE0 PRINT MSG " IX = "
1051 FBDD 8D D1 BSR JOUT1S OUTPUT SPACE
1052 FBDF 8D D5 BSR JIN1ADR
1053 FBE1 29 02 BVS ALTXD
1054 FBE3 AF 44 STX 4,U
1055 FBE5 39 ALTXD RTS ;
1056 *
1057 * ALTER "DP" DIRECT PAGE REGISTER
1058 *
1059 FBE6 8D 49 ALTRDP BSR PRTDP $FCD5 PRINT MSG " DP = "
1060 FBE8 8D C6 BSR JOUT1S OUTPUT SPACE
1061 FBEA 8D C7 BSR JBYTE INPUT BYTE (2 HEX CHAR)
1062 FBEC 29 02 BVS ALTDPD
1063 FBEE A7 43 STA 3,U
1064 FBF0 39 ALTDPD RTS ;
1065 *
1066 * ALTER "B" ACCUMULATOR
1067 *
1068 FBF1 8D 6C ALTRB BSR PRTB $FD09 PRINT MSG " B = "
1069 FBF3 8D BB BSR JOUT1S OUTPUT SPACE
1070 FBF5 8D BC BSR JBYTE INPUT BYTE (2 HEX CHAR)
1071 FBF7 29 02 BVS ALTBD
1072 FBF9 A7 42 STA 2,U
1073 FBFB 39 ALTBD RTS $F91C
1074 *
1075 * ALTER "A" ACCUMULATOR
1076 *
1077 FBFC 8D 58 ALTRA BSR PRTA $FCFF RINT MSG " A = "
1078 FBFE 8D B0 BSR JOUT1S OUTPUT SPACE
1079 FC00 8D B1 BSR JBYTE INPUT BYTE (2 HEX CHAR)
1080 FC02 29 02 BVS ALTAD
1081 FC04 A7 41 STA 1,U
1082 FC06 39 ALTAD RTS ;
1083 *
1084 * ALTER "CC" REGISTER
1085 *
1086 FC07 8D 5F ALTRCC BSR PRTCC $FD13 PRINT MSG " CC: "
1087 FC09 8D A5 BSR JOUT1S OUTPUT SPACE
1088 FC0B 8D A6 BSR JBYTE INPUT BYTE (2 HEX CHAR)
1089 FC0D 29 04 BVS ALTCCD
1090 FC0F 8A 80 ORA #$80 SETS "E" FLAG IN PRINT LIST
1091 FC11 A7 C4 STA ,U
1092 FC13 39 ALTCCD RTS ;
1093 *
1094 * PDATA
1095 *
1096 FC14 17 01 2B PRINT LBSR OUTCH
1097 FC17 A6 80 PDATA LDA ,X+ GET 1st CHAR. TO PRINT
1098 FC19 81 04 CMPA #4 IS IT EOT?
1099 FC1B 26 F7 BNE PRINT IF NOT EOT PRINT IT
1100 FC1D 39 RTS ;
1101 *
1102 * PRINT REGISTERS
1103 *
1104 FC1E 8E FD E2 PRTSP LDX #MSG10 POINT TO MSG "SP="
1105 FC21 8D F4 BSR PDATA PRINT MSG
1106 FC23 1F 31 TFR U,X
1107 FC25 16 00 BF JOUT4H LBRA OUT4H
1108 *
1109 FC28 8E FD EE PRTUS LDX #MSG12 POINT TO MSG "US="
1110 FC2B 8D EA BSR PDATA PRINT MSG
1111 FC2D AE 48 LDX 8,U
1112 FC2F 20 F4 BRA JOUT4H
1113 *
1114 FC31 8E FE 00 PRTDP LDX #MSG15 POINT TO MSG "DP="
1115 FC34 8D E1 BSR PDATA PRINT MSG
1116 FC36 A6 43 LDA 3,U
1117 FC38 16 00 B4 JOUT2H LBRA OUT2H OUTPUT HEX BYTE AS ASCII
1118 *
1119 FC3B 8E FD FA PRTIX LDX #MSG14 POINT TO MSG "IX="
1120 FC3E 8D D7 BSR PDATA PRINT MSG
1121 FC40 AE 44 LDX 4,U $FCE6
1122 FC42 20 E1 BRA JOUT4H
1123 *
1124 FC44 8E FD F4 PRTIY LDX #MSG13 POINT TO MSG "IY="
1125 FC47 8D CE BSR PDATA PRINT MSG
1126 FC49 AE 46 LDX 6,U
1127 FC4B 20 D8 BRA JOUT4H
1128 *
1129 FC4D 8E FD E8 PRTPC LDX #MSG11 POINT TO MSG "PC="
1130 FC50 8D C5 BSR PDATA PRINT MSG
1131 FC52 AE 4A LDX 10,U
1132 FC54 20 CF BRA JOUT4H
1133 *
1134 FC56 8E FE 06 PRTA LDX #MSG16 POINT TO MSG "A="
1135 FC59 8D BC BSR PDATA PRINT MSG
1136 FC5B A6 41 LDA 1,U
1137 FC5D 20 D9 BRA JOUT2H OUTPUT HEX BYTE AS ASCII
1138 *
1139 FC5F 8E FE 0B PRTB LDX #MSG17 POINT TO MSG "B="
1140 FC62 8D B3 BSR PDATA PRINT MSG
1141 FC64 A6 42 LDA 2,U
1142 FC66 20 D0 BRA JOUT2H OUTPUT HEX BYTE AS ASCII
1143 *
1144 FC68 8E FE 10 PRTCC LDX #MSG18 POINT TO MSG "CC:"
1145 FC6B 8D AA BSR PDATA PRINT MSG
1146 FC6D A6 C4 LDA ,U
1147 FC6F 8E FE 17 LDX #MSG19 POINT TO MSG "EFHINZVC"
1148 FC72 16 00 90 LBRA BIASCI OUTPUT IN BINARY/ASCII FORMAT
1149 *
1150 * "R" DISPLAY REGISTERS
1151 *
1152 FC75 8E FD DE REGSTR LDX #MSG5 POINT TO MSG " - "
1153 FC78 17 FF 27 LBSR PSTRNG PRINT MSG
1154 FC7B 8D A1 BSR PRTSP $FCBF
1155 FC7D 8D A9 BSR PRTUS $FCCA
1156 FC7F 8D B0 BSR PRTDP $FCD5
1157 FC81 8D B8 BSR PRTIX $FCE0
1158 FC83 8D BF BSR PRTIY $FCEB
1159 FC85 8E FD DE LDX #MSG5 POINT TO MSG " - "
1160 FC88 17 FF 17 LBSR PSTRNG PRINT MSG
1161 FC8B 8D C0 BSR PRTPC $FCF5
1162 FC8D 8D C7 BSR PRTA $FCFF
1163 FC8F 8D CE BSR PRTB $FD09
1164 FC91 20 D5 BRA PRTCC $FD13
1165 *
1166 * THE FOLLOWING ROUTINE LOOPS WAITING FOR THE
1167 * OPERATOR TO INPUT TWO VALID HEX ADDRESSES.
1168 * THE FIRST ADDRESS INPUT IS RETURNED IN "IY".
1169 * THE SECOND IS RETURNED IN "IX". THE "V" BIT
1170 * IN THE C-CODE REG. IS SET IF AN INVALID HEX
1171 * ADDRESS IS INPUT.
1172 *
1173 FC93 8D 09 IN2ADR BSR IN1ADR GET FIRST ADDRESS
1174 FC95 29 4D BVS NOTHEX EXIT IF NOT VALID HEX
1175 FC97 1F 12 TFR X,Y SAVE FIRST ADDR. IN "IY"
1176 FC99 86 2D LDA #'-
1177 FC9B 17 00 A4 LBSR OUTCH PRINT " - "
1178 *
1179 * THE FOLLOWING ROUTINE LOOPS WAITING FOR THE
1180 * OPERATOR TO INPUT ONE VALID HEX ADDRESS. THE
1181 * ADDRESS IS RETURNED IN THE "X" REGISTER.
1182 *
1183 FC9E 8D 0E IN1ADR BSR BYTE INPUT BYTE (2 HEX CHAR)
1184 FCA0 29 42 BVS NOTHEX EXIT IF NOT VALID HEX
1185 FCA2 1F 01 TFR D,X
1186 FCA4 8D 08 BSR BYTE INPUT BYTE (2 HEX CHAR)
1187 FCA6 29 3C BVS NOTHEX
1188 FCA8 34 10 PSHS X
1189 FCAA A7 61 STA 1,S
1190 FCAC 35 90 PULS X,PC
1191 *
1192 ***** INPUT BYTE (2 HEX CHAR.) *****
1193 *
1194 FCAE 8D 11 BYTE BSR INHEX GET HEX LEFT
1195 FCB0 29 32 BVS NOTHEX EXIT IF NOT VALID HEX
1196 FCB2 48 ASLA ;
1197 FCB3 48 ASLA ;
1198 FCB4 48 ASLA ; SHIFT INTO LEFT NIBBLE
1199 FCB5 48 ASLA ;
1200 FCB6 1F 89 TFR A,B PUT HEXL IN "B"
1201 FCB8 8D 07 BSR INHEX GET HEX RIGHT
1202 FCBA 29 28 BVS NOTHEX EXIT IF NOT VALID HEX
1203 FCBC 34 04 PSHS B PUSH HEXL ON STACK
1204 FCBE AB E0 ADDA ,S+ ADD HEXL TO HEXR AND ADJ. STK
1205 FCC0 39 RTS RETURN WITH HEX L&R IN "A"
1206 *
1207 *
1208 FCC1 8D 57 INHEX BSR ECHON INPUT ASCII CHAR.
1209 FCC3 81 30 CMPA #'0 IS IT > OR = "0" ?
1210 FCC5 25 1D BCS NOTHEX IF LESS IT AIN'T HEX
1211 FCC7 81 39 CMPA #'9 IS IT < OR = "9" ?
1212 FCC9 22 03 BHI INHEXA IF > MAYBE IT'S ALPHA
1213 FCCB 80 30 SUBA #$30 ASCII ADJ. NUMERIC
1214 FCCD 39 RTS ;
1215 *
1216 *
1217 FCCE 81 41 INHEXA CMPA #'A IS IT > OR = "A"
1218 FCD0 25 12 BCS NOTHEX IF LESS IT AIN'T HEX
1219 FCD2 81 46 CMPA #'F IS IT < OR = "F" ?
1220 FCD4 22 03 BHI INHEXL IF > IT AIN'T HEX
1221 FCD6 80 37 SUBA #$37 ASCII ADJ. ALPHA
1222 FCD8 39 RTS ;
1223 *
1224 FCD9 81 61 INHEXL CMPA #'a IS IT > OR = "a"
1225 FCDB 25 07 BCS NOTHEX IF LESS IT AIN'T HEX
1226 FCDD 81 66 CMPA #'f IS IT < "f"
1227 FCDF 22 03 BHI NOTHEX IF > IT AIN'T HEX
1228 FCE1 80 57 SUBA #$57 ADJUST TO LOWER CASE
1229 FCE3 39 RTS ;
1230 *
1231 *
1232 FCE4 1A 02 NOTHEX ORCC #2 SET (V) FLAG IN C-CODES REGISTER
1233 FCE6 39 RTS ;
1234 *
1235 *
1236 FCE7 34 10 OUT4H PSHS X PUSH X-REG. ON THE STACK
1237 FCE9 35 02 PULS A POP MS BYTE OF X-REG INTO A-ACC.
1238 FCEB 8D 02 BSR OUTHL OUTPUT HEX LEFT
1239 FCED 35 02 PULS A POP LS BYTE OF X-REG INTO A-ACC.
1240 FCEF OUTHL EQU *
1241 FCEF 34 02 OUT2H PSHS A SAVE IT BACK ON STACK
1242 FCF1 44 LSRA CONVERT UPPER HEX NIBBLE TO ASCII
1243 FCF2 44 LSRA ;
1244 FCF3 44 LSRA ;
1245 FCF4 44 LSRA ;
1246 FCF5 8D 04 BSR XASCII PRINT HEX NIBBLE AS ASCII
1247 FCF7 35 02 OUTHR PULS A CONVERT LOWER HEX NIBBLE TO ASCII
1248 FCF9 84 0F ANDA #$0F STRIP LEFT NIBBLE
1249 FCFB 8B 30 XASCII ADDA #$30 ASCII ADJ
1250 FCFD 81 39 CMPA #$39 IS IT < OR = "9" ?
1251 FCFF 2F 02 BLE OUTC IF LESS, OUTPUT IT
1252 FD01 8B 07 ADDA #7 IF > MAKE ASCII LETTER
1253 FD03 20 3D OUTC BRA OUTCH OUTPUT CHAR
1254 *
1255 * BINARY / ASCII --- THIS ROUTINE
1256 * OUTPUTS A BYTE IN ENHANCED
1257 * BINARY FORMAT. THE ENHANCEMENT
1258 * IS DONE BY SUBSTITUTING ASCII
1259 * LETTERS FOR THE ONES IN THE BYTE.
1260 * THE ASCII ENHANCEMENT LETTERS
1261 * ARE OBTAINED FROM THE STRING
1262 * POINTED TO BY THE INDEX REG. "X".
1263 *
1264 FD05 34 02 BIASCI PSHS A SAVE "A" ON STACK
1265 FD07 C6 08 LDB #8 PRESET LOOP# TO BITS PER BYTE
1266 FD09 A6 80 OUTBA LDA ,X+ GET LETTER FROM STRING
1267 FD0B 68 E4 ASL ,S TEST BYTE FOR "1" IN B7
1268 FD0D 25 02 BCS PRTBA IF ONE PRINT LETTER
1269 FD0F 86 2D LDA #'- IF ZERO PRINT "-"
1270 FD11 8D 2F PRTBA BSR OUTCH PRINT IT
1271 FD13 8D 2B BSR OUT1S PRINT SPACE
1272 FD15 5A DECB SUB 1 FROM #BITS YET TO PRINT
1273 FD16 26 F1 BNE OUTBA
1274 FD18 35 82 PULS A,PC
1275 *
1276 IFD EXTOPT
1277 *
1278 * EXTENDED USER COMMANDS
1279 *
1280 USRCMD JMP [MONEXT+EXTCMD]
1281 ENDIF EXTOPT
1281 ENDIF EXTOPT
1282 *
1283 *
1284 FD1A 7D DF E2 ECHON TST ECHO IS ECHO REQUIRED ?
1285 FD1D 27 06 BEQ INCH ECHO NOT REQ. IF CLEAR
1286 *
1287 * INCHE
1288 *
1289 * ---GETS CHARACTER FROM TERMINAL AND
1290 * ECHOS SAME. THE CHARACTER IS RETURNED
1291 * IN THE "A" ACCUMULATOR WITH THE PARITY
1292 * BIT MASKED OFF. ALL OTHER REGISTERS
1293 * ARE PRESERVED.
1294 *
1295 FD1F 8D 04 INCHE BSR INCH GET CHAR FROM TERMINAL
1296 FD21 84 7F ANDA #$7F STRIP PARITY FROM CHAR.
1297 FD23 20 1D BRA OUTCH ECHO CHAR TO TERMINAL
1298 *
1299 * INCH
1300 *
1301 * GET CHARACTER FROM TERMINAL. RETURN
1302 * CHARACTER IN "A" ACCUMULATOR AND PRESERVE
1303 * ALL OTHER REGISTERS. THE INPUT CHARACTER
1304 * IS 8 BITS AND IS NOT ECHOED.
1305 *
1306 *
1307 FD25 34 10 INCH PSHS X SAVE IX
1308 FD27 BE DF E0 GETSTA LDX CPORT POINT TO TERMINAL PORT
1309 FD2A A6 84 LDA ,X FETCH PORT STATUS
1310 FD2C 85 01 BITA #1 TEST READY BIT, RDRF ?
1311 IFD PS2OPT
1312 BNE GETST1
1313 LDX #PS2KBD
1314 LDA ,X
1315 BITA #1
1316 ENDIF PS2OPT
1316 ENDIF PS2OPT
1317 FD2E 27 F7 BEQ GETSTA IF NOT RDY, THEN TRY AGAIN
1318 FD30 A6 01 GETST1 LDA 1,X FETCH CHAR
1319 FD32 35 90 PULS X,PC RESTORE IX
1320 *
1321 * INCHEK
1322 *
1323 * CHECK FOR A CHARACTER AVAILABLE FROM
1324 * THE TERMINAL. THE SERIAL PORT IS CHECKED
1325 * FOR READ READY. ALL REGISTERS ARE
1326 * PRESERVED, AND THE "Z" BIT WILL BE
1327 * CLEAR IF A CHARACTER CAN BE READ.
1328 *
1329 *
1330 FD34 34 02 INCHEK PSHS A SAVE A ACCUM.
1331 FD36 A6 9F DF E0 LDA [CPORT] FETCH PORT STATUS
1332 FD3A 85 01 BITA #1 TEST READY BIT, RDRF ?
1333 IFD PS2OPT
1334 BNE INCHEK1
1335 LDA PS2KBD
1336 BITA #1 TEST READY BIT< RDRF ?
1337 ENDIF PS2OPT
1337 ENDIF PS2OPT
1338 FD3C 35 82 INCHEK1 PULS A,PC RESTORE A ACCUM.
1339 *
1340 FD3E 8D 00 OUT2S BSR OUT1S OUTPUT 2 SPACES
1341 FD40 86 20 OUT1S LDA #$20 OUTPUT 1 SPACE
1342 *
1343 *
1344 * OUTCH
1345 *
1346 * OUTPUT CHARACTER TO TERMINAL.
1347 * THE CHAR. TO BE OUTPUT IS
1348 * PASSED IN THE A REGISTER.
1349 * ALL REGISTERS ARE PRESERVED.
1350 *
1351 OUTCH IFD VDUOPT
1352 BSR VOUTCH
1353 ENDIF VDUOPT
1353 ENDIF VDUOPT
1354 IFD DG640OPT
1355 BSR VOUTCH
1356 ENDIF DG640OPT
1356 ENDIF DG640OPT
1357 FD42 34 12 AOUTCH PSHS A,X SAVE A ACCUM AND IX
1358 FD44 BE DF E0 LDX CPORT GET ADDR. OF TERMINAL
1359 FD47 A6 84 FETSTA LDA ,X FETCH PORT STATUS
1360 FD49 85 02 BITA #2 TEST TDRE, OK TO XMIT ?
1361 FD4B 27 FA BEQ FETSTA IF NOT LOOP UNTIL RDY
1362 FD4D 35 02 PULS A GET CHAR. FOR XMIT
1363 FD4F A7 01 STA 1,X XMIT CHAR.
1364 FD51 35 90 PULS X,PC RESTORE IX
1365 *
1366 * IO INITIALIZATION
1367 *
1368 FD53 IOINIZ EQU *
1369 IFD VDUOPT
1370 BSR VINIZ
1371 ENDIF VDUOPT
1371 ENDIF VDUOPT
1372 IFD DG640OPT
1373 BSR VINIZ
1374 ENDIF DG640OPT
1374 ENDIF DG640OPT
1375 FD53 BE DF E0 ACINIZ LDX CPORT POINT TO CONTROL PORT ADDRESS
1376 FD56 86 03 LDA #3 RESET ACIA PORT CODE
1377 FD58 A7 84 STA ,X STORE IN CONTROL REGISTER
1378 FD5A 86 11 LDA #$11 SET 8 DATA, 2 STOP AN 0 PARITY
1379 FD5C A7 84 STA ,X STORE IN CONTROL REGISTER
1380 FD5E 6D 01 TST 1,X ANYTHING IN DATA REGISTER?
1381 FD60 86 FF LDA #$FF TURN ON ECHO FLAG
1382 FD62 B7 DF E2 STA ECHO
1383 FD65 39 RTS
1384 *
1385 IFD VDUOPT
1386 *
1387 ***************************************************
1388 * VDU8 ADM3A REGISTER-MAPPED EMULATOR *
1389 * *
1390 * 80 x 25 Characters
1391 *
1392 ***************************************************
1393 *
1394 ***************************************************
1395 * INITIALIZE EMULATOR *
1396 ***************************************************
1397 *
1398 VINIZ LDX #VDU
1399 LDD #0
1400 STD COLADX AND ROWADX
1401 STA VDUCOL,X
1402 STB VDUROW,X
1403 STB VDUOFF,X
1404 STD NEWROW AND ESCFLG
1405 LDB #$02
1406 STB VDUATT,X
1407 CLR ESCFLG
1408 LDA #$1B SEND ESCAPE
1409 BSR VOUTCH
1410 LDA #'Y CLEAR TO END OF SCREEN
1411 *
1412 ** VIDEO OUTPUT ROUTINE
1413 *
1414 VOUTCH PSHS A,B,X SAVE REGISTERS
1415 LDX #VDU POINT TO VDU REGISTERS
1416 *
1417 ** CHECK FOR ESCAPE SEQUENCE
1418 *
1419 TST ESCFLG ESCAPE ACTIVE?
1420 BEQ SOROU1 BRANCH IF NOT
1421 BSR ESCAPE ELSE DO ESCAPE
1422 BRA RETURN AND RETURN
1423 *
1424 ** CHECK FOR CONTROL CHARACTERS
1425 *
1426 SOROU1 CMPA #$20 CONTROL CODES?
1427 BHS SOROU2
1428 BSR CONTRL BRANCH IF SO
1429 BRA RETURN
1430 *
1431 ** OUTPUT TEXT CHARACTER
1432 *
1433 SOROU2 STAA VDUCHR,X DISPLAY CHARACTER
1434 LBSR NEWCOL UPDATE COLUMN
1435 *
1436 ** DISPLAY CURSOR AND RETURN
1437 *
1438 RETURN PULS A,B,X,PC RESTORE REGISTERS AND RETURN
1439 *
1440 ***************************************************
1441 * CONTROL CODE HANDLERS *
1442 ***************************************************
1443 *
1444 CONTRL CMPA #$08 CTRL H - BACKSPACE ?
1445 LBEQ BACKSP
1446 CMPA #$1B ESCAPE SEQUENCE?
1447 LBEQ SETESC
1448 CMPA #$1A CTRL Z - Clear Screen
1449 LBEQ CLRSCR
1450 CMPA #$16 CTRL ^ - Home
1451 LBEQ HOME
1452 CMPA #$D CTRL M - RETURN?
1453 LBEQ CRETN
1454 CMPA #$0C CTRL L - CHAR RIGHT
1455 LBEQ CHRIGHT
1456 CMPA #$0B CTRL K - MOVE UP ONE LINE
1457 LBEQ LINEUP
1458 CMPA #$0A CTRL J - LINE FEED
1459 BNE RETESC NONE OF THESE, RETURN
1460 *
1461 ***************************************** LINE FEED
1462 *
1463 LINEFD LDD COLADX GET CURRENT COLUMN AND ROW
1464 INCB BUMP ROW
1465 CMPB #NUMLIN SCROLL TIME?
1466 LBNE NEWCUR POSITION CURSOR IF NOT
1467 LBRA SCROLL ELSE SCROLL IT
1468 *
1469 ***************************************** LINE FEED
1470 *
1471 LINEUP LDD COLADX GET CURRENT COLUMN AND ROW
1472 TSTB AT TOP OF SCREEN ?
1473 LBEQ RETESC Yes, Ignore
1474 DECB No, Decrement ROW
1475 LBRA NEWCUR POSITION CURSOR
1476 *
1477 *********************************** BACK SPACE
1478 *
1479 BACKSP LDA COLADX
1480 BEQ RETESC RETURN
1481 DECA
1482 LBRA POSCOL POSITION CURSOR
1483 *
1484 *********************************** CURSOR RIGHT
1485 *
1486 CHRIGHT LDA COLADX
1487 INCA
1488 CMPA #LINLEN
1489 LBEQ RETESC
1490 LBRA POSCOL
1491 *
1492 *********************************** CURSOR RIGHT
1493 *
1494 HOME LDD #0 HOME - POSITION TOP OF SCREEN
1495 LBRA NEWCUR
1496 *
1497 ***************************************************
1498 * ESCAPE HANDLERS *
1499 ***************************************************
1500 *
1501 ESCAPE LDAB ESCFLG GET FLAG
1502 CMPB #'= SETTING CURSOR?
1503 BEQ ESCCUR BRANCH IF SO
1504 CMPA #'Y CLEAR TO END OF SCREEN?
1505 LBEQ ESCCLS
1506 CMPA #'T CLEAR TO END OF LINE?
1507 BEQ ESCCLL
1508 CMPA #'= STARTING CURSOR SET?
1509 BNE CLRESC BRANCH IF NOT
1510 *
1511 ***************************** START ESCAPE SEQUENCE
1512 *
1513 SETESC STAA ESCFLG ELSE START CURSORING
1514 RTS AND RETURN
1515 *
1516 CLRESC CLR ESCFLG NO OTHERS SUPPORTED
1517 RETESC RTS SO RETURN
1518 *
1519 ********************************* SET SCREEN CURSOR
1520 *
1521 ESCCUR TST NEWROW ROW SET?
1522 BNE ESCCU1 BRANCH IF SO
1523 STAA NEWROW ELSE SET NEW ROW
1524 RTS AND RETURN
1525 *
1526 ESCCU1 CLR ESCFLG
1527 SUBA #$20 ADJUST COLUMN ADDRESS
1528 CMPA #LINLEN-1 CHECK FOR ACCEPTABLE COLUM
1529 BHI RETESC NOT OK, DO NOTHING
1530 *
1531 ESCCU2 LDAB NEWROW
1532 CLR NEWROW
1533 SUBB #$20 ADJUST TO ROW ADDRESS
1534 CMPB #NUMLIN-1 CHECK FOR ACCEPTABLE ROW
1535 BHI RETESC ELSE RETURN DOING NOTHING
1536 BRA NEWCUR GO SET NEW CURSOR IF SO
1537 *
1538 ****************** CLEAR FROM CURSOR TO END OF LINE
1539 CLRSCR LDD #0 CLEAR FROM TOP OF SCREEN
1540 BSR NEWCUR
1541 ESCCLL LDA COLADX
1542 LDB #$20 AND CLEAR CHAR
1543 ESCCL1 STB VDUCHR,X DISPLAY TEXT
1544 INCA
1545 STA VDUCOL,X
1546 CMPA #LINLEN UNTIL END OF LINE
1547 BNE ESCCL1
1548 CLR ESCFLG
1549 RTS
1550 *
1551 *********************************** CARRIAGE RETURN
1552 *
1553 CRETN CLRA SET COLUMN ZERO
1554 POSCOL LDB ROWADX GET CURRENT ROW
1555 *
1556 *********** GENERATE NEW CURSOR POSITION AND RETURN
1557 *
1558 NEWCUR STD COLADX SAVE NEW ROW AND COLUMN
1559 STA VDUCOL,X SET NEW COLUMN
1560 STB VDUROW,X SET NEW ROW
1561 RTS AND RETURN
1562 *
1563 ********************* UPDATE CURRENT COLUMN AND ROW
1564 *
1565 NEWCOL LDD COLADX GET ROW AND COLUMN
1566 INCA BUMP COLUMN
1567 CMPA #LINLEN ROLL?
1568 BNE NEWCUR BRANCH IF NOT
1569 CLRA ELSE RESET TO ZERO
1570 INCB AND BUMP ROW
1571 CMPB #NUMLIN
1572 BNE NEWCUR
1573 DECB BOTTOM ROW
1574 BSR NEWCUR
1575 *
1576 ********************************* SCROLL THE SCREEN
1577 *
1578 SCROLL LDB VDUOFF,X
1579 INCB
1580 CMPB #NUMLIN
1581 BLO SCROL1
1582 CLRB
1583 SCROL1 STB VDUOFF,X
1584 *
1585 **************** CLEAR FROM CURSOR TO END OF SCREEN
1586 *
1587 ESCCLS LDB COLADX GET CURSOR
1588 LDA #$20 GET A SPACE
1589 ESCCLS1 STB COLADX
1590 STB VDUCOL,X
1591 STA VDUCHR,X
1592 INCB
1593 CMPB #LINLEN
1594 BNE ESCCLS1
1595 *
1596 LDB ROWADX
1597 INCB
1598 CMPB #NUMLIN
1599 BEQ ESCCLS2
1600 STB ROWADX
1601 STB VDUROW,X
1602 CLRB
1603 BRA ESCCLS1
1604 *
1605 ESCCLS2 CLRB
1606 STB COLADX
1607 STB VDUCOL,X
1608 STB ESCFLG
1609 RTS
1610 ENDIF VDUOPT
1610 ENDIF VDUOPT
1611 *
1612 IFD DG640OPT
1613 ***************************************************
1614 * TELEVIDEO-TYPE MEMORY-MAPPED EMULATOR *
1615 * *
1616 * FOR HARD-WIRED MEMORY-MAPPED DISPLAYS USING THE *
1617 * HIGH ORDER BIT OF EACH BYTE FOR REVERSE VIDEO *
1618 * CURSORING (SUCH AS THE THOMAS INSTRUMENTATION *
1619 * 16x64 BOARD). *
1620 ***************************************************
1621
1622 ***************************************************
1623 * INITIALIZE EMULATOR *
1624 ***************************************************
1625
1626 VINIZ LDX #0
1627 STX COLADX AND ROWADX
1628 STX NEWROW AND ESCFLG
1629 LDX #SCREEN POINT TO SCREEN
1630 STX CURSOR SET PROGRAM CURSOR
1631 LDA #$1B SEND ESCAPE
1632 BSR VOUTCH
1633 LDA #'Y CLEAR TO END OF SCREEN
1634 *
1635 ** VIDEO OUTPUT ROUTINE
1636 *
1637 VOUTCH PSHS A,B,X SAVE REGISTERS
1638 *
1639 ** CLEAR CURSOR
1640 LDX CURSOR
1641 LDB 0,X
1642 ANDB #$7F
1643 STB 0,X
1644 *
1645 ** CHECK FOR ESCAPE SEQUENCE
1646 TST ESCFLG ESCAPE ACTIVE?
1647 BEQ SOROU1 BRANCH IF NOT
1648 BSR ESCAPE ELSE DO ESCAPE
1649 BRA RETURN AND RETURN
1650 *
1651 ** CHECK FOR CONTROL CHARACTERS
1652 SOROU1 CMPA #$20 CONTROL CODES?
1653 BHS SOROU2
1654 BSR CONTRL BRANCH IF SO
1655 BRA RETURN
1656 *
1657 ** OUTPUT TEXT CHARACTER
1658 SOROU2 LDX CURSOR ELSE GET CURSOR
1659 STAA 0,X DISPLAY CHARACTER
1660 LBSR NEWCOL UPDATE COLUMN
1661 *
1662 ** DISPLAY CURSOR AND RETURN
1663 RETURN LDX CURSOR AND DISPLAY IT
1664 LDB ,X
1665 ORAB #$80 WITH REVID
1666 STB ,X
1667 PULS A,B,X,PC RESTORE REGISTERS AND RETURN
1668
1669 ***************************************************
1670 * CONTROL CODE HANDLERS *
1671 ***************************************************
1672
1673 CONTRL CMPA #$08 CTRL H - BACKSPACE ?
1674 LBEQ BACKSP
1675 CMPA #$1B ESCAPE SEQUENCE?
1676 LBEQ SETESC
1677 CMPA #$D CTRL M - RETURN?
1678 LBEQ CRETN
1679 CMPA #$0A CTRL J - LINE FEED
1680 BNE RETESC NONE OF THESE, RETURN
1681
1682 ***************************************** LINE FEED
1683
1684 LINEFD LDD COLADX GET CURRENT COLUMN AND ROW
1685 INCB BUMP ROW
1686 CMPB #NUMLIN SCROLL TIME?
1687 LBNE NEWCUR POSITION CURSOR IF NOT
1688 LBRA SCROLL ELSE SCROLL IT
1689
1690 ***************************************** LINE FEED
1691
1692 LINEUP LDD COLADX GET CURRENT COLUMN AND ROW
1693 TSTB AT TOP OF SCREEN ?
1694 BEQ RETESC Yes, Ignore
1695 DECB No, Decrement ROW
1696 LBRA NEWCUR POSITION CURSOR
1697
1698
1699 *********************************** BACK SPACE
1700
1701 BACKSP LDA COLADX
1702 BEQ RETESC RETURN
1703 DECA
1704 LBRA POSCOL POSITION CURSOR
1705
1706 *********************************** CURSOR RIGHT
1707
1708 CHRIGHT LDA COLADX
1709 INCA
1710 CMPA #LINLEN
1711 BEQ RETESC
1712 LBRA POSCOL
1713
1714 ***************************************************
1715 * ESCAPE HANDLERS *
1716 ***************************************************
1717
1718 ESCAPE LDAB ESCFLG GET FLAG
1719 CMPB #'= SETTING CURSOR?
1720 BEQ ESCCUR BRANCH IF SO
1721 CMPA #'Y CLEAR TO END OF SCREEN?
1722 LBEQ ESCCLS
1723 CMPA #'T CLEAR TO END OF LINE?
1724 BEQ ESCCLL
1725 CMPA #'E INSERT LINE?
1726 BEQ ESCINL
1727 CMPA #'R DELETE LINE?
1728 BEQ ESCDLL
1729 CMPA #'= STARTING CURSOR SET?
1730 BNE CLRESC BRANCH IF NOT
1731
1732 ***************************** START ESCAPE SEQUENCE
1733
1734 SETESC STAA ESCFLG ELSE START CURSORING
1735 RTS AND RETURN
1736
1737 CLRESC CLR ESCFLG NO OTHERS SUPPORTED
1738 RETESC RTS SO RETURN
1739
1740 ********************************* SET SCREEN CURSOR
1741
1742 ESCCUR TST NEWROW ROW SET?
1743 BNE ESCCU1 BRANCH IF SO
1744 STAA NEWROW ELSE SET NEW ROW
1745 RTS AND RETURN
1746
1747 ESCCU1 CLR ESCFLG
1748 SUBA #$20 ADJUST COLUMN ADDRESS
1749 CMPA #LINLEN-1 CHECK FOR ACCEPTABLE COLUM
1750 BHI RETESC NOT OK, DO NOTHING
1751
1752 ESCCU2 LDAB NEWROW
1753 CLR NEWROW
1754 SUBB #$20 ADJUST TO ROW ADDRESS
1755 CMPB #NUMLIN-1 CHECK FOR ACCEPTABLE ROW
1756 BHI RETESC ELSE RETURN DOING NOTHING
1757 BRA NEWCUR GO SET NEW CURSOR IF SO
1758 *
1759 *************************** DELETE LINE FROM SCREEN
1760
1761 ESCDLL BSR CRETN GO COL. ZERO
1762 LDB ROWADX
1763 CMPB #NUMLIN-1
1764 BEQ SCROL3
1765 BRA SCROL1 AND DELETE THIS LINE
1766
1767 *************************** INSERT LINE INTO SCREEN
1768
1769 ESCINL BSR CRETN GO TO COL. ZERO
1770 LDAB ROWADX
1771 CMPB #NUMLIN-1
1772 BEQ ESCCLL
1773 *
1774 ** SCROLL SCREEN DOWN FROM CURSOR
1775 *
1776 LDX #SCREEN+SCNLEN-LINLEN
1777 ESCIN0 LDAA 0,-X
1778 STAA LINLEN,X
1779 LDA SCNLEN,X
1780 STA SCNLEN+LINLEN,X
1781 CPX CURSOR
1782 BNE ESCIN0
1783
1784 ****************** CLEAR FROM CURSOR TO END OF LINE
1785
1786 ESCCLL LDA COLADX GET CURRENT COLUMN
1787 LDX CURSOR GET CURSOR
1788 LDB #$20 AND CLEAR CHAR
1789 ESCLL1 STB SCNLEN,X CLEAR ATTRIBUTE
1790 STB ,X+ CLEAR TEXT
1791 INCA
1792 CMPA #LINLEN UNTIL END OF LINE
1793 BNE ESCLL1
1794 CLR ESCFLG
1795 RTS
1796
1797 *********************************** CARRIAGE RETURN
1798
1799 CRETN CLRA SET COLUMN ZERO
1800 POSCOL LDB ROWADX GET CURRENT ROW
1801
1802 *********** GENERATE NEW CURSOR POSITION AND RETURN
1803
1804 NEWCUR STD COLADX SAVE NEW ROW AND COLUMN
1805 LDA #LINLEN ELSE ADD A LINE
1806 MUL LINLEN * ROWADX
1807 ADDB COLADX
1808 ADCA #0
1809 ADDD #SCREEN ADD SCREEN BASE.
1810 STD CURSOR SAVE NEW CURSOR
1811 TFR D,X GET CURSOR IN X
1812 RTS AND RETURN
1813
1814 ********************* UPDATE CURRENT COLUMN AND ROW
1815
1816 NEWCOL LDD COLADX GET ROW AND COLUMN
1817 INCA BUMP COLUMN
1818 CMPA #LINLEN ROLL?
1819 BNE NEWCUR BRANCH IF NOT
1820 CLRA ELSE RESET TO ZERO
1821 INCB AND BUMP ROW
1822 CMPB #NUMLIN
1823 BNE NEWCUR
1824 DECB BOTTOM ROW
1825 BSR NEWCUR
1826
1827 ********************************* SCROLL THE SCREEN
1828
1829 SCROLL LDX #SCREEN POINT TO SCREEN
1830 SCROL1 LDA SCNLEN+LINLEN,X
1831 STA SCNLEN,X
1832 LDAA LINLEN,X MOVE TWO BYTES
1833 STAA 0,X+ UP ONE LINE
1834 CMPX #SCREEN+SCNLEN-LINLEN
1835 BNE SCROL1 LOOP UNTIL DONE
1836 BRA SCROL3
1837
1838 **************** CLEAR FROM CURSOR TO END OF SCREEN
1839
1840 ESCCLS LDX CURSOR GET CURSOR
1841 SCROL3 LDAA #$20 GET A SPACE
1842 SCROL2 STA SCNLEN,X CLEAR ATTRIBUTES
1843 STA ,X+ AND TEXT
1844 CMPX #SCREEN+SCNLEN
1845 BNE SCROL2 UNTIL DONE
1846 CLR ESCFLG
1847 RTS
1848 ENDIF DG640OPT
1848 ENDIF DG640OPT
1849 *
1850 IFD PRTOPT
1851 *************************************
1852 *
1853 ** PRINTER DRIVER ROUTINES
1854 *
1855 *************************************
1856 *
1857 ** PINIZ - INITIATE PRINTER PORT
1858 *
1859 PINIZ PSHS B
1860 LDD #DIRMSK*256+$04 ACCA=DIRMSK ACCB=$04
1861 STD PADATA SET DDR AND SELECT DATA
1862 *
1863 ** RESET PRINTER
1864 LDB #PRESET
1865 STAB PADATA
1866 RESTLP INCB DELAY FOR RESET
1867 BNE RESTLP
1868 STAA PADATA ACCA=DIRMSK
1869 *
1870 ** INITALIZE PORT B (DATA PORT)
1871 LDAA #$2A
1872 STAA PBCTRL
1873 LDD #$FF2E ACCA=$FF ACCB =%00101110
1874 STD PBDATA PBDREG PBCTRL
1875 *
1876 ** SELECT 66 LINES/PAGE
1877 LDAA #$1B
1878 BSR POUTCH
1879 LDAA #'C
1880 BSR POUTCH
1881 LDAA #66
1882 PULS B
1883 *************************************
1884 *
1885 ** OUTPUT A CHARACTER TO THE PRINTER
1886 *
1887 *************************************
1888 POUTCH PSHS B
1889 LDAB PBDATA CLEAR INTERRUPT BIT
1890 *
1891 ** WAIT TILL NOT BUSY
1892 BUSYLP LDAB PADATA
1893 BITB #PERROR
1894 BEQ PEXIT
1895 TSTB
1896 BMI BUSYLP
1897 *
1898 ** NOW OUTPUT CHARACTER
1899 STAA PBDATA
1900 PEXIT PULS B,PC
1901 *************************************
1902 *
1903 ** PCHK TEST IFD PRINTER READY
1904 *
1905 *************************************
1906 PCHK TST PBCTRL TEST STATE OF CRB7
1907 RTS SET ON ACKNOWLEDGE
1908 ENDIF PRTOPT
1908 ENDIF PRTOPT
1909 *************************************
1910 *
1911 * MONITOR KEYBOARD COMMAND JUMP TABLE
1912 *
1913 *************************************
1914 *
1915 FD66 JMPTAB EQU *
1916 FD66 01 FCB 1 " ^A "
1917 FD67 FB FC FDB ALTRA
1918 FD69 02 FCB 2 " ^B "
1919 FD6A FB F1 FDB ALTRB
1920 FD6C 03 FCB 3 " ^C "
1921 FD6D FC 07 FDB ALTRCC
1922 FD6F 04 FCB 4 " ^D "
1923 FD70 FB E6 FDB ALTRDP
1924 FD72 10 FCB $10 " ^P "
1925 FD73 FB B9 FDB ALTRPC
1926 FD75 15 FCB $15 " ^U "
1927 FD76 FB C5 FDB ALTRU
1928 FD78 18 FCB $18 " ^X "
1929 FD79 FB DB FDB ALTRX
1930 FD7B 19 FCB $19 " ^Y "
1931 FD7C FB D0 FDB ALTRY
1932 *
1933 FD7E 42 FCC 'B'
1934 FD7F F9 5C FDB BRKPNT
1935 FD81 45 FCC 'E'
1936 FD82 F8 FD FDB MEMDUMP
1937 FD84 47 FCC 'G'
1938 FD85 F8 A5 FDB GO
1939 FD87 4C FCC 'L'
1940 FD88 FA E6 FDB LOAD
1941 FD8A 50 FCC 'P'
1942 FD8B FB 44 FDB PUNCH
1943 FD8D 4D FCC 'M'
1944 FD8E F8 A8 FDB MEMCHG
1945 FD90 52 FCC 'R'
1946 FD91 FC 75 FDB REGSTR
1947 FD93 53 FCC 'S'
1948 FD94 F8 F1 FDB DISSTK
1949 FD96 58 FCC 'X'
1950 FD97 F9 88 FDB XBKPNT
1951 IFD MFDCOPT
1952 FD99 44 FCC 'D' *** SWTPC USES 'U' FOR MINIBOOT
1953 FD9A F9 D5 FDB MINBOOT
1954 ENDIF MFDCOPT
1955 IFD CF8OPT
1956 FCC 'D' *** FPGA 8 BIT USES 'D' FOR CFBOOT
1957 FDB CFBOOT
1958 ENDIF CF8OPT
1958 ENDIF CF8OPT
1959 IFD IDEOPT
1960 FCC 'D' *** XESS FPGA 16 BIT IDE USES 'D' FOR IDEBOOT
1961 FDB IDEBOOT
1962 ENDIF IDEOPT
1962 ENDIF IDEOPT
1963 IFD DMAFOPT
1964 FD9C 55 FCC 'U' *** SWTPC USES 'D' FOR DMAF2 BOOT
1965 FD9D FA 29 FDB DBOOT
1966 ENDIF DMAFOPT
1967 IFD EXTOPT
1968 FCC 'U' *** IF FPGA, 'U' IS FOR USER
1969 FDB USRCMD
1970 ENDIF EXTOPT
1970 ENDIF EXTOPT
1971 IFD RTCOPT
1972 FCC 'T'
1973 FDB TIMSET
1974 ENDIF RTCOPT
1974 ENDIF RTCOPT
1975 IFD TRAOPT
1976 FCC "T"
1977 FDB TRACE
1978 ENDIF TRAOPT
1978 ENDIF TRAOPT
1979 *
1980 FD9F TABEND EQU *
1981 *
1982 * ** 6809 VECTOR ADDRESSES **
1983 *
1984 * FOLLOWING ARE THE ADDRESSES OF THE VECTOR ROUTINES
1985 * FOR THE 6809 PROCESSOR. DURING INITIALIZATION THEY
1986 * ARE RELOCATED TO RAM FROM $DFC0 TO $DFCF. THEY ARE
1987 * RELOCATED TO RAM SO THAT THE USER MAY REVECTOR TO
1988 * HIS OWN ROUTINES IF HE SO DESIRES.
1989 *
1990 *
1991 FD9F F9 94 RAMVEC FDB SWIE USER-V
1992 FDA1 F8 A7 FDB RTI SWI3-V
1993 FDA3 F8 A7 FDB RTI SWI2-V
1994 FDA5 F8 A7 FDB RTI FIRQ-V
1995 FDA7 F8 A7 FDB RTI IRQ-V
1996 FDA9 F9 94 FDB SWIE SWI-V
1997 FDAB FF FF FDB $FFFF SVC-VO
1998 FDAD FF FF FDB $FFFF SVC-VL
1999 *
2000 * PRINTABLE MESSAGE STRINGS
2001 *
2002 FDAF 0D 0A 00 00 00 MSG1 FCB $D,$A,$0,$0,$0 * 0, CR/LF, 0
2003 FDB4 53 59 53 30 39 42 FCC 'SYS09BUG 1.4 FOR '
55 47 20 31 2E 34
20 46 4F 52 20
2004 IFD S3EOPT
2005 FCC 'S3E '
2006 ENDIF S3EOPT
2006 ENDIF S3EOPT
2007 IFD B5XOPT
2008 FCC 'B5-X300 '
2009 ENDIF B5XOPT
2009 ENDIF B5XOPT
2010 IFD S3SOPT
2011 FCC 'S3STARTER '
2012 ENDIF S3SOPT
2012 ENDIF S3SOPT
2013 IFD ADSOPT
2014 FCC 'ADS6809 '
2015 ENDIF ADSOPT
2015 ENDIF ADSOPT
2016 IFD SWTOPT`
2017 FDC5 53 57 54 50 43 20 FCC 'SWTPC '
2018 ENDIF SWTOPT
2019 IFD XESOPT`
2020 FCC 'XESS '
2021 ENDIF XESOPT
2021 ENDIF XESOPT
2022 FDCB 20 2D 20 FCC ' - '
2023 FDCE 04 FCB 4
2024 FDCF 4B 0D 0A 00 00 00 MSG2 FCB 'K,$D,$A,$00,$00,$00,$04 K, * CR/LF + 3 NULS
04
2025 FDD6 3E MSG3 FCC '>'
2026 FDD7 04 FCB 4
2027 FDD8 57 48 41 54 3F MSG4 FCC 'WHAT?'
2028 FDDD 04 FCB 4
2029 FDDE 20 2D 20 MSG5 FCC ' - '
2030 FDE1 04 FCB 4'
2031 FDE2 20 20 53 50 3D MSG10 FCC ' SP='
2032 FDE7 04 FCB 4
2033 FDE8 20 20 50 43 3D MSG11 FCC ' PC='
2034 FDED 04 FCB 4
2035 FDEE 20 20 55 53 3D MSG12 FCC ' US='
2036 FDF3 04 FCB 4
2037 FDF4 20 20 49 59 3D MSG13 FCC ' IY='
2038 FDF9 04 FCB 4
2039 FDFA 20 20 49 58 3D MSG14 FCC ' IX='
2040 FDFF 04 FCB 4
2041 FE00 20 20 44 50 3D MSG15 FCC ' DP='
2042 FE05 04 FCB 4
2043 FE06 20 20 41 3D MSG16 FCC ' A='
2044 FE0A 04 FCB 4
2045 FE0B 20 20 42 3D MSG17 FCC ' B='
2046 FE0F 04 FCB 4
2047 FE10 20 20 43 43 3A 20 MSG18 FCC ' CC: '
2048 FE16 04 FCB 4
2049 FE17 45 46 48 49 4E 5A MSG19 FCC 'EFHINZVC'
56 43
2050 FE1F 53 31 MSG20 FCC 'S1'
2051 FE21 04 FCB 4
2052 IFD DATOPT
2053 *
2054 * POWER UP/ RESET/ NMI ENTRY POINT
2055 *
2056 FF00 ORG $FF00
2057 *
2058 *
2059 FF00 8E FF F0 START LDX #IC11 POINT TO DAT RAM IC11
2060 FF03 86 0F LDA #$F GET COMPLIMENT OF ZERO
2061 *
2062 *
2063 * INITIALIZE DAT RAM --- LOADS $F-$0 IN LOCATIONS $0-$F
2064 * OF DAT RAM, THUS STORING COMPLEMENT OF MSB OF ADDRESS
2065 * IN THE DAT RAM. THE COMPLEMENT IS REQUIRED BECAUSE THE
2066 * OUTPUT OF IC11, A 74S189, IS THE INVERSE OF THE DATA
2067 * STORED IN IT.
2068 *
2069 *
2070 FF05 A7 80 DATLP STA ,X+ STORE & POINT TO NEXT RAM LOCATION
2071 FF07 4A DECA GET COMP. VALUE FOR NEXT LOCATION
2072 FF08 26 FB BNE DATLP ALL 16 LOCATIONS INITIALIZED ?
2073 *
2074 * NOTE: IX NOW CONTAINS $0000, DAT RAM IS NO LONGER
2075 * ADDRESSED, AND LOGICAL ADDRESSES NOW EQUAL
2076 * PHYSICAL ADDRESSES.
2077 *
2078 FF0A 86 F0 LDA #$F0
2079 FF0C A7 84 STA ,X STORE $F0 AT $FFFF
2080 FF0E 8E D0 A0 LDX #$D0A0 ASSUME RAM TO BE AT $D000-$DFFF
2081 FF11 10 8E 55 AA LDY #TSTPAT LOAD TEST DATA PATTERN INTO "Y"
2082 FF15 EE 84 TSTRAM LDU ,X SAVE DATA FROM TEST LOCATION
2083 FF17 10 AF 84 STY ,X STORE TEST PATTERN AT $D0A0
2084 FF1A 10 AC 84 CMPY ,X IS THERE RAM AT THIS LOCATION ?
2085 FF1D 27 0B BEQ CNVADR IF MATCH THERE'S RAM, SO SKIP
2086 FF1F 30 89 F0 00 LEAX -$1000,X ELSE POINT 4K LOWER
2087 FF23 8C F0 A0 CMPX #$F0A0 DECREMENTED PAST ZER0 YET ?
2088 FF26 26 ED BNE TSTRAM IF NOT CONTINUE TESTING FOR RAM
2089 FF28 20 D6 BRA START ELSE START ALL OVER AGAIN
2090 *
2091 *
2092 * THE FOLLOWING CODE STORES THE COMPLEMENT OF
2093 * THE MS CHARACTER OF THE FOUR CHARACTER HEX
2094 * ADDRESS OF THE FIRST 4K BLOCK OF RAM LOCATED
2095 * BY THE ROUTINE "TSTRAM" INTO THE DAT RAM. IT
2096 * IS STORED IN RAM IN THE LOCATION THAT IS
2097 * ADDRESSED WHEN THE PROCESSOR ADDRESS IS $D---,
2098 * THUS IF THE FIRST 4K BLOCK OF RAM IS FOUND
2099 * WHEN TESTING LOCATION $70A0, MEANING THERE
2100 * IS NO RAM PHYSICALLY ADDRESSED IN THE RANGE
2101 * $8000-$DFFF, THEN THE COMPLEMENT OF THE
2102 * "7" IN THE $70A0 WILL BE STORED IN
2103 * THE DAT RAM. THUS WHEN THE PROCESSOR OUTPUTS
2104 * AN ADDRESS OF $D---, THE DAT RAM WILL RESPOND
2105 * BY RECOMPLEMENTING THE "7" AND OUTPUTTING THE
2106 * 7 ONTO THE A12-A15 ADDRESS LINES. THUS THE
2107 * RAM THAT IS PHYSICALLY ADDRESSED AT $7---
2108 * WILL RESPOND AND APPEAR TO THE 6809 THAT IT
2109 * IS AT $D--- SINCE THAT IS THE ADDRESS THE
2110 * 6809 WILL BE OUTPUTING WHEN THAT 4K BLOCK
2111 * OF RAM RESPONDS.
2112 *
2113 *
2114 FF2A EF 84 CNVADR STU ,X RESTORE DATA AT TEST LOCATION
2115 FF2C 1F 10 TFR X,D PUT ADDR. OF PRESENT 4K BLOCK IN D
2116 FF2E 43 COMA COMPLEMENT MSB OF THAT ADDRESS
2117 FF2F 44 LSRA PUT MS 4 BITS OF ADDRESS IN
2118 FF30 44 LSRA LOCATION D0-D3 TO ALLOW STORING
2119 FF31 44 LSRA IT IN THE DYNAMIC ADDRESS
2120 FF32 44 LSRA TRANSLATION RAM.
2121 FF33 B7 FF FD STA $FFFD STORE XLATION FACTOR IN DAT "D"
2122 *
2123 FF36 10 CE DF C0 LDS #STACK INITIALIZE STACK POINTER
2124 *
2125 *
2126 * THE FOLLOWING CHECKS TO FIND THE REAL PHYSICAL ADDRESSES
2127 * OF ALL 4K BLKS OF RAM IN THE SYSTEM. WHEN EACH 4K BLK
2128 * OF RAM IS LOCATED, THE COMPLEMENT OF IT'S REAL ADDRESS
2129 * IS THEN STORED IN A "LOGICAL" TO "REAL" ADDRESS XLATION
2130 * TABLE THAT IS BUILT FROM $DFD0 TO $DFDF. FOR EXAMPLE IF
2131 * THE SYSTEM HAS RAM THAT IS PHYSICALLY LOCATED (WIRED TO
2132 * RESPOND) AT THE HEX LOCATIONS $0--- THRU $F---....
2133 *
2134 * 0 1 2 3 4 5 6 7 8 9 A B C D E F
2135 * 4K 4K 4K 4K 4K 4K 4K 4K -- 4K 4K 4K 4K -- -- --
2136 *
2137 * ....FOR A TOTAL OF 48K OF RAM, THEN THE TRANSLATION TABLE
2138 * CREATED FROM $DFD0 TO $DFDF WILL CONSIST OF THE FOLLOWING....
2139 *
2140 * 0 1 2 3 4 5 6 7 8 9 A B C D E F
2141 * 0F 0E 0D 0C 0B 0A 09 08 06 05 00 00 04 03 F1 F0
2142 *
2143 *
2144 * HERE WE SEE THE LOGICAL ADDRESSES OF MEMORY FROM $0000-$7FFF
2145 * HAVE NOT BEEN SELECTED FOR RELOCATION SO THAT THEIR PHYSICAL
2146 * ADDRESS WILL = THEIR LOGICAL ADDRESS; HOWEVER, THE 4K BLOCK
2147 * PHYSICALLY AT $9000 WILL HAVE ITS ADDRESS TRANSLATED SO THAT
2148 * IT WILL LOGICALLY RESPOND AT $8000. LIKEWISE $A,$B, AND $C000
2149 * WILL BE TRANSLATED TO RESPOND TO $9000,$C000, AND $D000
2150 * RESPECTIVELY. THE USER SYSTEM WILL LOGICALLY APPEAR TO HAVE
2151 * MEMORY ADDRESSED AS FOLLOWS....
2152 *
2153 * 0 1 2 3 4 5 6 7 8 9 A B C D E F
2154 * 4K 4K 4K 4K 4K 4K 4K 4K 4K 4K -- -- 4K 4K -- --
2155 *
2156 *
2157 FF3A 10 8E DF D0 LDY #LRARAM POINT TO LOGICAL/REAL ADDR. TABLE
2158 FF3E A7 2D STA 13,Y STORE $D--- XLATION FACTOR AT $DFDD
2159 FF40 6F 2E CLR 14,Y CLEAR $DFDE
2160 FF42 86 F0 LDA #$F0 DESTINED FOR IC8 AN MEM EXPANSION ?
2161 FF44 A7 2F STA 15,Y STORE AT $DFDF
2162 FF46 86 0C LDA #$0C PRESET NUMBER OF BYTES TO CLEAR
2163 FF48 6F A6 CLRLRT CLR A,Y CLEAR $DFDC THRU $DFD0
2164 FF4A 4A DECA SUB. 1 FROM BYTES LEFT TO CLEAR
2165 FF4B 2A FB BPL CLRLRT CONTINUE IF NOT DONE CLEARING
2166 FF4D 30 89 F0 00 FNDRAM LEAX -$1000,X POINT TO NEXT LOWER 4K OF RAM
2167 FF51 8C F0 A0 CMPX #$F0A0 TEST FOR DECREMENT PAST ZERO
2168 FF54 27 22 BEQ FINTAB SKIP IF FINISHED
2169 FF56 EE 84 LDU ,X SAVE DATA AT CURRENT TEST LOCATION
2170 FF58 10 8E 55 AA LDY #TSTPAT LOAD TEST DATA PATTERN INTO Y REG.
2171 FF5C 10 AF 84 STY ,X STORE TEST PATT. INTO RAM TEST LOC.
2172 FF5F 10 AC 84 CMPY ,X VERIFY RAM AT TEST LOCATION
2173 FF62 26 E9 BNE FNDRAM IF NO RAM GO LOOK 4K LOWER
2174 FF64 EF 84 STU ,X ELSE RESTORE DATA TO TEST LOCATION
2175 FF66 10 8E DF D0 LDY #LRARAM POINT TO LOGICAL/REAL ADDR. TABLE
2176 FF6A 1F 10 TFR X,D PUT ADDR. OF PRESENT 4K BLOCK IN D
2177 FF6C 44 LSRA PUT MS 4 BITS OF ADDR. IN LOC. D0-D3
2178 FF6D 44 LSRA TO ALLOW STORING IT IN THE DAT RAM.
2179 FF6E 44 LSRA
2180 FF6F 44 LSRA
2181 FF70 1F 89 TFR A,B SAVE OFFSET INTO LRARAM TABLE
2182 FF72 88 0F EORA #$0F INVERT MSB OF ADDR. OF CURRENT 4K BLK
2183 FF74 A7 A5 STA B,Y SAVE TRANSLATION FACTOR IN LRARAM TABLE
2184 FF76 20 D5 BRA FNDRAM GO TRANSLATE ADDR. OF NEXT 4K BLK
2185 FF78 86 F1 FINTAB LDA #$F1 DESTINED FOR IC8 AND MEM EXPANSION ?
2186 FF7A 10 8E DF D0 LDY #LRARAM POINT TO LRARAM TABLE
2187 FF7E A7 2E STA 14,Y STORE $F1 AT $DFCE
2188 *
2189 * THE FOLLOWING CHECKS TO SEE IF THERE IS A 4K BLK OF
2190 * RAM LOCATED AT $C000-$CFFF. IF NONE THERE IT LOCATES
2191 * THE NEXT LOWER 4K BLK AN XLATES ITS ADDR SO IT
2192 * LOGICALLY RESPONDS TO THE ADDRESS $C---.
2193 *
2194 *
2195 FF80 86 0C LDA #$0C PRESET NUMBER HEX "C"
2196 FF82 E6 A6 FINDC LDB A,Y GET ENTRY FROM LRARAM TABLE
2197 FF84 26 05 BNE FOUNDC BRANCH IF RAM THIS PHYSICAL ADDR.
2198 FF86 4A DECA ELSE POINT 4K LOWER
2199 FF87 2A F9 BPL FINDC GO TRY AGAIN
2200 FF89 20 14 BRA XFERTF
2201 FF8B 6F A6 FOUNDC CLR A,Y CLR XLATION FACTOR OF 4K BLOCK FOUND
2202 FF8D E7 2C STB $C,Y GIVE IT XLATION FACTOR MOVING IT TO $C---
2203 *
2204 * THE FOLLOWING CODE ADJUSTS THE TRANSLATION
2205 * FACTORS SUCH THAT ALL REMAINING RAM WILL
2206 * RESPOND TO A CONTIGUOUS BLOCK OF LOGICAL
2207 * ADDRESSES FROM $0000 AND UP....
2208 *
2209 FF8F 4F CLRA START AT ZERO
2210 FF90 1F 21 TFR Y,X START POINTER "X" START OF "LRARAM" TABLE.
2211 FF92 E6 A6 COMPRS LDB A,Y GET ENTRY FROM "LRARAM" TABLE
2212 FF94 27 04 BEQ PNTNXT IF IT'S ZER0 SKIP
2213 FF96 6F A6 CLR A,Y ELSE ERASE FROM TABLE
2214 FF98 E7 80 STB ,X+ AND ENTER ABOVE LAST ENTRY- BUMP
2215 FF9A 4C PNTNXT INCA GET OFFSET TO NEXT ENTRY
2216 FF9B 81 0C CMPA #$0C LAST ENTRY YET ?
2217 FF9D 2D F3 BLT COMPRS
2218 *
2219 * THE FOLLOWING CODE TRANSFER THE TRANSLATION
2220 * FACTORS FROM THE LRARAM TABLE TO IC11 ON
2221 * THE MP-09 CPU CARD.
2222 *
2223 FF9F 8E FF F0 XFERTF LDX #IC11 POINT TO DAT RAM IC11
2224 FFA2 C6 10 LDB #$10 GET NO. OF BYTES TO MOVE
2225 FFA4 A6 A0 FETCH LDA ,Y+ GET BYTE AND POINT TO NEXT
2226 FFA6 A7 80 STA ,X+ POKE XLATION FACTOR IN IC11
2227 FFA8 5A DECB SUB 1 FROM BYTES TO MOVE
2228 FFA9 26 F9 BNE FETCH CONTINUE UNTIL 16 MOVED
2229 *
2230 ELSE
2231 LRA RTS
2232 START LDS #STACK INITIALIZE STACK POINTER
2233 CLRB
2234 ENDIF DATOPT
2234 ENDIF DATOPT
2235 *
2236 FFAB 53 COMB SET "B" NON-ZERO
2237 FFAC F7 DF E2 STB ECHO TURN ON ECHO FLAG
2238 FFAF 16 F8 62 LBRA MONITOR INITIALIZATION IS COMPLETE
2239 *
2240 ** INTERRUPT JUMP VECTORS
2241 *
2242 FFB2 6E 9F DF C0 V1 JMP [STACK]
2243 FFB6 6E 9F DF C4 V2 JMP [SWI2]
2244 FFBA 6E 9F DF C6 V3 JMP [FIRQ]
2245 FFBE 6E 9F DF C8 V4 JMP [IRQ]
2246 FFC2 6E 9F DF CA V5 JMP [SWI]
2247 *
2248 * SWI3 ENTRY POINT
2249 *
2250 FFC6 1F 43 SWI3E TFR S,U
2251 FFC8 AE 4A LDX 10,U *$FFC8
2252 FFCA E6 80 LDB ,X+
2253 FFCC AF 4A STX 10,U
2254 FFCE 4F CLRA
2255 FFCF 58 ASLB
2256 FFD0 49 ROLA
2257 FFD1 BE DF CC LDX SVCVO
2258 FFD4 8C FF FF CMPX #$FFFF
2259 FFD7 27 0F BEQ SWI3Z
2260 FFD9 30 8B LEAX D,X
2261 FFDB BC DF CE CMPX SVCVL
2262 FFDE 22 08 BHI SWI3Z
2263 FFE0 34 10 PSHS X
2264 FFE2 EC C4 LDD ,U
2265 FFE4 AE 44 LDX 4,U
2266 FFE6 6E F1 JMP [,S++]
2267 FFE8 37 1F SWI3Z PULU A,B,X,CC,DP
2268 FFEA EE 42 LDU 2,U
2269 FFEC 6E 9F DF C2 JMP [SWI3]
2270 *
2271 * 6809 VECTORS
2272 *
2273 FFF0 ORG $FFF0
2274 FFF0 FF B2 FDB V1 USER-V
2275 FFF2 FF C6 FDB SWI3E SWI3-V
2276 FFF4 FF B6 FDB V2 SWI2-V
2277 FFF6 FF BA FDB V3 FIRQ-V
2278 FFF8 FF BE FDB V4 IRQ-V
2279 FFFA FF C2 FDB V5 SWI-V
2280 FFFC FF B2 FDB V1 NMI-V
2281 FFFE FF 00 FDB START RESTART-V
0004 END START
0005 END
Program + Init Data = 1826 bytes
Error count = 0
Go to most recent revision | Compare with Previous | Blame | View Log