[Copyright 1999,2002 Frank Durda IV, All Rights Reserved. Mirroring of any material on this page in any form is expressly prohibited. The official web site for this material is: http://nemesis.lonestar.org Contact this address for use clearances: clearance at nemesis.lonestar.org Comments and queries to this address: web_software at nemesis.lonestar.org]
MISOSYS EDAS-4.3 04/11/99 22:08:13 SYS5 - LS-DOS 6.2 Page 00001
00001 ;SYS5/ASM - LS-DOS 6.2
00003 *LIST OFF ;Get SYS0/EQU
00319 *LIST ON
00320 ;
0000 00321 *GET SYS5A:3
00322 ;SYS5A/ASM - LS-DOS 6.2
00323 ;
00A0 00324 ORG 0A0H
00325 ;
00326 ; References to save area in lowcore
00327 ;
00A0 00328 SAVONE DS 1
00A1 00329 SAVTWO DS 1
00A2 00330 DS 1 ;Space for saved byte (1)
00A3 00331 NXTADR DS 2
00A5 00332 NXTBYT DS 1
00A6 00333 DSPADR DS 2
00A8 00334 AFREG DS 2 ;AF Register save area
00AA 00335 DS 2 ;BC
00AC 00336 DS 2 ;DE
00AE 00337 HLREG DS 2 ;HL
00B0 00338 DS 8 ;AF', BC', DE', HL'
00B8 00339 IXREG DS 2 ;IX
00BA 00340 IYREG DS 2 ;IY
00BC 00341 SPREG DS 1 ;SP
00BD 00342 REGSAV DS 1
00BE 00343 PCREG DS 2 ;PC
00344 IF @BLD631
00346 ELSE
00347 COM '<*(C) 1986,LSI>'
00348 ;
00349 ;Special patch insertion
00350 ;
00351 ORG 23BDH
00352 ;
00353 @PRTBYT PUSH AF ;Print a byte routine
00354 CALL @PRT ; to support SYS9
00355 POP AF
00356 RET
00357 ENDIF
00358 ;
1E00 00359 ORG 1E00H
00360 ;
1E00 E670 00361 SYS5 AND 70H ;If entry = 0, return
1E02 C8 00362 RET Z
1E03 F1 00363 POP AF ;Discard return to SYS0
1E04 F1 00364 POP AF ;Get original reg-AF
1E05 F5 00365 PUSH AF
1E06 FDE5 00366 PUSH IY ;Save remaining regs
1E08 DDE5 00367 PUSH IX
1E0A 08 00368 EX AF,AF'
1E0B D9 00369 EXX
1E0C E5 00370 PUSH HL
1E0D D5 00371 PUSH DE
1E0E C5 00372 PUSH BC
1E0F F5 00373 PUSH AF
1E10 08 00374 EX AF,AF'
1E11 D9 00375 EXX
1E12 E5 00376 PUSH HL
1E13 D5 00377 PUSH DE
1E14 C5 00378 PUSH BC
1E15 F5 00379 PUSH AF
1E16 210000 00380 LD HL,0
1E19 39 00381 ADD HL,SP ;Place SP address into HL
1E1A 11A800 00382 LD DE,AFREG
1E1D 011800 00383 LD BC,24 ;Move the 24 bytes saved
1E20 EDB0 00384 LDIR
1E22 22BC00 00385 LD (SPREG),HL
1E25 F9 00386 LD SP,HL
1E26 2ABE00 00387 LD HL,(PCREG)
1E29 2B 00388 DEC HL
1E2A 7E 00389 LD A,(HL) ;P/u the byte at PC
1E2B FEF7 00390 CP 0F7H ; & check for breakpoint
1E2D 2003 00391 JR NZ,$?1 ;Go if not a breakpoint
1E2F 22BE00 00392 LD (PCREG),HL
00393 ;
00394 ; This next routine picks up the data stored in the
00395 ; instruction storage areas used to hold the
00396 ; address & byte of the inserted RST's used to
00397 ; control the single step mode. If the address
00398 ; save area is zero, then an RST was not inserted.
00399 ; Two areas are needed because DEBUG inserts
00400 ; RST 48's at both CALL origin & destination.
00401 ;
1E32 21A000 00402 $?1 LD HL,SAVONE
1E35 0602 00403 LD B,2 ;Set up loop for 2 areas
1E37 AF 00404 $?2 XOR A ;Clear register A & flags
1E38 5E 00405 LD E,(HL) ;P/u the next 2 bytes
1E39 77 00406 LD (HL),A ; (where an address
1E3A 23 00407 INC HL ; would be stored) while
1E3B 56 00408 LD D,(HL) ; simultaneously setting
1E3C 77 00409 LD (HL),A ; the save area to zero
1E3D 23 00410 INC HL
1E3E 7B 00411 LD A,E ;Ck if the area was zero
1E3F B2 00412 OR D
1E40 2807 00413 JR Z,$?3 ;If zero, no RST entry
1E42 1A 00414 LD A,(DE) ;Address save <> zero,
1E43 FEF7 00415 CP 0F7H ; ck byte for RST 48
1E45 2002 00416 JR NZ,$?3
1E47 7E 00417 LD A,(HL) ; Was RST 48, restore
1E48 12 00418 LD (DE),A ; the program byte
1E49 23 00419 $?3 INC HL
1E4A 10EB 00420 DJNZ $?2 ;Loop thru 2 save areas
1E4C ED7BBC00 00421 CMND LD SP,(SPREG) ;Set up the stack
1E50 CDD51E 00422 CALL WRREGS ; & display normal CRT
1E53 210010 00423 LD HL,16<8!0 ;Move cursor to 16,0
1E56 0603 00424 LD B,3 ;Command
1E58 3E0F 00425 LD A,15 ;Svc @VDCTL
1E5A EF 00426 RST 28H ;Set cursor
1E5B CDC921 00427 CALL INPUT@ ;Get command
1E5E FE67 00428 CP 'g' ;Goto AAAA,(BBBB(,CCCC))
1E60 CA821F 00429 JP Z,CMD_G
1E63 214C1E 00430 LD HL,CMND ;Set up a return branch
1E66 E5 00431 PUSH HL
1E67 FE73 00432 CP 's' ;Set CRT to full screen?
1E69 2832 00433 JR Z,CMD_S
1E6B FE3B 00434 CP ';' ;Inc CRT one page?
1E6D 2842 00435 JR Z,CMD_INC
1E6F FE2D 00436 CP '-' ;Dec CRT one page?
1E71 2856 00437 JR Z,CMD_DEC
1E73 FE6F 00438 CP 'o' ;Out to DOS
1E75 2857 00439 JR Z,CMD_O
1E77 FE63 00440 CP 'c' ;Single step with CALL?
1E79 2806 00441 JR Z,CMD_C
1E7B FE64 00442 CP 'd' ;Display AAAA
1E7D 282C 00443 JR Z,CMD_D
1E7F FE69 00444 CP 'i' ;Single step?
1E81 CA8B20 00445 CMD_C JP Z,CMD_CI
1E84 FE61 00446 CP 'a' ;ASCII modify memory?
1E86 CAD61F 00447 JP Z,CMD_AH
1E89 FE68 00448 CP 'h' ;Hex modify memory AAAA?
1E8B CAD61F 00449 JP Z,CMD_AH
1E8E FE72 00450 CP 'r' ;Modify reg pair RP DDDD?
1E90 CA3F20 00451 JP Z,CMD_R
1E93 FE75 00452 CP 'u' ;Dynamic display update?
1E95 280A 00453 JR Z,CMD_U
1E97 FE78 00454 CP 'x' ;Display register format?
1E99 C23F22 00455 JP NZ,BLOCK ;Try extra commands
00456 ;
00457 ; Command X - Normal display mode
00458 ;
1E9C AF 00459 CMD_X XOR A
1E9D 32A100 00460 CMD_S LD (SAVTWO),A ;Show not full screen
1EA0 C9 00461 RET
00462 ;
00463 ; Command U - Continuously update display
00464 ;
1EA1 CD3506 00465 CMD_U CALL @KBD ;Scan keyboard
1EA4 B7 00466 OR A ;Character entered?
1EA5 C0 00467 RET NZ ;Return to CMND if so
1EA6 CDD51E 00468 CALL WRREGS ; else refresh display
1EA9 18F6 00469 JR CMD_U ; & loop
00470 ;
00471 ; Command D - Display memory at address NNNN
00472 ;
1EAB CDE421 00473 CMD_D CALL HEXIN@
1EAE C8 00474 RET Z ;Ret to CMND if no char
1EAF 1814 00475 JR $?6 ; else set DSPADR to
00476 ; new address in HL
00477 ;
00478 ; Command ; - Increment memory display one block
00479 ;
1EB1 014000 00480 CMD_INC LD BC,64 ;Init for 64-byte block
1EB4 2AA600 00481 $?4 LD HL,(DSPADR) ;P/u current display addr
1EB7 3AA100 00482 LD A,(SAVTWO) ; =0 -> Normal disp mode
00483 ;<>0 -> Full disp mode
1EBA B7 00484 OR A
1EBB 2807 00485 JR Z,$?5
1EBD 0E00 00486 LD C,0 ;Zero out low order to
00487 ; provide inc or dec of
00488 ; 256 bytes (full disp)
1EBF 78 00489 LD A,B ;B=00 -> inc 1 page,
1EC0 B7 00490 OR A ; make BC = 256
1EC1 2001 00491 JR NZ,$?5 ;B=FF -> Dec 1 page,
1EC3 04 00492 INC B ; just add
1EC4 09 00493 $?5 ADD HL,BC ;HL now points to
1EC5 22A600 00494 $?6 LD (DSPADR),HL ; new display address
1EC8 C9 00495 RET
00496 ;
00497 ; Command - - Decrement memory display 1 block
00498 ;
1EC9 01C0FF 00499 CMD_DEC LD BC,0FFC0H ;Init to 64-byte dec
1ECC 18E6 00500 JR $?4
00501 ;
00502 ; Command O - Exit to DOS
00503 ;
1ECE CDC921 00504 CMD_O CALL INPUT@ ;Fetch valid terminator
1ED1 D0 00505 RET NC ;Back if bad char
1ED2 C30B1B 00506 JP @EXIT ;Else exit to DOS
00507 ;
00508 ; Register display routine
00509 ;
00510 WRREGS
1ED5 3E1C 00511 LD A,1CH ;Home the cursor
1ED7 CD4206 00512 CALL @DSP
00513 IF @MOD4
1EDA 3E0F 00514 LD A,15 ;Turn off the cursor
1EDC CD4206 00515 CALL @DSP
00516 ENDIF
1EDF 3AA100 00517 LD A,(SAVTWO) ;0 = Normal display mode
1EE2 B7 00518 OR A ;<> 0 = Full display mode
1EE3 2068 00519 JR NZ,FULDSP ;No reg display if FULL
1EE5 21A800 00520 LD HL,AFREG ;Pt to register save area
1EE8 E5 00521 PUSH HL
1EE9 21561F 00522 LD HL,REGTBL ;Pt to reg symbol table
1EEC 060C 00523 LD B,12 ;Init for 12 registers
1EEE CD3522 00524 $?8 CALL WR3BYT ;Write 3-character symbol
1EF1 E3 00525 EX (SP),HL ;Exchange reg save ptr
1EF2 5E 00526 LD E,(HL) ;Place reg value -> DE
1EF3 23 00527 INC HL
1EF4 56 00528 LD D,(HL)
1EF5 23 00529 INC HL ;Place next reg save
1EF6 E5 00530 PUSH HL ; pointer on the stack
1EF7 EB 00531 EX DE,HL ;Reg value -> HL
1EF8 3E3D 00532 LD A,'='
1EFA CD4206 00533 CALL @DSP
1EFD CD3122 00534 CALL WRSPA@
1F00 7C 00535 LD A,H ;Write hi-order byte
1F01 CD2E22 00536 CALL WRHEX
1F04 7D 00537 LD A,L ;Write lo-order byte
1F05 CD2E22 00538 CALL WRHEX
1F08 78 00539 LD A,B ;Get loop counter &
1F09 E60B 00540 AND 0BH ; ck if 12 => AF pair
1F0B FE08 00541 CP 08H ; or if 8 => AF' pair
1F0D 201C 00542 JR NZ,NOFLG ;Bypass if not flag reg
1F0F 4D 00543 LD C,L ;Transfer 'F' reg to C &
1F10 C5 00544 PUSH BC ; save the loop counter
1F11 217A1F 00545 LD HL,FLGTBL ;Pt to flag synbol table
1F14 0608 00546 LD B,8 ;Init for 8 bits
1F16 CB21 00547 $?9 SLA C ;Shift a bit into carry
1F18 7E 00548 LD A,(HL) ;P/u flag table character
1F19 3802 00549 JR C,$?10 ;Use table char if bit on
1F1B 3E2D 00550 LD A,'-' ; else use a dash
1F1D CD4206 00551 $?10 CALL @DSP
1F20 23 00552 INC HL ;Next flag table char
1F21 10F3 00553 DJNZ $?9 ;Loop for 8 flag bits
1F23 C1 00554 POP BC ;Get main loop counter
1F24 3EFD 00555 LD A,61+0C0H ;Tab 60 to put cursor
1F26 CD4206 00556 CALL @DSP ; on next line
1F29 1803 00557 JR $?11
1F2B CD7321 00558 NOFLG CALL WRMEM
1F2E E1 00559 $?11 POP HL ;Get next reg save ptr
1F2F E3 00560 EX (SP),HL ;Exc with next reg symbol
1F30 10BC 00561 DJNZ $?8 ;Loop end
1F32 E1 00562 POP HL ;Get reg save ptr (fini)
1F33 2AA600 00563 LD HL,(DSPADR) ;P/u memory disp address
1F36 0604 00564 LD B,4 ;Init for 4 lines
1F38 3EC6 00565 $?12 LD A,6+0C0H ;Tab 6 spaces
1F3A CD4206 00566 CALL @DSP
1F3D CD1522 00567 CALL WR2HEX@ ;Write the memory address
1F40 CD3122 00568 CALL WRSPA@
1F43 CD7321 00569 CALL WRMEM ;Write a line of memory
1F46 10F0 00570 DJNZ $?12 ;Loop until 4 or 16
1F48 3E1F 00571 LD A,1FH ;Clear to end-of-frame
1F4A C34206 00572 JP @DSP
1F4D 2AA600 00573 FULDSP LD HL,(DSPADR) ;P/u display address
1F50 2E00 00574 LD L,0 ;Round to multiple of 256
1F52 0610 00575 LD B,16 ;Init for 16 lines
1F54 18E2 00576 JR $?12
00577 ;
00578 ; Register symbol table
00579 ;
1F56 61 00580 REGTBL DB 'af bc de hl af''bc''de''hl''ix iy sp pc '
66 20 62 63 20 64 65 20
68 6C 20 61 66 27 62 63
27 64 65 27 68 6C 27 69
78 20 69 79 20 73 70 20
70 63 20
00581 ;
00582 ; Flag register bit symbol table
00583 ;
1F7A 53 00584 FLGTBL DB 'SZ1H1PNC'
5A 31 48 31 50 4E 43
00585 ;
00586 ; Command G - Go to memory address NNNN,
00587 ; Optional breakpoints
00588 ;
1F82 0602 00589 CMD_G LD B,2 ;Init for maximum of
1F84 11A500 00590 LD DE,NXTBYT ; two breakpoints
1F87 CDE421 00591 CALL HEXIN@ ;Get exec address
1F8A 2803 00592 JR Z,$?13 ;Go on end
1F8C 22BE00 00593 LD (PCREG),HL ; else save new start
1F8F 380A 00594 $?13 JR C,$?14 ;Go if used
1F91 CDE421 00595 CALL HEXIN@ ;Get a breakpoint
1F94 F5 00596 PUSH AF
1F95 C4C51F 00597 CALL NZ,$?17 ;Set if brkpt entered
1F98 F1 00598 POP AF
1F99 10F4 00599 DJNZ $?13
00600 $?14
1F9B AF 00601 XOR A
1F9C 329F19 00602 LD (@DBGHK),A ;Init DEBUG on
00603 ;
00604 ; This next section of code picks up the register
00605 ; save area, pushes the save area onto the stack,
00606 ; then pops out into the correct reg assignments.
00607 ;
1F9F 21BD00 00608 $?15 LD HL,REGSAV ;End of reg save area
1FA2 060B 00609 LD B,11 ;Init for 11 regs
1FA4 56 00610 $?16 LD D,(HL)
1FA5 2B 00611 DEC HL
1FA6 5E 00612 LD E,(HL)
1FA7 2B 00613 DEC HL
1FA8 D5 00614 PUSH DE
1FA9 10F9 00615 DJNZ $?16
1FAB F1 00616 POP AF ;Now pop the registers
1FAC C1 00617 POP BC
1FAD D1 00618 POP DE
1FAE E1 00619 POP HL
1FAF 08 00620 EX AF,AF'
1FB0 D9 00621 EXX
1FB1 F1 00622 POP AF
1FB2 C1 00623 POP BC
1FB3 D1 00624 POP DE
1FB4 E1 00625 POP HL
1FB5 08 00626 EX AF,AF'
1FB6 D9 00627 EXX
1FB7 DDE1 00628 POP IX
1FB9 FDE1 00629 POP IY
1FBB E1 00630 POP HL
1FBC F9 00631 LD SP,HL
1FBD 2ABE00 00632 LD HL,(PCREG) ;Init the branch address
1FC0 E5 00633 PUSH HL
1FC1 2AAE00 00634 LD HL,(HLREG)
1FC4 C9 00635 RET ;Go to branch
00636 ;
00637 ; This next routine will insert an RST 48 inst into
00638 ; the target of a single-step or breakpoint
00639 ; providing the target address is a RAM location.
00640 ; If it is, the target byte and its address are
00641 ; saved in one of the instruction save areas.
00642 ; If the target address is ROM or nonexistent, a
00643 ; branch to command INPUT routine is taken instead
00644 ; of the pending operation.
00645 ;
1FC5 7E 00646 $?17 LD A,(HL) ;Save byte of next inst
1FC6 12 00647 LD (DE),A
1FC7 1B 00648 DEC DE
1FC8 3EF7 00649 LD A,0F7H ;Insert RST 48 into
1FCA 77 00650 LD (HL),A ; next INST address
1FCB BE 00651 CP (HL) ;Ck if RAM/ROM/no memory
1FCC C2321E 00652 JP NZ,$?1 ;Go to command if not RAM
1FCF 7C 00653 LD A,H ;Is RAM, save address of
1FD0 12 00654 LD (DE),A ; insertion into buffer
1FD1 1B 00655 DEC DE ; pointed to by DE, DE-1
1FD2 7D 00656 LD A,L
1FD3 12 00657 LD (DE),A
1FD4 1B 00658 DEC DE
1FD5 C9 00659 RET
00660 ;
00661 ; Commands A & H - Modify address NNNN to XX
00662 ; increments address
00663 ;
1FD6 32A000 00664 CMD_AH LD (SAVONE),A ;Save entry condition
1FD9 2AA300 00665 LD HL,(NXTADR) ;Default to current mod addr
1FDC CDE421 00666 CALL HEXIN@
1FDF 22A300 00667 $?18 LD (NXTADR),HL ;Adjust addr for mod
1FE2 D8 00668 RET C ;Return on
1FE3 E5 00669 PUSH HL
1FE4 CDD51E 00670 CALL WRREGS
1FE7 21000D 00671 LD HL,13<8!0 ;Cursor to 13,0
1FEA 0603 00672 LD B,3
1FEC 3E0F 00673 LD A,15 ;SVC @VDCTL set cursor
1FEE EF 00674 RST 28H
1FEF 2AA300 00675 LD HL,(NXTADR) ;P/u mod address again
1FF2 CD1522 00676 CALL WR2HEX@ ;Write the address & save
1FF5 E5 00677 PUSH HL ; the mod addr again
1FF6 21000E 00678 LD HL,14<8!0 ;Cursor to 14,0
1FF9 0603 00679 LD B,3
1FFB 3E0F 00680 LD A,15 ;SVC @VDCTL set cursor
1FFD EF 00681 RST 28H
1FFE E1 00682 POP HL ;Recover mod addr
1FFF CD1320 00683 CALL AHDSP
2002 3E2D 00684 LD A,'-'
2004 CD4206 00685 CALL @DSP
2007 D1 00686 POP DE ;Recover mod addr in DE
2008 CD2920 00687 CALL AHGET
200B EB 00688 EX DE,HL ;Switch mod addr/value
200C 2801 00689 JR Z,$?19 ;Bypass change on
200E 73 00690 LD (HL),E ;Insert new val in memory
200F D8 00691 $?19 RET C ;To CMND on non-digit
2010 23 00692 INC HL ; else increment address
2011 18CC 00693 JR $?18 ; pointer & loop
2013 3AA000 00694 AHDSP LD A,(SAVONE)
2016 FE61 00695 CP 'a'
2018 C21122 00696 JP NZ,WR1HEX@ ;Write (HL) & bump H
201B 7E 00697 DSPASC@ LD A,(HL) ;Else write in ASCII
201C FE20 00698 CP 20H ;Convert non-displayable
201E 3804 00699 JR C,TYP3 ; values to '.'
2020 FEC0 00700 CP 0C0H
2022 3802 00701 JR C,TYP4
2024 3E2E 00702 TYP3 LD A,'.'
2026 C34206 00703 TYP4 JP @DSP
2029 3AA000 00704 AHGET LD A,(SAVONE)
202C FE61 00705 CP 'a'
202E C2E421 00706 JP NZ,HEXIN@
2031 E5 00707 GETASC@ PUSH HL ;Provide lower/upper
2032 21D621 00708 LD HL,INPUC@+1 ; case entry in type
2035 366F 00709 LD (HL),6FH ; by modifying sys5 code
2037 CDC921 00710 CALL INPUT@
203A 36EF 00711 LD (HL),0EFH ;Restore the UC -> lc
203C E1 00712 POP HL ; conversion
203D 6F 00713 LD L,A
203E C9 00714 RET
00715 ;
00716 ; Command R - Load register pair RP with NNNN
00717 ;
203F CDC921 00718 CMD_R CALL INPUT@ ;Get 1st symbol char
2042 C8 00719 RET Z ;Return if end
2043 4F 00720 LD C,A ; else save char in C
2044 CDC921 00721 CALL INPUT@ ;Get 2nd symbol char
2047 C8 00722 RET Z ;Return if end
2048 57 00723 LD D,A ; else save char in D
2049 1E20 00724 LD E,' ' ;Init for space
204B CDC921 00725 CALL INPUT@ ;Get 3rd symbol char
204E D8 00726 RET C ;Return on end
204F 2806 00727 JR Z,$?20 ;Bypass if not primed
2051 5F 00728 LD E,A ; else put "'" into E
2052 CDC921 00729 CALL INPUT@ ;Ck for space separator
2055 C0 00730 RET NZ ;Return if none
2056 D8 00731 RET C
2057 21561F 00732 $?20 LD HL,REGTBL ;Register symbol table
205A 060C 00733 LD B,12 ;Init for 12 registers
205C 7E 00734 $?21 LD A,(HL) ;Match first symbol?
205D B9 00735 CP C
205E 2806 00736 JR Z,$?24 ;If a match, test 2nd
2060 23 00737 INC HL ; else pt to next reg
2061 23 00738 $?22 INC HL
2062 23 00739 $?23 INC HL
2063 10F7 00740 DJNZ $?21 ;Loop for 12 regs
2065 C9 00741 RET ;Return if no match
2066 23 00742 $?24 INC HL ;Pt to 2nd table char
2067 7E 00743 LD A,(HL) ; & p/u the symbol
2068 BA 00744 CP D ;Ck the 2nd char input
2069 20F6 00745 JR NZ,$?22 ;-> next if no match
206B 23 00746 INC HL ;Match, ck 3rd reg symbol
206C 7E 00747 LD A,(HL) ;P/u the 3rd table symbol
206D BB 00748 CP E ; & compare with input
206E 20F2 00749 JR NZ,$?23 ;-> next if no match
2070 3E18 00750 LD A,18H ;Convert counter to index
2072 90 00751 SUB B ; into reg save area
2073 90 00752 SUB B
2074 4F 00753 LD C,A ;Index into BC
2075 0600 00754 LD B,0
2077 21A800 00755 LD HL,AFREG ;Start of reg save area
207A 09 00756 ADD HL,BC ;Add index to get pointer
207B E5 00757 PUSH HL ;Save the pointer
207C 3E1E 00758 LD A,1EH ;Erase to end-of-line
207E CD4206 00759 CALL @DSP
2081 D1 00760 POP DE ;Recover pointer
2082 CDE421 00761 CALL HEXIN@ ;Read in the new value
2085 C8 00762 RET Z ;No update if none
2086 EB 00763 EX DE,HL ;Exchg value/pointer
2087 73 00764 LD (HL),E ;Insert new value into
2088 23 00765 INC HL ; register save area
2089 72 00766 LD (HL),D
208A C9 00767 RET
00768 ;
00769 ; Command I - Step one instruction at a time
00770 ;
208B F5 00771 CMD_CI PUSH AF ;Save whether I or C
208C ED5BBE00 00772 LD DE,(PCREG) ;Point to inst address
2090 1A 00773 LD A,(DE) ; & get it
2091 215721 00774 LD HL,XY_TAB ;IX,IY Table
2094 FEDD 00775 CP 0DDH ;Is inst an IX?
2096 280E 00776 JR Z,$?25
2098 FEFD 00777 CP 0FDH ;Is inst an IY?
209A 280A 00778 JR Z,$?25
209C 211F21 00779 LD HL,OP_TAB ;All X IX, IY, & ED
209F FEED 00780 CP 0EDH ;Is inst an ED?
20A1 2006 00781 JR NZ,$?26
20A3 215021 00782 LD HL,ED_TAB ;ED Table
20A6 13 00783 $?25 INC DE ;Get next byte for
20A7 1A 00784 LD A,(DE) ; IX, IY, and ED inst
20A8 1B 00785 DEC DE ;Reset ptr to 1st byte
20A9 4F 00786 $?26 LD C,A ;Inst byte to reg C
00787 ;
00788 ; This next section of code determines the length
00789 ; of all instructions and whether they
00790 ; are CALLs, JumPs, or RETurns.
00791 ;
20AA 7E 00792 $?27 LD A,(HL) ;P/u table value &
20AB A1 00793 AND C ; strip off certain bits
20AC 23 00794 INC HL ;Pt to table code
20AD BE 00795 CP (HL) ;If a match, the inst is
20AE 23 00796 INC HL ; fully decoded as to
20AF 2806 00797 JR Z,$?28 ; length & type by the
20B1 23 00798 INC HL ; next byte
20B2 7E 00799 LD A,(HL) ;Ck for table end
20B3 FE05 00800 CP 5
20B5 30F3 00801 JR NC,$?27
20B7 7E 00802 $?28 LD A,(HL) ;Get control/length byte
20B8 47 00803 LD B,A ; into reg B
20B9 E60F 00804 AND 0FH ;Strip off the control
20BB 6F 00805 LD L,A ;Put length into reg L
20BC 2600 00806 LD H,0 ;Zero out reg H
20BE 19 00807 ADD HL,DE ;Next address into HL
20BF D5 00808 PUSH DE ;This addr in DE saved
20C0 11A500 00809 LD DE,NXTBYT ;Buffer area
20C3 CDC51F 00810 CALL $?17 ;Insert RST 48 if RAM
20C6 E1 00811 POP HL ;Get this inst address
20C7 78 00812 LD A,B ;Get control/length byte
20C8 E6F0 00813 AND 0F0H ;Strip off length
20CA 282A 00814 JR Z,$?29 ;Go if regular inst
20CC 23 00815 INC HL
20CD FE20 00816 CP 20H
20CF 3846 00817 JR C,$?34 ;Branch if 'JP (HL)'
20D1 2838 00818 JR Z,$?33 ;Go if 'JP (IX/IY)'
20D3 FE40 00819 CP 40H
20D5 382B 00820 JR C,$?32 ;Go if 'JR' or 'DJNZ'
20D7 2823 00821 JR Z,$?31 ;Branch if 'JP' inst
20D9 FE60 00822 CP 60H
20DB 381C 00823 JR C,$?30 ;Branch if 'RET' inst
20DD 2812 00824 JR Z,$?28A ;Branch if CALL inst
20DF 79 00825 LD A,C ; else calc target of
20E0 E638 00826 AND 38H ; the RST inst
20E2 6F 00827 LD L,A
20E3 2600 00828 LD H,0
20E5 F1 00829 POP AF ;Rcvr entry command
20E6 FE63 00830 CP 'c'
20E8 280C 00831 JR Z,$?29 ;Go in "call" mode
20EA 7D 00832 LD A,L ;Must check RST for
20EB FE28 00833 CP 5<3 ; 40, 48, 56 inhibit
20ED 3007 00834 JR NC,$?29 ;Convert to CALL
20EF 1829 00835 JR $?35 ; else single step
20F1 F1 00836 $?28A POP AF ;Recover entry command
20F2 FE69 00837 CP 'i' ;Was command an 'I'
20F4 2806 00838 JR Z,$?31 ;Go for 'CALLs' if 'I'
20F6 C39F1F 00839 $?29 JP $?15 ;Go for 'CALLs' if 'C'
20F9 2ABC00 00840 $?30 LD HL,(SPREG) ;RET inst, p/u RET addr
20FC 7E 00841 $?31 LD A,(HL) ;JP inst, p/u jump addr &
20FD 23 00842 INC HL ; insert into reg HL
20FE 66 00843 LD H,(HL)
20FF 6F 00844 LD L,A
2100 1818 00845 JR $?35
2102 4E 00846 $?32 LD C,(HL) ;'JR' or 'DJNZ', get 'E'
2103 79 00847 LD A,C ;Make A=0 if C is
2104 07 00848 RLCA ; positive, else make
2105 9F 00849 SBC A,A ; A=FF for negative
2106 47 00850 LD B,A ;Put -> B, FF if 'E' neg
2107 23 00851 INC HL ; or 0 if 'E' pos.
2108 09 00852 ADD HL,BC ;Add the displacement
2109 180F 00853 JR $?35
210B 2AB800 00854 $?33 LD HL,(IXREG) ;Init for JP (IX)
210E CB69 00855 BIT 5,C ;Test inst for DD/FD
2110 2808 00856 JR Z,$?35 ;Bit 5 off = DD
2112 2ABA00 00857 LD HL,(IYREG) ;JP (IY), p/u jump addr
2115 1803 00858 JR $?35
2117 2AAE00 00859 $?34 LD HL,(HLREG) ;JP (HL), p/u jump addr
211A CDC51F 00860 $?35 CALL $?17
211D 18D7 00861 JR $?29
00862 ;
00863 ; The next three tables are used to determine the
00864 ; length & instruction type for all instructions
00865 ; used in the single-step mode. Table format uses
00866 ; three bytes for each decoding process. The 1st
00867 ; byte is ANDed with the inst byte to strip off
00868 ; selected bits and include others. The result is
00869 ; compared to the next table byte (test byte) for
00870 ; a match. If matched, then the inst byte has been
00871 ; identified as to its class & length. The 3rd byte
00872 ; denotes the class and length as follows:
00873 ; High order nybble
00874 ; 0 = Regular instruction
00875 ; 1 = JP (HL) instruction
00876 ; 2 = JP (IX) or JP (IY) instruction
00877 ; 3 = JR or DJNZ instructions
00878 ; 4 = JP instructions
00879 ; 5 = RET instructions
00880 ; 6 = CALL instructions
00881 ; 7 = RST instructions
00882 ; Low order nybble = the length
00883 ; The last byte of each table is the length of
00884 ; all other instructions.
00885 ;
00886 ; Table for regular instructions (no IX, IY, ED)
00887 ;
211F C7 00888 OP_TAB DB 0C7H,0C0H,51H ;C8, D8, E8, F8
C0 51
2122 FF 00889 DB 0FFH,0C9H,51H ;C9
C9 51
2125 FF 00890 DB 0FFH,0E9H,11H ;E9
E9 11
2128 CF 00891 DB 0CFH,01H,03H ;01, 11, 21, 31
01 03
212B E7 00892 DB 0E7H,22H,3 ;22, 2A, 32, 3A
22 03
212E C7C2 00893 DW 0C2C7H ;C2, CA, D2, DA, E2, EA,
2130 43 00894 DB 43H ; F2, FA
2131 FF 00895 DB 0FFH,0C3H,43H ;C3
C3 43
2134 C7C4 00896 DW 0C4C7H ;C4, CC, D4, DC, E4, EC,
2136 63 00897 DB 63H ; F4, FC
2137 FF 00898 DB 0FFH,0CDH,63H ;CD
CD 63
213A C706 00899 DW 06C7H ;06, 0E, 16, 1E, 26, 2E,
213C 02 00900 DB 02H ; 36, 3E
213D F7 00901 DB 0F7H,0D3H,02 ;D3, DB
D3 02
2140 C7C6 00902 DW 0C6C7H ;C6, CE, D6, DE, E6, EE,
2142 02 00903 DB 02H ; F6, FE
2143 FF 00904 DB 0FFH,0CBH,2 ;All CB instructions
CB 02
2146 F7 00905 DB 0F7H,10H,32H ;10, 18
10 32
2149 E7 00906 DB 0E7H,20H,32H ;20, 28, 30, 38
20 32
214C C7 00907 DB 0C7H,0C7H,71H ;RST instructions
C7 71
214F 01 00908 DB 1 ;All others are 1-byte
00909 ;
00910 ; Next table is for ED - extended instructions
00911 ;
2150 C7 00912 ED_TAB DB 0C7H,43H,04H ;43, 4B, 53, 5B, 73, 7B
43 04
2153 F7 00913 DB 0F7H,45H,52H ;45, 4D
45 52
2156 02 00914 DB 2 ;All other ED are 2-byte
00915 ;
00916 ; IX, IY Index instructions table
00917 ;
2157 FE 00918 XY_TAB DB 0FEH,34H,03 ;34, 35
34 03
215A C0 00919 DB 0C0H,40H,03 ;4X, 5X, 6X, 7X (X = 0-F)
40 03
215D C0 00920 DB 0C0H,80H,03 ;8X, 9X, AX, BX (X= 0-F)
80 03
2160 FF 00921 DB 0FFH,21H,04 ;21
21 04
2163 FF 00922 DB 0FFH,22H,04 ;22
22 04
2166 FF 00923 DB 0FFH,2AH,04 ;2A
2A 04
2169 FF 00924 DB 0FFH,36H,04 ;36
36 04
216C FF 00925 DB 0FFH,0CBH,04 ;CB
CB 04
216F FF 00926 DB 0FFH,0E9H,22H ;E9
E9 22
2172 02 00927 DB 02H ;All others are 2-bytes
00928 ;
00929 ; Routine to display memory on CRT screen
00930 ;
2173 C5 00931 WRMEM PUSH BC ;Save main counter 4/16
2174 3E3D 00932 LD A,'='
2176 CD4206 00933 CALL @DSP
2179 3C 00934 INC A ;'>'
217A CD4206 00935 CALL @DSP
217D 0610 00936 LD B,16 ;Init for 16 lines
217F E5 00937 PUSH HL ;Save memory pointer
2180 CDA421 00938 $?36 CALL GRPHIC ;Ck if need graphic bars
2183 CD1122 00939 CALL WR1HEX@ ;Call on HEX display only
2186 10F8 00940 DJNZ $?36 ;Loop until full line
2188 E1 00941 POP HL ;Rcvr memory pointer
00942 ;
00943 ; Now write the line in ASCII
00944 ;
2189 CD3122 00945 CALL WRSPA@
218C 0610 00946 LD B,16
218E CDC321 00947 $?37 CALL $?41 ;Space after 8th
2191 7E 00948 LD A,(HL) ;P/u the byte -> reg A
2192 FE20 00949 CP 20H ;Repl controls with '.'
2194 3804 00950 JR C,$?38
2196 FEC0 00951 CP 0C0H ;Tabs/specials with '.'
2198 3802 00952 JR C,$?39
219A 3E2E 00953 $?38 LD A,'.'
219C CD4206 00954 $?39 CALL @DSP
219F 23 00955 INC HL ;Bump memory address
21A0 10EC 00956 DJNZ $?37
21A2 C1 00957 POP BC ;Get line counter
21A3 C9 00958 RET
00959 ;
00960 ; This routine determines if the vertical graphic
00961 ; bars should be surrounding the current character
00962 ;
21A4 ED5BA300 00963 GRPHIC LD DE,(NXTADR) ;P/u modification address
21A8 13 00964 INC DE ; & increment it
21A9 E5 00965 PUSH HL ;Save current memory
21AA AF 00966 XOR A ; display address
21AB ED52 00967 SBC HL,DE ;Ck if mod addr=disp addr
00968 IF @MOD4
21AD 3E95 00969 LD A,95H ;Graphic left bar
00970 ENDIF
00971 IF @MOD2
00972 LD A,15H
00973 ENDIF
21AF 280E 00974 JR Z,$?40 ;Insert graphic if equal
21B1 CDC321 00975 CALL $?41 ;Not =, insert space if
21B4 23 00976 INC HL ; between pos 8 & 9
21B5 7D 00977 LD A,L ;Result is zero if next
21B6 B4 00978 OR H ; char address is also
00979 ; the display address
21B7 E1 00980 POP HL ;Get current mem disp adr
00981 IF @MOD4
21B8 3EAA 00982 LD A,0AAH ;Graphic right bar output
21BA CA4206 00983 JP Z,@DSP ;Go if yes
21BD 1808 00984 JR $?42 ; else continue
00985 ENDIF
00986 IF @MOD2
00987 JR NZ,$?42 ;Go if not
00988 XOR A ; lead in
00989 CALL @DSP ;Init video lead in
00990 LD A,15H
00991 JP @DSP ; and display
00992 ENDIF
21BF 00993 $?40 EQU $
00994 IF @MOD2
00995 PUSH AF
00996 XOR A
00997 CALL @DSP ;Lead in code
00998 POP AF ;Restore
00999 ENDIF
21BF CD4206 01000 CALL @DSP ;Display char
21C2 E1 01001 POP HL ;Recover current display
21C3 78 01002 $?41 LD A,B ; address & output a
21C4 FE08 01003 CP 8 ; space if between the
21C6 C0 01004 RET NZ ; 8th & 9th bytes
21C7 1868 01005 $?42 JR WRSPA@ ; else just return
01006 ;
01007 ; This routine will return with zero flag set
01008 ; on entry of a comma or a SPACE. Entry of
01009 ; will set carry flag and return
01010 ;
21C9 D5 01011 INPUT@ PUSH DE
21CA CD2806 01012 $?43 CALL @KEY
21CD FE0D 01013 CP 0DH ;ENTER?
21CF 2810 01014 JR Z,$?44
21D1 FE20 01015 CP 20H ;Get another char if
21D3 38F5 01016 JR C,$?43 ; entry was control
21D5 CBEF 01017 INPUC@ SET 5,A ;Cvrt UC to lc
21D7 CD4206 01018 CALL @DSP ;Not control, disp it
21DA D1 01019 POP DE
21DB FE2C 01020 CP ',' ;Return with zero flag
21DD C8 01021 RET Z ; set if a comma
21DE FE20 01022 CP ' ' ;Return with zero flag
21E0 C9 01023 RET ; set if
21E1 D1 01024 $?44 POP DE
21E2 37 01025 SCF ; will set
21E3 C9 01026 RET ; the carry flag
01027 ;
01028 ; This routine will read in digits
01029 ; and convert them to binary
01030 ;
21E4 CDC921 01031 HEXIN@ CALL INPUT@ ;Get char and return on
21E7 C8 01032 RET Z ; SPACE, COMMA, or ENTER
21E8 210000 01033 LD HL,0 ;Init value to zero
21EB CD0022 01034 $?45 CALL CVB ;Convert to binary if ok
21EE DA4C1E 01035 JP C,CMND ; else back on bad digit
21F1 29 01036 ADD HL,HL ;Multiply current value
21F2 29 01037 ADD HL,HL ; by 16 and insert the
21F3 29 01038 ADD HL,HL ; new digit into the
21F4 29 01039 ADD HL,HL ; lo-order nybble of L
21F5 B5 01040 OR L
21F6 6F 01041 LD L,A
21F7 CDC921 01042 CALL INPUT@ ;Get another character
21FA 20EF 01043 JR NZ,$?45 ;Go if not separator
21FC 1F 01044 RRA ;Force to set
21FD CE81 01045 ADC A,81H ; the carry flag
21FF C9 01046 RET
01047 ;
01048 ; Routine to convert expected ASCII hex digit to
01049 ; its binary value. Set Carry-flag on bad digit
01050 ;
2200 D630 01051 CVB SUB '0' ;Convert digit to binary
2202 D8 01052 RET C ;Error if < '0'
2203 C6C9 01053 ADD A,0C9H ;Ck for > F (46H-30H=16H)
01054 ; (16H + E9H = FFH)
2205 D8 01055 RET C ;Error if > ASCII 'F'
2206 C606 01056 ADD A,6 ;(E9H-EFH) to (EFH-05H)
2208 3803 01057 JR C,ATOF ;Carry denotes was
220A C627 01058 ADD A,27H ;(EFH-FFH) to (F6H-06H)
220C D8 01059 RET C ;Error if (3AH-3FH/:-?)
220D C60A 01060 ATOF ADD A,0AH ;(00D-06D) to (10D-16D)
01061 ; or (F6H-FFH) to (0-9)
220F B7 01062 OR A ;Set zero flag on zero
2210 C9 01063 RET
01064 ;
01065 ; Routine to write one byte as two hex digits
01066 ;
2211 7E 01067 WR1HEX@ LD A,(HL)
2212 23 01068 INC HL
2213 1805 01069 JR CV2HEX@
01070 ;
01071 ; Routine to write 2 bytes (HL) as 4 hex digits
01072 ;
2215 7C 01073 WR2HEX@ LD A,H
2216 CD1A22 01074 CALL CV2HEX@
2219 7D 01075 LD A,L
01076 ;
01077 ; Routine converts a byte to 2 hex digits
01078 ;
221A F5 01079 CV2HEX@ PUSH AF ;Save the byte in A
221B 1F 01080 RRA ;Move hi-order
221C 1F 01081 RRA ; into lo-order
221D 1F 01082 RRA
221E 1F 01083 RRA
221F CD2322 01084 CALL $?46 ;Strip off hi-order
01085 ; & convert to ASCII
2222 F1 01086 POP AF ;Recover the byte
2223 E60F 01087 $?46 AND 0FH ;Strip off hi-order
01088 ; & convert to ASCII
2225 C690 01089 ADD A,90H
2227 27 01090 DAA
2228 CE40 01091 ADC A,40H
222A 27 01092 DAA
222B C34206 01093 $?47 JP @DSP
01094 ;
01095 ; Miscellaneous routines
01096 ;
222E CD1A22 01097 WRHEX CALL CV2HEX@
2231 3E20 01098 WRSPA@ LD A,20H
2233 18F6 01099 JR $?47
01100 ;
2235 CD3B22 01101 WR3BYT CALL $?48
2238 CD3B22 01102 CALL $?48
223B 7E 01103 $?48 LD A,(HL)
223C 23 01104 INC HL
223D 18EC 01105 JR $?47
01106 ;
01107 ; Command B - Block move
01108 ;
223F FE62 01109 BLOCK CP 'b'
2241 2048 01110 JR NZ,FILL
2243 2AA600 01111 LD HL,(DSPADR) ;'b'lock move s,d,len
2246 CDE421 01112 CALL HEXIN@ ;Default to display addd
2249 D8 01113 RET C ;Back on
224A 22A600 01114 LD (DSPADR),HL ;Save start addr
224D 2008 01115 JR NZ,BLO1 ;Go if start entered
224F CD1522 01116 CALL WR2HEX@ ; else show default
2252 3E2C 01117 LD A,','
2254 CD4206 01118 CALL @DSP
2257 2AA300 01119 BLO1 LD HL,(NXTADR) ;Default next address
225A CDE421 01120 CALL HEXIN@
225D 22A300 01121 LD (NXTADR),HL ;Save dest address
2260 200A 01122 JR NZ,BLO2 ;Go if entered
2262 F5 01123 PUSH AF
2263 CD1522 01124 CALL WR2HEX@ ; else show default
2266 3E2C 01125 LD A,','
2268 CD4206 01126 CALL @DSP
226B F1 01127 POP AF
226C 210001 01128 BLO2 LD HL,256 ;Default length to 256
226F 3805 01129 JR C,BLO3 ;Go if used prev.
2271 CDE421 01130 CALL HEXIN@ ;Get new length
2274 2005 01131 JR NZ,BLO4 ;Go if entered
2276 E5 01132 BLO3 PUSH HL
2277 CD1522 01133 CALL WR2HEX@ ; else dsply default
227A E1 01134 POP HL
227B 44 01135 BLO4 LD B,H ;Length to BC
227C 4D 01136 LD C,L
227D 2AA600 01137 LD HL,(DSPADR) ;Set source
2280 ED5BA300 01138 LD DE,(NXTADR) ; and dest
2284 EDB0 01139 LDIR
2286 ED53A300 01140 LD (NXTADR),DE ;Set new mod addr
228A C9 01141 RET
01142 ;
01143 ; 'f'ill aaaa,bbbb,cc
01144 ;
228B FE66 01145 FILL CP 'f'
228D 201C 01146 JR NZ,JUMP
228F CDE421 01147 CALL HEXIN@ ;Get starting address
2292 C8 01148 RET Z
2293 E5 01149 PUSH HL ;Save starting address
2294 CDE421 01150 CALL HEXIN@ ;Get ending address
2297 E3 01151 EX (SP),HL ;Place ending into BC
2298 C1 01152 POP BC ; & starting into HL
2299 C8 01153 RET Z
229A E5 01154 PUSH HL ;Save starting again
229B CDE421 01155 CALL HEXIN@ ;Get fill character
229E 5D 01156 LD E,L ;Save fill in E
229F E1 01157 POP HL ;Recover starting addr
22A0 C8 01158 RET Z
22A1 AF 01159 XOR A ;Clear the C-flag
22A2 E5 01160 FIL1 PUSH HL
22A3 ED42 01161 SBC HL,BC
22A5 E1 01162 POP HL
22A6 D0 01163 RET NC ;Return when start = end
22A7 73 01164 LD (HL),E ;Stuff char into memory
22A8 23 01165 INC HL
22A9 18F7 01166 JR FIL1
01167 ;
01168 ; 'j'ump over next instruction
01169 ;
22AB FE6A 01170 JUMP CP 'j'
22AD 2008 01171 JR NZ,QUERY
22AF 2ABE00 01172 LD HL,(PCREG) ;Get current PC location
22B2 23 01173 INC HL ; and increment it
22B3 22BE00 01174 LD (PCREG),HL
22B6 C9 01175 RET
01176 ;
01177 ; 'q'uery ii - 'q'uery oo,dd
01178 ; input/output to port
01179 ;
22B7 FE71 01180 QUERY CP 'q'
22B9 2024 01181 JR NZ,DISKIO
22BB 3E1E 01182 LD A,1EH ;Clear to end of line
22BD CD4206 01183 CALL @DSP
22C0 CDE421 01184 CALL HEXIN@ ;Get port number
22C3 C8 01185 RET Z ;Back if no value
22C4 4D 01186 LD C,L
22C5 3807 01187 JR C,QUE1 ;If , do input
22C7 CDE421 01188 CALL HEXIN@ ;Get byte to output
22CA C8 01189 RET Z ;Quit if none
22CB ED69 01190 OUT (C),L ;Do the output
22CD C9 01191 RET
22CE 3E3D 01192 QUE1 LD A,'=' ;Dsply separator
22D0 CD4206 01193 CALL @DSP
22D3 ED78 01194 IN A,(C) ;Read the port and
22D5 CD1A22 01195 CALL CV2HEX@ ; dsply the value
22D8 C3C921 01196 JP INPUT@
01197 ;
01198 ; If a command is entered and not found in SYS5,
01199 ; SYS9 will be searched if the extended debugger
01200 ; is active.
01201 ;
22DB 2AA419 01202 EXTDBG LD HL,(EXTDBG$) ;Try extended debug
22DE E9 01203 JP (HL)
01204 ;
01205 ; disk i/o - d,c,s,r/w/*,addr,lth
01206 ;
22DF D630 01207 DISKIO SUB 30H ;Cvrt drive to binary
22E1 FE08 01208 CP 8 ;Check on max drive
22E3 30F6 01209 JR NC,EXTDBG ;Exit if not <0-7>
22E5 4F 01210 LD C,A ;Xfer drive # to reg C
22E6 CD1E1A 01211 CALL @GTDCT ; & get the DCT
22E9 FD7E07 01212 LD A,(IY+7) ;Get sectors/cyl & heads
22EC E6E0 01213 AND 0E0H ;Remove sectors/cyl
22EE 07 01214 RLCA ; & keep # of heads
22EF 07 01215 RLCA ;Shift into bits 0-2
22F0 07 01216 RLCA
22F1 3C 01217 INC A ;Adj for zero offset
22F2 47 01218 LD B,A
22F3 FD7E07 01219 LD A,(IY+7) ;# of sectors per cyl
22F6 E61F 01220 AND 1FH ;Remove heads
22F8 3C 01221 INC A ;Adj for zero offset
22F9 67 01222 LD H,A
22FA AF 01223 XOR A ;Accumulate total # of
22FB 84 01224 DIS1 ADD A,H ;Sectors per cyl
22FC 10FD 01225 DJNZ DIS1
22FE FDCB046E 01226 BIT 5,(IY+4) ;Test if 2-sided drive
2302 2801 01227 JR Z,DIS2
2304 87 01228 ADD A,A ;Times 2 if 2-sided
2305 32A200 01229 DIS2 LD (SAVTWO+1),A ;Save sectors per cyl
2308 3E1E 01230 LD A,1EH ;Clear to end of line
230A CD4206 01231 CALL @DSP
230D CDC921 01232 CALL INPUT@ ;Input CYL #
2310 D8 01233 RET C
2311 CDE421 01234 CALL HEXIN@
2314 D8 01235 RET C
2315 55 01236 LD D,L ;Cylinder entered?
2316 2003 01237 JR NZ,DIS3
2318 FD5609 01238 LD D,(IY+9) ;P/u directory cyl
231B CDE421 01239 DIS3 CALL HEXIN@
231E 5D 01240 LD E,L ;Sector entered?
231F 3E01 01241 LD A,1 ;Init to 1 sector i/o
2321 2005 01242 JR NZ,DIS4
2323 1E00 01243 LD E,0 ;Default to sector 0
2325 3AA200 01244 LD A,(SAVTWO+1) ;Default to total sectors
2328 32A500 01245 DIS4 LD (NXTBYT),A
232B D8 01246 RET C
232C CDC921 01247 CALL INPUT@ ;Get I/O direction (RW*)
232F D8 01248 RET C
2330 47 01249 LD B,A ;Save i/o char in B
2331 CDC921 01250 CALL INPUT@ ;Get buffer i/o address
2334 D8 01251 RET C
2335 CDE421 01252 CALL HEXIN@
2338 E5 01253 PUSH HL ;Save buffer address
2339 380B 01254 JR C,DIS6
233B E5 01255 PUSH HL
233C CDE421 01256 CALL HEXIN@ ;Sector count entered?
233F 7D 01257 LD A,L
2340 E1 01258 POP HL
2341 2803 01259 JR Z,DIS6 ;Go if no sector count
2343 32A500 01260 LD (NXTBYT),A ;Else update count
2346 78 01261 DIS6 LD A,B ;P/u i/o direction
2347 FE72 01262 CP 'r' ;Read?
2349 2830 01263 JR Z,DIS9
234B FE77 01264 CP 'w' ;Write?
234D 2847 01265 JR Z,DIS10
234F FE2A 01266 CP '*' ;Write to directory?
2351 284A 01267 JR Z,DIS11
2353 24 01268 DIS7 INC H ;Bump up a buffer page
2354 1C 01269 INC E ;Bump sector number
2355 3AA200 01270 LD A,(SAVTWO+1) ;P/u max # sectors
2358 3D 01271 DEC A ;Compare max to where
2359 BB 01272 CP E ; we are
235A 3003 01273 JR NC,DIS8 ;Jump if more on cyl
235C 1E00 01274 LD E,0 ;Reset sector # to 0
235E 14 01275 INC D ;Bump cylinder
235F 3AA500 01276 DIS8 LD A,(NXTBYT) ;Reduce i/o sector count
2362 3D 01277 DEC A
2363 32A500 01278 LD (NXTBYT),A
2366 20DE 01279 JR NZ,DIS6 ;Loop if not through
2368 E1 01280 DIS8A POP HL ;Rcvr buffer start addr
2369 78 01281 LD A,B ;P/u i/o direction
236A FE72 01282 CP 'r' ;Read?
236C C0 01283 RET NZ ;Ret if not read
236D 2E00 01284 LD L,0 ;Reset memory buffer ptr
236F 22A600 01285 LD (DSPADR),HL ; to display the 1st
2372 22A300 01286 LD (NXTADR),HL ; sector read
2375 3E73 01287 LD A,'s' ;Set full screen mode
2377 32A100 01288 LD (SAVTWO),A
237A C9 01289 RET
01290 ;
237B 01291 DIS9 EQU $
237B E5 01292 PUSH HL
237C D5 01293 PUSH DE
237D C5 01294 PUSH BC
237E 54 01295 LD D,H ;Pass buffer to DE
237F 5D 01296 LD E,L
2380 13 01297 INC DE ;Start +1
2381 3600 01298 LD (HL),0 ;Clear a byte
2383 01FF00 01299 LD BC,255 ;Length -1
2386 EDB0 01300 LDIR ;Clear buffer
2388 C1 01301 POP BC ;Unstack
2389 D1 01302 POP DE
238A E1 01303 POP HL
01304 ;
238B CDF419 01305 CALL @RDSEC ;Read the sector
238E 28C3 01306 JR Z,DIS7 ;Loop on read ok
2390 FE06 01307 CP 6 ; or directory read
2392 28BF 01308 JR Z,DIS7
2394 180C 01309 JR DIS12 ; else error
2396 CDE819 01310 DIS10 CALL @WRSEC ;Write sector
2399 28B8 01311 JR Z,DIS7 ;Loop on write ok
239B 1805 01312 JR DIS12
239D CDEC19 01313 DIS11 CALL @WRSSC ;Write system sector
23A0 28B1 01314 JR Z,DIS7 ;Loop on write prot ok
01315 ;
01316 ; disk i/o error output display routine
01317 ;
23A2 D5 01318 DIS12 PUSH DE ;Save track & sector
23A3 F5 01319 PUSH AF ;Save error code
23A4 CD3122 01320 CALL WRSPA@ ;Output a space
23A7 3E2A 01321 LD A,'*'
23A9 CD4206 01322 CALL @DSP ; followed by asterisk
23AC F1 01323 POP AF
23AD CD1A22 01324 CALL CV2HEX@ ;Write error #
23B0 3E2A 01325 LD A,'*'
23B2 CD4206 01326 CALL @DSP ; followed by space
23B5 CDC921 01327 CALL INPUT@ ;Continue?
23B8 D1 01328 POP DE ;Rcvr track/sector
23B9 3098 01329 JR NC,DIS7 ;Loop unless
23BB 18AB 01330 JR DIS8A ;Exit on
01331 ;
23BD 01332 LAST EQU $
01333 IFGT LAST,MAXCOR$-2
01334 ERR 'Module too big'
01335 ENDIF
23FE 01336 ORG MAXCOR$-2
23FE BD05 01337 DW LAST-SYS5 ;Overlay size
01338 ;
1E00 01339 END SYS5
1E00 is the transfer address
00000 Total errors
[Copyright 1999,2002 Frank Durda IV, All Rights Reserved. Mirroring of any material on this page in any form is expressly prohibited. The official web site for this material is: http://nemesis.lonestar.org Contact this address for use clearances: clearance at nemesis.lonestar.org Comments and queries to this address: web_software at nemesis.lonestar.org]