Title Standard Rsx PreFix (20_Aug_84) ; ; Copyright 1984 ; Morrow Designs, Inc. ; San Leandro Ca. ; .z80 cseg ;---------------------------------------------------------------------- ; Equates (21_Aug_84) ;-------------------- ; No equ 0 ;Remove/Non_Banked is False Yes equ 0FFh ;Remove/Non_Banked is True ;Bios/Bdos Equates Bdos_Entry equ 5 ;Bdos: Entry Vector Location Bdos_ConOut equ 2 ; Console Output Bdos_PString equ 9 ; Print a Sting on the Console ;Non Printing Ascii Equates Tab equ 09h ;Tab Lf equ 0Ah ;Line Feed Cr equ 0Dh ;Carriage Return page ;---------------------------------------------------------------------- ; Rsx Prefix Section (20_Aug_84) ;------------------------------- ; Serial: db 1,2,3,4,5,6 ;Space for the Serial Number Start: db 0C3h ;Jump to Start of Code dw Start_Rsx ;Vector to Start of Code Next: db 0C3h ;Jump to Start of Next Rsx dw 0 ;Vector to Next Rsx Prev: dw 0 ;Address of Previous Rsx or Location 5 Remove: db Yes ;No to keep Rsx active after Warm Boot NonBank: db No ;No for using both banked & non-banked systems Name: db 'Trace 20' ;Name of this Rsx Loader: db 0 ;Loader Flag dw 0 ;Reserved ;---------------------------------------------------------------------- ; Rsx Code (20_Aug_84) ;--------------------- ; Start_Rsx: ld (Save_A),a ld (Save_BC),bc ld (Save_DE),de ld (Save_HL),hl ;Save the Input Values of the Registers pop hl push hl ld (Save_SP),hl ;Save the Calling Address ld (Old_Stack),sp ld sp,Stack ;Setup Local Stack call Print_Message ;Print the Bdos Function Number or a ;If (Message has been printed) jr z,Skip1 call Print_Registers ; Print the Registers Skip1: ld sp,(Old_Stack) ;Restore Stack Pointer ld hl,(Save_HL) ld de,(Save_DE) ld bc,(Save_BC) ;Restore the Registers ld a,(Save_A) jp Next ;---------------------------------------------------------------------- ; Print a Message on the Console (21_Aug_84) ;------------------------------------------- ; 1) This routine prints the message string, whose code is passed in the ; accm, on the console. ; 2) Register Usage: ; B -> Counter ; C -> Has Message Code on Entry ; DE -> Used to hold pointers/Bdos print string functions ; HL -> Used to hold pointers ; Print_Message: ld b,Max_Message ld hl,Message_Table ;HL:= Start of the Message Table PmLp1: ld a,(hl) ;Repeat A:= Table's Message Code inc hl ld e,(hl) inc hl ld d,(hl) ; DE:= Pointer to String inc hl ; (HL equal to start next entry) cp c ; If (Code eq table) jr z,Pmprn ; Goto Print djnz PmLp1 ;Until (the whole tables been checked) ld de,NoCode ;(Pointer:= 'Unrecognized Message') PmPrn: ld a,e ;If (Message is Suppressed) or d ret z ; Return (A:= 0) push de ld de,mStart ;DE:= Pointer to Line Opening String ld c,Bdos_PString ;C:= Print String Function call Next ;Print Carriage Return Line Feed pop de ld c,Bdos_PString ;C:= Print String Function call Next ;Print the Message ld a,0FFh ;A:= Message Printed ret page ;---------------------------------------------------------------------- ; Print the Register Values (21_Aug_84) ;-------------------------------------- ; Print_Registers: ld de,Mbc ld hl,(Save_BC) call Print_Number ;Print The BC Register Pair ld de,Mde ld hl,(Save_DE) call Print_Number ;Print The DE Register Pair ld de,Mhl ld hl,(Save_HL) call Print_Number ;Print the HL Register Pair ld de,Msp ld hl,(Save_SP) call Print_Number ;Print the Stack Pointer ld de,NewLin ld c,Bdos_PString call Next ;Print a New Line ret ;Return ;---------------------------------------------------------------------- ; Print a Number in Hex (21_Aug_84) ;---------------------------------- ; Print_Number: push hl ld c,Bdos_PString ;C:= Bdos Print String Function call Next ;Print the PreAmble String pop hl push hl ld a,h call Print_Byte ;Print the High-Order Byte pop hl ld a,l call Print_Byte ;Print the Lo-Order Byte ret ;Return ;---------------------------------------------------------------------- ; Print the hex value of the accumulator ;--------------------------------------- ; Print_Byte: push af ;save value rrca ;get upper nibble rrca rrca rrca and 0Fh ;mask off the rest call OutAsc ;print ascii hex digit pop af ;get value back and 0Fh ;mask call OutAsc ;print ascii hex digit ret ;Output the lower nibble of the accumulator as a hex digit. OutAsc: cp 0Ah ;see if digit or alpha jp m,num ;jump if digit add a,07h ;adjust for alpha num: add a,30h ;convert to ascii ld e,a ld c,Bdos_ConOut call Next ;Print it ret page ;---------------------------------------------------------------------- ; Message String Lookup Table (21_Aug_84) ;----------------------------------------- ; Message_Table: db 0 ;System Reset dw m0 db 1 ;Console Input dw m1 db 2 ;Console Output dw 0 ;*** Suppressed *** dw m2 db 3 ;Aux Input dw m3 db 4 ;Aux Ouput dw m4 db 5 ;List Output dw m5 db 6 ;Direct Console I/O dw m6 db 7 ;Aux Input Status dw m7 db 8 ;Aux Output Status dw m8 db 9 ;Print String dw m9 db 10 ;Read Console Buffer dw m10 db 11 ;Get Console Status dw m11 ;0 ;*** Suppressed *** dw m11 db 12 ;Return Version Number dw m12 db 13 ;Reset Disk System dw m13 db 14 ;Select Disk dw m14 db 15 ;Open File dw m15 db 16 ;Close File dw m16 db 17 ;Search for First dw m17 db 18 ;Search for Next dw m18 db 19 ;Delete File dw m19 db 20 ;Read Sequential dw m20 db 21 ;Write Sequential dw m21 db 22 ;Make File dw m22 db 23 ;Rename File dw m23 db 24 ;Return Login Vector dw m24 db 25 ;Return Current Disk dw m25 db 26 ;Set Dma Address dw m26 db 27 ;Get Address of Allocation Vector dw m27 db 28 ;Write Protect Disk dw m28 db 29 ;Get R/O Vector dw m29 db 30 ;Set File Attributes dw m30 db 31 ;Get Address of Dpb dw m31 db 32 ;Set/Get User Code dw m32 db 33 ;Read Random dw m33 db 34 ;Write Random dw m34 db 35 ;Compute File Size dw m35 db 36 ;Set Random Record dw m36 db 37 ;Reset Drive dw m37 db 38 ;Access Drive dw m38 db 39 ;Free Drive dw m39 db 40 ;Write Random with zero fill dw m40 db 41 ;Test and Write Record dw m41 db 42 ;Lock Record dw m42 db 43 ;Unlock Record dw m43 db 44 ;Set Multi-Sector Count dw m44 db 45 ;Set BDOS Error Mode dw m45 db 46 ;Get Disk Free Space dw m46 db 47 ;Chain to Program dw m47 db 48 ;Flush Buffers dw m48 db 49 ;Get/Set System Control Block dw m49 db 50 ;Direct Bios Call dw m50 db 59 ;Load Overlay dw m59 db 60 ;Call Resident System Extension dw m60 db 98 ;Free Blocks dw m98 db 99 ;Truncate File dw m99 db 100 ;Set Director Label dw m100 db 101 ;Return Directory Label Data dw m101 db 102 ;Read File Date Stamps and Password Mode dw m102 db 103 ;Write File XFCB dw m103 db 104 ;Set Date and Time dw m104 db 105 ;Get Date and Time dw m105 db 106 ;Set Default Password dw m106 db 107 ;Return Serial Number dw m107 db 108 ;Get/Set Program Return Code dw m108 db 109 ;Get/Set Console Mode dw m109 db 110 ;Get/Set Output Delimiter dw m110 dâ 11± ;Prinô Block dw m111 db 112 ;List Block dw m112 db 152 ;Parse Filename dw m152 End_Table: Max_Message equ ( (End_Table - Message_Table)/3 ) + 1 ;---------------------------------------------------------------------- ; Text Strings (21_Aug_84) ;------------------------- ; m0: db 'System Reset $' m1: db 'Console Input $' m2: db 'Console Output $' m3: db 'Auxiliary Input $' m4: db 'Auxiliary Output $' m5: db 'List Output $' m6: db 'Direct Console I/O $' m7: db 'Auxiliary Input Status $' m8: db 'Auxiliary Output Status $' m9: db 'Print String $' m10: db 'Read Console Buffer $' m11: db 'Get Console Status $' m12: db 'Return Version Number $' m13: db 'Reset Disk System $' m14: db 'Select Disk $' m15: db 'Open File $' m16: db 'Close File $' m17: db 'Search for First $' m18: db 'Search for Next $' m19: db 'Delete File $' m20: db 'Read Sequential $' m21: db 'Write Sequential $' m22: db 'Make File $' m23: db 'Rename File $' m24: db 'Return Login Vector $' m25: db 'Return Current Disk $' m26: db 'Set Dma Address $' m27: db 'Get Addr (Alloc) $' m28: db 'Write Protect Disk $' m29: db 'Get R/O Vector $' m30: db 'Set File Attributes $' m31: db 'Get Addr (Dpb) $' m32: db 'Set/Get User Code $' m33: db 'Read Random $' m34: db 'Write Random $' m35: db 'Compute File Size $' m36: db 'Set Random Record $' m37: db 'Reset Drive $' m38: db 'Access Drive $' m39: db 'Free Drive $' m40: db 'Write Random with Zero Fill $' m41: db 'Test and Write Record $' m42: db 'Lock Record $' m43: db 'Unlock Record $' m44: db 'Set Multi-Sector Count $' m45: db 'Set BDOS Error Mode $' m46: db 'Get Disk Free Space $' m47: db 'Chain to Program $' m48: db 'Flush Buffers $' m49: db 'Get/Set System Control Block $' m50: db 'Direct BIOS Call $' m59: db 'Load Overlay $' m60: db 'Call Resident System Extension $' m98: db 'Free Blocks $' m99: db 'Truncate File $' m100: db 'Set Directory Label $' m101: db 'Return Directory Label Data $' m102: db 'Read File Date Stamps $' m103: db 'Write File XFCB $' m104: db 'Set Date and Time $' m105: db 'Get Date and Time $' m106: db 'Set Default Password $' m107: db 'Return Serial Number $' m108: db 'Get/Set Program Return Code $' m109: db 'Get/Set Console Mode $' m110: db 'Get/Set Output Delimiter $' m111: db 'Print Block $' m112: db 'List Block $' m152: db 'Parse Filename $' NoCode: db 'Unrecognized Function Call $' Mbc: db Tab,'bc-$' Mde: db Tab,'de-$' Mhl: db Tab,'hl-$' Msp: db Tab,'sp-$' mStart: db Cr,Lf,'$' NewLin: db Cr,Lf,'$' page ;---------------------------------------------------------------------- ; Data Area (21_Aug_84) ;---------------------- ; Save_A: db 0 Save_BC: dw 0 Save_DE: dw 0 Save_HL: dw 0 Save_SP: dw 0 Old_Stack: dw 0 ds 10h,0 Stack: db 0 end