URL
https://opencores.org/ocsvn/System09/System09/trunk
Subversion Repositories System09
[/] [System09/] [tags/] [pre_mkfiles_rev1_merge/] [src/] [sys09bug/] [sys09s3e.lst] - Rev 187
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 SPARTAN 3E STARTER
0000 INCLUDE "opt_s3e.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 00FF 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 *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 7FC0 MONRAM EQU $7FC0
0008 ELSE
0009 MONRAM EQU $DFC0 STACK SPACE
0010 ENDIF S3EOPT
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 00FF ACIAOPT EQU $FF ACIA AT PORT 0
0027 00FF PS2OPT EQU $FF PS2 KEYBOARD AT $E020
0028 00FF VDUOPT EQU $FF VDU AT $E030
0029 00FF TRAOPT EQU $FF PIA TRACE TIMER
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 ACIAOPT EQU $FF ACIA AT PORT 0
0082 DMAFOPT EQU $FF DMAF2 8" FLOPPY DISK BOOT
0083 MFDCOPT EQU $FF MINIFLOPPY 5.25" DISK BOOT
0084 DATOPT EQU $FF DYNAMIC ADDRESS TRANSLATION
0085 ENDIF
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 DRVFDC EQU MONIO+$14
0107 CMDFDC EQU MONIO+$18
0108 SECFDC EQU MONIO+$1A
0109 DATFDC EQU MONIO+$1B
0110 ENDIF MFDCOPT
0110 ENDIF MFDCOPT
0111 IFD PS2OPT
0112 *
0113 ***************************************************
0114 * VDU8 PS/2 KEYBOARD PORT *
0115 ***************************************************
0116 *
0117 ** KEYBOARD SITS ON PORT 2
0118 *
0119 E020 PS2KBD EQU MONIO+$20 PS/2 KEYBOARD PORT
0120 ENDIF PS2OPT
0121 IFD VDUOPT
0122 *
0123 ***************************************************
0124 * VDU8 DISPLAY DRIVER EQUATES *
0125 ***************************************************
0126 *
0127 ** VDU8 DISPLAY SITS ON PORT 3
0128 *
0129 E030 VDU EQU MONIO+$30
0130 0000 VDUCHR EQU 0 CHARACTER REGISTER
0131 0001 VDUATT EQU 1 ATTRIBUTE REGISTER
0132 0002 VDUCOL EQU 2 CURSOR COLUMN
0133 0003 VDUROW EQU 3 CURSOR ROW
0134 0004 VDUOFF EQU 4 ROW OFFSET
0135 *
0136 0050 LINLEN EQU 80 LENGTH OF A LINE
0137 0019 NUMLIN EQU 25 NUMBER OF LINES
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 E070 TADATA EQU MONIO+$70 Timer preset port
0333 E071 TACTRL EQU MONIO+$71
0334 E072 TBDATA EQU MONIO+$72 Timer read back port
0335 E073 TBCTRL EQU MONIO+$73
0336 *
0337 000D TRADEL EQU 13 Number of E cycles for RTI (May need to be fudged)
0338 *
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 ADDREG EQU $F000 ADDRESS REGISTER
0397 CNTREG EQU $F002 COUNT REGISTER
0398 CCREG EQU $F010 CHANNEL CONTROL REGISTER
0399 PRIREG EQU $F014 DMA PRIORITY REGISTER
0400 AAAREG EQU $F015 ???
0401 BBBREG EQU $F016 ???
0402 COMREG EQU $F020 1791 COMMAND REGISTER
0403 SECREG EQU $F022 SECTOR REGISTER
0404 DRVREG EQU $F024 DRIVE SELECT LATCH
0405 CCCREG EQU $F040 ???
0406 ENDIF DMAFOPT
0406 ENDIF DMAFOPT
0407 IFD DATOPT
0408 **************************************************
0409 * DYNAMIC ADDRESS TRANSLATION REGISTERS *
0410 **************************************************
0411 *
0412 IC11 EQU $FFF0 DAT RAM CHIP
0413 TSTPAT EQU $55AA TEST PATTERN
0414 ENDIF DATOPT
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 7FC0 ORG MONRAM
0088 7FC0 STACK EQU * TOP OF INTERNAL STACK
0089 7FC0 NMI RMB 2 USER NMI VECTOR
0090 7FC2 SWI3 RMB 2 SOFTWARE INTERRUPT VECTOR #3
0091 7FC4 SWI2 RMB 2 SOFTWARE INTERRUPT VECTOR #2
0092 7FC6 FIRQ RMB 2 FAST INTERRUPT VECTOR
0093 7FC8 IRQ RMB 2 INTERRUPT VECTOR
0094 7FCA SWI RMB 2 SOFTWARE INTERRUPT VECTOR
0095 7FCC SVCVO RMB 2 SUPERVISOR CALL VECTOR ORGIN
0096 7FCE SVCVL RMB 2 SUPERVISOR CALL VECTOR LIMIT
0097 IFD DATOPT
0098 LRARAM RMB 16 LRA ADDRESSES
0099 ENDIF DATOPT
0099 ENDIF DATOPT
0100 7FD0 CPORT RMB 2 RE-VECTORABLE CONTROL PORT
0101 7FD2 ECHO RMB 1 ECHO FLAG
0102 7FD3 BPTBL RMB 24 BREAKPOINT TABLE BASE ADDR
0103 IFD TRAOPT
0104 7FEB NMISAV RMB 2 NMI Jump Vector Backup
0105 7FED TRACNT RMB 2 Trace Count
0106 ENDIF TRAOPT
0107 IFD VDUOPT
0108 *
0109 **************************************************
0110 * VDU8 DISPLAY DRIVER VARIABLES *
0111 **************************************************
0112 *
0113 **** ALWAYS KEEP COLADX AND ROWADX TOGETHER ******
0114 7FEF COLADX RMB 1 CURSOR COLUMN
0115 7FF0 ROWADX RMB 1 CURSOR ROW
0116 **************************************************
0117 *
0118 7FF1 NEWROW RMB 1 NEW ROW TEMP FOR ESCAPE
0119 7FF2 ESCFLG RMB 1 ESCAPE SEQUENCE ACTIVE
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 4B FDB NEXTCMD
0144 F804 FC 90 FDB INCH
0145 F806 FC 8A FDB INCHE
0146 F808 FC A8 FDB INCHEK
0147 F80A FC BD FDB OUTCH
0148 F80C FB 82 FDB PDATA
0149 F80E FB 11 FDB PCRLF
0150 F810 FB 0D FDB PSTRNG
0151 F812 FE E1 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 FE 60 MONITOR LDX #RAMVEC POINT TO VECTOR ADDR. STRING
0169 F817 10 8E 7F 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 7F D0 STX CPORT STORE ADDR. IN RAM
0188 F82A 17 01 45 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 04 8E LBSR IOINIZ INITIALIZE CONTROL PORT
0199 F842 8E FE 70 LDX #MSG1 POINT TO MONITOR MESSAGE
0200 F845 17 03 3A LBSR PDATA PRINT MSG
0201 *
0202 IFD DATOPT
0203 LDX #LRARAM POINT TO LRA RAM STORAGE AREA
0204 CLRA START TOTAL AT ZERO
0205 LDB #13 TOTAL UP ALL ACTIVE RAM MEMORY
0206 FNDREL TST B,X TEST FOR RAM AT NEXT LOC.
0207 BEQ RELPAS IF NO RAM GO TO NEXT LOC.
0208 ADDA #4 ELSE ADD 4K TO TOTAL
0209 DAA ADJ. TOTAL FOR DECIMAL
0210 RELPAS DECB SUB. 1 FROM LOCS. TO TEST
0211 BPL FNDREL PRINT TOTAL OF RAM
0212 LBSR OUT2H OUTPUT HEX BYTE AS ASCII
0213 LDX #MSG2 POINT TO MSG 'K' CR/LF + 3 NULS
0214 LBSR PDATA PRINT MSG
0215 ENDIF DATOPT
0215 ENDIF DATOPT
0216 *
0217 IFD TRAOPT
0218 F848 17 01 DE LBSR TRAINZ
0219 ENDIF TRAOPT
0220 *
0221 ***** NEXTCMD *****
0222 *
0223 F84B 8E FE 95 NEXTCMD LDX #MSG3 POINT TO MSG ">"
0224 F84E 17 02 BC LBSR PSTRNG PRINT MSG
0225 F851 17 04 3C LBSR INCH GET ONE CHAR. FROM TERMINAL
0226 F854 84 7F ANDA #$7F STRIP PARITY FROM CHAR.
0227 F856 81 0D CMPA #$0D IS IT CARRIAGE RETURN ?
0228 F858 27 F1 BEQ NEXTCMD IF CR THEN GET ANOTHER CHAR.
0229 F85A 1F 89 TFR A,B PUT CHAR. IN "B" ACCUM.
0230 F85C 81 20 CMPA #$20 IS IT CONTROL OR DATA CHAR ?
0231 F85E 2C 09 BGE PRTCMD IF CMD CHAR IS DATA, PRNT IT
0232 F860 86 5E LDA #'^ ELSE CNTRL CHAR CMD SO...
0233 F862 17 04 58 LBSR OUTCH PRINT "^"
0234 F865 1F 98 TFR B,A RECALL CNTRL CMD CHAR
0235 F867 8B 40 ADDA #$40 CONVERT IT TO ASCII LETTER
0236 F869 17 04 51 PRTCMD LBSR OUTCH PRNT CMD CHAR
0237 F86C 17 04 4C LBSR OUT1S PRNT SPACE
0238 F86F C1 60 CMPB #$60
0239 F871 2F 02 BLE NXTCH0
0240 F873 C0 20 SUBB #$20
0241 *
0242 ***** DO TABLE LOOKUP *****
0243 * FOR COMMAND FUNCTIONS
0244 *
0245 F875 8E FE 2A NXTCH0 LDX #JMPTAB POINT TO JUMP TABLE
0246 F878 E1 80 NXTCHR CMPB ,X+ DOES COMMAND MATCH TABLE ENTRY ?
0247 F87A 27 0F BEQ JMPCMD BRANCH IF MATCH FOUND
0248 F87C 30 02 LEAX 2,X POINT TO NEXT ENTRY IN TABLE
0249 F87E 8C FE 60 CMPX #TABEND REACHED END OF TABLE YET ?
0250 F881 26 F5 BNE NXTCHR IF NOT END, CHECK NEXT ENTRY
0251 F883 8E FE 97 LDX #MSG4 POINT TO MSG "WHAT?"
0252 F886 17 02 F9 LBSR PDATA PRINT MSG
0253 F889 20 C0 BRA NEXTCMD IF NO MATCH, PRMPT FOR NEW CMD
0254 F88B AD 94 JMPCMD JSR [,X] JUMP TO COMMAND ROUTINE
0255 F88D 20 BC BRA NEXTCMD PROMPT FOR NEW COMMAND
0256 *
0257 * "G" GO OR CONTINUE
0258 *
0259 F88F 1F 34 GO TFR U,S
0260 F891 3B RTI RTI
0261 *
0262 ***** "M" MEMORY EXAMINE AND CHANGE *****
0263 *
0264 F892 17 03 74 MEMCHG LBSR IN1ADR INPUT ADDRESS
0265 F895 29 2D BVS CHRTN IF NOT HEX, RETURN
0266 F897 1F 12 TFR X,Y SAVE ADDR IN "Y"
0267 F899 8E FE 9D MEMC2 LDX #MSG5 POINT TO MSG " - "
0268 F89C 17 02 6E LBSR PSTRNG PRINT MSG
0269 F89F 1F 21 TFR Y,X FETCH ADDRESS
0270 F8A1 17 03 AE LBSR OUT4H PRINT ADDR IN HEX
0271 F8A4 17 04 14 LBSR OUT1S OUTPUT SPACE
0272 F8A7 A6 A4 LDA ,Y GET CONTENTS OF CURRENT ADDR.
0273 F8A9 17 03 AE LBSR OUT2H OUTPUT CONTENTS IN ASCII
0274 F8AC 17 04 0C LBSR OUT1S OUTPUT SPACE
0275 F8AF 17 03 67 LBSR BYTE LOOP WAITING FOR OPERATOR INPUT
0276 F8B2 28 11 BVC CHANGE IF VALID HEX GO CHANGE MEM. LOC.
0277 F8B4 81 08 CMPA #8 IS IT A BACKSPACE (CNTRL H)?
0278 F8B6 27 E1 BEQ MEMC2 PROMPT OPERATOR AGAIN
0279 F8B8 81 18 CMPA #$18 IS IT A CANCEL (CNTRL X)?
0280 F8BA 27 DD BEQ MEMC2 PROMPT OPERATOR AGAIN
0281 F8BC 81 5E CMPA #'^ IS IT AN UP ARROW?
0282 F8BE 27 17 BEQ BACK DISPLAY PREVIOUS BYTE
0283 F8C0 81 0D CMPA #$D IS IT A CR?
0284 F8C2 26 0F BNE FORWRD DISPLAY NEXT BYTE
0285 F8C4 39 CHRTN RTS EXIT ROUTINE
0286 *
0287 *
0288 F8C5 A7 A4 CHANGE STA ,Y CHANGE BYTE IN MEMORY
0289 F8C7 A1 A4 CMPA ,Y DID MEMORY BYTE CHANGE?
0290 F8C9 27 08 BEQ FORWRD $F972
0291 F8CB 17 03 ED LBSR OUT1S OUTPUT SPACE
0292 F8CE 86 3F LDA #'? LOAD QUESTION MARK
0293 F8D0 17 03 EA LBSR OUTCH PRINT IT
0294 F8D3 31 21 FORWRD LEAY 1,Y POINT TO NEXT HIGHER MEM LOCATION
0295 F8D5 20 C2 BRA MEMC2 PRINT LOCATION & CONTENTS
0296 F8D7 31 3F BACK LEAY -1,Y POINT TO LAST MEM LOCATION
0297 F8D9 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 F8DB 17 02 AB DISSTK LBSR PRTSP PRINT CURRENT STACK POINTER
0304 F8DE 1F 32 TFR U,Y
0305 F8E0 8E 7F C0 LDX #STACK LOAD INTERNAL STACK AS UPPER LIMIT
0306 F8E3 30 1F LEAX -1,X POINT TO CURRENT STACK
0307 F8E5 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 F8E7 17 03 14 MEMDUMP LBSR IN2ADR INPUT ADDRESS BOUNDRIES
0315 F8EA 29 06 BVS EDPRTN NEW COMMAND IF ILLEGAL HEX
0316 F8EC 34 20 MDUMP1 PSHS Y COMPARE LOWER TO UPPER BOUNDS
0317 F8EE AC E1 CMPX ,S++ LOWER BOUNDS > UPPER BOUNDS?
0318 F8F0 24 01 BCC AJDUMP IF NOT, DUMP HEX AND ASCII
0319 F8F2 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 F8F3 1F 10 AJDUMP TFR X,D GET UPPER ADDR IN D-REG
0334 F8F5 C3 00 10 ADDD #$10 ADD 16 TO UPPER ADDRESS
0335 F8F8 C4 F0 ANDB #$F0 MASK TO EVEN 16 BYTE BOUNDRY
0336 F8FA 34 06 PSHS A,B SAVE ON STACK AS UPPER DUMP LIMIT
0337 F8FC 1F 20 TFR Y,D $F9A5 GET LOWER ADDRESS IN D-REG
0338 F8FE C4 F0 ANDB #$F0 MASK TO EVEN 16 BYTE BOUNDRY
0339 F900 1F 01 TFR D,X PUT IN X-REG AS LOWER DUMP LIMIT
0340 F902 AC E4 NXTLIN CMPX ,S COMPARE LOWER TO UPPER LIMIT
0341 F904 27 05 BEQ SKPDMP IF EQUAL SKIP HEX-ASCII DUMP
0342 F906 17 03 9F LBSR INCHEK CHECK FOR INPUT FROM KEYBOARD
0343 F909 27 03 BEQ EDUMP
0344 F90B 32 62 SKPDMP LEAS 2,S READJUST STACK IF NOT DUMPING
0345 F90D 39 RTS ;
0346 *
0347 * PRINT 16 HEX BYTES FOLLOWED BY 16 ASCII CHARACTERS
0348 * FOR EACH LINE THROUGHOUT ADDRESS LIMITS.
0349 *
0350 F90E 34 10 EDUMP PSHS X PUSH LOWER ADDR LIMIT ON STACK
0351 F910 8E FE 9D LDX #MSG5 POINT TO MSG " - "
0352 F913 17 01 F7 LBSR PSTRNG PRINT MSG
0353 F916 AE E4 LDX ,S LOAD LOWER ADDR FROM TOP OF STACK
0354 F918 17 03 37 LBSR OUT4H PRINT THE ADDRESS
0355 F91B 17 03 9B LBSR OUT2S 2 SPACES
0356 F91E C6 10 LDB #$10 LOAD COUNT OF 16 BYTES TO DUMP
0357 F920 A6 80 ELOOP LDA ,X+ GET FROM MEMORY HEX BYTE TO PRINT
0358 F922 17 03 35 LBSR OUT2H OUTPUT HEX BYTE AS ASCII
0359 F925 17 03 93 LBSR OUT1S OUTPUT SPACE
0360 F928 5A DECB $F9D1 DECREMENT BYTE COUNT
0361 F929 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 F92B 17 03 8B LBSR OUT2S 2 SPACES
0367 F92E AE E1 LDX ,S++ GET LOW LIMIT FRM STACK - ADJ STACK
0368 F930 C6 10 LDB #$10 SET ASCII CHAR TO PRINT = 16
0369 F932 A6 80 EDPASC LDA ,X+ GET CHARACTER FROM MEMORY
0370 F934 81 20 CMPA #$20 IF LESS THAN $20, NON-PRINTABLE?
0371 F936 25 04 BCS PERIOD IF SO, PRINT PERIOD INSTEAD
0372 F938 81 7E CMPA #$7E IS IT VALID ASCII?
0373 F93A 23 02 BLS PRASC IF SO PRINT IT
0374 F93C 86 2E PERIOD LDA #'. LOAD A PERIOD (.)
0375 F93E 17 03 7C PRASC LBSR OUTCH PRINT ASCII CHARACTER
0376 F941 5A DECB DECREMENT COUNT
0377 F942 26 EE BNE EDPASC
0378 F944 20 BC BRA NXTLIN
0379 *
0380 ***** "B" SET BREAKPOINT *****
0381 *
0382 F946 17 02 C0 BRKPNT LBSR IN1ADR GET BREAKPOINT ADDRESS
0383 F949 29 1E BVS EXITBP EXIT IF INVALID HEX ADDR.
0384 F94B 8C 7F C0 CMPX #STACK ADDRESS ILLEGAL IF >=$DFC0
0385 F94E 24 1A BCC BPERR IF ERROR PRINT (?), EXIT
0386 F950 34 10 PSHS X $FA82 PUSH BP ADDRESS ON STACK
0387 F952 8E FF FF LDX #$FFFF LOAD DUMMY ADDR TO TEST BP TABLE
0388 F955 8D 5B BSR BPTEST TEST BP TABLE FOR FREE SPACE
0389 F957 35 10 PULS X POP BP ADDRESS FROM STACK
0390 F959 27 0F BEQ BPERR (Z) SET, OUT OF BP TABLE SPACE
0391 F95B A6 84 LDA ,X GET DATA AT BREAKPOINT ADDRESS
0392 F95D 81 3F CMPA #$3F IS IT A SWI?
0393 F95F 27 09 BEQ BPERR IF SWI ALREADY, INDICATE ERROR
0394 F961 A7 A0 STA ,Y+ SAVE DATA BYTE IN BP TABLE
0395 F963 AF A4 STX ,Y SAVE BP ADDRESS IN BP TABLE
0396 F965 86 3F LDA #$3F LOAD A SWI ($3F)
0397 F967 A7 84 STA ,X SAVE SWI AT BREAKPOINT ADDRESS
0398 F969 39 EXITBP RTS ;
0399 *
0400 * INDICATE ERROR SETTING BREAKPOINT
0401 *
0402 F96A 17 03 4E BPERR LBSR OUT1S OUTPUT SPACE
0403 F96D 86 3F LDA #'? LOAD (?), INDICATE BREAKPOINT ERROR
0404 F96F 16 03 4B LBRA OUTCH PRINT "?"
0405 *
0406 *** "X" CLEAR OUTSTANDING BREAKPOINTS ***
0407 *
0408 F972 10 8E 7F D3 XBKPNT LDY #BPTBL POINT TO BREAKPOINT TABLE
0409 F976 C6 08 LDB #8 LOAD BREAKPOINT COUNTER
0410 F978 8D 1E XBPLP BSR RPLSWI REMOVE USED ENTRY IN BP TABLE
0411 F97A 5A DECB $FAAC DECREMENT BP COUNTER
0412 F97B 26 FB BNE XBPLP END OF BREAKPOINT TABLE?
0413 F97D 39 RTS
0414 *
0415 ***** SWI ENTRY POINT *****
0416 *
0417 F97E 1F 43 SWIE TFR S,U TRANSFER STACK TO USER POINTER
0418 F980 AE 4A LDX 10,U LOAD PC FROM STACK INTO X-REG
0419 F982 30 1F LEAX -1,X ADJUST ADDR DOWN 1 BYTE.
0420 F984 8D 2C BSR BPTEST FIND BREAKPOINT IN BP TABLE
0421 F986 27 04 BEQ REGPR IF FOUND, REPLACE DATA AT BP ADDR
0422 F988 AF 4A STX 10,U SAVE BREAKPOINT ADDR IN STACK
0423 F98A 8D 0C BSR RPLSWI GO REPLACE SWI WITH ORIGINAL DATA
0424 F98C 17 02 51 REGPR LBSR REGSTR GO PRINT REGISTERS
0425 *
0426 IFD TRAOPT
0427 F98F 8E 00 00 LDX #0
0428 F992 BF 7F ED STX TRACNT
0429 ENDIF TRAOPT
0430 *
0431 F995 16 FE B3 LBRA NEXTCMD GET NEXT COMMAND
0432 *
0433 F998 AE 21 RPLSWI LDX 1,Y LOAD BP ADDRESS FROM BP TABLE
0434 F99A 8C 7F C0 CMPX #STACK COMPARE TO TOP AVAILABLE USER MEMORY
0435 F99D 24 0A BCC FFSTBL GO RESET TABLE ENTRY TO $FF'S
0436 F99F A6 84 LDA ,X GET DATA FROM BP ADDRESS
0437 F9A1 81 3F CMPA #$3F IS IT SWI?
0438 F9A3 26 04 BNE FFSTBL IF NOT, RESET TABLE ENTRY TO $FF'S
0439 F9A5 A6 A4 LDA ,Y GET ORIGINAL DATA FROM BP TABLE
0440 F9A7 A7 84 STA ,X $FAD3 RESTORE DATA AT BP ADDRESS
0441 F9A9 86 FF FFSTBL LDA #$FF LOAD $FF IN A-ACC
0442 F9AB A7 A0 STA ,Y+ RESET BREAKPOINT TABLE DATA TO $FF'S
0443 F9AD A7 A0 STA ,Y+ RESET BREAKPOINT TABLE ADDR TO $FF'S
0444 F9AF A7 A0 STA ,Y+
0445 F9B1 39 RTS
0446 *
0447 ** SEARCH BREAKPOINT TABLE FOR MATCH **
0448 *
0449 F9B2 10 8E 7F D3 BPTEST LDY #BPTBL POINT TO BREAKPOINT TABLE
0450 F9B6 C6 08 LDB #8 LOAD BREAKPOINT COUNTER
0451 F9B8 A6 A0 FNDBP LDA ,Y+ LOAD DATA BYTE
0452 F9BA AC A1 CMPX ,Y++ COMPARE ADDRESS, IS IT SAME?
0453 F9BC 27 04 BEQ BPADJ IF SO, ADJUST POINTER FOR TABLE ENTRY
0454 F9BE 5A DECB IF NOT, DECREMENT BREAKPOINT COUNTER
0455 F9BF 26 F7 BNE FNDBP AND LOOK FOR NEXT POSSIBLE MATCH
0456 F9C1 39 RTS ;
0457 *
0458 *
0459 F9C2 31 3D BPADJ LEAY -3,Y MOVE POINTER TO BEGIN OF BP ENTRY
0460 F9C4 39 RTS
0461 *
0462 IFD TRAOPT
0463 *
0464 ** TRACE from address AAAA BB bytes
0465 *
0466 F9C5 17 01 5F TRACE LBSR ALTPC1 SET UP NEW PC
0467 F9C8 29 1C BVS TREXIT ADDRESS ERROR, EXIT
0468 F9CA 17 02 EE LBSR OUT1S
0469 F9CD 17 02 39 LBSR IN1ADR Fetch Byte Count
0470 F9D0 29 14 BVS TREXIT Byte Count error, EXIT
0471 F9D2 BF 7F ED STX TRACNT
0472 *
0473 F9D5 BE 7F C0 LDX NMI Save NMI Vector
0474 F9D8 BF 7F EB STX NMISAV
0475 F9DB 8E F9 E7 LDX #NMIE Set up NMI for Tracing
0476 F9DE BF 7F C0 STX NMI
0477 F9E1 17 00 45 LBSR TRAINZ Initialise Hardware
0478 F9E4 20 20 BRA TRACEG Start Trace
0479 F9E6 39 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 F9E7 1F 43 NMIE TFR S,U
0503 F9E9 86 36 LDA #$36 Disable Interrupt, CA2 Low
0504 F9EB B7 E0 71 STA TACTRL
0505 F9EE B6 E0 70 LDA TADATA Clear Interrupt flag by reading data port
0506 *
0507 F9F1 17 01 EC LBSR REGSTR DUMP REGISTERS
0508 *
0509 F9F4 AE 4A LDX 10,U TEST IF NEXT INSTRUCTION IS A SWI
0510 F9F6 A6 84 LDA ,X
0511 F9F8 81 3F CMPA #$3F
0512 F9FA 27 24 BEQ TRACEX EXIT ON SWI
0513 *
0514 F9FC BE 7F ED LDX TRACNT CHECK IF TRACE COUNT EXPIRED
0515 F9FF 27 1F BEQ TRACEX YES, GO BACK TO THE MONITOR
0516 FA01 30 1F LEAX -1,X DECREMENT TRACE COUNT
0517 FA03 BF 7F ED STX TRACNT
0518 *
0519 ** TRACE GO (RESUME SINGLE STEP)
0520 *
0521 FA06 1F 34 TRACEG TFR U,S SET UP PROGRAM STACK POINTER
0522 FA08 86 0D LDA #TRADEL SET UP TIMER DELAY (NUMB CYCLES FOR RTI+1)
0523 FA0A B7 E0 70 STA TADATA
0524 FA0D 86 36 LDA #$36 LOAD STROBE LOW
0525 FA0F B7 E0 71 STA TACTRL
0526 FA12 B6 E0 70 LDA TADATA CLEAR INTERRUPT
0527 FA15 86 36 LDA #$36 RELEASE RESET
0528 FA17 B7 E0 73 STA TBCTRL
0529 FA1A 86 3F LDA #$3F RELEASE LOAD, ENABLE CA1 NMI, CA1 RISING EDGE
0530 FA1C B7 E0 71 STA TACTRL
0531 FA1F 3B RTI GO EXECUTE INSTRUCTION
0532 *
0533 FA20 BE 7F EB TRACEX LDX NMISAV Restore NMI vector
0534 FA23 BF 7F C0 STX NMI
0535 FA26 16 FE 22 LBRA NEXTCMD Jump back to the command loop.
0536 *
0537 ** TRACE HARDWARE INITIALISATION
0538 *
0539 FA29 86 32 TRAINZ LDA #$32 SELECT DDRA, CA2 LOW, NMI DISABLED
0540 FA2B B7 E0 71 STA TACTRL
0541 FA2E 86 3A LDA #$3A SELECT DDRB, CB2 HIGH, FIRQ DISABLED
0542 FA30 B7 E0 73 STA TBCTRL
0543 FA33 86 FF LDA #$FF PORTA = OUTPUT
0544 FA35 B7 E0 70 STA TADATA
0545 FA38 86 00 LDA #$00 PORTB = INPUT
0546 FA3A B7 E0 72 STA TBDATA
0547 FA3D 86 36 LDA #$36 SELECT OUTPUT REGISTER A, CA2 LOW
0548 FA3F B7 E0 71 STA TACTRL
0549 FA42 86 3E LDA #$3E SELECT OUTPUT REGISTER B, CB2 HIGH
0550 FA44 B7 E0 73 STA TBCTRL
0551 FA47 39 RTS
0552 *
0553 ENDIF TRAOPT
0554 IFD MFDCOPT
0555 *
0556 ** "U" MINI DISK BOOT
0557 *
0558 MINBOOT TST CMDFDC
0559 CLR DRVFDC
0560 LDX #$0000
0561 LOOP LEAX $01,X
0562 CMPX #$0000
0563 BNE LOOP
0564 LDA #$0F
0565 STA CMDFDC
0566 BSR DELAY
0567 LOOP1 LDB CMDFDC
0568 BITB #$01
0569 BNE LOOP1
0570 LDA #$01
0571 STA SECFDC
0572 BSR DELAY
0573 LDA #$8C
0574 STA CMDFDC
0575 BSR DELAY
0576 LDX #$C000
0577 BRA LOOP3
0578 LOOP2 BITB #$02
0579 BEQ LOOP3
0580 LDA DATFDC
0581 STA ,X+
0582 LOOP3 LDB CMDFDC
0583 BITB #$01
0584 BNE LOOP2
0585 BITB #$2C
0586 BEQ LOOP4
0587 RTS
0588 *
0589 LOOP4 LDX #$C000
0590 STX $0A,U
0591 TFR U,S
0592 RTI
0593 *
0594 DELAY LDB #$04
0595 LOOP5 DECB
0596 BNE LOOP5
0597 RTS
0598 ENDIF MFDCOPT
0598 ENDIF MFDCOPT
0599 *
0600 IFD DMAFOPT
0601 *
0602 *** "D" DISK BOOT FOR DMAF2 ***
0603 *
0604 DBOOT LDA #$DE
0605 STA DRVREG
0606 LDA #$FF
0607 STA PRIREG $FAF8
0608 STA CCREG
0609 STA AAAREG
0610 STA BBBREG
0611 TST CCREG
0612 LDA #$D8
0613 STA COMREG
0614 LBSR DLY
0615 DBOOT0 LDA COMREG
0616 BMI DBOOT0
0617 LDA #$09
0618 STA COMREG
0619 LBSR DLY
0620 *
0621 DISKWT LDA COMREG FETCH DRIVE STATUS
0622 BITA #1 TEST BUSY BIT
0623 BNE DISKWT LOOP UNTIL NOT BUSY
0624 *
0625 BITA #$10
0626 BNE DBOOT
0627 *
0628 LDX #$C000 LOGICAL ADDR. = $C000
0629 BSR LRA GET 20 BIT PHYSICAL ADDR. OF LOG. ADDR.
0630 ORA #$10
0631 STA CCCREG
0632 TFR X,D
0633 COMA ;
0634 COMB ;
0635 STD ADDREG
0636 LDX #$FEFF LOAD DMA BYTE COUNT = $100
0637 STX CNTREG STORE IN COUNT REGISTER
0638 LDA #$FF LOAD THE CHANNEL REGISTER
0639 STA CCREG
0640 LDA #$FE SET CHANNEL 0
0641 STA PRIREG
0642 LDA #1 SET SECTOR TO "1"
0643 STA SECREG ISSUE COMMAND
0644 LDA #$8C SET SINGLE SECTOR READ
0645 STA COMREG ISSUE COMMAND
0646 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 CLRB ;
0656 DBOOT1 PSHS B $FB55
0657 CLRB ;
0658 DBOOT2 TST CCREG
0659 BPL DBOOT3
0660 DECB ;
0661 BNE DBOOT2
0662 PULS B
0663 DECB
0664 BNE DBOOT1
0665 BRA DBOOT
0666 DBOOT3 PULS B
0667 LDA COMREG
0668 BITA #$1C
0669 BEQ DBOOT4
0670 RTS ;
0671 *
0672 *
0673 DBOOT4 LDB #$DE
0674 STB DRVREG
0675 LDX #$C000
0676 STX 10,U
0677 TFR U,S $FB7B
0678 RTI ;
0679 ENDIF DMAFOPT
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 LRA PSHS A,B,X,Y PUSH REGISTERS ON STACK
0875 LDA 2,S GET MSB LOGICAL ADDR FRM X REG ON STACK
0876 LSRA ;
0877 LSRA ADJ FOR INDEXED INTO
0878 LSRA CORRESPONDING LOCATION
0879 LSRA IN LRA TABLE
0880 LDY #LRARAM LOAD LRA TABLE BASE ADDRESS
0881 LDB A,Y GET PHYSICAL ADDR. DATA FROM LRA TABLE
0882 LSRB ADJ. REAL ADDR. TO REFLECT EXTENDED
0883 LSRB PHYSICAL ADDRESS.
0884 LSRB EXTENDED MS 4-BITS ARE RETURNED
0885 LSRB IN THE "A" ACCUMULATOR
0886 STB ,S MS 4 BITS IN A ACCUM. STORED ON STACK
0887 LDB A,Y LOAD REAL ADDRESS DATA FROM LRA TABLE
0888 COMB COMP TO ADJ FOR PHYSICAL ADDR. IN X REG
0889 ASLB ADJ DATA FOR RELOCATION IN X REG
0890 ASLB ;
0891 ASLB $FB97
0892 ASLB ;
0893 LDA 2,S GET MS BYTE OF LOGICAL ADDR.
0894 ANDA #$0F MASK MS NIBBLE OF LOGICAL ADDRESS
0895 STA 2,S SAVE IT IN X REG ON STACK
0896 ORB 2,S SET MS BYTE IN X REG TO ADJ PHY ADDR.
0897 *
0898 * PLUS LS NIBBLE OF LOGICAL ADDRESS
0899 STB 2,S SAVE AS LS 16 BITS OF PHY ADDR IN X REG
0900 * ON STACK
0901 PULS A,B,X,Y,PC POP REGS. FROM STACK
0902 ENDIF DATOPT
0902 ENDIF DATOPT
0903 *
0904 * DELAY LOOP
0905 *
0906 FA48 34 04 DLY PSHS B SAVE CONTENTS OF "B"
0907 FA4A C6 20 LDB #$20 GET LOOP DELAY VALUE
0908 FA4C 5A SUB1 DECB SUBTRACT ONE FROM VALUE
0909 FA4D 26 FD BNE SUB1 LOOP UNTIL ZERO
0910 FA4F 35 84 PULS B,PC RESTORE CONTENTS OF "B"
0911 * RTS ;
0912 *
0913 ***** "L" LOAD MIKBUG TAPE *****
0914 *
0915 FA51 BD FC D2 LOAD JSR ACINIZ
0916 FA54 86 11 LDA #$11 LOAD 'DC1' CASS. READ ON CODE
0917 FA56 17 02 64 LBSR OUTCH OUTPUT IT TO TERMINAL PORT
0918 FA59 7F 7F D2 CLR ECHO TURN OFF ECHO FLAG
0919 FA5C 17 02 26 LOAD1 LBSR ECHON INPUT 8 BIT BYTE WITH NO ECHO
0920 FA5F 81 53 LOAD2 CMPA #'S IS IT AN "S", START CHARACTER ?
0921 FA61 26 F9 BNE LOAD1 IF NOT, DISCARD AND GET NEXT CHAR.
0922 FA63 17 02 1F LBSR ECHON
0923 FA66 81 39 CMPA #'9 IS IT A "9" , END OF FILE CHAR ?
0924 FA68 27 3D BEQ LOAD21 IF SO, EXIT LOAD
0925 FA6A 81 31 CMPA #'1 IS IT A "1" , FILE LOAD CHAR ?
0926 FA6C 26 F1 BNE LOAD2 IF NOT, LOOK FOR START CHAR.
0927 FA6E 17 01 A8 LBSR BYTE INPUT BYTE COUNT
0928 FA71 34 02 PSHS A PUSH COUNT ON STACK
0929 FA73 29 26 BVS LODERR (V) C-CODE SET, ILLEGAL HEX
0930 FA75 17 01 91 LBSR IN1ADR INPUT LOAD ADDRESS
0931 FA78 29 21 BVS LODERR (V) C-CODE SET, ADDR NOT HEX
0932 FA7A 34 10 PSHS X PUSH ADDR ON STACK
0933 FA7C E6 E0 LDB ,S+ LOAD MSB OF ADDR AS CHECKSUM BYTE
0934 FA7E EB E0 ADDB ,S+ ADD LSB OF ADDR TO CHECKSUM
0935 FA80 EB E4 ADDB ,S ADD BYTE COUNT BYTE TO CHECKSUM
0936 FA82 6A E4 DEC ,S $FC37 DECREMENT BYTE COUNT 2 TO BYPASS
0937 FA84 6A E4 DEC ,S ADDRESS BYTES.
0938 FA86 34 04 LOAD10 PSHS B PUSH CHECKSUM ON STACK
0939 FA88 17 01 8E LBSR BYTE INPUT DATA BYTE (2 HEX CHAR)
0940 FA8B 35 04 PULS B POP CHECKSUM FROM STACK
0941 FA8D 29 0C BVS LODERR (V) SET, DATA BYTE NOT HEX
0942 FA8F 34 02 PSHS A PUSH DATA BYTE ON STACK
0943 FA91 EB E0 ADDB ,S+ ADD DATA TO CHECKSUM, AUTO INC STACK
0944 FA93 6A E4 DEC ,S DECREMENT BYTE COUNT 1
0945 FA95 27 05 BEQ LOAD16 IF BYTE COUNT ZERO, TEST CHECKSUM
0946 FA97 A7 80 STA ,X+ SAVE DATA BYTE IN MEMORY
0947 FA99 20 EB BRA LOAD10 GET NEXT DATA BYTE
0948 FA9B 5F LODERR CLRB ;ERROR CONDITION, ZERO CHECKSUM ;
0949 FA9C 35 02 LOAD16 PULS A ADJUST STACK (REMOVE BYTE COUNT)
0950 FA9E C1 FF CMPB #$FF CHECKSUM OK?
0951 FAA0 27 BA BEQ LOAD1 IF SO, LOAD NEXT LINE
0952 FAA2 86 3F LDA #'? LOAD (?) ERROR INDICATOR
0953 FAA4 17 02 16 LBSR OUTCH OUTPUT IT TO TERMINAL
0954 FAA7 73 7F D2 LOAD21 COM ECHO TURN ECHO ON
0955 FAAA 86 13 LDA #$13 $FC5F LOAD 'DC3' CASS. READ OFF CODE
0956 FAAC 16 02 0E LBRA OUTCH OUTPUT IT
0957 *
0958 ***** "P" PUNCH MIKBUG TAPE *****
0959 *
0960 FAAF 6F E2 PUNCH CLR ,-S CLEAR RESERVED BYTE ON STACK
0961 FAB1 17 01 4A LBSR IN2ADR GET BEGIN AND END ADDRESS
0962 FAB4 34 30 PSHS X,Y SAVE ADDRESSES ON STACK
0963 FAB6 29 4D BVS PUNEXT (V) C-CODE SET, EXIT PUNCH
0964 FAB8 AC 62 CMPX 2,S COMPARE BEGIN TO END ADDR
0965 FABA 25 49 BCS PUNEXT IF BEGIN GREATER THAN END, EXIT PUNCH
0966 FABC 30 01 LEAX 1,X INCREMENT END ADDRESS
0967 FABE AF E4 STX ,S STORE END ADDR ON STACK
0968 FAC0 BD FC D2 JSR ACINIZ
0969 FAC3 86 12 LDA #$12 LOAD 'DC2' PUNCH ON CODE
0970 FAC5 17 01 F5 LBSR OUTCH OUTPUT IT TO TERMINAL
0971 FAC8 EC E4 PUNCH2 LDD ,S LOAD END ADDR IN D-ACC
0972 FACA A3 62 SUBD 2,S SUBTRACT BEGIN FROM END
0973 FACC 27 06 BEQ PUNCH3 SAME, PUNCH 32 BYTES DEFAULT
0974 FACE 10 83 00 20 CMPD #$20 LESS THAN 32 BYTES?
0975 FAD2 23 02 BLS PUNCH4 PUNCH THAT MANY BYTES
0976 FAD4 C6 20 PUNCH3 LDB #$20 LOAD BYTE COUNT OF 32.
0977 FAD6 E7 64 PUNCH4 STB 4,S STORE ON STACK AS BYTE COUNT
0978 FAD8 8E FE DE LDX #MSG20 POINT TO MSG "S1"
0979 FADB 17 00 2F LBSR PSTRNG PRINT MSG
0980 FADE CB 03 ADDB #3 ADD 3 BYTES TO BYTE COUNT
0981 FAE0 1F 98 TFR B,A GET BYTE COUNT IN A-ACC TO PUNCH
0982 FAE2 17 01 75 LBSR OUT2H OUTPUT BYTE COUNT
0983 FAE5 AE 62 LDX 2,S LOAD BEGIN ADDRESS
0984 FAE7 17 01 68 LBSR OUT4H PUNCH ADDRESS
0985 FAEA EB 62 ADDB 2,S ADD ADDR MSB TO CHECKSUM
0986 FAEC EB 63 ADDB 3,S ADD ADDR LSB TO CHECKSUM
0987 FAEE EB 84 PUNCHL ADDB ,X ADD DATA BYTE TO CHECKSUM
0988 FAF0 A6 80 LDA ,X+ LOAD DATA BYTE TO PUNCH
0989 FAF2 17 01 65 LBSR OUT2H OUTPUT DATA BYTE
0990 FAF5 6A 64 DEC 4,S DECREMENT BYTE COUNT
0991 FAF7 26 F5 BNE PUNCHL NOT DONE, PUNCH NEXT BYTE
0992 FAF9 53 COMB 1's COMPLIMENT CHECKSUM BYTE
0993 FAFA 1F 98 TFR B,A GET IT IN A-ACC TO PUNCH
0994 FAFC 17 01 5B LBSR OUT2H OUTPUT CHECKSUM BYTE
0995 FAFF AF 62 STX 2,S SAVE X-REG IN STACK AS NEW PUNCH ADDR
0996 FB01 AC E4 CMPX ,S COMPARE IT TO END ADDR
0997 FB03 26 C3 BNE PUNCH2 $FCB5 PUNCH NOT DONE, CONT.
0998 FB05 86 14 PUNEXT LDA #$14 LOAD 'DC4' PUNCH OFF CODE
0999 FB07 17 01 B3 LBSR OUTCH OUTPUT IT
1000 FB0A 32 65 LEAS 5,S READJUST STACK POINTER
1001 FB0C 39 RTS ;
1002 *
1003 * PRINT STRING PRECEEDED BY A CR & LF.
1004 *
1005 FB0D 8D 02 PSTRNG BSR PCRLF PRINT CR/LF
1006 FB0F 20 71 BRA PDATA PRINT STRING POINTED TO BY IX
1007 *
1008 * PCRLF
1009 *
1010 FB11 34 10 PCRLF PSHS X SAVE IX
1011 FB13 8E FE 8F LDX #MSG2+1 POINT TO MSG CR/LF + 3 NULS
1012 FB16 17 00 69 LBSR PDATA PRINT MSG
1013 FB19 35 90 PULS X,PC RESTORE IX & RETURN
1014 *
1015 * LONG BRANCHES TO COMMON ROUTINES
1016 *
1017 FB1B 16 01 9D JOUT1S LBRA OUT1S
1018 FB1E 16 00 F8 JBYTE LBRA BYTE
1019 FB21 16 00 E5 JIN1ADR LBRA IN1ADR
1020 *
1021 * ALTER "PC" PROGRAM COUNTER
1022 *
1023 FB24 17 00 91 ALTRPC LBSR PRTPC $FCF5 PRINT MSG " PC = "
1024 FB27 8D F2 ALTPC1 BSR JOUT1S OUTPUT SPACE
1025 FB29 8D F6 BSR JIN1ADR GET NEW CONTENTS FOR "PC"
1026 FB2B 29 02 BVS ALTPCD EXIT IF INVALID HEX
1027 FB2D AF 4A STX 10,U POKE IN NEW CONTENTS
1028 FB2F 39 ALTPCD RTS ;
1029 *
1030 * ALTER "U" USER STACK POINTER
1031 *
1032 FB30 8D 61 ALTRU BSR PRTUS $FCCA PRINT MSG " US = "
1033 FB32 8D E7 BSR JOUT1S OUTPUT SPACE
1034 FB34 8D EB BSR JIN1ADR
1035 FB36 29 02 BVS ALTUD
1036 FB38 AF 48 STX 8,U
1037 FB3A 39 ALTUD RTS ;
1038 *
1039 * ALTER "Y" INDEX REGISTER
1040 *
1041 FB3B 8D 72 ALTRY BSR PRTIY PRINT MSG " IY = "
1042 FB3D 8D DC BSR JOUT1S OUTPUT SPACE
1043 FB3F 8D E0 BSR JIN1ADR
1044 FB41 29 02 BVS ALTYD
1045 FB43 AF 46 STX 6,U $F8F0
1046 FB45 39 ALTYD RTS ;
1047 *
1048 * ALTER "X" INDEX REGISTER
1049 *
1050 FB46 8D 5E ALTRX BSR PRTIX $FCE0 PRINT MSG " IX = "
1051 FB48 8D D1 BSR JOUT1S OUTPUT SPACE
1052 FB4A 8D D5 BSR JIN1ADR
1053 FB4C 29 02 BVS ALTXD
1054 FB4E AF 44 STX 4,U
1055 FB50 39 ALTXD RTS ;
1056 *
1057 * ALTER "DP" DIRECT PAGE REGISTER
1058 *
1059 FB51 8D 49 ALTRDP BSR PRTDP $FCD5 PRINT MSG " DP = "
1060 FB53 8D C6 BSR JOUT1S OUTPUT SPACE
1061 FB55 8D C7 BSR JBYTE INPUT BYTE (2 HEX CHAR)
1062 FB57 29 02 BVS ALTDPD
1063 FB59 A7 43 STA 3,U
1064 FB5B 39 ALTDPD RTS ;
1065 *
1066 * ALTER "B" ACCUMULATOR
1067 *
1068 FB5C 8D 6C ALTRB BSR PRTB $FD09 PRINT MSG " B = "
1069 FB5E 8D BB BSR JOUT1S OUTPUT SPACE
1070 FB60 8D BC BSR JBYTE INPUT BYTE (2 HEX CHAR)
1071 FB62 29 02 BVS ALTBD
1072 FB64 A7 42 STA 2,U
1073 FB66 39 ALTBD RTS $F91C
1074 *
1075 * ALTER "A" ACCUMULATOR
1076 *
1077 FB67 8D 58 ALTRA BSR PRTA $FCFF RINT MSG " A = "
1078 FB69 8D B0 BSR JOUT1S OUTPUT SPACE
1079 FB6B 8D B1 BSR JBYTE INPUT BYTE (2 HEX CHAR)
1080 FB6D 29 02 BVS ALTAD
1081 FB6F A7 41 STA 1,U
1082 FB71 39 ALTAD RTS ;
1083 *
1084 * ALTER "CC" REGISTER
1085 *
1086 FB72 8D 5F ALTRCC BSR PRTCC $FD13 PRINT MSG " CC: "
1087 FB74 8D A5 BSR JOUT1S OUTPUT SPACE
1088 FB76 8D A6 BSR JBYTE INPUT BYTE (2 HEX CHAR)
1089 FB78 29 04 BVS ALTCCD
1090 FB7A 8A 80 ORA #$80 SETS "E" FLAG IN PRINT LIST
1091 FB7C A7 C4 STA ,U
1092 FB7E 39 ALTCCD RTS ;
1093 *
1094 * PDATA
1095 *
1096 FB7F 17 01 3B PRINT LBSR OUTCH
1097 FB82 A6 80 PDATA LDA ,X+ GET 1st CHAR. TO PRINT
1098 FB84 81 04 CMPA #4 IS IT EOT?
1099 FB86 26 F7 BNE PRINT IF NOT EOT PRINT IT
1100 FB88 39 RTS ;
1101 *
1102 * PRINT REGISTERS
1103 *
1104 FB89 8E FE A1 PRTSP LDX #MSG10 POINT TO MSG "SP="
1105 FB8C 8D F4 BSR PDATA PRINT MSG
1106 FB8E 1F 31 TFR U,X
1107 FB90 16 00 BF JOUT4H LBRA OUT4H
1108 *
1109 FB93 8E FE AD PRTUS LDX #MSG12 POINT TO MSG "US="
1110 FB96 8D EA BSR PDATA PRINT MSG
1111 FB98 AE 48 LDX 8,U
1112 FB9A 20 F4 BRA JOUT4H
1113 *
1114 FB9C 8E FE BF PRTDP LDX #MSG15 POINT TO MSG "DP="
1115 FB9F 8D E1 BSR PDATA PRINT MSG
1116 FBA1 A6 43 LDA 3,U
1117 FBA3 16 00 B4 JOUT2H LBRA OUT2H OUTPUT HEX BYTE AS ASCII
1118 *
1119 FBA6 8E FE B9 PRTIX LDX #MSG14 POINT TO MSG "IX="
1120 FBA9 8D D7 BSR PDATA PRINT MSG
1121 FBAB AE 44 LDX 4,U $FCE6
1122 FBAD 20 E1 BRA JOUT4H
1123 *
1124 FBAF 8E FE B3 PRTIY LDX #MSG13 POINT TO MSG "IY="
1125 FBB2 8D CE BSR PDATA PRINT MSG
1126 FBB4 AE 46 LDX 6,U
1127 FBB6 20 D8 BRA JOUT4H
1128 *
1129 FBB8 8E FE A7 PRTPC LDX #MSG11 POINT TO MSG "PC="
1130 FBBB 8D C5 BSR PDATA PRINT MSG
1131 FBBD AE 4A LDX 10,U
1132 FBBF 20 CF BRA JOUT4H
1133 *
1134 FBC1 8E FE C5 PRTA LDX #MSG16 POINT TO MSG "A="
1135 FBC4 8D BC BSR PDATA PRINT MSG
1136 FBC6 A6 41 LDA 1,U
1137 FBC8 20 D9 BRA JOUT2H OUTPUT HEX BYTE AS ASCII
1138 *
1139 FBCA 8E FE CA PRTB LDX #MSG17 POINT TO MSG "B="
1140 FBCD 8D B3 BSR PDATA PRINT MSG
1141 FBCF A6 42 LDA 2,U
1142 FBD1 20 D0 BRA JOUT2H OUTPUT HEX BYTE AS ASCII
1143 *
1144 FBD3 8E FE CF PRTCC LDX #MSG18 POINT TO MSG "CC:"
1145 FBD6 8D AA BSR PDATA PRINT MSG
1146 FBD8 A6 C4 LDA ,U
1147 FBDA 8E FE D6 LDX #MSG19 POINT TO MSG "EFHINZVC"
1148 FBDD 16 00 90 LBRA BIASCI OUTPUT IN BINARY/ASCII FORMAT
1149 *
1150 * "R" DISPLAY REGISTERS
1151 *
1152 FBE0 8E FE 9D REGSTR LDX #MSG5 POINT TO MSG " - "
1153 FBE3 17 FF 27 LBSR PSTRNG PRINT MSG
1154 FBE6 8D A1 BSR PRTSP $FCBF
1155 FBE8 8D A9 BSR PRTUS $FCCA
1156 FBEA 8D B0 BSR PRTDP $FCD5
1157 FBEC 8D B8 BSR PRTIX $FCE0
1158 FBEE 8D BF BSR PRTIY $FCEB
1159 FBF0 8E FE 9D LDX #MSG5 POINT TO MSG " - "
1160 FBF3 17 FF 17 LBSR PSTRNG PRINT MSG
1161 FBF6 8D C0 BSR PRTPC $FCF5
1162 FBF8 8D C7 BSR PRTA $FCFF
1163 FBFA 8D CE BSR PRTB $FD09
1164 FBFC 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 FBFE 8D 09 IN2ADR BSR IN1ADR GET FIRST ADDRESS
1174 FC00 29 4D BVS NOTHEX EXIT IF NOT VALID HEX
1175 FC02 1F 12 TFR X,Y SAVE FIRST ADDR. IN "IY"
1176 FC04 86 2D LDA #'-
1177 FC06 17 00 B4 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 FC09 8D 0E IN1ADR BSR BYTE INPUT BYTE (2 HEX CHAR)
1184 FC0B 29 42 BVS NOTHEX EXIT IF NOT VALID HEX
1185 FC0D 1F 01 TFR D,X
1186 FC0F 8D 08 BSR BYTE INPUT BYTE (2 HEX CHAR)
1187 FC11 29 3C BVS NOTHEX
1188 FC13 34 10 PSHS X
1189 FC15 A7 61 STA 1,S
1190 FC17 35 90 PULS X,PC
1191 *
1192 ***** INPUT BYTE (2 HEX CHAR.) *****
1193 *
1194 FC19 8D 11 BYTE BSR INHEX GET HEX LEFT
1195 FC1B 29 32 BVS NOTHEX EXIT IF NOT VALID HEX
1196 FC1D 48 ASLA ;
1197 FC1E 48 ASLA ;
1198 FC1F 48 ASLA ; SHIFT INTO LEFT NIBBLE
1199 FC20 48 ASLA ;
1200 FC21 1F 89 TFR A,B PUT HEXL IN "B"
1201 FC23 8D 07 BSR INHEX GET HEX RIGHT
1202 FC25 29 28 BVS NOTHEX EXIT IF NOT VALID HEX
1203 FC27 34 04 PSHS B PUSH HEXL ON STACK
1204 FC29 AB E0 ADDA ,S+ ADD HEXL TO HEXR AND ADJ. STK
1205 FC2B 39 RTS RETURN WITH HEX L&R IN "A"
1206 *
1207 *
1208 FC2C 8D 57 INHEX BSR ECHON INPUT ASCII CHAR.
1209 FC2E 81 30 CMPA #'0 IS IT > OR = "0" ?
1210 FC30 25 1D BCS NOTHEX IF LESS IT AIN'T HEX
1211 FC32 81 39 CMPA #'9 IS IT < OR = "9" ?
1212 FC34 22 03 BHI INHEXA IF > MAYBE IT'S ALPHA
1213 FC36 80 30 SUBA #$30 ASCII ADJ. NUMERIC
1214 FC38 39 RTS ;
1215 *
1216 *
1217 FC39 81 41 INHEXA CMPA #'A IS IT > OR = "A"
1218 FC3B 25 12 BCS NOTHEX IF LESS IT AIN'T HEX
1219 FC3D 81 46 CMPA #'F IS IT < OR = "F" ?
1220 FC3F 22 03 BHI INHEXL IF > IT AIN'T HEX
1221 FC41 80 37 SUBA #$37 ASCII ADJ. ALPHA
1222 FC43 39 RTS ;
1223 *
1224 FC44 81 61 INHEXL CMPA #'a IS IT > OR = "a"
1225 FC46 25 07 BCS NOTHEX IF LESS IT AIN'T HEX
1226 FC48 81 66 CMPA #'f IS IT < "f"
1227 FC4A 22 03 BHI NOTHEX IF > IT AIN'T HEX
1228 FC4C 80 57 SUBA #$57 ADJUST TO LOWER CASE
1229 FC4E 39 RTS ;
1230 *
1231 *
1232 FC4F 1A 02 NOTHEX ORCC #2 SET (V) FLAG IN C-CODES REGISTER
1233 FC51 39 RTS ;
1234 *
1235 *
1236 FC52 34 10 OUT4H PSHS X PUSH X-REG. ON THE STACK
1237 FC54 35 02 PULS A POP MS BYTE OF X-REG INTO A-ACC.
1238 FC56 8D 02 BSR OUTHL OUTPUT HEX LEFT
1239 FC58 35 02 PULS A POP LS BYTE OF X-REG INTO A-ACC.
1240 FC5A OUTHL EQU *
1241 FC5A 34 02 OUT2H PSHS A SAVE IT BACK ON STACK
1242 FC5C 44 LSRA CONVERT UPPER HEX NIBBLE TO ASCII
1243 FC5D 44 LSRA ;
1244 FC5E 44 LSRA ;
1245 FC5F 44 LSRA ;
1246 FC60 8D 04 BSR XASCII PRINT HEX NIBBLE AS ASCII
1247 FC62 35 02 OUTHR PULS A CONVERT LOWER HEX NIBBLE TO ASCII
1248 FC64 84 0F ANDA #$0F STRIP LEFT NIBBLE
1249 FC66 8B 30 XASCII ADDA #$30 ASCII ADJ
1250 FC68 81 39 CMPA #$39 IS IT < OR = "9" ?
1251 FC6A 2F 02 BLE OUTC IF LESS, OUTPUT IT
1252 FC6C 8B 07 ADDA #7 IF > MAKE ASCII LETTER
1253 FC6E 20 4D 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 FC70 34 02 BIASCI PSHS A SAVE "A" ON STACK
1265 FC72 C6 08 LDB #8 PRESET LOOP# TO BITS PER BYTE
1266 FC74 A6 80 OUTBA LDA ,X+ GET LETTER FROM STRING
1267 FC76 68 E4 ASL ,S TEST BYTE FOR "1" IN B7
1268 FC78 25 02 BCS PRTBA IF ONE PRINT LETTER
1269 FC7A 86 2D LDA #'- IF ZERO PRINT "-"
1270 FC7C 8D 3F PRTBA BSR OUTCH PRINT IT
1271 FC7E 8D 3B BSR OUT1S PRINT SPACE
1272 FC80 5A DECB SUB 1 FROM #BITS YET TO PRINT
1273 FC81 26 F1 BNE OUTBA
1274 FC83 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 FC85 7D 7F D2 ECHON TST ECHO IS ECHO REQUIRED ?
1285 FC88 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 FC8A 8D 04 INCHE BSR INCH GET CHAR FROM TERMINAL
1296 FC8C 84 7F ANDA #$7F STRIP PARITY FROM CHAR.
1297 FC8E 20 2D 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 FC90 34 10 INCH PSHS X SAVE IX
1308 FC92 BE 7F D0 GETSTA LDX CPORT POINT TO TERMINAL PORT
1309 FC95 A6 84 LDA ,X FETCH PORT STATUS
1310 FC97 85 01 BITA #1 TEST READY BIT, RDRF ?
1311 IFD PS2OPT
1312 FC99 26 09 BNE GETST1
1313 FC9B 8E E0 20 LDX #PS2KBD
1314 FC9E A6 84 LDA ,X
1315 FCA0 85 01 BITA #1
1316 ENDIF PS2OPT
1317 FCA2 27 EE BEQ GETSTA IF NOT RDY, THEN TRY AGAIN
1318 FCA4 A6 01 GETST1 LDA 1,X FETCH CHAR
1319 FCA6 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 FCA8 34 02 INCHEK PSHS A SAVE A ACCUM.
1331 FCAA A6 9F 7F D0 LDA [CPORT] FETCH PORT STATUS
1332 FCAE 85 01 BITA #1 TEST READY BIT, RDRF ?
1333 IFD PS2OPT
1334 FCB0 26 05 BNE INCHEK1
1335 FCB2 B6 E0 20 LDA PS2KBD
1336 FCB5 85 01 BITA #1 TEST READY BIT< RDRF ?
1337 ENDIF PS2OPT
1338 FCB7 35 82 INCHEK1 PULS A,PC RESTORE A ACCUM.
1339 *
1340 FCB9 8D 00 OUT2S BSR OUT1S OUTPUT 2 SPACES
1341 FCBB 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 FCBD 8D 45 BSR VOUTCH
1353 ENDIF VDUOPT
1354 IFD DG640OPT
1355 BSR VOUTCH
1356 ENDIF DG640OPT
1356 ENDIF DG640OPT
1357 FCBF 34 12 AOUTCH PSHS A,X SAVE A ACCUM AND IX
1358 FCC1 BE 7F D0 LDX CPORT GET ADDR. OF TERMINAL
1359 FCC4 A6 84 FETSTA LDA ,X FETCH PORT STATUS
1360 FCC6 85 02 BITA #2 TEST TDRE, OK TO XMIT ?
1361 FCC8 27 FA BEQ FETSTA IF NOT LOOP UNTIL RDY
1362 FCCA 35 02 PULS A GET CHAR. FOR XMIT
1363 FCCC A7 01 STA 1,X XMIT CHAR.
1364 FCCE 35 90 PULS X,PC RESTORE IX
1365 *
1366 * IO INITIALIZATION
1367 *
1368 FCD0 IOINIZ EQU *
1369 IFD VDUOPT
1370 FCD0 8D 13 BSR VINIZ
1371 ENDIF VDUOPT
1372 IFD DG640OPT
1373 BSR VINIZ
1374 ENDIF DG640OPT
1374 ENDIF DG640OPT
1375 FCD2 BE 7F D0 ACINIZ LDX CPORT POINT TO CONTROL PORT ADDRESS
1376 FCD5 86 03 LDA #3 RESET ACIA PORT CODE
1377 FCD7 A7 84 STA ,X STORE IN CONTROL REGISTER
1378 FCD9 86 11 LDA #$11 SET 8 DATA, 2 STOP AN 0 PARITY
1379 FCDB A7 84 STA ,X STORE IN CONTROL REGISTER
1380 FCDD 6D 01 TST 1,X ANYTHING IN DATA REGISTER?
1381 FCDF 86 FF LDA #$FF TURN ON ECHO FLAG
1382 FCE1 B7 7F D2 STA ECHO
1383 FCE4 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 FCE5 8E E0 30 VINIZ LDX #VDU
1399 FCE8 CC 00 00 LDD #0
1400 FCEB FD 7F EF STD COLADX AND ROWADX
1401 FCEE A7 02 STA VDUCOL,X
1402 FCF0 E7 03 STB VDUROW,X
1403 FCF2 E7 04 STB VDUOFF,X
1404 FCF4 FD 7F F1 STD NEWROW AND ESCFLG
1405 FCF7 C6 02 LDB #$02
1406 FCF9 E7 01 STB VDUATT,X
1407 FCFB 7F 7F F2 CLR ESCFLG
1408 FCFE 86 1B LDA #$1B SEND ESCAPE
1409 FD00 8D 02 BSR VOUTCH
1410 FD02 86 59 LDA #'Y CLEAR TO END OF SCREEN
1411 *
1412 ** VIDEO OUTPUT ROUTINE
1413 *
1414 FD04 34 16 VOUTCH PSHS A,B,X SAVE REGISTERS
1415 FD06 8E E0 30 LDX #VDU POINT TO VDU REGISTERS
1416 *
1417 ** CHECK FOR ESCAPE SEQUENCE
1418 *
1419 FD09 7D 7F F2 TST ESCFLG ESCAPE ACTIVE?
1420 FD0C 27 04 BEQ SOROU1 BRANCH IF NOT
1421 FD0E 8D 74 BSR ESCAPE ELSE DO ESCAPE
1422 FD10 20 0D BRA RETURN AND RETURN
1423 *
1424 ** CHECK FOR CONTROL CHARACTERS
1425 *
1426 FD12 81 20 SOROU1 CMPA #$20 CONTROL CODES?
1427 FD14 24 04 BHS SOROU2
1428 FD16 8D 09 BSR CONTRL BRANCH IF SO
1429 FD18 20 05 BRA RETURN
1430 *
1431 ** OUTPUT TEXT CHARACTER
1432 *
1433 FD1A A7 84 SOROU2 STAA VDUCHR,X DISPLAY CHARACTER
1434 FD1C 17 00 C5 LBSR NEWCOL UPDATE COLUMN
1435 *
1436 ** DISPLAY CURSOR AND RETURN
1437 *
1438 FD1F 35 96 RETURN PULS A,B,X,PC RESTORE REGISTERS AND RETURN
1439 *
1440 ***************************************************
1441 * CONTROL CODE HANDLERS *
1442 ***************************************************
1443 *
1444 FD21 81 08 CONTRL CMPA #$08 CTRL H - BACKSPACE ?
1445 FD23 10 27 00 41 LBEQ BACKSP
1446 FD27 81 1B CMPA #$1B ESCAPE SEQUENCE?
1447 FD29 10 27 00 6C LBEQ SETESC
1448 FD2D 81 1A CMPA #$1A CTRL Z - Clear Screen
1449 FD2F 10 27 00 8E LBEQ CLRSCR
1450 FD33 81 16 CMPA #$16 CTRL ^ - Home
1451 FD35 10 27 00 45 LBEQ HOME
1452 FD39 81 0D CMPA #$D CTRL M - RETURN?
1453 FD3B 10 27 00 99 LBEQ CRETN
1454 FD3F 81 0C CMPA #$0C CTRL L - CHAR RIGHT
1455 FD41 10 27 00 2C LBEQ CHRIGHT
1456 FD45 81 0B CMPA #$0B CTRL K - MOVE UP ONE LINE
1457 FD47 10 27 00 11 LBEQ LINEUP
1458 FD4B 81 0A CMPA #$0A CTRL J - LINE FEED
1459 FD4D 26 51 BNE RETESC NONE OF THESE, RETURN
1460 *
1461 ***************************************** LINE FEED
1462 *
1463 FD4F FC 7F EF LINEFD LDD COLADX GET CURRENT COLUMN AND ROW
1464 FD52 5C INCB BUMP ROW
1465 FD53 C1 19 CMPB #NUMLIN SCROLL TIME?
1466 FD55 10 26 00 83 LBNE NEWCUR POSITION CURSOR IF NOT
1467 FD59 16 00 99 LBRA SCROLL ELSE SCROLL IT
1468 *
1469 ***************************************** LINE FEED
1470 *
1471 FD5C FC 7F EF LINEUP LDD COLADX GET CURRENT COLUMN AND ROW
1472 FD5F 5D TSTB AT TOP OF SCREEN ?
1473 FD60 10 27 00 3C LBEQ RETESC Yes, Ignore
1474 FD64 5A DECB No, Decrement ROW
1475 FD65 16 00 74 LBRA NEWCUR POSITION CURSOR
1476 *
1477 *********************************** BACK SPACE
1478 *
1479 FD68 B6 7F EF BACKSP LDA COLADX
1480 FD6B 27 33 BEQ RETESC RETURN
1481 FD6D 4A DECA
1482 FD6E 16 00 68 LBRA POSCOL POSITION CURSOR
1483 *
1484 *********************************** CURSOR RIGHT
1485 *
1486 FD71 B6 7F EF CHRIGHT LDA COLADX
1487 FD74 4C INCA
1488 FD75 81 50 CMPA #LINLEN
1489 FD77 10 27 00 25 LBEQ RETESC
1490 FD7B 16 00 5B LBRA POSCOL
1491 *
1492 *********************************** CURSOR RIGHT
1493 *
1494 FD7E CC 00 00 HOME LDD #0 HOME - POSITION TOP OF SCREEN
1495 FD81 16 00 58 LBRA NEWCUR
1496 *
1497 ***************************************************
1498 * ESCAPE HANDLERS *
1499 ***************************************************
1500 *
1501 FD84 F6 7F F2 ESCAPE LDAB ESCFLG GET FLAG
1502 FD87 C1 3D CMPB #'= SETTING CURSOR?
1503 FD89 27 16 BEQ ESCCUR BRANCH IF SO
1504 FD8B 81 59 CMPA #'Y CLEAR TO END OF SCREEN?
1505 FD8D 10 27 00 6E LBEQ ESCCLS
1506 FD91 81 54 CMPA #'T CLEAR TO END OF LINE?
1507 FD93 27 31 BEQ ESCCLL
1508 FD95 81 3D CMPA #'= STARTING CURSOR SET?
1509 FD97 26 04 BNE CLRESC BRANCH IF NOT
1510 *
1511 ***************************** START ESCAPE SEQUENCE
1512 *
1513 FD99 B7 7F F2 SETESC STAA ESCFLG ELSE START CURSORING
1514 FD9C 39 RTS AND RETURN
1515 *
1516 FD9D 7F 7F F2 CLRESC CLR ESCFLG NO OTHERS SUPPORTED
1517 FDA0 39 RETESC RTS SO RETURN
1518 *
1519 ********************************* SET SCREEN CURSOR
1520 *
1521 FDA1 7D 7F F1 ESCCUR TST NEWROW ROW SET?
1522 FDA4 26 04 BNE ESCCU1 BRANCH IF SO
1523 FDA6 B7 7F F1 STAA NEWROW ELSE SET NEW ROW
1524 FDA9 39 RTS AND RETURN
1525 *
1526 FDAA 7F 7F F2 ESCCU1 CLR ESCFLG
1527 FDAD 80 20 SUBA #$20 ADJUST COLUMN ADDRESS
1528 FDAF 81 4F CMPA #LINLEN-1 CHECK FOR ACCEPTABLE COLUM
1529 FDB1 22 ED BHI RETESC NOT OK, DO NOTHING
1530 *
1531 FDB3 F6 7F F1 ESCCU2 LDAB NEWROW
1532 FDB6 7F 7F F1 CLR NEWROW
1533 FDB9 C0 20 SUBB #$20 ADJUST TO ROW ADDRESS
1534 FDBB C1 18 CMPB #NUMLIN-1 CHECK FOR ACCEPTABLE ROW
1535 FDBD 22 E1 BHI RETESC ELSE RETURN DOING NOTHING
1536 FDBF 20 1B BRA NEWCUR GO SET NEW CURSOR IF SO
1537 *
1538 ****************** CLEAR FROM CURSOR TO END OF LINE
1539 FDC1 CC 00 00 CLRSCR LDD #0 CLEAR FROM TOP OF SCREEN
1540 FDC4 8D 16 BSR NEWCUR
1541 FDC6 B6 7F EF ESCCLL LDA COLADX
1542 FDC9 C6 20 LDB #$20 AND CLEAR CHAR
1543 FDCB E7 84 ESCCL1 STB VDUCHR,X DISPLAY TEXT
1544 FDCD 4C INCA
1545 FDCE A7 02 STA VDUCOL,X
1546 FDD0 81 50 CMPA #LINLEN UNTIL END OF LINE
1547 FDD2 26 F7 BNE ESCCL1
1548 FDD4 7F 7F F2 CLR ESCFLG
1549 FDD7 39 RTS
1550 *
1551 *********************************** CARRIAGE RETURN
1552 *
1553 FDD8 4F CRETN CLRA SET COLUMN ZERO
1554 FDD9 F6 7F F0 POSCOL LDB ROWADX GET CURRENT ROW
1555 *
1556 *********** GENERATE NEW CURSOR POSITION AND RETURN
1557 *
1558 FDDC FD 7F EF NEWCUR STD COLADX SAVE NEW ROW AND COLUMN
1559 FDDF A7 02 STA VDUCOL,X SET NEW COLUMN
1560 FDE1 E7 03 STB VDUROW,X SET NEW ROW
1561 FDE3 39 RTS AND RETURN
1562 *
1563 ********************* UPDATE CURRENT COLUMN AND ROW
1564 *
1565 FDE4 FC 7F EF NEWCOL LDD COLADX GET ROW AND COLUMN
1566 FDE7 4C INCA BUMP COLUMN
1567 FDE8 81 50 CMPA #LINLEN ROLL?
1568 FDEA 26 F0 BNE NEWCUR BRANCH IF NOT
1569 FDEC 4F CLRA ELSE RESET TO ZERO
1570 FDED 5C INCB AND BUMP ROW
1571 FDEE C1 19 CMPB #NUMLIN
1572 FDF0 26 EA BNE NEWCUR
1573 FDF2 5A DECB BOTTOM ROW
1574 FDF3 8D E7 BSR NEWCUR
1575 *
1576 ********************************* SCROLL THE SCREEN
1577 *
1578 FDF5 E6 04 SCROLL LDB VDUOFF,X
1579 FDF7 5C INCB
1580 FDF8 C1 19 CMPB #NUMLIN
1581 FDFA 25 01 BLO SCROL1
1582 FDFC 5F CLRB
1583 FDFD E7 04 SCROL1 STB VDUOFF,X
1584 *
1585 **************** CLEAR FROM CURSOR TO END OF SCREEN
1586 *
1587 FDFF F6 7F EF ESCCLS LDB COLADX GET CURSOR
1588 FE02 86 20 LDA #$20 GET A SPACE
1589 FE04 F7 7F EF ESCCLS1 STB COLADX
1590 FE07 E7 02 STB VDUCOL,X
1591 FE09 A7 84 STA VDUCHR,X
1592 FE0B 5C INCB
1593 FE0C C1 50 CMPB #LINLEN
1594 FE0E 26 F4 BNE ESCCLS1
1595 *
1596 FE10 F6 7F F0 LDB ROWADX
1597 FE13 5C INCB
1598 FE14 C1 19 CMPB #NUMLIN
1599 FE16 27 08 BEQ ESCCLS2
1600 FE18 F7 7F F0 STB ROWADX
1601 FE1B E7 03 STB VDUROW,X
1602 FE1D 5F CLRB
1603 FE1E 20 E4 BRA ESCCLS1
1604 *
1605 FE20 5F ESCCLS2 CLRB
1606 FE21 F7 7F EF STB COLADX
1607 FE24 E7 02 STB VDUCOL,X
1608 FE26 F7 7F F2 STB ESCFLG
1609 FE29 39 RTS
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 FE2A JMPTAB EQU *
1916 FE2A 01 FCB 1 " ^A "
1917 FE2B FB 67 FDB ALTRA
1918 FE2D 02 FCB 2 " ^B "
1919 FE2E FB 5C FDB ALTRB
1920 FE30 03 FCB 3 " ^C "
1921 FE31 FB 72 FDB ALTRCC
1922 FE33 04 FCB 4 " ^D "
1923 FE34 FB 51 FDB ALTRDP
1924 FE36 10 FCB $10 " ^P "
1925 FE37 FB 24 FDB ALTRPC
1926 FE39 15 FCB $15 " ^U "
1927 FE3A FB 30 FDB ALTRU
1928 FE3C 18 FCB $18 " ^X "
1929 FE3D FB 46 FDB ALTRX
1930 FE3F 19 FCB $19 " ^Y "
1931 FE40 FB 3B FDB ALTRY
1932 *
1933 FE42 42 FCC 'B'
1934 FE43 F9 46 FDB BRKPNT
1935 FE45 45 FCC 'E'
1936 FE46 F8 E7 FDB MEMDUMP
1937 FE48 47 FCC 'G'
1938 FE49 F8 8F FDB GO
1939 FE4B 4C FCC 'L'
1940 FE4C FA 51 FDB LOAD
1941 FE4E 50 FCC 'P'
1942 FE4F FA AF FDB PUNCH
1943 FE51 4D FCC 'M'
1944 FE52 F8 92 FDB MEMCHG
1945 FE54 52 FCC 'R'
1946 FE55 FB E0 FDB REGSTR
1947 FE57 53 FCC 'S'
1948 FE58 F8 DB FDB DISSTK
1949 FE5A 58 FCC 'X'
1950 FE5B F9 72 FDB XBKPNT
1951 IFD MFDCOPT
1952 FCC 'D' *** SWTPC USES 'U' FOR MINIBOOT
1953 FDB MINBOOT
1954 ENDIF MFDCOPT
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 FCC 'U' *** SWTPC USES 'D' FOR DMAF2 BOOT
1965 FDB DBOOT
1966 ENDIF DMAFOPT
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 FE5D 54 FCC "T"
1977 FE5E F9 C5 FDB TRACE
1978 ENDIF TRAOPT
1979 *
1980 FE60 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 FE60 F9 7E RAMVEC FDB SWIE USER-V
1992 FE62 F8 91 FDB RTI SWI3-V
1993 FE64 F8 91 FDB RTI SWI2-V
1994 FE66 F8 91 FDB RTI FIRQ-V
1995 FE68 F8 91 FDB RTI IRQ-V
1996 FE6A F9 7E FDB SWIE SWI-V
1997 FE6C FF FF FDB $FFFF SVC-VO
1998 FE6E FF FF FDB $FFFF SVC-VL
1999 *
2000 * PRINTABLE MESSAGE STRINGS
2001 *
2002 FE70 0D 0A 00 00 00 MSG1 FCB $D,$A,$0,$0,$0 * 0, CR/LF, 0
2003 FE75 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 FE86 53 33 45 20 FCC 'S3E '
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 FCC 'SWTPC '
2018 ENDIF SWTOPT
2018 ENDIF SWTOPT
2019 IFD XESOPT`
2020 FCC 'XESS '
2021 ENDIF XESOPT
2021 ENDIF XESOPT
2022 FE8A 20 2D 20 FCC ' - '
2023 FE8D 04 FCB 4
2024 FE8E 4B 0D 0A 00 00 00 MSG2 FCB 'K,$D,$A,$00,$00,$00,$04 K, * CR/LF + 3 NULS
04
2025 FE95 3E MSG3 FCC '>'
2026 FE96 04 FCB 4
2027 FE97 57 48 41 54 3F MSG4 FCC 'WHAT?'
2028 FE9C 04 FCB 4
2029 FE9D 20 2D 20 MSG5 FCC ' - '
2030 FEA0 04 FCB 4'
2031 FEA1 20 20 53 50 3D MSG10 FCC ' SP='
2032 FEA6 04 FCB 4
2033 FEA7 20 20 50 43 3D MSG11 FCC ' PC='
2034 FEAC 04 FCB 4
2035 FEAD 20 20 55 53 3D MSG12 FCC ' US='
2036 FEB2 04 FCB 4
2037 FEB3 20 20 49 59 3D MSG13 FCC ' IY='
2038 FEB8 04 FCB 4
2039 FEB9 20 20 49 58 3D MSG14 FCC ' IX='
2040 FEBE 04 FCB 4
2041 FEBF 20 20 44 50 3D MSG15 FCC ' DP='
2042 FEC4 04 FCB 4
2043 FEC5 20 20 41 3D MSG16 FCC ' A='
2044 FEC9 04 FCB 4
2045 FECA 20 20 42 3D MSG17 FCC ' B='
2046 FECE 04 FCB 4
2047 FECF 20 20 43 43 3A 20 MSG18 FCC ' CC: '
2048 FED5 04 FCB 4
2049 FED6 45 46 48 49 4E 5A MSG19 FCC 'EFHINZVC'
56 43
2050 FEDE 53 31 MSG20 FCC 'S1'
2051 FEE0 04 FCB 4
2052 IFD DATOPT
2053 *
2054 * POWER UP/ RESET/ NMI ENTRY POINT
2055 *
2056 ORG $FF00
2057 *
2058 *
2059 START LDX #IC11 POINT TO DAT RAM IC11
2060 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 DATLP STA ,X+ STORE & POINT TO NEXT RAM LOCATION
2071 DECA GET COMP. VALUE FOR NEXT LOCATION
2072 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 LDA #$F0
2079 STA ,X STORE $F0 AT $FFFF
2080 LDX #$D0A0 ASSUME RAM TO BE AT $D000-$DFFF
2081 LDY #TSTPAT LOAD TEST DATA PATTERN INTO "Y"
2082 TSTRAM LDU ,X SAVE DATA FROM TEST LOCATION
2083 STY ,X STORE TEST PATTERN AT $D0A0
2084 CMPY ,X IS THERE RAM AT THIS LOCATION ?
2085 BEQ CNVADR IF MATCH THERE'S RAM, SO SKIP
2086 LEAX -$1000,X ELSE POINT 4K LOWER
2087 CMPX #$F0A0 DECREMENTED PAST ZER0 YET ?
2088 BNE TSTRAM IF NOT CONTINUE TESTING FOR RAM
2089 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 CNVADR STU ,X RESTORE DATA AT TEST LOCATION
2115 TFR X,D PUT ADDR. OF PRESENT 4K BLOCK IN D
2116 COMA COMPLEMENT MSB OF THAT ADDRESS
2117 LSRA PUT MS 4 BITS OF ADDRESS IN
2118 LSRA LOCATION D0-D3 TO ALLOW STORING
2119 LSRA IT IN THE DYNAMIC ADDRESS
2120 LSRA TRANSLATION RAM.
2121 STA $FFFD STORE XLATION FACTOR IN DAT "D"
2122 *
2123 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 LDY #LRARAM POINT TO LOGICAL/REAL ADDR. TABLE
2158 STA 13,Y STORE $D--- XLATION FACTOR AT $DFDD
2159 CLR 14,Y CLEAR $DFDE
2160 LDA #$F0 DESTINED FOR IC8 AN MEM EXPANSION ?
2161 STA 15,Y STORE AT $DFDF
2162 LDA #$0C PRESET NUMBER OF BYTES TO CLEAR
2163 CLRLRT CLR A,Y CLEAR $DFDC THRU $DFD0
2164 DECA SUB. 1 FROM BYTES LEFT TO CLEAR
2165 BPL CLRLRT CONTINUE IF NOT DONE CLEARING
2166 FNDRAM LEAX -$1000,X POINT TO NEXT LOWER 4K OF RAM
2167 CMPX #$F0A0 TEST FOR DECREMENT PAST ZERO
2168 BEQ FINTAB SKIP IF FINISHED
2169 LDU ,X SAVE DATA AT CURRENT TEST LOCATION
2170 LDY #TSTPAT LOAD TEST DATA PATTERN INTO Y REG.
2171 STY ,X STORE TEST PATT. INTO RAM TEST LOC.
2172 CMPY ,X VERIFY RAM AT TEST LOCATION
2173 BNE FNDRAM IF NO RAM GO LOOK 4K LOWER
2174 STU ,X ELSE RESTORE DATA TO TEST LOCATION
2175 LDY #LRARAM POINT TO LOGICAL/REAL ADDR. TABLE
2176 TFR X,D PUT ADDR. OF PRESENT 4K BLOCK IN D
2177 LSRA PUT MS 4 BITS OF ADDR. IN LOC. D0-D3
2178 LSRA TO ALLOW STORING IT IN THE DAT RAM.
2179 LSRA
2180 LSRA
2181 TFR A,B SAVE OFFSET INTO LRARAM TABLE
2182 EORA #$0F INVERT MSB OF ADDR. OF CURRENT 4K BLK
2183 STA B,Y SAVE TRANSLATION FACTOR IN LRARAM TABLE
2184 BRA FNDRAM GO TRANSLATE ADDR. OF NEXT 4K BLK
2185 FINTAB LDA #$F1 DESTINED FOR IC8 AND MEM EXPANSION ?
2186 LDY #LRARAM POINT TO LRARAM TABLE
2187 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 LDA #$0C PRESET NUMBER HEX "C"
2196 FINDC LDB A,Y GET ENTRY FROM LRARAM TABLE
2197 BNE FOUNDC BRANCH IF RAM THIS PHYSICAL ADDR.
2198 DECA ELSE POINT 4K LOWER
2199 BPL FINDC GO TRY AGAIN
2200 BRA XFERTF
2201 FOUNDC CLR A,Y CLR XLATION FACTOR OF 4K BLOCK FOUND
2202 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 CLRA START AT ZERO
2210 TFR Y,X START POINTER "X" START OF "LRARAM" TABLE.
2211 COMPRS LDB A,Y GET ENTRY FROM "LRARAM" TABLE
2212 BEQ PNTNXT IF IT'S ZER0 SKIP
2213 CLR A,Y ELSE ERASE FROM TABLE
2214 STB ,X+ AND ENTER ABOVE LAST ENTRY- BUMP
2215 PNTNXT INCA GET OFFSET TO NEXT ENTRY
2216 CMPA #$0C LAST ENTRY YET ?
2217 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 XFERTF LDX #IC11 POINT TO DAT RAM IC11
2224 LDB #$10 GET NO. OF BYTES TO MOVE
2225 FETCH LDA ,Y+ GET BYTE AND POINT TO NEXT
2226 STA ,X+ POKE XLATION FACTOR IN IC11
2227 DECB SUB 1 FROM BYTES TO MOVE
2228 BNE FETCH CONTINUE UNTIL 16 MOVED
2229 *
2230 ELSE
2231 FEE1 39 LRA RTS
2232 FEE2 10 CE 7F C0 START LDS #STACK INITIALIZE STACK POINTER
2233 FEE6 5F CLRB
2234 ENDIF DATOPT
2235 *
2236 FEE7 53 COMB SET "B" NON-ZERO
2237 FEE8 F7 7F D2 STB ECHO TURN ON ECHO FLAG
2238 FEEB 16 F9 26 LBRA MONITOR INITIALIZATION IS COMPLETE
2239 *
2240 ** INTERRUPT JUMP VECTORS
2241 *
2242 FEEE 6E 9F 7F C0 V1 JMP [STACK]
2243 FEF2 6E 9F 7F C4 V2 JMP [SWI2]
2244 FEF6 6E 9F 7F C6 V3 JMP [FIRQ]
2245 FEFA 6E 9F 7F C8 V4 JMP [IRQ]
2246 FEFE 6E 9F 7F CA V5 JMP [SWI]
2247 *
2248 * SWI3 ENTRY POINT
2249 *
2250 FF02 1F 43 SWI3E TFR S,U
2251 FF04 AE 4A LDX 10,U *$FFC8
2252 FF06 E6 80 LDB ,X+
2253 FF08 AF 4A STX 10,U
2254 FF0A 4F CLRA
2255 FF0B 58 ASLB
2256 FF0C 49 ROLA
2257 FF0D BE 7F CC LDX SVCVO
2258 FF10 8C FF FF CMPX #$FFFF
2259 FF13 27 0F BEQ SWI3Z
2260 FF15 30 8B LEAX D,X
2261 FF17 BC 7F CE CMPX SVCVL
2262 FF1A 22 08 BHI SWI3Z
2263 FF1C 34 10 PSHS X
2264 FF1E EC C4 LDD ,U
2265 FF20 AE 44 LDX 4,U
2266 FF22 6E F1 JMP [,S++]
2267 FF24 37 1F SWI3Z PULU A,B,X,CC,DP
2268 FF26 EE 42 LDU 2,U
2269 FF28 6E 9F 7F C2 JMP [SWI3]
2270 *
2271 * 6809 VECTORS
2272 *
2273 FFF0 ORG $FFF0
2274 FFF0 FE EE FDB V1 USER-V
2275 FFF2 FF 02 FDB SWI3E SWI3-V
2276 FFF4 FE F2 FDB V2 SWI2-V
2277 FFF6 FE F6 FDB V3 FIRQ-V
2278 FFF8 FE FA FDB V4 IRQ-V
2279 FFFA FE FE FDB V5 SWI-V
2280 FFFC FE EE FDB V1 NMI-V
2281 FFFE FE E2 FDB START RESTART-V
0004 END START
0005 END
Program + Init Data = 1852 bytes
Error count = 0
Go to most recent revision | Compare with Previous | Blame | View Log