00001 ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00002 ;* * 00003 ;* W65C816S PROOF OF CONCEPT SINGLE-BOARD COMPUTER * 00004 ;* * 00005 ;* S Y S T E M F I R M W A R E * 00006 ;* ——————————————————————————————————————————————————————————————————————————————— * 00007 ;* Copyright ©1991-2020 by BCS Technology Limited. All rights reserved. * 00008 ;* * 00009 ;* Permission is hereby granted to use, copy, modify and distribute this software, * 00010 ;* provided this copyright notice remains unaltered in the source code and proper * 00011 ;* attribution is given. Redistribution, in any form, must be at no charge to the * 00012 ;* end user. This code or any part thereof, including any derivation, MAY NOT be * 00013 ;* incorporated into any package intended for sale unless written permission to do * 00014 ;* so has been granted by the copyright holder. * 00015 ;* ——————————————————————————————————————————————————————————————————————————————— * 00016 ;* THERE IS NO WARRANTY OF ANY KIND WITH THIS SOFTWARE. * 00017 ;* * 00018 ;* While it is believed that all code will perform as intended, the user assumes * 00019 ;* all risk in connection with the incorporation of this software into any system. * 00020 ;* * 00021 ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00022 ; 00023 ; * * * * * * * * * * * * 00024 ; * VERSION INFORMATION * 00025 ; * * * * * * * * * * * * 00026 ; 00027 hardvers .macro ;hardware version 00028 ; 00029 hwdate .macro ;hardware version date 00030 ; 00031 copyyear .macro ;firmware copyright year 00032 ; 00033 softvers .macro ;software version 00034 ; 00035 romsnum .macro ;ROM identification 00036 ; 00037 ; 00038 ;REVISION TABLE 00039 ; 00040 ;Ver Date Revision Description 00041 ;——————————————————————————————————————————————————————————————————————————————— 00042 ;1.11 2020/02/17 A) Firmware adapted to POC hardware version 1.2 for baseline 00043 ; testing. Also, banner graphics rendition changed from 00044 ; hardware to software in preparation for eventual test of 00045 ; ANSI/VT100 console emulation. 00046 ; 00047 ; 2020/03/01 A) SIO driver ISR changed from polling vQUART registers to 00048 ; reading & analyzing hardware channel interrupt status. 00049 ; B) Permanently set SIO circular queue size to 64 datums. 00050 ; C) Detail change in the SIO driver receiver ISR in how it han- 00051 ; dles the queue pointer. 00052 ; D) Moved the top-of-stack to $00BFFF & repositioned the SIO 00053 ; queues below the stack. 00054 ; 00055 ; 2020/05/10 A) Activated SIO channels C & D. Timer B not activated at 00056 ; this time. Also, there is no path at this time to communi- 00057 ; cate with channels C & D. 00058 ; 00059 ; 2020/05/11 A) Added primitives to communicate through SIO channels C & D. 00060 ; B) Added jump table entries for testing SIO channels C & D. 00061 ; C) Revised algorithm for computing SIO queue pointers, as the 00062 ; existing algorithm was incorrect for 4 channels. 00063 ; D) Changed use of a horizontal tab for separating address col- 00064 ; umns in the monitor C & H functions to multiple spaces. 00065 ; 00066 ; 2020/05/17 A) Changed time delay function so less code is executed in the 00067 ; timekeeping part of the interrupt handler. 00068 ; 00069 ; 2020/11/28 A) Syntax changes made to work with assembler version 1.3, 00070 ; which now natively supports the 65C816 assembly language. 00071 ; Also, edits were made to recognize % as the binary radix 00072 ; (.OPT SWAPBIN) & to coerce immediate mode operands to 16 00073 ; bits where applicable. Firmware version is designated as 00074 ; 1.11.4a for documentation purposes only. No code changes 00075 ; have been made in this revision. 00076 ;——— 00077 ;1.10 2017/02/21 A) SIO driver rewritten to use static direct page pointers 00078 ; to access UART registers & circular queues. 00079 ; B) Code that sets DB taken out of primitives & ISRs, as it has 00080 ; no effect on POC V1 circuitry. 00081 ; 00082 ; 2017/03/15 A) Added "HBA present" flag in direct page & modified SCSICMD 00083 ; function to immediately abort if this flag is not set. 00084 ; B) Modified SCSI section of IRQ handler to test "HBA present" 00085 ; flag & skip over code if HBA isn't present. 00086 ; 00087 ; 2017/05/25 A) Modified SIO ISR to work strictly by channel indexing. 00088 ;——— 00089 ;1.9 2015/04/29 A) Jiffy IRQ is now generated by the C/T in the DUART. 00090 ; B) Deactivated all RTC IRQs. No reference is made within this 00091 ; firmware to the RTC's date & time registers. 00092 ; 00093 ; 2015/05/04 A) Changed interrupt level for UART receivers. 00094 ; 00095 ; 2015/12/16 A) Added test for null byte in S-record input stream process- 00096 ; ing. 00097 ; B) Added code in BIOS calls that assures the correct value is 00098 ; in DP regardless of what the caller is using for direct 00099 ; page. 00100 ; C) SIO queues enlarged to 256 bytes. 00101 ; D) Default stack pointer relocated to $00CBFF to accommodate 00102 ; change C above. 00103 ; 00104 ; 2016/01/01 A) Changed the way in which DP is handled when the monitor is 00105 ; entered via a BReaK. 00106 ; 00107 ; 2016/01/17 A) Detail change in SCSICMD that saved a few instructions. 00108 ;——— 00109 ;1.8 2015/04/25 A) Changed interrupt priority so RTC IRQs are serviced before 00110 ; UART IRQs. 00111 ; B) Made changes to the UART driver to reflect a more universal 00112 ; approach to handling both DUARTs & QUARTs. 00113 ; C) Detail change to time delay counter & free running clock 00114 ; ISR code to improve long-term accuracy & reduce code size. 00115 ; D) NXP 28L92 is now the assumed UART. However, new code will 00116 ; continue to work with the 26C92. 00117 ; E) UNIX time feature is now permanent. 00118 ; 00119 ; 2015/04/26 A) Changed the IRQ priority & compacted the IRQ ISR a bit. 00120 ;——— 00121 ;1.7 2015/02/25 A) Added experimental UNIX time feature. New jump table ent- 00122 ; ries added to get & set the clock value. 00123 ; 00124 ; 2015/03/26 A) Removed console clock setting code. 00125 ; B) Moved CHANBCTL jump table slot to occupy slot previously 00126 ; assigned to console clock setting entry. 00127 ;——— 00128 ;1.6 2014/06/02 A) SIO driver rewritten to use channel indexing instead of 00129 ; redundant code. This change is a verification of a method 00130 ; that will be used in future UART drivers. 00131 ; 00132 ; 2014/06/28 A) Added SCSIHAID (get SCSI host adapter bus ID) function to 00133 ; jump table. Jump table realigned to place SCSIHAID after 00134 ; SCSICMD. 00135 ; B) Changed the monitor load function to end after processing 00136 ; an S9 record. The terminating is no longer required. 00137 ; 00138 ; 2015/01/19 A) Entering the monitor now initializes the status register so 00139 ; registers are set to 16 bits. 00140 ;——— 00141 ;1.5 2013/10/13 A) Restructured GETUTIM to accept a storage address in .X 00142 ; B) BASINA renamed to GETCHA & BASINB renamed to GETCHB. 00143 ; C) BSOUTA renamed to PUTCHA & BSOUTB renamed to PUTCHB. 00144 ; D) SPRINT removed from jump table. 00145 ; E) Added CHANBCTL (channel-B control) function to jump table. 00146 ; F) Added IRQ vector display to monitor register dump function. 00147 ; G) Reorganized INCLUDE files so that BIOS data tables are all 00148 ; stored in a common subdirectory. 00149 ; H) General code compaction. 00150 ; 00151 ; 2013/10/23 A) ALARM function removed & jump table entry deleted. Jump 00152 ; table realigned. 00153 ; B) SIO driver changed to support 26C92 added features. 00154 ; C) Console & auxiliary ports now running at 115.2Kbps. 00155 ; D) Monitor now recognizes PEA # and PEI as syntacti- 00156 ; cally correct during assembly. 00157 ; 00158 ; 2013/10/24 A) Change the way in which I/O device setup parameters are 00159 ; processed during reset. 00160 ; 00161 ; 2013/11/04 A) Fixed a problem where the B-accumulator wasn't always being 00162 ; be copied to shadow storage after return from execution of 00163 ; a J command. 00164 ; 00165 ; 2014/01/23 A) Detail change to the POST screen following memory test. 00166 ; 00167 ; 2014/01/31 A) Changed the way in which the 53C94 clock factor & (re)sel- 00168 ; ection timeout setup values are computed. The previous 00169 ; method was not matching the ANSI T10 recommendations in all 00170 ; cases. 00171 ; B) Performed some code compaction. 00172 ; 00173 ; 2014/04/05 A) SPRINT string pointer parameter now passed through stack. 00174 ; B) Removed SEI & CLI instructions from the SCSI DMA data-in 00175 ; code (SSXFRIN). 00176 ;——— 00177 ;1.4 2013/06/26 A) SSLOTADR removed from BIOS jump table & converted to an in- 00178 ; ternal function. 00179 ; B) New function SCSIPARM (get SCSI device parameters) add to 00180 ; BIOS jump table. 00181 ; C) Reorganized BIOS jump table. SSSCMD renamed to SCSICMD but 00182 ; otherwise unchanged. 00183 ; D) Made enhancements to the SCSI enumeration algorithm to red- 00184 ; uce boot time. 00185 ; E) Reorganized the SCSI subsystem code sections. 00186 ; 00187 ; 2013/07/03 A) Changed the way SIO transmission is reenabled when data 00188 ; is written to TxD buffers. 00189 ;——— 00190 ;1.3 2013/05/27 A) Added GETUTIM (get uptime) BIOS call. 00191 ; B) Enlarged monitor auxiliary buffer to accept up to 32 bytes 00192 ; in a search pattern. 00193 ; C) Modified the way in which ABT, BRK, COP & NMI enter the M/L 00194 ; monitor if not revectored. 00195 ;——— 00196 ;1.2 2013/01/02 A) Changed the SCSI "test ready" algorithm to reduce the boot 00197 ; time. 00198 ; B) Removed the Ctrl-D soft reset function from the monitor. 00199 ;——— 00200 ;1.1 2012/09/10 A) Added tape rewind command to M/L monitor. 00201 ; B) Detail change in the SCSI driver DMA setup to properly han- 00202 ; dle block size to bytes conversion when a stream device is 00203 ; being accessed. Previously, the conversion was being taken 00204 ; for any read or write operation that accessed the medium. 00205 ; 00206 ; 2012/09/11 A) Slight code shrink in the SCSI driver DMA setup. 00207 ; 00208 ; 2012/09/17 A) Enlarged field in monitor SCSI read/write commands to 00209 ; accept a 16 bit quantity to suppport READ(10) & WRITE(10). 00210 ; 00211 ;1.0 2012/09/07 A) First production version. 00212 ;——————————————— 00213 ;0.9 2012/09/01 A) Changed all programatic references to the TMSTD subroutine 00214 ; to 2 consecutive WAI instructions, as they produce the same 00215 ; effect with slightly less code. 00216 ; B) Consistent with change 'A', removed "common/time.asm" from 00217 ; INCLUDEs, as it is no longer used. 00218 ; C) Changed alarm handler so it no longer uses the programmable 00219 ; delay counter. 00220 ; D) Modified time delay function to initialize the milliseconds 00221 ; counter for a more precise delay when short delay times are 00222 ; programmed. 00223 ;——— 00224 ;0.8 2012/08/11 A) Rewrote SCSI driver to use IRQs instead of polling. 00225 ; B) All SCSI I/O functions are now handled by DMA channel hand- 00226 ; shakes, except for command initiation. 00227 ; 00228 ; 2012/08/17 A) Modified IRQ handler to immediately exit after processing a 00229 ; SCSI interrupt. 00230 ; B) Modified NMI handler to ignore NMI if generated while any 00231 ; code in ROM is being accessed. 00232 ;——— 00233 ;0.7 2012/06/20 A) Method used to translate between assembly language & mach- 00234 ; ine instructions rewritten in order to shrink table sizes & 00235 ; improve execution speed. 00236 ; B) 53C94 FIFO count test removed from SCSI command execution, 00237 ; as this test is conducted during SCSI subsystem setup. 00238 ; 00239 ; 2012/07/25 A) Modified SCSI enumeration to store the device's capacity in 00240 ; blocks into the device table instead of the maximum LBA. 00241 ; 00242 ; 2012/08/05 A) Changed the way the BIOS executes the master boot code. 00243 ; B) Modified the SCSI driver primitive so the alarm time can be 00244 ; changed to accommodate slow operations like formatting a 00245 ; disk. Default alarm time reduced to 1 sec, which is more 00246 ; than enough for a device-not-present error to be be return- 00247 ; ed if a target is unresponsive. 00248 ; C) Modified the test ready part of SCSI enumeration to make 00249 ; multiple attempts to get device status before abandoning. 00250 ; 00251 ; 2012/08/06 A) Disabled the alarm function in the SCSI driver primitive. 00252 ;——— 00253 ;0.6 2012/05/31 A) SCSI driver rewritten to use DREQ handshake during data-in 00254 ; & data-out phases. PIO continues to be used in all other 00255 ; phases. 00256 ; 00257 ; 2012/06/05 A) Shrunk SCSI driver code. 00258 ; 00259 ; 2012/06/17 A) Replaced JMP absl instruction with JML absl to conform to 00260 ; WDC recommended assembler syntax. 00261 ; B) Enlarged SCSI enumeration temporary work area to accommod- 00262 ; ate additional information retrieved during device inquiry 00263 ; operation. 00264 ;——— 00265 ;0.5 2012/04/28 A) Added a static SCSI device table, which is populated during 00266 ; the SCSI enumeration process. 00267 ; B) Added the SSLOTADR function, which returns a pointer to the 00268 ; device table slot associated with a given SCSI ID. 00269 ; C) BIOS can load a boot block from the boot device, currently 00270 ; defined as SCSI ID 0, LUN 0, & execute code therein. 00271 ; 00272 ; 2012/05/10 A) Modified ISRs so data bank & direct page pointer are pushed 00273 ; as part of the stack frame. 00274 ; B) Modified monitor G & J commands to accommodate changes to 00275 ; ISR stack frame structure. 00276 ; 00277 ; 2012/05/16 A) Added alarm function to BIOS. 00278 ; B) Using alarm function to break SCSI controller command loop 00279 ; if no response occurs. 00280 ; 00281 ; 2012/05/19 A) Restructured the SCSI controller initialization code to a 00282 ; smaller & more efficient form. 00283 ; B) Changed the SCSI controller FIFO bit pattern to one that 00284 ; exercises more bits. 00285 ; 00286 ; 2012/05/19 A) Relocated SIO buffers higher in RAM & relocated the top 00287 ; of the MPU stack below the bottom of the last SIO buf- 00288 ; fer to prevent a collision between the stack & the buffers. 00289 ; B) Reduced all SIO buffer sizes to 128 bytes. 00290 ;——— 00291 ;0.4 2011/10/01 A) Added SCSI initialization functions to reset. 00292 ; B) Added BIOS jump table entry for SCSI initialization. 00293 ; C) Added BIOS jump table entry for SCSI command execution. 00294 ; D) Added SCSI subsystem commands to monitor. 00295 ; E) Added SCSI device enumeration. 00296 ; 00297 ; 2012/03/03 A) Restructured NVRAM to include serial number & other data. 00298 ;——— 00299 ;0.3 2011/09/15 A) Reset now uses the native mode stack location instead of 00300 ; the emulation mode stack. 00301 ; B) The native mode stack is tested prior to enabling IRQs & 00302 ; I/O activity. 00303 ;——— 00304 ;0.2 2011/07/06 A) Converted SIO from polled to interrupt-driven. 00305 ; B) Modified RAM testing to test the emulation mode stack bef- 00306 ; ore configuring I/O or starting IRQs. 00307 ;——— 00308 ;0.1 2010/08/01 A) ROM BIOS running in the MPU's native mode. 00309 ; B) Entire BIOS rewritten to use 16 bit code where possible. 00310 ; C) Monitor now has all relevant functions, including code ass- 00311 ; embly & disassembly. 00312 ;——— 00313 ;0.0 2009/12/24 A) Original ROM BIOS running in the MPU's emulation mode. 00314 ;——————————————————————————————————————————————————————————————————————————————— 00315 ; 00316 ; 00317 ; COMMENT ABBREVIATIONS 00318 ; —————————————————————————————————————————————————————————————————— 00319 ; ACIA asynchronous communication interface adapter, aka UART 00320 ; BCD binary-coded decimal 00321 ; BIN binary 00322 ; BIOS basic input/output subsystem 00323 ; BRG baud rate generator 00324 ; C/T counter/timer 00325 ; CD compact disk 00326 ; CDA compact disk drive 00327 ; CDB SCSI command descriptor block 00328 ; CFIFO circular first-in, first-out structure, aka circular queue 00329 ; CTS TIA-232 clear to send 00330 ; DMA direct memory access 00331 ; DP direct page or page zero, also MPU direct page register 00332 ; DSR TIA-232 data set ready 00333 ; DTR TIA-232 data terminal ready 00334 ; DUART dual ACIA or dual UART 00335 ; EOF end-of-field 00336 ; EOI end-of-input 00337 ; EOM end-of-medium 00338 ; EOR end-of-record 00339 ; EOT end-of-text (not same as ASCII ) 00340 ; FIFO first-in, first-out structure 00341 ; FS filesystem (not same as ASCII ) 00342 ; HBA SCSI host adapter 00343 ; HDA hard disk drive 00344 ; HZ frequency in Hertz 00345 ; IMR interrupt mask register 00346 ; ISL initial system load 00347 ; ISR interrupt service routine or interrupt status register 00348 ; LBA logical block address 00349 ; LBO logical block offset 00350 ; LSB least significant byte/bit 00351 ; LSD least significant digit 00352 ; LSDW least significant double word 00353 ; LSN least significant nybble 00354 ; LSW least significant word 00355 ; LUN SCSI logical unit number 00356 ; MFU major phuque-up 00357 ; MPU microprocessor 00358 ; MSB most significant byte/bit 00359 ; MSD most significant digit 00360 ; MSDW most significant double word 00361 ; MSN most significant nybble 00362 ; MSW most-significant word 00363 ; NVRAM non-volatile RAM 00364 ; OS operating system 00365 ; OSL operating system load 00366 ; RAM random access memory 00367 ; RHR DUART receiver holding register, aka FIFO 00368 ; RTC real-time clock (see also WDT) 00369 ; RTS TIA-232 request to send 00370 ; RxD DUART data receive(r) 00371 ; SCSI small computer system interface 00372 ; SDID SCSI device bus ID 00373 ; TAM BAM tag block bitmap 00374 ; TDM magnetic tape drive 00375 ; THR DUART transmitter holding register, aka FIFO 00376 ; TxD DUART data transmit(ter) 00377 ; TZ time zone 00378 ; UART universal asynchronous receiver/transmitter, aka ACIA 00379 ; UTC oordinated universal time, aka Zulu time 00380 ; WDT watchdog timer (see also RTC) 00381 ; WS whitespace, i.e., blanks & horizontal tabs 00382 ; ZP page zero or direct page 00383 ; —————————————————————————————————————————————————————————————————— 00384 ; A word is defined as 16 bits. 00385 ; 00386 ; MPU REGISTER SYMBOLS 00387 ; ————————————————————————————— 00388 ; .A 8 bit accumulator LSB 00389 ; .B 8 bit accumulator MSB 00390 ; .C 16 bit accumulator 00391 ; .X X-index 00392 ; .Y Y-index 00393 ; DB data bank 00394 ; DP direct page 00395 ; PB program bank 00396 ; PC program counter 00397 ; PCH program counter MSB 00398 ; PCL program counter LSB 00399 ; SP stack pointer 00400 ; SR MPU status 00401 ; ————————————————————————————— 00402 ; 00403 ; MPU STATUS FLAG SYMBOLS 00404 ; ——————————————————————————————— 00405 ; C carry 00406 ; D decimal mode 00407 ; I maskable interrupts 00408 ; m accumulator/memory size 00409 ; N result negative 00410 ; V sign overflow 00411 ; x index registers size 00412 ; Z result zero 00413 ; ——————————————————————————————— 00414 ; 00415 .include "include/816macs_nc.asm" 00416 ;================================================================================ 00417 ; 00418 ;W65C816S INSTRUCTION MACROS 00419 ; 00420 .if !.ref(_asm24_) ;if macros haven't been defined... 00421 ; 00422 _asm24_ .macro .ad 00423 ; 00424 pel .macro .op ;PEL 00425 ; 00426 longa .macro ;16 bit accumulator & memory 00427 ; 00428 longr .macro ;16 bit all registers 00429 ; 00430 longx .macro ;16 bit index registers 00431 ; 00432 shorta .macro ;8 bit accumulator & memory 00433 ; 00434 shortr .macro ;8 bit all registers 00435 ; 00436 shortx .macro ;8 bit index registers 00437 ; 00438 bsr .macro .sr ;BSR 00439 ; 00440 xxy .macro ;exchange .X with .Y 00441 ; 00442 xyx .macro ;exchange .Y with .X 00443 ; 00444 int .macro .op ;INT 00445 ; 00446 ; TRAP supervisor call, similar to the TRAP 68K instruction... 00447 ; 00448 trap .macro .op ;TRAP 00449 ; 00450 .endif 00451 .end 00452 .include "include/local/macros.asm" 00453 ;================================================================================ 00454 ; 00455 ;LOCAL MACROS 00456 ; 00457 ; 00458 ; decrement .X multiple times... 00459 ; 00460 decx .macro .n ;decx 00461 ; 00462 ; 00463 ; decrement .Y multiple times... 00464 ; 00465 decy .macro .n ;decy 00466 ; 00467 ; 00468 ; draw graphic horizontal line on console... 00469 ; 00470 drawhlin .macro .l ;drawhlin 00471 ; 00472 ; 00473 ; draw graphic rectangle on console... 00474 ; 00475 drawrect .macro .w,.h,.c,.r ;drawrect ,,, 00476 ; 00477 ; 00478 ; draw graphic vertical line on console... 00479 ; 00480 drawvlin .macro .l ;drawvlin 00481 ; 00482 ; 00483 ; generate 32 bit (DWORD) value... 00484 ; 00485 dwordgen .macro .op 00486 ; 00487 ; 00488 ; increment .X multiple times... 00489 ; 00490 incx .macro .n ;incx 00491 ; 00492 ; 00493 ; increment .Y multiple times... 00494 ; 00495 incy .macro .n ;incy 00496 ; 00497 ; 00498 ; load DP/absolute .X/.Y with LSW/MSW... 00499 ; 00500 lxy32 .macro .op 00501 ; 00502 ; 00503 ; load immediate .X/.Y with LSW/MSW... 00504 lxyi32 .macro .op 00505 ; 00506 ; 00507 ; position console cursor... 00508 ; 00509 plot .macro .c,.r 00510 ; 00511 ; 00512 ; print character string to console... 00513 ; 00514 printf .macro .s 00515 ; 00516 ; 00517 ; generate stack frame... 00518 ; 00519 pushparm .macro ... 00520 ; 00521 ; 00522 ; store .X/.Y LSW/MSW... 00523 ; 00524 sxy32 .macro .op 00525 ; 00526 .end 00527 .include "include/sys/macros_console.asm" 00528 ;================================================================================ 00529 ; 00530 ;CONSOLE CONTROL MACROS 00531 ; 00532 ; —————————————————————————————————————————————————————————————— 00533 ; The following macros control the display of the WYSE 60 family 00534 ; of terminals, which includes the WY60, WY150, WY160, WY325 & 00535 ; GPT units when operating in native mode. Currently, the WY325 00536 ; color control sequences are not implemented. The macro names 00537 ; mostly correspond to the display mnemonic names found in many 00538 ; business BASIC implementations. 00539 ; 00540 ; The extended box graphics characters are printed from the sec- 00541 ; ondary character set, which is derived from font bank 1 after 00542 ; it has been loaded with the multinational character set. 00543 ; —————————————————————————————————————————————————————————————— 00544 ; 00545 ; 00546 ; clearing data... 00547 ; 00548 bs .macro ;destructive backspace 00549 ; 00550 ce .macro ;clear to end of screen 00551 ; 00552 cf .macro ;clear foreground 00553 ; 00554 cl .macro ;clear to end of line 00555 ; 00556 cs .macro ;clear screen 00557 ; 00558 ; 00559 ; cursor control... 00560 ; 00561 cpos .macro .x,.y ;cursor at COL,ROW 00562 00563 ch .macro ;home cursor 00564 ; 00565 cn .macro ;cursor on 00566 ; 00567 co .macro ;cursor off 00568 ; 00569 cr .macro ;carriage return 00570 ; 00571 cu .macro ;reverse linefeed 00572 ; 00573 lf .macro ;carriage return/line feed 00574 ; 00575 ; 00576 ; display attributes... 00577 ; 00578 bf .macro ;reverse foreground 00579 ; 00580 br .macro ;reverse background 00581 ; 00582 er .macro ;enable normal foreground 00583 ; 00584 sb .macro ;set background 00585 00586 sf .macro ;set foreground 00587 ; 00588 ; 00589 ; display editing... 00590 ; 00591 cd .macro ;delete column 00592 ; 00593 ci .macro ;insert column 00594 ; 00595 dc .macro ;delete character 00596 ; 00597 ic .macro ;insert character 00598 ; 00599 ld .macro ;delete line 00600 ; 00601 li .macro ;insert line 00602 ; 00603 ; 00604 ; font selection... 00605 ; 00606 spcs .macro ;select primary character set 00607 ; 00608 sscs .macro ;select secondary character set 00609 ; 00610 lscs .macro ;set up secondary character set 00611 ; 00612 ; 00613 ; box graphics characters... 00614 ; 00615 g0 .macro ;horizontal line 00616 ; 00617 g1 .macro ;vertical line 00618 ; 00619 g2 .macro ;top left corner 00620 ; 00621 g3 .macro ;top right corner 00622 ; 00623 g4 .macro ;bottom left corner 00624 ; 00625 g5 .macro ;bottom right corner 00626 ; 00627 g6 .macro ;left tee |— 00628 ; 00629 g7 .macro ;right tee —| 00630 ; 00631 g8 .macro ;bottom tee 00632 ; 00633 g9 .macro ;top tee 00634 ; 00635 ga .macro ;four-way connect 00636 ; 00637 gb .macro ;solid block 00638 ; 00639 gc .macro ;dark hash block 00640 ; 00641 gd .macro ;light hash block 00642 ; 00643 ge .macro ;double vertical line 00644 ; 00645 gf .macro ;double horizontal line 00646 ; 00647 ; 00648 ; extended box graphics characters... 00649 ; 00650 xg0 .macro ;horizontal line 00651 ; 00652 xg1 .macro ;vertical line 00653 ; 00654 xg2 .macro ;top left corner 00655 ; 00656 xg3 .macro ;top right corner 00657 ; 00658 xg4 .macro ;bottom left corner 00659 ; 00660 xg5 .macro ;bottom right corner 00661 ; 00662 xg6 .macro ;left tee |— 00663 ; 00664 xg7 .macro ;right tee —| 00665 ; 00666 xg8 .macro ;bottom tee 00667 ; 00668 xg9 .macro ;top tee 00669 ; 00670 xga .macro ;four-way connect 00671 ; 00672 xgb .macro ;left transition tee |— 00673 ; 00674 xgc .macro ;right transition tee —| 00675 ; 00676 xgd .macro ;bottom transition tee 00677 ; 00678 xge .macro ;top transition tee 00679 ; 00680 xgf .macro ;half solid block 00681 ; 00682 ; 00683 ; miscellaneous control... 00684 ; 00685 bg .macro ;select graphics mode 00686 ; 00687 dn .macro ;display on 00688 ; 00689 do .macro ;display off 00690 ; 00691 eg .macro ;select text mode 00692 ; 00693 rb .macro ;ring bell 00694 ; 00695 .end 00696 .include "include/ascii.asm" 00697 ;================================================================================ 00698 ; 00699 ;STANDARD ASCII DEFINITIONS (ASCII menmonic order) 00700 ; 00701 0006 a_ack =$06 ; acknowledge 00702 0007 a_bel =$07 ; alert/ring bell 00703 0008 a_bs =$08 ; backspace 00704 0018 a_can =$18 ; cancel 00705 000D a_cr =$0d ; carriage return 00706 0011 a_dc1 =$11 ; device control #1 (XON) 00707 0012 a_dc2 =$12 ; device control #2 00708 0013 a_dc3 =$13 ; device control #3 (XOFF) 00709 0014 a_dc4 =$14 ; device control #4 00710 007F a_del =$7f ; delete 00711 0010 a_dle =$10 ; data link escape 00712 0019 a_em =$19 ; end of message 00713 0005 a_enq =$05 ; enquiry 00714 0004 a_eot =$04 ; end of transmission 00715 001B a_esc =$1b ; escape 00716 0017 a_etb =$17 ; end of transmitted block 00717 0003 a_etx =$03 ; end of data 00718 000C a_ff =$0c ; form feed 00719 001C a_fs =$1c ; field separator 00720 001D a_gs =$1d ; group separator 00721 0009 a_ht =$09 ; horizontal tabulation 00722 000A a_lf =$0a ; linefeed 00723 0015 a_nak =$15 ; negative acknowledge 00724 0000 a_nul =$00 ; null 00725 001E a_rs =$1e ; record separator 00726 000F a_si =$0f ; shift in 00727 000E a_so =$0e ; shift out 00728 0001 a_soh =$01 ; start of header 00729 0002 a_stx =$02 ; start of data 00730 001A a_sub =$1a ; substitute 00731 0016 a_syn =$16 ; synchronous idle 00732 001F a_us =$1f ; unit separator 00733 000B a_vt =$0b ; vertical tabulation 00734 ; 00735 ; 00736 ; miscellaneous (description order)... 00737 ; 00738 0027 a_apost =''' ;apostrophe 00739 0030 a_binnum ='0' ;binary to numeral mask 00740 0020 a_blank =' ' ;blank (whitespace) 00741 007A a_asclch ='z' ;end of lowercase ASCII 00742 005A a_ascuch ='Z' ;end of uppercase ASCII 00743 005F a_lctouc =$5f ;LC to UC conversion mask 00744 000F a_numbin =$0f ;numeral to binary mask 00745 0022 a_quo ='"' ;quotation mark 00746 0061 a_asclcl ='a' ;start of lowercase ASCII 00747 0041 a_ascucl ='A' ;start of uppercase ASCII 00748 0020 a_uctolc =$20 ;UC to LC conversion mask 00749 ; 00750 .end 00751 .include "include/atomic.asm" 00752 ;================================================================================ 00753 ; 00754 ;GLOBAL ATOMIC CONSTANTS 00755 ; 00756 ; 00757 ; data type sizes... 00758 ; 00759 0001 s_byte =1 ;byte 00760 0002 s_word =2 ;word (16 bits) 00761 0003 s_wword =3 ;wide word (24 bits) 00762 0003 s_xword =s_wword ;extended word (24 bits) 00763 0004 s_dword =4 ;double word (32 bits) 00764 0006 s_xdword =6 ;extended double word (48 bits) 00765 0008 s_lword =8 ;long word (64 bits) 00766 0100 s_rampag =$0100 ;65xx RAM page 00767 0001 s_short =1 ;size of short 00768 0002 s_int =2 ;size of integer 00769 0004 s_long =4 ;size of long 00770 0008 s_dlong =8 ;size of double long 00771 ; 00772 ; 00773 ; derivations... 00774 ; 00775 0002 s_ptr =s_word ;pointer 00776 0004 s_dptr =s_ptr*2 ;double pointer 00777 1000 s_ramblk =s_rampag*16 ;RAM block 00778 ; 00779 ; 00780 ; data type sizes in bits... 00781 ; 00782 0008 s_bbyte =8 ;byte 00783 0008 s_bibyte =s_bbyte ;byte 00784 0004 s_bnybbl =s_bbyte/2 ;nybble 00785 0010 s_bword =s_word*s_bbyte ;word 00786 0018 s_bwword =s_wword*s_bbyte ;wide word 00787 0018 s_bxword =s_xword*s_bbyte ;extended word 00788 0020 s_bdword =s_dword*s_bbyte ;double word 00789 0040 s_blword =s_lword*s_bbyte ;long word 00790 ; 00791 ; 00792 ; shifts required for powers-of-2 (see also SHIFTFAC macro)... 00793 ; 00794 0001 ex2_x1 =1 ;2^1 (2) 00795 0002 ex2_x2 =2 ;2^2 (4) 00796 0003 ex2_x3 =3 ;2^3 (8) 00797 0004 ex2_x4 =4 ;2^4 (16) 00798 0005 ex2_x5 =5 ;2^5 (32) 00799 0006 ex2_x6 =6 ;2^6 (64) 00800 0007 ex2_x7 =7 ;2^7 (128) 00801 0008 ex2_x8 =8 ;2^8 (256) 00802 0009 ex2_x9 =9 ;2^9 (512) 00803 000A ex2_x10 =10 ;2^10 (1024) 00804 000B ex2_x11 =11 ;2^11 (2048) 00805 000C ex2_x12 =12 ;2^12 (4096) 00806 000D ex2_x13 =13 ;2^13 (8192) 00807 000E ex2_x14 =14 ;2^14 (16384) 00808 000F ex2_x15 =15 ;2^15 (32768) 00809 0010 ex2_x16 =16 ;2^16 (65536) 00810 ; 00811 ; 00812 ; miscellaneous... 00813 ; 00814 002C bitabs =$2c ;absolute BIT opcode 00815 0024 bitzp =$24 ;zero page BIT opcode 00816 ; 00817 .end 00818 .include "include/calendrics/atomic.asm" 00819 ;================================================================================ 00820 ; 00821 ;CALENDRIC & TEMPORAL ATOMIC DEFINITIONS —— DO NOT EDIT!!! 00822 ; 00823 0001 _epdom_ =1 ;epoch day-of-month 00824 0004 _nleap_ =4 ;common leap year interval 00825 0007 _dayswk_ =7 ;days per week 00826 000A _epmon_ =10 ;epoch month 00827 000C _monyr_ =12 ;months per year 00828 0018 _hrsday_ =24 ;hours per day 00829 0034 _wksyr_ =52 ;weeks in a year 00830 003C _minshr_ =60 ;minutes per hour 00831 003C _secmin_ =60 ;seconds per minute 00832 0064 _eocint_ =100 ;EOC year interval 00833 016D _dayyr_ =365 ;days per common year 00834 016E _dayyrl_ =366 ;days per leap year 00835 0190 _eoclyr_ =400 ;EOC leap year interval 00836 06D8 _epyear_ =1752 ;epoch year 00837 0E10 _sechr_ =3600 ;seconds per hour 00838 270F _yrmax_ =9999 ;maximum possible year 00839 5180 _secday_ =86400 ;seconds per day 00840 ; 00841 ; 00842 ; size-of declarations... 00843 ; 00844 0002 s_dmabrv =2 ;packed day/month abbreviation 00845 0006 s_time_t =6 ;time_t calendar numeric 00846 0002 s_tzone =s_word ;timezone data 00847 0004 s_utcnt =s_dword ;system uptime counter 00848 ; 00849 ; 00850 ; calendar <——> broken-down time conversion constants... 00851 ; 00852 0001 _dncf01_ =1 00853 0002 _dncf02_ =2 00854 0003 _dncf03_ =3 00855 0004 _dncf04_ =4 00856 0005 _dncf05_ =5 00857 000A _dncf06_ =10 00858 000C _dncf07_ =12 00859 000E _dncf08_ =14 00860 0064 _dncf09_ =100 00861 0099 _dncf10_ =153 00862 016D _dncf11_ =365 00863 0190 _dncf12_ =400 00864 05B5 _dncf13_ =1461 00865 12C0 _dncf14_ =4800 00866 3AB1 _dncf15_ =146097 00867 84C3 _dncf16_ =2393283 00868 84C4 _dncf17_ =2393284 00869 ; 00870 .end 00871 .include "include/architecture.asm" 00872 ;================================================================================ 00873 ; 00874 ;MACHINE ARCHITECTURE 00875 ; 00876 0000 mm_ram =$000000 ;RAM (48K) 00877 C000 mm_io =$00c000 ;I/O (4K) 00878 D000 mm_rom =$00d000 ;ROM (12K) 00879 FFE0 mm_mpuv =$00ffe0 ;MPU vectors 00880 ; 00881 0064 hz =100 ;jiffy IRQs per second 00882 0100 s_zp =s_rampag ;direct page size 00883 0100 s_iodev =s_rampag ;I/O decoding spacing 00884 0000 zeropage .= mm_ram ;start of direct page 00885 0100 absolute .= zeropage+s_zp ;start of absolute RAM 00886 0200 rambot .= absolute+s_rampag ;start of user space RAM 00887 ; 00888 .end 00889 .include "include_hardware/maxim/ds1511_data.asm" 00890 ;================================================================================ 00891 ; 00892 ;DS1511 CONFIGURATION CONSTANTS — Description Order 00893 ; 00894 0001 wr_wdmsp =$01 ;10 ms underflows LSB 00895 0000 wr_wdsp =$00 ;10 ms underflows MSB 00896 0000 wr_dowap =%00000000 ;no alarm date/day IRQ 00897 0000 wr_hrsap =%00000000 ;no alarm hour IRQ 00898 0000 wr_minap =%00000000 ;no alarm min IRQ 00899 0000 wr_secap =%00000000 ;no alarm secs IRQ 00900 0000 wr_crbpa =%00000000 ;updates & WDT IRQs off 00901 00A0 wr_crbpb =%10100000 ;updates on 00902 ; 00903 ;================================================================================ 00904 ; 00905 ;DS1511 CONTROL MASKS — Description Order 00906 ; 00907 0000 d11noirq =%00000000 ;disable IRQs & updates 00908 00A2 d11onirq =%10100010 ;enable IRQs & updates 00909 0020 d11aimsk =%00100000 ;enable NVRAM autoincrement 00910 001F dlleomsk =%00011111 ;enable oscillator 00911 00E0 d11ecmsk =%11100000 ;extract control values 00912 001F d11emmsk =d11ecmsk ^ %11111111 ;extract month value 00913 0003 d11ismsk =%00000011 ;IRQ sources 00914 0040 d11sqmsk =%01000000 ;no square wave output 00915 0080 d11temsk =%10000000 ;stop/start register updates 00916 ; 00917 .end 00918 .include "include_hardware/maxim/ds1511.asm" 00919 ;================================================================================ 00920 ; 00921 ;DALLAS DS1511 REAL-TIME CLOCK REGISTER DEFINITIONS 00922 ; 00923 0020 nr_rtc =32 ;total registers ($14-$1F reserved) 00924 ; 00925 ; 00926 ; register offsets... 00927 ; 00928 0000 wr_sect =$00 ;TOD seconds ($00-$59 BCD) 00929 0001 wr_mint =$01 ;TOD minutes ($00-$59 BCD) 00930 0002 wr_hrst =$02 ;TOD hour ($00-$23 BCD) 00931 0003 wr_dowt =$03 ;day of week ($01-$07 BCD) 00932 0004 wr_datt =$04 ;date ($01-$31 BCD) 00933 0005 wr_mon =$05 ;month & control... 00934 ; 00935 ; xxxxxxxx 00936 ; |||||||| 00937 ; |||+++++———> month ($01-$12 BCD) 00938 ; ||+————————> 1: enable 32 Khz at SQW when on battery 00939 ; |+—————————> 0: enable 32 KHz at SQW when on Vcc 00940 ; +——————————> 0: enable oscillator 00941 ; 00942 0006 wr_yrlo =$06 ;year LSB ($00-$99 BCD) 00943 0007 wr_yrhi =$07 ;year MSB ($00-$39 BCD) 00944 0008 wr_seca =$08 ;alarm seconds & IRQ control... 00945 ; 00946 ; xxxxxxxx 00947 ; |||||||| 00948 ; |+++++++———> alarm seconds ($00-$59 BCD) 00949 ; +——————————> 1: IRQ once per second 00950 ; 00951 0009 wr_mina =$09 ;alarm minutes & IRQ control... 00952 ; 00953 ; xxxxxxxx 00954 ; |||||||| 00955 ; |+++++++———> alarm minutes ($00-$59 BCD) 00956 ; +——————————> 1: IRQ when TOD secs = alarm secs 00957 ; 00958 000A wr_hrsa =$0a ;alarm hour & IRQ control... 00959 ; 00960 ; x0xxxxxx 00961 ; | |||||| 00962 ; | ++++++———> alarm hour ($00-$23 BCD) 00963 ; +——————————> 1: IRQ when TOD secs & mins = alarm secs & mins 00964 ; 00965 000B wr_dowa =$0b ;alarm date/day & IRQ control... 00966 ; 00967 ; xxxxxxxx 00968 ; |||||||| 00969 ; ||++++++———> alarm day ($01-$07 BCD) or date ($01-$31 BCD) 00970 ; |+—————————> 0: alarm date set 00971 ; | 1: alarm day set 00972 ; +——————————> 0: IRQ when TOD & day/date = alarm TOD & day/date 00973 ; 1: IRQ when TOD = alarm time 00974 ; 00975 000C wr_wdms =$0c ;watchdog millisecs*10 ($00-$99 BCD) 00976 000D wr_wds =$0d ;watchdog seconds ($00-$99 BCD) 00977 000E wr_cra =$0e ;control register A... 00978 ; 00979 ; xxxxxxxx 00980 ; |||||||| 00981 ; |||||||+———> 1: IRQ pending (read only) 00982 ; ||||||+————> 1: IRQ = watchdog timer 00983 ; |||||+—————> 1: IRQ = kickstart (read only) 00984 ; ||||+——————> 1: IRQ = TOD alarm 00985 ; |||+———————> 0: PWR pin = active low 00986 ; ||| 1: PWR pin = high-Z 00987 ; ||+————————> 0: PWR pin = high-Z wo/Vcc present 00988 ; || 1: PWR pin = active low wo/Vcc present 00989 ; |+—————————> 1: aux external battery low (read only) 00990 ; +——————————> 1: external battery low (read only) 00991 ; 00992 000F wr_crb =$0f ;control register B... 00993 ; 00994 ; x0xxxxxx 00995 ; | |||||| 00996 ; | |||||+———> 0: watchdog generates IRQ 00997 ; | ||||| 1: watchdog generates reset 00998 ; | ||||+————> 1: watchdog IRQ/reset enabled 00999 ; | |||+—————> 1: kickstart IRQ enabled 01000 ; | ||+——————> 1: TOD alarm IRQ enabled 01001 ; | |+———————> 1: TOD alarm wakeup enabled 01002 ; | +————————> 1: NVRAM address autoincrement enabled 01003 ; +——————————> 0: TOD & date register update disabled 01004 ; 1: TOD & date register update enabled 01005 ; 01006 0010 wr_nvra =$10 ;NVRAM address port ($00-$FF) 01007 0011 wr_rsva =$11 ;reserved 01008 0012 wr_rsvb =$12 ;reserved 01009 0013 wr_nvrd =$13 ;NVRAM data port 01010 ; 01011 .end 01012 .include "include_hardware/ncr/53cf94_data.asm" 01013 ;================================================================================ 01014 ; 01015 ;53CF94 SCSI CONTROLLER CONFIGURATION CONSTANTS 01016 ; 01017 2D00 sr_clkhz =20000000 ;controller clock frequency (Hz)... 01018 ; 01019 ; ————————————————————————————————————————————————————————————————— 01020 ; SR_CLKHZ may range from 10,000,000 to 40,000,000 & must match the 01021 ; frequency of the clock generator installed in the host adapter. 01022 ; ————————————————————————————————————————————————————————————————— 01023 ; 01024 ; 01025 ; clock conversion factors... 01026 ; 01027 .if sr_clkhz < 10000000 || sr_clkhz > 40000000 01028 .if sr_clkhz < 40000001 && sr_clkhz > 35000000 01029 .if sr_clkhz < 35000001 && sr_clkhz > 30000000 01030 .if sr_clkhz < 30000001 && sr_clkhz > 25000000 01031 .if sr_clkhz < 25000001 && sr_clkhz > 20000000 01032 .if sr_clkhz < 20000001 && sr_clkhz > 15000000 01033 0004 sr_clkfp =%100 01034 .endif 01035 .if sr_clkhz < 15000001 && sr_clkhz > 10000000 01036 .if sr_clkhz < 10000001 01037 004C sr_toutp ={{sr_clkhz/2000}*scsiselt}/{sr_clkfp*8192} ;selection timeout factor 01038 ; 01039 0057 sr_cr1p =%01010000 | scsiid94 ;control register #1... 01040 ; 01041 ; 01010111 01042 ; | | ||| 01043 ; | | +++———> HBA SCSI ID (determined by SCSIID94) 01044 ; | +———————> parity error reporting enabled 01045 ; +—————————> disable bus reset IRQ 01046 ; 01047 000C sr_cr2p =%00001100 ;control register #2... 01048 ; 01049 ; 00000011 01050 ; || 01051 ; |+—————> abort on parity error 01052 ; +——————> enable SCSI-2 features 01053 ; 01054 0000 sr_cr3p =%00000000 ;control register #3 01055 0000 sr_ftmp =%00000000 ;forced test modes off 01056 ; 01057 ;================================================================================ 01058 ; 01059 ;53C94 SCSI CONTROLLER REGISTER & CONTROL MASKS 01060 ; 01061 001F c94isfct =%00011111 ;FIFO count 01062 0004 c94issqc =%00000100 ;command sequence completed 01063 0007 c94isrst =%00000111 ;state bits 01064 ; 01065 ; 01066 ; interrupt status... 01067 ; 01068 0001 c94sel =%00000001 ;selected 01069 0002 c94sela =%00000010 ;selected w/ATN 01070 0004 c94resel =%00000100 ;reselected 01071 0008 c94so =%00001000 ;successful operation 01072 0010 c94sr =%00010000 ;service request 01073 0020 c94dis =%00100000 ;disconnected 01074 0040 c94icmd =%01000000 ;invalid command 01075 0080 c94reset =%10000000 ;bus reset 01076 0018 c94srso =c94sr | c94so ;service request/success 01077 ; 01078 ; 01079 ; general status... 01080 ; 01081 0006 c94phasd =%00000110 ;data-in/out phase test 01082 0007 c94phase =%00000111 ;bus phase 01083 0008 c94gcv =%00001000 ;group code valid 01084 0010 c94ctz =%00010000 ;transfer count = 0 01085 0020 c94pe =%00100000 ;bus parity error 01086 0040 c94ioe =%01000000 ;illegal operation 01087 0080 c94int =%10000000 ;'C94 interrupting 01088 007F c94srall =c94int ^ %11111111 ;all bits but IRQ 01089 0078 c94srsts =%01111000 ;status bits only 01090 ; 01091 ; 01092 ; miscellaneous... 01093 ; 01094 0040 c94irqge =%01000000 ;gross error flag bit 01095 0080 c94irqsf =%10000000 ;general purpose flag bit 01096 ; 01097 .end 01098 .include "include_hardware/ncr/53cf94.asm" 01099 ;================================================================================ 01100 ; 01101 ;NCR 53CF94 SCSI CONTROLLER REGISTER DEFINITIONS 01102 ; 01103 0010 nr_srsi =16 ;total registers 01104 0010 fd_srsi =16 ;FIFO depth 01105 ; 01106 ; 01107 ; register offsets... 01108 ; 01109 0000 sr_ctcl =$00 ;transfer count LSB (read) 01110 0000 sr_stcl =sr_ctcl ;start transfer count LSB (write) 01111 0001 sr_ctch =$01 ;transfer count MSB (read) 01112 0001 sr_stch =sr_ctch ;start transfer count MSB (write) 01113 0002 sr_fifo =$02 ;data FIFO 01114 0003 sr_cmd =$03 ;controller command... 01115 ; 01116 ; xxxxxxxx 01117 ; |||||||| 01118 ; |+++++++———> command 01119 ; +——————————> 1: DMA 01120 ; 01121 0004 sr_stat =$04 ;status (read)... 01122 ; 01123 ; xxxxxxxx 01124 ; |||||||| 01125 ; |||||+++———> SCSI bus status 01126 ; ||||+——————> 1: group code valid 01127 ; |||+———————> 1: current transfer count = 0 01128 ; ||+————————> 1: SCSI bus parity error 01129 ; |+—————————> 1: illegal operation 01130 ; +——————————> 1: interrupt pending 01131 ; 01132 0004 sr_sdid =sr_stat ;target's SCSI ID (write) 01133 ; 01134 ; xxxxxxxx 01135 ; |||||||| 01136 ; |||||+++———> target device SCSI ID 01137 ; +++++——————> reserved 01138 ; 01139 0005 sr_irqst =$05 ;interrupt status (read)... 01140 ; 01141 ; xxxxxxxx 01142 ; |||||||| 01143 ; |||||||+———> 1: selected 01144 ; ||||||+————> 1: selected w/attention 01145 ; |||||+—————> 1: reselected 01146 ; ||||+——————> 1: successful operation 01147 ; |||+———————> 1: service request 01148 ; ||+————————> 1: disconnected 01149 ; |+—————————> 1: invalid command 01150 ; +——————————> 1: bus reset 01151 ; 01152 0005 sr_tout =sr_irqst ;selection timeout period (write) 01153 0006 sr_isr =$06 ;internal state (read)... 01154 ; 01155 ; 0000xxxx 01156 ; |||| 01157 ; |+++———> internal state 01158 ; +——————> 0: sync offset register at maximum 01159 ; 01160 0006 sr_stp =sr_isr ;sync transfer period (write) 01161 0007 sr_isrf =$07 ;internal/FIFO status (read)... 01162 ; 01163 ; xxxxxxxx 01164 ; |||||||| 01165 ; |||+++++———> FIFO byte count 01166 ; +++————————> internal state (see SR_ISR bits 0-2) 01167 ; 01168 0007 sr_synco =sr_isrf ;sync offset (write) 01169 0008 sr_cr1 =$08 ;control register #1... 01170 ; 01171 ; xxxxxxxx 01172 ; |||||||| 01173 ; |||||+++———> 1: controller's SCSI ID 01174 ; ||||+——————> 1: enable self-test 01175 ; |||+———————> 1: report parity errors 01176 ; ||+————————> 1: enable parity testing 01177 ; |+—————————> 1: no IRQ on bus reset 01178 ; +——————————> 1: enable extended timing 01179 ; 01180 0009 sr_clkf =$09 ;clock factor (write)... 01181 ; 01182 ; 00000xxx 01183 ; ||| 01184 ; +++———> 010: 10.00 MHz 01185 ; 011: 10.01 - 15 MHz 01186 ; 100: 15.01 - 20 MHz 01187 ; 101: 20.01 - 25 MHz 01188 ; 01189 000A sr_ftm =$0a ;forced test mode (write) 01190 000B sr_cr2 =$0b ;control register #2... 01191 ; 01192 ; xxxxxxxx 01193 ; |||||||| 01194 ; |||||||+———> 1: pass through/generate data parity 01195 ; ||||||+————> 1: pass through/generate register parity 01196 ; |||||+—————> 1: abort on parity error 01197 ; ||||+——————> 1: enable SCSI-2 features 01198 ; |||+———————> 1: tri-state DREQ & ignore /DACK 01199 ; ||+————————> 1: select byte order 01200 ; |+—————————> 1: latch SCSI phase 01201 ; +——————————> 1: data alignment enable 01202 ; 01203 000C sr_cr3 =$0c ;control register #3... 01204 ; 01205 ; 00000xxx 01206 ; ||| 01207 ; ||+———> burst size 01208 ; |+————> modify DMA mode 01209 ; +—————> last byte transfer mode 01210 ; 01211 000F sr_dar =$0f ;data alignment 01212 ; 01213 ;================================================================================ 01214 ; 01215 ;NCR/AMD 53C94 SCSI CONTROLLER COMMANDS 01216 ; 01217 0080 _flagdma =%10000000 ;invoke DMA operation 01218 ; 01219 0001 sccfifc =$01 ;clear FIFO 01220 0000 sccnop =$00 ;no operation (PIO) 01221 0080 sccnopd =sccnop | _flagdma ;no operation (DMA) 01222 0002 sccrstc =$02 ;reset controller 01223 0003 sccrstb =$03 ;reset bus 01224 ; 01225 ; 01226 ; idle state... 01227 ; 01228 0045 sccselda =$45 ;disable selection/reselection 01229 0044 sccselea =$44 ;enable selection/reselection 01230 0040 sccrsel =$40 ;reselect steps 01231 0041 sccsel =$41 ;select 01232 0042 sccsela =$42 ;select w/ATN 01233 0043 sccselas =$43 ;select w/ATN & stop 01234 0046 sccsela3 =$46 ;select w/ATN3 01235 ; 01236 ; 01237 ; initiator state... 01238 ; 01239 0011 sccicc =$11 ;command complete steps 01240 0010 sccinfot =$10 ;information transfer (PIO) 01241 0090 sccinfod =sccinfot | _flagdma ;information transfer (DMA) 01242 0012 sccmsga =$12 ;message accepted 01243 001B sccatnr =$1b ;reset ATN 01244 001A sccatns =$1a ;set ATN 01245 0018 scctpb =$18 ;transfer pad bytes 01246 ; 01247 ; 01248 ; target state... 01249 ; 01250 0025 scctcc =$25 ;command complete steps 01251 0027 sccdisc =$27 ;disconnect 01252 0023 sccdiscs =$23 ;disconnect steps 01253 0004 sccdmaa =$04 ;DMA abort 01254 0029 scccmdr =$29 ;receive command 01255 002B scccmdrs =$2b ;receive command steps 01256 002A sccdatar =$2a ;receive data 01257 0028 sccmsgrs =$28 ;receive message steps 01258 0022 sccdatas =$22 ;send data 01259 0020 sccmsgs =$20 ;send message 01260 0021 sccstss =$21 ;send status 01261 0024 sccterm =$24 ;terminate steps 01262 ; 01263 .end 01264 .include "include_hardware/nxp/common.asm" 01265 ;================================================================================ 01266 ; 01267 ;PHILIPS/NXP MULTIPLE UART COMMON DEFINITIONS 01268 ; 01269 0002 n_nxpblk =2 ;blocks in UART 01270 0002 n_nxpcpb =2 ;channels per block 01271 0004 n_nxpchn =n_nxpcpb*n_nxpblk ;channels in UART 01272 0008 s_nxpchn =8 ;channel spacing in block 01273 0010 s_nxpblk =s_nxpchn*n_nxpcpb ;size of block 01274 ; 01275 ; 01276 ; channel status analysis masks... 01277 ; 01278 0001 nxprxdr =%00000001 ;RxD: FIFO not empty 01279 0002 nxprxdf =%00000010 ;RxD: FIFO full 01280 0004 nxptxdr =%00000100 ;TxD: FIFO not full 01281 0008 nxptxdur =%00001000 ;TxD: FIFO empty 01282 0010 nxprxdor =%00010000 ;RxD: FIFO overrun 01283 0020 nxpparer =%00100000 ;RxD: parity error 01284 0040 nxpfrmer =%01000000 ;RxD: framing error 01285 0080 nxpbreak =%10000000 ;RxD: break 01286 ; 01287 ; 01288 ; interrupt status analysis masks... 01289 ; 01290 0001 nxpatirq =%00000001 ;ch A: TxD 01291 0002 nxparirq =%00000010 ;ch A: RxD 01292 0004 nxpabirq =%00000100 ;ch A: break change 01293 0008 nxpctirq =%00001000 ;C/T: underflow 01294 0010 nxpbtirq =%00010000 ;ch B: TxD 01295 0020 nxpbrirq =%00100000 ;ch B: RxD 01296 0040 nxpbbirq =%01000000 ;ch B: break change 01297 0080 nxpipirq =%10000000 ;input port change 01298 ; 01299 .end 01300 .include "include_hardware/nxp/registers.asm" 01301 ;================================================================================ 01302 ; 01303 ;PHILLIPS/NXP DUART REGISTERS 01304 ; 01305 ; Abbreviations used in comments are as follows: 01306 ; 01307 ; —-—-—-—-—-—-—-—-—-—-—-—-—-— 01308 ; C/T Counter/timer 01309 ; IP Input port 01310 ; LSB Least significant byte 01311 ; MSB Most significant byte 01312 ; OP Output port 01313 ; (R) Read only 01314 ; (RW) Read/write 01315 ; RxD Receiver 01316 ; TxD Transmitter 01317 ; (W) Write only 01318 ; —-—-—-—-—-—-—-—-—-—-—-—-—-— 01319 ; 01320 ; 01321 ; DUART channel register offsets... 01322 ; 01323 0000 nx_mr =0 ;mode select 01324 0001 nx_sr =1 ;status (R) 01325 0001 nx_csr =1 ;clock select (W) 01326 0002 nx_cr =2 ;command (W) 01327 0003 nx_rhr =3 ;RxD FIFO (R) 01328 0003 nx_thr =3 ;TxD FIFO (W) 01329 0003 nx_fif =3 ;communication FIFO (RW) 01330 ; 01331 ; 01332 ; DUART block register offsets... 01333 ; 01334 0004 nx_ipcr =4 ;IP change (R) 01335 0004 nx_acr =4 ;auxiliary control (W) 01336 0005 nx_isr =5 ;interrupt status (R) 01337 0005 nx_imr =5 ;interrupt enable (W) 01338 0006 nx_ctu =6 ;C/T MSB value (R) 01339 0007 nx_ctl =7 ;C/T LSB value (R) 01340 0006 nx_crur =6 ;C/T MSB preset (W) 01341 0007 nx_crlr =7 ;C/T LSB preset (W) 01342 000C nx_ureg =12 ;user-defined (RW) 01343 000D nx_ipsr =13 ;IP status (R) 01344 000D nx_opcr =13 ;OP configuration (W) 01345 000E nx_sct =14 ;start C/T (R) 01346 000E nx_sopb =14 ;set OP bits (W) 01347 000F nx_rct =15 ;stop C/T (R) 01348 000F nx_ropb =15 ;reset OP bits (W) 01349 ; 01350 ;================================================================================ 01351 ; 01352 ;vQUART REGISTER OFFSETS 01353 ; 01354 ; 01355 ; channel A... 01356 ; 01357 0000 nx_mra =nx_mr ;mode select 01358 0001 nx_sra =nx_sr ;status (R) 01359 0001 nx_csra =nx_csr ;clock select (W) 01360 0002 nx_cra =nx_cr ;command (W) 01361 0003 nx_rhra =nx_rhr ;RxD FIFO (R) 01362 0003 nx_thra =nx_thr ;TxD FIFO (W) 01363 0003 nx_fifa =nx_fif ;communication FIFO (RW) 01364 ; 01365 ; 01366 ; channel B... 01367 ; 01368 0008 nx_mrb =nx_mr+s_nxpchn ;mode select 01369 0009 nx_srb =nx_sr+s_nxpchn ;status (R) 01370 0009 nx_csrb =nx_csr+s_nxpchn ;clock select (W) 01371 000A nx_crb =nx_cr+s_nxpchn ;command (W) 01372 000B nx_rhrb =nx_rhr+s_nxpchn ;RxD FIFO (R) 01373 000B nx_thrb =nx_thr+s_nxpchn ;TxD FIFO (W) 01374 000B nx_fifb =nx_fif+s_nxpchn ;communication FIFO (RW) 01375 ; 01376 ; 01377 ; channel C... 01378 ; 01379 0100 nx_mrc =nx_mra+s_iodev ;mode select 01380 0101 nx_src =nx_sra+s_iodev ;status (R) 01381 0101 nx_csrc =nx_csra+s_iodev ;clock select (W) 01382 0102 nx_crc =nx_cra+s_iodev ;command (W) 01383 0103 nx_rhrc =nx_rhra+s_iodev ;RxD FIFO (R) 01384 0103 nx_thrc =nx_thra+s_iodev ;TxD FIFO (W) 01385 0103 nx_fifc =nx_fifa+s_iodev ;communication FIFO (RW) 01386 ; 01387 ; 01388 ; channel D... 01389 ; 01390 0108 nx_mrd =nx_mrc+s_nxpchn ;mode select 01391 0109 nx_srd =nx_src+s_nxpchn ;status (R) 01392 0109 nx_csrd =nx_csrc+s_nxpchn ;clock select (W) 01393 010A nx_crd =nx_crc+s_nxpchn ;command (W) 01394 010B nx_rhrd =nx_rhrc+s_nxpchn ;RxD FIFO (R) 01395 010B nx_thrd =nx_thrc+s_nxpchn ;TxD FIFO (W) 01396 010B nx_fifd =nx_fifc+s_nxpchn ;communication FIFO (RW) 01397 ; 01398 ; 01399 ; block A... 01400 ; 01401 0004 nx_ipcra =nx_ipcr ;IP change (R) 01402 0004 nx_acra =nx_acr ;auxiliary control (W) 01403 0005 nx_isra =nx_isr ;interrupt status (R) 01404 0005 nx_imra =nx_imr ;interrupt enable (W) 01405 0006 nx_ctua =nx_ctu ;C/T MSB value (R) 01406 0007 nx_ctla =nx_ctl ;C/T LSB value (R) 01407 0006 nx_crura =nx_crur ;C/T MSB preset (W) 01408 0007 nx_crlra =nx_crlr ;C/T LSB preset (W) 01409 000C nx_urega =nx_ureg ;user-defined (RW) 01410 000D nx_ipsra =nx_ipsr ;IP status (R) 01411 000D nx_opcra =nx_opcr ;OP configuration (W) 01412 000E nx_scta =nx_sct ;start C/T (R) 01413 000E nx_sopba =nx_sopb ;set OP bits (W) 01414 000F nx_rcta =nx_rct ;stop C/T (R) 01415 000F nx_ropba =nx_ropb ;reset OP bits (W) 01416 ; 01417 ; 01418 ; block B... 01419 ; 01420 0104 nx_ipcrb =nx_ipcr+s_iodev ;IP change (R) 01421 0104 nx_acrb =nx_acr+s_iodev ;auxiliary control (W) 01422 0105 nx_isrb =nx_isr+s_iodev ;interrupt status (R) 01423 0105 nx_imrb =nx_imr+s_iodev ;interrupt enable (W) 01424 0106 nx_ctub =nx_ctu+s_iodev ;C/T MSB value (R) 01425 0107 nx_ctlb =nx_ctl+s_iodev ;C/T LSB value (R) 01426 0106 nx_crurb =nx_crur+s_iodev ;C/T MSB preset (W) 01427 0107 nx_crlrb =nx_crlr+s_iodev ;C/T LSB preset (W) 01428 010C nx_uregb =nx_ureg+s_iodev ;user-defined (RW) 01429 010D nx_ipsrb =nx_ipsr+s_iodev ;IP status (R) 01430 010D nx_opcrb =nx_opcr+s_iodev ;OP configuration (W) 01431 010E nx_sctb =nx_sct+s_iodev ;start C/T (R) 01432 010E nx_sopbb =nx_sopb+s_iodev ;set OP bits (W) 01433 010F nx_rctb =nx_rct+s_iodev ;stop C/T (R) 01434 010F nx_ropbb =nx_ropb+s_iodev ;reset OP bits (W) 01435 ; 01436 .end 01437 .include "include_hardware/nxp/data.asm" 01438 ;================================================================================ 01439 ; 01440 ;PHILIPS/NXP MULTIPLE CHANNEL UART CONFIGURATION & CONTROL CONSTANTS 01441 ; 01442 4000 nxx1freq =3686400 ;X1 clock frequency in Hz 01443 2000 nxctscal =nxx1freq/2 ;C/T scaled clock 01444 ; 01445 ; 01446 ; ACR — auxiliary control register... 01447 ; 01448 0060 nxparbrt =%01100000 ;... 01449 ; 01450 ; a) Use baud rate table #1 —— see data sheet. 01451 ; b) C/T acts as a timer. 01452 ; c) C/T clock source is scaled to X1 ÷ 1. 01453 ; 01454 ; 01455 ; CR — command register... 01456 ; 01457 0001 nxpcrrxe =%00000001 ;enable receiver 01458 0002 nxpcrrxd =%00000010 ;disable receiver 01459 0004 nxpcrtxe =%00000100 ;enable transmitter 01460 0008 nxpcrtxd =%00001000 ;disable transmitter 01461 0010 nxpcrmr1 =%00010000 ;select MR1 01462 0020 nxpcrrxr =%00100000 ;reset receiver 01463 0030 nxpcrtxr =%00110000 ;reset transmitter 01464 0040 nxpcresr =%01000000 ;reset error status 01465 0050 nxpcrbir =%01010000 ;reset received break change IRQ 01466 0060 nxpcrbks =%01100000 ;start break 01467 0070 nxpcrbke =%01110000 ;stop break 01468 0080 nxpcrrsa =%10000000 ;assert request to send 01469 0090 nxpcrrsd =%10010000 ;deassert request to send 01470 00A0 nxpcrtme =%10100000 ;select C/T timer mode 01471 00B0 nxpcrmr0 =%10110000 ;select MR0 01472 00C0 nxpcrtmd =%11000000 ;select C/T counter mode 01473 ; 01474 ; 01475 ; CSR — clock select register... 01476 ; 01477 0066 nxpcsdef =%01100110 ;RxD & TxD at 115.2 Kbps... 01478 ; 01479 ; ———————————————————————————————————————————————————————————————— 01480 ; The above data rate is based upon the value of NXPARBRT (above). 01481 ; ———————————————————————————————————————————————————————————————— 01482 ; 01483 ; 01484 ; CT — counter/timer... 01485 ; 01486 0000 nxpctdlo =<{nxctscal/hz} ;underflows/sec LSB 01487 0048 nxpctdhi =>{nxctscal/hz} ;underflows/sec MSB 01488 ; 01489 ; 01490 ; IMR — interrupt mask register... 01491 ; 01492 0003 nxpairq =nxpatirq|nxparirq ;enable ch A RxD & TxD IRQs 01493 0030 nxpbirq =nxpbtirq|nxpbrirq ;enable ch B RxD & TxD IRQs 01494 003B nxpiqmsk =nxpairq|nxpbirq|nxpctirq ;set IRQ sources... 01495 ; 01496 ; —————————————————————————————————————————————————— 01497 ; nxpiqmsk enables all channel IRQs plus timer IRQs. 01498 ; —————————————————————————————————————————————————— 01499 ; 01500 ; 01501 ; MR0 — mode 0 register... 01502 ; 01503 00CC nxpm0def =%11001100 ;... 01504 ; 01505 ; 11001100 01506 ; |||||||| 01507 ; |||||+++———> extended baud rate #2 01508 ; ||||+——————> 16-deep FIFO 01509 ; ||++———————> TxD interrupts only when FIFO is empty 01510 ; |+—————————> RxD interrupts only when FIFO is full (see also MR1:6) 01511 ; +——————————> enable RxD watchdog timer 01512 ; 01513 ; 01514 ; MR1 — mode 1 register... 01515 ; 01516 00D3 nxpm1def =%11010011 ;... 01517 ; 01518 ; 11010011 01519 ; |||||||| 01520 ; ||||||++———> 8 bit char size 01521 ; |||||+—————> parity type (ignored) 01522 ; |||++——————> no parity generated or checked 01523 ; ||+————————> character error mode 01524 ; |+—————————> RxD interrupts only when FIFO is full (see also MR0:6) 01525 ; +——————————> RxD controls RTS 01526 ; 01527 ; 01528 ; MR2 — mode 2 register... 01529 ; 01530 0017 nxpm2def =%00010111 ;normal mode, auto RTS 01531 ; 01532 ; 01533 ; OPCR — output port configuration register... 01534 ; 01535 00F0 nxpopdef =%11110000 ;OP4-7 as IRQ outputs 01536 ; 01537 ; 01538 ; combined setup commands... 01539 ; 01540 000A nxpcrrtd =nxpcrtxd|nxpcrrxd ;disable transmitter & receiver 01541 0005 nxpcrrte =nxpcrtxe|nxpcrrxe ;enable transmitter & receiver 01542 ; 01543 .end 01544 .include "include_hardware/wdc/65c816.asm" 01545 ;================================================================================ 01546 ; 01547 ;W65C816S NATIVE MODE STATUS REGISTER DEFINITIONS 01548 ; 01549 0001 s_mpudbx =1 ;DB size 01550 0002 s_mpudpx =2 ;DP size 01551 0001 s_mpupbx =1 ;PB size 01552 0002 s_mpupcx =2 ;PC size 01553 0002 s_mpuspx =2 ;SP size 01554 0001 s_mpusrx =1 ;SR size 01555 ; 01556 ; 01557 ; status register flags... 01558 ; 01559 0001 sr_car =%00000001 ;C 01560 0002 sr_zer =%00000010 ;Z 01561 0004 sr_irq =%00000100 ;I 01562 0008 sr_bdm =%00001000 ;D 01563 0010 sr_ixw =%00010000 ;x 01564 0020 sr_amw =%00100000 ;m 01565 0040 sr_ovl =%01000000 ;V 01566 0080 sr_neg =%10000000 ;N 01567 ; 01568 ; NVmxDIZC 01569 ; xxxxxxxx 01570 ; |||||||| 01571 ; |||||||+———> 1: carry set/generated 01572 ; ||||||+————> 1: result = zero 01573 ; |||||+—————> 1: IRQ disabled 01574 ; ||||+——————> 0: binary arithmetic mode 01575 ; |||| 1: decimal arithmetic mode 01576 ; |||+———————> 0: 16 bit index 01577 ; ||| 1: 8 bit index 01578 ; ||+————————> 0: 16 bit .A & memory 01579 ; || 1: 8 bit .A & memory 01580 ; |+—————————> 1: sign overflow 01581 ; +——————————> 1: result = negative 01582 ; 01583 ; 01584 ; inverted status register flags... 01585 ; 01586 00FE sr_car_i =sr_car ^ %11111111 ;C 01587 00FD sr_zer_i =sr_zer ^ %11111111 ;Z 01588 00FB sr_irq_i =sr_irq ^ %11111111 ;I 01589 00F7 sr_bdm_i =sr_bdm ^ %11111111 ;D 01590 00EF sr_ixw_i =sr_ixw ^ %11111111 ;x 01591 00DF sr_amw_i =sr_amw ^ %11111111 ;m 01592 00BF sr_ovl_i =sr_ovl ^ %11111111 ;V 01593 007F sr_neg_i =sr_neg ^ %11111111 ;N 01594 ; 01595 .end 01596 .include "include_hardware/bcs/vquart.asm" 01597 ;=============================================================================== 01598 ; 01599 ;vQUART IRQ STATUS "REGISTER" 01600 ; 01601 000F m_irqrx =%00001111 ;RxD IRQs mask 01602 00F0 m_irqtx =%11110000 ;TxD IRQs mask 01603 ; 01604 .end 01605 .include "include_kernel/constants.asm" 01606 ;================================================================================ 01607 ; 01608 ;BIOS "NUMBER-OF" CONSTANTS 01609 ; 01610 0002 n_bootd =2 ;SCSI boot devices 01611 0008 n_ivvecs =8 ;total indirect vectors 01612 ; 01613 ;================================================================================ 01614 ; 01615 ;BIOS "SIZE-OF" CONSTANTS 01616 ; 01617 00FF s_hstack =s_rampag-s_byte ;native mode stack 01618 0100 s_stack =s_rampag ;emulation mode stack 01619 0002 s_tdcnt =s_word ;IRQ-driven delay timer 01620 0010 s_vecspc =n_ivvecs*s_ptr ;indirect vector space 01621 ; 01622 ;================================================================================ 01623 ; 01624 ;MISCELLANEOUS CONSTANTS 01625 ; 01626 0000 dbnk .= $00 ;default copy destination bank 01627 0000 sbnk .= $00 ;default copy source bank 01628 00C3 fisrmask =%11000011 ;function return SR mask 01629 0000 kerneldb =$00 ;kernel's data bank 01630 005A testpata =%01011010 ;RAM test pattern A 01631 00A5 testpatb =%10100101 ;RAM test pattern B 01632 ; 01633 .end 01634 .include "include_boot/constants.asm" 01635 ;================================================================================ 01636 ; 01637 ;BIOS BOOT CONSTANTS 01638 ; 01639 0000 bootsid =0 ;default boot device SCSI ID 01640 0000 bootslun =0 ;default boot device SCSI LUN 01641 ; 01642 .end 01643 .include "include_kernel/constants_tia232.asm" 01644 ;================================================================================ 01645 ; 01646 ;KERNEL TIA-232 CONSTANTS 01647 ; 01648 0008 n_tiabuf =n_nxpchn*2 ;total circular queues 01649 0002 n_tiabix =2 ;indices per queue 01650 0040 s_tiabuf =64 ;queue size... 01651 ; 01652 ; ——————————————————————————————————————————————— 01653 ; The queue size must be an integral power of 2, 01654 ; not to exceed 256 bytes. The minimum should be 01655 ; 64 bytes. If less than 256 the M_TIAPTR mask 01656 ; must be defined to a value compatible with the 01657 ; queue size, usuall S_TIABUF-1. 01658 ; ——————————————————————————————————————————————— 01659 ; 01660 003F m_tiaptr =s_tiabuf-1 ;queue pointer mask 01661 0200 s_tiaspc =s_tiabuf*n_tiabuf ;required queue space 01662 ; 01663 ; 01664 ; NXP UART communication channel indices... 01665 ; 01666 0000 nxpchana =0 ;channel A 01667 0001 nxpchanb =nxpchana+1 ;channel B 01668 0002 nxpchanc =nxpchanb+1 ;channel C 01669 0003 nxpchand =nxpchanc+1 ;channel D 01670 0004 nxpchane =nxpchand+1 ;channel E 01671 0005 nxpchanf =nxpchane+1 ;channel F 01672 0006 nxpchang =nxpchanf+1 ;channel G 01673 0007 nxpchanh =nxpchang+1 ;channel H 01674 ; 01675 .end 01676 .include "include_scsi/constants.asm" 01677 .opt swapbin 01678 ;================================================================================ 01679 ; 01680 ;SCSI SUBSYSTEM ATOMIC CONSTANTS 01681 ; 01682 ; 01683 ; "number of" constants... 01684 ; 01685 0005 n_grpshf =5 ;opcode group field shifts 01686 0015 n_lbabg0 =21 ;bits in group 0 LBA 01687 0020 n_lbabg2 =32 ;bits in group 2 LBA 01688 0005 n_lunshf =5 ;LUN field shifts 01689 0008 n_phases =8 ;SCSI bus phases 01690 0008 n_scsiid =8 ;recognized SCSI IDs 01691 0008 n_scsilu =8 ;recognized SCSI LUNs 01692 ; 01693 ; 01694 ; "size of" constants... 01695 ; 01696 0006 s_cdbg0 =6 ;group 0 CDB 01697 000A s_cdbg1 =10 ;group 1 CDB 01698 000A s_cdbg2 =10 ;group 2 CDB 01699 0010 s_cdbg4 =16 ;group 4 CDB 01700 000C s_cdbg5 =12 ;group 5 CDB 01701 0001 s_mesg =1 ;message 01702 0008 s_mesgws =8 ;message workspace 01703 0010 s_sspid =16 ;product ID field 01704 0012 s_reqsen =18 ;request sense data 01705 0004 s_revsn =4 ;product revision field 01706 0008 s_sernm =8 ;product serial number field 01707 0001 s_stat =1 ;status 01708 0008 s_vendr =8 ;vendor ID field 01709 0024 s_inqry =s_vendr+s_sspid+s_revsn+s_sernm 01710 0024 s_miswrk =s_inqry ;enumeration & inquiry workspace 01711 ; 01712 ; 01713 ; SCSI bus phases... 01714 ; 01715 0000 ssphasdo =%000 ;data out 01716 0001 ssphasdi =%001 ;data in 01717 0002 ssphascm =%010 ;command 01718 0003 ssphasst =%011 ;status 01719 0004 ssphasra =%100 ;reserved 01720 0005 ssphasrb =%101 ;reserved 01721 0006 ssphasmo =%110 ;message out 01722 0007 ssphasmi =%111 ;message in 01723 ; 01724 ; 01725 ; bus control constants... 01726 ; 01727 0007 scsiid94 =7 ;host adapter SCSI ID 01728 0005 scsirdly =5 ;bus reset recovery time (sec) 01729 00FA scsiselt =250 ;selection timeout (msec) 01730 ; 01731 ; 01732 ; miscellaneous... 01733 ; 01734 0020 lbamsw32 =%1000000000000000000000 >> s_bword ;... 01735 ; 01736 ; —————————————————————————————————————————————————————————————————————— 01737 ; LBA32MSW is used during SCSI enumeration to determine if a SCSI device 01738 ; recognizes 32 bit block addressing. If the MSW of the device's capac- 01739 ; ity as returned by the "read capacity" command is greater than 21 bits 01740 ; then the device will be flagged as 32 bit LBA capable. 01741 ; —————————————————————————————————————————————————————————————————————— 01742 ; 01743 0000 lun =0 ;default logical unit 01744 000A scsitrct =10 ;enumeration test ready attempts 01745 0002 scsitrtd =2 ;test ready attempt spacing (secs) 01746 ; 01747 .end 01748 .include "include_mon/constants.asm" 01749 .opt swapbin 01750 ;================================================================================ 01751 ; 01752 ;MACHINE LANGUAGE MONITOR "SIZE-OF" CONSTANTS 01753 ; 01754 0003 s_addr =s_xword ;24-bit address 01755 0020 s_auxbuf =32 ;auxiliary buffer 01756 0045 s_ibuf =69 ;input buffer 01757 0003 s_mnemon =3 ;MPU ASCII mnemonic 01758 0002 s_mnepck =2 ;MPU encoded mnemonic 01759 0003 s_mvinst =3 ;MVN/MVP instruction 01760 0001 s_opcode =s_byte ;MPU opcode 01761 0003 s_oper =s_xword ;operand 01762 0004 s_pfac =s_dword ;primary math accumulator 01763 0006 s_sfac =s_dword+s_word ;secondary math accumulators 01764 ; 01765 ;================================================================================ 01766 ; 01767 ;MACHINE LANGUAGE MONITOR "NUMBER-OF" CONSTANTS 01768 ; 01769 0015 n_dbytes =21 ;default disassembly bytes 01770 0010 n_dump =16 ;bytes per memory dump line 01771 00FF n_mbytes =s_rampag-1 ;default memory dump bytes 01772 000A n_hccols =10 ;compare/hunt display columns 01773 0009 n_opcols =3*s_oper ;disassembly operand columns 01774 0004 n_opslsr =4 ;LSRs to extract instruction size 01775 0005 n_shfenc =5 ;shifts to encode/decode mnemonic 01776 ; 01777 ;================================================================================ 01778 ; 01779 ;MACHINE LANGUAGE MONITOR NUMERIC CONVERSION CONSTANTS 01780 ; 01781 0006 a_hexdec ='A'-'9'-2 ;hex to decimal difference 01782 0025 c_bin ='%' ;binary prefix 01783 002B c_dec ='+' ;decimal prefix 01784 0024 c_hex ='$' ;hexadecimal prefix 01785 0025 c_oct ='%' ;octal prefix 01786 0066 k_hex ='f' ;hex ASCII conversion 01787 0020 m_bits =s_pfac*s_bibyte ;operand bit size 01788 0009 m_rectyp ='9'-'0' ;S-record type range 01789 000F bcdumask =%00001111 ;isolate BCD units mask 01790 0030 btoamask =%00110000 ;binary to ASCII mask 01791 ; 01792 ;================================================================================ 01793 ; 01794 ;ASSEMBLER/DISASSEMBLER CONSTANTS 01795 ; 01796 003F a_mnecvt ='?' ;encoded mnemonic conversion base 01797 001F aimmaska =%00011111 ;.A immediate opcode test #1 01798 0009 aimmaskb =%00001001 ;.A immediate opcode test #2 01799 0041 asmprfx ='A' ;assemble code prefix 01800 0009 ascprmct =9 ;assembler prompt "size-of" 01801 002E disprfx ='.' ;disassemble code prefix 01802 00C0 flimmask =%11000000 ;force long immediate flag 01803 00E0 opc_cpxi =$e0 ;CPX # opcode 01804 00C0 opc_cpyi =$c0 ;CPY # opcode 01805 00A2 opc_ldxi =$a2 ;LDX # opcode 01806 00A0 opc_ldyi =$a0 ;LDY # opcode 01807 0054 opc_mvn =$54 ;MVN opcode 01808 0044 opc_mvp =$44 ;MVP opcode 01809 00C2 opc_rep =$c2 ;REP opcode 01810 00E2 opc_sep =$e2 ;SEP opcode 01811 0030 pfmxmask =sr_amw | sr_ixw ;MPU m & x flag bits mask 01812 ; 01813 ; 01814 ; assembler prompt buffer offsets... 01815 ; 01816 0002 apadrbkh =s_word ;instruction address bank MSN 01817 0003 apadrbkl =apadrbkh+s_byte ;instruction address bank LSN 01818 0004 apadrmbh =apadrbkl+s_byte ;instruction address MSB MSN 01819 0005 apadrmbl =apadrmbh+s_byte ;instruction address MSB LSN 01820 0006 apadrlbh =apadrmbl+s_byte ;instruction address LSB MSN 01821 0007 apadrlbl =apadrlbh+s_byte ;instruction address LSB LSN 01822 ; 01823 ; 01824 ; addressing mode preamble symbols... 01825 ; 01826 0021 amp_flim ='!' ;force long 01827 0023 amp_imm ='#' ;immediate 01828 0028 amp_ind ='(' ;indirect 01829 005B amp_indl ='[' ;indirect long 01830 ; 01831 ; 01832 ; addressing mode symbolic translation indices... 01833 ; 01834 0000 am_nam =%0000 ;no symbol 01835 0001 am_imm =%0001 ;# 01836 0002 am_adrx =%0010 ;,X 01837 0003 am_adry =%0011 ;,Y 01838 0004 am_ind =%0100 ;() 01839 0005 am_indl =%0101 ;[] 01840 0006 am_indly =%0110 ;[],Y 01841 0007 am_indx =%0111 ;(,X) 01842 0008 am_indy =%1000 ;(),Y 01843 0009 am_stk =%1001 ;,S 01844 000A am_stky =%1010 ;(,S),Y 01845 000B am_move =%1011 ;, 01846 ; 01847 ; 01848 ; operand size translation indices... 01849 ; 01850 0000 ops0 =%0000 << 4 ;no operand 01851 0010 ops1 =%0001 << 4 ;8 bit operand 01852 0020 ops2 =%0010 << 4 ;16 bit operand 01853 0030 ops3 =%0011 << 4 ;24 bit operand 01854 0050 bop1 =%0101 << 4 ;8 bit relative branch 01855 0060 bop2 =%0110 << 4 ;16 bit relative branch 01856 0090 vops =%1001 << 4 ;8 or 16 bit operand 01857 ; 01858 ; 01859 ; operand size & addressing mode extraction masks... 01860 ; 01861 000F amodmask =%00001111 ;addressing mode index 01862 0030 opsmask =%00110000 ;operand size 01863 00C0 vopsmask =%11000000 ;BOPx & VOPS flag bits 01864 ; 01865 ; 01866 ; instruction mnemonic encoding... 01867 ; 01868 2144 mne_adc =$2144 ;ADC 01869 2BC4 mne_and =$2bc4 ;AND 01870 6D04 mne_asl =$6d04 ;ASL 01871 2106 mne_bcc =$2106 ;BCC 01872 A106 mne_bcs =$a106 ;BCS 01873 9186 mne_beq =$9186 ;BEQ 01874 AA86 mne_bit =$aa86 ;BIT 01875 5386 mne_bmi =$5386 ;BMI 01876 33C6 mne_bne =$33c6 ;BNE 01877 6C46 mne_bpl =$6c46 ;BPL 01878 14C6 mne_bra =$14c6 ;BRA 01879 64C6 mne_brk =$64c6 ;BRK 01880 6CC6 mne_brl =$6cc6 ;BRL 01881 25C6 mne_bvc =$25c6 ;BVC 01882 A5C6 mne_bvs =$a5c6 ;BVS 01883 2348 mne_clc =$2348 ;CLC 01884 2B48 mne_cld =$2b48 ;CLD 01885 5348 mne_cli =$5348 ;CLI 01886 BB48 mne_clv =$bb48 ;CLV 01887 8B88 mne_cmp =$8b88 ;CMP 01888 8C08 mne_cop =$8c08 ;COP 01889 CC48 mne_cpx =$cc48 ;CPX 01890 D448 mne_cpy =$d448 ;CPY 01891 218A mne_dec =$218a ;DEC 01892 C98A mne_dex =$c98a ;DEX 01893 D18A mne_dey =$d18a ;DEY 01894 9C0C mne_eor =$9c0c ;EOR 01895 23D4 mne_inc =$23d4 ;INC 01896 CBD4 mne_inx =$cbd4 ;INX 01897 D3D4 mne_iny =$d3d4 ;INY 01898 6B96 mne_jml =$6b96 ;JML 01899 8B96 mne_jmp =$8b96 ;JMP 01900 6D16 mne_jsl =$6d16 ;JSL 01901 9D16 mne_jsr =$9d16 ;JSR 01902 115A mne_lda =$115a ;LDA 01903 C95A mne_ldx =$c95a ;LDX 01904 D15A mne_ldy =$d15a ;LDY 01905 9D1A mne_lsr =$9d1a ;LSR 01906 7DDC mne_mvn =$7ddc ;MVN 01907 8DDC mne_mvp =$8ddc ;MVP 01908 8C1E mne_nop =$8c1e ;NOP 01909 14E0 mne_ora =$14e0 ;ORA 01910 11A2 mne_pea =$11a2 ;PEA 01911 51A2 mne_pei =$51a2 ;PEI 01912 99A2 mne_per =$99a2 ;PER 01913 1262 mne_pha =$1262 ;PHA 01914 1A62 mne_phb =$1a62 ;PHB 01915 2A62 mne_phd =$2a62 ;PHD 01916 6262 mne_phk =$6262 ;PHK 01917 8A62 mne_php =$8a62 ;PHP 01918 CA62 mne_phx =$ca62 ;PHX 01919 D262 mne_phy =$d262 ;PHY 01920 1362 mne_pla =$1362 ;PLA 01921 1B62 mne_plb =$1b62 ;PLB 01922 2B62 mne_pld =$2b62 ;PLD 01923 8B62 mne_plp =$8b62 ;PLP 01924 CB62 mne_plx =$cb62 ;PLX 01925 D362 mne_ply =$d362 ;PLY 01926 89A6 mne_rep =$89a6 ;REP 01927 6C26 mne_rol =$6c26 ;ROL 01928 9C26 mne_ror =$9c26 ;ROR 01929 5566 mne_rti =$5566 ;RTI 01930 6D66 mne_rtl =$6d66 ;RTL 01931 A566 mne_rts =$a566 ;RTS 01932 20E8 mne_sbc =$20e8 ;SBC 01933 21A8 mne_sec =$21a8 ;SEC 01934 29A8 mne_sed =$29a8 ;SED 01935 51A8 mne_sei =$51a8 ;SEI 01936 89A8 mne_sep =$89a8 ;SEP 01937 1568 mne_sta =$1568 ;STA 01938 8D68 mne_stp =$8d68 ;STP 01939 CD68 mne_stx =$cd68 ;STX 01940 D568 mne_sty =$d568 ;STY 01941 DD68 mne_stz =$dd68 ;STZ 01942 C8AA mne_tax =$c8aa ;TAX 01943 D0AA mne_tay =$d0aa ;TAY 01944 292A mne_tcd =$292a ;TCD 01945 A12A mne_tcs =$a12a ;TCS 01946 216A mne_tdc =$216a ;TDC 01947 1CEA mne_trb =$1cea ;TRB 01948 1D2A mne_tsb =$1d2a ;TSB 01949 252A mne_tsc =$252a ;TSC 01950 CD2A mne_tsx =$cd2a ;TSX 01951 166A mne_txa =$166a ;TXA 01952 A66A mne_txs =$a66a ;TXS 01953 D66A mne_txy =$d66a ;TXY 01954 16AA mne_tya =$16aa ;TYA 01955 CEAA mne_tyx =$ceaa ;TYX 01956 50B0 mne_wai =$50b0 ;WAI 01957 7170 mne_wdm =$7170 ;WDM 01958 10F2 mne_xba =$10f2 ;XBA 01959 3132 mne_xce =$3132 ;XCE 01960 ; 01961 ; 01962 ; encoded instruction mnemonic indices... 01963 ; 01964 0010 mne_adcx =16 ;ADC 01965 001D mne_andx =29 ;AND 01966 002C mne_aslx =44 ;ASL 01967 000F mne_bccx =15 ;BCC 01968 0041 mne_bcsx =65 ;BCS 01969 003B mne_beqx =59 ;BEQ 01970 0046 mne_bitx =70 ;BIT 01971 0024 mne_bmix =36 ;BMI 01972 001F mne_bnex =31 ;BNE 01973 002A mne_bplx =42 ;BPL 01974 0005 mne_brax =5 ;BRA 01975 0027 mne_brkx =39 ;BRK 01976 002B mne_brlx =43 ;BRL 01977 0017 mne_bvcx =23 ;BVC 01978 0044 mne_bvsx =68 ;BVS 01979 0014 mne_clcx =20 ;CLC 01980 001B mne_cldx =27 ;CLD 01981 0023 mne_clix =35 ;CLI 01982 0047 mne_clvx =71 ;CLV 01983 0035 mne_cmpx =53 ;CMP 01984 0037 mne_copx =55 ;COP 01985 004E mne_cpxx =78 ;CPX 01986 0058 mne_cpyx =88 ;CPY 01987 0012 mne_decx =18 ;DEC 01988 004A mne_dexx =74 ;DEX 01989 0054 mne_deyx =84 ;DEY 01990 003D mne_eorx =61 ;EOR 01991 0015 mne_incx =21 ;INC 01992 004D mne_inxx =77 ;INX 01993 0057 mne_inyx =87 ;INY 01994 0028 mne_jmlx =40 ;JML 01995 0036 mne_jmpx =54 ;JMP 01996 002D mne_jslx =45 ;JSL 01997 003F mne_jsrx =63 ;JSR 01998 0001 mne_ldax =1 ;LDA 01999 0049 mne_ldxx =73 ;LDX 02000 0053 mne_ldyx =83 ;LDY 02001 0040 mne_lsrx =64 ;LSR 02002 0030 mne_mvnx =48 ;MVN 02003 003A mne_mvpx =58 ;MVP 02004 0038 mne_nopx =56 ;NOP 02005 0006 mne_orax =6 ;ORA 02006 0002 mne_peax =2 ;PEA 02007 0021 mne_peix =33 ;PEI 02008 003C mne_perx =60 ;PER 02009 0003 mne_phax =3 ;PHA 02010 000A mne_phbx =10 ;PHB 02011 001A mne_phdx =26 ;PHD 02012 0026 mne_phkx =38 ;PHK 02013 0033 mne_phpx =51 ;PHP 02014 004B mne_phxx =75 ;PHX 02015 0055 mne_phyx =85 ;PHY 02016 0004 mne_plax =4 ;PLA 02017 000B mne_plbx =11 ;PLB 02018 001C mne_pldx =28 ;PLD 02019 0034 mne_plpx =52 ;PLP 02020 004C mne_plxx =76 ;PLX 02021 0056 mne_plyx =86 ;PLY 02022 0031 mne_repx =49 ;REP 02023 0029 mne_rolx =41 ;ROL 02024 003E mne_rorx =62 ;ROR 02025 0025 mne_rtix =37 ;RTI 02026 002E mne_rtlx =46 ;RTL 02027 0043 mne_rtsx =67 ;RTS 02028 000E mne_sbcx =14 ;SBC 02029 0013 mne_secx =19 ;SEC 02030 0019 mne_sedx =25 ;SED 02031 0022 mne_seix =34 ;SEI 02032 0032 mne_sepx =50 ;SEP 02033 0007 mne_stax =7 ;STA 02034 0039 mne_stpx =57 ;STP 02035 0050 mne_stxx =80 ;STX 02036 0059 mne_styx =89 ;STY 02037 005B mne_stzx =91 ;STZ 02038 0048 mne_taxx =72 ;TAX 02039 0052 mne_tayx =82 ;TAY 02040 0018 mne_tcdx =24 ;TCD 02041 0042 mne_tcsx =66 ;TCS 02042 0011 mne_tdcx =17 ;TDC 02043 000C mne_trbx =12 ;TRB 02044 000D mne_tsbx =13 ;TSB 02045 0016 mne_tscx =22 ;TSC 02046 004F mne_tsxx =79 ;TSX 02047 0008 mne_txax =8 ;TXA 02048 0045 mne_txsx =69 ;TXS 02049 005A mne_txyx =90 ;TXY 02050 0009 mne_tyax =9 ;TYA 02051 0051 mne_tyxx =81 ;TYX 02052 0020 mne_waix =32 ;WAI 02053 002F mne_wdmx =47 ;WDM 02054 0000 mne_xbax =0 ;XBA 02055 001E mne_xcex =30 ;XCE 02056 ; 02057 ;================================================================================ 02058 ; 02059 ;MISCELLANEOUS MONITOR CONSTANTS 02060 ; 02061 0004 halftab =4 ;1/2 tabulation spacing 02062 003E memprfx ='>' ;memory dump prefix 02063 003A memsepch =':' ;memory dump separator 02064 002E memsubch ='.' ;memory dump non-print char 02065 0021 scsipre ='!' ;SCSI command preamble char 02066 0053 srecpre ='S' ;S-record preamble char 02067 0000 srinit =%00000000 ;SR initialization value 02068 0003 stopkey =a_etx ;[Ctrl-C]: display stop key 02069 ; 02070 .end 02071 .include "include_kernel/display.asm" 02072 ;================================================================================ 02073 ; 02074 ;WY60/150/160/GPT TERMINAL DISPLAY CONTROL CONSTANTS — Description Order 02075 ; 02076 0020 t_cpbase =' ' ;cursor positioning base char 02077 0031 t_blcorn ='1' ;graphic bottom left corner 02078 0035 t_brcorn ='5' ;graphic bottom right corner 02079 003A t_hline =':' ;graphic horizontal line char 02080 0034 t_conctl ='4' ;graphic left connector 02081 0039 t_conctr ='9' ;graphic right connector 02082 0032 t_tlcorn ='2' ;graphic top left corner 02083 0033 t_trcorn ='3' ;graphic top right corner 02084 0036 t_vline ='6' ;graphic vertical line char 02085 ; 02086 ;================================================================================ 02087 ; 02088 ;POWER-ON SELF-TEST DISPLAY CONSTANTS 02089 ; 02090 0011 memctcol =17 ;memory count display column 02091 0009 memctrow =9 ;memory count display row 02092 0017 versrow =23 ;BIOS version display row 02093 ; 02094 ; 02095 ; POST banner graphics details... 02096 ; 02097 0000 postrecx =0 ;rectangle left column 02098 0000 postrecy =0 ;rectangle top row 02099 0000 postsepx =0 ;rectangle separator line col 02100 0004 postsepy =4 ;rectangle separator line row 02101 0029 postxdim =41 ;rectangle width 02102 0008 postydim =8 ;rectangle height 02103 0027 psghllen =postxdim-2 ;rectangle separator line length 02104 ; 02105 .end 02106 .include "include_scsi/display.asm" 02107 ;================================================================================ 02108 ; 02109 ;SCSI ENUMERATION DISPLAY CONSTANTS 02110 ; 02111 0002 colid =2 ;ID column 02112 0006 colvendr =6 ;vendor column 02113 0010 colprod =16 ;product column 02114 0022 colvers =34 ;version column 02115 0029 colstat =41 ;status column 02116 0009 rowtitle =9 ;column titles row 02117 000B rowenum =rowtitle+2 ;enumeration starting row 02118 0030 seghllen =48 ;enumeration horiz line length 02119 ; 02120 .end 02121 .include "include_scsi/masks.asm" 02122 .opt swapbin 02123 ;================================================================================ 02124 ; 02125 ;SCSI SUBSYSTEM MASKS 02126 ; 02127 00E0 grpmask =%11100000 ;command group 02128 0007 haidmask =%00000111 ;HBA bus ID 02129 0010 iqsynctr =%00010000 ;synchronous transfer flag bit 02130 0007 iqvendr =%00000111 ;ANSI version mask 02131 0080 lbafmask =%10000000 ;32 bit LBA flag 02132 00E0 lunmask =%11100000 ;LUN field mask 02133 001F lunmaskr =lunmask ^ %11111111 ;LBA MSB field mask 02134 0001 scbdimm =%00000001 ;immediate return bit 02135 001F sdtmask =%00011111 ;device type flag mask 02136 0020 sg2mask =2 << s_bnybbl ;group 2 field mask 02137 ; 02138 .end 02139 .include "include_scsi/commands.asm" 02140 ;================================================================================ 02141 ; 02142 ;SCSI DEVICE COMMAND OPERATION CODES 02143 ; 02144 0000 sc_tur =$00 ;test unit ready 02145 0001 sc_recal =$01 ;recalibrate/rewind... 02146 ; 02147 ; ———————————————————————————————————————————————————— 02148 ; SC_RECAL is obsoleted for block devices, & may cause 02149 ; a "check condition" status if issued to one. 02150 ; ———————————————————————————————————————————————————— 02151 ; 02152 0002 sc_getba =$02 ;get LBA... 02153 ; 02154 ; ———————————————————————————————————————————————————— 02155 ; SC_GETBA is obsoleted for block devices, & may cause 02156 ; a "check condition" status if issued to one. 02157 ; ———————————————————————————————————————————————————— 02158 ; 02159 0003 sc_getsd =$03 ;get sense data 02160 0004 sc_fmt =$04 ;format unit 02161 0005 sc_getbl =$05 ;get block limits 02162 0008 sc_read =$08 ;read from medium 02163 000A sc_writ =$0a ;write to medium 02164 000B sc_seek =$0b ;seek to block (block device) 02165 000C sc_seekb =$0c ;seek to block (stream device) 02166 0010 sc_wrtfm =$10 ;write filemarks 02167 0011 sc_space =$11 ;space on medium 02168 0012 sc_inqry =$12 ;get device parameters 02169 0015 sc_mode =$15 ;mode select 02170 0016 sc_resrv =$16 ;reserve device 02171 0017 sc_reles =$17 ;release device 02172 ; 02173 ; —————————————————————————————————————————————— 02174 ; SC_RELES & SC_RESRV are obsoleted but retained 02175 ; for compatibility with older devices. 02176 ; —————————————————————————————————————————————— 02177 ; 02178 0018 sc_copy =$18 ;copy data 02179 0019 sc_erase =$19 ;erase data 02180 001A sc_modes =$1a ;mode sense 02181 001B sc_ssdev =$1b ;start/stop or load/unload medium 02182 001E sc_lock =$1e ;lock/unlock medium 02183 0025 sc_getdc =$25 ;get device capacity 02184 0028 sc_readx =$28 ;read from medium extended 02185 002A sc_writx =$2a ;write to medium extended 02186 002B sc_seekx =$2b ;seek to block extended 02187 002B sc_locat =$2b ;set position in medium 02188 0034 sc_getp =$34 ;get logical position 02189 ; 02190 .end 02191 .include "include_scsi/devices.asm" 02192 ;================================================================================ 02193 ; 02194 ;LOGGED SCSI DEVICES TABLE 02195 ; 02196 ; —————————————————————————————————————— 02197 ; slot offset ——> $00 $01 $02 $03 $04 $05 $06 $07 02198 ; —————————————————————————————————————— 02199 ; | | ^——————————————^ ^————^ 02200 ; | | capacity block 02201 ; | | size 02202 ; | +———> type 02203 ; +————————> flag 02204 ; 02205 ; 02206 ; field sizes (description order)... 02207 ; 02208 0002 s_sdbsiz =s_word ;block size 02209 0001 s_sdflag =s_byte ;flag 02210 0004 s_sdcap =s_dword ;capacity in blocks 02211 0001 s_sdtype =s_byte ;type 02212 ; 02213 ; 02214 ; slot & table sizes... 02215 ; 02216 0003 sdslotex =ex2_x3 ;slot size computation factor... 02217 ; 02218 ; ——————————————————————————————————————————————————————————————————————— 02219 ; SDSLOTEX is used to atomically define the size of the device table slot 02220 ; so bit shifts can be used to compute a slot address for a SCSI ID. The 02221 ; above definition should be changed with caution. See additional notes 02222 ; in the SSLOTADR function. 02223 ; ——————————————————————————————————————————————————————————————————————— 02224 ; 02225 0008 s_sdslot =1 << sdslotex ;slot 02226 0040 s_sd_tab =s_sdslot*n_scsiid ;table 02227 ; 02228 ; 02229 ; field offsets... 02230 ; 02231 0000 o_sdflag =0 ;device flag... 02232 ; 02233 ; xx000xxx 02234 ; || ||| 02235 ; || +++———> ANSI version 02236 ; |+—————————> 1: supports sync transfer 02237 ; +——————————> 1: device enumerated 02238 ; 02239 0001 o_sdtype =o_sdflag+s_sdflag ;device type... 02240 ; 02241 ; x00xxxxx 02242 ; | ||||| 02243 ; | +++++———> ANSI device type 02244 ; +——————————> 1: device recognizes 32 bit LBAs 02245 ; 02246 0002 o_sdcap =o_sdtype+s_sdtype ;capacity in blocks 02247 0006 o_sdbsiz =o_sdcap+s_sdcap ;block size 02248 ; 02249 .end 02250 .include "include_scsi/keys_driver.asm" 02251 ;================================================================================ 02252 ; 02253 ;SCSI DRIVER EXIT CODES 02254 ; 02255 0000 ed_okay =%00000000 ;no error 02256 ; 02257 ; 02258 ; driver access codes... 02259 ; 02260 0001 ed_devid =%00000001 ;invalid SCSI ID (range) 02261 0002 ed_devne =%00000010 ;device not enumerated 02262 0020 ed_usfun =%00100000 ;unsupported driver function 02263 0008 ed_usgrp =%00001000 ;unsupported command group 02264 0011 ed_usphs =%00010001 ;unsupported bus phase 02265 ; 02266 ; 02267 ; bus or device access keys... 02268 ; 02269 0080 ed_devnp =%10000000 ;device not present 02270 0081 ed_abort =%10000001 ;aborted transaction 02271 0082 ed_check =%10000010 ;check condition 02272 ; 02273 ; 02274 ; controller access codes... 02275 ; 02276 0004 ed_cntrl =%00000100 ;general controller error 02277 0005 ed_fifo =%00000101 ;FIFO count error 02278 0009 ed_ilcmd =%00001001 ;illegal controller command 02279 0010 ed_reset =%00010000 ;unexpected bus reset 02280 ; 02281 .end 02282 .include "include_scsi/keys_status.asm" 02283 ;================================================================================ 02284 ; 02285 ;SCSI STATUS CODES (description order) 02286 ; 02287 0002 ss_check =%00000010 ;check condition 02288 0000 ss_ccomp =%00000000 ;command completed 02289 0022 ss_cterm =%00100010 ;command terminated 02290 0004 ss_cmet =%00000100 ;condition met/good 02291 0010 ss_goodi =%00010000 ;intermediate good 02292 0018 ss_resrv =%00011000 ;reservation conflict 02293 0008 ss_busy =%00001000 ;target busy 02294 ; 02295 .end 02296 .include "include_scsi/offsets_cdb.asm" 02297 ;================================================================================ 02298 ; 02299 ;SCSI COMMAND DESCRIPTOR BLOCK OFFSETS 02300 ; 02301 0000 so_opcod =0 ;SCSI operation code... 02302 ; 02303 ; xxxxxxxx 02304 ; |||||||| 02305 ; |||+++++———> command 02306 ; +++————————> group 02307 ; 02308 0001 so_lunla =1 ;LUN/LBA MSB... 02309 ; 02310 ; xxxxxxxx 02311 ; |||||||| 02312 ; |||+++++———> LBA bits 16-21 (group 0 only) 02313 ; +++————————> LUN 02314 ; 02315 ; 02316 ; group 0 block device offsets... 02317 ; 02318 0002 so_lbam =2 ;LBA bits 8-15 02319 0003 so_lbal =3 ;LBA bits 0-7 02320 0004 so_xfrl =4 ;transfer length 02321 ; 02322 ; 02323 ; group 0 stream device offsets... 02324 ; 02325 0002 so_xfrmb =2 ;transfer length bits 16-23 02326 0003 so_xfrib =3 ;transfer length bits 8-15 02327 0004 so_xfrlb =4 ;transfer length bits 0-7 02328 ; 02329 ; 02330 ; group 0 common offsets... 02331 ; 02332 0005 so_ctrl =5 ;control byte 02333 ; 02334 ; 02335 ; groups 1, 2 & 5 common offsets... 02336 ; 02337 0002 so_lbamb =2 ;LBA bits 24-31 02338 0003 so_lbamu =3 ;LBA bits 16-23 02339 0004 so_lbaml =4 ;LBA bits 8-15 02340 0005 so_lball =5 ;LBA bits 0-7 02341 ; 02342 ; 02343 ; group 1 & 2 offsets... 02344 ; 02345 0007 so_xfrlh =7 ;transfer length MSB 02346 0008 so_xfrll =8 ;transfer length LSB 02347 0009 so_ctrll =9 ;control byte 02348 ; 02349 ; 02350 ; group 5 offsets... 02351 ; 02352 0008 so_xfrxh =8 ;transfer length MSB 02353 0009 so_xfrxl =9 ;transfer length LSB 02354 000B so_ctrxl =11 ;control byte 02355 ; 02356 .end 02357 .include "include_scsi/offsets_misc.asm" 02358 ;================================================================================ 02359 ; 02360 ;SCSI MISCELLANEOUS OFFSETS 02361 ; 02362 ; 02363 ; read capacity... 02364 ; 02365 0000 rc_lbahi =0 ;LBA MSW 02366 0002 rc_lbalo =2 ;LBA LSW 02367 0004 rc_bszhi =4 ;block size MSW 02368 0006 rc_bszlo =6 ;block size LSW 02369 ; 02370 ; 02371 ; basic inquiry... 02372 ; 02373 0000 iq_pdt =0 ;ANSI device type 02374 0002 iq_ansiv =2 ;ANSI version 02375 0007 iq_flags =7 ;flags 02376 0008 iq_vendr =8 ;vendor ID 02377 0010 iq_pid =iq_vendr+s_vendr ;product ID 02378 0020 iq_revsn =iq_pid+s_sspid ;product revision 02379 ; 02380 ; 02381 ; serial number inquiry... 02382 ; 02383 0001 iq_page =1 ;page code ($80) 02384 0003 iq_pglen =3 ;page length 02385 0004 iq_sernm =4 ;product serial number 02386 ; 02387 .end 02388 .include "include_scsi/types_device.asm" 02389 ;================================================================================ 02390 ; 02391 ;SCSI DEVICE TYPES 02392 ; 02393 0000 sd_da =$00 ;direct access 02394 0001 sd_seq =$01 ;sequential access 02395 0002 sd_prtr =$02 ;printer 02396 0003 sd_proc =$03 ;processor 02397 0004 sd_worm =$04 ;WORM 02398 0005 sd_cdrom =$05 ;CD/DVD ROM 02399 0006 sd_scanr =$06 ;scanner 02400 0007 sd_optcl =$07 ;optical storage 02401 0008 sd_juke =$08 ;medium changer 02402 0009 sd_comm =$09 ;miscellaneous communications 02403 000C sd_sarry =$0c ;storage array 02404 000E sd_das =$0e ;simplified direct access 02405 000F sd_ocrw =$0f ;optical card reader/writer 02406 ; 02407 .end 02408 .include "include_storage/atomic.asm" 02409 ;=============================================================================== 02410 ; 02411 ;POC SERIES MASS STORAGE ATOMIC CONSTANTS 02412 ; 02413 0001 s_fsflag =s_byte ;filesystem flag size 02414 0004 s_fsmag =s_dword ;filesystem magic number size 02415 0008 s_fsnam =8 ;filesystem name padded size 02416 0004 s_islmag =s_dword ;ISL magic number size 02417 0004 s_lba =s_dword ;logical block address size 02418 0004 s_pblks =s_dword ;block count field size 02419 0008 s_volnam =8 ;volume name size 02420 ; 02421 ; 02422 ; default device block sizes... 02423 ; 02424 0800 s_cdblk =2048 ;CDA 02425 0200 s_hdblk =512 ;HDA 02426 0200 s_tdblk =512 ;TDA 02427 4000 s_cdblkb =s_cdblk *s_bibyte ;CDA block size in bits 02428 1000 s_hdblkb =s_hdblk *s_bibyte ;HDA block size in bits 02429 1000 s_tdblkb =s_tdblk *s_bibyte ;TDA block size in bits 02430 ; 02431 .end 02432 .include "include_storage/islmagic.asm" 02433 ;=============================================================================== 02434 ; 02435 ;POC SERIES MASS STORAGE ATOMIC CONSTANTS 02436 ; 02437 D4A2 islmagic =$c3c4d4A2 ;ISL magic number... 02438 ; 02439 ; ———————————————————————————————————————————————————————————————————————— 02440 ; ISLMAGIC must be in the boot block of each disk on which 1 or more file- 02441 ; systems have been defined. See the narratives for more detail. 02442 ; 02443 ; WARNING: DO NOT EDIT THIS FILE! 02444 ; ———————————————————————————————————————————————————————————————————————— 02445 ; 02446 .end 02447 .include "include_storage/layout.asm" 02448 ;=============================================================================== 02449 ; 02450 ;POC SERIES HARD DISK MASS STORAGE LAYOUT 02451 ; 02452 ; FIELD LOGICAL BLOCK ADDRESS 02453 ; +=======================+————————————————————— 02454 ; | 1st filesystem | 02455 ; +=======================+ $00000100 (pb_fs001) 02456 ; | reserved (222 blocks) | 02457 ; +———————————————————————+ $00000022 (pb_rsrvd) 02458 ; | stage 2 boot | 02459 ; +———————————————————————+ $00000002 (pb_stag2) 02460 ; | master boot | 02461 ; +=======================+ $00000000 (pb_mboot) 02462 ; 02463 0000 pb_mboot =$00000000 ;master boot origin LBA 02464 0002 pb_stag2 =$00000002 ;stage 2 boot origin LBA 02465 0022 pb_rsrvd =$00000022 ;reserved blocks origin LBA 02466 0100 pb_fs001 =$00000100 ;1st filesystem origin LBA 02467 0004 m_fsdisk =4 ;max filesystems per disk 02468 0002 n_mboot =pb_stag2 -pb_mboot ;master boot blocks 02469 0020 n_stag2 =pb_rsrvd -pb_stag2 ;stage 2 boot blocks 02470 00DE n_rsrvd =pb_fs001 -pb_rsrvd ;reserved blocks 02471 0400 s_mboot =n_mboot *s_hdblk ;master boot bytes 02472 4000 s_s2boot =n_stag2 *s_hdblk ;stage 2 boot bytes 02473 BC00 s_rsrvd =n_rsrvd *s_hdblk ;reserved bytes 02474 ; 02475 ; 02476 .end 02477 .include "include_storage/boot.asm" 02478 ;=============================================================================== 02479 ; 02480 ;MASTER BOOT BLOCK LAYOUT 02481 ; 02482 ; FIELD Offset in Block 02483 ; +================================+ ———————————————— 02484 ; | master boot code (914 bytes) | 02485 ; +————————————————————————————————+ $006E (mb_code) 02486 ; | filesystem table (90 bytes) | 02487 ; +————————————————————————————————+ $0014 (mb_fstab) 02488 ; | volume name | 02489 ; +————————————————————————————————+ $000C (mb_magic) 02490 ; | master boot record timestamp | 02491 ; +————————————————————————————————+ $0006 (mb_utime) 02492 ; | boot block magic number | 02493 ; +————————————————————————————————+ $0002 (mb_magic) 02494 ; | master boot code start address | 02495 ; +================================+ $0000 (mb_jaddr) 02496 ; 02497 ; 02498 ; filesystem table slot structure... 02499 ; 02500 0000 ft_flag =0 ;status flag... 02501 ; 02502 ; xx000000 02503 ; || 02504 ; |+—————————> 0: filesystem is read only 02505 ; | 1: filesystem is read/write 02506 ; +——————————> 0: slot is unused 02507 ; 1: slot points to active filesystem 02508 ; 02509 0001 ft_nused =ft_flag +s_fsflag ;unused field 02510 0002 ft_magic =ft_nused +s_byte ;magic number 02511 0006 ft_fsnam =ft_magic +s_fsmag ;name 02512 000E ft_sblba =ft_fsnam +s_fsnam ;starting LBA 02513 0012 ft_pblks =ft_sblba +s_lba ;total physical blocks 02514 ; 02515 0016 s_fsslot =ft_pblks +s_pblks ;table slot size 02516 ; 02517 ; 02518 ; filesystem table structure... 02519 ; 02520 0000 ft_nfs =0 ;number of active entries 02521 0001 ft_slotx =ft_nfs +s_byte ;lowest unused slot index 02522 0002 ft_slota =ft_slotx +s_byte ;slot array 02523 0058 ft_slotp =s_fsslot *m_fsdisk ;slot array size 02524 005A s_fstab =ft_slota +ft_slotp ;table size 02525 ; 02526 ; 02527 ; boot block structure... 02528 ; 02529 0000 mb_jaddr =0 ;MB code JuMP address 02530 0002 mb_magic =mb_jaddr +s_ptr ;MBR magic number 02531 0006 mb_utime =mb_magic +s_islmag ;MBR timestamp 02532 000C mb_volum =mb_utime +s_time_t ;volume name 02533 0014 mb_fstab =mb_volum +s_volnam ;filesystem table 02534 006E mb_code =mb_fstab +s_fstab ;master boot code 02535 0392 s_mbcode =s_mboot -mb_code ;master boot code space 02536 ; 02537 .end 02538 .include "include_kernel/directpage.asm" 02539 ;================================================================================ 02540 ; 02541 ;BIOS/KERNEL DIRECT PAGE STORAGE 02542 ; 02543 0000 kerneldp =zeropage ;kernel's notion of direct page 02544 ; 02545 ; 02546 ; vQUART channel block & pointer allocation... 02547 ; 02548 0008 s_nxpchp =s_ptr*n_nxpchn ;channel 02549 0004 s_nxpbkp =s_ptr*n_nxpblk ;block 02550 ; 02551 ; 02552 ; timekeeping workspace... 02553 ; 02554 0000 tdflag =kerneldp ;$80 = sleeping 02555 0001 slptime =tdflag+s_byte ;sleep termination time 02556 0005 jiffct =slptime+s_utcnt ;jiffy counter 02557 0006 uptime =jiffct+s_byte ;uptime counter (seconds) 02558 000A uxtime =uptime+s_utcnt ;UNIX time (seconds) 02559 ; 02560 ; 02561 ; TIA-232 driver workspace... 02562 ; 02563 0010 tiazpptr =uxtime+s_time_t ;start of pointer array 02564 0010 tiasr =tiazpptr ;vQUART channel status 02565 0018 tiacr =tiasr+s_nxpchp ;vQUART channel command 02566 0020 tiafif =tiacr+s_nxpchp ;vQUART channel FIFO 02567 0028 tiagetrx =tiafif+s_nxpchp ;RxD queue 'get' 02568 0030 tiaputrx =tiagetrx+s_nxpchp ;RxD queue 'put' 02569 0038 tiagettx =tiaputrx+s_nxpchp ;TxD queue 'get' 02570 0040 tiaputtx =tiagettx+s_nxpchp ;TxD queue 'put' 02571 0048 tiatxst =tiaputtx+s_nxpchp ;TxD status (bit field) 02572 0049 tiairqst =tiatxst+s_byte ;vQUART IRQ status workspace 02573 ; 02574 004A zeropage .= tiairqst+s_byte ;*** kernel direct page end *** 02575 ; 02576 .end 02577 .include "include_scsi/directpage.asm" 02578 ;================================================================================ 02579 ; 02580 ;SCSI DRIVER ZERO PAGE STORAGE 02581 ; 02582 004A scsihba =zeropage ;$80 = HBA detected 02583 004B scsididx =scsihba+s_byte ;device table pointer 02584 004D scsigidx =scsididx+s_ptr ;CDB size table index 02585 004E scsistat =scsigidx+s_byte ;status byte 02586 ; 02587 ; 02588 ; enumeration workspace... 02589 ; 02590 004F scsiedev =scsistat+s_byte ;current device 02591 0050 scsierow =scsiedev+s_byte ;display row 02592 0051 scsiztmp =scsierow+s_byte ;temporary storage 02593 ; 02594 0052 zeropage .= scsiztmp+s_byte ;new start of zero page 02595 ; 02596 .end 02597 .include "include_mon/directpage.asm" 02598 ;================================================================================ 02599 ; 02600 ;MACHINE LANGUAGE MONITOR DIRECT PAGE STORAGE 02601 ; 02602 0052 reg_pbx =zeropage ;PB shadow 02603 0053 reg_pcx =reg_pbx+s_mpupbx ;PC shadow 02604 0055 reg_srx =reg_pcx+s_mpupcx ;SR shadow 02605 0056 reg_ax =reg_srx+s_mpusrx ;.C shadow 02606 0058 reg_xx =reg_ax+s_word ;.X shadow 02607 005A reg_yx =reg_xx+s_word ;.Y shadow 02608 005C reg_spx =reg_yx+s_word ;SP shadow 02609 005E reg_dpx =reg_spx+s_mpuspx ;DP shadow 02610 0060 reg_dbx =reg_dpx+s_mpudpx ;DB shadow 02611 ; 02612 ; 02613 ; general workspace... 02614 ; 02615 0061 addra =reg_dbx+s_mpudbx ;address #1 02616 0064 addrb =addra+s_addr ;address #2 02617 0067 faca =addrb+s_addr ;primary accumulator 02618 006B facax =faca+s_pfac ;extended primary accumulator 02619 006F facb =facax+s_pfac ;secondary accumulator 02620 0075 facc =facb+s_sfac ;tertiary accumulator 02621 007B operand =facc+s_sfac ;instruction operand 02622 007E auxbufix =operand+s_oper ;auxiliary buffer index 02623 007F ibufidx =auxbufix+s_byte ;input buffer index 02624 0080 bitsdig =ibufidx+s_byte ;bits per numeral 02625 0081 numeral =bitsdig+s_byte ;numeral buffer 02626 0082 radix =numeral+s_byte ;radix index 02627 0083 admodidx =radix+s_byte ;addressing mode index 02628 0084 charcnt =admodidx+s_byte ;character counter 02629 0086 instsize =charcnt+s_word ;instruction size 02630 0088 mnepck =instsize+s_word ;encoded mnemonic 02631 008A opcode =mnepck+s_mnepck ;current opcode 02632 008B status =opcode+s_byte ;I/O status flag 02633 008C xrtemp =status+s_byte ;temp .X storage 02634 008D eopsize =xrtemp+s_byte ;entered operand size 02635 008E flimflag =eopsize+s_byte ;forced long immediate... 02636 ; 02637 ; xx000000 02638 ; || 02639 ; |+—————————> 0: .X/.Y = 8 bits 02640 ; | 1: .X/.Y = 18 bits 02641 ; +——————————> 0: .A = 8 bits 02642 ; 1: .A = 16 bits 02643 ; 02644 ; ———————————————————————————————————————————————————————————————————————— 02645 ; During assembly, FLIMFLAG indicates the operand size used with an immed- 02646 ; iate mode instruction, thus causing the following disassembly to display 02647 ; the assembled operand size. During disassembly, FLIMFLAG will mirror 02648 ; the effect of the most recent REP or SEP instruction. 02649 ; ———————————————————————————————————————————————————————————————————————— 02650 ; 02651 008F iopsize =flimflag+s_byte ;operand size 02652 0090 range =iopsize+s_byte ;allowable radix range 02653 0091 vopsflag =range+s_byte ;VOPS & ROPS mode bits 02654 ; 02655 ; 02656 ; copy/fill workspace (overlaps some of the above)... 02657 ; 02658 0067 mcftwork =faca ;start of copy/fill code 02659 0068 mcftopc =mcftwork+s_byte ;instruction opcode 02660 0069 mcftbnk =mcftopc+s_byte ;banks 02661 ; 02662 ; 02663 ; S-record load workspace (overlaps some of the above)... 02664 ; 02665 0064 endaddr =addrb ;load ending address 02666 0075 loadaddr =facc ;current record load address 02667 0077 loadbank =loadaddr+s_word ;current record load bank 02668 0061 strtaddr =addra ;load starting address 02669 ; 02670 007E datax =auxbufix ;datum holding area 02671 0088 cksumcmp =mnepck ;computed record checksum 02672 008D nrecs =eopsize ;processed S1 record count 02673 008F pageoff =iopsize ;record load page offset 02674 0090 reclen =range ;record length 02675 0091 rectype =vopsflag ;record type 02676 ; 02677 ; 02678 ; end of monitor direct page storage... 02679 ; 02680 0092 zeropage .= vopsflag+s_byte 02681 ; 02682 .end 02683 .include "include_kernel/absolute.asm" 02684 ;================================================================================ 02685 ; 02686 ;KERNEL ABSOLUTE RAM DEFINITIONS 02687 ; 02688 0100 ivectors =absolute ;indirect vectors 02689 0110 scsiwspc =ivectors+s_vecspc ;SCSI workspace 02690 ; 02691 BFFF hwstack =mm_io-s_byte ;top of hardware stack 02692 BF00 hwstackb =hwstack-s_hstack ;bottom of hardware stack 02693 BD00 tiabufs =hwstackb-s_tiaspc ;TIA-232 queues 02694 ; 02695 ;================================================================================ 02696 ; 02697 ;KERNEL INDIRECT VECTORS 02698 ; 02699 0100 ivabort =ivectors ;abort interrupt 02700 0102 ivbrk =ivabort+s_ptr ;software interrupt 02701 0104 ivcop =ivbrk+s_ptr ;coprocessor interrupt 02702 0106 ivirq =ivcop+s_ptr ;maskable interrupt 02703 0108 ivnmi =ivirq+s_ptr ;non-maskable interrupt 02704 010A ivscsi =ivnmi+s_ptr ;SCSI driver dispatch 02705 010C ivsparea =ivscsi+s_ptr ;user vector A 02706 010E ivspareb =ivsparea+s_ptr ;user vector B 02707 ; 02708 .end 02709 .include "include_scsi/absolute.asm" 02710 ;================================================================================ 02711 ; 02712 ;ABSOLUTE SCSI WORKSPACE 02713 ; 02714 0110 scdevtab =scsiwspc ;active device table 02715 0150 scmiswrk =scdevtab+s_sd_tab ;temporary workspace 02716 0174 scsimesg =scmiswrk+s_miswrk ;message workspace 02717 ; 02718 .end 02719 .include "include_mon/absolute.asm" 02720 ;================================================================================ 02721 ; 02722 ;MACHINE LANGUAGE MONITOR ABSOLUTE STORAGE 02723 ; 02724 0200 ibuffer =rambot ;input buffer 02725 0246 auxbuf =ibuffer+s_ibuf+1 ;auxiliary buffer 02726 ; 02727 .end 02728 .include "include_boot/boot.asm" 02729 ;================================================================================ 02730 ; 02731 ;SYSTEM BOOT ADDRESSES 02732 ; 02733 0400 bootblk =$000400 ;master boot block 02734 0800 stag2blk =bootblk+s_mboot ;stage 2 boot block 02735 ; 02736 .end 02737 .include "include_kernel/devices.asm" 02738 ;================================================================================ 02739 ; 02740 ;I/O DEVICE SELECTION ADDRESSES 02741 ; 02742 C000 io_a =mm_io ;device A select 02743 C100 io_b =io_a+s_iodev ;device B select 02744 C200 io_c =io_b+s_iodev ;device C select 02745 C300 io_d =io_c+s_iodev ;device D select 02746 C400 io_e =io_d+s_iodev ;device E select 02747 C500 io_f =io_e+s_iodev ;device F select 02748 C600 io_g =io_f+s_iodev ;device G select 02749 C700 io_h =io_g+s_iodev ;device H select 02750 ; 02751 ;================================================================================ 02752 ; 02753 ;I/O DEVICE HARDWARE ASSIGNMENTS 02754 ; 02755 C000 io_sioa =io_a ;DUART #1 02756 C100 io_siob =io_b ;DUART #2 02757 C200 io_sioq =io_c ;vQUART IRQ status 02758 C300 io_rtc =io_d ;RTC 02759 C400 io_scsi =io_e ;SCSI 02760 C500 io_scsid =io_f ;SCSI DMA 02761 C600 io_scsiq =io_g ;SCSI DMA handshake 02762 ; 02763 C000 io_quart =io_sioa ;start of virtual QUART 02764 ; 02765 .end 02766 ;================================================================================ 02767 ; 02768 ;BIOS API JUMP TABLE 02769 ; 02770 00D000 *=mm_rom 02771 ; 02772 00D000 4C D6 D1 jmp getcha ;read from SIO channel A 02773 00D003 4C E0 D1 jmp getchb ;read from SIO channel B 02774 00D006 4C 18 D2 jmp getchc ;read from SIO channel C 02775 00D009 4C 22 D2 jmp getchd ;read from SIO channel D 02776 00D00C 4C 4A D2 jmp putcha ;write to SIO channel A 02777 00D00F 4C 40 D2 jmp putchb ;write to SIO channel B 02778 00D012 4C 36 D2 jmp putchc ;write to SIO channel C 02779 00D015 4C 2C D2 jmp putchd ;write to SIO channel D 02780 00D018 4C BC D2 jmp chanbctl ;disable/enable SIO channel B 02781 00D01B 4C 0E D4 jmp getdtr ;get date & time from RTC 02782 00D01E 4C 8A D2 jmp getnvr ;get data from NVRAM 02783 00D021 4C 5A D4 jmp getuxtim ;get UNIX time 02784 00D024 4C 4B D4 jmp getsutim ;get system up time 02785 00D027 4C 48 D0 jmp hrst ;system reset 02786 00D02A 4C 23 DA jmp mon ;M/L monitor entry 02787 00D02D 4C 09 D6 jmp plot ;position console cursor 02788 00D030 4C 7D D4 jmp putdtr ;write date & time to RTC 02789 00D033 4C A3 D2 jmp putnvr ;write data to NVRAM 02790 00D036 4C 72 D8 jmp scsicmd ;execute SCSI command 02791 00D039 4C FD D9 jmp scsihaid ;get SCSI host adapter bus ID 02792 00D03C 4C 6F D6 jmp scsiinit ;initialize SCSI subsystem 02793 00D03F 4C 29 D8 jmp scsiparm ;get SCSI device parameters 02794 00D042 4C B2 D4 jmp setuxtim ;set UNIX time 02795 00D045 4C D5 D4 jmp utdelay ;generate user-defined time delay 02796 ; 02797 .include "kernel/reset.asm" 02798 ;================================================================================ 02799 ; 02800 ;hrst: SYSTEM RESET & POST 02801 ; 02802 00D048 78 hrst sei ;no IRQs during 1st stage POST 02803 00D049 38 sec ;select 'C02 mode to... 02804 00D04A FB xce ;default MPU state 02805 00D04B 18 clc 02806 00D04C FB xce ;select '816 mode 02807 ; 02808 ; 02809 ; destructively test critical RAM areas... 02810 ; 02811 00D04D A9 5A lda #testpata ;1st test pattern 02812 00D04F A2 00 ldx #0 02813 ; 02814 00D051 95 00 .0000010 sta mm_ram,x ;write direct page 02815 00D053 9D 00 01 sta absolute,x ;write kernel page 02816 00D056 9D 00 BF sta hwstackb,x ;write stack 02817 00D059 E8 inx 02818 00D05A D0 F5 bne .0000010 ;next 02819 ; 02820 00D05C A0 00 ldy #0 02821 ; 02822 00D05E E8 .0000020 inx ;waste time to see if... 02823 00D05F D0 FD bne .0000020 ;RAM holds 02824 ; 02825 00D061 C8 iny 02826 00D062 D0 FA bne .0000020 02827 ; 02828 00D064 D5 00 .0000030 cmp mm_ram,x ;check for proper pattern 02829 00D066 F0 01 beq .0000050 ;we're good so far 02830 ; 02831 00D068 DB .0000040 stp ;fatal, halt MPU... 02832 ; 02833 ; ———————————————————————————————————————————————————————————————— 02834 ; In the event testing fails the only thing that can be done is to 02835 ; halt the MPU. It isn't possible to report anything to the user 02836 ; because I/O isn't operable this early in the testing. 02837 ; ———————————————————————————————————————————————————————————————— 02838 ; 02839 00D069 DD 00 01 .0000050 cmp absolute,x ;check kernel page 02840 00D06C D0 FA bne .0000040 ;error 02841 ; 02842 00D06E DD 00 BF cmp hwstackb,x ;check stack 02843 00D071 D0 F5 bne .0000040 ;error 02844 ; 02845 00D073 E8 inx 02846 00D074 D0 EE bne .0000030 ;next location 02847 ; 02848 00D076 C9 A5 cmp #testpatb ;1st or 2nd test done? 02849 00D078 F0 04 beq .0000060 ;2nd 02850 ; 02851 00D07A A9 A5 lda #testpatb ;2nd test pattern 02852 00D07C 80 D3 bra .0000010 ;run 2nd test 02853 ; 02854 00D07E 74 00 .0000060 stz mm_ram,x ;clear direct page 02855 00D080 9E 00 01 stz absolute,x ;clear vector page 02856 00D083 E8 inx 02857 00D084 D0 F8 bne .0000060 02858 ; 02859 ; 02860 ; set up stack & indirect vectors... 02861 ; 02862 longa 02863 00D086 C2 20 rep #%00100000 02864 00D088 A9 FF BF lda !#hwstack ;top of stack 02865 00D08B 1B tcs ;set it 02866 shorta 02867 00D08C E2 20 sep #%00100000 02868 00D08E A2 09 ldx #s_vectab-1 ;vector table size 02869 ; 02870 00D090 BD E9 E9 .0000065 lda ivectab,x ;copy vectors 02871 00D093 9D 00 01 sta ivectors,x 02872 00D096 CA dex 02873 00D097 10 F7 bpl .0000065 02874 ; 02875 ; 02876 ; set up TIA-232 DP pointer array... 02877 ; 02878 00D099 A2 37 ldx #tiaipend-tiaiptab-1 02879 ; 02880 00D09B BD 03 EA .0000070 lda tiaiptab,x ;copy data table to... 02881 00D09E 95 10 sta tiazpptr,x ;DP pointer array 02882 00D0A0 CA dex 02883 00D0A1 10 F8 bpl .0000070 02884 ; 02885 ; 02886 ; configure RTC... 02887 ; 02888 00D0A3 A0 0A ldy #s_d11tab-s_word ;RTC setup table index 02889 ; 02890 00D0A5 BE 3B EA .0000080 ldx d11tab,y ;get register 02891 00D0A8 B9 3C EA lda d11tab+s_byte,y ;get parameter 02892 00D0AB 9D 00 C3 sta io_rtc,x ;write to register 02893 decy s_word 02894 .if .n 02895 .rept .n 02896 00D0AE 88 dey 02897 00D0AF 88 dey 02898 .else 02899 00D0B0 10 F3 bpl .0000080 ;next 02900 ; 02901 00D0B2 AD 05 C3 lda io_rtc+wr_mon ;ensure that RTC... 02902 00D0B5 29 1F and #dlleomsk ;oscillator is running 02903 00D0B7 09 40 ora #d11sqmsk ;also disable... 02904 00D0B9 8D 05 C3 sta io_rtc+wr_mon ;square wave output 02905 ; 02906 ; 02907 ; configure DUARTs... 02908 ; 02909 00D0BC A0 3C ldy #s_nxptab-s_word ;main setup table index 02910 ; 02911 00D0BE BE 63 EA .0000090 ldx nxpsutab,y ;get register 02912 00D0C1 B9 64 EA lda nxpsutab+s_byte,y ;get parameter 02913 00D0C4 9D 00 C0 sta io_sioa,x ;write to DUART #1 02914 00D0C7 9D 00 C1 sta io_siob,x ;write to DUART #2 02915 decy s_word 02916 .if .n 02917 .rept .n 02918 00D0CA 88 dey 02919 00D0CB 88 dey 02920 .else 02921 00D0CC 10 F0 bpl .0000090 ;next register 02922 ; 02923 00D0CE A0 04 ldy #s_nxptax-s_word ;auxiliary setup table index 02924 ; 02925 00D0D0 BE A1 EA .0000100 ldx nxpsxtab,y ;register 02926 00D0D3 B9 A2 EA lda nxpsxtab+s_byte,y ;parameter 02927 00D0D6 9D 00 C0 sta io_sioa,x ;write to register 02928 decy s_word 02929 .if .n 02930 .rept .n 02931 00D0D9 88 dey 02932 00D0DA 88 dey 02933 .else 02934 00D0DB 10 F3 bpl .0000100 ;next register 02935 ; 02936 00D0DD A9 33 lda #nxpairq|nxpbirq ;enable DUART #2... 02937 00D0DF 8D 05 C1 sta io_siob+nx_imr ;channel IRQs 02938 ; 02939 ; 02940 ; prepare for POST... 02941 ; 02942 00D0E2 A9 64 lda #hz ;initialize... 02943 00D0E4 85 05 sta jiffct ;jiffy IRQ counter 02944 00D0E6 AD 0E C0 lda io_quart+nx_scta ;start... 02945 00D0E9 58 cli ;jiffy IRQs 02946 00D0EA CB wai ;wait for 1st IRQ &... 02947 printf si_tmint ;initialize console 02948 00D0EB F4 CE EE pea #.s 02949 00D0EE 20 35 D6 jsr sprint 02950 00D0F1 20 CE D4 jsr td2sec ;recovery time 02951 ; 02952 ; 02953 ; display POST banner... 02954 ; 02955 drawrect postxdim,postydim,postrecx,postrecy 02956 pushparm .w,.h,.c,.r 02957 .if @0 02958 0000 .i .set 0 02959 .rept @0 02960 0001 .i .= .i+1 02961 00D0F4 F4 29 00 pea #@.i 02962 0002 .i .= .i+1 02963 00D0F7 F4 08 00 pea #@.i 02964 0003 .i .= .i+1 02965 00D0FA F4 00 00 pea #@.i 02966 0004 .i .= .i+1 02967 00D0FD F4 00 00 pea #@.i 02968 .else 02969 00D100 20 02 D5 jsr drawrect 02970 plot postsepx,postsepy 02971 00D103 A2 00 ldx #.c 02972 00D105 A0 04 ldy #.r 02973 00D107 20 09 D6 jsr plot 02974 printf dc_g6 ;print left tee 02975 00D10A F4 7E EE pea #.s 02976 00D10D 20 35 D6 jsr sprint 02977 drawhlin psghllen 02978 00D110 E2 20 sep #%00100000 02979 00D112 A9 27 lda #.l 02980 00D114 20 AF D5 jsr linehg 02981 printf dc_g7 ;print right tee 02982 00D117 F4 86 EE pea #.s 02983 00D11A 20 35 D6 jsr sprint 02984 printf si_bannr ;"POC SBC..." 02985 00D11D F4 EA EE pea #.s 02986 00D120 20 35 D6 jsr sprint 02987 00D123 20 CE D4 jsr td2sec 02988 ; 02989 ; 02990 ; non-destructively size RAM... 02991 ; 02992 printf si_memt ;"Sizing Memory..." 02993 00D126 F4 E4 EF pea #.s 02994 00D129 20 35 D6 jsr sprint 02995 longx ;use 16 bit index 02996 00D12C C2 10 rep #%00010000 02997 00D12E A2 00 02 ldx !#rambot ;start of page 2 02998 ; 02999 00D131 B5 00 hrst01 lda mm_ram,x ;get byte &... 03000 00D133 EB xba ;protect it 03001 00D134 A9 5A lda #testpata ;1st test pattern 03002 00D136 95 00 sta mm_ram,x ;write it 03003 .rept 10 ;decay time 03004 00D138 EA nop 03005 00D139 EA nop 03006 00D13A EA nop 03007 00D13B EA nop 03008 00D13C EA nop 03009 00D13D EA nop 03010 00D13E EA nop 03011 00D13F EA nop 03012 00D140 EA nop 03013 00D141 EA nop 03014 00D142 D5 00 cmp mm_ram,x ;check location 03015 00D144 D0 59 bne hrst05 ;failed 03016 ; 03017 00D146 A9 A5 lda #testpatb ;2nd test pattern 03018 00D148 95 00 sta mm_ram,x 03019 .rept 10 ;decay time 03020 00D14A EA nop 03021 00D14B EA nop 03022 00D14C EA nop 03023 00D14D EA nop 03024 00D14E EA nop 03025 00D14F EA nop 03026 00D150 EA nop 03027 00D151 EA nop 03028 00D152 EA nop 03029 00D153 EA nop 03030 00D154 D5 00 cmp mm_ram,x 03031 00D156 D0 47 bne hrst05 ;failed 03032 ; 03033 00D158 EB xba ;recover & restore... 03034 00D159 95 00 sta mm_ram,x ;old content 03035 .rept 10 ;decay time 03036 00D15B EA nop 03037 00D15C EA nop 03038 00D15D EA nop 03039 00D15E EA nop 03040 00D15F EA nop 03041 00D160 EA nop 03042 00D161 EA nop 03043 00D162 EA nop 03044 00D163 EA nop 03045 00D164 EA nop 03046 00D165 D5 00 cmp mm_ram,x ;verify 03047 00D167 D0 36 bne hrst05 ;failed 03048 ; 03049 00D169 E8 inx ;next location 03050 00D16A 8A txa ;test LSB of next location 03051 00D16B D0 03 bne .0000010 ;not time to update POST 03052 ; 03053 00D16D 20 5F E7 jsr dpyramct ;update RAM count 03054 ; 03055 00D170 E0 00 BF .0000010 cpx #hwstackb ;reach bottom of stack? 03056 00D173 90 BC bcc hrst01 ;no, keep testing 03057 ; 03058 00D175 A2 00 C0 ldx !#mm_io ;include MPU stack in... 03059 00D178 20 5F E7 jsr dpyramct ;final RAM count, since... 03060 shortr ;it was already tested 03061 00D17B E2 30 sep #%00110000 03062 00D17D 20 CE D4 jsr td2sec 03063 printf si_clver ;clear version row 03064 00D180 F4 D9 EF pea #.s 03065 00D183 20 35 D6 jsr sprint 03066 ; 03067 ; 03068 ; configure SCSI subsystem & attempt ISL... 03069 ; 03070 00D186 20 6F D6 jsr scsiinit ;configure SCSI subsystem 03071 00D189 B0 11 bcs hrst04 ;host adapter unresponsive 03072 ; 03073 00D18B 20 A7 D5 jsr scsihdrd ;display enumeration header 03074 00D18E 20 CE D4 jsr td2sec 03075 00D191 20 D7 D6 jsr scsienum ;enumerate devices 03076 00D194 90 17 bcc isl ;ready, attempt ISL 03077 ; 03078 00D196 F4 67 F0 hrst02 pea #sd_nodev ;"no SCSI devices..." 03079 ; 03080 00D199 20 35 D6 hrst03 jsr sprint ;print status messages 03081 ; 03082 00D19C 4C 23 DA hrst04 jmp mon ;start up M/L monitor 03083 ; 03084 ; 03085 ; memory test error... 03086 ; 03087 00D19F 20 5F E7 hrst05 jsr dpyramct ;try to display error point... 03088 shortr 03089 00D1A2 E2 30 sep #%00110000 03090 printf si_ramer ;"Sizing Error..." 03091 00D1A4 F4 16 F0 pea #.s 03092 00D1A7 20 35 D6 jsr sprint 03093 ; 03094 00D1AA CB .0000010 wai 03095 00D1AB 80 FD bra .0000010 ;loop MPU forever 03096 ; 03097 ;================================================================================ 03098 ; 03099 ;INITIAL SYSTEM LOAD 03100 ; 03101 00D1AD 20 CE D4 isl jsr td2sec 03102 shorta 03103 00D1B0 E2 20 sep #%00100000 03104 longx 03105 00D1B2 C2 10 rep #%00010000 03106 00D1B4 A9 00 lda #bootsid ;default boot device... 03107 ; 03108 ; —————————————————————————————————————————————————————— 03109 ; Eventually we'll use the boot device defined in NVRAM. 03110 ; —————————————————————————————————————————————————————— 03111 ; 03112 00D1B6 A2 99 E9 ldx !#cdblkget ;CDB address 03113 00D1B9 A0 00 04 ldy !#bootblk ;boot block buffer 03114 00D1BC 20 72 D8 jsr scsicmd ;get boot block 03115 00D1BF B0 DB bcs hrst04 ;error, go to monitor 03116 ; 03117 ; 03118 ; check MBR for validity... 03119 ; 03120 00D1C1 A2 03 ldx #s_islmag-1 ;magic number size 03121 ; 03122 00D1C3 BD 02 04 .0000010 lda bootblk+mb_magic,x;MBR magic number 03123 00D1C6 DD A7 EA cmp magicisl,x ;BIOS magic number 03124 00D1C9 D0 06 bne .0000020 ;no match, abort ISL 03125 ; 03126 00D1CB CA dex 03127 00D1CC 10 F5 bpl .0000010 ;next 03128 ; 03129 00D1CE 6C 00 04 jmp (bootblk) ;run master boot code 03130 ; 03131 00D1D1 F4 00 F0 .0000020 pea #si_noos ;"disk not bootable" 03132 00D1D4 80 C3 bra hrst03 ;abort ISL attempt 03133 ; 03134 .end 03135 .include "kernel/primitive.asm" 03136 ;================================================================================ 03137 ; 03138 ;getcha: GET DATUM FROM TIA-232 CHANNEL A 03139 ; 03140 ; —————————————————————————————————————————— 03141 ; Preparatory Ops: NONE 03142 ; 03143 ; Returned Values: .A: datum or entry value 03144 ; .B: entry value 03145 ; .X: entry value 03146 ; .Y: entry value 03147 ; 03148 ; MPU Flags: NVmxDIZC 03149 ; |||||||| 03150 ; |||||||+———> 0: datum available 03151 ; ||||||| 1: no datum 03152 ; ||||||+————> entry value 03153 ; |||||+—————> 0 03154 ; |||++——————> entry value 03155 ; ||+————————> 1 03156 ; ++—————————> entry value 03157 ; 03158 ; Example: JSR GETCHA 03159 ; BCS NODATUM 03160 ; STA DATUM 03161 ; —————————————————————————————————————————— 03162 ; 03163 00D1D6 18 getcha clc ;assume datum is available 03164 00D1D7 08 php ;save MPU state 03165 longr ;16 bit registers 03166 00D1D8 C2 30 rep #%00110000 03167 00D1DA DA phx ;save 03168 00D1DB A2 00 00 ldx !#nxpchana ;channel index 03169 00D1DE 80 08 bra getchcom ;goto common function 03170 ; 03171 ;================================================================================ 03172 ; 03173 ;getchb: GET DATUM FROM TIA-232 CHANNEL B 03174 ; 03175 ; —————————————————————————————————————————— 03176 ; Preparatory Ops: NONE 03177 ; 03178 ; Returned Values: .A: datum or entry value 03179 ; .B: entry value 03180 ; .X: entry value 03181 ; .Y: entry value 03182 ; 03183 ; MPU Flags: NVmxDIZC 03184 ; |||||||| 03185 ; |||||||+———> 0: datum available 03186 ; ||||||| 1: no datum 03187 ; ||||||+————> entry value 03188 ; |||||+—————> 0 03189 ; |||++——————> entry value 03190 ; ||+————————> 1 03191 ; ++—————————> entry value 03192 ; 03193 ; Example: JSR GETCHB 03194 ; BCS NODATUM 03195 ; STA DATUM 03196 ; —————————————————————————————————————————— 03197 ; 03198 00D1E0 18 getchb clc ;assume datum is available 03199 00D1E1 08 php ;save MPU state 03200 longr 03201 00D1E2 C2 30 rep #%00110000 03202 00D1E4 DA phx ;save 03203 00D1E5 A2 01 00 ldx !#nxpchanb ;channel B index 03204 ; 03205 ;================================================================================ 03206 ; 03207 ;getchcom: GET DATUM FROM TIA-232 CHANNEL (common code) 03208 ; 03209 ; ———————————————————————————————————————————————————————————————————————— 03210 ; Do not directly call this function, as the stack will become unbalanced. 03211 ; Only use the GETCHx functions, where x is the channel ID. 03212 ; ———————————————————————————————————————————————————————————————————————— 03213 ; 03214 00D1E8 5A getchcom phy 03215 00D1E9 48 pha 03216 00D1EA 0B phd 03217 ; 03218 ;——————————————————————————————— 03219 0001 .dpreg =1 ;DP 03220 0003 .areg =.dpreg+s_mpudpx ;.C 03221 0005 .yreg =.areg+s_word ;.Y 03222 0007 .xreg =.yreg+s_word ;.X 03223 0009 .sreg =.xreg+s_word ;SR 03224 ;——————————————————————————————— 03225 ; 03226 00D1EB F4 00 00 pea #kerneldp 03227 00D1EE 2B pld ;set kernel direct page 03228 shortr 03229 00D1EF E2 30 sep #%00110000 03230 00D1F1 8A txa ;channel index... 03231 00D1F2 0A asl ;becomes... 03232 00D1F3 AA tax ;channel offset 03233 00D1F4 B5 28 lda tiagetrx,x ;RxQ 'get' pointer 03234 00D1F6 D5 30 cmp tiaputrx,x ;RxQ 'put' pointer 03235 00D1F8 F0 16 beq .nodata ;RxQ is empty 03236 ; 03237 00D1FA A8 tay ;save 'get' pointer 03238 00D1FB A1 28 lda (tiagetrx,x) ;get oldest datum &... 03239 00D1FD 83 03 sta .areg,s ;return to caller 03240 00D1FF 98 tya ;recover 'get' pointer 03241 00D200 1A inc ;bump it &... 03242 00D201 29 3F and #m_tiaptr ;mask to queue size 03243 00D203 1D FB E9 ora tiaqpmsk,x ;align to queue base addr 03244 00D206 95 28 sta tiagetrx,x ;save new pointer 03245 ; 03246 .done longr 03247 00D208 C2 30 rep #%00110000 03248 00D20A 2B pld ;restore MPU state 03249 00D20B 68 pla 03250 00D20C 7A ply 03251 00D20D FA plx 03252 00D20E 28 plp 03253 00D20F 60 rts 03254 ; 03255 00D210 A3 09 .nodata lda .sreg,s ;SR stack copy 03256 00D212 09 01 ora #sr_car ;set carry &... 03257 00D214 83 09 sta .sreg,s ;rewrite 03258 00D216 80 F0 bra .done 03259 ; 03260 ;================================================================================ 03261 ; 03262 ;getchc: GET DATUM FROM TIA-232 CHANNEL C 03263 ; 03264 ; —————————————————————————————————————————— 03265 ; Preparatory Ops: NONE 03266 ; 03267 ; Returned Values: .A: datum or entry value 03268 ; .B: entry value 03269 ; .X: entry value 03270 ; .Y: entry value 03271 ; 03272 ; MPU Flags: NVmxDIZC 03273 ; |||||||| 03274 ; |||||||+———> 0: datum available 03275 ; ||||||| 1: no datum 03276 ; ||||||+————> entry value 03277 ; |||||+—————> 0 03278 ; |||++——————> entry value 03279 ; ||+————————> 1 03280 ; ++—————————> entry value 03281 ; 03282 ; Example: JSR GETCHC 03283 ; BCS NODATUM 03284 ; STA DATUM 03285 ; —————————————————————————————————————————— 03286 ; 03287 00D218 18 getchc clc ;assume datum is available 03288 00D219 08 php ;save MPU state 03289 longr ;16 bit registers 03290 00D21A C2 30 rep #%00110000 03291 00D21C DA phx ;save 03292 00D21D A2 02 00 ldx !#nxpchanc ;channel index 03293 00D220 80 C6 bra getchcom ;goto common function 03294 ; 03295 ;================================================================================ 03296 ; 03297 ;getchd: GET DATUM FROM TIA-232 CHANNEL D 03298 ; 03299 ; —————————————————————————————————————————— 03300 ; Preparatory Ops: NONE 03301 ; 03302 ; Returned Values: .A: datum or entry value 03303 ; .B: entry value 03304 ; .X: entry value 03305 ; .Y: entry value 03306 ; 03307 ; MPU Flags: NVmxDIZC 03308 ; |||||||| 03309 ; |||||||+———> 0: datum available 03310 ; ||||||| 1: no datum 03311 ; ||||||+————> entry value 03312 ; |||||+—————> 0 03313 ; |||++——————> entry value 03314 ; ||+————————> 1 03315 ; ++—————————> entry value 03316 ; 03317 ; Example: JSR GETCHD 03318 ; BCS NODATUM 03319 ; STA DATUM 03320 ; —————————————————————————————————————————— 03321 ; 03322 00D222 18 getchd clc ;assume datum is available 03323 00D223 08 php ;save MPU state 03324 longr ;16 bit registers 03325 00D224 C2 30 rep #%00110000 03326 00D226 DA phx ;save 03327 00D227 A2 03 00 ldx !#nxpchand ;channel index 03328 00D22A 80 BC bra getchcom ;goto common function 03329 ; 03330 ;================================================================================ 03331 ; 03332 ;putchd: WRITE DATUM TO TIA-232 CHANNEL D 03333 ; 03334 ; ————————————————————————————————————————————————————————— 03335 ; Preparatory Ops: .A: 8 bit datum 03336 ; 03337 ; Returned Values: .A: entry value 03338 ; .B: entry value 03339 ; .X: entry value 03340 ; .Y: entry value 03341 ; 03342 ; MPU Flags: NVmxDIZC 03343 ; |||||||| 03344 ; |||||||+———> 0 03345 ; ||||||+————> entry value 03346 ; |||||+—————> 0 03347 ; +++++——————> entry values 03348 ; 03349 ; Example: LDA #$41 03350 ; JSR PUTCHD 03351 ; 03352 ; Notes: 1) This function will block if the CFIFO is full. 03353 ; ————————————————————————————————————————————————————————— 03354 ; 03355 00D22C 58 putchd cli ;IRQs must be enabled 03356 00D22D 08 php ;save MPU state 03357 longr ;16 bit registers 03358 00D22E C2 30 rep #%00110000 03359 00D230 DA phx ;save 03360 00D231 A2 03 00 ldx !#nxpchand ;channel D index 03361 00D234 80 1C bra putchcom 03362 ; 03363 ;================================================================================ 03364 ; 03365 ;putchc: WRITE DATUM TO TIA-232 CHANNEL C 03366 ; 03367 ; ————————————————————————————————————————————————————————— 03368 ; Preparatory Ops: .A: 8 bit datum 03369 ; 03370 ; Returned Values: .A: entry value 03371 ; .B: entry value 03372 ; .X: entry value 03373 ; .Y: entry value 03374 ; 03375 ; MPU Flags: NVmxDIZC 03376 ; |||||||| 03377 ; |||||||+———> 0 03378 ; ||||||+————> entry value 03379 ; |||||+—————> 0 03380 ; +++++——————> entry values 03381 ; 03382 ; Example: LDA #$41 03383 ; JSR PUTCHC 03384 ; 03385 ; Notes: 1) This function will block if the CFIFO is full. 03386 ; ————————————————————————————————————————————————————————— 03387 ; 03388 00D236 58 putchc cli ;IRQs must be enabled 03389 00D237 08 php ;save MPU state 03390 longr ;16 bit registers 03391 00D238 C2 30 rep #%00110000 03392 00D23A DA phx ;save 03393 00D23B A2 02 00 ldx !#nxpchanc ;channel C index 03394 00D23E 80 12 bra putchcom 03395 ; 03396 ;================================================================================ 03397 ; 03398 ;putchb: WRITE DATUM TO TIA-232 CHANNEL B 03399 ; 03400 ; ————————————————————————————————————————————————————————— 03401 ; Preparatory Ops: .A: 8 bit datum 03402 ; 03403 ; Returned Values: .A: entry value 03404 ; .B: entry value 03405 ; .X: entry value 03406 ; .Y: entry value 03407 ; 03408 ; MPU Flags: NVmxDIZC 03409 ; |||||||| 03410 ; |||||||+———> 0 03411 ; ||||||+————> entry value 03412 ; |||||+—————> 0 03413 ; +++++——————> entry values 03414 ; 03415 ; Example: LDA #$41 03416 ; JSR PUTCHB 03417 ; 03418 ; Notes: 1) This function will block if the CFIFO is full. 03419 ; ————————————————————————————————————————————————————————— 03420 ; 03421 00D240 58 putchb cli ;IRQs must be enabled 03422 00D241 08 php ;save MPU state 03423 longr ;16 bit registers 03424 00D242 C2 30 rep #%00110000 03425 00D244 DA phx ;save 03426 00D245 A2 01 00 ldx !#nxpchanb ;channel B index 03427 00D248 80 08 bra putchcom 03428 ; 03429 ;================================================================================ 03430 ; 03431 ;putcha: WRITE DATUM TO TIA-232 CHANNEL A 03432 ; 03433 ; ————————————————————————————————————————————————————————— 03434 ; Preparatory Ops: .A: 8 bit datum 03435 ; 03436 ; Returned Values: .A: entry value 03437 ; .B: entry value 03438 ; .X: entry value 03439 ; .Y: entry value 03440 ; 03441 ; MPU Flags: NVmxDIZC 03442 ; |||||||| 03443 ; |||||||+———> 0 03444 ; ||||||+————> entry value 03445 ; |||||+—————> 0 03446 ; +++++——————> entry values 03447 ; 03448 ; Example: LDA #$41 03449 ; JSR PUTCHA 03450 ; 03451 ; Notes: 1) This function will block if the CFIFO is full. 03452 ; ————————————————————————————————————————————————————————— 03453 ; 03454 00D24A 58 putcha cli ;IRQs must be enabled 03455 00D24B 08 php ;save MPU state 03456 longr ;16 bit registers 03457 00D24C C2 30 rep #%00110000 03458 00D24E DA phx ;save 03459 00D24F A2 00 00 ldx !#nxpchana ;channel A index 03460 ; 03461 ;================================================================================ 03462 ; 03463 ;putchcom: WRITE DATUM TO TIA-232 CHANNEL (common code) 03464 ; 03465 ; ———————————————————————————————————————————————————————————————————————— 03466 ; Do not directly call this function, as the stack will become unbalanced. 03467 ; Only use the PUTCHx functions, where x is the comm port ID. 03468 ; ———————————————————————————————————————————————————————————————————————— 03469 ; 03470 00D252 5A putchcom phy ;preserve... 03471 00D253 48 pha ;remaining registers 03472 00D254 0B phd 03473 ; 03474 ;——————————————————————————————— 03475 0001 .dpreg =1 ;DP 03476 0003 .areg =.dpreg+s_mpudpx ;.C 03477 0005 .yreg =.areg+s_word ;.Y 03478 0007 .xreg =.yreg+s_word ;.X 03479 0009 .sreg =.xreg+s_word ;SR 03480 ;——————————————————————————————— 03481 ; 03482 00D255 F4 00 00 pea #kerneldp 03483 00D258 2B pld ;set kernel direct page 03484 00D259 8A txa ;get channel index 03485 00D25A 0A asl ;becomes... 03486 00D25B AA tax ;channel offset 03487 shortr 03488 00D25C E2 30 sep #%00110000 03489 00D25E B5 40 lda tiaputtx,x ;TxQ "put" index 03490 00D260 1A inc ;bump it &... 03491 00D261 29 3F and #m_tiaptr ;mask to queue size 03492 00D263 1D FB E9 ora tiaqpmsk,x ;align to queue base addr 03493 ; 03494 00D266 D5 38 .main cmp tiagettx,x ;room in TxQ? 03495 00D268 F0 1D beq .fifoful ;no, wait 03496 ; 03497 00D26A A8 tay ;save queue pointer 03498 00D26B A3 03 lda .areg,s ;get datum &... 03499 00D26D 81 40 sta (tiaputtx,x) ;put in queue 03500 00D26F 94 40 sty tiaputtx,x ;save new queue pointer 03501 00D271 BD F3 E9 lda tiatstab,x ;channel's TxD status mask 03502 00D274 14 48 trb tiatxst ;transmitter running? 03503 00D276 D0 09 bne .enabltx ;no, enable it 03504 ; 03505 .done longr 03506 00D278 C2 30 rep #%00110000 03507 00D27A 2B pld ;restore MPU status 03508 00D27B 68 pla 03509 00D27C 7A ply 03510 00D27D FA plx 03511 00D27E 28 plp 03512 00D27F 18 clc 03513 00D280 60 rts 03514 ; 03515 ; 03516 ; enable transmitter... 03517 ; 03518 00D281 A9 04 .enabltx lda #nxpcrtxe 03519 00D283 81 18 sta (tiacr,x) 03520 00D285 80 F1 bra .done 03521 ; 03522 ; 03523 ; block for TxQ space... 03524 ; 03525 00D287 CB .fifoful wai ;sleep &... 03526 00D288 80 DC bra .main ;try again 03527 ; 03528 ;================================================================================ 03529 ; 03530 ;getnvr: GET DATA FROM NVRAM 03531 ; 03532 ; ——————————————————————————————————————————————————— 03533 ; Preparatory Ops: .A: number of bytes to get (0=256) 03534 ; .X: storage location LSB 03535 ; .Y: storage location MSB 03536 ; 03537 ; Returned Values: entry values 03538 ; 03539 ; MPU Flags: NVmxDIZC 03540 ; |||||||| 03541 ; ++++++++———> not defined 03542 ; 03543 ; Example: lda #20 ;bytes to get 03544 ; ldx #buf ;storage MSB 03546 ; jsr getnvr 03547 ; ——————————————————————————————————————————————————— 03548 ; 03549 getnvr shortr 03550 00D28A E2 30 sep #%00110000 03551 00D28C 48 pha 03552 00D28D 5A phy 03553 00D28E DA phx 03554 ; 03555 ;——————————————————————————————— 03556 0001 .dest .= 1 ;destination address 03557 ;——————————————————————————————— 03558 ; 03559 00D28F AA tax ;bytes to fetch 03560 00D290 20 CA D2 jsr setautoi ;set up autoincrement 03561 00D293 A0 00 ldy #0 03562 00D295 8C 10 C3 sty io_rtc+wr_nvra ;set starting address 03563 ; 03564 00D298 AD 13 C3 .0000010 lda io_rtc+wr_nvrd ;fetch from RTC NVRAM 03565 00D29B 93 01 sta (.dest,s),y ;store in RAM 03566 00D29D C8 iny 03567 00D29E CA dex 03568 00D29F D0 F7 bne .0000010 03569 ; 03570 00D2A1 80 15 bra putnvraa ;done 03571 ; 03572 ;================================================================================ 03573 ; 03574 ;putnvr: PUT DATA IN NVRAM 03575 ; 03576 ; ——————————————————————————————————————————————————— 03577 ; Preparatory Ops: .A: number of bytes to put (0=256) 03578 ; .X: source location LSB 03579 ; .Y: source location MSB 03580 ; 03581 ; Returned Values: entry values 03582 ; 03583 ; MPU Flags: NVmxDIZC 03584 ; |||||||| 03585 ; ++++++++———> not defined 03586 ; 03587 ; Calling Example: lda #20 ;bytes to store 03588 ; ldx #buf ;source MSB 03590 ; jsr putnvr 03591 ; ——————————————————————————————————————————————————— 03592 ; 03593 00D2A3 48 putnvr pha 03594 00D2A4 5A phy 03595 00D2A5 DA phx 03596 ; 03597 ;——————————————————————————————— 03598 0001 .src =1 03599 ;——————————————————————————————— 03600 ; 03601 00D2A6 AA tax ;bytes to store 03602 00D2A7 20 CA D2 jsr setautoi ;set up autoincrement 03603 00D2AA A0 00 ldy #0 03604 00D2AC 8C 10 C3 sty io_rtc+wr_nvra ;set starting address 03605 ; 03606 00D2AF B3 01 .0000010 lda (.src,s),y ;fetch from RAM 03607 00D2B1 8D 13 C3 sta io_rtc+wr_nvrd ;store in RTC NVRAM 03608 00D2B4 C8 iny 03609 00D2B5 CA dex 03610 00D2B6 D0 F7 bne .0000010 03611 ; 03612 00D2B8 FA putnvraa plx 03613 00D2B9 7A ply 03614 00D2BA 68 pla 03615 00D2BB 60 rts 03616 ; 03617 ;================================================================================ 03618 ; 03619 ;chanbctl: TIA-232 CHANNEL B RECEIVER CONTROL 03620 ; 03621 ; —————————————————————————————————————————————— 03622 ; Preparatory Ops : see programming example 03623 ; 03624 ; Register Returns: .A: used 03625 ; .B: entry value 03626 ; .X: entry value 03627 ; .Y: entry value 03628 ; DB: entry value 03629 ; DP: entry value 03630 ; PB: entry value 03631 ; 03632 ; MPU Flags: NVmxDIZC 03633 ; |||||||| 03634 ; |||||||+———> entry value 03635 ; ||||||+————> 0 03636 ; |||+++—————> entry values 03637 ; ||+————————> 1 03638 ; |+—————————> entry value 03639 ; +——————————> undefined 03640 ; 03641 ; Examples: clc ;disable 03642 ; jsr chanbctl 03643 ; 03644 ; sec ;enable 03645 ; jsr chanbctl 03646 ; —————————————————————————————————————————————— 03647 ; 03648 chanbctl shorta 03649 00D2BC E2 20 sep #%00100000 03650 00D2BE 90 03 bcc disabchb ;disable 03651 ; 03652 ;================================================================================ 03653 ; 03654 ;enabchb: ENABLE DUART CHANNEL B RECEIVER 03655 ; 03656 00D2C0 A9 81 enabchb lda #nxpcrrsa|nxpcrrxe ;assert RTS & enable RxD 03657 .byte bitabs 03658 ; 03659 ;================================================================================ 03660 ; 03661 ;disabchb: DISABLE DUART CHANNEL B RECEIVER 03662 ; 03663 00D2C3 A9 92 disabchb lda #nxpcrrsd|nxpcrrxd;disable RxD & deassert RTS 03664 ; 03665 ;================================================================================ 03666 ; 03667 ;chbctl: DUART CHANNEL B CONTROL 03668 ; 03669 00D2C5 8D 0A C0 chbctl sta io_quart+nx_crb ;write to command register 03670 00D2C8 CB wai 03671 00D2C9 60 rts 03672 ; 03673 ;================================================================================ 03674 ; 03675 ;setautoi: SET UP RTC NVRAM AUTOINCREMENT 03676 ; 03677 00D2CA A9 20 setautoi lda #d11aimsk 03678 00D2CC 0C 0F C3 tsb io_rtc+wr_crb ;enable NVRAM autoincrement 03679 00D2CF 60 rts 03680 ; 03681 .end 03682 .include "kernel/interrupt.asm" 03683 ;================================================================================ 03684 ; 03685 ;iabort: ABORT INTERRUPT SERVICE ROUTINE 03686 ; 03687 iabort longr ;16 bit registers 03688 00D2D0 C2 30 rep #%00110000 03689 00D2D2 8B phb ;save DB 03690 00D2D3 0B phd ;save DP 03691 00D2D4 48 pha 03692 00D2D5 DA phx 03693 00D2D6 5A phy 03694 ; 03695 ;——————————————————————————————— 03696 ;ABORT REGISTER STACK FRAME 03697 ; 03698 0001 abt_yrx =1 ;.Y 03699 0003 abt_xrx =abt_yrx+s_word ;.X 03700 0005 abt_arx =abt_xrx+s_word ;.C 03701 0007 abt_dpx =abt_arx+s_word ;DP 03702 0009 abt_dbx =abt_dpx+s_mpudpx ;DB 03703 000A abt_srx =abt_dbx+s_mpudbx ;SR 03704 000B abt_pcx =abt_srx+s_mpusrx ;PC 03705 000D abt_pbx =abt_pcx+s_mpupcx ;PB 03706 ;——————————————————————————————— 03707 ; 03708 00D2D7 6C 00 01 jmp (ivabort) ;abort indirect vector... 03709 ; 03710 ; ———————————————————————————————————————————————————————————————————————— 03711 ; Unless the IVABORT vector is modified to point elsewhere routing will be 03712 ; to the CRTI common interrupt return. 03713 ; ———————————————————————————————————————————————————————————————————————— 03714 ; 03715 ;================================================================================ 03716 ; 03717 ;ibrk: SOFTWARE INTERRUPT REQUEST SERVICE ROUTINE 03718 ; 03719 ibrk longr ;16 bit registers 03720 00D2DA C2 30 rep #%00110000 03721 00D2DC 8B phb ;save DB 03722 00D2DD 0B phd ;save DP 03723 00D2DE 48 pha 03724 00D2DF DA phx 03725 00D2E0 5A phy 03726 ; 03727 ;——————————————————————————————— 03728 ;BRK REGISTER STACK FRAME 03729 ; 03730 0001 brk_yrx =1 ;.Y 03731 0003 brk_xrx =brk_yrx+s_word ;.X 03732 0005 brk_arx =brk_xrx+s_word ;.A 03733 0007 brk_dpx =brk_arx+s_word ;DP 03734 0009 brk_dbx =brk_dpx+s_mpudpx ;DB 03735 000A brk_srx =brk_dbx+s_mpudbx ;SR 03736 000B brk_pcx =brk_srx+s_mpusrx ;PC 03737 000D brk_pbx =brk_pcx+s_mpupcx ;PB 03738 ;——————————————————————————————— 03739 ; 03740 00D2E1 6C 02 01 jmp (ivbrk) ;BRK indirect vector 03741 ; 03742 ; ——————————————————————————————————————————————————————— 03743 ; IVBRK points to the BRK entry point of the M/L monitor. 03744 ; ——————————————————————————————————————————————————————— 03745 ; 03746 ;================================================================================ 03747 ; 03748 ;icop: COPROCESSOR INTERRUPT SERVICE ROUTINE 03749 ; 03750 icop longr ;16 bit registers 03751 00D2E4 C2 30 rep #%00110000 03752 00D2E6 8B phb ;save DB 03753 00D2E7 0B phd ;save DP 03754 00D2E8 48 pha 03755 00D2E9 DA phx 03756 00D2EA 5A phy 03757 ; 03758 ;——————————————————————————————— 03759 ;COP REGISTER STACK FRAME 03760 ; 03761 0001 cop_yrx =1 ;.Y 03762 0003 cop_xrx =cop_yrx+s_word ;.X 03763 0005 cop_arx =cop_xrx+s_word ;.A 03764 0007 cop_dpx =cop_arx+s_word ;DP 03765 0009 cop_dbx =cop_dpx+s_mpudpx ;DB 03766 000A cop_srx =cop_dbx+s_mpudbx ;SR 03767 000B cop_pcx =cop_srx+s_mpusrx ;PC 03768 000D cop_pbx =cop_pcx+s_mpupcx ;PB 03769 ;——————————————————————————————— 03770 ; 03771 00D2EB 6C 04 01 jmp (ivcop) ;COP indirect vector... 03772 ; 03773 ; ——————————————————————————————————————————————————————— 03774 ; IVCOP points to the BRK entry point of the M/L monitor. 03775 ; ——————————————————————————————————————————————————————— 03776 ; 03777 ;================================================================================ 03778 ; 03779 ;iirq: HARDWARE INTERRUPT REQUEST SERVICE ROUTINE 03780 ; 03781 iirq longr ;16 bit registers 03782 00D2EE C2 30 rep #%00110000 03783 00D2F0 8B phb ;save DB 03784 00D2F1 0B phd ;save DP 03785 00D2F2 48 pha 03786 00D2F3 DA phx 03787 00D2F4 5A phy 03788 ; 03789 ;——————————————————————————————— 03790 ;IRQ REGISTER STACK FRAME 03791 ; 03792 0001 irq_yrx =1 ;.Y 03793 0003 irq_xrx =irq_yrx+s_word ;.X 03794 0005 irq_arx =irq_xrx+s_word ;.C 03795 0007 irq_dpx =irq_arx+s_word ;DP 03796 0009 irq_dbx =irq_dpx+s_mpudpx ;DB 03797 000A irq_srx =irq_dbx+s_mpudbx ;SR 03798 000B irq_pcx =irq_srx+s_mpusrx ;PC 03799 000D irq_pbx =irq_pcx+s_mpupcx ;PB 03800 ;——————————————————————————————— 03801 ; 03802 00D2F5 6C 06 01 jmp (ivirq) ;take IRQ indirect vector 03803 ; 03804 iirqa longa 03805 00D2F8 C2 20 rep #%00100000 03806 00D2FA A9 00 00 lda !#kerneldp 03807 00D2FD 5B tcd ;set kernel DP 03808 ; 03809 ;—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-— 03810 ; 03811 ;vQUART IRQ PROCESSING 03812 ; 03813 shortr 03814 00D2FE E2 30 sep #%00110000 03815 00D300 AD 05 C0 lda io_quart+nx_isra ;DUART #1 interrupting? 03816 00D303 D0 08 bne iirq0100 ;yes 03817 ; 03818 00D305 AD 05 C1 lda io_quart+nx_isrb ;DUART #2 interrupting? 03819 00D308 D0 3F bne iirq0200 ;yes 03820 ; 03821 00D30A 4C BD D3 jmp iirq0400 ;no, skip vQUART 03822 ; 03823 ;—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-— 03824 ; 03825 ;DUART C/T IRQ PROCESSING 03826 ; 03827 00D30D 89 08 iirq0100 bit #nxpctirq ;C/T interrupting? 03828 00D30F F0 38 beq iirq0200 ;no 03829 ; 03830 00D311 2C 0F C0 bit io_quart+nx_rcta ;yes, clear interrupt 03831 longa 03832 00D314 C2 20 rep #%00100000 03833 ; 03834 ; 03835 ; process time fields... 03836 ; 03837 00D316 A6 05 ldx jiffct ;clock jiffy counter 03838 00D318 CA dex ;decrement 03839 00D319 D0 12 bne .0000020 ;not time to update 03840 ; 03841 00D31B A2 64 ldx #hz ;reset jiffy count 03842 00D31D E6 06 inc uptime ;bump uptime LSW 03843 00D31F D0 02 bne .0000010 ;done with uptime 03844 ; 03845 00D321 E6 08 inc uptime+s_word ;bump uptime MSW 03846 ; 03847 00D323 E6 0A .0000010 inc uxtime ;bump TOD LSW 03848 00D325 D0 06 bne .0000020 ;done with TOD 03849 ; 03850 00D327 E6 0C inc uxtime+s_word ;bump TOD MID 03851 00D329 D0 02 bne .0000020 ;done with TOD 03852 ; 03853 00D32B E6 0E inc uxtime+s_dword ;bump TOD MSW 03854 ; 03855 00D32D 86 05 .0000020 stx jiffct ;set new jiffy count 03856 ; 03857 ; 03858 ; process foreground sleep... 03859 ; 03860 shortr 03861 00D32F E2 30 sep #%00110000 03862 00D331 24 00 bit tdflag ;sleep in process? 03863 00D333 10 14 bpl iirq0200 ;no 03864 ; 03865 longx 03866 00D335 C2 10 rep #%00010000 03867 00D337 A6 08 ldx uptime+s_word ;uptime MSW 03868 00D339 E4 03 cpx slptime+s_word ;sleep expire time MSW 03869 00D33B 90 0A bcc .0000040 ;has not expired 03870 ; 03871 00D33D D0 06 bne .0000030 ;has expired 03872 ; 03873 00D33F A6 06 ldx uptime ;uptime LSW 03874 00D341 E4 01 cpx slptime ;sleep expire time LSW 03875 00D343 90 02 bcc .0000040 ;has not expired 03876 ; 03877 00D345 64 00 .0000030 stz tdflag ;has expired 03878 ; 03879 .0000040 shortr 03880 00D347 E2 30 sep #%00110000 03881 ; 03882 ;—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-— 03883 ; 03884 ;vQUART RECEIVER IRQ PROCESSING 03885 ; 03886 00D349 AD 00 C2 iirq0200 lda io_sioq ;get vQUART channel IRQ status 03887 00D34C F0 6F beq iirq0400 ;nothing to process 03888 ; 03889 00D34E 89 0F bit #m_irqrx ;receiver IRQ? 03890 00D350 F0 34 beq iirq0310 ;no 03891 ; 03892 00D352 85 49 sta tiairqst ;save IRQ status 03893 00D354 A0 00 ldy #0 ;starting channel index 03894 ; 03895 ; 03896 ; channel processing loop... 03897 ; 03898 00D356 46 49 .0000010 lsr tiairqst ;channel receiver interrupting? 03899 00D358 90 24 bcc .0000030 ;no, skip it 03900 ; 03901 00D35A 98 tya ;yes, copy channel index &... 03902 00D35B 0A asl ;make channel pointer... 03903 00D35C AA tax ;offset 03904 00D35D A9 40 lda #nxpcresr ;clear any... 03905 00D35F 81 18 sta (tiacr,x) ;RxD overrun error 03906 ; 03907 ; 03908 ; RHR processing loop... 03909 ; 03910 00D361 A1 10 .0000020 lda (tiasr,x) ;get channel status 03911 00D363 89 01 bit #nxprxdr ;RHR empty? 03912 00D365 F0 17 beq .0000030 ;yes, done with channel 03913 ; 03914 00D367 A1 20 lda (tiafif,x) ;get & hold datum from... 03915 00D369 EB xba ;RHR 03916 00D36A B5 30 lda tiaputrx,x ;get queue 'put' pointer 03917 00D36C 1A inc ;bump it &... 03918 00D36D 29 3F and #m_tiaptr ;mask to queue size 03919 00D36F 1D FB E9 ora tiaqpmsk,x ;align to queue base addr 03920 00D372 D5 28 cmp tiagetrx,x ;any room in queue? 03921 00D374 F0 EB beq .0000020 ;no, discard datum 03922 ; 03923 00D376 EB xba ;store datum... 03924 00D377 81 30 sta (tiaputrx,x) ;in queue 03925 00D379 EB xba ;'put' pointer 03926 00D37A 95 30 sta tiaputrx,x ;set it &... 03927 00D37C 80 E3 bra .0000020 ;get next datum 03928 ; 03929 ; ...end of RHR processing loop 03930 ; 03931 ; 03932 00D37E C8 .0000030 iny ;next channel 03933 00D37F C0 04 cpy #n_nxpchn ;all channels processed? 03934 00D381 90 D3 bcc .0000010 ;no 03935 ; 03936 ; ...end of channel processing loop 03937 ; 03938 ;—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-— 03939 ; 03940 ;vQUART TRANSMITTER IRQ PROCESSING 03941 ; 03942 00D383 AD 00 C2 iirq0300 lda io_sioq ;IRQ status 03943 ; 03944 00D386 89 F0 iirq0310 bit #m_irqtx ;transmitter IRQ? 03945 00D388 F0 33 beq iirq0400 ;no, done with vQUART 03946 ; 03947 00D38A 85 49 sta tiairqst ;save IRQ status 03948 00D38C A0 03 ldy #n_nxpchn-1 ;starting channel 03949 ; 03950 ; 03951 ; channel processing loop... 03952 ; 03953 00D38E 06 49 .0000010 asl tiairqst ;transmitter interrupting? 03954 00D390 90 28 bcc .0000040 ;no, skip it 03955 ; 03956 00D392 98 tya ;copy channel index &... 03957 00D393 0A asl ;make channel pointer... 03958 00D394 AA tax ;offset 03959 ; 03960 ; 03961 ; THR processing loop... 03962 ; 03963 00D395 B5 38 .0000020 lda tiagettx,x ;queue 'get' pointer 03964 00D397 D5 40 cmp tiaputtx,x ;queue 'put' pointer 03965 00D399 F0 16 beq .0000030 ;nothing to transmit 03966 ; 03967 00D39B EB xba ;save 'get' pointer 03968 00D39C A1 10 lda (tiasr,x) ;get channel status 03969 00D39E 89 04 bit #nxptxdr ;TFIFO full? 03970 00D3A0 F0 18 beq .0000040 ;yes, done for now 03971 ; 03972 00D3A2 A1 38 lda (tiagettx,x) ;read from queue &... 03973 00D3A4 81 20 sta (tiafif,x) ;write to TFIFO 03974 00D3A6 EB xba ;recover 'get' pointer 03975 00D3A7 1A inc ;bump it &... 03976 00D3A8 29 3F and #m_tiaptr ;mask to queue size 03977 00D3AA 1D FB E9 ora tiaqpmsk,x ;align to queue base addr 03978 00D3AD 95 38 sta tiagettx,x ;save it &... 03979 00D3AF 80 E4 bra .0000020 ;get next datum 03980 ; 03981 ; ...end of THR processing loop 03982 ; 03983 00D3B1 A9 08 .0000030 lda #nxpcrtxd ;disable... 03984 00D3B3 81 18 sta (tiacr,x) ;TxD 03985 00D3B5 BD F3 E9 lda tiatstab,x ;tell foreground... 03986 00D3B8 04 48 tsb tiatxst ;about it 03987 ; 03988 00D3BA 88 .0000040 dey ;all channels serviced? 03989 00D3BB 10 D1 bpl .0000010 ;no 03990 ; 03991 ; ...end of channel processing loop 03992 ; 03993 ;—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-— 03994 ; 03995 ;SCSI IRQ PROCESSING 03996 ; 03997 00D3BD 24 4A iirq0400 bit scsihba ;HBA present? 03998 00D3BF 10 2F bpl iirq0500 ;no 03999 ; 04000 00D3C1 AC 04 C4 ldy io_scsi+sr_stat ;yes, get general status 04001 00D3C4 10 2A bpl iirq0500 ;HBA not interrupting 04002 ; 04003 00D3C6 AE 06 C4 ldx io_scsi+sr_isr ;get command status 04004 00D3C9 AD 05 C4 lda io_scsi+sr_irqst ;get interrupt status 04005 longa 04006 00D3CC C2 20 rep #%00100000 04007 00D3CE 29 FF 00 and !#%11111111 ;squelch noise in .B 04008 ; 04009 ; —————————————————————————————————————————————————————————————————————— 04010 ; The following code modifies the stack frame that was pushed by the ISR 04011 ; preamble, thus affecting the behavior of the foreground code that was 04012 ; interrupted. The changes are as follows: 04013 ; 04014 ; Frame MPU 04015 ; Offset Register Data or operation 04016 ; —-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-— 04017 ; irq_arx .C SCSI controller interrupt status 04018 ; irq_xrx .X SCSI controller command status 04019 ; irq_yrx .Y SCSI controller general status 04020 ; irq_pcx PC SCSI foreground execution vector 04021 ; irq_srx SR C & D cleared, m & x set 04022 ; —-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-— 04023 ; 04024 ; No analysis of status is made here; the foreground sees to that. 04025 ; —————————————————————————————————————————————————————————————————————— 04026 ; 04027 00D3D1 83 05 sta irq_arx,s ;.A = interrupt status 04028 00D3D3 8A txa 04029 00D3D4 83 03 sta irq_xrx,s ;.X = command status 04030 00D3D6 98 tya 04031 00D3D7 83 01 sta irq_yrx,s ;.Y = general status 04032 00D3D9 AD 0A 01 lda ivscsi ;get alternate driver vector 04033 00D3DC D0 03 bne .0000010 ;vector defined, so use it 04034 ; 04035 00D3DE A9 07 D9 lda !#scsicmda ;default if no alternate 04036 ; 04037 00D3E1 83 0B .0000010 sta irq_pcx,s ;reroute foreground code &... 04038 00D3E3 9C 0A 01 stz ivscsi ;invalidate alternate vector 04039 shorta ;8 bit .A 04040 00D3E6 E2 20 sep #%00100000 04041 00D3E8 A3 0A lda irq_srx,s ;get status register 04042 00D3EA 29 FE and #sr_bdm|sr_car_i ;clear C & D flags 04043 00D3EC 09 30 ora #sr_amw|sr_ixw ;set m & x flags 04044 00D3EE 83 0A sta irq_srx,s ;change stack copy 04045 ; 04046 ;—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-— 04047 ; 04048 ;FUTURE IRQ PROCESSING 04049 ; 04050 iirq0500 ;!!! DO NOT DELETE THIS LABEL !!! 04051 ; 04052 ;================================================================================ 04053 ; 04054 ;crti: COMMON INTERRUPT RETURN 04055 ; 04056 crti longr 04057 00D3F0 C2 30 rep #%00110000 04058 00D3F2 7A ply ;restore MPU state 04059 00D3F3 FA plx 04060 00D3F4 68 pla 04061 00D3F5 2B pld 04062 00D3F6 AB plb 04063 00D3F7 40 rti 04064 ; 04065 ;================================================================================ 04066 ; 04067 ;inmi: NON-MASKABLE INTERRUPT SERVICE ROUTINE 04068 ; 04069 inmi longr ;16 bit registers 04070 00D3F8 C2 30 rep #%00110000 04071 00D3FA 8B phb ;save DB 04072 00D3FB 0B phd ;save DP 04073 00D3FC 48 pha 04074 00D3FD DA phx 04075 00D3FE 5A phy 04076 ; 04077 ;——————————————————————————————— 04078 ;NMI REGISTER STACK FRAME 04079 ; 04080 0001 nmi_yrx =1 ;.Y 04081 0003 nmi_xrx =nmi_yrx+s_word ;.X 04082 0005 nmi_arx =nmi_xrx+s_word ;.C 04083 0007 nmi_dpx =nmi_arx+s_word ;DP 04084 0009 nmi_dbx =nmi_dpx+s_mpudpx ;DB 04085 000A nmi_srx =nmi_dbx+s_mpudbx ;SR 04086 000B nmi_pcx =nmi_srx+s_mpusrx ;PC 04087 000D nmi_pbx =nmi_pcx+s_mpupcx ;PB 04088 ;——————————————————————————————— 04089 ; 04090 00D3FF 6C 08 01 jmp (ivnmi) ;NMI indirect vector 04091 ; 04092 inmia longa 04093 00D402 C2 20 rep #%00100000 04094 00D404 A3 0B lda nmi_pcx,s ;interrupted address 04095 00D406 C9 00 D0 cmp !#mm_rom ;anywhere in ROM? 04096 00D409 B0 E5 bcs crti ;yes, ignore NMI 04097 ; 04098 00D40B 4C 48 DA jmp monbrk ;goto M/L monitor 04099 ; 04100 .end 04101 .include "kernel/time.asm" 04102 ;================================================================================ 04103 ; 04104 ;getdtr: READ RTC DATE & TIME REGISTERS 04105 ; 04106 ; ———————————————————————————————————————————————————— 04107 ; Preparatory Ops: .X: storage address LSB 04108 ; .Y: storage address MSB 04109 ; 04110 ; Returned Values: .A: entry value 04111 ; .B: entry value 04112 ; .X: entry value 04113 ; .Y: entry value 04114 ; 04115 ; Storage location will contain 8 BCD 04116 ; bytes as follows: 04117 ; 04118 ; Offset Content Range 04119 ; —-—-—-—-—-—-—-—-—-—-—-—-—-—- 04120 ; $00 seconds $00-$59 04121 ; $01 minutes $00-$59 04122 ; $02 hours $00-$23 04123 ; $03 day-of-week $01-$07 04124 ; $04 date $01-$31 04125 ; $05 month $01-$12 04126 ; $06 year LSB $00-$99 04127 ; $07 year MSB $00-$39 04128 ; —-—-—-—-—-—-—-—-—-—-—-—-—-—-— 04129 ; 04130 ; MPU Flags: NVmxDIZC 04131 ; |||||||| 04132 ; ++++++++———> entry values 04133 ; 04134 ; Example: ldx #todbuf 04136 ; jsr getdtr 04137 ; ———————————————————————————————————————————————————— 04138 ; 04139 00D40E 08 getdtr php ;save MPU state 04140 longr 04141 00D40F C2 30 rep #%00110000 04142 00D411 0B phd 04143 00D412 5A phy 04144 00D413 DA phx 04145 00D414 48 pha 04146 00D415 A9 00 00 lda !#kerneldp ;set default... 04147 00D418 5B tcd ;direct page 04148 shortr 04149 00D419 E2 30 sep #%00110000 04150 00D41B 98 tya ;storage address MSB 04151 00D41C EB xba ;move to MSB of .C 04152 00D41D 8A txa ;storage address LSB 04153 longx ;16 bit index regs 04154 00D41E C2 10 rep #%00010000 04155 00D420 AA tax ;copy 16 bit storage index 04156 00D421 A9 80 lda #d11temsk 04157 00D423 1C 0F C3 trb io_rtc+wr_crb ;halt register updates 04158 00D426 A0 00 00 ldy !#0 ;RTC register offset 04159 ; 04160 00D429 B9 00 C3 .0000010 lda io_rtc,y ;read RTC 04161 00D42C C0 05 00 cpy !#wr_mon ;month register? 04162 00D42F D0 02 bne .0000020 ;no 04163 ; 04164 00D431 29 1F and #d11emmsk ;discard control bits 04165 ; 04166 00D433 95 00 .0000020 sta mm_ram,x ;store in RAM 04167 00D435 C0 07 00 cpy !#wr_yrhi-wr_sect ;all registers read? 04168 00D438 F0 04 beq getdtraa ;yes, done 04169 ; 04170 00D43A E8 inx ;next location 04171 00D43B C8 iny ;next register 04172 00D43C 80 EB bra .0000010 04173 ; 04174 00D43E A9 80 getdtraa lda #d11temsk 04175 00D440 0C 0F C3 tsb io_rtc+wr_crb ;resume register updates 04176 longr 04177 00D443 C2 30 rep #%00110000 04178 00D445 68 pla ;restore MPU entry state 04179 00D446 FA plx 04180 00D447 7A ply 04181 00D448 2B pld 04182 00D449 28 plp 04183 00D44A 60 rts 04184 ; 04185 ;================================================================================ 04186 ; 04187 ;getuptim: GET SYSTEM UP-TIME 04188 ; 04189 ; —————————————————————————————————————————————— 04190 ; Preparatory Ops: .X: 16 bits: storage location 04191 ; 04192 ; Returned Values: .A: entry value 04193 ; .B: entry value 04194 ; .X: entry value 04195 ; .Y: entry value 04196 ; 04197 ; MPU Flags: NVmxDIZC 04198 ; |||||||| 04199 ; ||||||++———> entry value 04200 ; |||||+—————> 0 04201 ; +++++——————> entry value 04202 ; —————————————————————————————————————————————— 04203 ; 04204 00D44B 58 getsutim cli ;IRQs must be... 04205 00D44C 08 php ;enabled on exit 04206 longr 04207 00D44D C2 30 rep #%00110000 04208 00D44F 5A phy ;save MPU state 04209 00D450 DA phx 04210 00D451 48 pha 04211 00D452 A9 06 00 lda !#uptime ;data source 04212 00D455 A0 02 00 ldy !#s_word ;data index 04213 00D458 80 0D bra GETTMCOM ;copy 04214 ; 04215 ;================================================================================ 04216 ; 04217 ;getuxtim: GET UNIX TIME 04218 ; 04219 ; —————————————————————————————————————————————— 04220 ; Preparatory Ops: .X: 16 bits: storage location 04221 ; 04222 ; Returned Values: .A: entry value 04223 ; .B: entry value 04224 ; .X: entry value 04225 ; .Y: entry value 04226 ; 04227 ; MPU Flags: NVmxDIZC 04228 ; |||||||| 04229 ; ||||||++———> entry value 04230 ; |||||+—————> 0 04231 ; +++++——————> entry value 04232 ; —————————————————————————————————————————————— 04233 ; 04234 00D45A 58 getuxtim cli ;IRQs must be... 04235 00D45B 08 php ;enabled on exit 04236 longr 04237 00D45C C2 30 rep #%00110000 04238 00D45E 5A phy ;save MPU state 04239 00D45F DA phx 04240 00D460 48 pha 04241 00D461 A9 0A 00 lda !#uxtime ;data source 04242 00D464 A0 04 00 ldy !#s_time_t-s_word ;data index 04243 ; 04244 00D467 48 GETTMCOM pha ;set data source 04245 00D468 0B phd ;save entry DP 04246 ; 04247 ;——————————————————————————————— 04248 0001 .reg_dp =1 ;DP 04249 0003 .source =.reg_dp+s_word ;data source (.C) 04250 0005 .reg_c =.source+s_ptr ;.C 04251 0007 .reg_x =.reg_c+s_word ;data destination 04252 0009 .reg_y =.reg_x+s_word ;.Y 04253 000B .reg_sr =.reg_y+s_word ;SR 04254 ;——————————————————————————————— 04255 ; 04256 00D469 A9 00 00 lda !#kerneldp 04257 00D46C 5B tcd ;set kernel direct page 04258 00D46D 78 sei ;suspend updating 04259 ; 04260 00D46E B3 03 .0000010 lda (.source,s),y ;copy source to... 04261 00D470 93 07 sta (.reg_x,s),y ;destination 04262 decy s_word 04263 .if .n 04264 .rept .n 04265 00D472 88 dey 04266 00D473 88 dey 04267 .else 04268 00D474 10 F8 bpl .0000010 ;next 04269 ; 04270 00D476 2B pld ;clean up stack 04271 00D477 68 pla ;restore MPU state 04272 00D478 68 pla 04273 00D479 FA plx 04274 00D47A 7A ply 04275 00D47B 28 plp 04276 00D47C 60 rts 04277 ; 04278 ;================================================================================ 04279 ; 04280 ;putdtr: WRITE RTC DATE & TIME REGISTERS 04281 ; 04282 ; ———————————————————————————————————————————————————— 04283 ; Preparatory Ops: .X: source address LSB 04284 ; .Y: source address MSB 04285 ; 04286 ; Source must contain 8 BCD values in 04287 ; the following order: 04288 ; 04289 ; Offset Content Range 04290 ; —-—-—-—-—-—-—-—-—-—-—-—-—-—- 04291 ; $00 seconds $00-$59 04292 ; $01 minutes $00-$59 04293 ; $02 hours $00-$23 04294 ; $03 day-of-week $01-$07 04295 ; $04 date $01-$31 04296 ; $05 month $01-$12 04297 ; $06 year LSB $00-$99 04298 ; $07 year MSB $00-$39 04299 ; —-—-—-—-—-—-—-—-—-—-—-—-—-—- 04300 ; 04301 ; Returned Values: .A: entry value 04302 ; .B: entry value 04303 ; .X: entry value 04304 ; .Y: entry value 04305 ; 04306 ; MPU Flags: NVmxDIZC 04307 ; |||||||| 04308 ; ++++++++———> entry values 04309 ; 04310 ; Example: ldx #todbuf 04312 ; jsr putdtr 04313 ; ———————————————————————————————————————————————————— 04314 ; 04315 00D47D 08 putdtr php ;save MPU state 04316 longr 04317 00D47E C2 30 rep #%00110000 04318 00D480 0B phd 04319 00D481 5A phy 04320 00D482 DA phx 04321 00D483 48 pha 04322 00D484 A9 00 00 lda !#kerneldp ;set default... 04323 00D487 5B tcd ;direct page 04324 shortr 04325 00D488 E2 30 sep #%00110000 04326 00D48A 98 tya ;storage address MSB 04327 00D48B EB xba ;move to MSB of .C 04328 00D48C 8A txa ;storage address LSB 04329 longx ;16 bit index regs 04330 00D48D C2 10 rep #%00010000 04331 00D48F AA tax ;source index 04332 00D490 A9 80 lda #d11temsk 04333 00D492 1C 0F C3 trb io_rtc+wr_crb ;halt register updates 04334 00D495 A0 00 00 ldy !#0 ;register offset 04335 ; 04336 00D498 A9 00 .0000010 lda #0 ;dummy value 04337 00D49A C0 05 00 cpy !#wr_mon ;month register? 04338 00D49D D0 05 bne .0000020 ;no 04339 ; 04340 00D49F B9 00 C3 lda io_rtc,y ;get month & control 04341 00D4A2 29 E0 and #d11ecmsk ;extract control bits... 04342 ; 04343 00D4A4 15 00 .0000020 ora mm_ram,x ;get new value 04344 00D4A6 99 00 C3 sta io_rtc,y ;write RTC 04345 00D4A9 C0 07 00 cpy !#wr_yrhi-wr_sect ;all registers written? 04346 00D4AC F0 90 beq getdtraa ;yes, done 04347 ; 04348 00D4AE E8 inx ;next location 04349 00D4AF C8 iny ;next register 04350 00D4B0 80 E6 bra .0000010 04351 ; 04352 ;================================================================================ 04353 ; 04354 ;setuxtim: SET UNIX TIME 04355 ; 04356 ; —————————————————————————————————————————————————— 04357 ; Preparatory Ops: .Y: 16 bits: time number location 04358 ; 04359 ; Returned Values: .A: used 04360 ; .B: used 04361 ; .X: used 04362 ; .Y: used 04363 ; 04364 ; MPU Flags: NVmxDIZC 04365 ; |||||||| 04366 ; ||||||++———> entry value 04367 ; |||||+—————> 0 04368 ; +++++——————> entry value 04369 ; —————————————————————————————————————————————————— 04370 ; 04371 00D4B2 58 setuxtim cli ;IRQs must be enabled... 04372 00D4B3 08 php ;on exit 04373 longr 04374 00D4B4 C2 30 rep #%00110000 04375 00D4B6 0B phd 04376 00D4B7 5A phy 04377 00D4B8 DA phx 04378 00D4B9 48 pha 04379 00D4BA A9 00 00 lda !#kerneldp 04380 00D4BD 5B tcd ;set kernel direct page 04381 00D4BE A9 05 00 lda !#s_time_t-1 ;bytes to copy 04382 00D4C1 A0 0A 00 ldy !#uxtime ;time "register" 04383 00D4C4 78 sei ;don't interrupt us... 04384 00D4C5 54 00 00 mvn #0,#0 ;while we copy 04385 00D4C8 68 pla 04386 00D4C9 FA plx 04387 00D4CA 7A ply 04388 00D4CB 2B pld 04389 00D4CC 28 plp 04390 00D4CD 60 rts 04391 ; 04392 ;================================================================================ 04393 ; 04394 ;td2sec: GENERATE 2 SECOND TIME DELAY 04395 ; 04396 td2sec longa 04397 00D4CE C2 20 rep #%00100000 04398 00D4D0 A9 02 00 lda !#2 04399 shorta 04400 00D4D3 E2 20 sep #%00100000 04401 ; 04402 ;================================================================================ 04403 ; 04404 ;utdelay: GENERATE USER-DEFINED TIME DELAY 04405 ; 04406 ; ——————————————————————————————————————————————— 04407 ; Preparatory Ops: .A: 16 bit delay time in secs 04408 ; 04409 ; Returned Values: .A: entry value 04410 ; .B: entry value 04411 ; .X: entry value 04412 ; .Y: entry value 04413 ; 04414 ; MPU Flags: NVmxDIZC 04415 ; |||||||| 04416 ; ++++++++———> entry values 04417 ; 04418 ; Notes: 1) Delay time is approximate. 04419 ; 2) A delay time of zero will cause an 04420 ; immediate exit. 04421 ; 04422 ; Examples: longa ;16 bit .A 04423 ; lda #600 ;600 secs 04424 ; jsr utdelay 04425 ; 04426 ; or... 04427 ; 04428 ; shorta ;8 bit .A 04429 ; lda #>600 ;600 secs MSB in .A 04430 ; xba ;transfer to .B 04431 ; lda #<600 ;600 secs LSB in .A 04432 ; jsr utdelay 04433 ; 04434 ; NOTES: 1) Short time delay periods will not be 04435 ; very accurate. 04436 ; ——————————————————————————————————————————————— 04437 ; 04438 00D4D5 08 utdelay php ;save MPU state 04439 longa 04440 00D4D6 C2 20 rep #%00100000 04441 00D4D8 09 00 00 ora !#0 ;zero delay? 04442 00D4DB F0 23 beq .0000020 ;yes, just exit 04443 ; 04444 00D4DD 0B phd 04445 00D4DE 48 pha ;save entry value 04446 00D4DF F4 00 00 pea #kerneldp 04447 00D4E2 2B pld ;set kernel direct page 04448 00D4E3 18 clc 04449 00D4E4 78 sei ;stop updates 04450 00D4E5 65 06 adc uptime ;uptime LSW 04451 00D4E7 85 01 sta slptime ;expire time LSW 04452 00D4E9 A5 08 lda uptime+s_word ;uptime MSW 04453 00D4EB 58 cli ;resume updates 04454 00D4EC 69 00 00 adc !#0 ;handle carry 04455 00D4EF 85 03 sta slptime+s_word ;expire time MSW 04456 shorta 04457 00D4F1 E2 20 sep #%00100000 04458 00D4F3 A9 80 lda #%10000000 04459 00D4F5 85 00 sta tdflag ;initiate sleep period 04460 ; 04461 00D4F7 CB .0000010 wai ;wait for next IRQ 04462 00D4F8 24 00 bit tdflag ;sleep period expire? 04463 00D4FA 30 FB bmi .0000010 ;no 04464 ; 04465 longa ;yes, restore... 04466 00D4FC C2 20 rep #%00100000 04467 00D4FE 68 pla ;entry value 04468 00D4FF 2B pld ;restore DP 04469 ; 04470 00D500 28 .0000020 plp ;restore MPU state 04471 00D501 60 rts 04472 ; 04473 .end 04474 .include "kernel/display.asm" 04475 ;=============================================================================== 04476 ; 04477 ;drawrect: draw GRAPHIC RECTANGLE ON CONSOLE 04478 ; 04479 ; ————————————————————————————————————————————————————————————————————— 04480 ; Calling syntax: pea #width ;width in columns (1) 04481 ; pea #height ;height in rows (1) 04482 ; pea #tlcol ;top left corner column (2) 04483 ; pea #tlrow ;top left corner row (2) 04484 ; jsr drawrect ;draw rectangle (3) 04485 ; bcs error ;parameter error 04486 ; 04487 ; Exit registers: .A: used 04488 ; .B: used 04489 ; .X: used 04490 ; .Y: used 04491 ; DB: entry value 04492 ; DP: entry value 04493 ; PB: entry value 04494 ; SR: NVmxDIZC 04495 ; |||||||| 04496 ; |||||||+———> 0: okay 04497 ; ||||||| 1: parameter error 04498 ; +++++++————> entry value 04499 ; 04500 ; Notes: 1) Width & height parameters include the corners & must be at 04501 ; least 2. 04502 ; 04503 ; 2) Column/row coordinates are zero-based. 04504 ; 04505 ; 3) Upon successfully drawing the rectangle, this function will 04506 ; position the cursor at 1,1 relative to the rectangle's top 04507 ; left corner. 04508 ; ————————————————————————————————————————————————————————————————————— 04509 ; 04510 00D502 18 drawrect clc ;no initial error 04511 00D503 08 php 04512 ; 04513 ;————————————————————————————————————————————————————————— 04514 ;STACK DEFINITIONS 04515 ; 04516 0001 .sfbase .set 1 ;base stack index 04517 0001 .sfidx .set .sfbase ;workspace index 04518 ; 04519 ;—————————> workspace stack frame start <————————— 04520 0001 .hlinlen =.sfidx ;horiz line length 04521 0002 .sfidx .= .sfidx+s_byte 04522 0002 .vlinlen =.sfidx ;vert line length 04523 0003 .sfidx .= .sfidx+s_byte 04524 0003 .rcol =.sfidx ;right column 04525 0004 .sfidx .= .sfidx+s_byte 04526 0004 .brow =.sfidx ;bottom row 04527 0005 .sfidx .= .sfidx+s_byte 04528 ;——————————> workspace stack frame end <—————————— 04529 ; 04530 0004 .s_wsf =.sfidx-.sfbase ;workspace stack frame size 04531 0005 .sfbase .= .sfidx 04532 ; 04533 ;———————> MPU register stack frame start <———————— 04534 0005 .reg_sr =.sfidx ;SR 04535 0006 .sfidx .= .sfidx+s_mpusrx 04536 0006 .reg_pc =.sfidx ;PC 04537 0008 .sfidx .= .sfidx+s_mpupcx 04538 ;————————> MPU register stack frame end <————————— 04539 ; 04540 0003 .s_rsf =.sfidx-.sfbase ;register stack frame size 04541 0008 .sfbase .= .sfidx 04542 ; 04543 ;—————————> parameter stack frame start <————————— 04544 0008 .tlrow =.sfidx ;TL corner row 04545 000A .sfidx .= .sfidx+s_word 04546 000A .tlcol =.sfidx ;TL corner column 04547 000C .sfidx .= .sfidx+s_word 04548 000C .height =.sfidx ;overall height 04549 000E .sfidx .= .sfidx+s_word 04550 000E .width =.sfidx ;overall width 04551 0010 .sfidx .= .sfidx+s_word 04552 ;——————————> parameter stack frame end <—————————— 04553 ; 04554 0008 .s_psf =.sfidx-.sfbase ;parameter stack frame size 04555 ;————————————————————————————————————————————————————————— 04556 ; 04557 longa 04558 00D504 C2 20 rep #%00100000 04559 00D506 38 sec 04560 00D507 3B tsc 04561 00D508 E9 04 00 sbc !#.s_wsf ;create fugacious workspace 04562 00D50B 1B tcs 04563 shortr 04564 00D50C E2 30 sep #%00110000 04565 ; 04566 ; 04567 ; compute rectangle details... 04568 ; 04569 00D50E 38 .setup sec 04570 00D50F A3 0E lda .width,s ;rectangle width 04571 00D511 E9 02 sbc #2 ;account for corners 04572 00D513 90 0D bcc .setup01 ;width < 2, error 04573 ; 04574 00D515 83 01 sta .hlinlen,s ;set horiz line length 04575 00D517 63 0A adc .tlcol,s ;TL corner column 04576 00D519 83 03 sta .rcol,s ;set right column 04577 00D51B 38 sec 04578 00D51C A3 0C lda .height,s ;rectangle height 04579 00D51E E9 02 sbc #2 ;account for corners 04580 00D520 B0 08 bcs .setup02 ;height > 1, okay 04581 ; 04582 00D522 A3 05 .setup01 lda .reg_sr,s ;SR return value 04583 00D524 09 01 ora #sr_car ;set carry, ... 04584 00D526 83 05 sta .reg_sr,s ;rewrite SR &... 04585 00D528 80 63 bra .done ;exit 04586 ; 04587 00D52A 83 02 .setup02 sta .vlinlen,s ;set vert line length 04588 00D52C 63 08 adc .tlrow,s ;top row 04589 00D52E 83 04 sta .brow,s ;set bottom row 04590 ; 04591 ; —————————————— 04592 ; draw Rectangle 04593 ; —————————————— 04594 ; 04595 00D530 A3 0A .main lda .tlcol,s ;TL corner column 04596 00D532 AA tax 04597 00D533 A3 08 lda .tlrow,s ;TL corner row 04598 00D535 A8 tay 04599 00D536 20 09 D6 jsr plot ;position cursor 04600 ; 04601 ; 04602 ; draw top border... 04603 ; 04604 printf dc_g2 ;print TL corner 04605 00D539 F4 5E EE pea #.s 04606 00D53C 20 35 D6 jsr sprint 04607 00D53F A3 01 lda .hlinlen,s 04608 00D541 20 AF D5 jsr linehg ;draw horizontal line 04609 printf dc_g3 ;print TR corner 04610 00D544 F4 66 EE pea #.s 04611 00D547 20 35 D6 jsr sprint 04612 ; 04613 ; 04614 ; draw left border... 04615 ; 04616 00D54A A3 0A lda .tlcol,s ;TL corner column 04617 00D54C AA tax 04618 00D54D A3 08 lda .tlrow,s ;TL corner row 04619 00D54F A8 tay 04620 00D550 C8 iny ;down a row 04621 00D551 20 09 D6 jsr plot ;position cursor 04622 00D554 A3 02 lda .vlinlen,s ;vert line length 04623 00D556 20 D8 D5 jsr linevg ;draw vertical line 04624 ; 04625 ; 04626 ; draw bottom border... 04627 ; 04628 00D559 A3 0A lda .tlcol,s ;left column 04629 00D55B AA tax 04630 00D55C A3 04 lda .brow,s ;bottom row 04631 00D55E A8 tay 04632 00D55F 20 09 D6 jsr plot ;position to BL corner 04633 printf dc_g4 ;print BL corner 04634 00D562 F4 6E EE pea #.s 04635 00D565 20 35 D6 jsr sprint 04636 00D568 A3 01 lda .hlinlen,s 04637 00D56A 20 AF D5 jsr linehg ;draw horizontal line 04638 printf dc_g5 ;print BR corner 04639 00D56D F4 76 EE pea #.s 04640 00D570 20 35 D6 jsr sprint 04641 ; 04642 ; 04643 ; draw right border... 04644 ; 04645 00D573 A3 03 lda .rcol,s ;right column 04646 00D575 AA tax 04647 00D576 A3 08 lda .tlrow,s ;top row 04648 00D578 A8 tay 04649 00D579 C8 iny ;down a row 04650 00D57A 20 09 D6 jsr plot ;position cursor 04651 00D57D A3 02 lda .vlinlen,s ;vert line length 04652 00D57F 20 D8 D5 jsr linevg ;draw vertical line 04653 ; 04654 ; 04655 ; position to 1,1 relative to rectangle... 04656 ; 04657 00D582 A3 0A lda .tlcol,s ;TL corner column 04658 00D584 AA tax 04659 00D585 A3 08 lda .tlrow,s ;TL corner row 04660 00D587 A8 tay 04661 00D588 E8 inx ;over a column &... 04662 00D589 C8 iny ;down a row 04663 00D58A 20 09 D6 jsr plot ;position cursor 04664 ; 04665 ; ————————————— 04666 ; Common Return 04667 ; ————————————— 04668 ; 04669 .done longr 04670 00D58D C2 30 rep #%00110000 04671 00D58F 18 clc 04672 00D590 3B tsc 04673 00D591 69 04 00 adc !#.s_wsf 04674 00D594 1B tcs 04675 00D595 69 03 00 adc !#.s_rsf 04676 00D598 AA tax 04677 00D599 69 08 00 adc !#.s_psf 04678 00D59C A8 tay 04679 00D59D A9 02 00 lda !#.s_rsf-1 04680 00D5A0 44 00 00 mvp #0,#0 04681 00D5A3 98 tya 04682 00D5A4 1B tcs 04683 00D5A5 28 plp 04684 00D5A6 60 rts 04685 ; 04686 ;================================================================================ 04687 ; 04688 ;scsihdrd: DISPLAY SCSI ENUMERATION HEADER 04689 ; 04690 scsihdrd printf sd_bannr ;enumeration titles 04691 00D5A7 F4 27 F0 pea #.s 04692 00D5AA 20 35 D6 jsr sprint 04693 00D5AD A9 30 lda #seghllen 04694 ; 04695 ;================================================================================ 04696 ; 04697 ;linehg: PRINT GRAPHIC HORIZONTAL LINE 04698 ; 04699 ; ———————————————————————————————————————— 04700 ; Preparatory Ops: .A: 8 bits: line length 04701 ; 04702 ; Returned Values: .A: entry value 04703 ; .B: entry value 04704 ; .X: entry value 04705 ; .Y: entry value 04706 ; 04707 ; MPU Flags: NVmxDIZC 04708 ; |||||||| 04709 ; ++++++++———> entry values 04710 ; ———————————————————————————————————————— 04711 ; 04712 00D5AF 08 linehg php 04713 longr 04714 00D5B0 C2 30 rep #%00110000 04715 00D5B2 48 pha ;save MPU state 04716 00D5B3 DA phx 04717 00D5B4 5A phy 04718 shortr 04719 00D5B5 E2 30 sep #%00110000 04720 00D5B7 09 00 ora #0 04721 00D5B9 F0 16 beq .0000020 ;zero length, just exit 04722 ; 04723 00D5BB 48 pha ;save length again 04724 printf dc_bg ;select graphics mode 04725 00D5BC F4 28 EE pea #.s 04726 00D5BF 20 35 D6 jsr sprint 04727 00D5C2 FA plx ;get length 04728 00D5C3 A9 3A lda #t_hline ;horizontal line char 04729 ; 04730 00D5C5 20 4A D2 .0000010 jsr putcha ;print 04731 00D5C8 CA dex 04732 00D5C9 D0 FA bne .0000010 04733 ; 04734 printf dc_eg ;restore text mode 04735 00D5CB F4 41 EE pea #.s 04736 00D5CE 20 35 D6 jsr sprint 04737 ; 04738 .0000020 longr 04739 00D5D1 C2 30 rep #%00110000 04740 00D5D3 7A ply ;restore MPU state 04741 00D5D4 FA plx 04742 00D5D5 68 pla 04743 00D5D6 28 plp 04744 00D5D7 60 rts 04745 ; 04746 ;================================================================================ 04747 ; 04748 ;linevg: PRINT GRAPHIC VERTICAL LINE 04749 ; 04750 ; ———————————————————————————————————————— 04751 ; Preparatory Ops: .A: 8 bits: line length 04752 ; 04753 ; Returned Values: .A: entry value 04754 ; .B: entry value 04755 ; .X: entry value 04756 ; .Y: entry value 04757 ; 04758 ; MPU Flags: NVmxDIZC 04759 ; |||||||| 04760 ; ++++++++———> entry value 04761 ; ———————————————————————————————————————— 04762 ; 04763 00D5D8 08 linevg php ;save MPU state 04764 longr 04765 00D5D9 C2 30 rep #%00110000 04766 00D5DB 5A phy 04767 00D5DC DA phx 04768 00D5DD 48 pha 04769 shortr 04770 00D5DE E2 30 sep #%00110000 04771 00D5E0 AA tax 04772 00D5E1 F0 1F beq .done ;zero length, just exit 04773 ; 04774 00D5E3 DA phx 04775 printf dc_bg ;select graphics mode 04776 00D5E4 F4 28 EE pea #.s 04777 00D5E7 20 35 D6 jsr sprint 04778 00D5EA FA plx 04779 00D5EB A9 00 lda #0 04780 ; 04781 00D5ED A8 .0000010 tay ;starting string index 04782 ; 04783 00D5EE B9 23 F0 .0000020 lda si_vline,y ;vertical line sequence 04784 00D5F1 F0 06 beq .0000030 ;done with it 04785 ; 04786 00D5F3 20 4A D2 jsr putcha ;print vertical line 04787 00D5F6 C8 iny 04788 00D5F7 10 F5 bpl .0000020 ;next 04789 ; 04790 00D5F9 CA .0000030 dex ;repeat? 04791 00D5FA D0 F1 bne .0000010 ;yes 04792 ; 04793 printf dc_eg ;select text mode 04794 00D5FC F4 41 EE pea #.s 04795 00D5FF 20 35 D6 jsr sprint 04796 ; 04797 .done longr 04798 00D602 C2 30 rep #%00110000 04799 00D604 68 pla ;restore MPU state 04800 00D605 FA plx 04801 00D606 7A ply 04802 00D607 28 plp 04803 00D608 60 rts 04804 ; 04805 ;================================================================================ 04806 ; 04807 ;SET CURSOR POSITION 04808 ; 04809 ; ———————————————————————————————————— 04810 ; Preparatory Ops: .X: absolute column 04811 ; .Y: absolute row 04812 ; 04813 ; Returned Values: .A: entry value 04814 ; .B: entry value 04815 ; .X: entry value 04816 ; .Y: entry value 04817 ; 04818 ; MPU Flags: NVmxDIZC 04819 ; |||||||| 04820 ; ++++++++———> entry values 04821 ; 04822 ; Examples: LDX #COL 04823 ; LDY #ROW 04824 ; JSR PLOT 04825 ; ———————————————————————————————————— 04826 ; 04827 00D609 08 plot php ;save MPU state 04828 longr 04829 00D60A C2 30 rep #%00110000 04830 00D60C 0B phd 04831 00D60D 48 pha ;protect registers 04832 00D60E DA phx 04833 00D60F 5A phy 04834 00D610 A9 00 00 lda !#kerneldp ;set default... 04835 00D613 5B tcd ;direct page 04836 shortr 04837 00D614 E2 30 sep #%00110000 04838 printf dc_plot ;positioning preamble 04839 00D616 F4 4B EE pea #.s 04840 00D619 20 35 D6 jsr sprint 04841 longx 04842 00D61C C2 10 rep #%00010000 04843 00D61E 7A ply ;recover row 04844 00D61F FA plx ;recover col 04845 shortx 04846 00D620 E2 10 sep #%00010000 04847 00D622 98 tya 04848 00D623 18 clc 04849 00D624 69 20 adc #t_cpbase ;convert &... 04850 00D626 20 4A D2 jsr putcha ;send to console 04851 00D629 8A txa ;row 04852 00D62A 69 20 adc #t_cpbase 04853 00D62C 20 4A D2 jsr putcha 04854 longr 04855 00D62F C2 30 rep #%00110000 04856 00D631 68 pla ;restore 04857 00D632 2B pld 04858 00D633 28 plp ;restore MPU state 04859 00D634 60 rts 04860 ; 04861 ;=============================================================================== 04862 ; 04863 ;sprint: PRINT NULL-TERMINATED CHARACTER STRING 04864 ; 04865 ; ———————————————————————————————————————————————————————————————————————— 04866 ; Calling syntax: pea # ;pointer to string (1) 04867 ; jsr sprint 04868 ; bcs error ;string too long 04869 ; 04870 ; Exit registers: .A: entry value 04871 ; .B: entry value 04872 ; .X: entry value 04873 ; .Y: entry value 04874 ; DB: entry value 04875 ; DP: entry value 04876 ; PB: entry value 04877 ; SR: NVmxDIZC 04878 ; |||||||| 04879 ; |||||||+———> 0: okay 04880 ; ||||||| 1: string too long 04881 ; +++++++————> entry value 04882 ; 04883 ; Notes: 1) Any method that pushes a word may be used to set the string's 04884 ; address —— PEA is illustrative. 04885 ; 2) Maximum permissible string length including the terminator is 04886 ; 32,767 bytes. 04887 ; 3) This function will block as long as the console's SIO queue 04888 ; is full. 04889 ; 5) The entry value of DB determines from which bank the string 04890 ; will sourced. 04891 ; 6) DP must point to the kernel's direct page shadow area. 04892 ; 7) DO NOT JUMP OR BRANCH INTO THIS FUNCTION! 04893 ; ———————————————————————————————————————————————————————————————————————— 04894 ; 04895 00D635 18 sprint clc ;no initial error 04896 00D636 08 php ;save MPU state 04897 longr 04898 00D637 C2 30 rep #%00110000 04899 00D639 8B phb 04900 00D63A 5A phy 04901 00D63B DA phx 04902 00D63C 48 pha 04903 ; 04904 ;————————————————————————————————————————————————————————— 04905 ;STACK DEFINITIONS 04906 ; 04907 ; 04908 0001 .sfbase .set 1 ;base stack index 04909 0001 .sfidx .set .sfbase ;workspace index 04910 ; 04911 ;———————> MPU register stack frame start <———————— 04912 0001 .reg_c =.sfidx ;.C 04913 0003 .sfidx .= .sfidx+s_word 04914 0003 .reg_x =.sfidx ;.X 04915 0005 .sfidx .= .sfidx+s_word 04916 0005 .reg_y =.sfidx ;.Y 04917 0007 .sfidx .= .sfidx+s_word 04918 0007 .reg_db =.sfidx ;DB 04919 0008 .sfidx .= .sfidx+s_mpudbx 04920 0008 .reg_sr =.sfidx ;SR 04921 0009 .sfidx .= .sfidx+s_mpusrx 04922 0009 .reg_pc =.sfidx ;PC 04923 000B .sfidx .= .sfidx+s_mpupcx 04924 ;————————> MPU register stack frame end <————————— 04925 ; 04926 000A .s_rsf =.sfidx-.sfbase ;register stack frame size 04927 000B .sfbase .= .sfidx 04928 ; 04929 ;—————————> parameter stack frame start <————————— 04930 000B .src =.sfidx ;string address 04931 000D .sfidx .= .sfidx+s_word 04932 ;——————————> parameter stack frame end <—————————— 04933 ; 04934 0002 .s_psf =.sfidx-.sfbase ;parameter stack frame size 04935 ;————————————————————————————————————————————————————————— 04936 ; 04937 00D63D D8 cld 04938 shortr 04939 00D63E E2 30 sep #%00110000 04940 longx 04941 00D640 C2 10 rep #%00010000 04942 00D642 A0 00 00 ldy !#0 04943 ; 04944 00D645 B3 0B .main lda (.src,s),y ;get from string 04945 00D647 F0 0C beq .done ;end of string 04946 ; 04947 00D649 20 4A D2 jsr putcha ;output datum 04948 00D64C C8 iny 04949 00D64D 10 F6 bpl .main ;get next 04950 ; 04951 00D64F A3 08 .main010 lda .reg_sr,s ;set carry... 04952 00D651 09 01 ora #sr_car ;to flag... 04953 00D653 83 08 sta .reg_sr,s ;an error 04954 ; 04955 .done longr 04956 00D655 C2 30 rep #%00110000 04957 00D657 18 clc 04958 00D658 3B tsc 04959 00D659 69 0A 00 adc !#.s_rsf 04960 00D65C AA tax 04961 00D65D 69 02 00 adc !#.s_psf 04962 00D660 A8 tay 04963 00D661 A9 09 00 lda !#.s_rsf-1 04964 00D664 44 00 00 mvp #0,#0 ;realign stack 04965 00D667 98 tya 04966 00D668 1B tcs 04967 00D669 68 pla ;restore MPU state 04968 00D66A FA plx 04969 00D66B 7A ply 04970 00D66C AB plb 04971 00D66D 28 plp 04972 00D66E 60 rts 04973 ; 04974 .end 04975 .include "scsi/scsiinit.asm" 04976 ;=============================================================================== 04977 ; 04978 ;CONFIGURE SCSI SUBSYSTEM 04979 ; 04980 scsiinit shortr ;8 bit everything 04981 00D66F E2 30 sep #%00110000 04982 00D671 64 4A stz scsihba ;clear "HBA present" flag 04983 00D673 A9 02 lda #sccrstc 04984 00D675 8D 03 C4 sta io_scsi+sr_cmd ;force controller reset 04985 .rept 10 ;wait for recovery 04986 00D678 CB wai 04987 00D679 CB wai 04988 00D67A CB wai 04989 00D67B CB wai 04990 00D67C CB wai 04991 00D67D CB wai 04992 00D67E CB wai 04993 00D67F CB wai 04994 00D680 CB wai 04995 00D681 CB wai 04996 00D682 A9 00 lda #sccnop ;write NOP to clear... 04997 00D684 8D 03 C4 sta io_scsi+sr_cmd ;the command register 04998 00D687 A9 80 lda #sccnopd ;write DMA NOP to test... 04999 00D689 8D 03 C4 sta io_scsi+sr_cmd ;command register retention 05000 00D68C CB wai 05001 00D68D CD 03 C4 cmp io_scsi+sr_cmd ;command retained? 05002 00D690 D0 3E bne .0000040 ;no, abort... 05003 ; 05004 ; ———————————————————————————————————————————————————————————————— 05005 ; The above test is sufficient to determine if the HBA is present. 05006 ; ———————————————————————————————————————————————————————————————— 05007 ; 05008 00D692 A2 0F ldx #fd_srsi-1 ;FIFO depth 05009 ; 05010 00D694 BD 53 EA .0000010 lda scfifotd,x ;stuff FIFO with... 05011 00D697 8D 02 C4 sta io_scsi+sr_fifo ;test data 05012 00D69A CA dex 05013 00D69B 10 F7 bpl .0000010 ;next 05014 ; 05015 00D69D AD 07 C4 lda io_scsi+sr_isrf ;get controller status 05016 00D6A0 29 1F and #c94isfct ;extract FIFO count 05017 00D6A2 C9 10 cmp #fd_srsi ;compare to expected count 05018 00D6A4 D0 2D bne .0000050 ;error, abort 05019 ; 05020 00D6A6 A2 0F ldx #fd_srsi-1 05021 ; 05022 00D6A8 AD 02 C4 .0000020 lda io_scsi+sr_fifo ;read from FIFO &... 05023 00D6AB DD 53 EA cmp scfifotd,x ;compare to test value 05024 00D6AE D0 23 bne .0000050 ;error, abort 05025 ; 05026 00D6B0 CA dex 05027 00D6B1 D0 F5 bne .0000020 ;next 05028 ; 05029 00D6B3 A9 01 lda #sccfifc ;clear test data... 05030 00D6B5 8D 03 C4 sta io_scsi+sr_cmd ;from FIFO 05031 00D6B8 A0 0A ldy #s_s94tab-s_word ;table size minus a word 05032 ; 05033 .0000030 longa 05034 00D6BA C2 20 rep #%00100000 05035 00D6BC B9 47 EA lda s94tab,y ;get register/parm 05036 shorta 05037 00D6BF E2 20 sep #%00100000 05038 00D6C1 AA tax ;register 05039 00D6C2 EB xba ;expose parameter &... 05040 00D6C3 9D 00 C4 sta io_scsi,x ;write to register 05041 decy s_word 05042 .if .n 05043 .rept .n 05044 00D6C6 88 dey 05045 00D6C7 88 dey 05046 .else 05047 00D6C8 10 F0 bpl .0000030 ;next register 05048 ; 05049 00D6CA 38 sec 05050 00D6CB 66 4A ror scsihba ;HBA is present 05051 00D6CD 4C F0 D9 jmp scsibrst ;reset SCSI bus & return 05052 ; 05053 00D6D0 A9 04 .0000040 lda #ed_cntrl ;not present/unresponsive 05054 .byte bitabs 05055 ; 05056 00D6D3 A9 05 .0000050 lda #ed_fifo ;FIFO retention 05057 00D6D5 38 sec 05058 00D6D6 60 rts 05059 ; 05060 .end 05061 .include "scsi/scsienum.asm" 05062 ;=============================================================================== 05063 ; 05064 ;scsienum: ENUMERATE SCSI DEVICES 05065 ; 05066 scsienum shortr 05067 00D6D7 E2 30 sep #%00110000 05068 00D6D9 A2 3F ldx #s_sd_tab-1 ;device table size 05069 ; 05070 00D6DB 9E 10 01 .0000010 stz scdevtab,x ;clear... 05071 00D6DE CA dex ;device... 05072 00D6DF 10 FA bpl .0000010 ;table 05073 ; 05074 00D6E1 A9 0B lda #rowenum 05075 00D6E3 85 50 sta scsierow ;set display starting row 05076 00D6E5 A9 00 lda #0 ;starting SCSI ID 05077 ; 05078 00D6E7 85 4F .0000020 sta scsiedev ;set current device 05079 00D6E9 C9 07 cmp #scsiid94 ;controller ID? 05080 00D6EB F0 70 beq .0000130 ;yes, skip it 05081 ; 05082 ; 05083 ; probe for device... 05084 ; 05085 00D6ED 20 DC D7 jsr scsiddid ;display current device 05086 00D6F0 A5 4F lda scsiedev 05087 00D6F2 20 52 D8 jsr testrdy ;dummy test... 05088 ; 05089 ; ————————————————————————————————————————————————————————— 05090 ; The dummy test should clear any power-on "unit attention" 05091 ; status in the device, if present. 05092 ; ————————————————————————————————————————————————————————— 05093 ; 05094 00D6F5 A5 4F lda scsiedev ;current device 05095 00D6F7 20 63 D8 jsr reqsens ;request sense data 05096 00D6FA B0 57 bcs .0000110 ;device not present 05097 ; 05098 00D6FC 20 72 D7 jsr enumptst ;request inquiry data 05099 00D6FF 90 03 bcc .0000030 ;got it 05100 ; 05101 00D701 F0 50 beq .0000110 ;device not present 05102 ; 05103 00D703 60 rts ;gross driver error — abort 05104 ; 05105 00D704 20 C0 D7 .0000030 jsr ssdstatf ;set device status fields 05106 00D707 20 E6 D7 jsr scsidpiq ;display inquiry data 05107 ; 05108 ; 05109 ; attempt to bring device on line... 05110 ; 05111 00D70A A9 0A lda #scsitrct ;load attempts 05112 00D70C 85 51 sta scsiztmp ;set counter 05113 ; 05114 00D70E A5 4F .0000040 lda scsiedev ;current device 05115 00D710 20 6D D8 jsr startlun ;spin up disk/load media 05116 00D713 90 12 bcc .0000050 ;ready 05117 ; 05118 00D715 C9 82 cmp #ed_check ;check condition? 05119 00D717 D0 20 bne .0000070 ;other exception, skip device 05120 ; 05121 00D719 C6 51 dec scsiztmp ;step count 05122 00D71B F0 27 beq .0000080 ;done, no medium 05123 ; 05124 00D71D A9 00 lda #0 05125 00D71F EB xba 05126 00D720 A9 02 lda #scsitrtd 05127 00D722 20 D5 D4 jsr utdelay ;delay &... 05128 00D725 80 E7 bra .0000040 ;try again 05129 ; 05130 ; 05131 ; get capacity & block size... 05132 ; 05133 00D727 A5 4F .0000050 lda scsiedev 05134 00D729 20 59 D8 jsr readcap ;get capacity 05135 00D72C 90 06 bcc .0000060 ;got it 05136 ; 05137 00D72E C9 82 cmp #ed_check ;check condition? 05138 00D730 F0 17 beq .0000090 ;yes, skip analysis 05139 ; 05140 00D732 80 05 bra .0000070 ;no, skip this device 05141 ; 05142 00D734 20 89 D7 .0000060 jsr anlyzcap ;analyze capacity data 05143 00D737 80 10 bra .0000090 ;device ready 05144 ; 05145 ; 05146 ; mark device not present... 05147 ; 05148 00D739 B2 4B .0000070 lda (scsididx) ;device status flag 05149 00D73B 29 7F and #c94irqsf ^ %11111111 05150 00D73D 92 4B sta (scsididx) ;clear present bit 05151 ; 05152 ; 05153 ; report device status... 05154 ; 05155 00D73F F4 5F F0 pea #sd_offl ;"Offline" 05156 00D742 80 08 bra .0000100 ;device invalid 05157 ; 05158 00D744 F4 76 F0 .0000080 pea #sd_nomed ;"No medium" 05159 00D747 80 03 bra .0000100 ;present but not ready 05160 ; 05161 00D749 F4 80 F0 .0000090 pea #sd_ready ;"Ready" 05162 ; 05163 00D74C 20 35 D6 .0000100 jsr sprint ;print status 05164 00D74F E6 50 inc scsierow ;bump display row 05165 00D751 80 08 bra .0000120 05166 ; 05167 00D753 A9 0D .0000110 lda #a_cr ;move cursor to... 05168 00D755 20 4A D2 jsr putcha ;beginning of row &... 05169 00D758 20 06 E7 jsr clearlin ;clear it 05170 ; 05171 00D75B A5 4F .0000120 lda scsiedev ;current device 05172 ; 05173 00D75D 1A .0000130 inc ;next device 05174 00D75E C9 08 cmp #n_scsiid ;tested all of them? 05175 00D760 90 85 bcc .0000020 ;no, try next device 05176 ; 05177 00D762 AA tax ;last ID checked 05178 ; 05179 00D763 38 .0000140 sec ;assume no device 05180 00D764 CA dex ;previous device 05181 00D765 30 08 bmi .0000150 ;all checked 05182 ; 05183 00D767 8A txa ;current device 05184 00D768 20 0B DA jsr sslotptr ;set slot pointer 05185 00D76B B2 4B lda (scsididx) ;test enum flag 05186 00D76D 10 F4 bpl .0000140 ;device not enumerated... 05187 ; 05188 ; ————————————————————————————————————————————————— 05189 ; If the device was enumerated then we fall through 05190 ; with carry cleared to indicate that at least one 05191 ; SCSI device is present. 05192 ; ————————————————————————————————————————————————— 05193 ; 05194 00D76F C2 80 .0000150 rep #sr_neg ;clear .N 05195 00D771 60 rts 05196 ; 05197 .end 05198 .include "scsi/enumptst.asm" 05199 ;================================================================================ 05200 ; 05201 ;enumptst: SCSI ENUMERATION PRESENCE TEST 05202 ; 05203 ; —————————————————————————————————————————————— 05204 ; Preparatory Ops : SCSIEDEV = device ID 05205 ; 05206 ; Register Returns: .A: see notes 05207 ; .B: used 05208 ; .X: used 05209 ; .Y: used 05210 ; 05211 ; MPU Flags: NVmxDIZC 05212 ; |||||||| 05213 ; |||||||+———> see notes 05214 ; ||||||+————> see notes 05215 ; |||||+—————> 0 05216 ; ||||+——————> 0 05217 ; |||+———————> 1 05218 ; ||+————————> 1 05219 ; |+—————————> 0 05220 ; +——————————> see notes 05221 ; 05222 ; Notes: 1) Status is flagged as follows: 05223 ; 05224 ; .C .Z condition 05225 ; ------------------------------------ 05226 ; 0 0 device present & ready 05227 ; 0 1 check condition 05228 ; 1 0 driver exception, code in .A 05229 ; 1 1 device not present 05230 ; ------------------------------------ 05231 ; —————————————————————————————————————————————— 05232 ; 05233 00D772 A5 4F enumptst lda scsiedev ;current device 05234 00D774 20 48 D8 jsr inquiry ;request device data 05235 00D777 90 0F bcc .0000020 ;gotten 05236 ; 05237 00D779 C9 80 cmp #ed_devnp ;device not present? 05238 00D77B F0 0B beq .0000020 ;no 05239 ; 05240 00D77D C9 82 cmp #ed_check ;check condition? 05241 00D77F F0 05 beq .0000010 ;yes, not an error 05242 ; 05243 00D781 E2 01 sep #sr_car ;flag a... 05244 00D783 C2 02 rep #sr_zer ;driver exception 05245 00D785 60 rts 05246 ; 05247 00D786 C2 01 .0000010 rep #sr_car ;device present/check condition 05248 ; 05249 00D788 60 .0000020 rts 05250 ; 05251 .end 05252 .include "scsi/anlyzcap.asm" 05253 ;================================================================================ 05254 ; 05255 ;anlyzcap: analyze SCSI device capacity 05256 ; 05257 ; —————————————————————————————————————————————— 05258 ; Preparatory Ops : SCSI work area loaded with 05259 ; device capacity parameters. 05260 ; SCSIDIDX = device table slot 05261 ; 05262 ; Register Returns: .A: used 05263 ; .B: used 05264 ; .X: entry value 05265 ; .Y: used 05266 ; 05267 ; MPU Flags: NVmxDIZC 05268 ; |||||||| 05269 ; ||||++++———> undefined 05270 ; |||+———————> 1 05271 ; ||+————————> 1 05272 ; ++—————————> undefined 05273 ; —————————————————————————————————————————————— 05274 ; 05275 anlyzcap longa 05276 00D789 C2 20 rep #%00100000 05277 00D78B AD 50 01 lda scmiswrk+rc_lbahi ;maximum LBA MSW 05278 00D78E EB xba ;reverse endianess &... 05279 00D78F 48 pha ;save 05280 00D790 C9 20 00 cmp !#lbamsw32 ;maximum LBA > 21 bits? 05281 00D793 90 0C bcc .0000010 ;no 05282 ; 05283 shorta ;yes 05284 00D795 E2 20 sep #%00100000 05285 00D797 A0 01 ldy #o_sdtype ;point at device type 05286 00D799 B1 4B lda (scsididx),y ;get device type &... 05287 00D79B 09 80 ora #c94irqsf ;set extended... 05288 00D79D 91 4B sta (scsididx),y ;LBA bit 05289 longa 05290 00D79F C2 20 rep #%00100000 05291 ; 05292 00D7A1 18 .0000010 clc 05293 00D7A2 A0 02 ldy #o_sdcap ;point at capacity LSW 05294 00D7A4 AD 52 01 lda scmiswrk+rc_lbalo ;maximum LBA LSW 05295 00D7A7 EB xba ;reverse endianess 05296 00D7A8 69 01 00 adc !#s_byte ;actual capacity LSW 05297 00D7AB 91 4B sta (scsididx),y ;save capacity LSW 05298 incy s_word 05299 .if .n 05300 .rept .n 05301 00D7AD C8 iny 05302 00D7AE C8 iny 05303 .else 05304 00D7AF 68 pla ;recover maximum LBA MSW 05305 00D7B0 69 00 00 adc !#0 ;actual capacity MSW 05306 00D7B3 91 4B sta (scsididx),y ;save capacity LBA MSW 05307 00D7B5 A0 06 ldy #o_sdbsiz ;point at block size LSW 05308 00D7B7 AD 56 01 lda scmiswrk+rc_bszlo ;block size LSW 05309 00D7BA EB xba ;reverse endianess 05310 00D7BB 91 4B sta (scsididx),y ;save block size LSW... 05311 ; 05312 ; ————————————————————————————————————————————————————— 05313 ; The block size MSW is not saved, as it isn't possible 05314 ; to read or write a block size greater than 64 KB. In 05315 ; most cases, the block size will be 512 or 2048. 05316 ; ————————————————————————————————————————————————————— 05317 ; 05318 shortr 05319 00D7BD E2 30 sep #%00110000 05320 00D7BF 60 rts 05321 ; 05322 .end 05323 .include "scsi/ssdstatf.asm" 05324 ;================================================================================ 05325 ; 05326 ;ssdstatf: SET SCSI DEVICE STATUS FIELDS 05327 ; 05328 ; ——————————————————————————————————————————————— 05329 ; Preparatory Ops : device data in SCSI work area 05330 ; SCSIDIDX = device table slot 05331 ; 05332 ; Register Returns: .A: used 05333 ; .B: entry value 05334 ; .X: entry value 05335 ; .Y: used 05336 ; 05337 ; MPU Flags: NVmxDIZC 05338 ; |||||||| 05339 ; ++++++++———> undefined 05340 ; ——————————————————————————————————————————————— 05341 ; 05342 00D7C0 AD 52 01 ssdstatf lda scmiswrk+iq_ansiv ;version field 05343 00D7C3 29 07 and #iqvendr ;isolate ANSI type bits 05344 00D7C5 09 80 ora #c94irqsf ;mark device present 05345 00D7C7 92 4B sta (scsididx) ;set device flag in table 05346 00D7C9 AD 57 01 lda scmiswrk+iq_flags 05347 00D7CC 29 10 and #iqsynctr ;sync data transfer flag 05348 00D7CE 0A asl 05349 00D7CF 0A asl 05350 00D7D0 12 4B ora (scsididx) ;add flag to ANSI type &... 05351 00D7D2 92 4B sta (scsididx) ;store 05352 00D7D4 A0 01 ldy #o_sdtype ;type table slot offset 05353 00D7D6 AD 50 01 lda scmiswrk ;device type field 05354 00D7D9 91 4B sta (scsididx),y ;store device type 05355 00D7DB 60 rts 05356 ; 05357 .end 05358 .include "scsi/scsiddid.asm" 05359 ;================================================================================ 05360 ; 05361 ;scsiddid: DISPLAY ENUMERATION DEVICE ID 05362 ; 05363 00D7DC 20 22 D8 scsiddid jsr scsipdid ;position to ID field 05364 00D7DF A5 4F lda scsiedev ;current device number 05365 00D7E1 09 30 ora #btoamask ;change to ASCII 05366 00D7E3 4C 4A D2 jmp putcha ;display SCSI ID 05367 ; 05368 .end 05369 .include "scsi/scsidpiq.asm" 05370 ;================================================================================ 05371 ; 05372 ;scsidpiq: DISPLAY INQUIRY DATA 05373 ; 05374 00D7E6 A2 06 scsidpiq ldx #colvendr ;vendor column 05375 00D7E8 A4 50 ldy scsierow ;device row 05376 00D7EA 20 09 D6 jsr plot ;position cursor 05377 00D7ED A2 08 ldx #iq_vendr ;offset to vendor ID 05378 00D7EF A0 08 ldy #s_vendr ;vendor ID field size 05379 ; 05380 00D7F1 BD 50 01 .0000010 lda scmiswrk,x ;get char 05381 00D7F4 20 4A D2 jsr putcha ;print it 05382 00D7F7 E8 inx 05383 00D7F8 88 dey 05384 00D7F9 D0 F6 bne .0000010 05385 ; 05386 00D7FB E0 24 cpx #iq_vendr+s_vendr+s_sspid+s_revsn 05387 00D7FD F0 1C beq .0000020 ;done with ID stuff 05388 ; 05389 00D7FF DA phx ;save string index 05390 00D800 A2 10 ldx #colprod ;product ID column 05391 00D802 A4 50 ldy scsierow ;device row 05392 00D804 20 09 D6 jsr plot ;position cursor 05393 00D807 FA plx ;get string index 05394 00D808 A0 10 ldy #s_sspid ;product ID field size 05395 00D80A E0 10 cpx #iq_vendr+s_vendr ;last field the vendor? 05396 00D80C F0 E3 beq .0000010 ;yes, print product ID 05397 ; 05398 00D80E DA phx 05399 00D80F A2 22 ldx #colvers ;revision field column 05400 00D811 A4 50 ldy scsierow ;device row 05401 00D813 20 09 D6 jsr plot ;position cursor 05402 00D816 FA plx 05403 00D817 A0 04 ldy #s_revsn ;revision field size 05404 00D819 80 D6 bra .0000010 ;print revision 05405 ; 05406 00D81B A2 29 .0000020 ldx #colstat 05407 00D81D A4 50 ldy scsierow 05408 00D81F 4C 09 D6 jmp plot ;position to status column 05409 ; 05410 .end 05411 .include "scsi/scsipdid.asm" 05412 ;================================================================================ 05413 ; 05414 ;scsipdid: POSITION TO ENUMERATION DEVICE ID FIELD 05415 ; 05416 00D822 A2 03 scsipdid ldx #colid+1 ;device ID column 05417 00D824 A4 50 ldy scsierow ;device row 05418 00D826 4C 09 D6 jmp plot ;position cursor 05419 ; 05420 .end 05421 .include "scsi/scsiparm.asm" 05422 ;=============================================================================== 05423 ; 05424 ;scsiparm: RETURN SCSI DEVICE PARAMETERS FROM ENUMERATION TABLE 05425 ; 05426 ; ——————————————————————————————————————————————————————————— 05427 ; Preparatory Ops : .A: 8 bit SCSI ID 05428 ; .X: workspace address (1) 05429 ; 05430 ; Register Returns: .A: used 05431 ; .B: used 05432 ; .X: entry value 05433 ; .Y: used 05434 ; DB: entry value 05435 ; DP: entry value 05436 ; PB: entry value 05437 ; 05438 ; MPU Flags: NVmxDIZC 05439 ; |||||||| 05440 ; |||||||+———> 0: okay 05441 ; ||||||| 1: SCSI ID out of range 05442 ; ||||||+————> undefined 05443 ; |||||+—————> entry value 05444 ; |||++——————> 0 05445 ; ||+————————> 1 05446 ; ++—————————> undefined 05447 ; 05448 ; Notes: 1) This function copies the device table parameters 05449 ; associated with the SCSI ID passed in .A to work- 05450 ; space pointed to by .X. The workspace must be 05451 ; sized to 8 bytes minimum. 05452 ; 2) This function does not check the logged device 05453 ; information in any way. 05454 ; ——————————————————————————————————————————————————————————— 05455 ; 05456 scsiparm longr ;force 16 bits 05457 00D829 C2 30 rep #%00110000 05458 00D82B 0B phd ;save current direct page 05459 00D82C 48 pha ;protect ID 05460 00D82D A9 00 00 lda !#kerneldp 05461 00D830 5B tcd ;set kernel direct page 05462 00D831 68 pla ;recover ID 05463 00D832 20 0B DA jsr sslotptr ;get device table pointer 05464 00D835 B0 0F bcs .0000020 ;ID out of range — error 05465 ; 05466 00D837 DA phx ;save workspace pointer 05467 ; 05468 ;——————————————————————————————— 05469 0001 .wrkspc =1 ;workspace pointer stack offset 05470 ;——————————————————————————————— 05471 ; 05472 shortx 05473 00D838 E2 10 sep #%00010000 05474 00D83A A0 07 ldy #s_sdslot-1 ;device table slot index 05475 ; 05476 00D83C B1 4B .0000010 lda (scsididx),y ;get from device table &... 05477 00D83E 93 01 sta (.wrkspc,s),y ;write to workspace 05478 00D840 88 dey 05479 00D841 10 F9 bpl .0000010 ;next 05480 ; 05481 longx 05482 00D843 C2 10 rep #%00010000 05483 00D845 FA plx ;clean up stack 05484 ; 05485 00D846 2B .0000020 pld 05486 00D847 60 rts 05487 ; 05488 .end 05489 .include "scsi/inquiry.asm" 05490 ;=============================================================================== 05491 ; 05492 ;inquiry: EXECUTE "INQUIRY" SCSI COMMAND 05493 ; 05494 ; —————————————————————————————————————————————— 05495 ; Preparatory Ops : .A: 8 bit SCSI ID 05496 ; 05497 ; Register Returns: see SCSICMD for all returns 05498 ; —————————————————————————————————————————————— 05499 ; 05500 inquiry longx 05501 00D848 C2 10 rep #%00010000 05502 00D84A A2 A9 E9 ldx !#cdinqry ;CDB address 05503 00D84D A0 50 01 ldy !#scmiswrk ;buffer 05504 00D850 80 20 bra scsicmd 05505 ; 05506 .end 05507 .include "scsi/testrdy.asm" 05508 ;=============================================================================== 05509 ; 05510 ;testrdy: EXECUTE "TEST UNIT READY" SCSI COMMAND 05511 ; 05512 ; —————————————————————————————————————————————— 05513 ; Preparatory Ops : .A: 8 bit SCSI ID 05514 ; 05515 ; Register Returns: see SCSICMD for all returns 05516 ; —————————————————————————————————————————————— 05517 ; 05518 testrdy longx 05519 00D852 C2 10 rep #%00010000 05520 00D854 A2 BB E9 ldx !#cdtstrdy ;CDB address 05521 00D857 80 19 bra scsicmd 05522 ; 05523 .end 05524 .include "scsi/readcap.asm" 05525 ;=============================================================================== 05526 ; 05527 ;readcap: EXECUTE "READ CAPACITY" SCSI COMMAND 05528 ; 05529 ; —————————————————————————————————————————————— 05530 ; Preparatory Ops : .A: 8 bit SCSI ID 05531 ; 05532 ; Register Returns: see SCSICMD for all returns 05533 ; —————————————————————————————————————————————— 05534 ; 05535 readcap longx 05536 00D859 C2 10 rep #%00010000 05537 00D85B A2 9F E9 ldx !#cdgetcap ;CDB address 05538 00D85E A0 50 01 ldy !#scmiswrk ;buffer address 05539 00D861 80 0F bra scsicmd 05540 ; 05541 .end 05542 .include "scsi/reqsens.asm" 05543 ;=============================================================================== 05544 ; 05545 ;reqsens: EXECUTE "REQUEST SENSE" SCSI COMMAND 05546 ; 05547 ; —————————————————————————————————————————————— 05548 ; Preparatory Ops : .A: 8 bit SCSI ID 05549 ; 05550 ; Register Returns: see SCSICMD for all returns 05551 ; —————————————————————————————————————————————— 05552 ; 05553 reqsens longx 05554 00D863 C2 10 rep #%00010000 05555 00D865 A2 AF E9 ldx !#cdreqsns ;CDB address 05556 00D868 A0 50 01 ldy !#scmiswrk ;buffer 05557 00D86B 80 05 bra scsicmd 05558 ; 05559 .end 05560 .include "scsi/startlun.asm" 05561 ;=============================================================================== 05562 ; 05563 ;startlun: EXECUTE "START UNIT" SCSI COMMAND 05564 ; 05565 ; —————————————————————————————————————————————— 05566 ; Preparatory Ops : .A: 8 bit SCSI ID 05567 ; 05568 ; Register Returns: see SCSICMD for all returns 05569 ; —————————————————————————————————————————————— 05570 ; 05571 startlun longx 05572 00D86D C2 10 rep #%00010000 05573 00D86F A2 B5 E9 ldx !#cdstrunt ;CDB address 05574 ; 05575 .end 05576 .include "scsi/scsicmd.asm" 05577 ;=============================================================================== 05578 ; 05579 ;scsicmd: EXECUTE SCSI COMMAND 05580 ; 05581 ; ———————————————————————————————————————————————————————————————————————— 05582 ; Preparatory Ops : .A: 8 bits: target device SCSI ID 05583 ; .X: 16 bits: command descriptor block address 05584 ; .Y: 16 bits: buffer address (1) 05585 ; 05586 ; Register Returns: .A: exit code (2,3) 05587 ; .B: $00 05588 ; .X: used 05589 ; .Y: used 05590 ; DB: entry value 05591 ; DP: entry value 05592 ; PB: entry value 05593 ; 05594 ; MPU Flags: NVmxDIZC 05595 ; |||||||| 05596 ; |||||||+———> 0: okay (2) 05597 ; ||||||| 1: exception (3) 05598 ; ||||||+————> reflects exit code 05599 ; ||||++—————> 0 05600 ; ||++———————> 1 05601 ; ++—————————> undefined 05602 ; 05603 ; Example: 05604 ; 05605 ; Notes: 1) .Y is "don't care" if the command doesn't require access to a 05606 ; buffer. 05607 ; 05608 ; 2) If no error exists $00 will be returned in .A. 05609 ; 05610 ; 3) If an exception is flagged one of the following error codes 05611 ; will be returned in .A: 05612 ; 05613 ; ED_DEVID — invalid SCSI ID (range) 05614 ; ED_DEVNE — device not enumerated 05615 ; ED_USFUN — unsupported driver function 05616 ; ED_USGRP — unsupported command group 05617 ; ED_USPHS — unsupported bus phase 05618 ; ED_DEVNP — device not present 05619 ; ED_ABORT — aborted transaction 05620 ; ED_CHECK — check condition 05621 ; ED_CNTRL — general controller error¹ 05622 ; ED_FIFO — FIFO count error 05623 ; ED_ILCMD — illegal controller command 05624 ; ED_RESET — unexpected bus reset 05625 ; 05626 ; ¹Also returned if HBA was not detected during SCSI subsys- 05627 ; tem initialization. 05628 ; 05629 ; The above are defined in include_scsi/keys_driver.asm. DO NOT 05630 ; hard-code any of these definitions into any program. Use the 05631 ; INCLUDE file to define them. 05632 ; ———————————————————————————————————————————————————————————————————————— 05633 ; 05634 00D872 C2 FF scsicmd rep #%11111111 ;clear all SR flags 05635 00D874 0B phd ;save current DP 05636 00D875 5A phy ;save buffer address 05637 00D876 DA phx ;save CDB address 05638 ; 05639 ;————————————————————————————————————————————————————— 05640 0001 sccdbptr .= 1 ;CDB address 05641 0003 scbufptr .= sccdbptr+s_ptr ;buffer address 05642 0005 reg_dp .= scbufptr+s_ptr ;DP 05643 0007 scretadr .= reg_dp+s_word ;return address 05644 ;————————————————————————————————————————————————————— 05645 ; 05646 00D877 F4 00 00 pea #kerneldp 05647 00D87A 2B pld ;select kernel direct page 05648 00D87B 9C 0A 01 stz ivscsi ;clear alternate vector 05649 shortr 05650 00D87E E2 30 sep #%00110000 05651 00D880 24 4A bit scsihba ;host adapter present? 05652 00D882 10 52 bpl ex_cntrl ;no, abort 05653 ; 05654 00D884 20 0B DA jsr sslotptr ;point at device table slot 05655 00D887 B0 56 bcs ex_devid ;invalid target ID — error 05656 ; 05657 00D889 AA tax ;protect target ID 05658 00D88A A0 00 ldy #so_opcod ;CDB opcode offset 05659 00D88C B3 01 lda (sccdbptr,s),y ;get opcode 05660 00D88E C9 12 cmp #sc_inqry ;inquiry? 05661 00D890 F0 0E beq .0000010 ;yes, skip enumeration check 05662 ; 05663 00D892 C9 03 cmp #sc_getsd ;request sense? 05664 00D894 F0 0A beq .0000010 ;yes, skip enumeration check 05665 ; 05666 00D896 C9 00 cmp #sc_tur ;test unit ready? 05667 00D898 F0 06 beq .0000010 ;yes, skip enumeration check 05668 ; 05669 00D89A EB xba ;protect opcode 05670 00D89B B2 4B lda (scsididx) ;check device status 05671 00D89D 10 43 bpl ex_devne ;not enumerated — error 05672 ; 05673 00D89F EB xba ;restore opcode 05674 ; 05675 ; 05676 ; check command group validity... 05677 ; 05678 00D8A0 29 E0 .0000010 and #grpmask ;isolate command group 05679 00D8A2 A0 03 ldy #n_scgrps-1 05680 ; 05681 00D8A4 D9 D1 E9 .0000030 cmp scgroups,y ;find the group 05682 00D8A7 F0 05 beq .0000040 ;found it 05683 ; 05684 00D8A9 88 dey 05685 00D8AA 10 F8 bpl .0000030 ;try another 05686 ; 05687 00D8AC 80 43 bra ex_usgrp ;invalid group — error 05688 ; 05689 00D8AE 84 4D .0000040 sty scsigidx ;save group index 05690 ; 05691 ; 05692 ; set up controller & initiate selection... 05693 ; 05694 00D8B0 A9 01 lda #sccfifc 05695 00D8B2 8D 03 C4 sta io_scsi+sr_cmd ;clear FIFO 05696 00D8B5 8E 04 C4 stx io_scsi+sr_sdid ;set target ID 05697 00D8B8 BE D5 E9 ldx scsizes,y ;use CDB size as counter 05698 00D8BB A0 00 ldy #0 ;CDB index 05699 ; 05700 00D8BD B3 01 .0000050 lda (sccdbptr,s),y ;load CDB... 05701 00D8BF 8D 02 C4 sta io_scsi+sr_fifo ;into FIFO 05702 00D8C2 C8 iny ;bump source index 05703 00D8C3 CA dex ;step counter 05704 00D8C4 D0 F7 bne .0000050 ;next 05705 ; 05706 00D8C6 A9 41 lda #sccsel ;select wo/ATN command 05707 ; 05708 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 05709 ; 05710 ;c94cmd: ISSUE COMMAND TO SCSI CONTROLLER 05711 ; 05712 ; ———————————————————————————————————————————————————————————— 05713 ; Upon entry the 8 bit controller command code must be in .A & 05714 ; any other controller setup steps, such as setting the target 05715 ; ID or priming the FIFO, must have been completed. 05716 ; ———————————————————————————————————————————————————————————— 05717 ; 05718 00D8C8 8D 03 C4 c94cmd sta io_scsi+sr_cmd ;issue controller command 05719 ; 05720 00D8CB CB .0000010 wai ;wait for controller... 05721 00D8CC 80 FD bra .0000010 ;response... 05722 ; 05723 ; ———————————————————————————————————————————————————————————————————— 05724 ; There's a possibility of deadlock here should the controller fail to 05725 ; generate an IRQ after be issued the command. The above loop will be 05726 ; terminated when the IRQ comes, as the SCSI ISR will revector the MPU 05727 ; to SCSICMDA or to an alternate location specified in IVSCSI. Should 05728 ; that IRQ never come...well, that's why there's a reset button. 05729 ; ———————————————————————————————————————————————————————————————————— 05730 ; 05731 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 05732 ; 05733 ;phinvald: PROCESS INVALID BUS PHASES 05734 ; 05735 00D8CE 20 05 DA phinvald jsr scsirstb ;force a bus reset 05736 00D8D1 80 21 bra ex_usphs ;invalid phase error 05737 ; 05738 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 05739 ; 05740 ;grosserr: SCSI HARDWARE FAILURE HANDLER 05741 ; 05742 00D8D3 20 05 DA grosserr jsr scsirstb ;force a bus reset 05743 ; 05744 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 05745 ; 05746 ;ERROR EXIT HANDLERS 05747 ; 05748 00D8D6 A9 04 ex_cntrl lda #ed_cntrl ;HBA not present/hardware failure 05749 .byte bitabs 05750 00D8D9 A9 81 ex_abort lda #ed_abort ;transaction aborted 05751 .byte bitabs 05752 00D8DC A9 82 ex_check lda #ed_check ;check condition 05753 .byte bitabs 05754 00D8DF A9 01 ex_devid lda #ed_devid ;invalid SCSI ID (range) 05755 .byte bitabs 05756 00D8E2 A9 02 ex_devne lda #ed_devne ;device not enumerated 05757 .byte bitabs 05758 00D8E5 A9 80 ex_devnp lda #ed_devnp ;device not present 05759 .byte bitabs 05760 00D8E8 A9 09 ex_ilcmd lda #ed_ilcmd ;illegal controller command 05761 .byte bitabs 05762 00D8EB A9 04 ex_reset lda #ed_cntrl ;unexpected bus reset 05763 .byte bitabs 05764 00D8EE A9 20 ex_usfun lda #ed_usfun ;unsupported driver function 05765 .byte bitabs 05766 00D8F1 A9 08 ex_usgrp lda #ed_usgrp ;unsupported command group 05767 .byte bitabs 05768 00D8F4 A9 11 ex_usphs lda #ed_usphs ;unsupported bus phase 05769 ; 05770 00D8F6 38 sec ;flag an error &... 05771 00D8F7 80 03 bra ex_comm ;exit 05772 ; 05773 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 05774 ; 05775 ;COMMON DRIVER EXIT 05776 ; 05777 00D8F9 A9 00 ex_okay lda #ed_okay ;okay exit code 05778 00D8FB 18 clc ;no error 05779 ; 05780 ex_comm longr 05781 00D8FC C2 30 rep #%00110000 05782 00D8FE FA plx ;clean up stack 05783 00D8FF 7A ply 05784 00D900 2B pld 05785 00D901 29 FF 00 and !#%11111111 ;clear .B/condition .Z 05786 shortr 05787 00D904 E2 30 sep #%00110000 05788 00D906 60 rts 05789 ; 05790 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 05791 ; 05792 ;scsicmda: CONTROLLER COMMAND COMPLETION ANALYSIS 05793 ; 05794 ; —————————————————————————————————————————————————————————— 05795 ; Upon entry, the following 8 bit controller register values 05796 ; are expected: 05797 ; 05798 ; .A: interrupt status: 05799 ; 05800 ; xxxxxxxx 05801 ; |||||||| 05802 ; |||||||+———> 1: selected 05803 ; ||||||+————> 1: selected w/attention 05804 ; |||||+—————> 1: reselected 05805 ; ||||+——————> 1: successful operation 05806 ; |||+———————> 1: service request 05807 ; ||+————————> 1: disconnected 05808 ; |+—————————> 1: invalid command 05809 ; +——————————> 1: bus reset 05810 ; 05811 ; .X: command state 05812 ; 05813 ; 0000xxxx 05814 ; |||| 05815 ; |+++———> internal state 05816 ; +——————> 0: sync offset register at maximum 05817 ; 05818 ; .Y: general status 05819 ; 05820 ; xxxxxxxx 05821 ; |||||||| 05822 ; |||||+++———> current bus phase 05823 ; ||||+——————> 1: valid group code 05824 ; |||+———————> 1: transfer count = zero 05825 ; ||+————————> 1: bus parity error 05826 ; |+—————————> 1: gross error 05827 ; +——————————> 1: interrupt pending 05828 ; —————————————————————————————————————————————————————————— 05829 ; 05830 00D907 89 07 scsicmda bit #c94resel | c94sela | c94sel 05831 00D909 D0 E3 bne ex_usfun ;function not supported 05832 ; 05833 00D90B 0A asl ;bus reset? 05834 00D90C B0 DD bcs ex_reset ;yes — error 05835 ; 05836 00D90E 0A asl ;illegal controller command? 05837 00D90F B0 D7 bcs ex_ilcmd ;yes — error 05838 ; 05839 00D911 0A asl ;disconnected? 05840 00D912 B0 0B bcs .0000010 ;yes, analyze cause 05841 ; 05842 00D914 0A asl ;bus service request? 05843 00D915 90 08 bcc .0000010 ;no, transaction completed 05844 ; 05845 00D917 98 tya ;general status 05846 00D918 29 07 and #c94phase ;isolate the bus phase 05847 00D91A 0A asl ;convert phase to... 05848 00D91B AA tax ;table index &... 05849 00D91C 7C C1 E9 jmp (scsiptab,x) ;execute function 05850 ; 05851 ; 05852 ; process bus disconnection... 05853 ; 05854 00D91F AD 03 C4 .0000010 lda io_scsi+sr_cmd ;was last controller... 05855 00D922 C9 41 cmp #sccsel ;command a select? 05856 00D924 F0 BF beq ex_devnp ;yes, device not present 05857 ; 05858 00D926 8A txa ;get command status 05859 00D927 29 07 and #c94isrst ;isolate state bits 05860 00D929 C9 04 cmp #c94issqc ;command steps completed? 05861 00D92B D0 A9 bne ex_cntrl ;no — controller error 05862 ; 05863 ; 05864 ; execute function completed steps... 05865 ; 05866 longa 05867 00D92D C2 20 rep #%00100000 05868 00D92F A9 3B D9 lda !#.0000020 ;where to return 05869 00D932 8D 0A 01 sta ivscsi ;set up vector 05870 shorta 05871 00D935 E2 20 sep #%00100000 05872 00D937 A9 12 lda #sccmsga ;message accepted 05873 00D939 80 8D bra c94cmd ;initiate command... 05874 ; 05875 ; ———————————————————————————————————————————————————————— 05876 ; For now, we're not analyzing the message. There's just 05877 ; not enough room in the ROM for the required code & data. 05878 ; ———————————————————————————————————————————————————————— 05879 ; 05880 00D93B A5 4E .0000020 lda scsistat ;last status 05881 00D93D F0 BA beq ex_okay ;okay 05882 ; 05883 00D93F C9 04 cmp #ss_cmet ;condition met? 05884 00D941 F0 B6 beq ex_okay ;yes 05885 ; 05886 00D943 C9 02 cmp #ss_check ;check condition? 05887 00D945 F0 95 beq ex_check ;yes 05888 ; 05889 00D947 80 90 bra ex_abort ;other status 05890 ; 05891 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 05892 ; 05893 ;phmesout: PROCESS MESSAGE-OUT PHASE 05894 ; 05895 phmesout longx 05896 00D949 C2 10 rep #%00010000 05897 00D94B A9 01 lda #s_mesg ;data size 05898 00D94D A2 74 01 ldx !#scsimesg ;where to get it 05899 00D950 20 DB D9 jsr dmaxfrit ;do DMA transfer setup 05900 00D953 80 1B bra ssxfrout ;goto DMA output function 05901 ; 05902 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 05903 ; 05904 ;phmesin: PROCESS MESSAGE-IN PHASE 05905 ; 05906 phmesin longx 05907 00D955 C2 10 rep #%00010000 05908 00D957 A9 01 lda #s_mesg ;data size 05909 00D959 A2 74 01 ldx !#scsimesg ;where to put it 05910 00D95C 20 DB D9 jsr dmaxfrit ;do DMA transfer setup 05911 00D95F 80 1F bra ssxfrin ;goto DMA input function 05912 ; 05913 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 05914 ; 05915 ;phstatus: PROCESS STATUS PHASE 05916 ; 05917 phstatus longx 05918 00D961 C2 10 rep #%00010000 05919 00D963 A9 01 lda #s_stat ;data size 05920 00D965 A2 4E 00 ldx !#scsistat ;where to put it 05921 00D968 20 DB D9 jsr dmaxfrit ;do DMA transfer setup 05922 00D96B 80 13 bra ssxfrin ;goto DMA input function 05923 ; 05924 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 05925 ; 05926 ;phdatout: PROCESS DATA OUT PHASE 05927 ; 05928 00D96D 20 8D D9 phdatout jsr dmaxfrsu ;do data phase setup 05929 ; 05930 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 05931 ; 05932 ;ssxfrout: DMA OUTPUT TRANSFER 05933 ; 05934 ; ——————————————————————————————————————————— 05935 ; Preparatory Ops : .X: 16 bit buffer pointer 05936 ; 05937 ; Register Returns: none 05938 ; ——————————————————————————————————————————— 05939 ; 05940 00D970 B5 00 ssxfrout lda mm_ram,x ;get datum 05941 00D972 E8 inx ;next buffer location 05942 ; 05943 00D973 2C 02 C6 .0000010 bit io_scsiq+sr_fifo ;FIFO full? 05944 00D976 10 FB bpl .0000010 ;yes 05945 ; 05946 00D978 8D 02 C5 sta io_scsid+sr_fifo ;no, store datum 05947 00D97B 80 F3 bra ssxfrout ;repeat 05948 ; 05949 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 05950 ; 05951 ;phdatin: PROCESS DATA IN PHASE 05952 ; 05953 00D97D 20 8D D9 phdatin jsr dmaxfrsu ;data phase setup 05954 ; 05955 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 05956 ; 05957 ;ssxfrin: DMA INPUT TRANSFER 05958 ; 05959 ; ——————————————————————————————————————————— 05960 ; Preparatory Ops : .X: 16 bit buffer pointer 05961 ; 05962 ; Register Returns: none 05963 ; ——————————————————————————————————————————— 05964 ; 05965 00D980 2C 02 C6 ssxfrin bit io_scsiq+sr_fifo ;FIFO empty? 05966 00D983 10 FB bpl ssxfrin ;yes, keep trying 05967 ; 05968 00D985 AD 02 C5 lda io_scsid+sr_fifo ;get &... 05969 00D988 95 00 sta mm_ram,x ;store datum 05970 00D98A E8 inx ;next buffer location 05971 00D98B 80 F3 bra ssxfrin ;repeat 05972 ; 05973 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 05974 ; 05975 ;dmaxfrsu: DMA TRANSFER SETUP 05976 ; 05977 dmaxfrsu shortr ;8 bit everything 05978 00D98D E2 30 sep #%00110000 05979 ; 05980 ;——————————————————————————————— 05981 0001 .retadr .set 1 ;return address 05982 0003 .cdbptr .set .retadr+s_ptr ;CDB address 05983 0005 .bufptr .set .cdbptr+s_ptr ;buffer address 05984 ;——————————————————————————————— 05985 ; 05986 00D98F A0 01 ldy #o_sdtype 05987 00D991 B1 4B lda (scsididx),y ;get device flag 05988 00D993 29 1F and #sdtmask ;extract device type 05989 00D995 C9 00 cmp #sd_da ;direct access? 05990 00D997 F0 04 beq .0000010 ;yes 05991 ; 05992 00D999 C9 05 cmp #sd_cdrom ;CD or DVD? 05993 00D99B D0 0E bne .0000030 ;no 05994 ; 05995 00D99D A0 00 .0000010 ldy #so_opcod ;CDB opcode offset 05996 00D99F B3 03 lda (.cdbptr,s),y ;get opcode from CDB 05997 00D9A1 A2 07 ldx #sctloset-sccsttab-1 05998 ; 05999 00D9A3 DD D9 E9 .0000020 cmp sccsttab,x ;compare to table 06000 00D9A6 F0 04 beq .0000040 ;translate transfer size 06001 ; 06002 00D9A8 CA dex 06003 00D9A9 10 F8 bpl .0000020 ;try next 06004 ; 06005 00D9AB 18 .0000030 clc ;don't translate size 06006 ; 06007 00D9AC A9 00 .0000040 lda #0 06008 00D9AE EB xba ;initialize .B 06009 00D9AF A6 4D ldx scsigidx ;get group index 06010 00D9B1 BC E1 E9 ldy sctloset,x ;get transfer size field offset 06011 00D9B4 BD E5 E9 lda scctztab,x ;get transfer size field size 06012 00D9B7 AA tax 06013 00D9B8 B3 03 lda (.cdbptr,s),y ;get transfer size 06014 00D9BA CA dex ;byte or word? 06015 00D9BB F0 04 beq .0000050 ;byte, hence no MSB 06016 ; 06017 00D9BD EB xba ;transfer size MSB 06018 00D9BE C8 iny ;point at & get... 06019 00D9BF B3 03 lda (.cdbptr,s),y ;transfer size LSB 06020 ; 06021 00D9C1 90 0F .0000050 bcc .0000070 ;no size conversion needed 06022 ; 06023 longr 06024 00D9C3 C2 30 rep #%00110000 06025 00D9C5 AA tax ;use transfer size as counter 06026 00D9C6 A9 00 00 lda !#0 ;start with no bytes 06027 00D9C9 A0 06 00 ldy !#o_sdbsiz ;block size index 06028 00D9CC 18 clc 06029 ; 06030 00D9CD 71 4B .0000060 adc (scsididx),y ;bytes = bytes + block size 06031 00D9CF CA dex ;step counter 06032 00D9D0 D0 FB bne .0000060 ;more blocks 06033 ; 06034 .0000070 longr 06035 00D9D2 C2 30 rep #%00110000 06036 00D9D4 A8 tay ;protect count 06037 00D9D5 A3 05 lda .bufptr,s ;get buffer address 06038 00D9D7 AA tax ;now RAM index 06039 00D9D8 98 tya ;get count & fall thru 06040 shorta 06041 00D9D9 E2 20 sep #%00100000 06042 ; 06043 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 06044 ; 06045 ;dmaxfrit: INITIATE A DMA TRANSFER 06046 ; 06047 ; ————————————————————————————————————————————— 06048 ; Preparatory Ops : .C: 16 bits: transfer count 06049 ; 06050 ; Register Returns: .A: used 06051 ; .B: used 06052 ; .X: entry value 06053 ; .Y: entry value 06054 ; 06055 ; MPU Flags: NVmxDIZC 06056 ; |||||||| 06057 ; ||||||++———> undefined 06058 ; |||||+—————> 1 06059 ; ||||+——————> 0 06060 ; |||+———————> 0 06061 ; ||+————————> 1 06062 ; ++—————————> undefined 06063 ; ————————————————————————————————————————————— 06064 ; 06065 00D9DB 8D 00 C4 dmaxfrit sta io_scsi+sr_stcl ;set transfer count LSB 06066 00D9DE EB xba 06067 00D9DF 8D 01 C4 sta io_scsi+sr_stch ;set transfer count MSB 06068 ; 06069 ; ———————————————————————————————————————————————————————— 06070 ; NOTE: A 16 bit write to the 'C94 transfer count register 06071 ; doesn't work due to yet-to-be-resolved hardware 06072 ; timing issues. 06073 ; ———————————————————————————————————————————————————————— 06074 ; 06075 00D9E2 A9 01 lda #sccfifc 06076 00D9E4 8D 03 C4 sta io_scsi+sr_cmd ;flush FIFO 06077 00D9E7 A9 00 lda #0 06078 00D9E9 EB xba ;clear .B 06079 00D9EA A9 90 lda #sccinfod ;DMA info xfer command 06080 00D9EC 8D 03 C4 sta io_scsi+sr_cmd ;initiate transfer 06081 00D9EF 60 rts 06082 ; 06083 ;=============================================================================== 06084 ; 06085 ;scsibrst: RESET SCSI BUS w/DEVICE RECOVERY DELAY 06086 ; 06087 scsibrst shorta 06088 00D9F0 E2 20 sep #%00100000 06089 00D9F2 20 05 DA jsr scsirstb 06090 00D9F5 A9 00 lda #0 06091 00D9F7 EB xba 06092 00D9F8 A9 05 lda #scsirdly ;recovery period 06093 00D9FA 4C D5 D4 jmp utdelay ;delay 06094 ; 06095 ;=============================================================================== 06096 ; 06097 ;scsihaid: REPORT HBA BUS ID 06098 ; 06099 scsihaid shorta 06100 00D9FD E2 20 sep #%00100000 06101 00D9FF AD 08 C4 lda io_scsi+sr_cr1 ;'CF94 control register 1 06102 00DA02 29 07 and #haidmask ;isolate bus ID bits 06103 00DA04 60 rts 06104 ; 06105 ;=============================================================================== 06106 ; 06107 ;scsirstb: RESET SCSI BUS 06108 ; 06109 00DA05 A9 03 scsirstb lda #sccrstb ;bus reset command 06110 00DA07 8D 03 C4 sta io_scsi+sr_cmd ;issue to controller 06111 00DA0A 60 rts 06112 ; 06113 .end 06114 .include "scsi/sslotptr.asm" 06115 ;=============================================================================== 06116 ; 06117 ;sslotptr: GET SCSI DEVICE TABLE SLOT POINTER 06118 ; 06119 ; —————————————————————————————————————————————————————— 06120 ; Preparatory Ops : .A: SCSI ID 06121 ; .B: "don't care"—will be masked 06122 ; 06123 ; Returns : slot pointer in SCSIDIDX if no error 06124 ; 06125 ; Register Returns: .A: entry value 06126 ; .B: 0 06127 ; .X: entry value 06128 ; .Y: entry value 06129 ; 06130 ; MPU Flags: NVmxDIZC 06131 ; |||||||| 06132 ; |||||||+———> 0: okay 06133 ; ||||||| 1: SCSI ID out of range 06134 ; ||||||+————> undefined 06135 ; |||||+—————> entry value 06136 ; ||||+——————> 0 06137 ; |||+———————> entry value 06138 ; ||+————————> 1 06139 ; ++—————————> undefined 06140 ; —————————————————————————————————————————————————————— 06141 ; 06142 00DA0B D8 sslotptr cld ;ensure binary mode 06143 longa ;16 bit .A 06144 00DA0C C2 20 rep #%00100000 06145 00DA0E 29 FF 00 and !#%11111111 ;get rid of noise 06146 00DA11 C9 08 00 cmp !#n_scsiid ;check ID 06147 00DA14 B0 0A bcs .0000010 ;out of range — error 06148 ; 06149 ; —————————————————————————————————————————————————————— 06150 ; The following code depends on the fact that the device 06151 ; table slot size has been atomically defined to be 2^n. 06152 ; —————————————————————————————————————————————————————— 06153 ; 06154 00DA16 48 pha ;save device ID 06155 .rept sdslotex ;multiply ID to get index 06156 00DA17 0A asl 06157 00DA18 0A asl 06158 00DA19 0A asl 06159 00DA1A 69 10 01 adc !#scdevtab ;add offset to base 06160 00DA1D 85 4B sta scsididx ;set up pointer 06161 00DA1F 68 pla ;recover ID 06162 ; 06163 .0000010 shorta 06164 00DA20 E2 20 sep #%00100000 06165 00DA22 60 rts 06166 ; 06167 .end 06168 .include "mon/816mon.asm" 06169 ;================================================================================ 06170 ; 06171 ;MACHINE LANGUAGE MONITOR — COLD START 06172 ; 06173 mon shortr 06174 00DA23 E2 30 sep #%00110000 06175 00DA25 F4 00 00 pea #kerneldp 06176 00DA28 2B pld ;set kernel direct page 06177 00DA29 A2 3F ldx #vopsflag-reg_pbx 06178 ; 06179 00DA2B 74 52 .0000010 stz reg_pbx,x ;clear working storage 06180 00DA2D CA dex 06181 00DA2E 10 FB bpl .0000010 06182 ; 06183 ; 06184 ; initialize shadow register storage... 06185 ; 06186 00DA30 A9 00 lda #srinit 06187 00DA32 85 55 sta reg_srx ;status register 06188 00DA34 A9 00 lda #kerneldb 06189 00DA36 48 pha 06190 00DA37 AB plb ;set kernel data bank 06191 00DA38 85 60 sta reg_dbx ;set DB shadow register 06192 longa ;16 bit .A 06193 00DA3A C2 20 rep #%00100000 06194 00DA3C A9 FF BF lda !#hwstack ;top of hardware stack 06195 00DA3F 1B tcs ;set SP 06196 00DA40 7B tdc 06197 00DA41 85 5E sta reg_dpx ;set DP shadow register 06198 ; 06199 ; 06200 ; announce presence... 06201 ; 06202 00DA43 F4 99 F0 pea #mm_entry ;"*MON" 06203 00DA46 80 23 bra moncom 06204 ; 06205 ;================================================================================ 06206 ; 06207 ;MACHINE LANGUAGE MONITOR — SOFTWARE INTERRUPT INTERCEPT 06208 ; 06209 ; ———————————————————————————————————————————————————————————————————————— 06210 ; This is the entry point taken when a BRK instruction is executed. It is 06211 ; assumed that the BRK handler has pushed the registers to the stack that 06212 ; are not automatically pushed by the MPU in response to BRK. 06213 ; 06214 ; COP is pointed here for now. 06215 ; ———————————————————————————————————————————————————————————————————————— 06216 ; 06217 monbrk longr ;store 16 bit registers 06218 00DA48 C2 30 rep #%00110000 06219 00DA4A 7A ply ;recover registers 06220 00DA4B FA plx 06221 00DA4C 68 pla 06222 00DA4D 85 56 sta reg_ax ;.C 06223 00DA4F 86 58 stx reg_xx ;.X 06224 00DA51 84 5A sty reg_yx ;.Y 06225 00DA53 F4 00 00 pea #kerneldp 06226 00DA56 2B pld ;set kernel direct page 06227 shortx ;8 bit index registers 06228 00DA57 E2 10 sep #%00010000 06229 00DA59 68 pla ;get DP &... 06230 00DA5A 85 5E sta reg_dpx ;store 06231 00DA5C FA plx ;get DB &... 06232 00DA5D 86 60 stx reg_dbx ;store 06233 00DA5F FA plx ;get SR &... 06234 00DA60 86 55 stx reg_srx ;store 06235 00DA62 68 pla ;get PC &... 06236 00DA63 85 53 sta reg_pcx ;store 06237 00DA65 FA plx ;get PB &... 06238 00DA66 86 52 stx reg_pbx ;store 06239 00DA68 F4 86 F0 pea #mm_brk ;"*BRK" 06240 ; 06241 ;================================================================================ 06242 ; 06243 ;MACHINE LANGUAGE MONITOR — COMMON ENTRY POINT 06244 ; 06245 ; —————————————————————————————————————————————————————————————————————— 06246 ; This entry point is common to both the cold start & software interrupt 06247 ; intercept startups. It prints either *MON or *BRK, stores the current 06248 ; stack pointer, sets up the status register & falls through to the reg- 06249 ; ister display. 06250 ; —————————————————————————————————————————————————————————————————————— 06251 ; 06252 00DA6B 58 moncom cli ;make sure IRQs are enabled 06253 00DA6C 20 35 D6 jsr sprint ;print entry banner 06254 longa 06255 00DA6F C2 20 rep #%00100000 06256 00DA71 3B tsc ;get SP &... 06257 00DA72 85 5C sta reg_spx ;store 06258 00DA74 C2 FE rep #%11111110 ;clear SR 06259 00DA76 38 sec ;see next 06260 ; 06261 ;================================================================================ 06262 ; 06263 ;DISPLAY MPU REGISTERS 06264 ; 06265 00DA77 B0 03 monreg bcs .0000010 ;okay to proceed 06266 ; 06267 00DA79 4C 36 DB jmp monerr ;error if called with a parm 06268 ; 06269 .0000010 printf mm_regs ;display register heading 06270 00DA7C F4 B7 F0 pea #.s 06271 00DA7F 20 35 D6 jsr sprint 06272 ; 06273 ; 06274 ; display program bank & counter... 06275 ; 06276 shortr 06277 00DA82 E2 30 sep #%00110000 06278 00DA84 20 A4 E7 jsr dpypbr ;display PB 06279 00DA87 20 C5 E7 jsr printspc ;inter-field space 06280 longa 06281 00DA8A C2 20 rep #%00100000 06282 00DA8C A5 53 lda reg_pcx 06283 shorta 06284 00DA8E E2 20 sep #%00100000 06285 00DA90 20 8A E7 jsr dpyhexw ;display PC 06286 00DA93 A2 02 ldx #2 06287 00DA95 20 A8 E7 jsr multspc ;inter-field spacing 06288 ; 06289 ; 06290 ; display SR in bitwise fashion... 06291 ; 06292 00DA98 A6 55 ldx reg_srx ;SR 06293 00DA9A A0 08 ldy #s_bibyte ;bits in a byte 06294 ; 06295 00DA9C 8A .0000020 txa ;remaining SR bits 06296 00DA9D 0A asl ;grab one of them 06297 00DA9E AA tax ;save remainder 06298 00DA9F A9 00 lda #0 ;a clear bit but... 06299 00DAA1 69 30 adc #'0' ;adjust if set &... 06300 00DAA3 20 4A D2 jsr putcha ;print 06301 00DAA6 88 dey ;bit processed 06302 00DAA7 D0 F3 bne .0000020 ;do another 06303 ; 06304 ; 06305 ; display .C, .X, .Y, SP & DP... 06306 ; 06307 00DAA9 20 C5 E7 .0000030 jsr printspc ;spacing 06308 longa 06309 00DAAC C2 20 rep #%00100000 06310 00DAAE B9 56 00 lda reg_ax,y ;get register value 06311 shorta 06312 00DAB1 E2 20 sep #%00100000 06313 00DAB3 20 8A E7 jsr dpyhexw ;convert & display 06314 incy s_word 06315 .if .n 06316 .rept .n 06317 00DAB6 C8 iny 06318 00DAB7 C8 iny 06319 .else 06320 00DAB8 C0 0A cpy #reg_dbx-reg_ax 06321 00DABA 90 ED bcc .0000030 ;next 06322 ; 06323 ; 06324 ; display DB & IRQ vector... 06325 ; 06326 00DABC 20 C5 E7 jsr printspc ;more spacing 06327 00DABF A5 60 lda reg_dbx ;get DB &... 06328 00DAC1 20 9A E7 jsr dpyhex ;display it 06329 00DAC4 20 C5 E7 jsr printspc ;more spacing 06330 longa 06331 00DAC7 C2 20 rep #%00100000 06332 00DAC9 AD 06 01 lda ivirq ;IRQ vector 06333 shorta 06334 00DACC E2 20 sep #%00100000 06335 00DACE 20 8A E7 jsr dpyhexw ;convert & display 06336 ; 06337 ;================================================================================ 06338 ; 06339 ;MACHINE LANGUAGE MONITOR — COMMAND EXECUTIVE 06340 ; 06341 monce shorta 06342 00DAD1 E2 20 sep #%00100000 06343 00DAD3 A9 00 lda #0 ;default buffer index 06344 ; 06345 moncea longx 06346 00DAD5 C2 10 rep #%00010000 06347 00DAD7 A6 5C ldx reg_spx ;rebalance the... 06348 00DAD9 9A txs ;stack 06349 shortr 06350 00DADA E2 30 sep #%00110000 06351 00DADC 85 7F sta ibufidx ;(re)set buffer index 06352 printf mm_prmpt ;display input prompt 06353 00DADE F4 AC F0 pea #.s 06354 00DAE1 20 35 D6 jsr sprint 06355 ; 06356 00DAE4 20 1F E4 monceb jsr input ;wait for input 06357 ; 06358 00DAE7 20 7E E4 .0000010 jsr getcharc ;read from buffer 06359 00DAEA F0 E5 beq monce ;terminator, just loop 06360 ; 06361 00DAEC C9 20 cmp #a_blank 06362 00DAEE F0 F7 beq .0000010 ;strip leading blanks 06363 ; 06364 00DAF0 A2 0E ldx #n_mpctab-1 ;number of primary commands 06365 ; 06366 00DAF2 DD AB EA .0000020 cmp mpctab,x ;search primary command list 06367 00DAF5 D0 0E bne .0000040 06368 ; 06369 00DAF7 8A txa ;get index 06370 00DAF8 0A asl ;double for offset 06371 00DAF9 AA tax 06372 longa 06373 00DAFA C2 20 rep #%00100000 06374 00DAFC BD C0 EA lda mpcextab,x ;command address -1 06375 ; 06376 00DAFF 48 .0000030 pha ;prime the stack 06377 shorta 06378 00DB00 E2 20 sep #%00100000 06379 00DB02 4C D6 E2 jmp getparm ;evaluate parm & execute command 06380 ; 06381 00DB05 CA .0000040 dex 06382 00DB06 10 EA bpl .0000020 ;continue searching primary commands 06383 ; 06384 00DB08 A2 03 ldx #n_radix-1 ;number of radices 06385 ; 06386 00DB0A DD 12 EB .0000050 cmp radxtab,x ;search conversion command list 06387 00DB0D D0 03 bne .0000060 06388 ; 06389 00DB0F 4C 05 E1 jmp monenv ;convert & display parameter 06390 ; 06391 00DB12 CA .0000060 dex 06392 00DB13 10 F5 bpl .0000050 06393 ; 06394 00DB15 C9 21 cmp #scsipre ;SCSI command preamble? 06395 00DB17 D0 1F bne monerraa ;no, unknown command 06396 ; 06397 00DB19 20 7E E4 .0000070 jsr getcharc ;read next char from buffer 06398 00DB1C F0 1A beq monerraa ;no char — error 06399 ; 06400 00DB1E C9 20 cmp #a_blank 06401 00DB20 F0 F7 beq .0000070 ;ignore blanks 06402 ; 06403 00DB22 A2 05 ldx #n_spctab-1 ;number of SCSI commands 06404 ; 06405 00DB24 DD BA EA .0000080 cmp spctab,x ;search command table 06406 00DB27 D0 0A bne .0000090 06407 ; 06408 00DB29 8A txa ;get index 06409 00DB2A 0A asl ;double for offset 06410 00DB2B AA tax 06411 longa 06412 00DB2C C2 20 rep #%00100000 06413 00DB2E BD DE EA lda spcextab,x ;command address -1 06414 00DB31 80 CC bra .0000030 ;eval parm & execute command 06415 ; 06416 00DB33 CA .0000090 dex 06417 00DB34 10 EE bpl .0000080 06418 ; 06419 ;================================================================================ 06420 ; 06421 ;MACHINE LANGUAGE MONITOR — COMMON ERROR HANDLER 06422 ; 06423 monerr shortr ;8 bit registers 06424 00DB36 E2 30 sep #%00110000 06425 ; 06426 00DB38 20 53 E7 monerraa jsr dpyerr ;indicate an error 06427 00DB3B 80 94 bra monce ;return to input loop 06428 ; 06429 ;================================================================================ 06430 ; 06431 ;MACHINE LANGUAGE MONITOR — CLEAR CONSOLE SCREEN 06432 ; 06433 ; ————————— 06434 ; syntax: z 06435 ; ————————— 06436 ; 06437 00DB3D 90 F7 moncls bcc monerr ;no parameters allowed 06438 ; 06439 printf dc_cs ;clear console screen 06440 00DB3F F4 48 EE pea #.s 06441 00DB42 20 35 D6 jsr sprint 06442 00DB45 A9 2E lda #'.' ;prompt 06443 00DB47 20 4A D2 jsr putcha ;print it 06444 00DB4A 64 7F stz ibufidx ;reset buffer index 06445 00DB4C 80 96 bra monceb ;return to input loop 06446 ; 06447 .end 06448 .include "mon/cmd_code_assemble.asm" 06449 ;================================================================================ 06450 ; 06451 ;MACHINE LANGUAGE MONITOR — ASSEMBLE CODE 06452 ; 06453 ; ———————————————————————————————————————— 06454 ; syntax: A [] 06455 ; ———————————————————————————————————————— 06456 ; 06457 ;monasc: ASSEMBLE CODE 06458 ; 06459 ; ——————————————————————————————————————————————————————————————————————— 06460 ; syntax: A [] 06461 ; 06462 ; After a line of code has been successfully assembled it will be disass- 06463 ; embled & displayed, & the monitor will prompt with the next address to 06464 ; which code may be assembled. 06465 ; ——————————————————————————————————————————————————————————————————————— 06466 ; 06467 00DB4E 90 03 monasc bcc .0000020 ;assembly address entered 06468 ; 06469 00DB50 4C 36 DB .0000010 jmp monerr ;terminate w/error 06470 ; 06471 ; 06472 ; evaluate assembly address... 06473 ; 06474 00DB53 20 C6 E2 .0000020 jsr facasize ;check address... 06475 00DB56 C9 04 cmp #s_dword ;range 06476 00DB58 B0 F6 bcs .0000010 ;out of range — error 06477 ; 06478 00DB5A 20 A8 E2 jsr facaddra ;store assembly address 06479 ; 06480 ; 06481 ; initialize workspace... 06482 ; 06483 00DB5D A2 1F ldx #s_auxbuf-s_byte 06484 ; 06485 00DB5F 9E 46 02 .0000030 stz auxbuf,x ;clear addressing mode buffer 06486 00DB62 CA dex 06487 00DB63 D0 FA bne .0000030 06488 ; 06489 00DB65 A9 20 lda #a_blank 06490 00DB67 8D 46 02 sta auxbuf ;preamble placeholder 06491 00DB6A 20 31 E2 jsr clroper ;clear operand 06492 00DB6D 64 7E stz auxbufix ;reset addressing mode index 06493 00DB6F 64 8E stz flimflag ;clear forced long immediate 06494 00DB71 64 88 stz mnepck ;clear encoded... 06495 00DB73 64 89 stz mnepck+s_byte ;mnemonic workspace 06496 00DB75 64 91 stz vopsflag ;clear 8/16 or relative flag 06497 ; 06498 ; 06499 ; encode mnemonic... 06500 ; 06501 00DB77 A0 03 ldy #s_mnemon ;expected mnemonic size 06502 ; 06503 00DB79 20 10 E4 .0000040 jsr getcharw ;get from buffer wo/whitespace 06504 00DB7C D0 0A bne .0000060 ;gotten 06505 ; 06506 00DB7E C0 03 cpy #s_mnemon ;any input at all? 06507 00DB80 90 03 bcc .0000050 ;yes 06508 ; 06509 00DB82 4C D1 DA jmp monce ;no, abort further assembly 06510 ; 06511 00DB85 4C 25 DD .0000050 jmp monasc10 ;incomplete mnemonic — error 06512 ; 06513 00DB88 38 .0000060 sec 06514 00DB89 E9 3F sbc #a_mnecvt ;ASCII to binary factor 06515 00DB8B A2 05 ldx #n_shfenc ;shifts required to encode 06516 ; 06517 00DB8D 4A .0000070 lsr ;shift out a bit... 06518 00DB8E 66 89 ror mnepck+s_byte ;into... 06519 00DB90 66 88 ror mnepck ;encoded mnemonic 06520 00DB92 CA dex 06521 00DB93 D0 F8 bne .0000070 ;next bit 06522 ; 06523 00DB95 88 dey 06524 00DB96 D0 E1 bne .0000040 ;get next char 06525 ; 06526 ; 06527 ; test for copy instruction... 06528 ; 06529 longa ;16 bit load 06530 00DB98 C2 20 rep #%00100000 06531 00DB9A A5 88 lda mnepck ;packed menmonic 06532 00DB9C A2 54 ldx #opc_mvn ;MVN opcode 06533 00DB9E C9 DC 7D cmp !#mne_mvn ;is it MVN? 06534 00DBA1 F0 07 beq monasc01 ;yes 06535 ; 06536 00DBA3 A2 44 ldx #opc_mvp ;MVP opcode 06537 00DBA5 C9 DC 8D cmp !#mne_mvp ;is it MVP? 06538 00DBA8 D0 30 bne monasc02 ;no 06539 ; 06540 ; 06541 ; assemble copy instruction... 06542 ; 06543 00DBAA 86 8A monasc01 stx opcode ;store relevant opcode 06544 shorta 06545 00DBAC E2 20 sep #%00100000 06546 00DBAE 20 1F E3 jsr instdata ;get instruction data 06547 00DBB1 86 8D stx eopsize ;effective operand size 06548 00DBB3 E8 inx 06549 00DBB4 86 86 stx instsize ;instruction size 06550 00DBB6 A2 01 ldx #s_oper-s_word ;operand index 06551 00DBB8 86 8C stx xrtemp ;set it 06552 ; 06553 00DBBA 20 D8 E7 .0000010 jsr ascbin ;evaluate bank number 06554 00DBBD B0 50 bcs monasc04 ;conversion error 06555 ; 06556 00DBBF F0 4E beq monasc04 ;nothing returned — error 06557 ; 06558 00DBC1 20 C6 E2 jsr facasize ;bank must be... 06559 00DBC4 C9 02 cmp #s_word ;8 bits 06560 00DBC6 B0 47 bcs monasc04 ;it isn't — error 06561 ; 06562 00DBC8 A5 67 lda faca ;bank 06563 00DBCA A6 8C ldx xrtemp ;operand index 06564 00DBCC 95 7B sta operand,x ;store 06565 00DBCE C6 8C dec xrtemp ;index=index-1 06566 00DBD0 10 E8 bpl .0000010 ;get destination bank 06567 ; 06568 00DBD2 20 B0 E3 jsr getcharr ;should be no more input 06569 00DBD5 D0 38 bne monasc04 ;there is — error 06570 ; 06571 00DBD7 4C D5 DC jmp monasc08 ;finish MVN/MVP assembly 06572 ; 06573 ; 06574 ; continue with normal assembly... 06575 ; 06576 monasc02 shorta ;back to 8 bits 06577 00DBDA E2 20 sep #%00100000 06578 ; 06579 00DBDC 20 10 E4 monasc03 jsr getcharw ;get next char 06580 00DBDF F0 3D beq monasc06 ;EOI, no argument 06581 ; 06582 00DBE1 C9 21 cmp #amp_flim 06583 00DBE3 D0 0A bne .0000010 ;no forced long immediate 06584 ; 06585 00DBE5 A5 8E lda flimflag ;FLIM already set? 06586 00DBE7 D0 26 bne monasc04 ;yes — error 06587 ; 06588 00DBE9 A9 C0 lda #flimmask 06589 00DBEB 85 8E sta flimflag ;set flag &... 06590 00DBED 80 ED bra monasc03 ;get next char 06591 ; 06592 00DBEF C9 23 .0000010 cmp #amp_imm ;immediate mode? 06593 00DBF1 F0 08 beq .0000020 ;yes 06594 ; 06595 00DBF3 C9 28 cmp #amp_ind ;indirect mode? 06596 00DBF5 F0 04 beq .0000020 ;yes 06597 ; 06598 00DBF7 C9 5B cmp #amp_indl ;indirect long mode? 06599 00DBF9 D0 07 bne .0000030 ;no 06600 ; 06601 00DBFB 8D 46 02 .0000020 sta auxbuf ;set addressing mode preamble 06602 00DBFE E6 7E inc auxbufix ;bump aux buffer index &... 06603 00DC00 80 02 bra .0000040 ;evaluate operand 06604 ; 06605 00DC02 C6 7F .0000030 dec ibufidx ;position back to char 06606 ; 06607 00DC04 20 D8 E7 .0000040 jsr ascbin ;evaluate operand 06608 00DC07 D0 09 bne monasc05 ;evaluated 06609 ; 06610 00DC09 B0 04 bcs monasc04 ;conversion error 06611 ; 06612 00DC0B A5 7E lda auxbufix ;no operand...any preamble? 06613 00DC0D F0 0F beq monasc06 ;no, syntax is okay so far 06614 ; 06615 00DC0F 4C 25 DD monasc04 jmp monasc10 ;abort w/error 06616 ; 06617 00DC12 20 C6 E2 monasc05 jsr facasize ;size operand 06618 00DC15 C9 04 cmp #s_dword ;max is 24 bits 06619 00DC17 B0 F6 bcs monasc04 ;too big 06620 ; 06621 00DC19 85 8D sta eopsize ;save operand size 06622 00DC1B 20 BC E2 jsr facaoper ;store operand 06623 ; 06624 00DC1E C6 7F monasc06 dec ibufidx ;back to last char 06625 00DC20 A6 7E ldx auxbufix ;mode buffer index 06626 00DC22 D0 01 bne .0000010 ;preamble in buffer 06627 ; 06628 00DC24 E8 inx ;step past preamble position 06629 ; 06630 00DC25 20 7E E4 .0000010 jsr getcharc ;get a char w/forced UC 06631 00DC28 F0 0A beq .0000030 ;EOI 06632 ; 06633 00DC2A E0 20 cpx #s_auxbuf ;mode buffer full? 06634 00DC2C B0 E1 bcs monasc04 ;yes, too much input 06635 ; 06636 00DC2E 9D 46 02 .0000020 sta auxbuf,x ;store for comparison 06637 00DC31 E8 inx 06638 00DC32 D0 F1 bne .0000010 06639 ; 06640 ; 06641 ; evaluate mnemonic... 06642 ; 06643 00DC34 A2 5B .0000030 ldx #n_mnemon-1 ;starting mnemonic index 06644 ; 06645 00DC36 8A monasc07 txa ;convert index... 06646 00DC37 0A asl ;to offset 06647 00DC38 A8 tay ;now mnemonic table index 06648 longa ;16 bit compare 06649 00DC39 C2 20 rep #%00100000 06650 00DC3B B9 1F EB lda mnetab,y ;get mnemonic from table 06651 00DC3E C5 88 cmp mnepck ;compare to entered mnemonic 06652 shorta ;back to 8 bits 06653 00DC40 E2 20 sep #%00100000 06654 00DC42 F0 05 beq .0000020 ;match 06655 ; 06656 00DC44 CA .0000010 dex ;try next mnemonic 06657 00DC45 30 C8 bmi monasc04 ;unknown mnemonic — error 06658 ; 06659 00DC47 80 ED bra monasc07 ;keep going 06660 ; 06661 00DC49 86 88 .0000020 stx mnepck ;save mnemonic index 06662 00DC4B 8A txa 06663 00DC4C A2 00 ldx #0 ;trial opcode 06664 ; 06665 00DC4E DD D7 EB .0000030 cmp mnetabix,x ;search index table... 06666 00DC51 F0 05 beq .0000050 ;for a match 06667 ; 06668 00DC53 E8 .0000040 inx ;keep going until we... 06669 00DC54 D0 F8 bne .0000030 ;search entire table 06670 ; 06671 00DC56 80 B7 bra monasc04 ;this shouldn't happen! 06672 ; 06673 ; ————————————————————————————————————————————————————————————————————— 06674 ; If the mnemonic index table search fails then there is a coding error 06675 ; somewhere, as every entry in the mnemonic table is supposed to have a 06676 ; matching cardinal index. 06677 ; ————————————————————————————————————————————————————————————————————— 06678 ; 06679 ; 06680 ; evaluate addressing mode... 06681 ; 06682 00DC58 86 8A .0000050 stx opcode ;save trial opcode 06683 00DC5A 20 1F E3 jsr instdata ;get related instruction data 06684 00DC5D 85 91 sta vopsflag ;save 8/16 or relative flag 06685 00DC5F 86 8F stx iopsize ;operand size 06686 00DC61 E8 inx 06687 00DC62 86 86 stx instsize ;instruction size 06688 00DC64 A6 8A ldx opcode ;recover trial opcode 06689 00DC66 98 tya ;addressing mode 06690 00DC67 0A asl ;create table index 06691 00DC68 A8 tay 06692 longa 06693 00DC69 C2 20 rep #%00100000 06694 00DC6B B9 DB ED lda ms_lutab,y ;mode lookup table 06695 00DC6E 85 64 sta addrb ;set pointer 06696 shorta 06697 00DC70 E2 20 sep #%00100000 06698 00DC72 A0 00 ldy #0 06699 ; 06700 00DC74 B1 64 .0000060 lda (addrb),y ;table addressing mode 06701 00DC76 D9 46 02 cmp auxbuf,y ;entered addressing mode 06702 00DC79 F0 04 beq .0000080 ;okay so far 06703 ; 06704 00DC7B A5 88 .0000070 lda mnepck ;reload mnemonic index 06705 00DC7D 80 D4 bra .0000040 ;wrong opcode for addresing mode 06706 ; 06707 00DC7F 09 00 .0000080 ora #0 ;last char the terminator? 06708 00DC81 F0 03 beq .0000090 ;yes, evaluate operand 06709 ; 06710 00DC83 C8 iny 06711 00DC84 80 EE bra .0000060 ;keep testing 06712 ; 06713 ; 06714 ; evaluate operand... 06715 ; 06716 00DC86 A5 8D .0000090 lda eopsize ;entered operand size 06717 00DC88 D0 06 bne .0000100 ;non-zero 06718 ; 06719 00DC8A 05 8F ora iopsize ;instruction operand size 06720 00DC8C D0 ED bne .0000070 ;wrong opcode — keep trying 06721 ; 06722 00DC8E 80 45 bra monasc08 ;assemble instruction 06723 ; 06724 00DC90 24 91 .0000100 bit vopsflag ;is this a branch? 06725 00DC92 70 3A bvs .0000160 ;yes, evaluate 06726 ; 06727 00DC94 A5 8F lda iopsize ;instruction operand size 06728 00DC96 24 91 bit vopsflag ;variable size operand allowed? 06729 00DC98 30 15 bmi .0000130 ;yes 06730 ; 06731 00DC9A 24 8E bit flimflag ;was forced immediate set? 06732 00DC9C 10 03 bpl .0000110 ;no 06733 ; 06734 00DC9E 4C 25 DD jmp monasc10 ;yes — error 06735 ; 06736 00DCA1 C5 8D .0000110 cmp eopsize ;entered operand size 06737 00DCA3 90 D6 bcc .0000070 ;operand too big 06738 ; 06739 00DCA5 85 8D sta eopsize ;new operand size 06740 00DCA7 80 2C bra monasc08 ;assemble, otherwise... 06741 ; 06742 00DCA9 C5 8D .0000120 cmp eopsize ;exact size match required 06743 00DCAB D0 CE bne .0000070 ;mismatch — wrong opcode 06744 ; 06745 00DCAD 80 26 bra monasc08 ;assemble 06746 ; 06747 ; 06748 ; process variable size immediate mode operand... 06749 ; 06750 00DCAF A6 8D .0000130 ldx eopsize ;entered operand size 06751 00DCB1 E0 03 cpx #s_xword ;check size 06752 00DCB3 B0 70 bcs monasc10 ;too big — error 06753 ; 06754 00DCB5 24 8E bit flimflag ;forced long immediate? 06755 00DCB7 10 06 bpl .0000140 ;no 06756 ; 06757 00DCB9 A2 02 ldx #s_word ;promote operand size to... 06758 00DCBB 86 8D stx eopsize ;16 bits 06759 00DCBD 80 08 bra .0000150 06760 ; 06761 00DCBF E0 02 .0000140 cpx #s_word ;16 bits? 06762 00DCC1 D0 04 bne .0000150 ;no 06763 ; 06764 00DCC3 A0 C0 ldy #flimmask ;yes so force long... 06765 00DCC5 84 8E sty flimflag ;immediate disassembly 06766 ; 06767 00DCC7 1A .0000150 inc ;new instruction operand size 06768 00DCC8 C5 8D cmp eopsize ;compare against operand size 06769 00DCCA 90 AF bcc .0000070 ;mismatch — can't assemble 06770 ; 06771 00DCCC 80 07 bra monasc08 ;okay, assemble 06772 ; 06773 ; 06774 ; process relative branch... 06775 ; 06776 00DCCE 20 6B E3 .0000160 jsr targoff ;compute branch offset 06777 00DCD1 B0 52 bcs monasc10 ;branch out of range 06778 ; 06779 00DCD3 85 8D sta eopsize ;effective operand size 06780 ; 06781 ; 06782 ; assemble instruction... 06783 ; 06784 00DCD5 A5 8A monasc08 lda opcode ;opcode 06785 00DCD7 87 61 sta [addra] ;store at assembly address 06786 00DCD9 A6 8D ldx eopsize ;any operand to process? 06787 00DCDB F0 09 beq .0000020 ;no 06788 ; 06789 00DCDD 9B txy ;also storage offset 06790 ; 06791 00DCDE CA .0000010 dex 06792 00DCDF B5 7B lda operand,x ;get operand byte &... 06793 00DCE1 97 61 sta [addra],y ;poke into memory 06794 00DCE3 88 dey 06795 00DCE4 D0 F8 bne .0000010 ;next 06796 ; 06797 00DCE6 A9 0D .0000020 lda #a_cr 06798 00DCE8 20 4A D2 jsr putcha ;return to left margin 06799 00DCEB A9 41 lda #asmprfx ;assembly prefix 06800 00DCED 20 FE E5 jsr dpycodaa ;disassemble & display 06801 ; 06802 ; 06803 ; prompt for next instruction... 06804 ; 06805 00DCF0 A9 20 monasc09 lda #a_blank 06806 00DCF2 A2 08 ldx #ascprmct-1 06807 ; 06808 00DCF4 9D 00 02 .0000010 sta ibuffer,x ;prepare buffer for... 06809 00DCF7 CA dex ;next instruction 06810 00DCF8 10 FA bpl .0000010 06811 ; 06812 00DCFA A9 41 lda #asmprfx ;assemble code... 06813 00DCFC 8D 00 02 sta ibuffer ;prompt prefix 06814 00DCFF A5 63 lda addra+s_word ;next instruction address bank 06815 00DD01 20 14 E9 jsr binhex ;convert to ASCII 06816 00DD04 8D 02 02 sta ibuffer+apadrbkh ;store MSN in buffer 06817 00DD07 8E 03 02 stx ibuffer+apadrbkl ;store LSN in buffer 06818 00DD0A A5 62 lda addra+s_byte ;next instruction address MSB 06819 00DD0C 20 14 E9 jsr binhex 06820 00DD0F 8D 04 02 sta ibuffer+apadrmbh 06821 00DD12 8E 05 02 stx ibuffer+apadrmbl 06822 00DD15 A5 61 lda addra ;next instruction address LSB 06823 00DD17 20 14 E9 jsr binhex 06824 00DD1A 8D 06 02 sta ibuffer+apadrlbh 06825 00DD1D 8E 07 02 stx ibuffer+apadrlbl 06826 00DD20 A9 09 lda #ascprmct ;effective input count 06827 00DD22 4C D5 DA jmp moncea ;reenter input loop 06828 ; 06829 ; 06830 ; process assembly error... 06831 ; 06832 00DD25 20 53 E7 monasc10 jsr dpyerr ;indicate error &... 06833 00DD28 80 C6 bra monasc09 ;prompt w/same assembly address 06834 ; 06835 .end 06836 .include "mon/cmd_code_disassemble.asm" 06837 ;================================================================================ 06838 ; 06839 ;MACHINE LANGUAGE MONITOR — DISASSEMBLE CODE 06840 ; 06841 ; ————————————————————————————— 06842 ; syntax: D [ []] 06843 ; ————————————————————————————— 06844 ; 06845 00DD2A B0 11 mondsc bcs .0000010 ;no parameters 06846 ; 06847 00DD2C 64 8E stz flimflag ;reset to 8 bit mode 06848 00DD2E 20 C6 E2 jsr facasize ;check starting... 06849 00DD31 C9 04 cmp #s_dword ;address 06850 00DD33 B0 46 bcs .0000050 ;out of range — error 06851 ; 06852 00DD35 20 A8 E2 jsr facaddra ;copy starting address 06853 00DD38 20 D6 E2 jsr getparm ;get ending address 06854 00DD3B 90 17 bcc .0000020 ;gotten 06855 ; 06856 00DD3D 20 2D E9 .0000010 jsr clrfaca ;clear accumulator 06857 longa 06858 00DD40 C2 20 rep #%00100000 06859 00DD42 18 clc 06860 00DD43 A5 61 lda addra ;starting address 06861 00DD45 69 15 00 adc !#n_dbytes ;default bytes 06862 00DD48 85 67 sta faca ;effective ending address 06863 shorta 06864 00DD4A E2 20 sep #%00100000 06865 00DD4C A5 63 lda addra+s_word ;starting bank 06866 00DD4E 69 00 adc #0 06867 00DD50 85 69 sta faca+s_word ;effective ending bank 06868 00DD52 B0 27 bcs .0000050 ;end address > $FFFFFF 06869 ; 06870 00DD54 20 C6 E2 .0000020 jsr facasize ;check ending... 06871 00DD57 C9 04 cmp #s_dword ;address 06872 00DD59 B0 20 bcs .0000050 ;out of range — error 06873 ; 06874 00DD5B 20 B2 E2 jsr facaddrb ;set ending address 06875 00DD5E 20 D6 E2 jsr getparm ;check for excess input 06876 00DD61 90 18 bcc .0000050 ;present — error 06877 ; 06878 00DD63 20 1C E2 jsr calccnt ;calculate bytes 06879 00DD66 90 13 bcc .0000050 ;end < start 06880 ; 06881 00DD68 20 8E E4 .0000030 jsr teststop ;test for display stop 06882 00DD6B B0 0B bcs .0000040 ;stopped 06883 ; 06884 00DD6D 20 B5 E7 jsr newline ;next line 06885 00DD70 20 FC E5 jsr dpycod ;disassemble & display 06886 00DD73 20 60 E2 jsr decdcnt ;decrement byte count 06887 00DD76 90 F0 bcc .0000030 ;not done 06888 ; 06889 00DD78 4C D1 DA .0000040 jmp monce ;back to main loop 06890 ; 06891 00DD7B 4C 36 DB .0000050 jmp monerr ;address range error 06892 ; 06893 .end 06894 .include "mon/cmd_code_exec.asm" 06895 ;================================================================================ 06896 ; 06897 ;MACHINE LANGUAGE MONITOR — EXECUTE CODE 06898 ; 06899 ; ————————————————————————————————————————————————————————————— 06900 ; syntax: G [] 06901 ; 06902 ; If no address is specified, the current values in the PB & PC 06903 ; shadow registers are used. 06904 ; ————————————————————————————————————————————————————————————— 06905 ; 06906 00DD7E 20 54 E3 monjmp jsr setxaddr ;set execution address 06907 00DD81 B0 24 bcs monjmpab ;out of range — error 06908 ; 06909 00DD83 20 D6 E2 jsr getparm ;check for excess input 06910 00DD86 90 1F bcc monjmpab ;too much input — error 06911 ; 06912 longa ;16 bit .A 06913 00DD88 C2 20 rep #%00100000 06914 00DD8A A5 5C lda reg_spx 06915 00DD8C 1B tcs ;restore SP 06916 ; 06917 00DD8D A6 60 monjmpaa ldx reg_dbx 06918 00DD8F DA phx 06919 00DD90 AB plb ;restore DB 06920 00DD91 A6 52 ldx reg_pbx 06921 00DD93 DA phx ;restore PB 06922 00DD94 A5 53 lda reg_pcx 06923 00DD96 48 pha ;restore PC 06924 00DD97 A6 55 ldx reg_srx 06925 00DD99 DA phx ;restore SR 06926 00DD9A A5 5E lda reg_dpx 06927 00DD9C 48 pha ;DP to stack 06928 longx 06929 00DD9D C2 10 rep #%00010000 06930 00DD9F A5 56 lda reg_ax ;restore .C, ... 06931 00DDA1 A6 58 ldx reg_xx ;.X &... 06932 00DDA3 A4 5A ldy reg_yx ;.Y 06933 00DDA5 2B pld ;restore DP &... 06934 00DDA6 40 rti ;execute code 06935 ; 06936 00DDA7 4C 36 DB monjmpab jmp monerr ;error 06937 ; 06938 ;================================================================================ 06939 ; 06940 ;MACHINE LANGUAGE MONITOR — EXECUTE CODE AS SUBROUTINE 06941 ; 06942 ; ———————————————————————————————————————————————————————————— 06943 ; syntax: J [] 06944 ; 06945 ; If no address is specified the current values in the PB & PC 06946 ; shadow registers are used. An RTS at the end of the called 06947 ; subroutine will return control to the monitor provided the 06948 ; stack remains in balance. 06949 ; ———————————————————————————————————————————————————————————— 06950 ; 06951 00DDAA 20 54 E3 monjsr jsr setxaddr ;set execution address 06952 00DDAD B0 F8 bcs monjmpab ;out of range — error 06953 ; 06954 00DDAF 20 D6 E2 jsr getparm ;check for excess input 06955 00DDB2 90 F3 bcc monjmpab ;too much input — error 06956 ; 06957 longa 06958 00DDB4 C2 20 rep #%00100000 06959 00DDB6 A5 5C lda reg_spx 06960 00DDB8 1B tcs ;restore SP &... 06961 00DDB9 20 8D DD jsr monjmpaa ;call subroutine 06962 00DDBC 08 php ;push SR 06963 longr 06964 00DDBD C2 30 rep #%00110000 06965 00DDBF 85 56 sta reg_ax ;save... 06966 00DDC1 86 58 stx reg_xx ;register... 06967 00DDC3 84 5A sty reg_yx ;returns 06968 shortx ;8 bit .X & .Y 06969 00DDC5 E2 10 sep #%00010000 06970 00DDC7 FA plx ;get & save... 06971 00DDC8 86 55 stx reg_srx ;return SR 06972 00DDCA 3B tsc ;get & save... 06973 00DDCB 85 5C sta reg_spx ;return SP 06974 00DDCD 7B tdc ;get & save... 06975 00DDCE 85 5E sta reg_dpx ;ZP pointer 06976 shorta ;8 bit .A 06977 00DDD0 E2 20 sep #%00100000 06978 00DDD2 4B phk ;get &... 06979 00DDD3 68 pla ;save... 06980 00DDD4 85 52 sta reg_pbx ;return PB 06981 00DDD6 8B phb ;get &... 06982 00DDD7 68 pla ;save... 06983 00DDD8 85 60 sta reg_dbx ;return DB 06984 00DDDA F4 F6 F0 pea #mm_rts ;"*RET" 06985 00DDDD 4C 6B DA jmp moncom ;return to monitor 06986 ; 06987 .end 06988 .include "mon/cmd_code_load.asm" 06989 ;================================================================================ 06990 ; 06991 ;MACHINE LANGUAGE MONITOR — LOAD S-RECORD CODE 06992 ; 06993 ; ———————————————————————————————————————————————————————————————————————— 06994 ; syntax: L [ []] 06995 ; 06996 ; is the 64KB RAM bank into which code is to be loaded. If not 06997 ; specified the bank value stored in the MPU's PB shadow register is used. 06998 ; On completion of the load, the PB shadow register will be set to . 06999 ; 07000 ; is an optional load address page offset. This offset will be 07001 ; added to each record's starting load address MSB to produce the effect- 07002 ; ive load address. Address wrap will occur if the sum of the load add- 07003 ; ress MSB & page offset is greater than $FF—the bank address will not 07004 ; wrap. must be specified if is required. 07005 ; 07006 ; 07007 ; Data Input Requirements 07008 ; —-—-—-—-—-—-—-—-—-—-—-— 07009 ; This function translates Motorola S-records into binary values that are 07010 ; loaded into RAM. If a non-zero page offset is specified, the load add- 07011 ; ress information in each record will be modified by the offset value, 07012 ; thus permitting a relocating load to a new starting page boundary. 07013 ; 07014 ; The data stream is read from the auxiliary TIA-232 port until an S9 rec- 07015 ; ord has been received & processed. Pressing [Ctrl-C] will immediately 07016 ; abort the process, will which result in a partial & most likely unusable 07017 ; load. 07018 ; 07019 ; The end of each record (EOR) is demarcated by an (UNIX newline) or 07020 ; a sequence (MS-DOS newline). A missing EOR demarcation will 07021 ; cause a buffer overrun error & prematurely halt the load. 07022 ; 07023 ; The following S-record types are recognized: 07024 ; 07025 ; Type Description 07026 ; —-—-—-—-—-—-—-—-—-— 07027 ; 0 Block header 07028 ; 1 Loadable data 07029 ; 5 Record count 07030 ; 9 Termination 07031 ; —-—-—-—-—-—-—-—-—-— 07032 ; 07033 ; The present code dos not process the S0 record type in any way. 07034 ; 07035 ; The general format of an S-record is as follows: 07036 ; 07037 ;
07038 ; 07039 ; Excepting the preamble & type characters, data in each field is repre- 07040 ; sented by pairs of ASCII characters that are textual equivalents of hex- 07041 ; adecimal values. For example, "1A" means the binary value $1A or deci- 07042 ; mal 26. The preamble & type characters taken together are used to des- 07043 ; cribe the record type, e.g., S0, S1, S5 or S9. 07044 ; 07045 ; Field details are as follows: 07046 ; 07047 ; Field Size Description 07048 ; —-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—- 07049 ; preamble 1 a literal "S" 07050 ; 07051 ; type 1 record type, indicated by a literal ASCII numeral 07052 ; 07053 ; length 2 record length, equal to the number of bytes encoded 07054 ; coded in the
, & fields 07055 ; 07056 ; address 4 S0: always "0000" 07057 ; S1: record load address 07058 ; S5: number of transmitted S1 records (64K max) 07059 ; S9: start address for code (optional) 07060 ; 07061 ; data * S0: descriptive information (optional) 07062 ; * S1: data to be loaded into RAM, starting at the add- 07063 ; ress in the
field 07064 ; 0 S5: not used 07065 ; 0 S9: not used 07066 ; 07067 ; checksum 2 8 bit ones complement computed from the , 07068 ;
& fields 07069 ; —-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—- 07070 ; 07071 ; Sizes are in ASCII characters. A size indicated by * will vary depend- 07072 ; ing on the data in the field. Values in the
field are in big- 07073 ; endian format. Hence "C4" followed by "21" means the binary value $C421 07074 ; or decimal 50209. 07075 ; 07076 ; This function will attempt to flush all input from the auxiliary TIA-232 07077 ; channel prior to commencing the load. A data stream should not be sent 07078 ; until the "Ready" prompt is displayed. 07079 ; ———————————————————————————————————————————————————————————————————————— 07080 ; 07081 00DDE0 90 04 monlsr bcc .0000010 ;bank entered 07082 ; 07083 00DDE2 A5 52 lda reg_pbx ;use current bank... 07084 00DDE4 80 0C bra .0000040 ;as default 07085 ; 07086 00DDE6 20 C6 E2 .0000010 jsr facasize ;check arg size 07087 00DDE9 C9 02 cmp #s_word 07088 00DDEB 90 03 bcc .0000030 ;bank in range 07089 ; 07090 00DDED 4C 36 DB .0000020 jmp monerr ;abort w/error 07091 ; 07092 00DDF0 A5 67 .0000030 lda faca ;entered bank 07093 ; 07094 00DDF2 85 77 .0000040 sta loadbank ;set load bank 07095 00DDF4 64 8F stz pageoff ;reset page offset 07096 00DDF6 20 D6 E2 jsr getparm ;check for page offset 07097 00DDF9 B0 10 bcs .0000050 ;none entered 07098 ; 07099 00DDFB 20 C6 E2 jsr facasize ;check size 07100 00DDFE C9 02 cmp #s_word 07101 00DE00 B0 EB bcs .0000020 ;out of range 07102 ; 07103 00DE02 A5 67 lda faca ;entered page offset 07104 00DE04 85 8F sta pageoff ;save it 07105 00DE06 20 D6 E2 jsr getparm ;should be no more input 07106 00DE09 90 E2 bcc .0000020 ;error 07107 ; 07108 .0000050 longa 07109 00DE0B C2 20 rep #%00100000 07110 00DE0D 64 8D stz nrecs ;reset S1 record count 07111 shorta 07112 00DE0F E2 20 sep #%00100000 07113 00DE11 20 C0 D2 jsr enabchb ;enable channel B receiver 07114 00DE14 A2 14 ldx #20 07115 ; 07116 00DE16 CB .0000060 wai ;flush... 07117 00DE17 20 93 E5 jsr clrchanb ;channel B 07118 00DE1A CA dex 07119 00DE1B D0 F9 bne .0000060 07120 ; 07121 00DE1D F4 7A F1 pea #lr_rtl ;"Ready" 07122 00DE20 20 35 D6 jsr sprint ;print string 07123 ; 07124 ; ———————————————————— 07125 ; MAIN PROCESSING LOOP 07126 ; ———————————————————— 07127 ; 07128 monlsr01 longa 07129 00DE23 C2 20 rep #%00100000 07130 00DE25 64 88 stz cksumcmp ;reset computed checksum 07131 shortr 07132 00DE27 E2 30 sep #%00110000 07133 00DE29 A2 00 ldx #0 ;buffer index 07134 00DE2B A0 45 ldy #s_ibuf ;input counter 07135 ; 07136 ; 07137 ; acquire record... 07138 ; 07139 00DE2D 20 9A E5 .0000010 jsr getchanb ;get datum from channel B 07140 00DE30 90 03 bcc .0000020 ;gotten 07141 ; 07142 00DE32 4C 55 DF jmp monlsr07 ;aborted by user 07143 ; 07144 00DE35 F0 0D .0000020 beq monlsr02 ;EOL, process record 07145 ; 07146 00DE37 9D 00 02 sta ibuffer,x ;store datum 07147 00DE3A E8 inx ;bump index 07148 00DE3B 88 dey ;decrement counter 07149 00DE3C D0 EF bne .0000010 ;buffer not full, get next 07150 ; 07151 00DE3E F4 21 F1 pea #lr_bufor ;"buffer overrun..." 07152 00DE41 4C 50 DF jmp monlsr06 ;abort w/error 07153 ; 07154 00DE44 9E 00 02 monlsr02 stz ibuffer,x ;terminate input 07155 00DE47 64 7F stz ibufidx ;reset buffer index 07156 00DE49 A5 8D lda nrecs ;total S1 records LSB 07157 00DE4B 05 8E ora nrecs+s_byte ;total S1 records MSB 07158 00DE4D D0 06 bne .0000010 ;not 1st record 07159 ; 07160 00DE4F F4 45 F1 pea #lr_load ;"loading..." 07161 00DE52 20 35 D6 jsr sprint 07162 ; 07163 ; 07164 ; evaluate record preamble... 07165 ; 07166 00DE55 20 B2 E3 .0000010 jsr getchar ;get 1st char from record 07167 00DE58 C9 53 cmp #srecpre ;preamble char 07168 00DE5A D0 44 bne monlsr03 ;error 07169 ; 07170 00DE5C 20 B2 E3 jsr getchar ;get record type 07171 00DE5F F0 3F beq monlsr03 ;unexpected end — error 07172 ; 07173 00DE61 38 sec 07174 00DE62 E9 30 sbc #'0' ;change to binary 07175 00DE64 C9 0A cmp #m_rectyp+1 ;check range 07176 00DE66 B0 38 bcs monlsr03 ;out of range — error 07177 ; 07178 00DE68 85 91 sta rectype ;set record type 07179 ; 07180 ; 07181 ; evaluate record length... 07182 ; 07183 00DE6A 20 C1 E5 jsr getcvt ;get & convert length 07184 00DE6D B0 31 bcs monlsr03 ;error 07185 ; 07186 00DE6F AA tax 07187 .rept 2 ;deduct address length 07188 00DE70 CA dex 07189 00DE71 CA dex 07190 00DE72 86 90 stx reclen ;save record length 07191 00DE74 20 CA E7 jsr acksum ;add to checksum 07192 ; 07193 ; 07194 ; evaluate load address... 07195 ; 07196 00DE77 20 C1 E5 jsr getcvt ;get & convert address MSB 07197 00DE7A B0 24 bcs monlsr03 ;error 07198 ; 07199 00DE7C 85 76 sta loadaddr+s_byte ;save load address MSB 07200 00DE7E 20 CA E7 jsr acksum ;add to checksum 07201 00DE81 20 C1 E5 jsr getcvt ;get & convert address LSB 07202 00DE84 B0 1A bcs monlsr03 ;error 07203 ; 07204 00DE86 85 75 sta loadaddr ;save load address LSB 07205 00DE88 20 CA E7 jsr acksum ;add to checksum 07206 ; 07207 ; 07208 ; evaluate data field... 07209 ; 07210 00DE8B A2 00 ldx #0 ;rebuffer index 07211 00DE8D A4 90 ldy reclen ;record length 07212 ; 07213 00DE8F 20 C1 E5 .0000020 jsr getcvt ;get & convert 07214 00DE92 B0 0C bcs monlsr03 ;premature record end 07215 ; 07216 00DE94 88 dey ;len -= 1 07217 00DE95 F0 0F beq monlsr04 ;.A = checksum byte 07218 ; 07219 00DE97 9D 00 02 sta ibuffer,x ;store converted byte 07220 00DE9A 20 CA E7 jsr acksum ;add to checksum 07221 00DE9D E8 inx 07222 00DE9E 80 EF bra .0000020 ;get next 07223 ; 07224 00DEA0 F4 35 F1 monlsr03 pea #lr_corup ;"corrupted record..." 07225 00DEA3 4C 50 DF jmp monlsr06 07226 ; 07227 00DEA6 85 7E monlsr04 sta datax ;save record checksum 07228 00DEA8 A5 88 lda cksumcmp ;running checksum 07229 00DEAA 49 FF eor #%11111111 ;ones complement 07230 00DEAC C5 7E cmp datax ;check against record checksum 07231 00DEAE D0 F0 bne monlsr03 ;bad checksum — error 07232 ; 07233 00DEB0 A5 91 lda rectype ;record type 07234 00DEB2 0A asl ;generate index 07235 00DEB3 AA tax 07236 00DEB4 7C EA EA jmp (lsrextab,x) ;process record type 07237 ; 07238 ; 07239 ; process S0 record... 07240 ; 07241 ; ————————————————————————————————— 07242 ; S0 data segment is not evaluated. 07243 ; ————————————————————————————————— 07244 ; 07245 00DEB7 80 34 monlsrs0 bra monlsr05 ;get next record 07246 ; 07247 ; 07248 ; process S1 record... 07249 ; 07250 00DEB9 20 84 E5 monlsrs1 jsr adjloadr ;adjust load address 07251 longa 07252 00DEBC C2 20 rep #%00100000 07253 00DEBE A5 8D lda nrecs ;any records processed? 07254 00DEC0 D0 04 bne .0000010 ;yes 07255 ; 07256 00DEC2 A5 75 lda loadaddr ;load address 07257 00DEC4 85 61 sta strtaddr ;also start address 07258 ; 07259 .0000010 shortr 07260 00DEC6 E2 30 sep #%00110000 07261 00DEC8 C6 90 dec reclen ;bytes to copy 07262 00DECA A2 00 ldx #0 ;buffer index 07263 ; 07264 00DECC BD 00 02 .0000020 lda ibuffer,x ;get byte &... 07265 00DECF 87 75 sta [loadaddr] ;write to RAM 07266 00DED1 C6 90 dec reclen ;all bytes copied? 07267 00DED3 F0 09 beq .0000030 ;yes 07268 ; 07269 longa ;no 07270 00DED5 C2 20 rep #%00100000 07271 00DED7 E6 75 inc loadaddr ;bump load address 07272 shorta 07273 00DED9 E2 20 sep #%00100000 07274 00DEDB E8 inx ;bump index 07275 00DEDC D0 EE bne .0000020 ;next 07276 ; 07277 .0000030 longa 07278 00DEDE C2 20 rep #%00100000 07279 00DEE0 A5 75 lda loadaddr 07280 00DEE2 85 64 sta endaddr ;set working end address 07281 00DEE4 E6 8D inc nrecs ;bump processed record count 07282 shorta 07283 00DEE6 E2 20 sep #%00100000 07284 00DEE8 A9 2E lda #'.' ;progress indicator 07285 00DEEA 20 4A D2 jsr putcha ;print on console 07286 ; 07287 monlsr05 shortr 07288 00DEED E2 30 sep #%00110000 07289 00DEEF 4C 23 DE jmp monlsr01 ;get next record 07290 ; 07291 ; 07292 ; process S5 record... 07293 ; 07294 00DEF2 C6 90 monlsrs5 dec reclen ;data field should be empty 07295 00DEF4 D0 AA bne monlsr03 ;it isn't — error 07296 ; 07297 longa 07298 00DEF6 C2 20 rep #%00100000 07299 00DEF8 A5 75 lda loadaddr ;expected S1 record count 07300 00DEFA C5 8D cmp nrecs ;processed S1 record count 07301 00DEFC F0 EF beq monlsr05 ;count okay — continue 07302 ; 07303 00DEFE F4 68 F1 pea #lr_recct ;"invalid S1 count..." 07304 00DF01 80 4D bra monlsr06 ;abort w/error 07305 ; 07306 ; 07307 ; process S9 record... 07308 ; 07309 00DF03 C6 90 monlsrs9 dec reclen ;data field should be empty 07310 00DF05 D0 99 bne monlsr03 ;it isn't — error 07311 ; 07312 longa 07313 00DF07 C2 20 rep #%00100000 07314 00DF09 A5 8D lda nrecs ;total S1 records 07315 00DF0B D0 05 bne .0000010 ;at least 1 record loaded 07316 ; 07317 00DF0D F4 55 F1 pea #lr_norec ;"no records..." 07318 00DF10 80 3E bra monlsr06 ;abort w/error 07319 ; 07320 .0000010 shorta 07321 00DF12 E2 20 sep #%00100000 07322 00DF14 A5 77 lda loadbank ;load bank 07323 00DF16 85 52 sta reg_pbx ;default for execution 07324 00DF18 20 84 E5 jsr adjloadr ;adjust load address 07325 longa 07326 00DF1B C2 20 rep #%00100000 07327 00DF1D A5 75 lda loadaddr ;load address from S9 07328 00DF1F D0 02 bne .0000020 ;valid 07329 ; 07330 00DF21 A5 61 lda strtaddr ;initial load address 07331 ; 07332 00DF23 85 53 .0000020 sta reg_pcx ;set execution address 07333 shorta 07334 00DF25 E2 20 sep #%00100000 07335 00DF27 F4 14 F1 pea #lr_addrs ;"start address..." 07336 00DF2A 20 35 D6 jsr sprint 07337 00DF2D 20 A4 E7 jsr dpypbr ;display bank 07338 longa 07339 00DF30 C2 20 rep #%00100000 07340 00DF32 A5 61 lda strtaddr ;initial load address 07341 shorta 07342 00DF34 E2 20 sep #%00100000 07343 00DF36 20 8A E7 jsr dpyhexw ;display start address 07344 00DF39 F4 09 F1 pea #lr_addre ;"end address" 07345 00DF3C 20 35 D6 jsr sprint 07346 00DF3F 20 A4 E7 jsr dpypbr ;display bank 07347 longa 07348 00DF42 C2 20 rep #%00100000 07349 00DF44 A5 64 lda endaddr ;final load address 07350 shorta 07351 00DF46 E2 20 sep #%00100000 07352 00DF48 20 8A E7 jsr dpyhexw ;display end address 07353 00DF4B 80 08 bra monlsr07 ;back to monitor executive 07354 ; 07355 ; 07356 ; undefined record type error handler... 07357 ; 07358 00DF4D F4 88 F1 monlsrut pea #lr_type ;"invalid..." 07359 ; 07360 ; 07361 ; general error processing... 07362 ; 07363 monlsr06 shortr 07364 00DF50 E2 30 sep #%00110000 07365 00DF52 20 35 D6 jsr sprint ;print error message 07366 ; 07367 ; 07368 ; terminate S-record processing... 07369 ; 07370 00DF55 20 C3 D2 monlsr07 jsr disabchb ;disable channel B port 07371 00DF58 4C D1 DA jmp monce ;back to monitor executive 07372 ; 07373 .end 07374 .include "mon/cmd_mem_change.asm" 07375 ;================================================================================ 07376 ; 07377 ;MACHINE LANGUAGE MONITOR — CHANGE and/or DUMP MEMORY 07378 ; 07379 ; ———————————————————————————————————————————— 07380 ; syntax: > [ []...] 07381 ; 07382 ; > without operands will dump 16 bytes 07383 ; of memory, starting at . 07384 ; ———————————————————————————————————————————— 07385 ; 07386 00DF5B B0 23 monchm bcs .0000030 ;no address given — quit 07387 ; 07388 00DF5D 20 C6 E2 jsr facasize ;size address 07389 00DF60 C9 04 cmp #s_dword 07390 00DF62 B0 1F bcs .0000040 ;address out of range — error 07391 ; 07392 00DF64 20 A8 E2 jsr facaddra ;set starting address 07393 00DF67 20 C4 E3 jsr getpat ;evaluate change pattern 07394 00DF6A 90 04 bcc .0000010 ;entered 07395 ; 07396 00DF6C 10 0C bpl .0000020 ;not entered, just dump 07397 ; 07398 00DF6E 80 13 bra .0000040 ;evaluation error 07399 ; 07400 00DF70 88 .0000010 dey ;next byte 07401 00DF71 30 07 bmi .0000020 ;done 07402 ; 07403 00DF73 B9 46 02 lda auxbuf,y ;write pattern... 07404 00DF76 97 61 sta [addra],y ;to memory 07405 00DF78 80 F6 bra .0000010 ;next 07406 ; 07407 00DF7A 20 B5 E7 .0000020 jsr newline ;next line 07408 00DF7D 20 10 E7 jsr dpymem ;regurgitate changes 07409 ; 07410 00DF80 4C D1 DA .0000030 jmp monce ;back to command loop 07411 ; 07412 00DF83 4C 36 DB .0000040 jmp monerr ;goto error handler 07413 ; 07414 .end 07415 .include "mon/cmd_mem_compare.asm" 07416 ;================================================================================ 07417 ; 07418 ;MACHINE LANGUAGE MONITOR — COMPARE MEMORY 07419 ; 07420 ; ————————————————————————————— 07421 ; syntax: C 07422 ; ————————————————————————————— 07423 ; 07424 00DF86 B0 26 moncmp bcs .0000030 ;start not given — quit 07425 ; 07426 00DF88 20 82 E2 jsr enddest ;get end & reference addresses 07427 00DF8B B0 24 bcs .0000040 ;range or other error 07428 ; 07429 00DF8D 64 8C stz xrtemp ;column counter 07430 ; 07431 00DF8F 20 8E E4 .0000010 jsr teststop ;check for stop/XOFF/XON 07432 00DF92 B0 1A bcs .0000030 ;abort 07433 ; 07434 00DF94 A7 61 lda [addra] ;get from reference location 07435 00DF96 C7 7B cmp [operand] ;test against reference location 07436 00DF98 F0 03 beq .0000020 ;match, don't display address 07437 ; 07438 00DF9A 20 E2 E5 jsr dpycaddr ;display current location 07439 ; 07440 00DF9D 20 FB E2 .0000020 jsr nxtaddra ;next reference location 07441 00DFA0 B0 0C bcs .0000030 ;done 07442 ; 07443 longa 07444 00DFA2 C2 20 rep #%00100000 07445 00DFA4 E6 7B inc operand ;bump bits 0-15 07446 shorta 07447 00DFA6 E2 20 sep #%00100000 07448 00DFA8 D0 E5 bne .0000010 07449 ; 07450 00DFAA E6 7C inc operand+s_byte ;bump bits 16-23 07451 00DFAC 80 E1 bra .0000010 07452 ; 07453 00DFAE 4C D1 DA .0000030 jmp monce ;return to command exec 07454 ; 07455 00DFB1 4C 36 DB .0000040 jmp monerr ;goto error handler 07456 ; 07457 .end 07458 .include "mon/cmd_mem_copy.asm" 07459 ;================================================================================ 07460 ; 07461 ;MACHINE LANGUAGE MONITOR — COPY (transfer) MEMORY 07462 ; 07463 ; ———————————————————————————————— 07464 ; syntax: T 07465 ; ———————————————————————————————— 07466 ; 07467 00DFB4 B0 49 moncpy bcs .0000040 ;start not given — quit 07468 ; 07469 00DFB6 20 82 E2 jsr enddest ;get end & target addresses 07470 00DFB9 B0 47 bcs .0000050 ;range or other error 07471 ; 07472 longa 07473 00DFBB C2 20 rep #%00100000 07474 00DFBD 38 sec 07475 00DFBE A5 64 lda addrb ;ending address 07476 00DFC0 E5 61 sbc addra ;starting address 07477 00DFC2 90 3E bcc .0000050 ;start > end — error 07478 ; 07479 00DFC4 85 6F sta facb ;bytes to copy 07480 shorta 07481 00DFC6 E2 20 sep #%00100000 07482 longx 07483 00DFC8 C2 10 rep #%00010000 07484 00DFCA A5 7D lda operand+s_word ;target bank 07485 00DFCC A4 7B ldy operand ;target address 07486 00DFCE C5 63 cmp addra+s_word ;source bank 07487 longa 07488 00DFD0 C2 20 rep #%00100000 07489 00DFD2 D0 1C bne .0000020 ;can use forward copy 07490 ; 07491 00DFD4 C4 61 cpy addra ;source address 07492 00DFD6 90 18 bcc .0000020 ;can use forward copy 07493 ; 07494 00DFD8 D0 02 bne .0000010 ;must use reverse copy 07495 ; 07496 00DFDA 80 26 bra .0000050 ;copy in place — error 07497 ; 07498 00DFDC A5 6F .0000010 lda facb ;get bytes to copy 07499 00DFDE 48 pha ;protect 07500 00DFDF 20 76 E4 jsr lodbnk ;load banks 07501 00DFE2 20 42 E2 jsr cprvsup ;do reverse copy setup 07502 00DFE5 68 pla ;get bytes to copy 07503 00DFE6 AA tax ;save a copy 07504 00DFE7 18 clc 07505 00DFE8 65 7B adc operand ;change target to... 07506 00DFEA A8 tay ;target end 07507 00DFEB 8A txa ;recover bytes to copy 07508 00DFEC A6 64 ldx addrb ;source end 07509 00DFEE 80 0C bra .0000030 07510 ; 07511 00DFF0 A5 6F .0000020 lda facb ;get bytes to copy 07512 00DFF2 48 pha ;protect 07513 00DFF3 20 76 E4 jsr lodbnk ;load banks 07514 00DFF6 20 3B E2 jsr cpfwsup ;do forward copy setup 07515 00DFF9 68 pla ;get bytes to copy 07516 00DFFA A6 61 ldx addra ;source start 07517 ; 07518 00DFFC 4C 67 00 .0000030 jmp mcftwork ;copy memory 07519 ; 07520 00DFFF 4C D1 DA .0000040 jmp monce ;back to executive 07521 ; 07522 00E002 4C 36 DB .0000050 jmp monerr ;error 07523 ; 07524 .end 07525 .include "mon/cmd_mem_display.asm" 07526 ;================================================================================ 07527 ; 07528 ;MACHINE LANGUAGE MONITOR — DISPLAY MEMORY RANGE 07529 ; 07530 ; ————————————————————————————— 07531 ; syntax: M [ []] 07532 ; ————————————————————————————— 07533 ; 07534 00E005 B0 0F mondmp bcs .0000010 ;no parameters 07535 ; 07536 00E007 20 C6 E2 jsr facasize ;check address... 07537 00E00A C9 04 cmp #s_dword ;range 07538 00E00C B0 46 bcs .0000050 ;address out of range 07539 ; 07540 00E00E 20 A8 E2 jsr facaddra ;copy starting address 07541 00E011 20 D6 E2 jsr getparm ;get ending address 07542 00E014 90 17 bcc .0000020 ;gotten 07543 ; 07544 00E016 20 2D E9 .0000010 jsr clrfaca ;clear accumulator 07545 longa 07546 00E019 C2 20 rep #%00100000 07547 00E01B 18 clc 07548 00E01C A5 61 lda addra ;starting address 07549 00E01E 69 FF 00 adc !#n_mbytes ;default bytes 07550 00E021 85 67 sta faca ;effective ending address 07551 shorta 07552 00E023 E2 20 sep #%00100000 07553 00E025 A5 63 lda addra+s_word ;starting bank 07554 00E027 69 00 adc #0 07555 00E029 85 69 sta faca+s_word ;effective ending bank 07556 00E02B B0 27 bcs .0000050 ;end address > $FFFFFF 07557 ; 07558 00E02D 20 C6 E2 .0000020 jsr facasize ;check ending address... 07559 00E030 C9 04 cmp #s_dword ;range 07560 00E032 B0 20 bcs .0000050 ;out of range — error 07561 ; 07562 00E034 20 B2 E2 jsr facaddrb ;copy ending address 07563 00E037 20 D6 E2 jsr getparm ;check for excess input 07564 00E03A 90 18 bcc .0000050 ;error 07565 ; 07566 00E03C 20 1C E2 jsr calccnt ;calculate bytes to dump 07567 00E03F 90 13 bcc .0000050 ;end < start 07568 ; 07569 00E041 20 8E E4 .0000030 jsr teststop ;test for display stop 07570 00E044 B0 0B bcs .0000040 ;stopped 07571 ; 07572 00E046 20 B5 E7 jsr newline ;next line 07573 00E049 20 10 E7 jsr dpymem ;display 07574 00E04C 20 60 E2 jsr decdcnt ;decrement byte count 07575 00E04F 90 F0 bcc .0000030 ;not done 07576 ; 07577 00E051 4C D1 DA .0000040 jmp monce ;back to main loop 07578 ; 07579 00E054 4C 36 DB .0000050 jmp monerr ;address range error 07580 ; 07581 .end 07582 .include "mon/cmd_mem_fill.asm" 07583 ;================================================================================ 07584 ; 07585 ;MACHINE LANGUAGE MONITOR — FILL MEMORY 07586 ; 07587 ; ————————————————————————————————————————— 07588 ; syntax: F 07589 ; 07590 ; & must be in the same bank. 07591 ; ————————————————————————————————————————— 07592 ; 07593 00E057 B0 5E monfil bcs .0000010 ;start not given — quit 07594 ; 07595 00E059 20 C6 E2 jsr facasize ;check size 07596 00E05C C9 04 cmp #s_dword 07597 00E05E B0 5A bcs .0000020 ;out of range — error... 07598 ; 07599 00E060 20 A8 E2 jsr facaddra ;store start 07600 00E063 20 D6 E2 jsr getparm ;evaluate end 07601 00E066 B0 52 bcs .0000020 ;not entered — error 07602 ; 07603 00E068 20 C6 E2 jsr facasize ;check size 07604 00E06B C9 04 cmp #s_dword 07605 00E06D B0 4B bcs .0000020 ;out of range — error 07606 ; 07607 00E06F A5 69 lda faca+s_word ;end bank 07608 00E071 C5 63 cmp addra+s_word ;start bank 07609 00E073 D0 45 bne .0000020 ;not same — error 07610 ; 07611 00E075 20 B2 E2 jsr facaddrb ;store 07612 longa 07613 00E078 C2 20 rep #%00100000 07614 00E07A 38 sec 07615 00E07B A5 64 lda addrb ;ending address 07616 00E07D E5 61 sbc addra ;starting address 07617 00E07F 90 39 bcc .0000020 ;start > end — error 07618 ; 07619 00E081 85 6F sta facb ;bytes to copy 07620 shorta 07621 00E083 E2 20 sep #%00100000 07622 00E085 20 D6 E2 jsr getparm ;evaluate 07623 00E088 B0 30 bcs .0000020 ;not entered — error 07624 ; 07625 00E08A 20 C6 E2 jsr facasize ; should be... 07626 00E08D C9 02 cmp #s_word ;8 bits 07627 00E08F B0 29 bcs .0000020 ;it isn't — error 07628 ; 07629 00E091 20 BC E2 jsr facaoper ;store 07630 00E094 20 D6 E2 jsr getparm ;should be no more parameters 07631 00E097 90 21 bcc .0000020 ;there are — error 07632 ; 07633 00E099 A5 7B lda operand ; 07634 00E09B 87 61 sta [addra] ;fill 1st location 07635 longr ;16 bit operations 07636 00E09D C2 30 rep #%00110000 07637 00E09F A5 6F lda facb ;get byte count 07638 00E0A1 F0 14 beq .0000010 ;only 1 location — finished 07639 ; 07640 00E0A3 3A dec ;zero align &... 07641 00E0A4 48 pha ;protect 07642 shorta 07643 00E0A5 E2 20 sep #%00100000 07644 00E0A7 A5 63 lda addra+s_word ;start bank 07645 00E0A9 EB xba 07646 00E0AA A5 66 lda addrb+s_word ;end bank 07647 00E0AC 20 3B E2 jsr cpfwsup ;do forward copy setup 07648 00E0AF 68 pla ;recover fill count 07649 00E0B0 A6 61 ldx addra ;fill-from starting location 07650 00E0B2 9B txy 07651 00E0B3 C8 iny ;fill-to starting location 07652 00E0B4 4C 67 00 jmp mcftwork ;fill memory 07653 ; 07654 00E0B7 4C D1 DA .0000010 jmp monce ;goto command executive 07655 ; 07656 00E0BA 4C 36 DB .0000020 jmp monerr ;goto error handler 07657 ; 07658 .end 07659 .include "mon/cmd_mem_search.asm" 07660 ;================================================================================ 07661 ; 07662 ;MACHINE LANGUAGE MONITOR — SEARCH (hunt) MEMORY 07663 ; 07664 ; ——————————————————————————————————— 07665 ; syntax: H 07666 ; ——————————————————————————————————— 07667 ; 07668 00E0BD B0 40 monhnt bcs .0000050 ;no start address 07669 ; 07670 00E0BF 20 C6 E2 jsr facasize ;size starting address 07671 00E0C2 C9 04 cmp #s_dword 07672 00E0C4 B0 3C bcs .0000060 ;address out of range — error 07673 ; 07674 00E0C6 20 A8 E2 jsr facaddra ;store starting address 07675 00E0C9 20 D6 E2 jsr getparm ;evaluate ending address 07676 00E0CC B0 34 bcs .0000060 ;no address — error 07677 ; 07678 00E0CE 20 C6 E2 jsr facasize ;size ending address 07679 00E0D1 C9 04 cmp #s_dword 07680 00E0D3 B0 2D bcs .0000060 ;address out of range — error 07681 ; 07682 00E0D5 20 B2 E2 jsr facaddrb ;store ending address 07683 00E0D8 20 1C E2 jsr calccnt ;calculate byte range 07684 00E0DB 90 25 bcc .0000060 ;end < start 07685 ; 07686 00E0DD 20 C4 E3 jsr getpat ;evaluate search pattern 07687 00E0E0 B0 20 bcs .0000060 ;error 07688 ; 07689 00E0E2 64 8C stz xrtemp ;clear column counter 07690 ; 07691 00E0E4 20 8E E4 .0000010 jsr teststop ;check for stop 07692 00E0E7 B0 16 bcs .0000050 ;abort 07693 ; 07694 00E0E9 A4 7E ldy auxbufix ;pattern index 07695 ; 07696 00E0EB 88 .0000020 dey 07697 00E0EC 30 09 bmi .0000030 ;pattern match 07698 ; 07699 00E0EE B7 61 lda [addra],y ;get from memory 07700 00E0F0 D9 46 02 cmp auxbuf,y ;test against pattern 07701 00E0F3 D0 05 bne .0000040 ;mismatch, next location 07702 ; 07703 00E0F5 F0 F4 beq .0000020 ;match, keep testing 07704 ; 07705 00E0F7 20 E2 E5 .0000030 jsr dpycaddr ;display current location 07706 ; 07707 00E0FA 20 FB E2 .0000040 jsr nxtaddra ;next location 07708 00E0FD 90 E5 bcc .0000010 ;not done 07709 ; 07710 00E0FF 4C D1 DA .0000050 jmp monce ;back to executive 07711 ; 07712 00E102 4C 36 DB .0000060 jmp monerr ;goto error handler 07713 ; 07714 .end 07715 .include "mon/cmd_radix_display.asm" 07716 ;================================================================================ 07717 ; 07718 ;MACHINE LANGUAGE MONITOR — CONVERT NUMERIC VALUE 07719 ; 07720 ; —————————————————————— 07721 ; syntax: 07722 ; —————————————————————— 07723 ; 07724 00E105 20 D4 E2 monenv jsr getparmr ;reread & evaluate parameter 07725 00E108 B0 26 bcs .0000020 ;none entered 07726 ; 07727 00E10A A2 00 ldx #0 ;radix index 07728 00E10C A0 04 ldy #n_radix ;number of radices 07729 ; 07730 00E10E 5A .0000010 phy ;save counter 07731 00E10F DA phx ;save radix index 07732 00E110 20 B5 E7 jsr newline ;next line &... 07733 00E113 20 06 E7 jsr clearlin ;clear it 07734 00E116 A9 20 lda #a_blank 07735 00E118 A2 04 ldx #halftab 07736 00E11A 20 A8 E7 jsr multspc ;indent 1/2 tab 07737 00E11D FA plx ;get radix index but... 07738 00E11E DA phx ;put it back 07739 00E11F BD 12 EB lda radxtab,x ;get radix 07740 00E122 20 80 E8 jsr binasc ;convert to ASCII 07741 00E125 5A phy ;string address MSB 07742 00E126 DA phx ;string address LSB 07743 00E127 20 35 D6 jsr sprint ;print 07744 00E12A FA plx ;get index again 07745 00E12B 7A ply ;get counter 07746 00E12C E8 inx 07747 00E12D 88 dey 07748 00E12E D0 DE bne .0000010 ;no 07749 07750 00E130 4C D1 DA .0000020 jmp monce ;back to command exec 07751 ; 07752 .end 07753 .include "mon/cmd_reg_change.asm" 07754 ;================================================================================ 07755 ; 07756 ;MACHINE LANGUAGE MONITOR — CHANGE REGISTERS 07757 ; 07758 ; —————————————————————————————————————————————————————— 07759 ; syntax: ; [PB [PC [.S [.C [.X [.Y [SP [DP [DB]]]]]]]]] 07760 ; 07761 ; ; with no parameters is the same as the R command. 07762 ; —————————————————————————————————————————————————————— 07763 ; 07764 00E133 B0 33 monchr bcs .0000040 ;dump registers & quit 07765 ; 07766 00E135 A0 00 ldy #0 ;register counter 07767 00E137 84 75 sty facc ;initialize register index 07768 ; 07769 00E139 20 C6 E2 .0000010 jsr facasize ;get parameter size 07770 00E13C D9 16 EB cmp rcvltab,y ;check against size table 07771 00E13F B0 2A bcs .0000050 ;out of range 07772 ; 07773 00E141 B9 16 EB lda rcvltab,y ;determine number of bytes... 07774 00E144 C9 03 cmp #s_word+1 ;to store 07775 00E146 66 76 ror facc+s_byte ;condition flag 07776 00E148 10 02 bpl .0000020 ;8 bit register size 07777 ; 07778 longa ;16 bit register size 07779 00E14A C2 20 rep #%00100000 07780 ; 07781 00E14C A6 75 .0000020 ldx facc ;get register index 07782 00E14E A5 67 lda faca ;get parm 07783 00E150 95 52 sta reg_pbx,x ;put in shadow storage 07784 shorta 07785 00E152 E2 20 sep #%00100000 07786 00E154 06 76 asl facc+s_byte ;mode flag to carry 07787 00E156 8A txa ;register index 07788 00E157 69 01 adc #s_byte ;at least 1 byte stored 07789 00E159 85 75 sta facc ;save new index 07790 00E15B 20 D6 E2 jsr getparm ;get a parameter 07791 00E15E B0 08 bcs .0000040 ;EOI 07792 ; 07793 00E160 C8 iny ;bump register count 07794 00E161 C0 09 cpy #n_regchv ;all registers processed? 07795 00E163 D0 D4 bne .0000010 ;no, keep going 07796 ; 07797 00E165 20 C1 E7 .0000030 jsr alert ;excessive input 07798 ; 07799 00E168 4C 77 DA .0000040 jmp monreg ;display changes 07800 ; 07801 00E16B 4C 36 DB .0000050 jmp monerr ;goto error handler 07802 ; 07803 .end 07804 .include "mon/cmd_scsi.asm" 07805 ;================================================================================ 07806 ; 07807 ;MACHINE LANGUAGE MONITOR: ISSUE SCSI COMMAND 07808 ; 07809 ; ———————————————————————————————————————————————————————————————————————— 07810 ; syntax: ! , where is: 07811 ; 07812 ; B , rewind tape 07813 ; F , format unit 07814 ; I reset SCSI subsystem 07815 ; R ,,,, read from device 07816 ; S ,, request sense data 07817 ; W ,,,, write to device 07818 ; 07819 ; Parameters: 07820 ; 07821 ; SCSI ID, $00-$07 07822 ; logical unit, $00-$07 07823 ; logical block address, e.g., $1F410C 07824 ; quantity of data to read or write ($0000-$FFFF) 07825 ; buffer starting address 07826 ; 07827 ; NOTES: 1) Commands are not case-sensitive. Whitespace may used between 07828 ; the ! prefix & the command letter, & between the command let- 07829 ; ter & 1st parameter. 07830 ; 2) Whitespace may substituted for commas to delimit parameters. 07831 ; 3) As with all other monitor commands, parameters are assummed to 07832 ; be hex unless prefixed with an alternate radix. 07833 ; 4) is blocks when accessing a block device, e.g., a disk or 07834 ; is bytes when accessing a stream device, e.g., a tape. 07835 ; 5) & are not checked for validity. Improper values 07836 ; may result in overwrite of critical system areas & cause fat- 07837 ; ality. 07838 ; 07839 ; In some cases, the monitor may report an error that was actually genera- 07840 ; ted within the SCSI subsystem driver, such as device not present. Such 07841 ; errors are currently not decoded & displayed. 07842 ; ———————————————————————————————————————————————————————————————————————— 07843 ; 07844 ;================================================================================ 07845 ; 07846 ;MACHINE LANGUAGE MONITOR: RECALIBRATE DISK/REWIND TAPE 07847 ; 07848 ; ————————————————————— 07849 ; syntax: !b 07850 ; ————————————————————— 07851 ; 07852 00E16E B0 3F scsibom bcs scsierrc ;required parameters missing 07853 ; 07854 00E170 20 A1 E4 jsr getidlun ;get SCSI ID & LUN 07855 00E173 B0 3A bcs scsierrc ;missing LUN or out of range 07856 ; 07857 ; ———————————————————————————————————————————————— 07858 ; GETIDLUN exits with the LUN in .X if successful. 07859 ; ———————————————————————————————————————————————— 07860 ; 07861 00E175 A9 01 lda #sc_recal ;SCSI opcode 07862 00E177 80 12 bra scsicoma ;execute command 07863 ; 07864 ; ——————————————————————————————————————————————————————————————— 07865 ; SC_RECAL has been declared obsolete for block devices. Hence 07866 ; the effect is undefined if the target is not a stream device. 07867 ; Disks will either interpret it as a recalibrate command or will 07868 ; generate "check condition," the latter which will result in the 07869 ; monitor flagging an error. 07870 ; ——————————————————————————————————————————————————————————————— 07871 ; 07872 ;================================================================================ 07873 ; 07874 ;MACHINE LANGUAGE MONITOR: FORMAT UNIT/ERASE TAPE 07875 ; 07876 ; ————————————————————— 07877 ; syntax: !f 07878 ; ————————————————————— 07879 ; 07880 00E179 B0 34 scsifmt bcs scsierrc ;required parameters missing 07881 ; 07882 00E17B 20 A1 E4 jsr getidlun ;get SCSI ID & LUN 07883 00E17E B0 2F bcs scsierrc ;missing LUN or out of range 07884 ; 07885 00E180 24 8E bit flimflag ;device type 07886 00E182 10 03 bpl .0000010 ;block 07887 ; 07888 00E184 A9 19 lda #sc_erase ;stream: erase 07889 .byte bitabs 07890 ; 07891 00E187 A9 04 .0000010 lda #sc_fmt ;block: format 07892 00E189 A2 00 ldx #0 ;wait 'til done 07893 ; 07894 00E18B 20 ED E4 scsicoma jsr setupcdb ;initialize CDB 07895 00E18E 20 D6 E2 jsr getparm ;check for excess input 07896 00E191 90 1C bcc scsierrc ;error 07897 ; 07898 longx 07899 00E193 C2 10 rep #%00010000 07900 00E195 A5 7B lda operand ;target ID 07901 00E197 A2 46 02 ldx !#auxbuf ;CDB address 07902 00E19A 20 72 D8 jsr scsicmd ;execute command 07903 00E19D 90 0D bcc scsixcom ;executed 07904 ; 07905 00E19F 80 0E bra scsierrc ;error 07906 ; 07907 ;================================================================================ 07908 ; 07909 ;MACHINE LANGUAGE MONITOR: RESET SCSI SUBSYSTEM 07910 ; 07911 ; —————————— 07912 ; syntax: !i 07913 ; —————————— 07914 ; 07915 00E1A1 90 0C scsirst bcc scsierrc ;no parameters allowed 07916 ; 07917 00E1A3 F4 48 EE pea #dc_cs 07918 00E1A6 20 35 D6 jsr sprint ;clear screen 07919 00E1A9 20 6F D6 jsr scsiinit ;initialize & reset 07920 ; 07921 00E1AC 4C D1 DA scsixcom jmp monce ;back to command exec 07922 ; 07923 00E1AF 4C 36 DB scsierrc jmp monerr ;goto error handler 07924 ; 07925 ;================================================================================ 07926 ; 07927 ;MACHINE LANGUAGE MONITOR: READ FROM DEVICE 07928 ; 07929 ; —————————————————————————————————————— 07930 ; syntax: !r 07931 ; —————————————————————————————————————— 07932 ; 07933 00E1B2 B0 FB scsiread bcs scsierrc ;no parameters given 07934 ; 07935 00E1B4 20 A1 E4 jsr getidlun ;get SCSI ID & LUN 07936 00E1B7 B0 F6 bcs scsierrc ;out of range 07937 ; 07938 00E1B9 A9 08 lda #sc_read ;basic read opcode 07939 00E1BB 80 30 bra scsirwc ;perform read operation 07940 ; 07941 ;================================================================================ 07942 ; 07943 ;MACHINE LANGUAGE MONITOR: REQUEST SENSE DATA 07944 ; 07945 ; ———————————————————————————— 07946 ; syntax: !s 07947 ; ———————————————————————————— 07948 ; 07949 00E1BD B0 F0 scsisens bcs scsierrc ;no parameters given 07950 ; 07951 00E1BF 20 A1 E4 jsr getidlun ;get SCSI ID & LUN 07952 00E1C2 B0 EB bcs scsierrc ;out of range 07953 ; 07954 00E1C4 A9 03 lda #sc_getsd ;request sense opcode 07955 00E1C6 20 ED E4 jsr setupcdb ;initialize CDB 07956 00E1C9 A9 12 lda #s_reqsen ;data size 07957 00E1CB 8D 4A 02 sta auxbuf+so_xfrl ;set it 07958 00E1CE 20 6D E5 jsr setuprAA ;set up buffer address 07959 00E1D1 B0 DC bcs scsierrc ;error 07960 ; 07961 longx 07962 00E1D3 C2 10 rep #%00010000 07963 00E1D5 A5 7B lda operand ;target ID 07964 00E1D7 A2 46 02 ldx !#auxbuf ;CDB address 07965 00E1DA A4 61 ldy addra ;buffer address 07966 00E1DC 20 72 D8 jsr scsicmd ;execute command 07967 00E1DF 90 CB bcc scsixcom ;executed 07968 ; 07969 00E1E1 80 CC bra scsierrc ;error 07970 ; 07971 ;================================================================================ 07972 ; 07973 ;MACHINE LANGUAGE MONITOR: WRITE TO DEVICE 07974 ; 07975 ; —————————————————————————————————————— 07976 ; syntax: !w 07977 ; —————————————————————————————————————— 07978 ; 07979 00E1E3 B0 CA scsiwrit bcs scsierrc ;no parameters given 07980 ; 07981 00E1E5 20 A1 E4 jsr getidlun ;get SCSI ID & LUN 07982 00E1E8 B0 C5 bcs scsierrc ;out of range 07983 ; 07984 00E1EA A8 tay ;protect LUN 07985 00E1EB A9 0A lda #sc_writ ;basic write opcode 07986 ; 07987 ; 07988 ; read/write common code... 07989 ; 07990 00E1ED 24 8E scsirwc bit flimflag ;addressing capability 07991 00E1EF 50 02 bvc .0000010 ;21 bit 07992 ; 07993 00E1F1 09 20 ora #sg2mask ;set group 2 bit 07994 ; 07995 00E1F3 20 ED E4 .0000010 jsr setupcdb ;initialize CDB 07996 00E1F6 20 FE E4 jsr setuprwb ;set up access params 07997 00E1F9 B0 B4 bcs scsierrc ;error 07998 ; 07999 longx 08000 00E1FB C2 10 rep #%00010000 08001 00E1FD A5 7B lda operand ;target ID 08002 00E1FF A2 46 02 ldx !#auxbuf ;CDB address 08003 00E202 A4 61 ldy addra ;buffer address 08004 00E204 20 72 D8 jsr scsicmd ;execute command 08005 00E207 90 A3 bcc scsixcom ;executed 08006 ; 08007 00E209 80 A4 bra scsierrc ;error 08008 ; 08009 .end 08010 .include "mon/cmd_version.asm" 08011 ;================================================================================ 08012 ; 08013 ;MACHINE LANGUAGE MONITOR — DISPLAY SOFTWARE VERSION 08014 ; 08015 ; ————————— 08016 ; syntax: v 08017 ; ————————— 08018 ; 08019 00E20B 90 0C monver bcc .0000010 ;no parameters allowed 08020 ; 08021 00E20D 20 B5 E7 jsr newline 08022 printf si_vers ;print version string 08023 00E210 F4 94 EF pea #.s 08024 00E213 20 35 D6 jsr sprint 08025 00E216 4C D1 DA jmp monce ;back to command exec 08026 ; 08027 00E219 4C 36 DB .0000010 jmp monerr ;goto error handler 08028 ; 08029 .end 08030 .include "mon/subs.asm" 08031 ;================================================================================ 08032 ; 08033 ;calccnt: COMPUTE BYTE COUNT FROM ADDRESS RANGE 08034 ; 08035 00E21C 20 36 E9 calccnt jsr clrfacb ;clear accumulator 08036 longa 08037 00E21F C2 20 rep #%00100000 08038 00E221 38 sec 08039 00E222 A5 64 lda addrb ;ending address 08040 00E224 E5 61 sbc addra ;starting address 08041 00E226 85 6F sta facb ;byte count 08042 shorta 08043 00E228 E2 20 sep #%00100000 08044 00E22A A5 66 lda addrb+s_word ;handle banks 08045 00E22C E5 63 sbc addra+s_word 08046 00E22E 85 71 sta facb+s_word 08047 00E230 60 rts 08048 ; 08049 ;================================================================================ 08050 ; 08051 ;clroper: CLEAR OPERAND 08052 ; 08053 00E231 A2 02 clroper ldx #s_oper-1 08054 ; 08055 00E233 74 7B .0000010 stz operand,x 08056 00E235 CA dex 08057 00E236 10 FB bpl .0000010 08058 ; 08059 00E238 64 8D stz eopsize 08060 00E23A 60 rts 08061 ; 08062 ;================================================================================ 08063 ; 08064 ;cpfwsup: FOWARD COPY MEMORY SETUP 08065 ; 08066 cpfwsup longr 08067 00E23B C2 30 rep #%00110000 08068 00E23D A2 54 00 ldx !#opc_mvn ;"move next" opcode 08069 00E240 80 05 bra cpsup 08070 ; 08071 ;================================================================================ 08072 ; 08073 ;cprvsup: REVERSE COPY MEMORY SETUP 08074 ; 08075 cprvsup longr 08076 00E242 C2 30 rep #%00110000 08077 00E244 A2 44 00 ldx !#opc_mvp ;"move previous" opcode 08078 ; 08079 ;================================================================================ 08080 ; 08081 ;cpsup: COPY MEMORY SETUP COMMON CODE 08082 ; 08083 00E247 48 cpsup pha ;save banks 08084 00E248 8A txa ;protect... 08085 00E249 EB xba ;opcode 08086 shorta 08087 00E24A E2 20 sep #%00100000 08088 00E24C A2 07 00 ldx !#cpcodeee-cpcode-1 08089 ; 08090 00E24F BD 99 E4 .0000010 lda cpcode,x ;transfer copy code to... 08091 00E252 95 67 sta mcftwork,x ;to workspace 08092 00E254 CA dex 08093 00E255 10 F8 bpl .0000010 08094 ; 08095 00E257 EB xba ;recover opcode &... 08096 00E258 85 68 sta mcftopc ;set it 08097 longa 08098 00E25A C2 20 rep #%00100000 08099 00E25C 68 pla ;get banks &... 08100 00E25D 85 69 sta mcftbnk ;set them 08101 00E25F 60 rts 08102 ; 08103 ;================================================================================ 08104 ; 08105 ;decdcnt: DECREMENT DUMP COUNT 08106 ; ——————————————————————————————————————————— 08107 ; Preparatory Ops: bytes to process in FACB 08108 ; bytes processed in CHARCNT 08109 ; 08110 ; Returned Values: .A: used 08111 ; .X: entry value 08112 ; .Y: entry value 08113 ; .C: 1 = count = zero 08114 ; ——————————————————————————————————————————— 08115 ; 08116 decdcnt longa 08117 00E260 C2 20 rep #%00100000 08118 00E262 A5 71 lda facb+s_word ;count MSW 08119 00E264 29 FF 00 and !#%11111111 ;get rid of MSB 08120 00E267 38 sec 08121 00E268 05 6F ora facb ;count LSW 08122 00E26A F0 13 beq .0000020 ;zero, just exit 08123 ; 08124 00E26C A5 6F lda facb 08125 00E26E E5 84 sbc charcnt ;bytes processed 08126 00E270 85 6F sta facb 08127 shorta 08128 00E272 E2 20 sep #%00100000 08129 00E274 A5 71 lda facb+s_word 08130 00E276 E9 00 sbc #0 ;handle borrow 08131 00E278 90 04 bcc .0000010 ;underflow 08132 ; 08133 00E27A 85 71 sta facb+s_word 08134 00E27C 18 clc ;count > 0 08135 00E27D 60 rts 08136 ; 08137 00E27E 38 .0000010 sec 08138 ; 08139 .0000020 shorta 08140 00E27F E2 20 sep #%00100000 08141 00E281 60 rts 08142 ; 08143 ;================================================================================ 08144 ; 08145 ;enddest: GET 2ND & 3RD ADDRESSES FOR COMPARE & TRANSFER 08146 ; 08147 00E282 20 C6 E2 enddest jsr facasize ;check start... 08148 00E285 C9 04 cmp #s_dword ;for range 08149 00E287 B0 1E bcs .0000010 ;out of range — error 08150 ; 08151 00E289 20 A8 E2 jsr facaddra ;store start 08152 00E28C 20 D6 E2 jsr getparm ;get end 08153 00E28F B0 16 bcs .0000010 ;not entered — error 08154 ; 08155 00E291 20 C6 E2 jsr facasize ;check end... 08156 00E294 C9 04 cmp #s_dword ;for range 08157 00E296 B0 0F bcs .0000010 ;out of range — error 08158 ; 08159 00E298 20 B2 E2 jsr facaddrb ;store end 08160 00E29B 20 D6 E2 jsr getparm ;get destination 08161 00E29E B0 07 bcs .0000010 ;not entered — error 08162 ; 08163 00E2A0 20 C6 E2 jsr facasize ;check destination... 08164 00E2A3 C9 04 cmp #s_dword ;for range 08165 00E2A5 90 15 bcc facaoper ;store dest address 08166 ; 08167 00E2A7 60 .0000010 rts ;exit w/error 08168 ; 08169 ;================================================================================ 08170 ; 08171 ;facaddra: COPY FACA TO ADDRA 08172 ; 08173 00E2A8 A2 02 facaddra ldx #s_wword-1 08174 ; 08175 00E2AA B5 67 .0000010 lda faca,x 08176 00E2AC 95 61 sta addra,x 08177 00E2AE CA dex 08178 00E2AF 10 F9 bpl .0000010 08179 ; 08180 00E2B1 60 rts 08181 ; 08182 ;================================================================================ 08183 ; 08184 ;facaddrb: COPY FACA TO ADDRB 08185 ; 08186 00E2B2 A2 02 facaddrb ldx #s_wword-1 08187 ; 08188 00E2B4 B5 67 .0000010 lda faca,x 08189 00E2B6 95 64 sta addrb,x 08190 00E2B8 CA dex 08191 00E2B9 10 F9 bpl .0000010 08192 ; 08193 00E2BB 60 rts 08194 ; 08195 ;================================================================================ 08196 ; 08197 ;facaoper: COPY FACA TO OPERAND 08198 ; 08199 00E2BC A2 02 facaoper ldx #s_oper-1 08200 ; 08201 00E2BE B5 67 .0000010 lda faca,x 08202 00E2C0 95 7B sta operand,x 08203 00E2C2 CA dex 08204 00E2C3 10 F9 bpl .0000010 08205 ; 08206 00E2C5 60 rts 08207 ; 08208 ;================================================================================ 08209 ; 08210 ;facasize: REPORT OPERAND SIZE IN FACA 08211 ; 08212 ; —————————————————————————————————————————— 08213 ; Preparatory Ops: operand in FACA 08214 ; 08215 ; Returned Values: .A: s_byte (1) 08216 ; s_word (2) 08217 ; s_xword (3) 08218 ; s_dword (4) 08219 ; .X: entry value 08220 ; .Y: entry value 08221 ; 08222 ; Notes: 1) This function will always report 08223 ; a non-zero result. 08224 ; —————————————————————————————————————————— 08225 ; 08226 facasize shortr 08227 00E2C6 E2 30 sep #%00110000 08228 00E2C8 A2 03 ldx #s_dword-1 08229 ; 08230 00E2CA B5 67 .0000010 lda faca,x ;get byte 08231 00E2CC D0 03 bne .0000020 ;done 08232 ; 08233 00E2CE CA dex 08234 00E2CF D0 F9 bne .0000010 ;next byte 08235 ; 08236 00E2D1 E8 .0000020 inx ;count=index+1 08237 00E2D2 8A txa 08238 00E2D3 60 rts 08239 ; 08240 ;================================================================================ 08241 ; 08242 ;getparm: EVALUATE A PARAMETER 08243 ; 08244 ; ————————————————————————————————————————————————— 08245 ; Preparatory Ops: null-terminated input in IBUFFER 08246 ; 08247 ; Returned Values: .A: chars in converted parameter 08248 ; .X: used 08249 ; .Y: entry value 08250 ; .C: 1 = no parameter entered 08251 ; ————————————————————————————————————————————————— 08252 ; 08253 00E2D4 C6 7F getparmr dec ibufidx ;reread previous char 08254 ; 08255 00E2D6 5A getparm phy ;preserve 08256 00E2D7 20 D8 E7 jsr ascbin ;convert parameter to binary 08257 00E2DA B0 1C bcs .0000040 ;conversion error 08258 ; 08259 00E2DC 20 B0 E3 jsr getcharr ;reread last char 08260 00E2DF D0 08 bne .0000010 ;not end-of-input 08261 ; 08262 00E2E1 C6 7F dec ibufidx ;reindex to terminator 08263 00E2E3 A5 84 lda charcnt ;get chars processed so far 08264 00E2E5 F0 0C beq .0000030 ;none 08265 ; 08266 00E2E7 D0 08 bne .0000020 ;some 08267 ; 08268 00E2E9 C9 20 .0000010 cmp #a_blank ;recognized delimiter 08269 00E2EB F0 04 beq .0000020 ;end of parameter 08270 ; 08271 00E2ED C9 2C cmp #',' ;recognized delimiter 08272 00E2EF D0 07 bne .0000040 ;unknown delimter 08273 ; 08274 00E2F1 18 .0000020 clc 08275 .byte bitzp ;skip SEC below 08276 ; 08277 00E2F3 38 .0000030 sec 08278 00E2F4 7A ply ;restore 08279 00E2F5 A5 84 lda charcnt ;get count 08280 00E2F7 60 rts ;done 08281 ; 08282 00E2F8 4C 36 DB .0000040 jmp monerr ;abort w/error 08283 ; 08284 ;================================================================================ 08285 ; 08286 ;nxtaddra: TEST & INCREMENT WORKING ADDRESS 'A' 08287 ; 08288 ; —————————————————————————————————————————————————— 08289 ; Calling syntax: JSR NXTADDRA 08290 ; 08291 ; Exit registers: .A: used 08292 ; .B: used 08293 ; .X: entry value 08294 ; .Y: entry value 08295 ; DB: entry value 08296 ; DP: entry value 08297 ; PB: entry value 08298 ; SR: NVmxDIZC 08299 ; |||||||| 08300 ; |||||||+———> 0: ADDRA < ADDRB 08301 ; ||||||| 1: ADDRA >= ADDRB 08302 ; ||||||+————> undefined 08303 ; |||+++—————> entry value 08304 ; ||+————————> 1 08305 ; ++—————————> undefined 08306 ; —————————————————————————————————————————————————— 08307 ; 08308 nxtaddra shorta 08309 00E2FB E2 20 sep #%00100000 08310 00E2FD A5 63 lda addra+s_word ;bits 16-23 08311 00E2FF C5 66 cmp addrb+s_word 08312 00E301 90 0F bcc incaddra ;increment 08313 ; 08314 00E303 D0 0A bne .0000010 ;don't increment 08315 ; 08316 longa 08317 00E305 C2 20 rep #%00100000 08318 00E307 A5 61 lda addra ;bits 0-15 08319 00E309 C5 64 cmp addrb ;condition flags 08320 shorta 08321 00E30B E2 20 sep #%00100000 08322 00E30D 90 03 bcc incaddra ;increment 08323 ; 08324 00E30F 60 .0000010 rts 08325 ; 08326 ;================================================================================ 08327 ; 08328 ;getbyte: GET A BYTE FROM MEMORY 08329 ; 08330 00E310 A7 61 getbyte lda [addra] ;get a byte & fall through 08331 ; 08332 ;================================================================================ 08333 ; 08334 ;incaddra: INCREMENT WORKING ADDRESS 'A' 08335 ; 08336 ; —————————————————————————————————————————————————— 08337 ; Calling syntax: JSR INCADDRA 08338 ; 08339 ; Exit registers: .A: entry value 08340 ; .B: entry value 08341 ; .X: entry value 08342 ; .Y: entry value 08343 ; DB: entry value 08344 ; DP: entry value 08345 ; PB: entry value 08346 ; SR: NVmxDIZC 08347 ; |||||||| 08348 ; ++++++++———> entry value 08349 ; —————————————————————————————————————————————————— 08350 ; 08351 00E312 08 incaddra php 08352 longa 08353 00E313 C2 20 rep #%00100000 08354 00E315 E6 61 inc addra ;bump bits 0-15 08355 00E317 D0 04 bne .0000010 08356 ; 08357 shorta 08358 00E319 E2 20 sep #%00100000 08359 00E31B E6 63 inc addra+s_word ;bump bits 16-23 08360 ; 08361 00E31D 28 .0000010 plp 08362 00E31E 60 rts 08363 ; 08364 ;================================================================================ 08365 ; 08366 ;instdata: GET INSTRUCTION SIZE & ADDRESSING MODE DATA 08367 ; 08368 ; —————————————————————————————————— 08369 ; Preparatory Ops: .X: 65C816 opcode 08370 ; 08371 ; Returned Values: .A: mode flags 08372 ; .X: operand size 08373 ; .Y: mode index 08374 ; —————————————————————————————————— 08375 ; 08376 instdata shortr 08377 00E31F E2 30 sep #%00110000 08378 00E321 BD D7 EC lda mnetabam,x ;addressing mode data 08379 00E324 48 pha ;save mode flag bits 08380 00E325 48 pha ;save size data 08381 00E326 29 0F and #amodmask ;extract mode index &... 08382 00E328 A8 tay ;save 08383 00E329 68 pla ;recover data 08384 00E32A 29 30 and #opsmask ;mask mode fields &... 08385 .rept n_opslsr ;extract operand size 08386 00E32C 4A lsr 08387 00E32D 4A lsr 08388 00E32E 4A lsr 08389 00E32F 4A lsr 08390 00E330 AA tax ;operand size 08391 00E331 68 pla ;recover mode flags 08392 00E332 29 C0 and #vopsmask ;discard mode & size fields 08393 00E334 60 rts 08394 ; 08395 ;================================================================================ 08396 ; 08397 ;offtarg: CONVERT BRANCH OFFSET TO TARGET ADDRESS 08398 ; 08399 ; ——————————————————————————————————————————————— 08400 ; Preparatory Ops: ADDRA: base address 08401 ; INSTSIZE: instruction size 08402 ; OPERAND: offset 08403 ; 08404 ; Returned Values: OPERAND: target address (L/H) 08405 ; .A: used 08406 ; .X: entry value 08407 ; .Y: entry value 08408 ; ——————————————————————————————————————————————— 08409 ; 08410 offtarg longa 08411 00E335 C2 20 rep #%00100000 08412 00E337 A5 61 lda addra ;base address 08413 shorta 08414 00E339 E2 20 sep #%00100000 08415 00E33B 46 86 lsr instsize ;bit 0 will be set if... 08416 00E33D B0 07 bcs .0000010 ;a long branch 08417 ; 08418 00E33F 24 7B bit operand ;short forward or backward? 08419 00E341 10 03 bpl .0000010 ;forward 08420 ; 08421 00E343 EB xba ;expose address MSB 08422 00E344 3A dec ;back a page 08423 00E345 EB xba ;expose address LSB 08424 ; 08425 .0000010 longa 08426 00E346 C2 20 rep #%00100000 08427 00E348 18 clc 08428 00E349 65 7B adc operand ;calculate target address 08429 00E34B 85 7B sta operand ;new operand 08430 shorta 08431 00E34D E2 20 sep #%00100000 08432 00E34F A9 03 lda #s_wword 08433 00E351 85 86 sta instsize ;effective instruction size 08434 00E353 60 rts 08435 ; 08436 ;================================================================================ 08437 ; 08438 ;setxaddr: SET EXECUTION ADDRESS 08439 ; 08440 00E354 B0 13 setxaddr bcs .0000010 ;no address given 08441 ; 08442 00E356 20 C6 E2 jsr facasize ;check address... 08443 00E359 C9 04 cmp #s_dword ;range 08444 00E35B B0 0D bcs .0000020 ;out of range 08445 ; 08446 longa 08447 00E35D C2 20 rep #%00100000 08448 00E35F A5 67 lda faca ;execution address 08449 00E361 85 53 sta reg_pcx ;set new PC value 08450 shorta 08451 00E363 E2 20 sep #%00100000 08452 00E365 A5 69 lda faca+s_word 08453 00E367 85 52 sta reg_pbx ;set new PB value 08454 ; 08455 00E369 18 .0000010 clc ;no error 08456 ; 08457 00E36A 60 .0000020 rts 08458 ; 08459 ;================================================================================ 08460 ; 08461 ;targoff: CONVERT BRANCH TARGET ADDRESS TO BRANCH OFFSET 08462 ; 08463 ; ————————————————————————————————————————————————— 08464 ; Preparatory Ops: ADDRA: instruction address 08465 ; OPERAND: target address 08466 ; 08467 ; Returned Values: OPERAND: computed offset 08468 ; .A: effective operand size 08469 ; .X: entry value 08470 ; .Y: entry value 08471 ; .C: 1 = branch out of range 08472 ; 08473 ; Execution notes: ADDRB is set to the branch base 08474 ; address. 08475 ; ————————————————————————————————————————————————— 08476 ; 08477 00E36B 64 87 targoff stz instsize+s_byte ;always zero 08478 00E36D A5 86 lda instsize ;instruction size will tell... 08479 00E36F 4A lsr ;if long or short branch 08480 ; 08481 ;————————————————————————————————————————————————— 08482 007A .btype =facc+5 ;branch type flag 08483 ;————————————————————————————————————————————————— 08484 ; 08485 00E370 66 7A ror .btype ;set branch type... 08486 ; 08487 ; x0000000 08488 ; | 08489 ; +——————————> 0: short 08490 ; 1: long 08491 ; 08492 longa 08493 00E372 C2 20 rep #%00100000 08494 00E374 18 clc 08495 00E375 A5 61 lda addra ;instruction address 08496 00E377 65 86 adc instsize ;instruction size 08497 00E379 85 64 sta addrb ;base address 08498 00E37B 38 sec 08499 00E37C A5 7B lda operand ;target address 08500 00E37E E5 64 sbc addrb ;base address 08501 00E380 85 7B sta operand ;offset 08502 shorta 08503 00E382 E2 20 sep #%00100000 08504 00E384 90 15 bcc .0000040 ;backward branch 08505 ; 08506 00E386 24 7A bit .btype ;check branch range 08507 00E388 30 0A bmi .0000020 ;long 08508 ; 08509 ; 08510 ; process short forward branch... 08511 ; 08512 00E38A EB xba ;offset MSB should be zero 08513 00E38B D0 21 bne .0000060 ;it isn't — out of range 08514 ; 08515 00E38D EB xba ;offset LSB should be $00-$7F 08516 00E38E 30 1E bmi .0000060 ;it isn't — out of range 08517 ; 08518 00E390 A9 01 .0000010 lda #s_byte ;final instruction size 08519 00E392 18 clc ;branch in range 08520 00E393 60 rts 08521 ; 08522 ; 08523 ; process long forward branch... 08524 ; 08525 00E394 EB .0000020 xba ;offset MSB should be positive 08526 00E395 30 17 bmi .0000060 ;it isn't — branch out of range 08527 ; 08528 00E397 A9 02 .0000030 lda #s_word 08529 00E399 18 clc 08530 00E39A 60 rts 08531 ; 08532 ; 08533 ; process backward branch... 08534 ; 08535 00E39B 24 7A .0000040 bit .btype ;long or short? 08536 00E39D 30 0C bmi .0000050 ;long 08537 ; 08538 ; 08539 ; process short backward branch... 08540 ; 08541 00E39F EB xba ;offset MSB should be negative 08542 00E3A0 10 0C bpl .0000060 ;it isn't — out of range 08543 ; 08544 00E3A2 49 FF eor #%11111111 ;complement offset MSB 2s 08545 00E3A4 D0 08 bne .0000060 ;out of range 08546 ; 08547 00E3A6 EB xba ;offset LSB should be $80-$FF 08548 00E3A7 30 E7 bmi .0000010 ;it is — branch in range 08549 ; 08550 00E3A9 80 03 bra .0000060 ;branch out of range 08551 ; 08552 ; 08553 ; process long backward branch... 08554 ; 08555 00E3AB EB .0000050 xba ;offset MSB should be negative 08556 00E3AC 30 E9 bmi .0000030 ;it is — branch in range 08557 ; 08558 00E3AE 38 .0000060 sec ;range error 08559 00E3AF 60 rts 08560 ; 08561 ;================================================================================ 08562 ; 08563 ;getcharr: GET PREVIOUS INPUT BUFFER CHARACTER 08564 ; 08565 00E3B0 C6 7F getcharr dec ibufidx ;move back a char 08566 ; 08567 ;================================================================================ 08568 ; 08569 ;getchar: GET A CHARACTER FROM INPUT BUFFER 08570 ; 08571 ; ———————————————————————————————————————— 08572 ; Preparatory Ops : none 08573 ; 08574 ; Register Returns: .A: character or 08575 ; .B: entry value 08576 ; .X: entry value 08577 ; .Y: entry value 08578 ; DB: entry value 08579 ; DP: entry value 08580 ; PB: entry value 08581 ; 08582 ; MPU Flags: NVmxDIZC 08583 ; |||||||| 08584 ; |||||||+———> entry value 08585 ; ||||||+————> 1: gotten 08586 ; ++++++—————> entry value 08587 ; ———————————————————————————————————————— 08588 ; 08589 00E3B2 DA getchar phx 08590 00E3B3 5A phy 08591 00E3B4 08 php ;save register sizes 08592 shortr ;force 8 bits 08593 00E3B5 E2 30 sep #%00110000 08594 00E3B7 A6 7F ldx ibufidx ;buffer index 08595 00E3B9 BD 00 02 lda ibuffer,x ;get char 08596 00E3BC E6 7F inc ibufidx ;bump index 08597 00E3BE 28 plp ;restore register widths 08598 00E3BF 7A ply 08599 00E3C0 FA plx 08600 00E3C1 48 pha ;condition... 08601 00E3C2 68 pla ;.Z 08602 00E3C3 60 rts 08603 ; 08604 ;================================================================================ 08605 ; 08606 ;getpat: GET PATTERN FOR MEMORY CHANGE or SEARCH 08607 ; 08608 ; ————————————————————————————————————————————————————— 08609 ; Preparatory Ops: Null-terminated pattern in IBUFFER. 08610 ; 08611 ; Returned Values: .A: used 08612 ; .X: used 08613 ; .Y: pattern length if entered 08614 ; .C: 0 = pattern valid 08615 ; 1 = exception 08616 ; .N 0 = no pattern entered 08617 ; 1 = evaluation error 08618 ; 08619 ; Notes: 1) If pattern is preceded by "'" the following 08620 ; characters are interpreted as ASCII. 08621 ; 2) A maximum of S_AUXBUF bytes or chars is 08622 ; accepted. Excess input will be discarded. 08623 ; ————————————————————————————————————————————————————— 08624 ; 08625 00E3C4 64 8B getpat stz status ;clear pattern type indicator 08626 00E3C6 A0 00 ldy #0 ;pattern index 08627 00E3C8 20 B0 E3 jsr getcharr ;get last char 08628 00E3CB F0 3C beq .0000070 ;EOS 08629 ; 08630 00E3CD A6 7F ldx ibufidx ;current buffer index 08631 00E3CF 20 10 E4 jsr getcharw ;get next 08632 00E3D2 F0 35 beq .0000070 ;EOS 08633 ; 08634 00E3D4 C9 27 cmp #''' 08635 00E3D6 D0 04 bne .0000010 ;not ASCII input 08636 ; 08637 00E3D8 66 8B ror status ;condition flag 08638 00E3DA 80 12 bra .0000030 ;balance of input is ASCII 08639 ; 08640 00E3DC 86 7F .0000010 stx ibufidx ;restore buffer index 08641 ; 08642 00E3DE 20 D6 E2 .0000020 jsr getparm ;evaluate numeric pattern 08643 00E3E1 B0 21 bcs .0000060 ;done w/pattern 08644 ; 08645 00E3E3 20 C6 E2 jsr facasize ;size 08646 00E3E6 C9 02 cmp #s_word 08647 00E3E8 B0 1F bcs .0000070 ;not a byte — error 08648 ; 08649 00E3EA A5 67 lda faca ;get byte &... 08650 00E3EC 80 05 bra .0000040 ;store 08651 ; 08652 00E3EE 20 B2 E3 .0000030 jsr getchar ;get ASCII char 08653 00E3F1 F0 11 beq .0000060 ;done w/pattern 08654 ; 08655 00E3F3 C0 20 .0000040 cpy #s_auxbuf ;pattern buffer full? 08656 00E3F5 F0 0A beq .0000050 ;yes 08657 ; 08658 00E3F7 99 46 02 sta auxbuf,y ;store pattern 08659 00E3FA C8 iny 08660 00E3FB 24 8B bit status 08661 00E3FD 10 DF bpl .0000020 ;get next numeric value 08662 ; 08663 00E3FF 80 ED bra .0000030 ;get next ASCII char 08664 ; 08665 00E401 20 C1 E7 .0000050 jsr alert ;excess input 08666 ; 08667 00E404 84 7E .0000060 sty auxbufix ;save pattern size 08668 00E406 98 tya ;condition .Z 08669 00E407 18 clc ;pattern valid 08670 00E408 60 rts 08671 ; 08672 ; 08673 ; no pattern entered... 08674 ; 08675 00E409 C2 80 .0000070 rep #%10000000 08676 00E40B 38 sec 08677 00E40C 60 rts 08678 ; 08679 ; 08680 ; evaluation error... 08681 ; 08682 00E40D E2 81 .0000080 sep #%10000001 08683 00E40F 60 rts 08684 ; 08685 ;================================================================================ 08686 ; 08687 ;getcharw: GET FROM INPUT BUFFER, DISCARDING WHITESPACE 08688 ; 08689 ; —————————————————————————————————————————————————— 08690 ; Preparatory Ops: Null-terminated input in IBUFFER. 08691 ; 08692 ; Returned Values: .A: char or null 08693 ; .X: entry value 08694 ; .Y: entry value 08695 ; .Z: 1 = null terminator detected 08696 ; 08697 ; Notes: Whitespace is defined as a blank ($20) or a 08698 ; horizontal tab ($09). 08699 ; —————————————————————————————————————————————————— 08700 ; 08701 00E410 20 B2 E3 getcharw jsr getchar ;get from buffer 08702 00E413 F0 08 beq .0000010 ;EOI 08703 ; 08704 00E415 C9 20 cmp #' ' 08705 00E417 F0 F7 beq getcharw ;discard whitespace 08706 ; 08707 00E419 C9 09 cmp #a_ht ;also whitespace 08708 00E41B F0 F3 beq getcharw 08709 ; 08710 00E41D 18 .0000010 clc 08711 00E41E 60 rts 08712 ; 08713 ;================================================================================ 08714 ; 08715 ;input: INTERACTIVE INPUT FROM CONSOLE CHANNEL 08716 ; 08717 ; ——————————————————————————————————————————————————————————— 08718 ; Preparatory Ops: Zero IBUFIDX, or load IBUFFER with default 08719 ; input & set IBUFIDX to the number of chars 08720 ; loaded into the buffer. 08721 ; 08722 ; Returned Values: .A: used 08723 ; .X: characters entered 08724 ; .Y: used 08725 ; 08726 ; Example: STZ IBUFIDX 08727 ; JSR INPUT 08728 ; 08729 ; Notes: Input is collected in IBUFFER & is null-terminated. 08730 ; IBUFIDX is reset to zero upon exit. 08731 ; ——————————————————————————————————————————————————————————— 08732 ; 08733 00E41F A6 7F input ldx ibufidx 08734 00E421 9E 00 02 stz ibuffer,x ;be sure buffer is terminated 08735 00E424 20 0B E7 jsr dpyibuf ;print default input if any 08736 printf dc_cn ;enable cursor 08737 00E427 F4 33 EE pea #.s 08738 00E42A 20 35 D6 jsr sprint 08739 00E42D A6 7F ldx ibufidx ;starting buffer index 08740 ; 08741 ; 08742 ; main input loop... 08743 ; 08744 00E42F 20 D6 D1 .0000010 jsr getcha ;poll for input 08745 00E432 B0 3F bcs .0000060 ;nothing 08746 ; 08747 00E434 C9 7F cmp #a_del ;above ASCII range? 08748 00E436 B0 13 bcs .0000030 ;yes, not allowed 08749 ; 08750 00E438 C9 09 cmp #a_ht ;horizontal tab? 08751 00E43A D0 02 bne .0000020 ;no 08752 ; 08753 00E43C A9 20 lda #a_blank ;replace w/blank 08754 ; 08755 00E43E C9 20 .0000020 cmp #a_blank ;control char? 08756 00E440 90 10 bcc .0000040 ;yes 08757 ; 08758 ; 08759 ; process QWERTY character... 08760 ; 08761 00E442 E0 45 cpx #s_ibuf ;room in buffer? 08762 00E444 B0 05 bcs .0000030 ;no 08763 ; 08764 00E446 9D 00 02 sta ibuffer,x ;store char 08765 00E449 E8 inx ;bump index 08766 .byte bitabs ;echo char 08767 ; 08768 00E44B A9 07 .0000030 lda #a_bel ;alert user 08769 00E44D 20 4A D2 jsr putcha 08770 00E450 80 DD bra .0000010 ;get some more 08771 ; 08772 ; 08773 ; process carriage return... 08774 ; 08775 00E452 C9 0D .0000040 cmp #a_cr ;carriage return? 08776 00E454 D0 0E bne .0000050 ;no 08777 ; 08778 00E456 DA phx ;protect input count 08779 printf dc_co ;cursor off 08780 00E457 F4 37 EE pea #.s 08781 00E45A 20 35 D6 jsr sprint 08782 00E45D FA plx ;recover input count 08783 00E45E 9E 00 02 stz ibuffer,x ;terminate input 08784 00E461 64 7F stz ibufidx ;reset buffer index 08785 00E463 60 rts ;done 08786 ; 08787 ; 08788 ; process backspace... 08789 ; 08790 00E464 C9 08 .0000050 cmp #a_bs ;backspace? 08791 00E466 D0 C7 bne .0000010 ;no 08792 ; 08793 00E468 8A txa 08794 00E469 F0 C4 beq .0000010 ;no input, ignore 08795 ; 08796 00E46B CA dex ;1 less char 08797 00E46C DA phx ;preserve count 08798 00E46D 20 5A E7 jsr gendbs ;destructive backspace 08799 00E470 FA plx ;restore count 08800 00E471 80 BC bra .0000010 ;get more input 08801 ; 08802 ; 08803 ; waiting loop... 08804 ; 08805 00E473 CB .0000060 wai ;wait for datum 08806 00E474 80 B9 bra .0000010 08807 ; 08808 ;================================================================================ 08809 ; 08810 ;lodbnk: LOAD SOURCE & DESTINATION BANKS 08811 ; 08812 lodbnk shorta 08813 00E476 E2 20 sep #%00100000 08814 00E478 A5 7D lda operand+s_word ;destination bank 08815 00E47A EB xba ;make it MSB 08816 00E47B A5 63 lda addra+s_word ;source bank is LSB 08817 00E47D 60 rts 08818 ; 08819 ;================================================================================ 08820 ; 08821 ;getcharc: GET A CHARACTER FROM INPUT BUFFER & CONVERT CASE 08822 ; 08823 ; —————————————————————————————————————————————————— 08824 ; Preparatory Ops: Null-terminated input in IBUFFER. 08825 ; 08826 ; Returned Values: .A: char or null 08827 ; .X: entry value 08828 ; .Y: entry value 08829 ; .Z: 1 = null terminator detected 08830 ; —————————————————————————————————————————————————— 08831 ; 08832 00E47E 20 B2 E3 getcharc jsr getchar ;get from buffer 08833 ; 08834 ;================================================================================ 08835 ; 08836 ;toupper: FORCE CHARACTER TO UPPER CASE 08837 ; 08838 ; —————————————————————————————————————————————— 08839 ; Preparatory Ops : .A: character to convert 08840 ; 08841 ; Register Returns: .A: converted character 08842 ; .B: entry value 08843 ; .X: entry value 08844 ; .Y: entry value 08845 ; DB: entry value 08846 ; DP: entry value 08847 ; PB: entry value 08848 ; 08849 ; MPU Flags: NVmxDIZC 08850 ; |||||||| 08851 ; ++++++++———> entry value 08852 ; 08853 ; Notes: 1) Accumulator must be 8 bits on entry. 08854 ; 2) This subroutine has no effect on 08855 ; characters that are not alpha. 08856 ; —————————————————————————————————————————————— 08857 ; 08858 00E481 08 toupper php ;protect flags 08859 00E482 C9 61 cmp #a_asclcl ;check char range 08860 00E484 90 06 bcc .0000010 ;not LC alpha 08861 ; 08862 00E486 C9 7B cmp #a_asclch+s_byte 08863 00E488 B0 02 bcs .0000010 ;not LC alpha 08864 ; 08865 00E48A 29 5F and #a_lctouc ;change to UC 08866 ; 08867 00E48C 28 .0000010 plp ;restore flags 08868 00E48D 60 rts 08869 ; 08870 ;================================================================================ 08871 ; 08872 ;teststop: TEST FOR STOP KEY 08873 ; 08874 ; —————————————————————————————————————————————— 08875 ; Preparatory Ops: none 08876 ; 08877 ; Returned Values: .A: detected keypress, if any 08878 ; .B: entry value 08879 ; .X: entry value 08880 ; .Y: entry value 08881 ; DB: entry value 08882 ; DP: entry value 08883 ; PB: entry value 08884 ; 08885 ; MPU Flags: NVmxDIZC 08886 ; |||||||| 08887 ; |||||||+———> 0: normal key detected 08888 ; ||||||| 1: detected 08889 ; +++++++————> undefined 08890 ; 08891 ; Example: jsr teststop 08892 ; bcs stopped 08893 ; 08894 ; Notes: The symbol STOPKEY defines the ASCII 08895 ; value of the "stop key." 08896 ; —————————————————————————————————————————————— 08897 ; 08898 00E48E 20 D6 D1 teststop jsr getcha ;poll console 08899 00E491 B0 04 bcs .0000010 ;no input 08900 ; 08901 00E493 C9 03 cmp #stopkey ;stop key pressed? 08902 00E495 F0 01 beq .0000020 ;yes 08903 ; 08904 00E497 18 .0000010 clc 08905 ; 08906 00E498 60 .0000020 rts 08907 ; 08908 ;================================================================================ 08909 ; 08910 ;cpcode: COPY MEMORY CODE 08911 ; 08912 ; ——————————————————————————————————————————— 08913 ; This code is transfered to workspace when a 08914 ; copy or fill operation is to be performed. 08915 ; ——————————————————————————————————————————— 08916 ; 08917 00E499 8B cpcode phb ;must preserve data bank 08918 .rept s_mvinst ;placeholder — do not delete 08919 00E49A EA nop 08920 00E49B EA nop 08921 00E49C EA nop 08922 00E49D AB plb ;restore data bank 08923 00E49E 4C D1 DA jmp monce ;return to command executive 08924 E4A1 cpcodeee =* ;placeholder — do not delete 08925 ; 08926 .end 08927 .include "mon/subs_scsi.asm" 08928 ;================================================================================ 08929 ; 08930 ;getidlun: GET SCSI ID & LUN 08931 ; 08932 ; ————————————————————————————————————————————————————————— 08933 ; Preparatory Ops : NONE 08934 ; 08935 ; Register Returns: .A: used 08936 ; .B: used 08937 ; .X: LUN shifted to LUN bit field 08938 ; .Y: entry value 08939 ; 08940 ; Other returns : FLIMFLAG: xx000000 08941 ; || 08942 ; |+—————————> 0: 21 bit LBAs 08943 ; | 1: 32 bit LBAs 08944 ; +——————————> 0: block device 08945 ; 1: stream device 08946 ; 08947 ; MPU Flags: NVmxDIZC 08948 ; |||||||| 08949 ; |||||||+———> 0: okay 08950 ; ||||||| 1: ID or LUN out of range 08951 ; ||||||+————> undefined 08952 ; |||||+—————> undefined 08953 ; ||||+——————> undefined 08954 ; |||+———————> 1 08955 ; ||+————————> 1 08956 ; |+—————————> undefined 08957 ; +——————————> undefined 08958 ; ————————————————————————————————————————————————————————— 08959 ; 08960 00E4A1 20 C6 E2 getidlun jsr facasize ;check parameter range 08961 00E4A4 C9 02 cmp #s_word ;should be a byte 08962 00E4A6 B0 42 bcs .0000020 ;too big — error 08963 ; 08964 00E4A8 A5 67 lda faca ;SCSI ID 08965 00E4AA 85 7B sta operand ;save it 08966 longx 08967 00E4AC C2 10 rep #%00010000 08968 00E4AE A2 46 02 ldx !#auxbuf ;workspace 08969 00E4B1 20 29 D8 jsr scsiparm ;get device info 08970 00E4B4 B0 34 bcs .0000020 ;ID out of range 08971 ; 08972 shortr 08973 00E4B6 E2 30 sep #%00110000 08974 00E4B8 38 sec 08975 00E4B9 2C 46 02 bit auxbuf ;device enumerated? 08976 00E4BC 10 2C bpl .0000020 ;no 08977 ; 08978 00E4BE AD 47 02 lda auxbuf+o_sdtype ;get type field 08979 00E4C1 AA tax 08980 00E4C2 29 80 and #%10000000 ;isolate LBA flag bit 08981 00E4C4 4A lsr ;shift &... 08982 00E4C5 85 8E sta flimflag ;store 08983 00E4C7 8A txa ;get type again 08984 00E4C8 29 1F and #sdtmask ;extract type 08985 00E4CA C9 01 cmp #sd_seq ;sequential stream device? 08986 00E4CC D0 04 bne .0000010 ;no 08987 ; 08988 00E4CE A9 80 lda #%10000000 ;yes 08989 00E4D0 04 8E tsb flimflag 08990 ; 08991 00E4D2 20 D6 E2 .0000010 jsr getparm ;get LUN 08992 00E4D5 B0 13 bcs .0000020 ;missing LUN — error 08993 ; 08994 00E4D7 20 C6 E2 jsr facasize ;check LUN range 08995 00E4DA C9 02 cmp #s_word ;should be a byte 08996 00E4DC B0 0C bcs .0000020 ;too big — error 08997 ; 08998 00E4DE A5 67 lda faca ;LUN 08999 00E4E0 C9 08 cmp #n_scsilu ;should be 0-7 09000 00E4E2 B0 06 bcs .0000020 ;error 09001 ; 09002 .rept n_lunshf ;shift to LUN field 09003 00E4E4 0A asl 09004 00E4E5 0A asl 09005 00E4E6 0A asl 09006 00E4E7 0A asl 09007 00E4E8 0A asl 09008 00E4E9 AA tax 09009 ; 09010 .0000020 shortr 09011 00E4EA E2 30 sep #%00110000 09012 00E4EC 60 rts 09013 ; 09014 ;================================================================================ 09015 ; 09016 ;setupcdb: SET UP SCSI COMMAND DESCRIPTOR BLOCK 09017 ; 09018 ; ————————————————————————————————————————— 09019 ; Preparatory Ops : .A: 8 bit SCSI opcode 09020 ; .X: shifted LUN 09021 ; 09022 ; Register Returns: .A: used 09023 ; .B: entry value 09024 ; .X: used 09025 ; .Y: entry value 09026 ; 09027 ; MPU Flags: NVmxDIZC 09028 ; |||||||| 09029 ; |||||||+———> undefined 09030 ; ||||||+————> undefined 09031 ; |||||+—————> undefined 09032 ; ||||+——————> undefined 09033 ; |||+———————> 1 09034 ; ||+————————> 1 09035 ; |+—————————> undefined 09036 ; +——————————> undefined 09037 ; 09038 ; Notes: 1) AUXBUF is used as the SCSI CDB. 09039 ; ————————————————————————————————————————— 09040 ; 09041 00E4ED DA setupcdb phx ;protect LUN 09042 00E4EE A2 09 ldx #s_cdbg2-1 ;CDB size 09043 ; 09044 00E4F0 9E 46 02 .0000010 stz auxbuf,x ;clear CDB workspace 09045 00E4F3 CA dex 09046 00E4F4 10 FA bpl .0000010 09047 ; 09048 00E4F6 FA plx ;recover LUN 09049 00E4F7 8D 46 02 sta auxbuf+so_opcod ;store opcode in CDB 09050 00E4FA 8E 47 02 stx auxbuf+so_lunla ;store LUN in CDB 09051 00E4FD 60 rts 09052 ; 09053 ;================================================================================ 09054 ; 09055 ;SET UP SCSI READ/WRITE PARAMETERS 09056 ; 09057 ; ————————————————————————————————————————————————————— 09058 ; Preparatory Ops: CDB initialized by SETUPCDB, & 09059 ; device & LBA flags conditioned 09060 ; 09061 ; Register Returns: .A: used 09062 ; .B: used 09063 ; .X: used 09064 ; .Y: used 09065 ; 09066 ; MPU Flags: NVmxDIZC 09067 ; |||||||| 09068 ; |||||||+———> 0: okay 09069 ; ||||||| 1: parameter error 09070 ; ||||+++————> undefined 09071 ; ||++———————> 1 09072 ; ++—————————> undefined 09073 ; 09074 ; Notes: 1) If the target is a block device & is 32 bit 09075 ; capable, a group 2 CDB will be set up. 09076 ; ————————————————————————————————————————————————————— 09077 ; 09078 00E4FE 20 D6 E2 setuprwb jsr getparm ;get LBA 09079 00E501 B0 0D bcs .0000020 ;missing LBA 09080 ; 09081 00E503 24 8E bit flimflag ;check device type 09082 longa 09083 00E505 C2 20 rep #%00100000 09084 00E507 10 08 bpl .0000030 ;block (e.g., disk) 09085 ; 09086 00E509 A5 67 lda faca ;stream device's... 09087 00E50B 05 69 ora faca+s_word ;LBA... 09088 00E50D F0 25 beq .0000050 ;must be zero 09089 ; 09090 00E50F 38 .0000010 sec ;abort w/error 09091 ; 09092 00E510 60 .0000020 rts 09093 ; 09094 .0000030 longa 09095 00E511 C2 20 rep #%00100000 09096 00E513 A5 67 lda faca ;LBA LSW 09097 00E515 EB xba ;reverse endianess 09098 00E516 50 0B bvc .0000040 ;use 21 bit LBA 09099 ; 09100 00E518 8D 4A 02 sta auxbuf+so_lbaml ;use 32 bit LBA 09101 00E51B A5 69 lda faca+s_word ;LBA MSW 09102 00E51D EB xba ;reverse endianess 09103 00E51E 8D 48 02 sta auxbuf+so_lbamb ;store into CDB 09104 00E521 80 11 bra .0000050 09105 ; 09106 00E523 8D 48 02 .0000040 sta auxbuf+so_lbam ;use 21 bit LBA 09107 00E526 A5 69 lda faca+s_word ;LBA LSB of MSW 09108 00E528 29 1F 00 and !#lunmaskr ;mask LUN bits 09109 00E52B C5 69 cmp faca+s_word ;any change? 09110 00E52D D0 E0 bne .0000010 ;yes, bogus LBA 09111 ; 09112 shorta ;discard MSB of MSW 09113 00E52F E2 20 sep #%00100000 09114 00E531 0C 47 02 tsb auxbuf+so_lunla ;combine w/LUN 09115 ; 09116 .0000050 shorta 09117 00E534 E2 20 sep #%00100000 09118 00E536 20 D6 E2 jsr getparm ;get number of blocks/bytes 09119 00E539 B0 D5 bcs .0000020 ;missing parameter 09120 ; 09121 00E53B 20 C6 E2 jsr facasize ;allowable block range... 09122 00E53E C9 03 cmp #s_xword ;0-65535 09123 00E540 B0 41 bcs setuprex ;too many blocks/bytes 09124 ; 09125 longa 09126 00E542 C2 20 rep #%00100000 09127 00E544 A5 67 lda faca ;number of blocks/bytes LSW 09128 00E546 EB xba ;reverse endianess 09129 shorta 09130 00E547 E2 20 sep #%00100000 09131 00E549 24 8E bit flimflag ;block or stream device? 09132 longa 09133 00E54B C2 20 rep #%00100000 09134 00E54D 30 07 bmi .0000060 ;stream 09135 ; 09136 00E54F 50 0A bvc .0000070 ;short block addressing 09137 ; 09138 00E551 8D 4D 02 sta auxbuf+so_xfrlh ;long block addressing 09139 00E554 80 15 bra .0000080 09140 ; 09141 00E556 8D 49 02 .0000060 sta auxbuf+so_xfrib ;stream device addressing 09142 00E559 80 10 bra .0000080 09143 ; 09144 .0000070 shorta ;short block addressing 09145 00E55B E2 20 sep #%00100000 09146 00E55D 20 C6 E2 jsr facasize ;recheck block range 09147 00E560 C9 02 cmp #s_word ;0-255 09148 00E562 B0 1F bcs setuprex ;too many blocks 09149 ; 09150 00E564 A5 67 lda faca 09151 00E566 F0 A7 beq .0000010 ;zero = 256: invalid 09152 ; 09153 00E568 8D 4A 02 sta auxbuf+so_xfrl 09154 ; 09155 .0000080 shorta 09156 00E56B E2 20 sep #%00100000 09157 ; 09158 ; 09159 ; get buffer address... 09160 ; 09161 00E56D 20 D6 E2 setuprAA jsr getparm ;get address 09162 00E570 B0 11 bcs setuprex ;none entered 09163 ; 09164 00E572 20 C6 E2 jsr facasize ;check... 09165 00E575 C9 03 cmp #s_wword ;range 09166 00E577 B0 0A bcs setuprex ;out of range 09167 ; 09168 00E579 20 A8 E2 jsr facaddra ;save address 09169 00E57C 20 D6 E2 jsr getparm ;check for extra input 09170 00E57F 6A ror ;capture carry 09171 00E580 49 80 eor #%10000000 ;invert 09172 00E582 0A asl ;put back to carry 09173 ; 09174 00E583 60 setuprex rts 09175 ; 09176 .end 09177 .include "mon/subs_srec.asm" 09178 ;================================================================================ 09179 ; 09180 ;adjloadr: ADJUST S-RECORD LOAD ADDRESS 09181 ; 09182 00E584 A5 8F adjloadr lda pageoff ;page offset 09183 00E586 EB xba ;move to MSB 09184 00E587 A9 00 lda #0 ;even page boundary 09185 longa 09186 00E589 C2 20 rep #%00100000 09187 00E58B 18 clc 09188 00E58C 65 75 adc loadaddr ;record load address 09189 00E58E 85 75 sta loadaddr ;new load address 09190 shorta 09191 00E590 E2 20 sep #%00100000 09192 00E592 60 rts 09193 ; 09194 ;================================================================================ 09195 ; 09196 ;clrchanb: CLEAR EXCESS INPUT FROM AUXILIARY CHANNEL 09197 ; 09198 00E593 CB clrchanb wai ;wait for an IRQ 09199 00E594 20 E0 D1 jsr getchb ;read from channel 09200 00E597 90 FA bcc clrchanb ;keep clearing 09201 ; 09202 00E599 60 rts 09203 ; 09204 ;================================================================================ 09205 ; 09206 ;getchanb: GET DATUM FROM AUXILIARY CHANNEL W/STOP TEST 09207 ; 09208 ; ———————————————————————————————————————————————————————————————————— 09209 ; Preparatory Ops: NONE 09210 ; 09211 ; Returned Values: .A: datum or null 09212 ; .B: used 09213 ; .X: entry value 09214 ; .Y: entry value 09215 ; 09216 ; MPU Flags: NVmxDIZC 09217 ; |||||||| 09218 ; |||||||+———> 0: .A is valid 09219 ; ||||||| 1: user aborted 09220 ; ||||||+————> 0: datum in .A 09221 ; |||||| 1: EOR detected 09222 ; ||||++—————> undefined 09223 ; ||++———————> 1 09224 ; ++—————————> undefined 09225 ; 09226 ; Notes: 1) This sub will loop until a datum is gotten or the stop key 09227 ; is detected on the console channel. 09228 ; 09229 ; 2) If , or the combination is encountered in 09230 ; the input stream, $00 will be substituted. is not 09231 ; a synonym for & if encountered, may cause process- 09232 ; ing errors. 09233 ; ———————————————————————————————————————————————————————————————————— 09234 ; 09235 getchanb shortr ;8 bit loads 09236 00E59A E2 30 sep #%00110000 09237 00E59C A9 00 lda #0 09238 00E59E EB xba ;flush B-accumulator 09239 ; 09240 00E59F 20 8E E4 .0000010 jsr teststop ;check for user abort 09241 00E5A2 B0 19 bcs .0000040 ;aborted 09242 ; 09243 00E5A4 20 E0 D1 jsr getchb ;get datum 09244 00E5A7 B0 15 bcs .0000050 ;none 09245 ; 09246 00E5A9 C9 00 cmp #a_nul ;null received? 09247 00E5AB F0 F2 beq .0000010 ;yes, discard 09248 ; 09249 00E5AD C9 0A cmp #a_lf ;? 09250 00E5AF F0 09 beq .0000020 ;yes, EOR delimiter 09251 ; 09252 00E5B1 C9 0D cmp #a_cr ;? 09253 00E5B3 D0 07 bne .0000030 ;no 09254 ; 09255 00E5B5 EB xba ;look at previous datum 09256 00E5B6 C9 0D cmp #a_cr ;was it a as well? 09257 00E5B8 D0 E5 bne .0000010 ;no, wait for next datum 09258 ; 09259 00E5BA A9 00 .0000020 lda #0 ;end of record 09260 ; 09261 00E5BC 18 .0000030 clc ;valid datum 09262 ; 09263 00E5BD 60 .0000040 rts 09264 ; 09265 00E5BE CB .0000050 wai ;wait for any interrupt &... 09266 00E5BF 80 DE bra .0000010 ;check for data 09267 ; 09268 ;================================================================================ 09269 ; 09270 ;getcvt: GET & CONVERT S-RECORD BYTE PAIR 09271 ; 09272 ; ————————————————————————————————————————————————————————— 09273 ; Preparatory Ops: NONE 09274 ; 09275 ; Returned Values: .A: byte converted from ASCII pair 09276 ; .X: entry value 09277 ; .Y: entry value 09278 ; .C: 0: conversion successful 09279 ; 1: conversion error or premature EOT 09280 ; ————————————————————————————————————————————————————————— 09281 ; 09282 getcvt shortr 09283 00E5C1 E2 30 sep #%00110000 09284 00E5C3 20 B2 E3 jsr getchar ;get MSN char 09285 00E5C6 F0 18 beq .0000010 ;premature EOT 09286 ; 09287 00E5C8 20 87 E9 jsr nybtobin ;convert to a nybble 09288 00E5CB B0 14 bcs .0000020 ;conversion error 09289 ; 09290 .rept s_bnybbl ;shift to MSN position 09291 00E5CD 0A asl 09292 00E5CE 0A asl 09293 00E5CF 0A asl 09294 00E5D0 0A asl 09295 00E5D1 85 7E sta datax ;store MSN 09296 00E5D3 20 B2 E3 jsr getchar ;get LSN char 09297 00E5D6 F0 08 beq .0000010 ;premature EOT 09298 ; 09299 00E5D8 20 87 E9 jsr nybtobin 09300 00E5DB B0 04 bcs .0000020 ;error 09301 ; 09302 00E5DD 05 7E ora datax ;combine with MSN 09303 00E5DF 60 rts ;done 09304 ; 09305 00E5E0 38 .0000010 sec ;conversion error 09306 ; 09307 00E5E1 60 .0000020 rts 09308 ; 09309 .end 09310 .include "common/display.asm" 09311 ;================================================================================ 09312 ; 09313 ;dpycaddr: monitor: DISPLAY CURRENT ADDRESS IN COLUMNS 09314 ; 09315 00E5E2 A6 8C dpycaddr ldx xrtemp ;column count 09316 00E5E4 D0 05 bne .0000010 ;not at right side 09317 ; 09318 00E5E6 20 B5 E7 jsr newline ;next row 09319 00E5E9 A2 0A ldx #n_hccols ;max columns 09320 ; 09321 00E5EB E0 0A .0000010 cpx #n_hccols ;max columns 09322 00E5ED F0 07 beq .0000020 ;at left margin 09323 ; 09324 00E5EF A2 02 ldx #2 09325 00E5F1 20 A8 E7 jsr multspc ;tab a column 09326 00E5F4 A6 8C ldx xrtemp ;reload col count 09327 ; 09328 00E5F6 CA .0000020 dex ;one less column 09329 00E5F7 86 8C stx xrtemp ;save column counter 09330 00E5F9 4C 7D E7 jmp prntladr ;print reference address 09331 ; 09332 ;================================================================================ 09333 ; 09334 ;dpycod: monitor: DISASSEMBLE & DISPLAY MACHINE CODE 09335 ; 09336 ; ———————————————————————————————————————————————————————————————————————— 09337 ; This function disassembles & displays the machine code at the location 09338 ; pointed to by ADDRA. Upon return, ADDRA will point to the opcode of the 09339 ; next instruction. The entry point at DPYCODAA should be called with a 09340 ; disassembly prefix character loaded in .A. If entered at DPYCOD, the 09341 ; default character will be display at the beginning of each disassembled 09342 ; instruction. 09343 ; 09344 ; The disassembly of immediate mode instructions that can take an 8 or 16 09345 ; bit operand is affected by the bit pattern that is stored in FLIMFLAG 09346 ; upon entry to this function: 09347 ; 09348 ; FLIMFLAG: xx000000 09349 ; || 09350 ; |+—————————> 0: 8 bit .X or .Y operand 09351 ; | 1: 16 bit .X or .Y operand 09352 ; +——————————> 0: 8 bit .A or BIT # operand 09353 ; 1: 16 bit .A or BIT # operand 09354 ; 09355 ; FLIMFLAG is conditioned according to the operand of the most recently 09356 ; disassembled REP or SEP instruction. Hence repetitive calls to this 09357 ; subroutine will usually result in the correct disassembly of immediate 09358 ; mode instructions. 09359 ; ———————————————————————————————————————————————————————————————————————— 09360 ; 09361 00E5FC A9 2E dpycod lda #disprfx ;default prefix 09362 ; 09363 ; 09364 ; alternate prefix display entry point... 09365 ; 09366 00E5FE 20 4A D2 dpycodaa jsr putcha ;print prefix 09367 00E601 20 C5 E7 jsr printspc ;space 09368 00E604 20 7D E7 jsr prntladr ;print long address 09369 00E607 20 C5 E7 jsr printspc ;space to opcode field 09370 00E60A 20 10 E3 jsr getbyte ;get opcode 09371 00E60D 85 8A sta opcode ;save &... 09372 00E60F 20 BA E7 jsr printbyt ;display as hex 09373 ; 09374 ; 09375 ; decode menmonic & addressing info... 09376 ; 09377 00E612 A6 8A ldx opcode ;current mnemonic 09378 00E614 BD D7 EB lda mnetabix,x ;get mnemonic index 09379 00E617 0A asl ;double for... 09380 00E618 A8 tay ;mnemonic table offset 09381 longa ;16 bit load 09382 00E619 C2 20 rep #%00100000 09383 00E61B B9 1F EB lda mnetab,y ;copy encoded mnemonic to... 09384 00E61E 85 88 sta mnepck ;working storage 09385 shorta ;back to 8 bits 09386 00E620 E2 20 sep #%00100000 09387 00E622 20 1F E3 jsr instdata ;extract mode & size data 09388 00E625 85 91 sta vopsflag ;save mode flags 09389 00E627 84 83 sty admodidx ;save mode index 09390 00E629 0A asl ;variable immediate instruction? 09391 00E62A 90 1F bcc dpycod01 ;no, effective operand size in .X 09392 ; 09393 ; 09394 ; determine immediate mode operand size... 09395 ; 09396 00E62C A5 8A lda opcode ;current opcode 09397 00E62E 24 8E bit flimflag ;operand display mode 09398 00E630 10 08 bpl .0000010 ;8 bit .A & BIT immediate mode 09399 ; 09400 00E632 29 1F and #aimmaska ;determine if... 09401 00E634 C9 09 cmp #aimmaskb ;.A or BIT immediate 09402 00E636 F0 10 beq .0000030 ;display 16 bit operand 09403 ; 09404 00E638 A5 8A lda opcode ;not .A or BIT immediate 09405 ; 09406 00E63A 50 0F .0000010 bvc dpycod01 ;8 bit .X/.Y immediate mode 09407 ; 09408 00E63C A0 03 ldy #n_vopidx-1 ;opcodes to test 09409 ; 09410 00E63E D9 D7 ED .0000020 cmp vopidx,y ;looking for LDX #, CPY #, etc. 09411 00E641 F0 07 beq .0000040 ;disassemble a 16 bit operand 09412 ; 09413 00E643 88 dey 09414 00E644 10 F8 bpl .0000020 ;keep trying 09415 ; 09416 00E646 80 03 bra dpycod01 ;not .X or .Y immediate 09417 ; 09418 00E648 A5 8A .0000030 lda opcode ;reload 09419 ; 09420 00E64A E8 .0000040 inx ;16 bit operand 09421 ; 09422 ; 09423 ; get & display operand bytes... 09424 ; 09425 00E64B 86 8F dpycod01 stx iopsize ;operand size... 09426 00E64D E8 inx ;plus opcode becomes... 09427 00E64E 86 86 stx instsize ;instruction size 09428 00E650 86 84 stx charcnt ;total bytes to process 09429 00E652 A9 0B lda #n_opcols+2 ;total operand columns plus WS 09430 00E654 85 8C sta xrtemp ;initialize counter 09431 00E656 20 31 E2 jsr clroper ;clear operand 09432 00E659 A4 8F ldy iopsize ;operand size 09433 00E65B F0 16 beq .0000020 ;no operand 09434 ; 09435 00E65D A2 00 ldx #0 ;operand index 09436 ; 09437 00E65F 20 10 E3 .0000010 jsr getbyte ;get operand byte 09438 00E662 95 7B sta operand,x ;save 09439 00E664 DA phx ;protect operand index 09440 00E665 20 BA E7 jsr printbyt ;print operand byte 09441 .rept 3 ;3 columns used 09442 00E668 C6 8C dec xrtemp 09443 00E66A C6 8C dec xrtemp 09444 00E66C C6 8C dec xrtemp 09445 00E66E FA plx ;get operand index 09446 00E66F E8 inx ;bump it 09447 00E670 88 dey 09448 00E671 D0 EC bne .0000010 ;next 09449 ; 09450 00E673 A6 8C .0000020 ldx xrtemp ;operand columns remaining 09451 00E675 20 A8 E7 jsr multspc ;space to mnemonic field 09452 ; 09453 ; 09454 ; display mnemonic... 09455 ; 09456 00E678 A0 03 ldy #s_mnemon ;size of ASCII mnemonic 09457 ; 09458 00E67A A9 00 .0000030 lda #0 ;initialize char 09459 00E67C A2 05 ldx #n_shfenc ;shifts to execute 09460 ; 09461 00E67E 06 88 .0000040 asl mnepck ;shift encoded mnemonic 09462 00E680 26 89 rol mnepck+s_byte 09463 00E682 2A rol 09464 00E683 CA dex 09465 00E684 D0 F8 bne .0000040 09466 ; 09467 00E686 69 3F adc #a_mnecvt ;convert to ASCII &... 09468 00E688 48 pha ;stash 09469 00E689 88 dey 09470 00E68A D0 EE bne .0000030 ;continue with mnemonic 09471 ; 09472 00E68C A0 03 ldy #s_mnemon 09473 ; 09474 00E68E 68 .0000050 pla ;get mnenmonic byte 09475 00E68F 20 4A D2 jsr putcha ;print it 09476 00E692 88 dey 09477 00E693 D0 F9 bne .0000050 09478 ; 09479 ; 09480 ; display operand... 09481 ; 09482 00E695 A5 8F lda iopsize ;operand size 09483 00E697 F0 6D beq clearlin ;zero, disassembly finished 09484 ; 09485 00E699 20 C5 E7 jsr printspc ;space to operand field 09486 00E69C 24 91 bit vopsflag ;check mode flags 09487 00E69E 50 08 bvc dpycod02 ;not a branch 09488 ; 09489 00E6A0 20 35 E3 jsr offtarg ;compute branch target 09490 00E6A3 A6 86 ldx instsize ;effective instruction size 09491 00E6A5 CA dex 09492 00E6A6 86 8F stx iopsize ;effective operand size 09493 ; 09494 00E6A8 64 91 dpycod02 stz vopsflag ;clear 09495 00E6AA A5 83 lda admodidx ;instruction addressing mode 09496 00E6AC C9 0B cmp #am_move ;block move instruction? 09497 00E6AE D0 02 bne .0000010 ;no 09498 ; 09499 00E6B0 66 91 ror vopsflag ;yes 09500 ; 09501 00E6B2 0A .0000010 asl ;convert addressing mode to... 09502 00E6B3 AA tax ;symbology table index 09503 longa ;do a 16 bit load 09504 00E6B4 C2 20 rep #%00100000 09505 00E6B6 BD DB ED lda ms_lutab,x ;addressing symbol pointer 09506 00E6B9 48 pha 09507 shorta ;back to 8 bit loads 09508 00E6BA E2 20 sep #%00100000 09509 00E6BC A0 00 ldy #0 09510 00E6BE B3 01 lda (1,s),y ;get 1st char 09511 00E6C0 C9 20 cmp #a_blank 09512 00E6C2 F0 03 beq .0000020 ;no addresing mode preamble 09513 ; 09514 00E6C4 20 4A D2 jsr putcha ;print preamble 09515 ; 09516 00E6C7 A9 24 .0000020 lda #c_hex 09517 00E6C9 20 4A D2 jsr putcha ;operand displayed as hex 09518 00E6CC A4 8F ldy iopsize ;operand size = index 09519 ; 09520 00E6CE 88 .0000030 dey 09521 00E6CF 30 14 bmi .0000040 ;done with operand 09522 ; 09523 00E6D1 B9 7B 00 lda operand,y ;get operand byte 09524 00E6D4 20 9A E7 jsr dpyhex ;print operand byte 09525 00E6D7 24 91 bit vopsflag ;block move? 09526 00E6D9 10 F3 bpl .0000030 ;no 09527 ; 09528 00E6DB 64 91 stz vopsflag ;reset 09529 printf ms_move ;display MVN/MVP operand separator 09530 00E6DD F4 14 EE pea #.s 09531 00E6E0 20 35 D6 jsr sprint 09532 00E6E3 80 E9 bra .0000030 ;continue 09533 ; 09534 00E6E5 FA .0000040 plx ;symbology LSB 09535 00E6E6 7A ply ;symbology MSB 09536 00E6E7 E8 inx ;move past preamble 09537 00E6E8 D0 01 bne .0000050 09538 ; 09539 00E6EA C8 iny 09540 ; 09541 00E6EB 5A .0000050 phy 09542 00E6EC DA phx 09543 00E6ED 20 35 D6 jsr sprint ;print postamble, if any 09544 ; 09545 ; 09546 ; condition immediate mode display format... 09547 ; 09548 00E6F0 A5 7B dpycod03 lda operand ;operand LSB 09549 00E6F2 29 30 and #pfmxmask ;isolate M & X bits 09550 00E6F4 0A asl ;shift to match... 09551 00E6F5 0A asl ;FLIMFLAG alignment 09552 00E6F6 A6 8A ldx opcode ;current instruction 09553 00E6F8 E0 C2 cpx #opc_rep ;was it REP? 09554 00E6FA D0 04 bne .0000010 ;no 09555 ; 09556 00E6FC 04 8E tsb flimflag ;set flag bits as required 09557 00E6FE 80 06 bra clearlin 09558 ; 09559 00E700 E0 E2 .0000010 cpx #opc_sep ;was it SEP? 09560 00E702 D0 02 bne clearlin ;no, just exit 09561 ; 09562 00E704 14 8E trb flimflag ;clear flag bits as required 09563 ; 09564 ;================================================================================ 09565 ; 09566 ;clearlin: CLEAR DISPLAY LINE 09567 ; 09568 00E706 F4 30 EE clearlin pea #dc_cl 09569 00E709 80 4B bra dpyerraa 09570 ; 09571 ;================================================================================ 09572 ; 09573 ;dpyibuf: monitor: DISPLAY INPUT BUFFER CONTENTS 09574 ; 09575 00E70B F4 00 02 dpyibuf pea #ibuffer 09576 00E70E 80 46 bra dpyerraa 09577 ; 09578 ;================================================================================ 09579 ; 09580 ;dpymem: monitor: DISPLAY MEMORY 09581 ; 09582 ; ———————————————————————————————————————————————————————————— 09583 ; This function displays 16 bytes of memory as hex values & as 09584 ; ASCII equivalents. The starting address for the display is 09585 ; in ADDRA & is expected to be a 24 bit address. Upon return, 09586 ; ADDRA will point to the start of the next 16 bytes. 09587 ; ———————————————————————————————————————————————————————————— 09588 ; 09589 dpymem shortr 09590 00E710 E2 30 sep #%00110000 09591 00E712 64 84 stz charcnt ;reset 09592 00E714 A9 3E lda #memprfx 09593 00E716 20 4A D2 jsr putcha ;display prefix 09594 00E719 20 7D E7 jsr prntladr ;print 24 bit address 09595 00E71C A2 00 ldx #0 ;string buffer index 09596 00E71E A0 10 ldy #n_dump ;bytes per line 09597 ; 09598 00E720 20 10 E3 .0000010 jsr getbyte ;get from RAM, also... 09599 00E723 48 pha ;save for decoding 09600 00E724 DA phx ;save string index 09601 00E725 20 BA E7 jsr printbyt ;display as hex ASCII 09602 00E728 E6 84 inc charcnt ;bytes displayed +1 09603 00E72A FA plx ;recover string index &... 09604 00E72B 68 pla ;byte 09605 00E72C C9 20 cmp #a_blank ;printable? 09606 00E72E 90 04 bcc .0000020 ;no 09607 ; 09608 00E730 C9 7F cmp #a_del 09609 00E732 90 02 bcc .0000030 ;is printable 09610 ; 09611 00E734 A9 2E .0000020 lda #memsubch ;substitute character 09612 ; 09613 00E736 9D 00 02 .0000030 sta ibuffer,x ;save char 09614 00E739 E8 inx ;bump index 09615 00E73A 88 dey ;byte count -= 1 09616 00E73B D0 E3 bne .0000010 ;not done 09617 ; 09618 00E73D 9E 00 02 stz ibuffer,x ;terminate ASCII string 09619 00E740 A9 3A lda #memsepch 09620 00E742 20 4A D2 jsr putcha ;separate ASCII from bytes 09621 printf dc_bf ;select reverse video 09622 00E745 F4 22 EE pea #.s 09623 00E748 20 35 D6 jsr sprint 09624 00E74B 20 0B E7 jsr dpyibuf ;display ASCII equivalents 09625 00E74E F4 3B EE pea #dc_er ;back to... 09626 00E751 80 03 bra dpyerraa ;normal video 09627 ; 09628 ;================================================================================ 09629 ; 09630 ;dpyerr: monitor: DISPLAY ERROR SIGNAL 09631 ; 09632 00E753 F4 A4 F0 dpyerr pea #mm_err ;"*ERR" 09633 ; 09634 00E756 20 35 D6 dpyerraa jsr sprint 09635 00E759 60 rts 09636 ; 09637 ;================================================================================ 09638 ; 09639 ;gendbs: monitor: GENERATE DESTRUCTIVE BACKSPACE 09640 ; 09641 00E75A F4 2C EE gendbs pea #dc_bs ;destructive backspace 09642 00E75D 80 F7 bra dpyerraa 09643 ; 09644 ;================================================================================ 09645 ; 09646 ;dpyramct: DISPLAY POST RAM COUNT 09647 ; 09648 dpyramct longr 09649 00E75F C2 30 rep #%00110000 09650 00E761 DA phx ;current location 09651 00E762 86 67 stx faca ;store it for decoding 09652 00E764 64 69 stz faca+s_word 09653 shortr 09654 00E766 E2 30 sep #%00110000 09655 00E768 A2 11 ldx #memctcol 09656 00E76A A0 09 ldy #memctrow 09657 00E76C 20 09 D6 jsr plot ;position cursor 09658 00E76F A9 AB lda #$80 | c_dec ;convert count to... 09659 00E771 20 80 E8 jsr binasc ;decimal string wo/radix 09660 00E774 5A phy 09661 00E775 DA phx 09662 00E776 20 35 D6 jsr sprint ;print it 09663 longx 09664 00E779 C2 10 rep #%00010000 09665 00E77B FA plx ;recover location 09666 00E77C 60 rts 09667 ; 09668 ;================================================================================ 09669 ; 09670 ;prntladr: monitor: PRINT 24 BIT CURRENT ADDRESS 09671 ; 09672 00E77D 08 prntladr php ;protect register sizes 09673 shorta 09674 00E77E E2 20 sep #%00100000 09675 00E780 A5 63 lda addra+s_word ;get bank byte &... 09676 00E782 20 9A E7 jsr dpyhex ;display it 09677 longa 09678 00E785 C2 20 rep #%00100000 09679 00E787 A5 61 lda addra ;get 16 bit address 09680 00E789 28 plp ;restore register sizes 09681 ; 09682 ;================================================================================ 09683 ; 09684 ;dpyhexw: monitor: DISPLAY BINARY WORD AS HEX ASCII 09685 ; 09686 ; ———————————————————————————————————— 09687 ; Preparatory Ops: .C: word to display 09688 ; 09689 ; Returned Values: .C: used 09690 ; .X: used 09691 ; .Y: entry value 09692 ; ———————————————————————————————————— 09693 ; 09694 00E78A 08 dpyhexw php ;protect register sizes 09695 longa 09696 00E78B C2 20 rep #%00100000 09697 00E78D 48 pha ;protect value 09698 shorta 09699 00E78E E2 20 sep #%00100000 09700 00E790 EB xba ;get MSB &... 09701 00E791 20 9A E7 jsr dpyhex ;display 09702 longa 09703 00E794 C2 20 rep #%00100000 09704 00E796 68 pla ;recover value 09705 shorta ;only LSB visible 09706 00E797 E2 20 sep #%00100000 09707 00E799 28 plp ;restore register sizes 09708 ; 09709 ;================================================================================ 09710 ; 09711 ;dpyhex: monitor: DISPLAY BINARY BYTE AS HEX ASCII 09712 ; 09713 ; ———————————————————————————————————— 09714 ; Preparatory Ops: .A: byte to display 09715 ; 09716 ; Returned Values: .A: used 09717 ; .X: used 09718 ; .Y: entry value 09719 ; ———————————————————————————————————— 09720 ; 09721 00E79A 20 14 E9 dpyhex jsr binhex ;convert to hex ASCII 09722 00E79D 20 4A D2 jsr putcha ;print MSN 09723 00E7A0 8A txa 09724 00E7A1 4C 4A D2 jmp putcha ;print LSN 09725 ; 09726 ;================================================================================ 09727 ; 09728 ;dpypbr: monitor: DISPLAY PB REGISTER 09729 ; 09730 00E7A4 A5 52 dpypbr lda reg_pbx ;PB 09731 00E7A6 80 F2 bra dpyhex ;display as hex ASCII 09732 ; 09733 ;================================================================================ 09734 ; 09735 ;multspc: monitor: PRINT MULTIPLE BLANKS 09736 ; 09737 ; ———————————————————————————————————————————————— 09738 ; Preparatory Ops : .X: number of blanks to print 09739 ; 09740 ; Register Returns: .A: used 09741 ; .X: used 09742 ; 09743 ; Calling Example : ldx #3 09744 ; jsr multspc ;print 3 spaces 09745 ; 09746 ; Notes: This sub will print 1 blank if .X=0. 09747 ; ———————————————————————————————————————————————— 09748 ; 09749 00E7A8 8A multspc txa 09750 00E7A9 D0 01 bne .0000010 ;blank count specified 09751 ; 09752 00E7AB E8 inx ;default to 1 blank 09753 ; 09754 00E7AC A9 20 .0000010 lda #a_blank 09755 ; 09756 00E7AE 20 4A D2 .0000020 jsr putcha 09757 00E7B1 CA dex 09758 00E7B2 D0 FA bne .0000020 09759 ; 09760 00E7B4 60 rts 09761 ; 09762 ;================================================================================ 09763 ; 09764 ;newline: monitor: PRINT NEWLINE (CRLF) 09765 ; 09766 00E7B5 F4 45 EE newline pea #dc_lf 09767 00E7B8 80 9C bra dpyerraa 09768 ; 09769 ;================================================================================ 09770 ; 09771 ;printbyt: monitor: PRINT A BYTE WITH LEADING SPACE 09772 ; 09773 00E7BA 48 printbyt pha ;protect byte 09774 00E7BB 20 C5 E7 jsr printspc ;print leading space 09775 00E7BE 68 pla ;restore &... 09776 00E7BF 80 D9 bra dpyhex ;print byte 09777 ; 09778 ;================================================================================ 09779 ; 09780 ;alert: ALERT USER w/TERMINAL BELL 09781 ; 09782 00E7C1 A9 07 alert lda #a_bel 09783 00E7C3 80 02 bra printcmn 09784 ; 09785 ;================================================================================ 09786 ; 09787 ;printspc: PRINT A SPACE 09788 ; 09789 00E7C5 A9 20 printspc lda #a_blank 09790 ; 09791 00E7C7 4C 4A D2 printcmn jmp putcha 09792 ; 09793 .end 09794 .include "common/numeric.asm" 09795 ;================================================================================ 09796 ; 09797 ;acksum: ACCUMULATE S-RECORD CHECKSUM 09798 ; 09799 ; ———————————————————————————————————————————— 09800 ; Preparatory Ops: .A: byte to add to checksum 09801 ; 09802 ; Returned Values: .A: entry value 09803 ; .B: entry value 09804 ; .X: entry value 09805 ; .Y: entry value 09806 ; ———————————————————————————————————————————— 09807 ; 09808 00E7CA 48 acksum pha ;protect 09809 00E7CB C2 21 rep #sr_amw|sr_car ;16 bit .A + clear carry 09810 00E7CD 29 FF 00 and !#%11111111 ;clear .B 09811 00E7D0 65 88 adc cksumcmp ;checksum 09812 00E7D2 85 88 sta cksumcmp ;new checksum LSB 09813 shorta 09814 00E7D4 E2 20 sep #%00100000 09815 00E7D6 68 pla 09816 00E7D7 60 rts 09817 ; 09818 ;================================================================================ 09819 ; 09820 ;ascbin: CONVERT NULL-TERMINATED ASCII NUMBER STRING TO BINARY 09821 ; 09822 ; ——————————————————————————————————————————————————— 09823 ; Preparatory Ops: ASCII number string in kworkbuf 09824 ; 09825 ; Returned Values: FACA: converted parameter 09826 ; .A: used 09827 ; .X: used 09828 ; .Y: used 09829 ; .C: 1 = conversion error 09830 ; .Z: 1 = nothing to convert 09831 ; 09832 ; Notes: 1) Conversion stops when a non-numeric char- 09833 ; acter is encountered. 09834 ; 2) Radix symbols are as follows: 09835 ; 09836 ; % binary 09837 ; @ octal 09838 ; + decimal 09839 ; $ hexadecimal 09840 ; 09841 ; Hex is the default if no radix is speci- 09842 ; fied in the 1st character of the string. 09843 ; ——————————————————————————————————————————————————— 09844 ; 09845 ascbin shortr 09846 00E7D8 E2 30 sep #%00110000 09847 00E7DA 20 2D E9 jsr clrfaca ;clear accumulator 09848 00E7DD 64 84 stz charcnt ;zero char count 09849 00E7DF 64 82 stz radix ;initialize 09850 ; 09851 ; 09852 ; process radix if present... 09853 ; 09854 00E7E1 20 10 E4 jsr getcharw ;get next non-WS char 09855 00E7E4 D0 02 bne .0000010 ;got something 09856 ; 09857 00E7E6 18 clc ;no more input 09858 00E7E7 60 rts 09859 ; 09860 00E7E8 A2 03 .0000010 ldx #n_radix-1 ;number of radices 09861 ; 09862 00E7EA DD 12 EB .0000020 cmp radxtab,x ;recognized radix? 09863 00E7ED F0 06 beq .0000030 ;yes 09864 ; 09865 00E7EF CA dex 09866 00E7F0 10 F8 bpl .0000020 ;try next 09867 ; 09868 00E7F2 C6 7F dec ibufidx ;reposition to previous char 09869 00E7F4 E8 inx ;not recognized, assume hex 09870 ; 09871 00E7F5 C9 2B .0000030 cmp #c_dec ;decimal radix? 09872 00E7F7 D0 02 bne .0000040 ;not decimal 09873 ; 09874 00E7F9 66 82 ror radix ;flag decimal conversion 09875 ; 09876 00E7FB BD FE EA .0000040 lda basetab,x ;number bases table 09877 00E7FE 85 90 sta range ;set valid numeral range 09878 00E800 BD 02 EB lda bitsdtab,x ;get bits per digit 09879 00E803 85 80 sta bitsdig ;store 09880 ; 09881 ; 09882 ; process numerals... 09883 ; 09884 00E805 20 B2 E3 ascbin01 jsr getchar ;get next char 09885 00E808 F0 70 beq ascbin03 ;EOI 09886 ; 09887 00E80A C9 20 cmp #' ' 09888 00E80C F0 6C beq ascbin03 ;blank — EOF 09889 ; 09890 00E80E C9 2C cmp #',' 09891 00E810 F0 68 beq ascbin03 ;comma — EOF 09892 ; 09893 00E812 C9 09 cmp #a_ht 09894 00E814 F0 64 beq ascbin03 ;tab — EOF 09895 ; 09896 00E816 20 87 E9 jsr nybtobin ;change to binary 09897 00E819 B0 60 bcs ascbin04 ;not a recognized numeral 09898 ; 09899 00E81B C5 90 cmp range ;check range 09900 00E81D B0 5C bcs ascbin04 ;not valid for base 09901 ; 09902 00E81F 85 81 sta numeral ;save processed numeral 09903 00E821 E6 84 inc charcnt ;bump numeral count 09904 00E823 24 82 bit radix ;working in base 10? 09905 00E825 10 15 bpl .0000030 ;no 09906 ; 09907 ; 09908 ; compute N*2 for decimal conversion... 09909 ; 09910 00E827 A2 00 ldx #0 ;accumulator index 09911 00E829 A0 02 ldy #s_pfac/2 ;iterations 09912 longa 09913 00E82B C2 20 rep #%00100000 09914 00E82D 18 clc 09915 ; 09916 00E82E B5 67 .0000020 lda faca,x ;N 09917 00E830 2A rol ;N=N*2 09918 00E831 95 6F sta facb,x 09919 00E833 E8 inx 09920 00E834 E8 inx 09921 00E835 88 dey 09922 00E836 D0 F6 bne .0000020 09923 ; 09924 00E838 B0 41 bcs ascbin04 ;overflow — error 09925 ; 09926 shorta 09927 00E83A E2 20 sep #%00100000 09928 ; 09929 ; 09930 ; compute N*base for binary, octal or hex... 09931 ; or N*8 for decimal... 09932 ; 09933 00E83C A6 80 .0000030 ldx bitsdig ;bits per digit 09934 longa ;16 bit shifts 09935 00E83E C2 20 rep #%00100000 09936 ; 09937 00E840 06 67 .0000040 asl faca 09938 00E842 26 69 rol faca+s_word 09939 00E844 B0 35 bcs ascbin04 ;overflow — error 09940 ; 09941 00E846 CA dex 09942 00E847 D0 F7 bne .0000040 ;next shift 09943 ; 09944 shorta ;back to 8 bits 09945 00E849 E2 20 sep #%00100000 09946 00E84B 24 82 bit radix ;check base 09947 00E84D 10 13 bpl ascbin02 ;not decimal 09948 ; 09949 ; 09950 ; compute N*10 for decimal (N*8 + N*2)... 09951 ; 09952 00E84F A0 04 ldy #s_pfac 09953 longa 09954 00E851 C2 20 rep #%00100000 09955 ; 09956 00E853 B5 67 .0000050 lda faca,x ;N*8 09957 00E855 75 6F adc facb,x ;N*2 09958 00E857 95 67 sta faca,x ;now N*10 09959 00E859 E8 inx 09960 00E85A E8 inx 09961 00E85B 88 dey 09962 00E85C D0 F5 bne .0000050 09963 ; 09964 00E85E B0 1B bcs ascbin04 ;overflow — error 09965 ; 09966 shorta 09967 00E860 E2 20 sep #%00100000 09968 ; 09969 ; 09970 ; add current numeral to partial result... 09971 ; 09972 00E862 A5 67 ascbin02 lda faca ;N 09973 00E864 65 81 adc numeral ;N=N+D 09974 00E866 85 67 sta faca 09975 00E868 A2 01 ldx #1 09976 00E86A A0 03 ldy #s_pfac-1 09977 ; 09978 00E86C B5 67 .0000010 lda faca,x 09979 00E86E 69 00 adc #0 ;account for carry 09980 00E870 95 67 sta faca,x 09981 00E872 E8 inx 09982 00E873 88 dey 09983 00E874 D0 F6 bne .0000010 09984 ; 09985 00E876 90 8D bcc ascbin01 ;next if no overflow 09986 ; 09987 00E878 B0 01 bcs ascbin04 ;overflow — error 09988 ; 09989 ; 09990 ; finish up... 09991 ; 09992 00E87A 18 ascbin03 clc ;no error 09993 ; 09994 ascbin04 shorta ;reset if necessary 09995 00E87B E2 20 sep #%00100000 09996 00E87D A5 84 lda charcnt ;load char count 09997 00E87F 60 rts ;done 09998 ; 09999 ;================================================================================ 10000 ; 10001 ;binasc: CONVERT 32-BIT BINARY TO NULL-TERMINATED ASCII NUMBER STRING 10002 ; 10003 ; —————————————————————————————————————————————————————— 10004 ; Preparatory Ops: FACA: 32-bit operand 10005 ; .A: radix character, w/bit 7 set to 10006 ; suppress radix symbol in the 10007 ; conversion string 10008 ; 10009 ; Returned Values: kworkbuf: conversion string 10010 ; .A: string length 10011 ; .X: string address LSB 10012 ; .Y: string address MSB 10013 ; 10014 ; Execution Notes: ibufidx & instsize are overwritten. 10015 ; —————————————————————————————————————————————————————— 10016 ; 10017 00E880 64 7F binasc stz ibufidx ;initialize string index 10018 00E882 64 86 stz instsize ;clear format flag 10019 ; 10020 ; 10021 ; evaluate radix... 10022 ; 10023 00E884 0A asl ;extract format flag &... 10024 00E885 66 86 ror instsize ;save it 10025 00E887 4A lsr ;extract radix character 10026 00E888 A2 03 ldx #n_radix-1 ;total radices 10027 ; 10028 00E88A DD 12 EB .0000010 cmp radxtab,x ;recognized radix? 10029 00E88D F0 04 beq .0000020 ;yes 10030 ; 10031 00E88F CA dex 10032 00E890 10 F8 bpl .0000010 ;try next 10033 ; 10034 00E892 E8 inx ;assume hex 10035 ; 10036 00E893 86 82 .0000020 stx radix ;save radix index for later 10037 00E895 24 86 bit instsize 10038 00E897 30 08 bmi .0000030 ;no radix symbol wanted 10039 ; 10040 00E899 BD 12 EB lda radxtab,x ;radix table 10041 00E89C 8D 00 02 sta ibuffer ;prepend to string 10042 00E89F E6 7F inc ibufidx ;bump string index 10043 ; 10044 00E8A1 C9 2B .0000030 cmp #c_dec ;converting to decimal? 10045 00E8A3 D0 07 bne .0000040 ;no 10046 ; 10047 00E8A5 20 3F E9 jsr facabcd ;convert operand to BCD 10048 00E8A8 A9 00 lda #0 10049 00E8AA 80 17 bra .0000070 ;skip binary stuff 10050 ; 10051 ; 10052 ; prepare for binary, octal or hex conversion... 10053 ; 10054 00E8AC A2 00 .0000040 ldx #0 ;operand index 10055 00E8AE A0 05 ldy #s_sfac-1 ;workspace index 10056 ; 10057 00E8B0 B5 67 .0000050 lda faca,x ;copy operand to... 10058 00E8B2 99 6F 00 sta facb,y ;workspace in... 10059 00E8B5 88 dey ;big-endian order 10060 00E8B6 E8 inx 10061 00E8B7 E0 04 cpx #s_pfac 10062 00E8B9 D0 F5 bne .0000050 10063 ; 10064 00E8BB A9 00 lda #0 10065 00E8BD BB tyx 10066 ; 10067 00E8BE 95 6F .0000060 sta facb,x ;pad workspace 10068 00E8C0 CA dex 10069 00E8C1 10 FB bpl .0000060 10070 ; 10071 ; 10072 ; set up conversion parameters... 10073 ; 10074 00E8C3 85 75 .0000070 sta facc ;initialize byte counter 10075 00E8C5 A4 82 ldy radix ;radix index 10076 00E8C7 B9 0E EB lda numstab,y ;numerals in string 10077 00E8CA 85 76 sta facc+s_byte ;set remaining numeral count 10078 00E8CC B9 06 EB lda bitsntab,y ;bits per numeral 10079 00E8CF 85 77 sta facc+s_word ;set 10080 00E8D1 B9 0A EB lda lzsttab,y ;leading zero threshold 10081 00E8D4 85 78 sta facc+s_wword ;set 10082 ; 10083 ; 10084 ; generate conversion string... 10085 ; 10086 00E8D6 A9 00 .0000080 lda #0 10087 00E8D8 A4 77 ldy facc+s_word ;bits per numeral 10088 ; 10089 00E8DA A2 05 .0000090 ldx #s_sfac-1 ;workspace size 10090 00E8DC 18 clc ;avoid starting carry 10091 ; 10092 00E8DD 36 6F .0000100 rol facb,x ;shift out a bit... 10093 00E8DF CA dex ;from the operand or... 10094 00E8E0 10 FB bpl .0000100 ;BCD conversion result 10095 ; 10096 00E8E2 2A rol ;bit to .A 10097 00E8E3 88 dey 10098 00E8E4 D0 F4 bne .0000090 ;more bits to grab 10099 ; 10100 00E8E6 A8 tay ;if numeral isn't zero... 10101 00E8E7 D0 0A bne .0000110 ;skip leading zero tests 10102 ; 10103 00E8E9 A6 76 ldx facc+s_byte ;remaining numerals 10104 00E8EB E4 78 cpx facc+s_wword ;leading zero threshold 10105 00E8ED 90 04 bcc .0000110 ;below it, must convert 10106 ; 10107 00E8EF A6 75 ldx facc ;processed byte count 10108 00E8F1 F0 11 beq .0000130 ;discard leading zero 10109 ; 10110 00E8F3 C9 0A .0000110 cmp #10 ;check range 10111 00E8F5 90 02 bcc .0000120 ;is 0-9 10112 ; 10113 00E8F7 69 06 adc #a_hexdec ;apply hex adjust 10114 ; 10115 00E8F9 69 30 .0000120 adc #'0' ;change to ASCII 10116 00E8FB A4 7F ldy ibufidx ;string index 10117 00E8FD 99 00 02 sta ibuffer,y ;save numeral in buffer 10118 00E900 E6 7F inc ibufidx ;next buffer position 10119 00E902 E6 75 inc facc ;bytes=bytes+1 10120 ; 10121 00E904 C6 76 .0000130 dec facc+s_byte ;numerals=numerals-1 10122 00E906 D0 CE bne .0000080 ;not done 10123 ; 10124 ; 10125 ; terminate string & exit... 10126 ; 10127 00E908 A6 7F ldx ibufidx ;printable string length 10128 00E90A 9E 00 02 stz ibuffer,x ;terminate string 10129 00E90D 8A txa 10130 00E90E A2 00 ldx #ibuffer 10132 00E912 18 clc ;all okay 10133 00E913 60 rts 10134 ; 10135 ;================================================================================ 10136 ; 10137 ;binhex: CONVERT BINARY BYTE TO HEX ASCII CHARS 10138 ; 10139 ; ———————————————————————————————————————————— 10140 ; Preparatory Ops: .A: byte to convert 10141 ; 10142 ; Returned Values: .A: MSN ASCII char 10143 ; .X: LSN ASCII char 10144 ; .Y: entry value 10145 ; 10146 ; Calling Example: LDA #$E4 10147 ; JSR BINHEX 10148 ; JSR BSOUTA ;display MSN 10149 ; TXA 10150 ; JSR BSOUTA ;display LSN 10151 ; ———————————————————————————————————————————— 10152 ; 10153 00E914 48 binhex pha ;save byte to convert 10154 00E915 29 0F and #bcdumask ;extract LSN 10155 00E917 AA tax ;save it 10156 00E918 68 pla 10157 .rept s_bnybbl ;extract MSN 10158 00E919 4A lsr 10159 00E91A 4A lsr 10160 00E91B 4A lsr 10161 00E91C 4A lsr 10162 00E91D 48 pha ;save MSN 10163 00E91E 8A txa 10164 00E91F 20 24 E9 jsr .0000010 ;generate ASCII LSN 10165 00E922 AA tax ;save 10166 00E923 68 pla ;get input 10167 ; 10168 ; 10169 ; convert nybble to hex ASCII equivalent... 10170 ; 10171 00E924 C9 0A .0000010 cmp #10 10172 00E926 90 02 bcc .0000020 ;in decimal range 10173 ; 10174 00E928 69 66 adc #k_hex ;hex compensate 10175 ; 10176 00E92A 49 30 .0000020 eor #'0' ;finalize nybble 10177 00E92C 60 rts ;done 10178 ; 10179 ;================================================================================ 10180 ; 10181 ;clrfaca: CLEAR FLOATING ACCUMULATOR A 10182 ; 10183 00E92D 08 clrfaca php 10184 longa 10185 00E92E C2 20 rep #%00100000 10186 00E930 64 67 stz faca 10187 00E932 64 69 stz faca+s_word 10188 00E934 28 plp 10189 00E935 60 rts 10190 ; 10191 ;================================================================================ 10192 ; 10193 ;clrfacb: CLEAR FLOATING ACCUMULATOR B 10194 ; 10195 00E936 08 clrfacb php 10196 longa 10197 00E937 C2 20 rep #%00100000 10198 00E939 64 6F stz facb 10199 00E93B 64 71 stz facb+s_word 10200 00E93D 28 plp 10201 00E93E 60 rts 10202 ; 10203 ;================================================================================ 10204 ; 10205 ;facabcd: CONVERT FACA INTO BCD 10206 ; 10207 00E93F A2 03 facabcd ldx #s_pfac-1 ;primary accumulator size -1 10208 ; 10209 00E941 B5 67 .0000010 lda faca,x ;value to be converted 10210 00E943 48 pha ;preserve 10211 00E944 CA dex 10212 00E945 10 FA bpl .0000010 ;next 10213 ; 10214 00E947 A2 05 ldx #s_sfac-1 ;workspace size 10215 ; 10216 00E949 74 6F .0000020 stz facb,x ;clear final result 10217 00E94B 74 75 stz facc,x ;clear scratchpad 10218 00E94D CA dex 10219 00E94E 10 F9 bpl .0000020 10220 ; 10221 00E950 E6 7A inc facc+s_sfac-s_byte 10222 00E952 F8 sed ;select decimal mode 10223 00E953 A0 1F ldy #m_bits-1 ;bits to convert -1 10224 ; 10225 00E955 A2 03 .0000030 ldx #s_pfac-1 ;operand size 10226 00E957 18 clc ;no carry at start 10227 ; 10228 00E958 76 67 .0000040 ror faca,x ;grab LS bit in operand 10229 00E95A CA dex 10230 00E95B 10 FB bpl .0000040 10231 ; 10232 00E95D 90 0D bcc .0000060 ;LS bit clear 10233 ; 10234 00E95F 18 clc 10235 00E960 A2 05 ldx #s_sfac-1 10236 ; 10237 00E962 B5 6F .0000050 lda facb,x ;partial result 10238 00E964 75 75 adc facc,x ;scratchpad 10239 00E966 95 6F sta facb,x ;new partial result 10240 00E968 CA dex 10241 00E969 10 F7 bpl .0000050 10242 ; 10243 00E96B 18 clc 10244 ; 10245 00E96C A2 05 .0000060 ldx #s_sfac-1 10246 ; 10247 00E96E B5 75 .0000070 lda facc,x ;scratchpad 10248 00E970 75 75 adc facc,x ;double &... 10249 00E972 95 75 sta facc,x ;save 10250 00E974 CA dex 10251 00E975 10 F7 bpl .0000070 10252 ; 10253 00E977 88 dey 10254 00E978 10 DB bpl .0000030 ;next operand bit 10255 ; 10256 00E97A D8 cld 10257 00E97B A2 00 ldx #0 10258 00E97D A0 04 ldy #s_pfac 10259 ; 10260 00E97F 68 .0000080 pla ;operand 10261 00E980 95 67 sta faca,x ;restore 10262 00E982 E8 inx 10263 00E983 88 dey 10264 00E984 D0 F9 bne .0000080 ;next 10265 ; 10266 00E986 60 rts 10267 ; 10268 ;================================================================================ 10269 ; 10270 ;nybtobin: CONVERT ASCII NYBBLE TO BINARY 10271 ; 10272 00E987 20 81 E4 nybtobin jsr toupper ;convert case if necessary 10273 00E98A 38 sec 10274 00E98B E9 30 sbc #'0' ;change to binary 10275 00E98D 90 08 bcc .0000020 ;not a numeral — error 10276 ; 10277 00E98F C9 0A cmp #10 10278 00E991 90 03 bcc .0000010 ;numeral is 0-9 10279 ; 10280 00E993 E9 07 sbc #a_hexdec+1 ;10-15 ——> A-F 10281 00E995 18 clc ;no conversion error 10282 ; 10283 00E996 60 .0000010 rts 10284 ; 10285 00E997 38 .0000020 sec ;conversion error 10286 00E998 60 rts 10287 ; 10288 .end 10289 .include "scsi/cdb.asm" 10290 ;================================================================================ 10291 ; 10292 ;STATIC SCSI COMMAND DESCRIPTOR BLOCKS 10293 ; 10294 cdblkget .byte sc_read ;load master boot block 10295 .byte lun << n_lunshf | pb_mboot >> s_bword 10296 .byte >pb_mboot 10297 .byte > s_bword 10321 .byte 0 10322 .byte 0 10323 .byte s_reqsen 10324 .byte 0 10325 ; 10326 cdstrunt .byte sc_ssdev ;start unit/load medium 10327 .byte 0 10328 .byte 0 10329 .byte 0 10330 .byte 1 10331 .byte 0 10332 ; 10333 cdtstrdy .byte sc_tur ;test unit ready 10334 .byte 0 10335 .byte 0 10336 .byte 0 10337 .byte 0 10338 .byte 0 10339 ; 10340 .end 10341 .include "scsi/phases.asm" 10342 ;================================================================================ 10343 ; 10344 ;SCSI DRIVER BUS PHASE VECTORS 10345 ; 10346 scsiptab .word phdatout ;data-out 10347 .word phdatin ;data-in 10348 .word ex_usphs ;command 10349 .word phstatus ;status 10350 .word ex_usphs ;reserved 10351 .word ex_usphs ;reserved 10352 .word phmesout ;message-out 10353 .word phmesin ;message-in 10354 ; 10355 .end 10356 .include "tables/scsi.asm" 10357 ;================================================================================ 10358 ; 10359 ;SCSI DRIVER COMMAND VALIDATION TABLES 10360 ; 10361 scgroups .byte 0 << n_grpshf ;supported command groups 10362 .byte 1 << n_grpshf 10363 .byte 2 << n_grpshf 10364 .byte 5 << n_grpshf 10365 ; 10366 scsizes .byte s_cdbg0 ;group CDB sizes 10367 .byte s_cdbg1 10368 .byte s_cdbg2 10369 .byte s_cdbg5 10370 ; 10371 0004 n_scgrps =scsizes-scgroups ;number of supported groups 10372 ; 10373 ;================================================================================ 10374 ; 10375 ;SCSI COMMAND CODE SIZE TRANSLATION TABLES 10376 ; 10377 ; 10378 ; opcodes... 10379 ; 10380 sccsttab .byte sc_read ;read from medium (21 bit LBA) 10381 .byte sc_readx ;read from medium (32 bit LBA) 10382 .byte sc_writ ;write to medium (21 bit LBA) 10383 .byte sc_writx ;write to medium (32 bit LBA) 10384 ; 10385 ; 10386 ; LBA field offsets... 10387 ; 10388 sclboset .byte so_lbal ;read from medium (21 bit LBA) 10389 .byte so_lball ;read from medium (32 bit LBA) 10390 .byte so_lbal ;write to medium (21 bit LBA) 10391 .byte so_lball ;write to medium (32 bit LBA) 10392 ; 10393 ; 10394 ; transfer size field offsets... 10395 ; 10396 sctloset .byte so_xfrl ;read from medium (21 bit LBA) 10397 .byte so_xfrlh ;read from medium (32 bit LBA) 10398 .byte so_xfrl ;write to medium (21 bit LBA) 10399 .byte so_xfrlh ;write to medium (32 bit LBA) 10400 ; 10401 ; 10402 ; transfer size field sizes... 10403 ; 10404 scctztab .byte s_byte ;read from medium (21 bit LBA) 10405 .byte s_word ;read from medium (32 bit LBA) 10406 .byte s_byte ;write to medium (21 bit LBA) 10407 .byte s_word ;write to medium (32 bit LBA) 10408 ; 10409 .end 10410 .include "tables/sysvecs.asm" 10411 ;================================================================================ 10412 ; 10413 ;INDIRECT HARDWARE VECTOR INITIALIZATION DATA 10414 ; 10415 ; ——————————————————————————————————————————————————— 10416 ; CAUTION: The following table entries must be in the 10417 ; same order as the page 1 vector addresses. 10418 ; ——————————————————————————————————————————————————— 10419 ; 10420 ivectab .word monbrk ;ABORT (hardware) 10421 .word monbrk ;BRK (software) 10422 .word monbrk ;COP (software) 10423 .word iirqa ;IRQ (hardware) 10424 .word inmia ;NMI (hardware) 10425 000A s_vectab =*-ivectab ;bytes in table 10426 ; 10427 .end 10428 .include "tables/tia232.asm" 10429 ;================================================================================ 10430 ; 10431 ;SIO MASKS 10432 ; 10433 tiatstab ;TxD status flags 10434 0000 .a .set 0 10435 .rept n_nxpchn 10436 .word 1 << .a 10437 0001 .a .= .a + 1 10438 .word 1 << .a 10439 0002 .a .= .a + 1 10440 .word 1 << .a 10441 0003 .a .= .a + 1 10442 .word 1 << .a 10443 0004 .a .= .a + 1 10444 ; 10445 tiaqpmsk ;queue pointer masks 10446 0000 .a .set 0 10447 .rept n_nxpchn 10448 .word .a << 6 10449 0001 .a .= .a + 1 10450 .word .a << 6 10451 0002 .a .= .a + 1 10452 .word .a << 6 10453 0003 .a .= .a + 1 10454 .word .a << 6 10455 0004 .a .= .a + 1 10456 ; 10457 ;================================================================================ 10458 ; 10459 ;TIA-232 DIRECT PAGE POINTER TABLES 10460 ; 10461 EA03 tiaiptab =* 10462 ; 10463 ; 10464 ; UART registers... 10465 ; 10466 .word io_quart+nx_sra ;ch A: status 10467 .word io_quart+nx_srb ;ch B: status 10468 .word io_quart+nx_src ;ch C: status 10469 .word io_quart+nx_srd ;ch D: status 10470 .word io_quart+nx_cra ;ch A: command 10471 .word io_quart+nx_crb ;ch B: command 10472 .word io_quart+nx_crc ;ch C: command 10473 .word io_quart+nx_crd ;ch D: command 10474 .word io_quart+nx_fifa;ch A: FIFO 10475 .word io_quart+nx_fifb;ch B: FIFO 10476 .word io_quart+nx_fifc;ch C: FIFO 10477 .word io_quart+nx_fifd;ch D: FIFO 10478 ; 10479 ; 10480 ; RxD circular queues... 10481 ; 10482 BD00 .addr .set tiabufs 10483 .rept n_tiabix 10484 0000 .a .set 0 10485 .rept n_nxpchn 10486 .word .addr+.a 10487 0040 .a .= .a+s_tiabuf 10488 .word .addr+.a 10489 0080 .a .= .a+s_tiabuf 10490 .word .addr+.a 10491 00C0 .a .= .a+s_tiabuf 10492 .word .addr+.a 10493 0100 .a .= .a+s_tiabuf 10494 0000 .a .set 0 10495 .rept n_nxpchn 10496 .word .addr+.a 10497 0040 .a .= .a+s_tiabuf 10498 .word .addr+.a 10499 0080 .a .= .a+s_tiabuf 10500 .word .addr+.a 10501 00C0 .a .= .a+s_tiabuf 10502 .word .addr+.a 10503 0100 .a .= .a+s_tiabuf 10504 ; 10505 ; 10506 ; TxD circular queues... 10507 ; 10508 BE00 .addr .set tiabufs+.a 10509 .rept n_tiabix 10510 0000 .a .set 0 10511 .rept n_nxpchn 10512 .word .addr+.a 10513 0040 .a .= .a+s_tiabuf 10514 .word .addr+.a 10515 0080 .a .= .a+s_tiabuf 10516 .word .addr+.a 10517 00C0 .a .= .a+s_tiabuf 10518 .word .addr+.a 10519 0100 .a .= .a+s_tiabuf 10520 0000 .a .set 0 10521 .rept n_nxpchn 10522 .word .addr+.a 10523 0040 .a .= .a+s_tiabuf 10524 .word .addr+.a 10525 0080 .a .= .a+s_tiabuf 10526 .word .addr+.a 10527 00C0 .a .= .a+s_tiabuf 10528 .word .addr+.a 10529 0100 .a .= .a+s_tiabuf 10530 ; 10531 EA3B tiaipend =* 10532 ; 10533 .end 10534 .include "tables/ds1511.asm" 10535 ;================================================================================ 10536 ; 10537 ;MAXIM DS1511 REAL-TIME CLOCK INITIALIZATION DATA 10538 ; 10539 ; ———————————————————————————————————————————————————————————————————————— 10540 ; Each entry in this table consists of a chip register offset paired with 10541 ; the parameter that is to be loaded into the register. Use caution when 10542 ; editing this table, as changing the order in which parameters are load- 10543 ; ed may cause the device to malfunction. Table entries are read in rev- 10544 ; erse order during device setup. Changes to the RTC setup should be made 10545 ; in include_hardware/clock/ds1511_constants.asm, not here. Only change 10546 ; this table if an entry is to be added or deleted. 10547 ; ———————————————————————————————————————————————————————————————————————— 10548 ; 10549 d11tab .byte wr_crb, wr_crbpb ;CRB : updates on 10550 .byte wr_seca,wr_secap ;SECA: no alarm secs IRQ 10551 .byte wr_mina,wr_minap ;MINA: no alarm min IRQ 10552 .byte wr_hrsa,wr_hrsap ;HRSA: no alarm hour IRQ 10553 .byte wr_dowa,wr_dowap ;DOWS: no alarm date/day IRQ 10554 .byte wr_crb, wr_crbpa ;CRB : updates & WDT IRQs off 10555 000C s_d11tab =*-d11tab ;table size 10556 ; 10557 .end 10558 .include "tables/ncr53c94.asm" 10559 ;================================================================================ 10560 ; 10561 ;53C94 SCSI CONTROLLER INITIALIZATION DATA 10562 ; 10563 ; ——————————————————————————————————————————————————————————————————————— 10564 ; Each entry in this table consists of a chip register offset paired with 10565 ; the parameter that is to be loaded into the register. Use caution when 10566 ; editing this table, as changing the order in which parameters are load- 10567 ; ed may cause the device to malfunction. Table entries are read in rev- 10568 ; erse order during device setup. 10569 ; ——————————————————————————————————————————————————————————————————————— 10570 ; 10571 s94tab .byte sr_cr3, sr_cr3p ;set control #3 10572 .byte sr_cr2, sr_cr2p ;set control #2 10573 .byte sr_cr1, sr_cr1p ;set control #1 10574 .byte sr_tout,sr_toutp ;set selection timeout period 10575 .byte sr_clkf,sr_clkfp ;set clock factor 10576 .byte sr_ftm, sr_ftmp ;disable forced test modes 10577 ; 10578 000C s_s94tab =*-s94tab ;table size 10579 ; 10580 ;=============================================================================== 10581 ; 10582 ;SCSI CONTROLLER FIFO TEST DATA 10583 ; 10584 scfifotd .byte $ff,$00,$12,$21,$24,$42,$36,$63 10585 .byte $48,$84,$5a,$a5,$6c,$c6,$7e,$e7 10586 ; 10587 .end 10588 .include "tables/nxp_duart.asm" 10589 ;================================================================================ 10590 ; 10591 ;PHILIPS/NXP DUAL UART INITIALIZATION DATA 10592 ; 10593 ; 10594 ; common setup table for both DUARTs... 10595 ; 10596 nxpsutab .byte nx_crb, nxpcrrsa ;CRB 10597 .byte nx_crb, nxpcrrte ;CRB 10598 .byte nx_csrb,nxpcsdef ;CSRB 10599 .byte nx_mrb, nxpm2def ;MR2B 10600 .byte nx_mrb, nxpm1def ;MR1B 10601 .byte nx_crb, nxpcrmr1 ;CRB 10602 .byte nx_mrb, nxpm0def ;MR0B 10603 .byte nx_crb, nxpcrmr0 ;CRB 10604 .byte nx_cra, nxpcrrsa ;CRA 10605 .byte nx_cra, nxpcrrte ;CRA 10606 .byte nx_csra,nxpcsdef ;CSRA 10607 .byte nx_mra, nxpm2def ;MR2A 10608 .byte nx_mra, nxpm1def ;MR1A 10609 .byte nx_cra, nxpcrmr1 ;CRA 10610 .byte nx_mra, nxpm0def ;MR0A 10611 .byte nx_cra, nxpcrmr0 ;CRA 10612 .byte nx_acr, nxparbrt ;ACR 10613 .byte nx_opcr,nxpopdef ;OPCR 10614 .byte nx_crb, nxpcrtmd ;CRB 10615 .byte nx_crb, nxpcresr ;CRB 10616 .byte nx_crb, nxpcrbir ;CRB 10617 .byte nx_crb, nxpcrtxr ;CRB 10618 .byte nx_crb, nxpcrrxr ;CRB 10619 .byte nx_crb, nxpcrrsd ;CRB 10620 .byte nx_cra, nxpcrtmd ;CRA 10621 .byte nx_cra, nxpcresr ;CRA 10622 .byte nx_cra, nxpcrbir ;CRA 10623 .byte nx_cra, nxpcrtxr ;CRA 10624 .byte nx_cra, nxpcrrxr ;CRA 10625 .byte nx_cra, nxpcrrsd ;CRA 10626 .byte nx_imr, 0 ;IMR (disable IRQs) 10627 003E s_nxptab =*-nxpsutab 10628 ; 10629 ; 10630 ; auxiliary setup table for DUART #1... 10631 ; 10632 nxpsxtab .byte nx_imr, nxpiqmsk ;IMR (enables IRQs) 10633 .byte nx_ctu, nxpctdhi ;CTU 10634 .byte nx_ctl, nxpctdlo ;CTL 10635 0006 s_nxptax =*-nxpsxtab 10636 ; 10637 .end 10638 .include "storage/magic.asm" 10639 ;================================================================================ 10640 ; 10641 ;ISL MAGIC NUMBER 10642 ; 10643 magicisl .dword islmagic 10644 ; 10645 .end 10646 .include "mon/tables.asm" 10647 ;================================================================================ 10648 ; 10649 ;MACHINE LANGUAGE MONITOR COMMAND PROCESSING DATA TABLES 10650 ; 10651 ; 10652 ; monitor commands... 10653 ; 10654 mpctab .byte "A" ;assemble code 10655 .byte "C" ;compare memory ranges 10656 .byte "D" ;disassemble code 10657 .byte "F" ;fill memory 10658 .byte "G" ;execute code 10659 .byte "H" ;search memory 10660 .byte "J" ;execute code as subroutine 10661 .byte "L" ;load data 10662 .byte "M" ;dump memory range 10663 .byte "R" ;dump registers 10664 .byte "T" ;copy memory range 10665 .byte "V" ;display software version 10666 .byte "Z" ;clear screen 10667 .byte ">" ;change memory 10668 .byte ";" ;change registers 10669 000F n_mpctab =*-mpctab ;entries in above table 10670 ; 10671 ; 10672 ; SCSI subsystem commands (preceded by !)... 10673 ; 10674 spctab .byte "B" ;recal/rewind 10675 .byte "F" ;format unit 10676 .byte "I" ;reset SCSI subsystem 10677 .byte "R" ;read data 10678 .byte "S" ;request sense data 10679 .byte "W" ;write data 10680 0006 n_spctab =*-spctab ;entries in above table 10681 ; 10682 ; 10683 ; monitor command jump table... 10684 ; 10685 mpcextab .word monasc-s_byte ; A assemble code 10686 .word moncmp-s_byte ; C compare memory ranges 10687 .word mondsc-s_byte ; D disassemble code 10688 .word monfil-s_byte ; F fill memory 10689 .word monjmp-s_byte ; G execute code 10690 .word monhnt-s_byte ; H search memory 10691 .word monjsr-s_byte ; J execute code as subroutine 10692 .word monlsr-s_byte ; L load data 10693 .word mondmp-s_byte ; M dump memory range 10694 .word monreg-s_byte ; R dump registers 10695 .word moncpy-s_byte ; T copy memory range 10696 .word monver-s_byte ; V display software version 10697 .word moncls-s_byte ; Z clear screen 10698 .word monchm-s_byte ; > change memory 10699 .word monchr-s_byte ; ; change registers 10700 ; 10701 ; 10702 ; SCSI subsystem command jump table... 10703 ; 10704 spcextab .word scsibom-s_byte ; B recal/rewind 10705 .word scsifmt-s_byte ; F format unit 10706 .word scsirst-s_byte ; I reset SCSI subsystem 10707 .word scsiread-s_byte ; R read data 10708 .word scsisens-s_byte ; S request sense data 10709 .word scsiwrit-s_byte ; W write data 10710 ; 10711 ; 10712 ; S-record processing jump table... 10713 ; 10714 lsrextab .word monlsrs0 ;S0 10715 .word monlsrs1 ;S1 10716 .word monlsrut ;S2 (not implemented) 10717 .word monlsrut ;S3 (not implemented) 10718 .word monlsrut ;S4 (not implemented) 10719 .word monlsrs5 ;S5 10720 .word monlsrut ;S6 (undefined) 10721 .word monlsrut ;S7 (not implemented) 10722 .word monlsrut ;S8 (not implemented) 10723 .word monlsrs9 ;S9 10724 ; 10725 ; 10726 ; number conversion... 10727 ; 10728 basetab .byte 16,10,8,2 ;supported number bases 10729 bitsdtab .byte 4,3,3,1 ;bits per binary digit 10730 bitsntab .byte 4,4,3,1 ;bits per ASCII character 10731 lzsttab .byte 3,2,9,2 ;leading zero suppression thresholds 10732 numstab .byte 12,12,16,48 ;bin to ASCII conversion numerals 10733 radxtab .byte c_hex ;hexadecimal radix 10734 .byte c_dec ;decimal radix 10735 .byte c_oct ;octal radix 10736 .byte c_bin ;binary radix 10737 0004 n_radix =*-radxtab ;number of recognized radices 10738 ; 10739 ; 10740 ; shadow MPU register sizes... 10741 ; 10742 rcvltab .byte s_mpupbx+s_byte ; PB 10743 .byte s_mpupcx+s_byte ; PC 10744 .byte s_mpusrx+s_byte ; SR 10745 .byte s_word+s_byte ; .C 10746 .byte s_word+s_byte ; .X 10747 .byte s_word+s_byte ; .Y 10748 .byte s_mpuspx+s_byte ; SP 10749 .byte s_mpudpx+s_byte ; DP 10750 .byte s_mpudbx+s_byte ; DB 10751 0009 n_regchv =*-rcvltab ;total shadow registers 10752 ; 10753 ;================================================================================ 10754 ; 10755 ;MACHINE LANGUAGE MONITOR ASSEMBLER/DISASSEMBLER DATA TABLES 10756 ; 10757 ; 10758 ; numerically sorted & encoded W65C816S mnemonics... 10759 ; 10760 mnetab .word mne_xba ; 0 — XBA 10761 .word mne_lda ; 1 — LDA 10762 .word mne_pea ; 2 — PEA 10763 .word mne_pha ; 3 — PHA 10764 .word mne_pla ; 4 — PLA 10765 .word mne_bra ; 5 — BRA 10766 .word mne_ora ; 6 — ORA 10767 .word mne_sta ; 7 — STA 10768 .word mne_txa ; 8 — TXA 10769 .word mne_tya ; 9 — TYA 10770 .word mne_phb ; 10 — PHB 10771 .word mne_plb ; 11 — PLB 10772 .word mne_trb ; 12 — TRB 10773 .word mne_tsb ; 13 — TSB 10774 .word mne_sbc ; 14 — SBC 10775 .word mne_bcc ; 15 — BCC 10776 .word mne_adc ; 16 — ADC 10777 .word mne_tdc ; 17 — TDC 10778 .word mne_dec ; 18 — DEC 10779 .word mne_sec ; 19 — SEC 10780 .word mne_clc ; 20 — CLC 10781 .word mne_inc ; 21 — INC 10782 .word mne_tsc ; 22 — TSC 10783 .word mne_bvc ; 23 — BVC 10784 .word mne_tcd ; 24 — TCD 10785 .word mne_sed ; 25 — SED 10786 .word mne_phd ; 26 — PHD 10787 .word mne_cld ; 27 — CLD 10788 .word mne_pld ; 28 — PLD 10789 .word mne_and ; 29 — AND 10790 .word mne_xce ; 30 — XCE 10791 .word mne_bne ; 31 — BNE 10792 .word mne_wai ; 32 — WAI 10793 .word mne_pei ; 33 — PEI 10794 .word mne_sei ; 34 — SEI 10795 .word mne_cli ; 35 — CLI 10796 .word mne_bmi ; 36 — BMI 10797 .word mne_rti ; 37 — RTI 10798 .word mne_phk ; 38 — PHK 10799 .word mne_brk ; 39 — BRK 10800 .word mne_jml ; 40 — JML 10801 .word mne_rol ; 41 — ROL 10802 .word mne_bpl ; 42 — BPL 10803 .word mne_brl ; 43 — BRL 10804 .word mne_asl ; 44 — ASL 10805 .word mne_jsl ; 45 — JSL 10806 .word mne_rtl ; 46 — RTL 10807 .word mne_wdm ; 47 — WDM 10808 .word mne_mvn ; 48 — MVN 10809 .word mne_rep ; 49 — REP 10810 .word mne_sep ; 50 — SEP 10811 .word mne_php ; 51 — PHP 10812 .word mne_plp ; 52 — PLP 10813 .word mne_cmp ; 53 — CMP 10814 .word mne_jmp ; 54 — JMP 10815 .word mne_cop ; 55 — COP 10816 .word mne_nop ; 56 — NOP 10817 .word mne_stp ; 57 — STP 10818 .word mne_mvp ; 58 — MVP 10819 .word mne_beq ; 59 — BEQ 10820 .word mne_per ; 60 — PER 10821 .word mne_eor ; 61 — EOR 10822 .word mne_ror ; 62 — ROR 10823 .word mne_jsr ; 63 — JSR 10824 .word mne_lsr ; 64 — LSR 10825 .word mne_bcs ; 65 — BCS 10826 .word mne_tcs ; 66 — TCS 10827 .word mne_rts ; 67 — RTS 10828 .word mne_bvs ; 68 — BVS 10829 .word mne_txs ; 69 — TXS 10830 .word mne_bit ; 70 — BIT 10831 .word mne_clv ; 71 — CLV 10832 .word mne_tax ; 72 — TAX 10833 .word mne_ldx ; 73 — LDX 10834 .word mne_dex ; 74 — DEX 10835 .word mne_phx ; 75 — PHX 10836 .word mne_plx ; 76 — PLX 10837 .word mne_inx ; 77 — INX 10838 .word mne_cpx ; 78 — CPX 10839 .word mne_tsx ; 79 — TSX 10840 .word mne_stx ; 80 — STX 10841 .word mne_tyx ; 81 — TYX 10842 .word mne_tay ; 82 — TAY 10843 .word mne_ldy ; 83 — LDY 10844 .word mne_dey ; 84 — DEY 10845 .word mne_phy ; 85 — PHY 10846 .word mne_ply ; 86 — PLY 10847 .word mne_iny ; 87 — INY 10848 .word mne_cpy ; 88 — CPY 10849 .word mne_sty ; 89 — STY 10850 .word mne_txy ; 90 — TXY 10851 .word mne_stz ; 91 — STZ 10852 ; 10853 00B8 s_mnetab =*-mnetab ;mnemonic table size 10854 005C n_mnemon =s_mnetab/s_word ;total mnemonics 10855 ; 10856 ; 10857 ; mnemonic lookup indices in opcode order... 10858 ; 10859 mnetabix .byte mne_brkx ; $00 BRK 10860 .byte mne_orax ; $01 ORA (dp,X) 10861 .byte mne_copx ; $02 COP 10862 .byte mne_orax ; $03 ORA offset,S 10863 .byte mne_tsbx ; $04 TSB dp 10864 .byte mne_orax ; $05 ORA dp 10865 .byte mne_aslx ; $06 ASL dp 10866 .byte mne_orax ; $07 ORA [dp] 10867 .byte mne_phpx ; $08 PHP 10868 .byte mne_orax ; $09 ORA # 10869 .byte mne_aslx ; $0A ASL A 10870 .byte mne_phdx ; $0B PHD 10871 .byte mne_tsbx ; $0C TSB abs 10872 .byte mne_orax ; $0D ORA abs 10873 .byte mne_aslx ; $0E ASL abs 10874 .byte mne_orax ; $0F ORA absl 10875 ; 10876 .byte mne_bplx ; $10 BPL abs 10877 .byte mne_orax ; $11 ORA (dp),Y 10878 .byte mne_orax ; $12 ORA (dp) 10879 .byte mne_orax ; $13 ORA (offset,S),Y 10880 .byte mne_trbx ; $14 TRB dp 10881 .byte mne_orax ; $15 ORA dp,X 10882 .byte mne_aslx ; $16 ASL dp,X 10883 .byte mne_orax ; $17 ORA [dp],Y 10884 .byte mne_clcx ; $18 CLC 10885 .byte mne_orax ; $19 ORA abs 10886 .byte mne_incx ; $1A INC A 10887 .byte mne_tcsx ; $1B TCS 10888 .byte mne_trbx ; $1C TRB abs 10889 .byte mne_orax ; $1D ORA abs,X 10890 .byte mne_aslx ; $1E ASL abs,X 10891 .byte mne_orax ; $1F ORA absl,X 10892 ; 10893 .byte mne_jsrx ; $20 JSR abs 10894 .byte mne_andx ; $21 AND (dp,X) 10895 .byte mne_jslx ; $22 JSL absl 10896 .byte mne_andx ; $23 AND offset,S 10897 .byte mne_bitx ; $24 BIT dp 10898 .byte mne_andx ; $25 AND dp 10899 .byte mne_rolx ; $26 ROL dp 10900 .byte mne_andx ; $27 AND [dp] 10901 .byte mne_plpx ; $28 PLP 10902 .byte mne_andx ; $29 AND # 10903 .byte mne_rolx ; $2A ROL A 10904 .byte mne_pldx ; $2B PLD 10905 .byte mne_bitx ; $2C BIT abs 10906 .byte mne_andx ; $2D AND abs 10907 .byte mne_rolx ; $2E ROL abs 10908 .byte mne_andx ; $2F AND absl 10909 ; 10910 .byte mne_bmix ; $30 BMI abs 10911 .byte mne_andx ; $31 AND (dp),Y 10912 .byte mne_andx ; $32 AND (dp) 10913 .byte mne_andx ; $33 AND (offset,S),Y 10914 .byte mne_bitx ; $34 BIT dp,X 10915 .byte mne_andx ; $35 AND dp,X 10916 .byte mne_rolx ; $36 ROL dp,X 10917 .byte mne_andx ; $37 AND [dp],Y 10918 .byte mne_secx ; $38 SEC 10919 .byte mne_andx ; $39 AND abs,Y 10920 .byte mne_decx ; $3A DEC A 10921 .byte mne_tscx ; $3B TSC 10922 .byte mne_bitx ; $3C BIT abs,X 10923 .byte mne_andx ; $3D AND abs,X 10924 .byte mne_rolx ; $3E ROL abs,X 10925 .byte mne_andx ; $3F AND absl,X 10926 ; 10927 .byte mne_rtix ; $40 RTI 10928 .byte mne_eorx ; $41 EOR (dp,X) 10929 .byte mne_wdmx ; $42 WDM 10930 .byte mne_eorx ; $43 EOR offset,S 10931 .byte mne_mvpx ; $44 MVP sb,db 10932 .byte mne_eorx ; $45 EOR dp 10933 .byte mne_lsrx ; $46 LSR dp 10934 .byte mne_eorx ; $47 EOR [dp] 10935 .byte mne_phax ; $48 PHA 10936 .byte mne_eorx ; $49 EOR # 10937 .byte mne_lsrx ; $4A LSR A 10938 .byte mne_phkx ; $4B PHK 10939 .byte mne_jmpx ; $4C JMP abs 10940 .byte mne_eorx ; $4D EOR abs 10941 .byte mne_lsrx ; $4E LSR abs 10942 .byte mne_eorx ; $4F EOR absl 10943 ; 10944 .byte mne_bvcx ; $50 BVC abs 10945 .byte mne_eorx ; $51 EOR (dp),Y 10946 .byte mne_eorx ; $52 EOR (dp) 10947 .byte mne_eorx ; $53 EOR (offset,S),Y 10948 .byte mne_mvnx ; $54 MVN sb,db 10949 .byte mne_eorx ; $55 EOR dp,X 10950 .byte mne_lsrx ; $56 LSR dp,X 10951 .byte mne_eorx ; $57 EOR [dp],Y 10952 .byte mne_clix ; $58 CLI 10953 .byte mne_eorx ; $59 EOR abs,Y 10954 .byte mne_phyx ; $5A PHY 10955 .byte mne_tcdx ; $5B TCD 10956 .byte mne_jmlx ; $5C JML absl 10957 .byte mne_eorx ; $5D EOR abs,X 10958 .byte mne_lsrx ; $5E LSR abs,X 10959 .byte mne_eorx ; $5F EOR absl,X 10960 ; 10961 .byte mne_rtsx ; $60 RTS 10962 .byte mne_adcx ; $61 ADC (dp,X) 10963 .byte mne_perx ; $62 PER 10964 .byte mne_adcx ; $63 ADC offset,S 10965 .byte mne_stzx ; $64 STZ dp 10966 .byte mne_adcx ; $65 ADC dp 10967 .byte mne_rorx ; $66 ROR dp 10968 .byte mne_adcx ; $67 ADC [dp] 10969 .byte mne_plax ; $68 PLA 10970 .byte mne_adcx ; $69 ADC # 10971 .byte mne_rorx ; $6A ROR A 10972 .byte mne_rtlx ; $6B RTL 10973 .byte mne_jmpx ; $6C JMP (abs) 10974 .byte mne_adcx ; $6D ADC abs 10975 .byte mne_rorx ; $6E ROR abs 10976 .byte mne_adcx ; $6F ADC absl 10977 ; 10978 .byte mne_bvsx ; $70 BVS abs 10979 .byte mne_adcx ; $71 ADC (dp),Y 10980 .byte mne_adcx ; $72 ADC (dp) 10981 .byte mne_adcx ; $73 ADC (offset,S),Y 10982 .byte mne_stzx ; $74 STZ dp,X 10983 .byte mne_adcx ; $75 ADC dp,X 10984 .byte mne_rorx ; $76 ROR dp,X 10985 .byte mne_adcx ; $77 ADC [dp],Y 10986 .byte mne_seix ; $78 SEI 10987 .byte mne_adcx ; $79 ADC abs,Y 10988 .byte mne_plyx ; $7A PLY 10989 .byte mne_tdcx ; $7B TDC 10990 .byte mne_jmpx ; $7C JMP (abs,X) 10991 .byte mne_adcx ; $7D ADC abs,X 10992 .byte mne_rorx ; $7E ROR abs,X 10993 .byte mne_adcx ; $7F ADC absl,X 10994 ; 10995 .byte mne_brax ; $80 BRA abs 10996 .byte mne_stax ; $81 STA (dp,X) 10997 .byte mne_brlx ; $82 BRL abs 10998 .byte mne_stax ; $83 STA offset,S 10999 .byte mne_styx ; $84 STY dp 11000 .byte mne_stax ; $85 STA dp 11001 .byte mne_stxx ; $86 STX dp 11002 .byte mne_stax ; $87 STA [dp] 11003 .byte mne_deyx ; $88 DEY 11004 .byte mne_bitx ; $89 BIT # 11005 .byte mne_txax ; $8A TXA 11006 .byte mne_phbx ; $8B PHB 11007 .byte mne_styx ; $8C STY abs 11008 .byte mne_stax ; $8D STA abs 11009 .byte mne_stxx ; $8E STX abs 11010 .byte mne_stax ; $8F STA absl 11011 ; 11012 .byte mne_bccx ; $90 BCC abs 11013 .byte mne_stax ; $91 STA (dp),Y 11014 .byte mne_stax ; $92 STA (dp) 11015 .byte mne_stax ; $93 STA (offset,S),Y 11016 .byte mne_styx ; $94 STY dp,X 11017 .byte mne_stax ; $95 STA dp,X 11018 .byte mne_stxx ; $96 STX dp,Y 11019 .byte mne_stax ; $97 STA [dp],Y 11020 .byte mne_tyax ; $98 TYA 11021 .byte mne_stax ; $99 STA abs,Y 11022 .byte mne_txsx ; $9A TXS 11023 .byte mne_txyx ; $9B TXY 11024 .byte mne_stzx ; $9C STZ abs 11025 .byte mne_stax ; $9D STA abs,X 11026 .byte mne_stzx ; $9E STZ abs,X 11027 .byte mne_stax ; $9F STA absl,X 11028 ; 11029 .byte mne_ldyx ; $A0 LDY # 11030 .byte mne_ldax ; $A1 LDA (dp,X) 11031 .byte mne_ldxx ; $A2 LDX # 11032 .byte mne_ldax ; $A3 LDA offset,S 11033 .byte mne_ldyx ; $A4 LDY dp 11034 .byte mne_ldax ; $A5 LDA dp 11035 .byte mne_ldxx ; $A6 LDX dp 11036 .byte mne_ldax ; $A7 LDA [dp] 11037 .byte mne_tayx ; $A8 TAY 11038 .byte mne_ldax ; $A9 LDA # 11039 .byte mne_taxx ; $AA TAX 11040 .byte mne_plbx ; $AB PLB 11041 .byte mne_ldyx ; $AC LDY abs 11042 .byte mne_ldax ; $AD LDA abs 11043 .byte mne_ldxx ; $AE LDX abs 11044 .byte mne_ldax ; $AF LDA absl 11045 ; 11046 .byte mne_bcsx ; $B0 BCS abs 11047 .byte mne_ldax ; $B1 LDA (dp),Y 11048 .byte mne_ldax ; $B2 LDA (dp) 11049 .byte mne_ldax ; $B3 LDA (offset,S),Y 11050 .byte mne_ldyx ; $B4 LDY dp,X 11051 .byte mne_ldax ; $B5 LDA dp,X 11052 .byte mne_ldxx ; $B6 LDX dp,Y 11053 .byte mne_ldax ; $B7 LDA [dp],Y 11054 .byte mne_clvx ; $B8 CLV 11055 .byte mne_ldax ; $B9 LDA abs,Y 11056 .byte mne_tsxx ; $BA TSX 11057 .byte mne_tyxx ; $BB TYX 11058 .byte mne_ldyx ; $BC LDY abs,X 11059 .byte mne_ldax ; $BD LDA abs,X 11060 .byte mne_ldxx ; $BE LDX abs,Y 11061 .byte mne_ldax ; $BF LDA absl,X 11062 ; 11063 .byte mne_cpyx ; $C0 CPY # 11064 .byte mne_cmpx ; $C1 CMP (dp,X) 11065 .byte mne_repx ; $C2 REP # 11066 .byte mne_cmpx ; $C3 CMP offset,S 11067 .byte mne_cpyx ; $C4 CPY dp 11068 .byte mne_cmpx ; $C5 CMP dp 11069 .byte mne_decx ; $C6 DEC dp 11070 .byte mne_cmpx ; $C7 CMP [dp] 11071 .byte mne_inyx ; $C8 INY 11072 .byte mne_cmpx ; $C9 CMP # 11073 .byte mne_dexx ; $CA DEX 11074 .byte mne_waix ; $CB WAI 11075 .byte mne_cpyx ; $CC CPY abs 11076 .byte mne_cmpx ; $CD CMP abs 11077 .byte mne_decx ; $CE DEC abs 11078 .byte mne_cmpx ; $CF CMP absl 11079 ; 11080 .byte mne_bnex ; $D0 BNE abs 11081 .byte mne_cmpx ; $D1 CMP (dp),Y 11082 .byte mne_cmpx ; $D2 CMP (dp) 11083 .byte mne_cmpx ; $D3 CMP (offset,S),Y 11084 .byte mne_peix ; $D4 PEI dp 11085 .byte mne_cmpx ; $D5 CMP dp,X 11086 .byte mne_decx ; $D6 DEC dp,X 11087 .byte mne_cmpx ; $D7 CMP [dp],Y 11088 .byte mne_cldx ; $D8 CLD 11089 .byte mne_cmpx ; $D9 CMP abs,Y 11090 .byte mne_phxx ; $DA PHX 11091 .byte mne_stpx ; $DB STP 11092 .byte mne_jmpx ; $DC JMP [abs] 11093 .byte mne_cmpx ; $DD CMP abs,X 11094 .byte mne_decx ; $DE DEC abs,X 11095 .byte mne_cmpx ; $DF CMP absl,X 11096 ; 11097 .byte mne_cpxx ; $E0 CPX # 11098 .byte mne_sbcx ; $E1 SBC (dp,X) 11099 .byte mne_sepx ; $E2 SEP # 11100 .byte mne_sbcx ; $E3 SBC offset,S 11101 .byte mne_cpxx ; $E4 CPX dp 11102 .byte mne_sbcx ; $E5 SBC dp 11103 .byte mne_incx ; $E6 INC dp 11104 .byte mne_sbcx ; $E7 SBC [dp] 11105 .byte mne_inxx ; $E8 INX 11106 .byte mne_sbcx ; $E9 SBC # 11107 .byte mne_nopx ; $EA NOP 11108 .byte mne_xbax ; $EB XBA 11109 .byte mne_cpxx ; $EC CPX abs 11110 .byte mne_sbcx ; $ED SBC abs 11111 .byte mne_incx ; $EE INC abs 11112 .byte mne_sbcx ; $EF SBC absl 11113 ; 11114 .byte mne_beqx ; $F0 BEQ abs 11115 .byte mne_sbcx ; $F1 SBC (dp),Y 11116 .byte mne_sbcx ; $F2 SBC (dp) 11117 .byte mne_sbcx ; $F3 SBC (offset,S),Y 11118 .byte mne_peax ; $F4 PEA # 11119 .byte mne_sbcx ; $F5 SBC dp,X 11120 .byte mne_incx ; $F6 INC dp,X 11121 .byte mne_sbcx ; $F7 SBC [dp],Y 11122 .byte mne_sedx ; $F8 SED 11123 .byte mne_sbcx ; $F9 SBC abs,Y 11124 .byte mne_plxx ; $FA PLX 11125 .byte mne_xcex ; $FB XCE 11126 .byte mne_jsrx ; $FC JSR (abs,X) 11127 .byte mne_sbcx ; $FD SBC abs,X 11128 .byte mne_incx ; $FE INC abs,X 11129 .byte mne_sbcx ; $FF SBC absl,X 11130 ; 11131 ; 11132 ; instruction addressing modes & sizes in opcode order... 11133 ; 11134 ; xxxxxxxx 11135 ; |||||||| 11136 ; ||||++++———> Addressing Mode 11137 ; |||| —————————————————————————————————— 11138 ; |||| 0000 dp, abs, absl, implied or A 11139 ; |||| 0001 # 11140 ; |||| 0010 dp,X, abs,X or absl,X 11141 ; |||| 0011 dp,Y or abs,Y 11142 ; |||| 0100 (dp) or (abs) 11143 ; |||| 0101 [dp] or [abs] 11144 ; |||| 0110 [dp],Y 11145 ; |||| 0111 (dp,X) or (abs,X) 11146 ; |||| 1000 (dp),Y 11147 ; |||| 1001 offset,S 11148 ; |||| 1010 (offset,S),Y 11149 ; |||| 1011 sbnk,dbnk (MVN or MVP) 11150 ; |||| —-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-— 11151 ; |||| # = immediate 11152 ; |||| A = accumulator 11153 ; |||| abs = absolute 11154 ; |||| absl = absolute long 11155 ; |||| dbnk = destination bank 11156 ; |||| dp = direct (zero) page 11157 ; |||| S = stack relative 11158 ; |||| sbnk = source bank 11159 ; |||| —————————————————————————————————— 11160 ; |||| 11161 ; ||++———————> binary-encoded operand size 11162 ; |+—————————> 1: relative branch instruction 11163 ; +——————————> 1: variable operand size... 11164 ; 11165 ; ————————————————————————————————————————————————————————————— 11166 ; Variable operand size refers to an immediate mode instruction 11167 ; that can accept either an 8 or 16 bit operand. During instr- 11168 ; uction assembly, an 8 bit operand can be forced to 16 bits by 11169 ; preceding the operand field with !, e.g., LDA !#$01, which 11170 ; will assemble as $A9 $01 $00. LDA #$0001 will assemble as 11171 ; as $A9 $01, whereas LDA !#$0001 will assemble as $A9 $01 $00. 11172 ; ————————————————————————————————————————————————————————————— 11173 ; 11174 mnetabam .byte ops0 | am_nam ; $00 BRK 11175 .byte ops1 | am_indx ; $01 ORA (dp,X) 11176 .byte ops1 | am_nam ; $02 COP 11177 .byte ops1 | am_stk ; $03 ORA offset,S 11178 .byte ops1 | am_nam ; $04 TSB dp 11179 .byte ops1 | am_nam ; $05 ORA dp 11180 .byte ops1 | am_nam ; $06 ASL dp 11181 .byte ops1 | am_indl ; $07 ORA [dp] 11182 .byte ops0 | am_nam ; $08 PHP 11183 .byte vops | am_imm ; $09 ORA # 11184 .byte ops0 | am_nam ; $0A ASL A 11185 .byte ops0 | am_nam ; $0B PHD 11186 .byte ops2 | am_nam ; $0C TSB abs 11187 .byte ops2 | am_nam ; $0D ORA abs 11188 .byte ops2 | am_nam ; $0E ASL abs 11189 .byte ops3 | am_nam ; $0F ORA absl 11190 ; 11191 .byte bop1 | am_nam ; $10 BPL abs 11192 .byte ops1 | am_indy ; $11 ORA (dp),Y 11193 .byte ops1 | am_ind ; $12 ORA (dp) 11194 .byte ops1 | am_stky ; $13 ORA (offset,S),Y 11195 .byte ops1 | am_nam ; $14 TRB dp 11196 .byte ops1 | am_adrx ; $15 ORA dp,X 11197 .byte ops1 | am_adrx ; $16 ASL dp,X 11198 .byte ops1 | am_indly ; $17 ORA [dp],Y 11199 .byte ops0 | am_nam ; $18 CLC 11200 .byte ops2 | am_nam ; $19 ORA abs 11201 .byte ops0 | am_nam ; $1A INC A 11202 .byte ops0 | am_nam ; $1B TCS 11203 .byte ops2 | am_nam ; $1C TRB abs 11204 .byte ops2 | am_adrx ; $1D ORA abs,X 11205 .byte ops2 | am_adrx ; $1E ASL abs,X 11206 .byte ops3 | am_adrx ; $1F ORA absl,X 11207 ; 11208 .byte ops2 | am_nam ; $20 JSR abs 11209 .byte ops1 | am_indx ; $21 AND (dp,X) 11210 .byte ops3 | am_nam ; $22 JSL absl 11211 .byte ops1 | am_stk ; $23 AND offset,S 11212 .byte ops1 | am_nam ; $24 BIT dp 11213 .byte ops1 | am_nam ; $25 AND dp 11214 .byte ops1 | am_nam ; $26 ROL dp 11215 .byte ops1 | am_indl ; $27 AND [dp] 11216 .byte ops0 | am_nam ; $28 PLP 11217 .byte vops | am_imm ; $29 AND # 11218 .byte ops0 | am_nam ; $2A ROL A 11219 .byte ops0 | am_nam ; $2B PLD 11220 .byte ops2 | am_nam ; $2C BIT abs 11221 .byte ops2 | am_nam ; $2D AND abs 11222 .byte ops2 | am_nam ; $2E ROL abs 11223 .byte ops3 | am_nam ; $2F AND absl 11224 ; 11225 .byte bop1 | am_nam ; $30 BMI abs 11226 .byte ops1 | am_indy ; $31 AND (dp),Y 11227 .byte ops1 | am_ind ; $32 AND (dp) 11228 .byte ops1 | am_stky ; $33 AND (offset,S),Y 11229 .byte ops1 | am_adrx ; $34 BIT dp,X 11230 .byte ops1 | am_adrx ; $35 AND dp,X 11231 .byte ops1 | am_adrx ; $36 ROL dp,X 11232 .byte ops1 | am_indly ; $37 AND [dp],Y 11233 .byte ops0 | am_nam ; $38 SEC 11234 .byte ops2 | am_adry ; $39 AND abs,Y 11235 .byte ops0 | am_nam ; $3A DEC A 11236 .byte ops0 | am_nam ; $3B TSC 11237 .byte ops2 | am_adrx ; $3C BIT abs,X 11238 .byte ops2 | am_adrx ; $3D AND abs,X 11239 .byte ops2 | am_adrx ; $3E ROL abs,X 11240 .byte ops3 | am_adrx ; $3F AND absl,X 11241 ; 11242 .byte ops0 | am_nam ; $40 RTI 11243 .byte ops1 | am_indx ; $41 EOR (dp,X) 11244 .byte ops1 | am_nam ; $42 WDM 11245 .byte ops1 | am_stk ; $43 EOR offset,S 11246 .byte ops2 | am_move ; $44 MVP sb,db 11247 .byte ops1 | am_nam ; $45 EOR dp 11248 .byte ops1 | am_nam ; $46 LSR dp 11249 .byte ops1 | am_indl ; $47 EOR [dp] 11250 .byte ops0 | am_nam ; $48 PHA 11251 .byte vops | am_imm ; $49 EOR # 11252 .byte ops0 | am_nam ; $4A LSR A 11253 .byte ops0 | am_nam ; $4B PHK 11254 .byte ops2 | am_nam ; $4C JMP abs 11255 .byte ops2 | am_nam ; $4D EOR abs 11256 .byte ops2 | am_nam ; $4E LSR abs 11257 .byte ops3 | am_nam ; $4F EOR absl 11258 ; 11259 .byte bop1 | am_nam ; $50 BVC abs 11260 .byte ops1 | am_indy ; $51 EOR (dp),Y 11261 .byte ops1 | am_ind ; $52 EOR (dp) 11262 .byte ops1 | am_stky ; $53 EOR (offset,S),Y 11263 .byte ops2 | am_move ; $54 MVN sb,db 11264 .byte ops1 | am_adrx ; $55 EOR dp,X 11265 .byte ops1 | am_adrx ; $56 LSR dp,X 11266 .byte ops1 | am_indly ; $57 EOR [dp],Y 11267 .byte ops0 | am_nam ; $58 CLI 11268 .byte ops2 | am_adry ; $59 EOR abs,Y 11269 .byte ops0 | am_nam ; $5A PHY 11270 .byte ops0 | am_nam ; $5B TCD 11271 .byte ops3 | am_nam ; $5C JML absl 11272 .byte ops2 | am_adrx ; $5D EOR abs,X 11273 .byte ops2 | am_adrx ; $5E LSR abs,X 11274 .byte ops3 | am_adrx ; $5F EOR absl,X 11275 ; 11276 .byte ops0 | am_nam ; $60 RTS 11277 .byte ops1 | am_indx ; $61 ADC (dp,X) 11278 .byte bop2 | am_nam ; $62 PER 11279 .byte ops1 | am_stk ; $63 ADC offset,S 11280 .byte ops1 | am_nam ; $64 STZ dp 11281 .byte ops1 | am_nam ; $65 ADC dp 11282 .byte ops1 | am_nam ; $66 ROR dp 11283 .byte ops1 | am_indl ; $67 ADC [dp] 11284 .byte ops0 | am_nam ; $68 PLA 11285 .byte vops | am_imm ; $69 ADC # 11286 .byte ops0 | am_nam ; $6A ROR A 11287 .byte ops0 | am_nam ; $6B RTL 11288 .byte ops2 | am_ind ; $6C JMP (abs) 11289 .byte ops2 | am_nam ; $6D ADC abs 11290 .byte ops2 | am_nam ; $6E ROR abs 11291 .byte ops3 | am_nam ; $6F ADC absl 11292 ; 11293 .byte bop1 | am_nam ; $70 BVS abs 11294 .byte ops1 | am_indy ; $71 ADC (dp),Y 11295 .byte ops1 | am_ind ; $72 ADC (dp) 11296 .byte ops1 | am_stky ; $73 ADC (offset,S),Y 11297 .byte ops1 | am_adrx ; $74 STZ dp,X 11298 .byte ops1 | am_adrx ; $75 ADC dp,X 11299 .byte ops1 | am_adrx ; $76 ROR dp,X 11300 .byte ops1 | am_indly ; $77 ADC [dp],Y 11301 .byte ops0 | am_nam ; $78 SEI 11302 .byte ops2 | am_adry ; $79 ADC abs,Y 11303 .byte ops0 | am_nam ; $7A PLY 11304 .byte ops0 | am_nam ; $7B TDC 11305 .byte ops2 | am_indx ; $7C JMP (abs,X) 11306 .byte ops2 | am_adrx ; $7D ADC abs,X 11307 .byte ops2 | am_adrx ; $7E ROR abs,X 11308 .byte ops3 | am_adrx ; $7F ADC absl,X 11309 ; 11310 .byte bop1 | am_nam ; $80 BRA abs 11311 .byte ops1 | am_indx ; $81 STA (dp,X) 11312 .byte bop2 | am_nam ; $82 BRL abs 11313 .byte ops1 | am_stk ; $83 STA offset,S 11314 .byte ops1 | am_nam ; $84 STY dp 11315 .byte ops1 | am_nam ; $85 STA dp 11316 .byte ops1 | am_nam ; $86 STX dp 11317 .byte ops1 | am_indl ; $87 STA [dp] 11318 .byte ops0 | am_nam ; $88 DEY 11319 .byte vops | am_imm ; $89 BIT # 11320 .byte ops0 | am_nam ; $8A TXA 11321 .byte ops0 | am_nam ; $8B PHB 11322 .byte ops2 | am_nam ; $8C STY abs 11323 .byte ops2 | am_nam ; $8D STA abs 11324 .byte ops2 | am_nam ; $8E STX abs 11325 .byte ops3 | am_nam ; $8F STA absl 11326 ; 11327 .byte bop1 | am_nam ; $90 BCC abs 11328 .byte ops1 | am_indy ; $91 STA (dp),Y 11329 .byte ops1 | am_ind ; $92 STA (dp) 11330 .byte ops1 | am_stky ; $93 STA (offset,S),Y 11331 .byte ops1 | am_adrx ; $94 STY dp,X 11332 .byte ops1 | am_adrx ; $95 STA dp,X 11333 .byte ops1 | am_adry ; $96 STX dp,Y 11334 .byte ops1 | am_indly ; $97 STA [dp],Y 11335 .byte ops0 | am_nam ; $98 TYA 11336 .byte ops2 | am_adry ; $99 STA abs,Y 11337 .byte ops0 | am_nam ; $9A TXS 11338 .byte ops0 | am_nam ; $9B TXY 11339 .byte ops2 | am_nam ; $9C STZ abs 11340 .byte ops2 | am_adrx ; $9D STA abs,X 11341 .byte ops2 | am_adrx ; $9E STZ abs,X 11342 .byte ops3 | am_adrx ; $9F STA absl,X 11343 ; 11344 .byte vops | am_imm ; $A0 LDY # 11345 .byte ops1 | am_indx ; $A1 LDA (dp,X) 11346 .byte vops | am_imm ; $A2 LDX # 11347 .byte ops1 | am_stk ; $A3 LDA offset,S 11348 .byte ops1 | am_nam ; $A4 LDY dp 11349 .byte ops1 | am_nam ; $A5 LDA dp 11350 .byte ops1 | am_nam ; $A6 LDX dp 11351 .byte ops1 | am_indl ; $A7 LDA [dp] 11352 .byte ops0 | am_nam ; $A8 TAY 11353 .byte vops | am_imm ; $A9 LDA # 11354 .byte ops0 | am_nam ; $AA TAX 11355 .byte ops0 | am_nam ; $AB PLB 11356 .byte ops2 | am_nam ; $AC LDY abs 11357 .byte ops2 | am_nam ; $AD LDA abs 11358 .byte ops2 | am_nam ; $AE LDX abs 11359 .byte ops3 | am_nam ; $AF LDA absl 11360 ; 11361 .byte bop1 | am_nam ; $B0 BCS abs 11362 .byte ops1 | am_indy ; $B1 LDA (dp),Y 11363 .byte ops1 | am_ind ; $B2 LDA (dp) 11364 .byte ops1 | am_stky ; $B3 LDA (offset,S),Y 11365 .byte ops1 | am_adrx ; $B4 LDY dp,X 11366 .byte ops1 | am_adrx ; $B5 LDA dp,X 11367 .byte ops1 | am_adry ; $B6 LDX dp,Y 11368 .byte ops1 | am_indly ; $B7 LDA [dp],Y 11369 .byte ops0 | am_nam ; $B8 CLV 11370 .byte ops2 | am_adry ; $B9 LDA abs,Y 11371 .byte ops0 | am_nam ; $BA TSX 11372 .byte ops0 | am_nam ; $BB TYX 11373 .byte ops2 | am_adrx ; $BC LDY abs,X 11374 .byte ops2 | am_adrx ; $BD LDA abs,X 11375 .byte ops2 | am_adry ; $BE LDX abs,Y 11376 .byte ops3 | am_adrx ; $BF LDA absl,X 11377 ; 11378 .byte vops | am_imm ; $C0 CPY # 11379 .byte ops1 | am_indx ; $C1 CMP (dp,X) 11380 .byte ops1 | am_imm ; $C2 REP # 11381 .byte ops1 | am_stk ; $C3 CMP offset,S 11382 .byte ops1 | am_nam ; $C4 CPY dp 11383 .byte ops1 | am_nam ; $C5 CMP dp 11384 .byte ops1 | am_nam ; $C6 DEC dp 11385 .byte ops1 | am_indl ; $C7 CMP [dp] 11386 .byte ops0 | am_nam ; $C8 INY 11387 .byte vops | am_imm ; $C9 CMP # 11388 .byte ops0 | am_nam ; $CA DEX 11389 .byte ops0 | am_nam ; $CB WAI 11390 .byte ops2 | am_nam ; $CC CPY abs 11391 .byte ops2 | am_nam ; $CD CMP abs 11392 .byte ops2 | am_nam ; $CE DEC abs 11393 .byte ops3 | am_nam ; $CF CMP absl 11394 ; 11395 .byte bop1 | am_nam ; $D0 BNE abs 11396 .byte ops1 | am_indy ; $D1 CMP (dp),Y 11397 .byte ops1 | am_ind ; $D2 CMP (dp) 11398 .byte ops1 | am_stky ; $D3 CMP (offset,S),Y 11399 .byte ops1 | am_nam ; $D4 PEI dp 11400 .byte ops1 | am_adrx ; $D5 CMP dp,X 11401 .byte ops1 | am_adrx ; $D6 DEC dp,X 11402 .byte ops1 | am_indly ; $D7 CMP [dp],Y 11403 .byte ops0 | am_nam ; $D8 CLD 11404 .byte ops2 | am_adry ; $D9 CMP abs,Y 11405 .byte ops0 | am_nam ; $DA PHX 11406 .byte ops0 | am_nam ; $DB STP 11407 .byte ops2 | am_indl ; $DC JMP [abs] 11408 .byte ops2 | am_adrx ; $DD CMP abs,X 11409 .byte ops2 | am_adrx ; $DE DEC abs,X 11410 .byte ops3 | am_adrx ; $DF CMP absl,X 11411 ; 11412 .byte vops | am_imm ; $E0 CPX # 11413 .byte ops1 | am_indx ; $E1 SBC (dp,X) 11414 .byte ops1 | am_imm ; $E2 SEP # 11415 .byte ops1 | am_stk ; $E3 SBC offset,S 11416 .byte ops1 | am_nam ; $E4 CPX dp 11417 .byte ops1 | am_nam ; $E5 SBC dp 11418 .byte ops1 | am_nam ; $E6 INC dp 11419 .byte ops1 | am_indl ; $E7 SBC [dp] 11420 .byte ops0 | am_nam ; $E8 INX 11421 .byte vops | am_imm ; $E9 SBC # 11422 .byte ops0 | am_nam ; $EA NOP 11423 .byte ops0 | am_nam ; $EB XBA 11424 .byte ops2 | am_nam ; $EC CPX abs 11425 .byte ops2 | am_nam ; $ED SBC abs 11426 .byte ops2 | am_nam ; $EE INC abs 11427 .byte ops3 | am_nam ; $EF SBC absl 11428 ; 11429 .byte bop1 | am_nam ; $F0 BEQ abs 11430 .byte ops1 | am_indy ; $F1 SBC (dp),Y 11431 .byte ops1 | am_ind ; $F2 SBC (dp) 11432 .byte ops1 | am_stky ; $F3 SBC (offset,S),Y 11433 .byte ops2 | am_imm ; $F4 PEA # 11434 .byte ops1 | am_adrx ; $F5 SBC dp,X 11435 .byte ops1 | am_adrx ; $F6 INC dp,X 11436 .byte ops1 | am_indly ; $F7 SBC [dp],Y 11437 .byte ops0 | am_nam ; $F8 SED 11438 .byte ops2 | am_adry ; $F9 SBC abs,Y 11439 .byte ops0 | am_nam ; $FA PLX 11440 .byte ops0 | am_nam ; $FB XCE 11441 .byte ops2 | am_indx ; $FC JSR (abs,X) 11442 .byte ops2 | am_adrx ; $FD SBC abs,X 11443 .byte ops2 | am_adrx ; $FE INC abs,X 11444 .byte ops3 | am_adrx ; $FF SBC absl,X 11445 ; 11446 ; 11447 ; .X & .Y immediate mode opcodes... 11448 ; 11449 vopidx .byte $a0 ;LDY # 11450 .byte $a2 ;LDX # 11451 .byte $c0 ;CPY # 11452 .byte $e0 ;CPX # 11453 0004 n_vopidx =*-vopidx ;number of opcodes 11454 ; 11455 ; 11456 ; addressing mode symbology lookup... 11457 ; 11458 ms_lutab .word ms_nam ;(0000) no symbol 11459 .word ms_imm ;(0001) # 11460 .word ms_addrx ;(0010) dp,X or abs,X 11461 .word ms_addry ;(0011) dp,Y or abs,Y 11462 .word ms_ind ;(0100) (dp) or (abs) 11463 .word ms_indl ;(0101) [dp] or [abs] 11464 .word ms_indly ;(0110) [dp],Y 11465 .word ms_indx ;(0111) (dp,X) or (abs,X) 11466 .word ms_indy ;(1000) (dp),Y 11467 .word ms_stk ;(1001) offset,S 11468 .word ms_stky ;(1010) (offset,S),Y 11469 .word ms_nam ;(1011) sbnk,dbnk 11470 ; 11471 ; 11472 ; addressing mode symbology strings... 11473 ; 11474 ms_nam .byte " ",0 ;no symbol 11475 ms_addrx .byte " ,X",0 ;dp,X or addr,X 11476 ms_addry .byte " ,Y",0 ;dp,Y or addr,Y 11477 ms_imm .byte "#",0 ;immediate 11478 ms_ind .byte "()",0 ;(dp) or (abs) 11479 ms_indl .byte "[]",0 ;[dp] or [abs] 11480 ms_indly .byte "[],Y",0 ;[dp],Y 11481 ms_indx .byte "(,X)",0 ;(dp,X) or (abs,X) 11482 ms_indy .byte "(),Y",0 ;(dp),Y 11483 ms_move .byte ",$",0 ;MVN/MVP sbnk,dbnk 11484 ms_stk .byte " ,S",0 ;offset,S 11485 ms_stky .byte "(,S),Y",0 ;(offset,S),Y 11486 ; 11487 .end 11488 .include "boot/strings.asm" 11489 ;================================================================================ 11490 ; 11491 ;CONSOLE DISPLAY CONTROL STRINGS 11492 ; 11493 dc_bf bf ;enable reverse foreground 11494 .byte a_esc,"(" 11495 .byte a_esc,"G4" 11496 .byte 0 11497 ; 11498 dc_bg bg ;select graphics mode 11499 .byte a_esc,"H",a_stx 11500 .byte 0 11501 ; 11502 dc_bs bs ;destructive backspace 11503 .byte a_bs 11504 dc 11505 .byte a_esc,"W" 11506 .byte 0 11507 ; 11508 dc_cl cl ;clear to end of line 11509 .byte a_esc,"T" 11510 .byte 0 11511 ; 11512 dc_cn cn ;cursor on 11513 .byte a_esc,"`1" 11514 .byte 0 11515 ; 11516 dc_co co ;cursor off 11517 .byte a_esc,"`0" 11518 .byte 0 11519 ; 11520 dc_er er ;enable normal foreground 11521 .byte a_esc,"(" 11522 .byte a_esc,"G0" 11523 .byte 0 11524 ; 11525 dc_eg eg ;select text mode 11526 .byte a_esc,"H",a_etx 11527 .byte 0 11528 ; 11529 dc_lf lf ;newline 11530 cr 11531 .byte a_cr 11532 .byte a_lf 11533 .byte 0 11534 ; 11535 dc_cs cs ;clear screen & home cursor 11536 .byte a_esc,"+" 11537 .byte 0 11538 ; 11539 dc_plot .byte a_esc,"=" ;cursor positioning preamble 11540 .byte 0 11541 ; 11542 ;================================================================================ 11543 ; 11544 ;CONSOLE BOX GRAPHICS DRAWING 11545 ; 11546 dc_g0 g0 ;horizontal line 11547 bg 11548 .byte a_esc,"H",a_stx 11549 .byte ":" 11550 eg 11551 .byte a_esc,"H",a_etx 11552 .byte 0 11553 ; 11554 dc_g1 g1 ;vertical line 11555 bg 11556 .byte a_esc,"H",a_stx 11557 .byte "6" 11558 eg 11559 .byte a_esc,"H",a_etx 11560 .byte 0 11561 ; 11562 dc_g2 g2 ;top left corner 11563 bg 11564 .byte a_esc,"H",a_stx 11565 .byte "2" 11566 eg 11567 .byte a_esc,"H",a_etx 11568 .byte 0 11569 ; 11570 dc_g3 g3 ;top right corner 11571 bg 11572 .byte a_esc,"H",a_stx 11573 .byte "3" 11574 eg 11575 .byte a_esc,"H",a_etx 11576 .byte 0 11577 ; 11578 dc_g4 g4 ;bottom left corner 11579 bg 11580 .byte a_esc,"H",a_stx 11581 .byte "1" 11582 eg 11583 .byte a_esc,"H",a_etx 11584 .byte 0 11585 ; 11586 dc_g5 g5 ;bottom right corner 11587 bg 11588 .byte a_esc,"H",a_stx 11589 .byte "5" 11590 eg 11591 .byte a_esc,"H",a_etx 11592 .byte 0 11593 ; 11594 dc_g6 g6 ;left tee (connects right) 11595 bg 11596 .byte a_esc,"H",a_stx 11597 .byte "4" 11598 eg 11599 .byte a_esc,"H",a_etx 11600 .byte 0 11601 ; 11602 dc_g7 g7 ;right tee (connects left) 11603 bg 11604 .byte a_esc,"H",a_stx 11605 .byte "9" 11606 eg 11607 .byte a_esc,"H",a_etx 11608 .byte 0 11609 ; 11610 dc_g8 g8 ;bottom tee (connects up) 11611 bg 11612 .byte a_esc,"H",a_stx 11613 .byte "=" 11614 eg 11615 .byte a_esc,"H",a_etx 11616 .byte 0 11617 ; 11618 dc_g9 g9 ;top tee (connects down) 11619 bg 11620 .byte a_esc,"H",a_stx 11621 .byte "0" 11622 eg 11623 .byte a_esc,"H",a_etx 11624 .byte 0 11625 ; 11626 dc_ga ga ;four-way connect 11627 bg 11628 .byte a_esc,"H",a_stx 11629 .byte "8" 11630 eg 11631 .byte a_esc,"H",a_etx 11632 .byte 0 11633 ; 11634 dc_gb gb ;solid block 11635 bg 11636 .byte a_esc,"H",a_stx 11637 .byte "7" 11638 eg 11639 .byte a_esc,"H",a_etx 11640 .byte 0 11641 ; 11642 dc_gc gc ;dark hash block 11643 bg 11644 .byte a_esc,"H",a_stx 11645 .byte ";" 11646 eg 11647 .byte a_esc,"H",a_etx 11648 .byte 0 11649 ; 11650 dc_gd gd ;light hash block 11651 bg 11652 .byte a_esc,"H",a_stx 11653 .byte "?" 11654 eg 11655 .byte a_esc,"H",a_etx 11656 .byte 0 11657 ; 11658 dc_ge ge ;double vertical line 11659 bg 11660 .byte a_esc,"H",a_stx 11661 .byte ">" 11662 eg 11663 .byte a_esc,"H",a_etx 11664 .byte 0 11665 ; 11666 dc_gf gf ;double horizontal line 11667 bg 11668 .byte a_esc,"H",a_stx 11669 .byte "<" 11670 eg 11671 .byte a_esc,"H",a_etx 11672 .byte 0 11673 ; 11674 ;================================================================================ 11675 ; 11676 ;SYSTEM INITIALIZATION TEXT STRINGS 11677 ; 11678 ; 11679 ; terminal initialization sequence... 11680 ; 11681 si_tmint .byte a_esc,a_quo ;unlock keyboard 11682 co ;cursor off 11683 .byte a_esc,"`0" 11684 .byte a_esc,"^0" ;normal video 11685 .byte a_esc,"`:" ;select 80 cols 11686 .byte a_esc,"e(" ;select 24 rows 11687 .byte a_esc,"e1" ;char attribute mode 11688 .byte a_esc,"(" ;write-protect off 11689 spcs ;select primary char set 11690 .byte a_esc,"cD" 11691 cs ;clear screen & home cursor 11692 .byte a_esc,"+" 11693 dn ;display on 11694 .byte a_esc,"`9" 11695 .byte 0 11696 ; 11697 ; 11698 ; POST banner... 11699 ; 11700 si_bannr cpos 2,1 ;@(2,1) 11701 .byte a_esc,"=" 11702 .byte .y+t_cpbase,.x+t_cpbase 11703 .byte "* * * POC SINGLE BOARD COMPUTER * * *" 11704 cpos 9,2 ;@(9,2) 11705 .byte a_esc,"=" 11706 .byte .y+t_cpbase,.x+t_cpbase 11707 .byte "BCS Technology Limited" 11708 cpos 9,3 ;@(9,3) 11709 .byte a_esc,"=" 11710 .byte .y+t_cpbase,.x+t_cpbase 11711 .byte "128KB Static RAM System" 11712 cpos 4,5 ;@(4,5) 11713 .byte a_esc,"=" 11714 .byte .y+t_cpbase,.x+t_cpbase 11715 .byte "Main Processor : WDC 65C816S" 11716 cpos 4,6 ;@(4,6) 11717 .byte a_esc,"=" 11718 .byte .y+t_cpbase,.x+t_cpbase 11719 .byte "Hardware Version: " 11720 hardvers 11721 .byte "1" ;major (0, 1, 2 ...) 11722 .byte "." 11723 .byte "2" ;minor (0, 1, 2 ...) 11724 .byte " " ;revision (blank, a, b, etc.) 11725 .byte " (" 11726 hwdate ;hardware date 11727 .byte "2020/01/08" ;YYYY/MM/DD 11728 .byte ")" 11729 cpos 0,versrow ;@(0,23) (version row) 11730 .byte a_esc,"=" 11731 .byte .y+t_cpbase,.x+t_cpbase 11732 ; 11733 ; 11734 ; copyright & firmware version info... 11735 ; 11736 si_vers .byte "Copyright (C)1991-" 11737 copyyear 11738 .byte "2020" ;YYYY 11739 .byte " " 11740 bg ;horizontal line 11741 .byte a_esc,"H",a_stx 11742 .byte t_hline,t_hline 11743 eg 11744 .byte a_esc,"H",a_etx 11745 .byte " Firmware " 11746 softvers 11747 .byte "1" ;major 11748 .byte "." 11749 .byte "11" ;minor 11750 .byte "." 11751 .byte "4a" ;revision 11752 .byte " ROM ID " 11753 romsnum 11754 .byte "20201125" ;YYYYMMDD 11755 .byte "-" 11756 .byte "01" ;sequence (01, 02 ...) 11757 .byte 0 11758 ; 11759 si_clver cpos 0,versrow ;@(0,23) 11760 .byte a_esc,"=" 11761 .byte .y+t_cpbase,.x+t_cpbase 11762 cl 11763 .byte a_esc,"T" 11764 cpos 0,rowtitle 11765 .byte a_esc,"=" 11766 .byte .y+t_cpbase,.x+t_cpbase 11767 .byte 0 11768 ; 11769 si_memt cpos 2,memctrow ;@(2,memctrow) 11770 .byte a_esc,"=" 11771 .byte .y+t_cpbase,.x+t_cpbase 11772 .byte "Sizing memory:" 11773 cpos 23,memctrow ;@(23,memctrow) 11774 .byte a_esc,"=" 11775 .byte .y+t_cpbase,.x+t_cpbase 11776 .byte "Bytes" 11777 .byte 0 11778 ; 11779 si_noos lf 11780 cr 11781 .byte a_cr 11782 .byte a_lf 11783 lf 11784 cr 11785 .byte a_cr 11786 .byte a_lf 11787 .byte "disk not bootable" 11788 .byte 0 11789 ; 11790 si_ramer rb ;terminal bell 11791 .byte a_bel 11792 cpos 0,12 ;@(0,12) 11793 .byte a_esc,"=" 11794 .byte .y+t_cpbase,.x+t_cpbase 11795 .byte "Bad RAM" 11796 .byte 0 11797 ; 11798 si_vline .byte t_vline,a_bs,a_lf,0 11799 ; 11800 .end 11801 .include "scsi/strings.asm" 11802 ;================================================================================ 11803 ; 11804 ;SCSI INITIALIZATION TEXT STRINGS 11805 ; 11806 sd_bannr cpos 0,rowtitle 11807 .byte a_esc,"=" 11808 .byte .y+t_cpbase,.x+t_cpbase 11809 cl 11810 .byte a_esc,"T" 11811 cpos colid,rowtitle 11812 .byte a_esc,"=" 11813 .byte .y+t_cpbase,.x+t_cpbase 11814 .byte "ID" 11815 cpos colvendr,rowtitle 11816 .byte a_esc,"=" 11817 .byte .y+t_cpbase,.x+t_cpbase 11818 .byte "Vendor" 11819 cpos colprod,rowtitle 11820 .byte a_esc,"=" 11821 .byte .y+t_cpbase,.x+t_cpbase 11822 .byte "Product" 11823 cpos colvers,rowtitle 11824 .byte a_esc,"=" 11825 .byte .y+t_cpbase,.x+t_cpbase 11826 .byte "Vers" 11827 cpos colstat,rowtitle 11828 .byte a_esc,"=" 11829 .byte .y+t_cpbase,.x+t_cpbase 11830 .byte "Status" 11831 cpos colid,rowtitle+1 11832 .byte a_esc,"=" 11833 .byte .y+t_cpbase,.x+t_cpbase 11834 .byte 0 11835 ; 11836 sd_offl .byte "Offline",0 11837 ; 11838 sd_nodev cpos colid,rowenum 11839 .byte a_esc,"=" 11840 .byte .y+t_cpbase,.x+t_cpbase 11841 .byte "No devices",0 11842 ; 11843 sd_nomed .byte "No medium",0 11844 ; 11845 sd_ready .byte "Ready",0 11846 ; 11847 .end 11848 .include "mon/strings.asm" 11849 ;================================================================================ 11850 ; 11851 ;M/L MONITOR TEXT STRINGS 11852 ; 11853 mm_brk rb 11854 .byte a_bel 11855 er 11856 .byte a_esc,"(" 11857 .byte a_esc,"G0" 11858 lf 11859 cr 11860 .byte a_cr 11861 .byte a_lf 11862 .byte " *BRK" 11863 cl 11864 .byte a_esc,"T" 11865 .byte a_lf 11866 cl 11867 .byte a_esc,"T" 11868 .byte 0 11869 ; 11870 mm_entry lf 11871 cr 11872 .byte a_cr 11873 .byte a_lf 11874 .byte a_lf 11875 .byte " *MON" 11876 lf 11877 cr 11878 .byte a_cr 11879 .byte a_lf 11880 .byte 0 11881 ; 11882 mm_err .byte " *ERR" 11883 cl 11884 .byte a_esc,"T" 11885 .byte 0 11886 ; 11887 mm_prmpt lf 11888 cr 11889 .byte a_cr 11890 .byte a_lf 11891 cl 11892 .byte a_esc,"T" 11893 sf 11894 .byte a_esc,"(" 11895 .byte a_esc,"G0" 11896 .byte "." 11897 .byte 0 11898 ; 11899 mm_regs lf 11900 cr 11901 .byte a_cr 11902 .byte a_lf 11903 .byte " PB PC NVmxDIZC .C .X .Y SP DP DB IRQV" 11904 cl 11905 .byte a_esc,"T" 11906 lf 11907 cr 11908 .byte a_cr 11909 .byte a_lf 11910 .byte "; " 11911 cl 11912 .byte a_esc,"T" 11913 .byte 0 11914 ; 11915 mm_rts rb 11916 .byte a_bel 11917 er 11918 .byte a_esc,"(" 11919 .byte a_esc,"G0" 11920 lf 11921 cr 11922 .byte a_cr 11923 .byte a_lf 11924 .byte " *RTS" 11925 cl 11926 .byte a_esc,"T" 11927 .byte a_lf 11928 cl 11929 .byte a_esc,"T" 11930 .byte 0 11931 ; 11932 ;================================================================================ 11933 ; 11934 ;S-RECORD PROCESSING TEXT STRINGS 11935 ; 11936 lr_addre lf 11937 cr 11938 .byte a_cr 11939 .byte a_lf 11940 .byte " End: $",0 11941 ; 11942 lr_addrs lf 11943 cr 11944 .byte a_cr 11945 .byte a_lf 11946 .byte "Start: $" 11947 ce 11948 .byte a_esc,"Y" 11949 .byte 0 11950 ; 11951 lr_bufor lf 11952 cr 11953 .byte a_cr 11954 .byte a_lf 11955 .byte "Buffer overrun" 11956 cl 11957 .byte a_esc,"T" 11958 rb 11959 .byte a_bel 11960 .byte 0 11961 ; 11962 lr_corup lf 11963 cr 11964 .byte a_cr 11965 .byte a_lf 11966 .byte "Bad record" 11967 cl 11968 .byte a_esc,"T" 11969 rb 11970 .byte a_bel 11971 .byte 0 11972 ; 11973 lr_load co 11974 .byte a_esc,"`0" 11975 cr 11976 .byte a_cr 11977 cl 11978 .byte a_esc,"T" 11979 .byte "Loading: " 11980 .byte 0 11981 ; 11982 lr_norec lf 11983 cr 11984 .byte a_cr 11985 .byte a_lf 11986 .byte "No S1 records" 11987 cl 11988 .byte a_esc,"T" 11989 rb 11990 .byte a_bel 11991 .byte 0 11992 ; 11993 lr_recct lf 11994 cr 11995 .byte a_cr 11996 .byte a_lf 11997 .byte "Bad S1 count" 11998 cl 11999 .byte a_esc,"T" 12000 rb 12001 .byte a_bel 12002 .byte 0 12003 ; 12004 lr_rtl cr 12005 .byte a_cr 12006 cl 12007 .byte a_esc,"T" 12008 .byte "Ready: " 12009 cn 12010 .byte a_esc,"`1" 12011 .byte 0 12012 ; 12013 lr_type lf 12014 cr 12015 .byte a_cr 12016 .byte a_lf 12017 .byte "Invalid record" 12018 cl 12019 .byte a_esc,"T" 12020 rb 12021 .byte a_bel 12022 .byte 0 12023 ; 12024 .end 12025 ;================================================================================ 12026 ; 12027 ;MPU VECTOR TABLE COLLISION CHECK 12028 ; 12029 F19C _txtend_ =* 12030 ; 12031 .if _txtend_ > mm_mpuv 12032 00F19C FF FF FF FF 12033 00F1A0 FF FF FF FF 12034 00F1A4 FF FF FF FF 12035 00F1A8 FF FF FF FF 12036 00F1AC FF FF FF FF 12037 00F1B0 FF FF FF FF 12038 00F1B4 FF FF FF FF 12039 00F1B8 FF FF FF FF 12040 00F1BC FF FF FF FF 12041 00F1C0 FF FF FF FF 12042 00F1C4 FF FF FF FF 12043 00F1C8 FF FF FF FF 12044 00F1CC FF FF FF FF 12045 00F1D0 FF FF FF FF 12046 00F1D4 FF FF FF FF 12047 00F1D8 FF FF FF FF 12048 00F1DC FF FF FF FF 12049 00F1E0 FF FF FF FF 12050 00F1E4 FF FF FF FF 12051 00F1E8 FF FF FF FF 12052 00F1EC FF FF FF FF 12053 00F1F0 FF FF FF FF 12054 00F1F4 FF FF FF FF 12055 00F1F8 FF FF FF FF 12056 00F1FC FF FF FF FF 12057 00F200 FF FF FF FF 12058 00F204 FF FF FF FF 12059 00F208 FF FF FF FF 12060 00F20C FF FF FF FF 12061 00F210 FF FF FF FF 12062 00F214 FF FF FF FF 12063 00F218 FF FF FF FF 12064 00F21C FF FF FF FF 12065 00F220 FF FF FF FF 12066 00F224 FF FF FF FF 12067 00F228 FF FF FF FF 12068 00F22C FF FF FF FF 12069 00F230 FF FF FF FF 12070 00F234 FF FF FF FF 12071 00F238 FF FF FF FF 12072 00F23C FF FF FF FF 12073 00F240 FF FF FF FF 12074 00F244 FF FF FF FF 12075 00F248 FF FF FF FF 12076 00F24C FF FF FF FF 12077 00F250 FF FF FF FF 12078 00F254 FF FF FF FF 12079 00F258 FF FF FF FF 12080 00F25C FF FF FF FF 12081 00F260 FF FF FF FF 12082 00F264 FF FF FF FF 12083 00F268 FF FF FF FF 12084 00F26C FF FF FF FF 12085 00F270 FF FF FF FF 12086 00F274 FF FF FF FF 12087 00F278 FF FF FF FF 12088 00F27C FF FF FF FF 12089 00F280 FF FF FF FF 12090 00F284 FF FF FF FF 12091 00F288 FF FF FF FF 12092 00F28C FF FF FF FF 12093 00F290 FF FF FF FF 12094 00F294 FF FF FF FF 12095 00F298 FF FF FF FF 12096 00F29C FF FF FF FF 12097 00F2A0 FF FF FF FF 12098 00F2A4 FF FF FF FF 12099 00F2A8 FF FF FF FF 12100 00F2AC FF FF FF FF 12101 00F2B0 FF FF FF FF 12102 00F2B4 FF FF FF FF 12103 00F2B8 FF FF FF FF 12104 00F2BC FF FF FF FF 12105 00F2C0 FF FF FF FF 12106 00F2C4 FF FF FF FF 12107 00F2C8 FF FF FF FF 12108 00F2CC FF FF FF FF 12109 00F2D0 FF FF FF FF 12110 00F2D4 FF FF FF FF 12111 00F2D8 FF FF FF FF 12112 00F2DC FF FF FF FF 12113 00F2E0 FF FF FF FF 12114 00F2E4 FF FF FF FF 12115 00F2E8 FF FF FF FF 12116 00F2EC FF FF FF FF 12117 00F2F0 FF FF FF FF 12118 00F2F4 FF FF FF FF 12119 00F2F8 FF FF FF FF 12120 00F2FC FF FF FF FF 12121 00F300 FF FF FF FF 12122 00F304 FF FF FF FF 12123 00F308 FF FF FF FF 12124 00F30C FF FF FF FF 12125 00F310 FF FF FF FF 12126 00F314 FF FF FF FF 12127 00F318 FF FF FF FF 12128 00F31C FF FF FF FF 12129 00F320 FF FF FF FF 12130 00F324 FF FF FF FF 12131 00F328 FF FF FF FF 12132 00F32C FF FF FF FF 12133 00F330 FF FF FF FF 12134 00F334 FF FF FF FF 12135 00F338 FF FF FF FF 12136 00F33C FF FF FF FF 12137 00F340 FF FF FF FF 12138 00F344 FF FF FF FF 12139 00F348 FF FF FF FF 12140 00F34C FF FF FF FF 12141 00F350 FF FF FF FF 12142 00F354 FF FF FF FF 12143 00F358 FF FF FF FF 12144 00F35C FF FF FF FF 12145 00F360 FF FF FF FF 12146 00F364 FF FF FF FF 12147 00F368 FF FF FF FF 12148 00F36C FF FF FF FF 12149 00F370 FF FF FF FF 12150 00F374 FF FF FF FF 12151 00F378 FF FF FF FF 12152 00F37C FF FF FF FF 12153 00F380 FF FF FF FF 12154 00F384 FF FF FF FF 12155 00F388 FF FF FF FF 12156 00F38C FF FF FF FF 12157 00F390 FF FF FF FF 12158 00F394 FF FF FF FF 12159 00F398 FF FF FF FF 12160 00F39C FF FF FF FF 12161 00F3A0 FF FF FF FF 12162 00F3A4 FF FF FF FF 12163 00F3A8 FF FF FF FF 12164 00F3AC FF FF FF FF 12165 00F3B0 FF FF FF FF 12166 00F3B4 FF FF FF FF 12167 00F3B8 FF FF FF FF 12168 00F3BC FF FF FF FF 12169 00F3C0 FF FF FF FF 12170 00F3C4 FF FF FF FF 12171 00F3C8 FF FF FF FF 12172 00F3CC FF FF FF FF 12173 00F3D0 FF FF FF FF 12174 00F3D4 FF FF FF FF 12175 00F3D8 FF FF FF FF 12176 00F3DC FF FF FF FF 12177 00F3E0 FF FF FF FF 12178 00F3E4 FF FF FF FF 12179 00F3E8 FF FF FF FF 12180 00F3EC FF FF FF FF 12181 00F3F0 FF FF FF FF 12182 00F3F4 FF FF FF FF 12183 00F3F8 FF FF FF FF 12184 00F3FC FF FF FF FF 12185 00F400 FF FF FF FF 12186 00F404 FF FF FF FF 12187 00F408 FF FF FF FF 12188 00F40C FF FF FF FF 12189 00F410 FF FF FF FF 12190 00F414 FF FF FF FF 12191 00F418 FF FF FF FF 12192 00F41C FF FF FF FF 12193 00F420 FF FF FF FF 12194 00F424 FF FF FF FF 12195 00F428 FF FF FF FF 12196 00F42C FF FF FF FF 12197 00F430 FF FF FF FF 12198 00F434 FF FF FF FF 12199 00F438 FF FF FF FF 12200 00F43C FF FF FF FF 12201 00F440 FF FF FF FF 12202 00F444 FF FF FF FF 12203 00F448 FF FF FF FF 12204 00F44C FF FF FF FF 12205 00F450 FF FF FF FF 12206 00F454 FF FF FF FF 12207 00F458 FF FF FF FF 12208 00F45C FF FF FF FF 12209 00F460 FF FF FF FF 12210 00F464 FF FF FF FF 12211 00F468 FF FF FF FF 12212 00F46C FF FF FF FF 12213 00F470 FF FF FF FF 12214 00F474 FF FF FF FF 12215 00F478 FF FF FF FF 12216 00F47C FF FF FF FF 12217 00F480 FF FF FF FF 12218 00F484 FF FF FF FF 12219 00F488 FF FF FF FF 12220 00F48C FF FF FF FF 12221 00F490 FF FF FF FF 12222 00F494 FF FF FF FF 12223 00F498 FF FF FF FF 12224 00F49C FF FF FF FF 12225 00F4A0 FF FF FF FF 12226 00F4A4 FF FF FF FF 12227 00F4A8 FF FF FF FF 12228 00F4AC FF FF FF FF 12229 00F4B0 FF FF FF FF 12230 00F4B4 FF FF FF FF 12231 00F4B8 FF FF FF FF 12232 00F4BC FF FF FF FF 12233 00F4C0 FF FF FF FF 12234 00F4C4 FF FF FF FF 12235 00F4C8 FF FF FF FF 12236 00F4CC FF FF FF FF 12237 00F4D0 FF FF FF FF 12238 00F4D4 FF FF FF FF 12239 00F4D8 FF FF FF FF 12240 00F4DC FF FF FF FF 12241 00F4E0 FF FF FF FF 12242 00F4E4 FF FF FF FF 12243 00F4E8 FF FF FF FF 12244 00F4EC FF FF FF FF 12245 00F4F0 FF FF FF FF 12246 00F4F4 FF FF FF FF 12247 00F4F8 FF FF FF FF 12248 00F4FC FF FF FF FF 12249 00F500 FF FF FF FF 12250 00F504 FF FF FF FF 12251 00F508 FF FF FF FF 12252 00F50C FF FF FF FF 12253 00F510 FF FF FF FF 12254 00F514 FF FF FF FF 12255 00F518 FF FF FF FF 12256 00F51C FF FF FF FF 12257 00F520 FF FF FF FF 12258 00F524 FF FF FF FF 12259 00F528 FF FF FF FF 12260 00F52C FF FF FF FF 12261 00F530 FF FF FF FF 12262 00F534 FF FF FF FF 12263 00F538 FF FF FF FF 12264 00F53C FF FF FF FF 12265 00F540 FF FF FF FF 12266 00F544 FF FF FF FF 12267 00F548 FF FF FF FF 12268 00F54C FF FF FF FF 12269 00F550 FF FF FF FF 12270 00F554 FF FF FF FF 12271 00F558 FF FF FF FF 12272 00F55C FF FF FF FF 12273 00F560 FF FF FF FF 12274 00F564 FF FF FF FF 12275 00F568 FF FF FF FF 12276 00F56C FF FF FF FF 12277 00F570 FF FF FF FF 12278 00F574 FF FF FF FF 12279 00F578 FF FF FF FF 12280 00F57C FF FF FF FF 12281 00F580 FF FF FF FF 12282 00F584 FF FF FF FF 12283 00F588 FF FF FF FF 12284 00F58C FF FF FF FF 12285 00F590 FF FF FF FF 12286 00F594 FF FF FF FF 12287 00F598 FF FF FF FF 12288 00F59C FF FF FF FF 12289 00F5A0 FF FF FF FF 12290 00F5A4 FF FF FF FF 12291 00F5A8 FF FF FF FF 12292 00F5AC FF FF FF FF 12293 00F5B0 FF FF FF FF 12294 00F5B4 FF FF FF FF 12295 00F5B8 FF FF FF FF 12296 00F5BC FF FF FF FF 12297 00F5C0 FF FF FF FF 12298 00F5C4 FF FF FF FF 12299 00F5C8 FF FF FF FF 12300 00F5CC FF FF FF FF 12301 00F5D0 FF FF FF FF 12302 00F5D4 FF FF FF FF 12303 00F5D8 FF FF FF FF 12304 00F5DC FF FF FF FF 12305 00F5E0 FF FF FF FF 12306 00F5E4 FF FF FF FF 12307 00F5E8 FF FF FF FF 12308 00F5EC FF FF FF FF 12309 00F5F0 FF FF FF FF 12310 00F5F4 FF FF FF FF 12311 00F5F8 FF FF FF FF 12312 00F5FC FF FF FF FF 12313 00F600 FF FF FF FF 12314 00F604 FF FF FF FF 12315 00F608 FF FF FF FF 12316 00F60C FF FF FF FF 12317 00F610 FF FF FF FF 12318 00F614 FF FF FF FF 12319 00F618 FF FF FF FF 12320 00F61C FF FF FF FF 12321 00F620 FF FF FF FF 12322 00F624 FF FF FF FF 12323 00F628 FF FF FF FF 12324 00F62C FF FF FF FF 12325 00F630 FF FF FF FF 12326 00F634 FF FF FF FF 12327 00F638 FF FF FF FF 12328 00F63C FF FF FF FF 12329 00F640 FF FF FF FF 12330 00F644 FF FF FF FF 12331 00F648 FF FF FF FF 12332 00F64C FF FF FF FF 12333 00F650 FF FF FF FF 12334 00F654 FF FF FF FF 12335 00F658 FF FF FF FF 12336 00F65C FF FF FF FF 12337 00F660 FF FF FF FF 12338 00F664 FF FF FF FF 12339 00F668 FF FF FF FF 12340 00F66C FF FF FF FF 12341 00F670 FF FF FF FF 12342 00F674 FF FF FF FF 12343 00F678 FF FF FF FF 12344 00F67C FF FF FF FF 12345 00F680 FF FF FF FF 12346 00F684 FF FF FF FF 12347 00F688 FF FF FF FF 12348 00F68C FF FF FF FF 12349 00F690 FF FF FF FF 12350 00F694 FF FF FF FF 12351 00F698 FF FF FF FF 12352 00F69C FF FF FF FF 12353 00F6A0 FF FF FF FF 12354 00F6A4 FF FF FF FF 12355 00F6A8 FF FF FF FF 12356 00F6AC FF FF FF FF 12357 00F6B0 FF FF FF FF 12358 00F6B4 FF FF FF FF 12359 00F6B8 FF FF FF FF 12360 00F6BC FF FF FF FF 12361 00F6C0 FF FF FF FF 12362 00F6C4 FF FF FF FF 12363 00F6C8 FF FF FF FF 12364 00F6CC FF FF FF FF 12365 00F6D0 FF FF FF FF 12366 00F6D4 FF FF FF FF 12367 00F6D8 FF FF FF FF 12368 00F6DC FF FF FF FF 12369 00F6E0 FF FF FF FF 12370 00F6E4 FF FF FF FF 12371 00F6E8 FF FF FF FF 12372 00F6EC FF FF FF FF 12373 00F6F0 FF FF FF FF 12374 00F6F4 FF FF FF FF 12375 00F6F8 FF FF FF FF 12376 00F6FC FF FF FF FF 12377 00F700 FF FF FF FF 12378 00F704 FF FF FF FF 12379 00F708 FF FF FF FF 12380 00F70C FF FF FF FF 12381 00F710 FF FF FF FF 12382 00F714 FF FF FF FF 12383 00F718 FF FF FF FF 12384 00F71C FF FF FF FF 12385 00F720 FF FF FF FF 12386 00F724 FF FF FF FF 12387 00F728 FF FF FF FF 12388 00F72C FF FF FF FF 12389 00F730 FF FF FF FF 12390 00F734 FF FF FF FF 12391 00F738 FF FF FF FF 12392 00F73C FF FF FF FF 12393 00F740 FF FF FF FF 12394 00F744 FF FF FF FF 12395 00F748 FF FF FF FF 12396 00F74C FF FF FF FF 12397 00F750 FF FF FF FF 12398 00F754 FF FF FF FF 12399 00F758 FF FF FF FF 12400 00F75C FF FF FF FF 12401 00F760 FF FF FF FF 12402 00F764 FF FF FF FF 12403 00F768 FF FF FF FF 12404 00F76C FF FF FF FF 12405 00F770 FF FF FF FF 12406 00F774 FF FF FF FF 12407 00F778 FF FF FF FF 12408 00F77C FF FF FF FF 12409 00F780 FF FF FF FF 12410 00F784 FF FF FF FF 12411 00F788 FF FF FF FF 12412 00F78C FF FF FF FF 12413 00F790 FF FF FF FF 12414 00F794 FF FF FF FF 12415 00F798 FF FF FF FF 12416 00F79C FF FF FF FF 12417 00F7A0 FF FF FF FF 12418 00F7A4 FF FF FF FF 12419 00F7A8 FF FF FF FF 12420 00F7AC FF FF FF FF 12421 00F7B0 FF FF FF FF 12422 00F7B4 FF FF FF FF 12423 00F7B8 FF FF FF FF 12424 00F7BC FF FF FF FF 12425 00F7C0 FF FF FF FF 12426 00F7C4 FF FF FF FF 12427 00F7C8 FF FF FF FF 12428 00F7CC FF FF FF FF 12429 00F7D0 FF FF FF FF 12430 00F7D4 FF FF FF FF 12431 00F7D8 FF FF FF FF 12432 00F7DC FF FF FF FF 12433 00F7E0 FF FF FF FF 12434 00F7E4 FF FF FF FF 12435 00F7E8 FF FF FF FF 12436 00F7EC FF FF FF FF 12437 00F7F0 FF FF FF FF 12438 00F7F4 FF FF FF FF 12439 00F7F8 FF FF FF FF 12440 00F7FC FF FF FF FF 12441 00F800 FF FF FF FF 12442 00F804 FF FF FF FF 12443 00F808 FF FF FF FF 12444 00F80C FF FF FF FF 12445 00F810 FF FF FF FF 12446 00F814 FF FF FF FF 12447 00F818 FF FF FF FF 12448 00F81C FF FF FF FF 12449 00F820 FF FF FF FF 12450 00F824 FF FF FF FF 12451 00F828 FF FF FF FF 12452 00F82C FF FF FF FF 12453 00F830 FF FF FF FF 12454 00F834 FF FF FF FF 12455 00F838 FF FF FF FF 12456 00F83C FF FF FF FF 12457 00F840 FF FF FF FF 12458 00F844 FF FF FF FF 12459 00F848 FF FF FF FF 12460 00F84C FF FF FF FF 12461 00F850 FF FF FF FF 12462 00F854 FF FF FF FF 12463 00F858 FF FF FF FF 12464 00F85C FF FF FF FF 12465 00F860 FF FF FF FF 12466 00F864 FF FF FF FF 12467 00F868 FF FF FF FF 12468 00F86C FF FF FF FF 12469 00F870 FF FF FF FF 12470 00F874 FF FF FF FF 12471 00F878 FF FF FF FF 12472 00F87C FF FF FF FF 12473 00F880 FF FF FF FF 12474 00F884 FF FF FF FF 12475 00F888 FF FF FF FF 12476 00F88C FF FF FF FF 12477 00F890 FF FF FF FF 12478 00F894 FF FF FF FF 12479 00F898 FF FF FF FF 12480 00F89C FF FF FF FF 12481 00F8A0 FF FF FF FF 12482 00F8A4 FF FF FF FF 12483 00F8A8 FF FF FF FF 12484 00F8AC FF FF FF FF 12485 00F8B0 FF FF FF FF 12486 00F8B4 FF FF FF FF 12487 00F8B8 FF FF FF FF 12488 00F8BC FF FF FF FF 12489 00F8C0 FF FF FF FF 12490 00F8C4 FF FF FF FF 12491 00F8C8 FF FF FF FF 12492 00F8CC FF FF FF FF 12493 00F8D0 FF FF FF FF 12494 00F8D4 FF FF FF FF 12495 00F8D8 FF FF FF FF 12496 00F8DC FF FF FF FF 12497 00F8E0 FF FF FF FF 12498 00F8E4 FF FF FF FF 12499 00F8E8 FF FF FF FF 12500 00F8EC FF FF FF FF 12501 00F8F0 FF FF FF FF 12502 00F8F4 FF FF FF FF 12503 00F8F8 FF FF FF FF 12504 00F8FC FF FF FF FF 12505 00F900 FF FF FF FF 12506 00F904 FF FF FF FF 12507 00F908 FF FF FF FF 12508 00F90C FF FF FF FF 12509 00F910 FF FF FF FF 12510 00F914 FF FF FF FF 12511 00F918 FF FF FF FF 12512 00F91C FF FF FF FF 12513 00F920 FF FF FF FF 12514 00F924 FF FF FF FF 12515 00F928 FF FF FF FF 12516 00F92C FF FF FF FF 12517 00F930 FF FF FF FF 12518 00F934 FF FF FF FF 12519 00F938 FF FF FF FF 12520 00F93C FF FF FF FF 12521 00F940 FF FF FF FF 12522 00F944 FF FF FF FF 12523 00F948 FF FF FF FF 12524 00F94C FF FF FF FF 12525 00F950 FF FF FF FF 12526 00F954 FF FF FF FF 12527 00F958 FF FF FF FF 12528 00F95C FF FF FF FF 12529 00F960 FF FF FF FF 12530 00F964 FF FF FF FF 12531 00F968 FF FF FF FF 12532 00F96C FF FF FF FF 12533 00F970 FF FF FF FF 12534 00F974 FF FF FF FF 12535 00F978 FF FF FF FF 12536 00F97C FF FF FF FF 12537 00F980 FF FF FF FF 12538 00F984 FF FF FF FF 12539 00F988 FF FF FF FF 12540 00F98C FF FF FF FF 12541 00F990 FF FF FF FF 12542 00F994 FF FF FF FF 12543 00F998 FF FF FF FF 12544 00F99C FF FF FF FF 12545 00F9A0 FF FF FF FF 12546 00F9A4 FF FF FF FF 12547 00F9A8 FF FF FF FF 12548 00F9AC FF FF FF FF 12549 00F9B0 FF FF FF FF 12550 00F9B4 FF FF FF FF 12551 00F9B8 FF FF FF FF 12552 00F9BC FF FF FF FF 12553 00F9C0 FF FF FF FF 12554 00F9C4 FF FF FF FF 12555 00F9C8 FF FF FF FF 12556 00F9CC FF FF FF FF 12557 00F9D0 FF FF FF FF 12558 00F9D4 FF FF FF FF 12559 00F9D8 FF FF FF FF 12560 00F9DC FF FF FF FF 12561 00F9E0 FF FF FF FF 12562 00F9E4 FF FF FF FF 12563 00F9E8 FF FF FF FF 12564 00F9EC FF FF FF FF 12565 00F9F0 FF FF FF FF 12566 00F9F4 FF FF FF FF 12567 00F9F8 FF FF FF FF 12568 00F9FC FF FF FF FF 12569 00FA00 FF FF FF FF 12570 00FA04 FF FF FF FF 12571 00FA08 FF FF FF FF 12572 00FA0C FF FF FF FF 12573 00FA10 FF FF FF FF 12574 00FA14 FF FF FF FF 12575 00FA18 FF FF FF FF 12576 00FA1C FF FF FF FF 12577 00FA20 FF FF FF FF 12578 00FA24 FF FF FF FF 12579 00FA28 FF FF FF FF 12580 00FA2C FF FF FF FF 12581 00FA30 FF FF FF FF 12582 00FA34 FF FF FF FF 12583 00FA38 FF FF FF FF 12584 00FA3C FF FF FF FF 12585 00FA40 FF FF FF FF 12586 00FA44 FF FF FF FF 12587 00FA48 FF FF FF FF 12588 00FA4C FF FF FF FF 12589 00FA50 FF FF FF FF 12590 00FA54 FF FF FF FF 12591 00FA58 FF FF FF FF 12592 00FA5C FF FF FF FF 12593 00FA60 FF FF FF FF 12594 00FA64 FF FF FF FF 12595 00FA68 FF FF FF FF 12596 00FA6C FF FF FF FF 12597 00FA70 FF FF FF FF 12598 00FA74 FF FF FF FF 12599 00FA78 FF FF FF FF 12600 00FA7C FF FF FF FF 12601 00FA80 FF FF FF FF 12602 00FA84 FF FF FF FF 12603 00FA88 FF FF FF FF 12604 00FA8C FF FF FF FF 12605 00FA90 FF FF FF FF 12606 00FA94 FF FF FF FF 12607 00FA98 FF FF FF FF 12608 00FA9C FF FF FF FF 12609 00FAA0 FF FF FF FF 12610 00FAA4 FF FF FF FF 12611 00FAA8 FF FF FF FF 12612 00FAAC FF FF FF FF 12613 00FAB0 FF FF FF FF 12614 00FAB4 FF FF FF FF 12615 00FAB8 FF FF FF FF 12616 00FABC FF FF FF FF 12617 00FAC0 FF FF FF FF 12618 00FAC4 FF FF FF FF 12619 00FAC8 FF FF FF FF 12620 00FACC FF FF FF FF 12621 00FAD0 FF FF FF FF 12622 00FAD4 FF FF FF FF 12623 00FAD8 FF FF FF FF 12624 00FADC FF FF FF FF 12625 00FAE0 FF FF FF FF 12626 00FAE4 FF FF FF FF 12627 00FAE8 FF FF FF FF 12628 00FAEC FF FF FF FF 12629 00FAF0 FF FF FF FF 12630 00FAF4 FF FF FF FF 12631 00FAF8 FF FF FF FF 12632 00FAFC FF FF FF FF 12633 00FB00 FF FF FF FF 12634 00FB04 FF FF FF FF 12635 00FB08 FF FF FF FF 12636 00FB0C FF FF FF FF 12637 00FB10 FF FF FF FF 12638 00FB14 FF FF FF FF 12639 00FB18 FF FF FF FF 12640 00FB1C FF FF FF FF 12641 00FB20 FF FF FF FF 12642 00FB24 FF FF FF FF 12643 00FB28 FF FF FF FF 12644 00FB2C FF FF FF FF 12645 00FB30 FF FF FF FF 12646 00FB34 FF FF FF FF 12647 00FB38 FF FF FF FF 12648 00FB3C FF FF FF FF 12649 00FB40 FF FF FF FF 12650 00FB44 FF FF FF FF 12651 00FB48 FF FF FF FF 12652 00FB4C FF FF FF FF 12653 00FB50 FF FF FF FF 12654 00FB54 FF FF FF FF 12655 00FB58 FF FF FF FF 12656 00FB5C FF FF FF FF 12657 00FB60 FF FF FF FF 12658 00FB64 FF FF FF FF 12659 00FB68 FF FF FF FF 12660 00FB6C FF FF FF FF 12661 00FB70 FF FF FF FF 12662 00FB74 FF FF FF FF 12663 00FB78 FF FF FF FF 12664 00FB7C FF FF FF FF 12665 00FB80 FF FF FF FF 12666 00FB84 FF FF FF FF 12667 00FB88 FF FF FF FF 12668 00FB8C FF FF FF FF 12669 00FB90 FF FF FF FF 12670 00FB94 FF FF FF FF 12671 00FB98 FF FF FF FF 12672 00FB9C FF FF FF FF 12673 00FBA0 FF FF FF FF 12674 00FBA4 FF FF FF FF 12675 00FBA8 FF FF FF FF 12676 00FBAC FF FF FF FF 12677 00FBB0 FF FF FF FF 12678 00FBB4 FF FF FF FF 12679 00FBB8 FF FF FF FF 12680 00FBBC FF FF FF FF 12681 00FBC0 FF FF FF FF 12682 00FBC4 FF FF FF FF 12683 00FBC8 FF FF FF FF 12684 00FBCC FF FF FF FF 12685 00FBD0 FF FF FF FF 12686 00FBD4 FF FF FF FF 12687 00FBD8 FF FF FF FF 12688 00FBDC FF FF FF FF 12689 00FBE0 FF FF FF FF 12690 00FBE4 FF FF FF FF 12691 00FBE8 FF FF FF FF 12692 00FBEC FF FF FF FF 12693 00FBF0 FF FF FF FF 12694 00FBF4 FF FF FF FF 12695 00FBF8 FF FF FF FF 12696 00FBFC FF FF FF FF 12697 00FC00 FF FF FF FF 12698 00FC04 FF FF FF FF 12699 00FC08 FF FF FF FF 12700 00FC0C FF FF FF FF 12701 00FC10 FF FF FF FF 12702 00FC14 FF FF FF FF 12703 00FC18 FF FF FF FF 12704 00FC1C FF FF FF FF 12705 00FC20 FF FF FF FF 12706 00FC24 FF FF FF FF 12707 00FC28 FF FF FF FF 12708 00FC2C FF FF FF FF 12709 00FC30 FF FF FF FF 12710 00FC34 FF FF FF FF 12711 00FC38 FF FF FF FF 12712 00FC3C FF FF FF FF 12713 00FC40 FF FF FF FF 12714 00FC44 FF FF FF FF 12715 00FC48 FF FF FF FF 12716 00FC4C FF FF FF FF 12717 00FC50 FF FF FF FF 12718 00FC54 FF FF FF FF 12719 00FC58 FF FF FF FF 12720 00FC5C FF FF FF FF 12721 00FC60 FF FF FF FF 12722 00FC64 FF FF FF FF 12723 00FC68 FF FF FF FF 12724 00FC6C FF FF FF FF 12725 00FC70 FF FF FF FF 12726 00FC74 FF FF FF FF 12727 00FC78 FF FF FF FF 12728 00FC7C FF FF FF FF 12729 00FC80 FF FF FF FF 12730 00FC84 FF FF FF FF 12731 00FC88 FF FF FF FF 12732 00FC8C FF FF FF FF 12733 00FC90 FF FF FF FF 12734 00FC94 FF FF FF FF 12735 00FC98 FF FF FF FF 12736 00FC9C FF FF FF FF 12737 00FCA0 FF FF FF FF 12738 00FCA4 FF FF FF FF 12739 00FCA8 FF FF FF FF 12740 00FCAC FF FF FF FF 12741 00FCB0 FF FF FF FF 12742 00FCB4 FF FF FF FF 12743 00FCB8 FF FF FF FF 12744 00FCBC FF FF FF FF 12745 00FCC0 FF FF FF FF 12746 00FCC4 FF FF FF FF 12747 00FCC8 FF FF FF FF 12748 00FCCC FF FF FF FF 12749 00FCD0 FF FF FF FF 12750 00FCD4 FF FF FF FF 12751 00FCD8 FF FF FF FF 12752 00FCDC FF FF FF FF 12753 00FCE0 FF FF FF FF 12754 00FCE4 FF FF FF FF 12755 00FCE8 FF FF FF FF 12756 00FCEC FF FF FF FF 12757 00FCF0 FF FF FF FF 12758 00FCF4 FF FF FF FF 12759 00FCF8 FF FF FF FF 12760 00FCFC FF FF FF FF 12761 00FD00 FF FF FF FF 12762 00FD04 FF FF FF FF 12763 00FD08 FF FF FF FF 12764 00FD0C FF FF FF FF 12765 00FD10 FF FF FF FF 12766 00FD14 FF FF FF FF 12767 00FD18 FF FF FF FF 12768 00FD1C FF FF FF FF 12769 00FD20 FF FF FF FF 12770 00FD24 FF FF FF FF 12771 00FD28 FF FF FF FF 12772 00FD2C FF FF FF FF 12773 00FD30 FF FF FF FF 12774 00FD34 FF FF FF FF 12775 00FD38 FF FF FF FF 12776 00FD3C FF FF FF FF 12777 00FD40 FF FF FF FF 12778 00FD44 FF FF FF FF 12779 00FD48 FF FF FF FF 12780 00FD4C FF FF FF FF 12781 00FD50 FF FF FF FF 12782 00FD54 FF FF FF FF 12783 00FD58 FF FF FF FF 12784 00FD5C FF FF FF FF 12785 00FD60 FF FF FF FF 12786 00FD64 FF FF FF FF 12787 00FD68 FF FF FF FF 12788 00FD6C FF FF FF FF 12789 00FD70 FF FF FF FF 12790 00FD74 FF FF FF FF 12791 00FD78 FF FF FF FF 12792 00FD7C FF FF FF FF 12793 00FD80 FF FF FF FF 12794 00FD84 FF FF FF FF 12795 00FD88 FF FF FF FF 12796 00FD8C FF FF FF FF 12797 00FD90 FF FF FF FF 12798 00FD94 FF FF FF FF 12799 00FD98 FF FF FF FF 12800 00FD9C FF FF FF FF 12801 00FDA0 FF FF FF FF 12802 00FDA4 FF FF FF FF 12803 00FDA8 FF FF FF FF 12804 00FDAC FF FF FF FF 12805 00FDB0 FF FF FF FF 12806 00FDB4 FF FF FF FF 12807 00FDB8 FF FF FF FF 12808 00FDBC FF FF FF FF 12809 00FDC0 FF FF FF FF 12810 00FDC4 FF FF FF FF 12811 00FDC8 FF FF FF FF 12812 00FDCC FF FF FF FF 12813 00FDD0 FF FF FF FF 12814 00FDD4 FF FF FF FF 12815 00FDD8 FF FF FF FF 12816 00FDDC FF FF FF FF 12817 00FDE0 FF FF FF FF 12818 00FDE4 FF FF FF FF 12819 00FDE8 FF FF FF FF 12820 00FDEC FF FF FF FF 12821 00FDF0 FF FF FF FF 12822 00FDF4 FF FF FF FF 12823 00FDF8 FF FF FF FF 12824 00FDFC FF FF FF FF 12825 00FE00 FF FF FF FF 12826 00FE04 FF FF FF FF 12827 00FE08 FF FF FF FF 12828 00FE0C FF FF FF FF 12829 00FE10 FF FF FF FF 12830 00FE14 FF FF FF FF 12831 00FE18 FF FF FF FF 12832 00FE1C FF FF FF FF 12833 00FE20 FF FF FF FF 12834 00FE24 FF FF FF FF 12835 00FE28 FF FF FF FF 12836 00FE2C FF FF FF FF 12837 00FE30 FF FF FF FF 12838 00FE34 FF FF FF FF 12839 00FE38 FF FF FF FF 12840 00FE3C FF FF FF FF 12841 00FE40 FF FF FF FF 12842 00FE44 FF FF FF FF 12843 00FE48 FF FF FF FF 12844 00FE4C FF FF FF FF 12845 00FE50 FF FF FF FF 12846 00FE54 FF FF FF FF 12847 00FE58 FF FF FF FF 12848 00FE5C FF FF FF FF 12849 00FE60 FF FF FF FF 12850 00FE64 FF FF FF FF 12851 00FE68 FF FF FF FF 12852 00FE6C FF FF FF FF 12853 00FE70 FF FF FF FF 12854 00FE74 FF FF FF FF 12855 00FE78 FF FF FF FF 12856 00FE7C FF FF FF FF 12857 00FE80 FF FF FF FF 12858 00FE84 FF FF FF FF 12859 00FE88 FF FF FF FF 12860 00FE8C FF FF FF FF 12861 00FE90 FF FF FF FF 12862 00FE94 FF FF FF FF 12863 00FE98 FF FF FF FF 12864 00FE9C FF FF FF FF 12865 00FEA0 FF FF FF FF 12866 00FEA4 FF FF FF FF 12867 00FEA8 FF FF FF FF 12868 00FEAC FF FF FF FF 12869 00FEB0 FF FF FF FF 12870 00FEB4 FF FF FF FF 12871 00FEB8 FF FF FF FF 12872 00FEBC FF FF FF FF 12873 00FEC0 FF FF FF FF 12874 00FEC4 FF FF FF FF 12875 00FEC8 FF FF FF FF 12876 00FECC FF FF FF FF 12877 00FED0 FF FF FF FF 12878 00FED4 FF FF FF FF 12879 00FED8 FF FF FF FF 12880 00FEDC FF FF FF FF 12881 00FEE0 FF FF FF FF 12882 00FEE4 FF FF FF FF 12883 00FEE8 FF FF FF FF 12884 00FEEC FF FF FF FF 12885 00FEF0 FF FF FF FF 12886 00FEF4 FF FF FF FF 12887 00FEF8 FF FF FF FF 12888 00FEFC FF FF FF FF 12889 00FF00 FF FF FF FF 12890 00FF04 FF FF FF FF 12891 00FF08 FF FF FF FF 12892 00FF0C FF FF FF FF 12893 00FF10 FF FF FF FF 12894 00FF14 FF FF FF FF 12895 00FF18 FF FF FF FF 12896 00FF1C FF FF FF FF 12897 00FF20 FF FF FF FF 12898 00FF24 FF FF FF FF 12899 00FF28 FF FF FF FF 12900 00FF2C FF FF FF FF 12901 00FF30 FF FF FF FF 12902 00FF34 FF FF FF FF 12903 00FF38 FF FF FF FF 12904 00FF3C FF FF FF FF 12905 00FF40 FF FF FF FF 12906 00FF44 FF FF FF FF 12907 00FF48 FF FF FF FF 12908 00FF4C FF FF FF FF 12909 00FF50 FF FF FF FF 12910 00FF54 FF FF FF FF 12911 00FF58 FF FF FF FF 12912 00FF5C FF FF FF FF 12913 00FF60 FF FF FF FF 12914 00FF64 FF FF FF FF 12915 00FF68 FF FF FF FF 12916 00FF6C FF FF FF FF 12917 00FF70 FF FF FF FF 12918 00FF74 FF FF FF FF 12919 00FF78 FF FF FF FF 12920 00FF7C FF FF FF FF 12921 00FF80 FF FF FF FF 12922 00FF84 FF FF FF FF 12923 00FF88 FF FF FF FF 12924 00FF8C FF FF FF FF 12925 00FF90 FF FF FF FF 12926 00FF94 FF FF FF FF 12927 00FF98 FF FF FF FF 12928 00FF9C FF FF FF FF 12929 00FFA0 FF FF FF FF 12930 00FFA4 FF FF FF FF 12931 00FFA8 FF FF FF FF 12932 00FFAC FF FF FF FF 12933 00FFB0 FF FF FF FF 12934 00FFB4 FF FF FF FF 12935 00FFB8 FF FF FF FF 12936 00FFBC FF FF FF FF 12937 00FFC0 FF FF FF FF 12938 00FFC4 FF FF FF FF 12939 00FFC8 FF FF FF FF 12940 00FFCC FF FF FF FF 12941 00FFD0 FF FF FF FF 12942 00FFD4 FF FF FF FF 12943 00FFD8 FF FF FF FF 12944 00FFDC FF FF FF FF 12945 .dcb mm_mpuv-_txtend_,$ff 12946 .endif 12947 ; 12948 ;================================================================================ 12949 ; 12950 ;MPU VECTOR TABLE 12951 ; 12952 .word $ffff ;undefined 12953 .word $ffff ;undefined 12954 v_icop .word icop ;coprocessor interrupt 12955 v_ibrk .word ibrk ;software interrupt request 12956 v_iabort .word iabort ;abort interrupt 12957 v_inmi .word inmi ;non-maskable interrupt 12958 .word $ffff ;undefined 12959 v_iirq .word iirq ;hardware interrupt request 12960 ; 12961 ; 12962 ; 65C02 emulation mode vectors... 12963 ; 12964 .word $ffff ;undefined 12965 .word $ffff ;undefined 12966 .word $ffff ;undefined 12967 .word $ffff ;undefined 12968 .word $ffff ;undefined 12969 .word $ffff ;undefined 12970 v_hrst .word hrst ;hardware reset 12971 .word $ffff ;undefined 12972 ; 12973 ;================================================================================ 12974 .end