Blame | Last modification | View Log | Download | RSS feed
Tue Jul 17 11:00:24 2018 Page 1
2500 A.D. 65816 Macro Assembler #26960 - Version 5.02g
-----------------------------------------------------
Input Filename : src\FF\monitor.asm
Output Filename : obj\FF\monitor.obj
Listing Has Been Relocated
2593 .LIST on
2594
2595 F8FFB1 .INCLUDE inc\dirp00.inc
2596 ;----------------------------------------------------------
2597 ; DIRP00.ASM
2598 ; PROGETTO: B1601
2599 ;
2600 ; Variabili in Direct Page $00
2601 ;----------------------------------------------------------
2602
2603 ; sezione COMMON -- questo permette di includere il file in piu' file
2604
2605 .LIST on
2606
2607 DIRP00: .SECTION page0, ref_only, common ;Direct-Page 00
2608
2609 000000 .ABSOLUTE ;; inizia sempre da $00
2610 000000 .ORG 0x00
2611 000000
2612 000000 0000 JiffyClk .DW ; contatore 10ms 32 bit
2613 000002 0000 .DW
2614 000004 SysTmr .DS SYSTMRCNT ; system timer 0 (10ms)
2615 000008 SysTMF .DS SYSTMRCNT ; flag timer (80 -> start)
2616 00000C 00 Bnk0Flag .DB ; <7>: flag test RAM banco 0 ok
2617 ; <6>: flag warm reset
2618 00000D 00 RTCFlag .DB
2619
2620 00000E diskstat .DS 2 ; flag device on ata bus #0 & #1
2621 ; <7>: device ready
2622 ; <6>: compact flash device (C.F.)
2623 ; <5>: device identification ok
2624 ; <4>: MBR loaded
2625 ; <3>: valid signature in MBR
2626 ; <2>: first partition found&active
2627 ; <1>:
2628 ; <0>: valid partition flag
2629
2630 ; <7>: device ready
2631 ; <6>: USB device
2632 ; <5>: compact flash device (C.F.)
2633 ; <4>: device identification ok
2634 ; <3>: MBR loaded
2635 ; <2>: first partition found&active
2636 ; <1>: always 1
2637 ; <0>: valid partition flag
2638 000010
Tue Jul 17 11:00:24 2018 Page 2
2639
2640 00000E atadev .EQU diskstat
2641
2642 000010 usbdev .DS 2 ; flag flash disk on usb bus #0
2643 ; <7>: device plugged and ready
2644 ; <6>: always 1
2645 ; <5>: device identification ok
2646 ; <4>: MBR loaded
2647 ; <3>: valid signature in MBR
2648 ; <2>: first partition found&active
2649 ; <1>:
2650 ; <0>: valid partition flag
2651
2652 000012 diskmax .DS 16 ; disk max. sector's
2653 000012 atasec .EQU diskmax
2654 00001A usbsec .EQU diskmax+8
2655
2656
2657 000022 atambr .DS 8 ; data for first partition found in mbr
2658 ; first 3 bytes for start sector of partition
2659 ; last byte for partition type
2660 00002A usbmbr .DS 8
2661
2662 000032 ataprt .DS 8 ; total sec's of first partition
2663 00003A usbprt .DS 8 ; total sec's of first partition
2664
2665
2666 000042 00 usb0ch .DB ; usb0 (ch375/ch376) flag
2667 ; <7>: module on
2668 ; <6>: ch376 flag
2669 ; <5:0>: chip version
2670
2671 000043 00 usb0st .DB ; usb0 status
2672 ; <7>: usb0 host mode ok
2673 ; <6>: flash disk attached flag
2674 ; <5>: usb device attached
2675
2676 000044 00 fdcdrv .DB ; phisycal drive status (drive #0)
2677 ; <7>: disk format established in bit 0&1
2678 ; <6>: double step seek done
2679 ; <5>: trust format bit's (set after ok r/w)
2680 ; <4>: write protect bit (if disk in drive)
2681 ; <3>: don't care
2682 ; <2>: don't care
2683 ; <1>: HD disk if set else DD disk
2684 ; <0>: CBM format if set else IBM format
2685
2686 000045 00 vdrive .DB ; virtual drive status (ram disk, drive #1)
2687 ; <7>: disk format established in bit 0&1
2688 ; <6>: change disk simulation (after format)
2689 ; <5>: don't care
2690 ; <4>: write protect bit (under sw control)
2691 ; <3>: don't care
2692 ; <2>: don't care
2693 ; <1>: HD disk if set else DD disk
2694 ; <0>: CBM format if set else IBM format
2695
Tue Jul 17 11:00:24 2018 Page 3
2696 000046 00 fdcctl .DB ; fdc controller status
2697 ; <7>: drive is attached
2698 ; <6>: drive need recalibration (restore)
2699 ; <5>: FDC controller ok
2700 ; <4>: motor on
2701 ; <3>: dma is active
2702 ; <2>: dma chip ok (post routine)
2703 ; <1>: clock rate (1=HD,0=DD)
2704 ; <0>: disk ready
2705
2706 000047 00 fdctrk .DB ; fd: current seek track
2707 000048 00 fdcerr .DB ; fd: last error code
2708 000049 00 ataerr .DB ; ata: last error code
2709 00004A 00 ataxer .DB ; ata: last extended error code
2710
2711 00004B 00 CtrlBrk .DB ; flag CTRL+BREAK (NMI)
2712
2713 00004C 0000 MemTop .DW ; top memoria RAM
2714 00004E 00 .DB ; banco top mem
2715
2716 00004F 00 DflTxtIn .DB ; device di default text input
2717 000050 00 DflTxtOut .DB ; device di default text output
2718
2719 000051 COPPtr LP ; long pointer for COP decoding
2720 000054 00 COPIdx .DB ; COP signature/index
2721
2722 000055 00 BiosEnt .DB ; flag accesso a bios setup
2723
2724 ; variabili utilizzate da ACIA
2725 000056 spwrk .DS $30
2726
2727 ; bios mem
2728 000086 0000 nsize .DW ; dimensione blocco da allocare
2729 ;bsize .DW ; dimensione vera blocco free
2730 000088 0000 splitsz .DW ; dimensione blocco splittato
2731 00008A 0000 bfree .DW ; puntatore blocco free
2732 00008C 0000 hdrptr .DW ; puntatore header heap
2733
2734 00008E 0000 pbrklv .DW ; current break level of current process
2735 000090 0000 pbrkmin .DW ; minimum breal level of current process
2736 000092 0000 pbrkmax .DW ; maximum breal level of current process
2737 000094
2738 ; bios temp. work area
2739 000094 bwrktmp .DS $28
2740
2741 0000BC 00 coptmp .DB ; temp. used while cop
2742
2743 0000BD 00 tstser .DB ; check ser/usb test board post
2744 ; <7>: VIA2 ok
2745 ; <6>: PICRAM ok
2746 ; <1>: UART 16C550 ok
2747 ; <0>: R65C51 ok
2748
2749
2750 ;crc16 .DW
2751
2752 0000BD .RELATIVE
Tue Jul 17 11:00:24 2018 Page 4
2753
2754 .ENDS
2755
2756 [01] .IFDEF _ACIA_INC_
2757 .INCLUDE INC\SP.INC
2758 [00] .ENDIF
2759
2773 .LIST on
2774
2775 000060 KBDBUFLEN .EQU 96 ; dimensione buffer di tastiera
2776
2777 DIRP01: .SECTION page0, ref_only, common ;Direct-Page 01
2778
2779 000000 .ABSOLUTE ;; inizia sempre da $00
2780 000000 .ORG 0x00
2781
2782 000000
2783 000000 KbdBuf .DS KBDBUFLEN ; buffer della tastiera
2784 000060 00 KbdITail .DB ; coda buffer tastiera
2785 000061 00 KbdIHead .DB ; testa buffer tastiera
2786 000062 00 KbdCnt .DB ; numero bytes nel buffer
2787 000063 00 KbdShift .DB
2788 000064 00 KbdFlag .DB
2789 000065 00 KbdToggle .DB
2790 000066 00 KbdSt .DB ; status tastiera dopo reset
2791 000067 00 PS2Ctl .DB ; flag controller PS2 keyboard
2792
2793 000068 00 LCDFlag .DB
2794 000069 00 LCDTmp .DB
2795 00006A 0000 LCDVal .DW
2796
2797 00006C 00 VBBFlag .DB ; flag video board
2798 00006D 00 VBBRam .DB ; flag video RAM
2799
2800 00006E 00 ScnLinTmp .DB
2801 00006F 00 ScnChBase .DB ; base video ram VDC
2802 000070 00 ScnAttBase .DB ; base ram attributi VDC
2803 000071 00 ScnCursMode .DB ; VDC cursore default
2804 000072 00 ScnSaveAttr .DB
2805 000073 00 ScnInsert .DB
2806 000074 00 ScnAutoIns .DB ; bit 7 -> autoins - bit 6 -> modo input
2807 000075 00 ScnScroll .DB
2808 000076 00 ScnMaxRow .DB ; max. righe finestra (-1)
2809 000077 00 ScnMaxCols .DB ; max. colonne finestra (-1)
2810
2811 000078 ScnMapTabs1 .DS 10
2812 000082 ScnMapTabs2 .DS 4
2813 000086
2814 000086 0000 ScnPtr .DW ; puntatore video ram linea corrente
2815 000088 00 .DB
2816
2817 000089 00 ScnFiltLen .DB ; lunghezza set caratteri filtro
2818
2819 00008A 0000 ScnAtPtr .DW ; puntatore attributi ram linea corrente
2820 00008C 00 .DB
2821
2822 00008D 00 ScnTmpx .DB ; temporaneo: durante put char
Tue Jul 17 11:00:24 2018 Page 5
2823 00008E
2824 00008E 00 ScnTop .DB ; riga superiore finestra
2825 00008F 00 ScnLeft .DB ; colonna sinistra finestra
2826 000090 00 ScnBottom .DB ; riga inferiore finestra
2827 000091 00 ScnRight .DB ; colonna destra finestra
2828 000092 00 ScnAttr .DB ; attributo default
2829 000093 00 ScnAttr2 .DB ; attributo alternativo
2830 000094 00 ScnRow .DB ; riga cursore
2831 000095 00 ScnCol .DB ; colonna cursore
2832 000096 00 ScnRowStart .DB ; riga di start input
2833 000097 00 ScnInput .DB ; riga di fine input
2834 000098 00 ScnColStart .DB ; colonna di start input
2835 000099 00 ScnSaveX .DB
2836 00009A 00 ScnSaveY .DB
2837 00009B 00 ScnTmpL .DB
2838 00009C 00 ScnTmpH .DB
2839 00009D 00 ScnSaveRow .DB
2840 00009E 00 ScnSaveCol .DB
2841 00009F 00 ScnCurChr .DB
2842 0000A0 00 ScnLstChr .DB
2843 0000A1 00 ScnCR .DB
2844 0000A2 0000 ScnPrm .DW ; puntatore long utilizzato da print imm
2845 0000A4 00 .DB ; banco puntatore ScnPrm
2846 0000A5 00 ScnMode .DB ; flag modo schermo
2847
2848 0000A6 ScnPtr1 LP
2849
2850 0000A9 00 ScnDefCol .DB ; default foreground color
2851
2852 0000AA ScnPtr2 LP
2853
2854 0000AD 00 ScnDefBkgCol .DB ; default background color
2855 0000AE 00 ScnInpRow .DB ; modo input line: riga start input
2856 0000AF 00 ScnInpCol .DB ; modo input line: colonna start input
2857 0000B0 00 ScnLstRow .DB ; modo input line: riga stop input
2858 0000B1 00 ScnLstCol .DB ; modo input line: colonna stop input
2859 0000B2 00 ScnFlag .DB ; Bit 7: input line - Bit 6: input riga unica
2860 0000B3 00 ScnMask .DB ; flag tasti funzione editor di linea
2861 0000B4 00 ScnFilt .DB ; filtro tasti editor di linea
2862 0000B5 00 ScnCntrl .DB ; flag ASCII/CONTROL
2863 ;DflTxtIn .DB ; device di default text input
2864 ;DflTxtOut .DB ; device di default text output
2865 0000B6
2866 000047 SCNCLRLEN .EQU ($ - ScnLinTmp - 1)
2867
2868 ;SCNCLRLEN .EQU (DflTxtOut - ScnLinTmp)
2869
2870 ; variabili monitor
2871 0000B6 00 SMAddrL .DB ; address low/high
2872 0000B7 00 SMAddrH .DB
2873 0000B8 00 SMAddrK .DB ; address bank
2874 0000B9 00 SMFlag32 .DB ; flag parametro 32 bit
2875 0000BA 00 SMTmpL .DB ; temp. low/high
2876 0000BB 00 SMTmpH .DB
2877 0000BC 00 SMTmpK .DB ; temp. bank
2878 0000BD 00 SMTmpKK .DB ; high byte param. 32 bit
2879 0000BE 00 SMSizeL .DB ; size low/high
Tue Jul 17 11:00:24 2018 Page 6
2880 0000BF 00 SMSizeH .DB
2881 0000C0 00 SMSizeK .DB ; size bank
2882 0000C1 00 SMXAddrL .DB ; address low/high XM
2883 0000C2 00 SMXAddrH .DB
2884 0000C3 00 SMXAddrK .DB ; address bank XM
2885 0000C4 00 SMbndx .DB ; indice input buffer
2886 0000C5 00 SMnprm .DB ; numero parametri riga di comando
2887 0000C6 00 SMdumb .DB
2888 0000C7 00 SMkr .DB
2889 0000C8 0000 SMpc .DW
2890 0000CA 00 SMsr .DB
2891 0000CB 00 SMbr .DB
2892 0000CC 0000 SMdp .DW
2893 0000CE 0000 SMac .DW
2894 0000D0 0000 SMxr .DW
2895 0000D2 0000 SMyr .DW
2896 0000D4 0000 SMsp .DW
2897
2898 0000D6 00 SMAuxL .DB
2899 0000D7 00 SMAuxH .DB
2900
2901 0000D8 00 asmlong .DB ; flag for CPU in 16 mode
2902 ; <7> -> A/M in 16 bit mode
2903 ; <6> -> X/Y in 16 bit mode
2904 0000D9 00 asmcpu .DB ; <7> -> 8 bit family
2905 ; <6> -> 65C02 cmos version
2906
2907 0000DA 00 SMctx .DB ; context (if = $00 no quit command)
2908 0000DB SMrsm LP ; long pointer to resume caller context
2909
2910 0000DE 00 rtcadr .DB ; rtc internal ram address
2911 0000DF 00 rtcbnk .DB ; RTC internal bank ram
2912 0000E0 00 cmdlin .DB ;
2913 0000E1 00 SMesc .DB
2914
2915 0000E2 SMXTmp: .DS 26 ; 26 bytes tmp
2916
2917 0000E2 SMTmp2 .EQU SMXTmp
2918 0000E4 SMTmp3 .EQU SMXTmp+2
2919 0000E6 SMdwTmp1 .EQU SMXTmp+4
2920 0000EA SMdwTmp2 .EQU SMXTmp+8
2921 0000EE SMFsrc .EQU SMXTmp+12 ; source bank for flash update
2922 0000EF SMFflag .EQU SMXTmp+13 ; flag file for flash update
2923 0000F0 SMXPos2 .EQU SMXTmp+14
2924 0000F1 SMYPos2 .EQU SMXTmp+15
2925 0000F2 SMXPos3 .EQU SMXTmp+16
2926 0000F3 SMYPos3 .EQU SMXTmp+17
2927 ;SMAuxL .EQU SMXTmp+18
2928 ;SMAuxH .EQU SMXTmp+19
2929 0000F6 SMXPos .EQU SMXTmp+20
2930 0000F7 SMYPos .EQU SMXTmp+21
2931 0000F8 SMdwTmp3 .EQU SMXTmp+22
2932
2933 0000E2 atcmd .EQU SMXTmp ; save @ command
2934 0000E3 atnum .EQU SMXTmp+1 ; @ command index
2935 0000E4 atflag .EQU SMXTmp+2 ; @ L,S,V,R,W start address flag
2936 0000E5 atbnk .EQU SMXTmp+3 ; @ L,S,V,R,W bank
Tue Jul 17 11:00:24 2018 Page 7
2937 0000E6 atstr .EQU SMXTmp+4 ; @ command string start (word)
2938 0000E8 atstart .EQU SMXTmp+6 ; @ L,S,V,R,W start address (word)
2939 0000EA atend .EQU SMXTmp+8 ; @ S,W end address (word)
2940 0000EC atbuf .EQU SMXTmp+10 ; @ local buffer pointer (word)
2941 0000EE atipb .EQU SMXTmp+12 ; @ bank of input buffer
2942 0000EF atdir .EQU SMXTmp+13 ; @ load dir flag
2943 0000F0 atptr .EQU SMXTmp+14 ; @ load dir pointer (word)
2944 0000F2 atsiz .EQU SMXTmp+16 ; @ buffer size (word)
2945 0000F5 atlp .EQU SMXTmp+19 ; @ long pointer
2946 0000F8 atsa .EQU SMXTmp+22 ; @ sa
2947
2948 0000E2 btmpx .EQU SMXTmp ; asc2bin conversion
2949 0000E3 brtcsec .EQU SMXTmp+1
2950 0000E4 brtcmin .EQU SMXTmp+2
2951 0000E5 brtchour .EQU SMXTmp+3
2952 0000E6 brtcday .EQU SMXTmp+4
2953 0000E7 brtcmonth .EQU SMXTmp+5
2954 0000E8 brtcyear .EQU SMXTmp+6
2955 0000E9 brtcct .EQU SMXTmp+7
2956
2957
2958 0000FC .RELATIVE
2959
2960 .ENDS
2961
2965 .LIST on
2966
2967 .EXTERN qedtent
2968
2969 .MONSEG
2970 .LONGA off
2971 .LONGI off
2972
2973 ; $FF0000 - standard entry monitor
2974 FF0000 4C 6E 00 jmp _SysMon
2975
2976 ; $FF0003 - entry monitor after reset
2977 FF0003 4C 6A 00 jmp _mon0
2978 FF0006
2979 ; $FF0006 - entry monitor after brk
2980 FF0006 4C 0E 00 jmp _SysBreak
2981 FF0009
2982 ; $FF0009 - entry monitor after sys request
2983 FF0009 A9 FF lda #$FF
2984 FF000B 4C 10 00 jmp _SysBreak2
2985 FF000E
2986 .CODEFF
2987 FF000E
2988 0001E2 SMTMP2 .EQU (DP01ADDR + SMTmp2)
2989 0001B6 SMADDRL .EQU (DP01ADDR + SMAddrL)
2990
2991 019900 INPUTBUF .EQU MONBUF
2992 0000A2 INPBUFLEN .EQU $A2
2993
2994 .LONGA off
2995 .LONGI off
2996 FF000E
Tue Jul 17 11:00:24 2018 Page 8
2997 .GLOBAL _SysMon, _SysBreak
2998 .GLOBAL ErrCls2, GetParm, PrintByte, PrintHex, GetParm32, CkStop
2999 .GLOBAL PrintWord, PrintAddr, PrintHex, TmpToAddr, GetParm, DecTmpPtrA
3000 .GLOBAL SubTmpAddr, PrintHex1, GetCurCh, FF_Byte2Hex
3001
3002 .EXTERN matcmd, atacmd, Cmd_d, Cmd_a
3003 FF000E
3004 .EXTERN Cmd_fddisk, Cmd_fdgetfmt, Cmd_fdres, Cmd_fdinit, Cmd_fdformat
3005 .EXTERN Cmd_fdverfmt, Cmd_fdread, Cmd_fdwrite, Cmd_fdverf, Cmd_fdnew
3006 .EXTERN Cmd_fdtread, Cmd_fdtwrite, Cmd_fdtverf, Cmd_fdfs, Cmd_fdlsys
3007 .EXTERN Cmd_mkhash, Cmd_sptst, Cmd_asptst
3008
3009 FF000E
3010 ; BRK entry
3011 ; descrizione stack:
3012 ;
3013 ; KR -> SP + 13
3014 ; PCH -> SP + 12
3015 ; PCL -> SP + 11
3016 ; SR -> SP + 10
3017 ; A -> SP + 8
3018 ; X -> SP + 6
3019 ; Y -> SP + 4
3020 ; DPR -> SP + 2
3021 ; DBR -> SP + 1
3022
3023 FF000E _SysBreak:
3024 FF000E A9 00 lda #0
3025 FF0010 _SysBreak2:
3026 FF0010 A8 tay ; save context
3027 FF0011 CPU16
3028 FF0011 C2 30 rep #(PMFLAG.OR.PXFLAG)
3029 .LONGA on
3030 .LONGI on
3031 .MNLIST
3032 FF0013 A9 00 01 lda #DP01ADDR ; imposta nuova DP
3033 FF0016 5B tcd
3034 FF0017 CPU08
3035 FF0017 E2 30 sep #(PMFLAG.OR.PXFLAG)
3036 .LONGA off
3037 .LONGI off
3038 .MNLIST
3039 FF0019 68 pla ; DBR
3040 FF001A 85 CB sta SMbr
3041 FF001C CPU16
3042 FF001C C2 30 rep #(PMFLAG.OR.PXFLAG)
3043 .LONGA on
3044 .LONGI on
3045 .MNLIST
3046 FF001E 68 pla ; DPR
3047 FF001F 85 CC sta SMdp
3048 FF0021 68 pla
3049 FF0022 85 D2 sta SMyr
3050 FF0024 68 pla
3051 FF0025 85 D0 sta SMxr
3052 FF0027 68 pla
3053 FF0028 85 CE sta SMac
Tue Jul 17 11:00:24 2018 Page 9
3054 FF002A CPU08
3055 FF002A E2 30 sep #(PMFLAG.OR.PXFLAG)
3056 .LONGA off
3057 .LONGI off
3058 .MNLIST
3059 FF002C 68 pla
3060 FF002D 85 CA sta SMsr
3061 FF002F 68 pla
3062 FF0030 85 C8 sta SMpc ; PCL
3063 FF0032 68 pla
3064 FF0033 85 C9 sta SMpc+1 ; PCH
3065 FF0035 68 pla
3066 FF0036 85 C7 sta SMkr ; PBR (KR)
3067 FF0038 CPU16
3068 FF0038 C2 30 rep #(PMFLAG.OR.PXFLAG)
3069 .LONGA on
3070 .LONGI on
3071 .MNLIST
3072 FF003A BA tsx
3073 FF003B 86 D4 stx SMsp
3074 FF003D CPU08
3075 FF003D E2 30 sep #(PMFLAG.OR.PXFLAG)
3076 .LONGA off
3077 .LONGI off
3078 .MNLIST
3079 ;SCNINIT
3080
3081 FF003F 98 tya
3082 FF0040 D0 0B bne ?02
3083 ;SCNINIT
3084 FF0042 SCNPRINT
3085 FF0042 02 01 cop $01
3086 .MNLIST
3087 FF0044 0D 42 72 65 61 .DB KB_CR, 'Break', 0
6B 00
3088 FF004B 80 12 bra ?04
3089 FF004D ?02: SCNPRINT
3090 FF004D 02 01 cop $01
3091 .MNLIST
3092 FF004F 0D 53 79 73 74 .DB KB_CR, 'System Request', 0
65 6D 20 52 65
71 75 65 73 74
00
3093 FF005F 64 DA ?04: stz SMctx
3094 FF0061
3095 FF0061 9C 21 FC stz $FC21
3096 FF0064
3097 FF0064 58 cli
3098 FF0065 80 57 bra _SysMon2
3099 FF0067
3100 ; entry monitor con inizializzazione schermo
3101 FF0067 _SysMonClr:
3102 FF0067 SCNINIT
3103 FF0067 02 18 cop $18
3104 FF0069 00 .DB $00
3105 .MNLIST
3106
Tue Jul 17 11:00:24 2018 Page 10
3107 FF006A _mon0:
3108 FF006A CPU08
3109 FF006A E2 30 sep #(PMFLAG.OR.PXFLAG)
3110 .LONGA off
3111 .LONGI off
3112 .MNLIST
3113 FF006C A9 00 lda #0
3114 FF006E
3115 ; entry principale per monitor -- called from user program/reset
3116 FF006E _SysMon:
3117 FF006E A8 tay ; save context
3118 FF006F CPU16
3119 FF006F C2 30 rep #(PMFLAG.OR.PXFLAG)
3120 .LONGA on
3121 .LONGI on
3122 .MNLIST
3123 FF0071 A9 00 01 lda #DP01ADDR ; imposta nuova DP
3124 FF0074 5B tcd
3125 FF0075 85 CC sta SMdp
3126 FF0077 64 CE stz SMac
3127 FF0079 64 D0 stz SMxr
3128 FF007B 64 D2 stz SMyr
3129 FF007D BA tsx
3130 FF007E 86 D4 stx SMsp
3131 FF0080 A9 6E 00 lda #_SysMon
3132 FF0083 85 C8 sta SMpc
3133 FF0085 CPU08
3134 FF0085 E2 30 sep #(PMFLAG.OR.PXFLAG)
3135 .LONGA off
3136 .LONGI off
3137 .MNLIST
3138 FF0087 A9 00 lda #0
3139 FF0089 48 pha
3140 FF008A AB plb
3141 FF008B 85 CB sta SMbr
3142 FF008D 4B phk
3143 FF008E 68 pla
3144 FF008F 85 C7 sta SMkr
3145 FF0091 08 php
3146 FF0092 68 pla
3147 FF0093 85 CA sta SMsr
3148 FF0095 8D 0C FC sta CREMEOFF
3149 FF0098 8D 0A FC sta CRXMEOFF
3150 FF009B 8D 08 FC sta CRXFEOFF
3151 FF009E 98 tya
3152 FF009F 85 DA sta SMctx ; save context
3153 FF00A1 F0 0B beq ?02
3154 FF00A3 ACC16
3155 FF00A3 C2 20 rep #PMFLAG
3156 .LONGA on
3157 .MNLIST
3158 FF00A5 68 pla
3159 FF00A6 1A inc a
3160 FF00A7 85 DB sta SMrsm ; save resume address
3161 FF00A9 ACC08
3162 FF00A9 E2 20 sep #PMFLAG
3163 .LONGA off
Tue Jul 17 11:00:24 2018 Page 11
3164 .MNLIST
3165 FF00AB 68 pla
3166 FF00AC 85 DD sta SMrsm+2
3167 FF00AE
3168 FF00AE ?02: SCNPRINT
3169 FF00AE 02 01 cop $01
3170 .MNLIST
3171 FF00B0
3172 FF00B0 0D 4D 6F 6E 69 .DB KB_CR, 'Monitor v1.2', 0
74 6F 72 20 76
31 2E 32 00
3173 FF00BE
3174 FF00BE _SysMon2:
3175 FF00BE D8 cld
3176 FF00BF 64 C6 stz SMdumb
3177 FF00C1 20 82 0C jsr PrintReg
3178
3179 FF00C4 GetCmd:
3180 FF00C4 SCN_CR
3181 FF00C4 SCNPRCHAR
3182 .MLIST
3183 FF00C4 02 07 cop $07
3184 .MNLIST
3185 FF00C6 0D .DB $0D
3186 .MNLIST
3187 FF00C7 64 E1 stz SMesc
3188 FF00C9 A2 00 ldx #0
3189 FF00CB 86 C4 stx SMbndx
3190 FF00CD CA dex
3191 FF00CE E8 ?01: inx ; ciclo input
3192 FF00CF E0 A2 cpx #INPBUFLEN
3193 FF00D1 B0 63 bcs SMError
3194 FF00D3 KBCHARIN ; input tastiera
3195 FF00D3 02 0F cop $0F
3196 .MNLIST
3197 FF00D5 9F 00 99 01 sta INPUTBUF,x
3198 FF00D9 C9 0D cmp #KB_CR
3199 FF00DB D0 F1 bne ?01
3200 FF00DD A9 00 lda #0
3201 FF00DF 9F 00 99 01 sta INPUTBUF,x
3202 FF00E3 20 48 1A ?02: jsr GetCurCh ; get char da buffer
3203 FF00E6 F0 DC beq GetCmd ; fine linea
3204 FF00E8 C9 20 cmp #' '
3205 FF00EA F0 F7 beq ?02 ; skip spazi
3206 FF00EC C9 23 cmp #'#'
3207 FF00EE D0 02 bne ?02w
3208 FF00F0 C6 E1 dec SMesc
3209 FF00F2 20 DF 01 ?02w: jsr pfxcmd ; check prefix command
3210 FF00F5 A6 C4 ldx SMbndx ; salva indice corrente
3211 FF00F7 CA dex
3212 FF00F8 86 D7 stx SMAuxH
3213 FF00FA A0 00 ldy #0 ; indice comando
3214 FF00FC BB tyx ; indice tabella comandi
3215 FF00FD INDEX16
3216 FF00FD C2 10 rep #PXFLAG
3217 .LONGI on
3218 .MNLIST
Tue Jul 17 11:00:24 2018 Page 12
3219 FF00FF A5 D7 ?02a: lda SMAuxH ; ripristina indice buffer
3220 FF0101 85 C4 sta SMbndx
3221 FF0103 DA ?02b: phx
3222 FF0104 INDEX08
3223 FF0104 E2 10 sep #PXFLAG
3224 .LONGI off
3225 .MNLIST
3226 FF0106 20 48 1A jsr GetCurCh ; get char
3227 FF0109 INDEX16
3228 FF0109 C2 10 rep #PXFLAG
3229 .LONGI on
3230 .MNLIST
3231 FF010B FA plx
3232 ;beq SMError ; ERRORE
3233 FF010C 5F 41 03 FF eor CMDTBL,x ; cerca comando interno
3234 FF0110 F0 16 beq ?10 ; test carattere ok
3235 FF0112 C9 80 cmp #$80 ; comando trovato - fine
3236 FF0114 F0 15 beq ?11
3237 FF0116 C8 iny ; next command
3238 FF0117 E8 ?09: inx
3239 FF0118 BF 40 03 FF lda CMDTBL-1,x ; cerca fine stringa
3240 FF011C 10 F9 bpl ?09
3241 FF011E BF 41 03 FF lda CMDTBL,x ; test fine tabella comandi
3242 FF0122 D0 DB bne ?02a ; continua scan
3243 FF0124 INDEX08
3244 FF0124 E2 10 sep #PXFLAG
3245 .LONGI off
3246 .MNLIST
3247 FF0126 F0 0E beq SMError ; comando interno non trovato
3248 FF0128 E8 ?10: inx
3249 FF0129 D0 D8 bne ?02b ; continua scan stringa attuale
3250 FF012B ?11: INDEX08
3251 FF012B E2 10 sep #PXFLAG
3252 .LONGI off
3253 .MNLIST
3254 FF012D 20 BD 01 jsr ExecCmd
3255 FF0130 80 92 bra GetCmd
3256 FF0132
3257 FF0132 ErrCls4:
3258 FF0132 68 pla
3259 FF0133 68 pla
3260 FF0134 ErrCls2:
3261 FF0134 68 pla
3262 FF0135 68 pla
3263 FF0136
3264 FF0136 SMError:
3265 FF0136 SCNPRINT
3266 FF0136 02 01 cop $01
3267 .MNLIST
3268 FF0138
3269 FF0138 02 3F 00 .DB SCN_CSRRIGHT, '?', 0
3270 FF013B
3271 FF013B 80 87 bra GetCmd
3272
3273 ; set program counter
3274 FF013D _setpc:
3275 FF013D B0 0C bcs ?02
Tue Jul 17 11:00:24 2018 Page 13
3276 FF013F A5 BC lda SMTmpK
3277 FF0141 85 C7 sta SMkr
3278 FF0143 A5 BB lda SMTmpH
3279 FF0145 85 C9 sta SMpc+1
3280 FF0147 A5 BA lda SMTmpL
3281 FF0149 85 C8 sta SMpc
3282 FF014B A5 C7 ?02: lda SMkr
3283 FF014D C9 08 cmp #$08 ; test bank
3284 FF014F 90 E3 bcc ErrCls2
3285 FF0151 60 rts
3286
3287 FF0152 GetParm32:
3288 FF0152 A9 80 lda #$80
3289 FF0154 85 B9 sta SMFlag32
3290 FF0156 80 04 bra GetParm2
3291 FF0158
3292 FF0158 GetParm0:
3293 FF0158 C6 C4 dec SMbndx
3294 FF015A
3295 FF015A GetParm:
3296 FF015A 64 B9 stz SMFlag32
3297
3298 FF015C GetParm2:
3299 FF015C A5 C4 lda SMbndx
3300 FF015E 85 E0 sta cmdlin ; save start of command line
3301 FF0160 64 BA stz SMTmpL
3302 FF0162 64 BB stz SMTmpH
3303 FF0164 64 BC stz SMTmpK
3304 FF0166 64 BD stz SMTmpKK
3305 FF0168 64 C5 stz SMnprm
3306 FF016A 20 48 1A ?01: jsr GetCurCh
3307 FF016D F0 4D beq ?11
3308 FF016F C9 20 cmp #' '
3309 FF0171 F0 F7 beq ?01
3310 FF0173 C9 20 ?03: cmp #' '
3311 FF0175 F0 42 beq ?10
3312 FF0177 C9 2C cmp #','
3313 FF0179 F0 3E beq ?10
3314 FF017B C9 30 cmp #'0'
3315 FF017D 90 B3 bcc ErrCls4
3316 FF017F C9 61 cmp #'a'
3317 FF0181 90 07 bcc ?05
3318 FF0183 C9 7B cmp #('z' + 1)
3319 FF0185 B0 03 bcs ?05
3320 FF0187 38 sec
3321 FF0188 E9 20 sbc #$20
3322 FF018A C9 47 ?05: cmp #'G'
3323 FF018C B0 A4 bcs ErrCls4
3324 FF018E C9 3A cmp #':'
3325 FF0190 90 06 bcc ?07
3326 FF0192 C9 41 cmp #'A'
3327 FF0194 90 9C bcc ErrCls4
3328 FF0196 E9 08 sbc #$08
3329 FF0198 E9 2F ?07: sbc #$2F
3330 FF019A 0A asl a
3331 FF019B 0A asl a
3332 FF019C 0A asl a
Tue Jul 17 11:00:24 2018 Page 14
3333 FF019D 0A asl a
3334 FF019E DA phx
3335 FF019F A2 04 ldx #4
3336 FF01A1 0A ?08: asl a
3337 FF01A2 26 BA rol SMTmpL
3338 FF01A4 26 BB rol SMTmpH
3339 FF01A6 26 BC rol SMTmpK
3340 FF01A8 24 B9 bit SMFlag32 ; test valore 32 bit
3341 FF01AA 10 02 bpl ?09
3342 FF01AC 26 BD rol SMTmpKK
3343 FF01AE CA ?09: dex
3344 FF01AF D0 F0 bne ?08
3345 FF01B1 FA plx
3346 FF01B2 E6 C5 inc SMnprm
3347 FF01B4 20 48 1A jsr GetCurCh
3348 FF01B7 D0 BA bne ?03
3349 FF01B9 18 ?10: clc
3350 FF01BA A5 C5 lda SMnprm
3351 FF01BC 60 ?11: rts
3352 FF01BD
3353 FF01BD ExecCmd:
3354 FF01BD 24 E1 bit SMesc
3355 FF01BF 10 11 bpl ?01
3356 FF01C1 A6 C4 ldx SMbndx
3357 FF01C3 86 E0 stx cmdlin ; save start of command line
3358 FF01C5 BF 00 99 01 lda >INPUTBUF,x
3359 FF01C9 F0 0A beq ?02
3360 FF01CB C9 20 cmp #' '
3361 FF01CD F0 06 beq ?02
3362 FF01CF 4C 34 01 jmp ErrCls2
3363 FF01D2 20 5A 01 ?01: jsr GetParm
3364 FF01D5 08 ?02: php
3365 FF01D6 48 pha
3366 FF01D7 98 tya
3367 FF01D8 0A asl a
3368 FF01D9 AA tax
3369 FF01DA 68 pla
3370 FF01DB 28 plp
3371 FF01DC 7C 81 04 jmp (CMDVCTRS,x)
3372
3373 ;---------------------------------------------------------------------------
3374 ; prefix commands
3375 ;---------------------------------------------------------------------------
3376
3377 ; handle prefix command's
3378 ; A = byte from input buffer
3379 FF01DF pfxcmd:
3380 FF01DF A2 01 ldx #PFXLEN
3381 FF01E1 DF 23 03 FF ?03: cmp >PFXTBL,x
3382 FF01E5 F0 04 beq ?04
3383 FF01E7 CA dex
3384 FF01E8 10 F7 bpl ?03
3385 FF01EA 60 rts ; return to standard command
3386 FF01EB 68 ?04: pla ; pop stack return address
3387 FF01EC 68 pla
3388 FF01ED 8A txa
3389 FF01EE 0A asl a
Tue Jul 17 11:00:24 2018 Page 15
3390 FF01EF AA tax
3391 FF01F0 FC 3D 03 jsr (PFXVCTRS,x) ; execute prefix command
3392 FF01F3 4C C4 00 jmp GetCmd ; command loop
3393
3394 ; prefix '@': cbm disk command
3395 FF01F6 pfx_at:
3396 FF01F6 64 E4 stz <atflag
3397 FF01F8 A9 99 lda #>INPUTBUF
3398 FF01FA 85 E7 sta <atstr+1 ; hi ptr command string
3399 FF01FC A9 01 lda #^INPUTBUF
3400 FF01FE 85 EE sta <atipb ; bank of cmnd string
3401 FF0200 20 5E 1A ?01: jsr GetCurCh2 ; get next byte
3402 FF0203 F0 12 beq ?04 ; just '@': like '@e'
3403 FF0205 C9 20 cmp #' ' ; skip blanks
3404 FF0207 F0 F7 beq ?01
3405 FF0209 A2 0C ldx #PATLEN
3406 FF020B DF 25 03 FF ?02: cmp >PATTBL,x
3407 FF020F F0 0A beq ?06
3408 FF0211 CA dex
3409 FF0212 10 F7 bpl ?02
3410 FF0214 4C 98 02 jmp ?15
3411 FF0217 A2 00 ?04: ldx #0 ; '@e' command
3412 FF0219 A9 45 lda #'E'
3413 FF021B 85 E2 ?06: sta <atcmd
3414 FF021D 86 E3 stx <atnum
3415 FF021F 8A txa
3416 FF0220 F0 04 beq ?08 ; @e
3417 FF0222 C9 5A cmp #'Z' ; @z close all
3418 FF0224 D0 0E bne ?9a ; get string for command
3419 FF0226 20 48 1A ?08: jsr GetCurCh ; no params for '@e' & '@z' command
3420 FF0229 D0 03 bne ?09
3421 FF022B 4C CF 02 jmp ?22 ; ok
3422 FF022E C9 20 ?09: cmp #' '
3423 FF0230 F0 F4 beq ?08
3424 FF0232 D0 64 bne ?15 ; error
3425 FF0234 A5 E2 ?9a: lda <atcmd
3426 FF0236 C9 47 cmp #'G' ; get
3427 FF0238 F0 0B beq ?9c
3428 FF023A C9 50 cmp #'P' ; put
3429 FF023C F0 07 beq ?9c
3430 FF023E C9 58 cmp #'X' ; close want one param
3431 FF0240 D0 06 bne ?10
3432 FF0242 4C F7 02 jmp ?40 ; X want one param
3433 FF0245 4C D2 02 ?9c: jmp ?30 ; G&P want 2/3 param
3434 FF0248 20 48 1A ?10: jsr GetCurCh ; parse command string
3435 FF024B F0 4B beq ?15 ; error
3436 FF024D C9 20 cmp #' '
3437 FF024F F0 F7 beq ?10
3438 FF0251 C9 22 cmp #'"' ; will start with a quotes mark
3439 FF0253 D0 43 bne ?15 ; error
3440 FF0255 A6 C4 ldx SMbndx ; save pointer to start string
3441 FF0257 86 E6 stx <atstr
3442 FF0259 BF 00 99 01 ?12: lda INPUTBUF,x ; search final quote mark
3443 FF025D F0 39 beq ?15 ; error
3444 FF025F E8 inx
3445 FF0260 C9 22 cmp #'"'
3446 FF0262 D0 F5 bne ?12
Tue Jul 17 11:00:24 2018 Page 16
3447 FF0264 86 C4 stx SMbndx ; store index to next char
3448 FF0266 CA dex
3449 FF0267 A9 00 lda #0 ; terminate command string
3450 FF0269 9F 00 99 01 sta INPUTBUF,x
3451 FF026D A6 E3 ?14: ldx <atnum
3452 FF026F E0 07 cpx #PATLD ; O,L,S,V,R,W need more params
3453 FF0271 90 5C bcc ?22
3454 FF0273 20 48 1A jsr GetCurCh
3455 FF0276 F0 20 beq ?15 ; at least need bank/chnl
3456 FF0278 20 5A 01 jsr GetParm
3457 FF027B B0 1B bcs ?15
3458 FF027D A5 BA lda SMTmpL
3459 FF027F 85 E5 sta <atbnk ; bank for L,S,V,R,W - chn for O
3460 FF0281 A4 E2 ldy <atcmd
3461 FF0283 C0 4F cpy #'O'
3462 FF0285 D0 02 bne ?14a
3463 FF0287 85 F8 sta <atsa
3464 FF0289 20 5A 01 ?14a: jsr GetParm
3465 FF028C 90 0D bcc ?16
3466 FF028E A5 E2 lda <atcmd
3467 FF0290 C9 57 cmp #'W'
3468 FF0292 F0 04 beq ?15
3469 FF0294 C9 53 cmp #'S'
3470 FF0296 D0 37 bne ?22 ; L,V,R without start address or O
3471 FF0298 4C 34 01 ?15: jmp ErrCls2 ; S,W need start address
3472 FF029B ?16: ACC16
3473 FF029B C2 20 rep #PMFLAG
3474 .LONGA on
3475 .MNLIST
3476 FF029D A5 BA lda SMTmpL
3477 FF029F 85 E8 sta <atstart
3478 FF02A1 ACC08
3479 FF02A1 E2 20 sep #PMFLAG
3480 .LONGA off
3481 .MNLIST
3482 FF02A3 A9 80 lda #$80
3483 FF02A5 85 E4 sta <atflag ; flag start address
3484 FF02A7 20 5A 01 jsr GetParm ; end address
3485 FF02AA A5 E2 lda <atcmd
3486 FF02AC 90 0A bcc ?18
3487 FF02AE C9 53 cmp #'S'
3488 FF02B0 F0 E6 beq ?15 ; S,W need end address
3489 FF02B2 C9 57 cmp #'W'
3490 FF02B4 F0 E2 beq ?15
3491 FF02B6 80 17 bra ?22
3492 FF02B8 C9 57 ?18: cmp #'W'
3493 FF02BA F0 04 beq ?20
3494 FF02BC C9 53 cmp #'S'
3495 FF02BE D0 D8 bne ?15 ; L,V,R want just start address
3496 FF02C0 ?20: ACC16
3497 FF02C0 C2 20 rep #PMFLAG
3498 .LONGA on
3499 .MNLIST
3500 FF02C2 A5 BA lda SMTmpL
3501 FF02C4 1A inc a
3502 FF02C5 85 EA sta <atend
3503 FF02C7 C5 E8 cmp <atstart
Tue Jul 17 11:00:24 2018 Page 17
3504 FF02C9 ACC08
3505 FF02C9 E2 20 sep #PMFLAG
3506 .LONGA off
3507 .MNLIST
3508 FF02CB 90 CB bcc ?15 ; end+1 will be > start
3509 FF02CD F0 C9 beq ?15
3510 FF02CF 4C D1 25 ?22: jmp matcmd
3511 FF02D2 20 5A 01 ?30: jsr GetParm ; G&P
3512 FF02D5 B0 C1 bcs ?15
3513 FF02D7 A5 BA lda SMTmpL
3514 FF02D9 85 F8 sta <atsa
3515 FF02DB 20 5A 01 jsr GetParm
3516 FF02DE B0 B8 bcs ?15
3517 FF02E0 A5 BA lda SMTmpL
3518 FF02E2 85 E5 sta <atbnk
3519 FF02E4 64 E8 stz <atstart
3520 FF02E6 64 E9 stz <atstart+1
3521 FF02E8 20 5A 01 jsr GetParm
3522 FF02EB 90 E2 bcc ?22
3523 FF02ED ACC16
3524 FF02ED C2 20 rep #PMFLAG
3525 .LONGA on
3526 .MNLIST
3527 FF02EF A5 BA lda SMTmpL
3528 FF02F1 85 E8 sta <atstart
3529 FF02F3 ACC08
3530 FF02F3 E2 20 sep #PMFLAG
3531 .LONGA off
3532 .MNLIST
3533 FF02F5 80 D8 bra ?22
3534 FF02F7 20 5A 01 ?40: jsr GetParm ; X (close)
3535 FF02FA B0 9C bcs ?15
3536 FF02FC A5 BA lda SMTmpL
3537 FF02FE 85 F8 sta <atsa
3538 FF0300 80 CD bra ?22
3539
3540 ; prefix '|': ata test
3541 FF0302 pfx_bar:
3542 FF0302 20 48 1A ?01: jsr GetCurCh ; get next byte
3543 FF0305 F0 0F beq ?04 ; error
3544 FF0307 C9 20 cmp #' ' ; skip blanks
3545 FF0309 F0 F7 beq ?01
3546 FF030B A2 0A ldx #PBARLEN
3547 FF030D DF 32 03 FF ?02: cmp >PBARTBL,x
3548 FF0311 F0 06 beq ?06
3549 FF0313 CA dex
3550 FF0314 10 F7 bpl ?02
3551 FF0316 4C 34 01 ?04: jmp ErrCls2
3552 FF0319 86 E3 ?06: stx <atnum
3553 FF031B 20 5A 01 jsr GetParm ; get first param
3554 FF031E B0 F6 bcs ?04
3555 FF0320 4C 9B 2E jmp atacmd
3556
3557 ; prefixes table
3558 FF0323 PFXTBL:
3559 FF0323 40 7C .DB '@|'
3560 FF0325
Tue Jul 17 11:00:24 2018 Page 18
3561 000001 PFXLEN .EQU ($ - PFXTBL - 1)
3562
3563 ; prefix '@' commands table
3564 FF0325 PATTBL:
3565 FF0325 45 5A 58 47 50 .DB 'EZXGPDC'
44 43
3566 000007 PATLD .EQU ($ - PATTBL)
3567 FF032C 4C 53 56 52 57 .DB 'LSVRWO'
4F
3568
3569 00000C PATLEN .EQU ($ - PATTBL - 1)
3570
3571 ; prefix '|' commands table
3572 ; <r>ead pio mode - <w>rite pio mode - <v>erify pio mode
3573 ; <c>lear ata device (sw reset) - <i>dentify device
3574 ; <m>br sector load - <p>br sector load
3575 ; <d>ma ata buffer on/off - <b>ank dma buffer (0..7)
3576 ; <R>ead dma mode - <W>rite dma mode
3577 FF0332 PBARTBL:
3578 FF0332 72 76 77 63 69 .DB 'rvwcimpdbRW'
6D 70 64 62 52
57
3579
3580 00000A PBARLEN .EQU ($ - PBARTBL - 1)
3581
3582 ; prefix commands vectors
3583 FF033D PFXVCTRS:
3584 FF033D F601 0203 .DW pfx_at, pfx_bar
3585
3586 FF0341
3587 ;---------------------------------------------------------------------------
3588 ; keywords table
3589 ;---------------------------------------------------------------------------
3590
3591 FF0341 CMDTBL:
3592 FF0341 64 6D 61 72 E4 .DC 'dmard'
3593 FF0346 64 75 6D 62 6F .DC 'dumbon'
EE
3594 FF034C 64 75 6D 62 6F .DC 'dumboff'
66 E6
3595 FF0353
3596 FF0353 63 62 6D 66 F3 .DC 'cbmfs'
3597 FF0358 73 62 72 6B F0 .DC 'sbrkp'
3598 FF035D 73 62 72 6B ED .DC 'sbrkm'
3599
3600 FF0362 65 64 69 F4 .DC 'edit'
3601 FF0366 6D 6B 68 61 73 .DC 'mkhash'
E8
3602 FF036C 71 75 69 F4 .DC 'quit'
3603 FF0370 63 62 6D 70 61 .DC 'cbmpas' ; CBM quick pascal
F3
3604 FF0376 78 6D 74 65 73 .DC 'xmtest'
F4
3605 FF037C 62 65 65 F0 .DC 'beep'
3606 FF0380
3607 ; FDC diagnostic -- implementation in mond.asm
3608 FF0380 66 64 64 69 73 .DC 'fddisk' ; invoca FDCTST
Tue Jul 17 11:00:24 2018 Page 19
EB
3609 FF0386 66 64 72 65 F3 .DC 'fdres' ; reset FDC controller UM8388
3610 FF038B 66 64 72 65 61 .DC 'fdread' ; read disk sector's
E4
3611 FF0391 66 64 69 6E 69 .DC 'fdinit' ; init drive
F4
3612 FF0397 66 64 66 6F 72 .DC 'fdformat' ; format whole disk (low level)
6D 61 F4
3613 FF039F 66 64 77 72 69 .DC 'fdwrite' ; write disk sector's
74 E5
3614 FF03A6 66 64 67 65 74 .DC 'fdgetfmt' ; get current disk format
66 6D F4
3615 FF03AE 66 64 76 65 72 .DC 'fdverfmt' ; verify disk format
66 6D F4
3616 FF03B6 66 64 76 65 72 .DC 'fdverf' ; verify read
E6
3617 FF03BC 66 64 74 72 65 .DC 'fdtread' ; read whole track
61 E4
3618 FF03C3 66 64 74 77 72 .DC 'fdtwrite' ; write whole track
69 74 E5
3619 FF03CB 66 64 74 76 65 .DC 'fdtverf' ; verify whole track
72 E6
3620 FF03D2 66 64 6E 65 F7 .DC 'fdnew' ; new ram disk's
3621 FF03D7 66 64 66 F3 .DC 'fdfs' ; new file system
3622 FF03DB 66 64 6C 73 79 .DC 'fdlsys' ; load rom.bin
F3
3623
3624 FF03E1 66 6C 61 73 E8 .DC 'flash' ; update flash from file (fdlsys)
3625 FF03E6 6D 66 6C 61 73 .DC 'mflash' ; update flash from memory
E8
3626 FF03EC 65 66 6C 61 73 .DC 'eflash' ; update flash from emulator
E8
3627 FF03F2
3628 FF03F2 63 6F F0 .DC 'cop'
3629 FF03F5 74 72 75 E5 .DC 'true'
3630 FF03F9 76 64 E3 .DC 'vdc' ; cambia dot clock VDC
3631 FF03FC
3632 ; assembler/disassembler mode
3633 FF03FC 70 38 31 B6 .DC 'p816' ; set 65C816 mode (default mode)
3634 FF0400 70 63 30 B2 .DC 'pc02' ; set 65C02 mode
3635 FF0404 70 30 B2 .DC 'p02' ; set 6502 mode
3636 FF0407 61 6D B8 .DC 'am8'
3637 FF040A 61 6D 31 B6 .DC 'am16'
3638 FF040E 78 79 B8 .DC 'xy8'
3639 FF0411 78 79 31 B6 .DC 'xy16'
3640
3641 ; memory bank clear/move
3642 FF0415 6B FA .DC 'kz' ; clear whole memory bank
3643 FF0417 6B E6 .DC 'kf' ; fill whole memory bank
3644 FF0419 6B C6 .DC 'kF' ; fill whole memory bank with pattern
3645 FF041B 6B 6D F6 .DC 'kmv' ; move whole memory bank
3646 FF041E
3647 FF041E 63 72 F3 .DC 'crs' ; show CR
3648 FF0421 63 72 E5 .DC 'cre' ; enable EM
3649 FF0424 63 72 F8 .DC 'crx' ; enable XM
3650 FF0427 63 72 E6 .DC 'crf' ; enable FM
3651 FF042A 6D F8 .DC 'mx' ; display XM
Tue Jul 17 11:00:24 2018 Page 20
3652 FF042C 78 F3 .DC 'xs' ; show XM in sectors
3653 FF042E 78 BE .DC 'x>' ; set extended mem
3654 FF0430 78 6D F0 .DC 'xmp' ; set extended mem page
3655 FF0433 72 E4 .DC 'rd' ; read single mem.
3656 FF0435 77 F2 .DC 'wr' ; write single mem
3657 FF0437 6B 6D F4 .DC 'kmt' ; full memory bank test
3658 FF043A 78 6D F4 .DC 'xmt' ; eXtended memory test
3659 FF043D
3660 FF043D 74 E5 .DC 'te' ; show RTC internal extended ram
3661 FF043F 65 BE .DC 'e>' ; set RTC internal extended ram
3662 FF0441 74 F5 .DC 'tu'
3663 FF0443 74 F3 .DC 'ts'
3664 FF0445 75 BE .DC 'u>'
3665 FF0447 74 E3 .DC 'tc'
3666 FF0449 63 BE .DC 'c>'
3667 FF044B 67 F4 .DC 'gt' ; get rtc time
3668 FF044D 67 E4 .DC 'gd' ; get rtc date
3669 FF044F 73 F4 .DC 'st' ; set rtc time
3670 FF0451 73 E4 .DC 'sd' ; set rtc date
3671 FF0453
3672 FF0453 23 74 65 73 F4 .DC '#test'
3673 FF0458 23 73 74 72 63 .DC '#strcpy'
70 F9
3674 FF045F 23 66 64 69 73 .DC '#fdisk'
EB
3675 FF0465 23 73 70 74 65 .DC '#sptest'
73 F4
3676 FF046C 23 61 73 70 74 .DC '#asptest'
65 73 F4
3677
3678 FF0474 ED .DC 'm' ; display mem
3679 FF0475 BE .DC '>' ; set mem
3680 FF0476 BB .DC ';' ; set registri
3681 FF0477 F2 .DC 'r' ; show registri
3682 FF0478 FA .DC 'z' ; fill zero
3683 FF0479 E6 .DC 'f' ; fill byte
3684 FF047A C6 .DC 'F' ; fill con byte auto-inc
3685 FF047B E4 .DC 'd' ; disassemble line (masmx.asm)
3686 FF047C E1 .DC 'a' ; assemble line (masmx.asm)
3687 FF047D AE .DC '.' ; assemble line (masmx.asm)
3688 FF047E EA .DC 'j' ; jmp to soubroutine (terminate with rtl)
3689 FF047F E7 .DC 'g' ; jmp to soubroutine (terminate with brk)
3690 FF0480 00 .DB 0
3691 FF0481
3692 FF0481 CMDVCTRS:
3693 FF0481 2905 .DW Cmd_dmard
3694 FF0483 5C09 7409 .DW Cmd_dumbon, Cmd_dumboff
3695 FF0487
3696 FF0487 5705 .DW testcbm
3697 FF0489 C905 .DW Cmd_sbrkp
3698 FF048B D405 .DW Cmd_sbrkm
3699 FF048D
3700 FF048D 2B06 .DW Cmd_edit
3701 FF048F 1C28 .DW Cmd_mkhash
3702 FF0491 9307 A007 6A07 .DW Cmd_quit, Cmd_cbmpas, Cmd_xmtest
3703 FF0497 3006 .DW Cmd_beep
3704 FF0499
Tue Jul 17 11:00:24 2018 Page 21
3705 ; FDC diagnostic -- implementation in mond.asm
3706 FF0499 AB2B A42B EA2D .DW Cmd_fddisk, Cmd_fdres, Cmd_fdread, Cmd_fdinit
E82B
3707 FF04A1 002C D02D 672B .DW Cmd_fdformat, Cmd_fdwrite, Cmd_fdgetfmt, Cmd_fdverfmt
4F2C
3708 FF04A9 DD2D 872D 7E2D .DW Cmd_fdverf, Cmd_fdtread, Cmd_fdtwrite, Cmd_fdtverf
902D
3709 FF04B1 452B 312E 7B28 .DW Cmd_fdnew, Cmd_fdfs, Cmd_fdlsys
3710 FF04B7
3711 FF04B7 C41B CF1B 8B1B .DW Cmd_flash, Cmd_mflash, Cmd_eflash
3712 FF04BD
3713 FF04BD B207 ED08 8409 .DW Cmd_cop, Cmd_true, Cmd_vdc
3714
3715 ; assembler/disassembler mode
3716 FF04C3 5606 5A06 5E06 .DW Cmd_p816, Cmd_pc02, Cmd_p02, Cmd_am8, Cmd_am16, Cmd_xy8
A606 AC06 F006
3717 FF04CF 2B07 .DW Cmd_xy16
3718 FF04D1
3719 ; memory bank clear/move
3720 FF04D1 B70F DE0F 7B0F .DW Cmd_kz, Cmd_kf, Cmd_kF, Cmd_km
330F
3721 FF04D9
3722 FF04D9 620D 3D0D 4A0D .DW Cmd_crs, Cmd_cre, Cmd_crx, Cmd_crf
570D
3723 FF04E1 7E0E 620E 5210 .DW Cmd_mx, Cmd_xs, Cmd_SetXMem, Cmd_SetXMPage
A70D
3724 FF04E9 230E 3D0E 760B .DW Cmd_rd, Cmd_wr, Cmd_kmt, Cmd_xmt
4D0A
3725 FF04F1
3726 FF04F1 F910 0811 D411 .DW Cmd_te, Cmd_stxm, Cmd_tu, Cmd_ts, Cmd_stum, Cmd_tc, Cmd_stcm
CE11 E711 AE12
D012
3727 FF04FF 7413 B513 EF13 .DW Cmd_gt, Cmd_gd, Cmd_st, Cmd_sd
2D14
3728
3729 FF0507 0215 CC14 B714 .DW Cmd_test, Cmd_strcpy, Cmd_fdisk, Cmd_sptst, Cmd_asptst
1630 4732
3730
3731 FF0511 D80D D70E F40C .DW Cmd_m, Cmd_SetMem, Cmd_SetReg, PrintReg
820C
3732 FF0519 1310 1E10 2C10 .DW Cmd_z, Cmd_f, Cmd_F, Cmd_d, Cmd_a, Cmd_a
F71C 2D20 2D20
3733 FF0525 F606 1007 .DW Cmd_j, Cmd_g
3734
3735
3736 FF0529 Cmd_dmard:
3737 FF0529 A9 00 lda #0
3738 FF052B 48 pha
3739 FF052C 48 pha
3740 FF052D F4 00 00 pea #0
3741 FF0530 A2 01 ldx #1
3742 FF0532 DA phx
3743 FF0533 48 pha
3744 FF0534 F4 00 00 pea #0
3745 FF0537 ATADMARD
3746 FF0537 02 42 cop $42
3747 FF0539 00 .DB $00
Tue Jul 17 11:00:24 2018 Page 22
3748 .MNLIST
3749 FF053A 60 rts
3750
3751 ; ---- TEST CBM
3752 FF053B getstr:
3753 FF053B SCN_CR
3754 FF053B SCNPRCHAR
3755 .MLIST
3756 FF053B 02 07 cop $07
3757 .MNLIST
3758 FF053D 0D .DB $0D
3759 .MNLIST
3760 FF053E A2 00 ldx #0
3761 FF0540 CA dex
3762 FF0541 E8 ?01: inx ; ciclo input
3763 FF0542 E0 A2 cpx #INPBUFLEN
3764 FF0544 B0 0A bcs ?02
3765 FF0546 KBCHARIN ; input tastiera
3766 FF0546 02 0F cop $0F
3767 .MNLIST
3768 FF0548 9F 00 99 01 sta >INPUTBUF,x
3769 FF054C C9 0D cmp #KB_CR
3770 FF054E D0 F1 bne ?01
3771 FF0550 A9 0D ?02: lda #KB_CR
3772 FF0552 9F 00 99 01 sta >INPUTBUF,x
3773 FF0556 60 rts
3774
3775 FF0557 testcbm:
3776 FF0557 D0 04 bne ?02
3777 FF0559 A9 0F lda #15
3778 FF055B 85 BA sta SMTmpL
3779 FF055D A5 BA ?02: lda SMTmpL
3780 FF055F C9 FF cmp #$FF
3781 FF0561 D0 05 bne ?02a
3782 FF0563 20 5B 19 jsr PrintCR
3783 FF0566 80 33 bra cbmer
3784 FF0568 29 0F ?02a: and #$0F
3785 FF056A C9 0F cmp #$0F
3786 FF056C F0 02 beq ?03
3787 FF056E 09 80 ora #$80
3788 FF0570 85 BA ?03: sta SMTmpL
3789
3790 FF0572 SCNPRINT
3791 FF0572 02 01 cop $01
3792 .MNLIST
3793 FF0574 0D 54 79 70 65 .DB $0D, 'Type command string:', 0
20 63 6F 6D 6D
61 6E 64 20 73
74 72 69 6E 67
3A 00
3794 FF058A 20 3B 05 jsr getstr
3795 FF058D SCN_CR
3796 FF058D SCNPRCHAR
3797 .MLIST
3798 FF058D 02 07 cop $07
3799 .MNLIST
3800 FF058F 0D .DB $0D
Tue Jul 17 11:00:24 2018 Page 23
3801 .MNLIST
3802 FF0590 A9 01 lda #^INPUTBUF
3803 FF0592 48 pha
3804 FF0593 F4 00 99 pea #!INPUTBUF
3805 FF0596 A5 BA lda SMTmpL
3806 FF0598 48 pha
3807 FF0599 CBMFSCMD
3808 FF0599 02 80 cop FN_CBMFSCMD
3809 .MNLIST
3810
3811 ;; bcs ?04
3812 ;; ldy #0
3813 ;;?04: tya
3814 ;; jmp PrintByte
3815
3816 FF059B cbmer:
3817 FF059B ACC16
3818 FF059B C2 20 rep #PMFLAG
3819 .LONGA on
3820 .MNLIST
3821 FF059D 3B tsc
3822 FF059E 38 sec
3823 FF059F E9 80 00 sbc #128
3824 FF05A2 1B tcs
3825 FF05A3 1A inc a
3826 FF05A4 A2 00 ldx #0
3827 FF05A6 DA phx
3828 FF05A7 48 pha
3829 FF05A8 F4 80 00 pea #128
3830 FF05AB ACC08
3831 FF05AB E2 20 sep #PMFLAG
3832 .LONGA off
3833 .MNLIST
3834 FF05AD A9 0F lda #15
3835 FF05AF 48 pha
3836 FF05B0 CBMFSRD
3837 FF05B0 02 81 cop FN_CBMFSRW
3838 FF05B2 00 .DB $00
3839 .MNLIST
3840 FF05B3 ACC16
3841 FF05B3 C2 20 rep #PMFLAG
3842 .LONGA on
3843 .MNLIST
3844 FF05B5 3B tsc
3845 FF05B6 1A inc a
3846 FF05B7 ACC08
3847 FF05B7 E2 20 sep #PMFLAG
3848 .LONGA off
3849 .MNLIST
3850 FF05B9 A2 00 ldx #0
3851 FF05BB SCNSTROUT
3852 FF05BB 02 03 cop $03
3853 .MNLIST
3854 FF05BD ACC16CLC
3855 FF05BD C2 21 rep #(PMFLAG.OR.PCFLAG)
3856 .LONGA on
3857 .MNLIST
Tue Jul 17 11:00:24 2018 Page 24
3858 FF05BF 3B tsc
3859 FF05C0 69 80 00 adc #128
3860 FF05C3 1B tcs
3861 FF05C4 ACC08
3862 FF05C4 E2 20 sep #PMFLAG
3863 .LONGA off
3864 .MNLIST
3865 FF05C6 4C 5B 19 jmp PrintCR
3866 FF05C9
3867 FF05C9
3868 ; --------
3869 FF05C9 Cmd_sbrkp:
3870 FF05C9 D0 06 bne ?01
3871 FF05CB 64 BA stz SMTmpL
3872 FF05CD 64 BB stz SMTmpH
3873 FF05CF 64 F8 stz SMdwTmp3
3874 FF05D1 18 ?01: clc
3875 FF05D2 80 0B bra _sbrk
3876
3877 FF05D4 Cmd_sbrkm:
3878 FF05D4 D0 04 bne ?01
3879 FF05D6 64 BA stz SMTmpL
3880 FF05D8 64 BB stz SMTmpH
3881 FF05DA 38 ?01: sec
3882 FF05DB A9 80 lda #$80
3883 FF05DD 85 F8 sta SMdwTmp3
3884 FF05DF
3885 FF05DF _sbrk:
3886 FF05DF 08 php
3887 FF05E0 20 5B 19 jsr PrintCR
3888 FF05E3 28 plp
3889 FF05E4 A5 BB lda SMTmpH
3890 FF05E6 EB xba
3891 FF05E7 A5 BA lda SMTmpL
3892 FF05E9 SETBRK
3893 FF05E9 02 7F cop FN_SETBRK
3894 .MNLIST
3895 FF05EB B0 1C bcs ?10
3896 FF05ED EB xba
3897 FF05EE AA tax ; HI
3898 FF05EF EB xba ; LOW
3899 FF05F0 20 48 19 jsr PrintWord
3900 FF05F3 A5 BA lda SMTmpL
3901 FF05F5 05 BB ora SMTmpH
3902 FF05F7 F0 0D beq ?06
3903 FF05F9 A9 00 lda #0
3904 FF05FB EB xba
3905 FF05FC A9 00 lda #0
3906 FF05FE SETBRK
3907 FF05FE 02 7F cop FN_SETBRK
3908 .MNLIST
3909 FF0600 EB xba
3910 FF0601 AA tax ; HI
3911 FF0602 EB xba ; LOW
3912 FF0603 20 48 19 jsr PrintWord
3913 FF0606 4C 5B 19 ?06: jmp PrintCR
3914 FF0609 ?10: SCNPRINT
Tue Jul 17 11:00:24 2018 Page 25
3915 FF0609 02 01 cop $01
3916 .MNLIST
3917 FF060B 0D 3A 3A 20 45 .DB $0D, ':: Error -> ', 0
72 72 6F 72 20
2D 3E 20 00
3918 FF0619 48 pha
3919 FF061A 98 tya
3920 FF061B 20 4E 19 jsr PrintByte
3921 FF061E 20 51 19 jsr PrintBlank
3922 FF0621 68 pla
3923 FF0622 EB xba
3924 FF0623 AA tax
3925 FF0624 EB xba
3926 FF0625 20 48 19 jsr PrintWord
3927 FF0628 4C 5B 19 jmp PrintCR
3928
3929 FF062B Cmd_edit:
3930 ;phb
3931 ;phd
3932 ;pea #$4000
3933 ;lda #$40
3934 ;pha
3935 FF062B 22 B3 17 FD jsl qedtent
3936 ;pla
3937 ;pla
3938 ;pla
3939 ;pld
3940 ;plb
3941 FF062F 60 rts
3942 FF0630
3943 FF0630 Cmd_beep:
3944 FF0630 90 06 bcc ?01
3945 FF0632 A9 B0 lda #10110000B ; CTC 2 in modo 0 - 2 bytes
3946 FF0634 8D 4B FD sta CTC0+CTCCTRL
3947 FF0637 60 rts
3948 FF0638 A9 B0 ?01: lda #10110000B ; CTC 2 in modo 0 - 2 bytes
3949 FF063A 8D 4B FD sta CTC0+CTCCTRL
3950 FF063D A5 BA lda SMTmpL
3951 FF063F 05 BB ora SMTmpH
3952 FF0641 F0 12 beq ?02
3953 FF0643 A5 BA lda SMTmpL
3954 FF0645 8D 4A FD sta CTC0+CTCCNT2
3955 FF0648 A5 BB lda SMTmpH
3956 FF064A 8D 4A FD sta CTC0+CTCCNT2
3957 FF064D A9 08 lda #$08
3958 FF064F 1C 2B FD trb PIA0+PIACRB
3959 FF0652 1C 29 FD trb PIA0+PIACRA
3960 FF0655 60 ?02: rts
3961
3962 FF0656 Cmd_p816:
3963 FF0656 A9 00 lda #0
3964 FF0658 80 06 bra _pset
3965 FF065A
3966 FF065A Cmd_pc02:
3967 FF065A A9 C0 lda #$C0
3968 FF065C 80 02 bra _pset
3969 FF065E
Tue Jul 17 11:00:24 2018 Page 26
3970 FF065E Cmd_p02:
3971 FF065E A9 80 lda #$80
3972
3973 FF0660 _pset:
3974 FF0660 85 D9 sta asmcpu
3975 FF0662 SCNPRINT
3976 FF0662 02 01 cop $01
3977 .MNLIST
3978 FF0664 0D 3A 3A 20 43 .DB $0D, ':: Current assembler mode -> ', 0
75 72 72 65 6E
74 20 61 73 73
65 6D 62 6C 65
72 20 6D 6F 64
65 20 2D 3E 20
00
3979 FF0683 A5 D9 lda asmcpu
3980 FF0685 D0 0A bne ?02
3981 FF0687 SCNPRINT
3982 FF0687 02 01 cop $01
3983 .MNLIST
3984 FF0689 36 35 43 38 31 .DB '65C816', 0
36 00
3985 FF0690 60 rts
3986 FF0691 24 D9 ?02: bit asmcpu
3987 FF0693 50 09 bvc ?04
3988 FF0695 SCNPRINT
3989 FF0695 02 01 cop $01
3990 .MNLIST
3991 FF0697 36 35 43 30 32 .DB '65C02', 0
00
3992 FF069D 60 rts
3993 FF069E ?04:
3994 FF069E SCNPRINT
3995 FF069E 02 01 cop $01
3996 .MNLIST
3997 FF06A0 36 35 30 32 00 .DB '6502', 0
3998 FF06A5 60 rts
3999
4000 FF06A6 Cmd_am8:
4001 FF06A6 A9 80 lda #$80
4002 FF06A8 14 D8 trb asmlong
4003 FF06AA 80 04 bra _amx
4004 FF06AC
4005 FF06AC Cmd_am16:
4006 FF06AC A9 80 lda #$80
4007 FF06AE 04 D8 tsb asmlong
4008 FF06B0 _amx:
4009 FF06B0 SCNPRINT
4010 FF06B0 02 01 cop $01
4011 .MNLIST
4012 FF06B2 0D 3A 3A 20 41 .DB $0D, ':: Accumulator/Memory 65C816 mode -> ', 0
63 63 75 6D 75
6C 61 74 6F 72
2F 4D 65 6D 6F
72 79 20 36 35
43 38 31 36 20
6D 6F 64 65 20
Tue Jul 17 11:00:24 2018 Page 27
2D 3E 20 00
4013 FF06D9 24 D8 bit asmlong
4014 FF06DB 10 0A bpl ?02
4015 FF06DD SCNPRINT
4016 FF06DD 02 01 cop $01
4017 .MNLIST
4018 FF06DF 31 36 20 62 69 .DB '16 bit', 0
74 00
4019 FF06E6 60 rts
4020 FF06E7 ?02: SCNPRINT
4021 FF06E7 02 01 cop $01
4022 .MNLIST
4023 FF06E9 38 20 62 69 74 .DB '8 bit', 0
00
4024 FF06EF 60 rts
4025
4026 FF06F0 Cmd_xy8:
4027 FF06F0 A9 40 lda #$40
4028 FF06F2 14 D8 trb asmlong
4029 FF06F4 80 39 bra _xy
4030
4031 FF06F6 Cmd_j:
4032 FF06F6 68 pla
4033 FF06F7 68 pla
4034 FF06F8 20 3D 01 jsr _setpc
4035 FF06FB 22 15 07 FF jsl _ldregs
4036 FF06FF CPU16
4037 FF06FF C2 30 rep #(PMFLAG.OR.PXFLAG)
4038 .LONGA on
4039 .LONGI on
4040 .MNLIST
4041 FF0701 85 CE sta SMac
4042 FF0703 86 D0 stx SMxr
4043 FF0705 84 D2 sty SMyr
4044 FF0707 CPU08
4045 FF0707 E2 30 sep #(PMFLAG.OR.PXFLAG)
4046 .LONGA off
4047 .LONGI off
4048 .MNLIST
4049 FF0709 08 php
4050 FF070A 68 pla
4051 FF070B 85 CA sta SMsr
4052 FF070D 4C BE 00 jmp _SysMon2
4053 FF0710
4054 FF0710 Cmd_g:
4055 FF0710 68 pla
4056 FF0711 68 pla
4057 FF0712 20 3D 01 jsr _setpc
4058 FF0715
4059 FF0715 _ldregs:
4060 FF0715 A5 C7 lda SMkr
4061 FF0717 48 pha
4062 FF0718 ACC16
4063 FF0718 C2 20 rep #PMFLAG
4064 .LONGA on
4065 .MNLIST
4066 FF071A A5 C8 lda SMpc
Tue Jul 17 11:00:24 2018 Page 28
4067 FF071C 48 pha
4068 FF071D A6 CA ldx SMsr
4069 FF071F DA phx
4070 FF0720 CPU16
4071 FF0720 C2 30 rep #(PMFLAG.OR.PXFLAG)
4072 .LONGA on
4073 .LONGI on
4074 .MNLIST
4075 FF0722 A5 CE lda SMac
4076 FF0724 A6 D0 ldx SMxr
4077 FF0726 A4 D2 ldy SMyr
4078 FF0728 CPU08
4079 FF0728 E2 30 sep #(PMFLAG.OR.PXFLAG)
4080 .LONGA off
4081 .LONGI off
4082 .MNLIST
4083 FF072A 40 rti
4084 FF072B
4085 FF072B Cmd_xy16:
4086 FF072B A9 40 lda #$40
4087 FF072D 04 D8 tsb asmlong
4088 FF072F _xy:
4089 FF072F SCNPRINT
4090 FF072F 02 01 cop $01
4091 .MNLIST
4092 FF0731 0D 3A 3A 20 58 .DB $0D, ':: X&Y registers 65C816 mode -> ', 0
26 59 20 72 65
67 69 73 74 65
72 73 20 36 35
43 38 31 36 20
6D 6F 64 65 20
2D 3E 20 00
4093 FF0753 24 D8 bit asmlong
4094 FF0755 50 0A bvc ?02
4095 FF0757 SCNPRINT
4096 FF0757 02 01 cop $01
4097 .MNLIST
4098 FF0759 31 36 20 62 69 .DB '16 bit', 0
74 00
4099 FF0760 60 rts
4100 FF0761 ?02: SCNPRINT
4101 FF0761 02 01 cop $01
4102 .MNLIST
4103 FF0763 38 20 62 69 74 .DB '8 bit', 0
00
4104 FF0769 60 rts
4105
4106 FF076A Cmd_xmtest:
4107 FF076A D0 04 bne ?01
4108 FF076C 64 BA stz SMTmpL
4109 FF076E 64 BB stz SMTmpH
4110 FF0770 ?01: ACC16CLC ; A/M 16 bit + CLC
4111 FF0770 C2 21 rep #(PMFLAG.OR.PCFLAG)
4112 .LONGA on
4113 .MNLIST
4114 FF0772 A5 BA lda SMTmpL ; LBA
4115 FF0774 6A ?02: ror a ; divide by 16 to get xmem bank
Tue Jul 17 11:00:24 2018 Page 29
4116 FF0775 6A ror a
4117 FF0776 6A ror a
4118 FF0777 6A ror a
4119 FF0778 ACC08
4120 FF0778 E2 20 sep #PMFLAG
4121 .LONGA off
4122 .MNLIST
4123 ;sta SMTmpK ; ram disk bank
4124 FF077A EB xba ; B = bank, A = modulus
4125 FF077B 6A ror a ; shift in last carry
4126 FF077C 4A lsr a ; calc the modulo
4127 FF077D 4A lsr a
4128 FF077E 4A lsr a ; MSB of xmem
4129 FF077F 18 clc
4130 FF0780 69 20 adc #$20 ; add the physical start of xmem
4131 FF0782 48 pha
4132 FF0783 EB xba ; return in A the ram disk bank
4133 FF0784 48 pha
4134 FF0785 TXT_CR
4135 FF0785 TXTPRCHAR
4136 .MLIST
4137 FF0785 02 08 cop $08
4138 .MNLIST
4139 FF0787 0D .DB $0D
4140 .MNLIST
4141 FF0788 68 pla
4142 FF0789 20 4E 19 jsr PrintByte
4143 FF078C FA plx
4144 FF078D A9 00 lda #0
4145 FF078F 20 48 19 jsr PrintWord
4146 FF0792 60 rts
4147
4148 FF0793 Cmd_quit:
4149 FF0793 A5 DA lda SMctx
4150 FF0795 D0 03 bne ?02
4151 FF0797 4C 1B 0A jmp CmdErr3
4152 FF079A ?02: SCN_CR
4153 FF079A SCNPRCHAR
4154 .MLIST
4155 FF079A 02 07 cop $07
4156 .MNLIST
4157 FF079C 0D .DB $0D
4158 .MNLIST
4159 FF079D DC DB 01 jml [DP01ADDR+SMrsm]
4160 FF07A0
4161 FF07A0 Cmd_cbmpas:
4162 FF07A0 A5 DA lda SMctx
4163 FF07A2 F0 03 beq ?02
4164 FF07A4 4C 1B 0A jmp CmdErr3
4165 FF07A7 A0 00 ?02: ldy #0
4166 FF07A9 22 00 FF FE jsl CBMCOLD
4167 FF07AD 64 DA stz SMctx
4168 FF07AF 4C 82 0C jmp PrintReg
4169 FF07B2
4170 FF07B2 Cmd_cop:
4171 FF07B2 ?00: KBGETIN
4172 FF07B2 02 17 cop $17
Tue Jul 17 11:00:24 2018 Page 30
4173 .MNLIST
4174 FF07B4 C9 00 cmp #$00
4175 FF07B6 F0 FA beq ?00
4176 FF07B8 EB xba
4177 FF07B9 AA tax
4178 FF07BA EB xba
4179 FF07BB SCN_CR
4180 FF07BB SCNPRCHAR
4181 .MLIST
4182 FF07BB 02 07 cop $07
4183 .MNLIST
4184 FF07BD 0D .DB $0D
4185 .MNLIST
4186 FF07BE 20 48 19 jsr PrintWord
4187 FF07C1 SCN_CR
4188 FF07C1 SCNPRCHAR
4189 .MLIST
4190 FF07C1 02 07 cop $07
4191 .MNLIST
4192 FF07C3 0D .DB $0D
4193 .MNLIST
4194 FF07C4 A5 64 lda DP01ADDR+KbdFlag
4195 FF07C6 20 4E 19 jsr PrintByte
4196 FF07C9 A5 65 lda DP01ADDR+KbdToggle
4197 FF07CB 4C 4E 19 jmp PrintByte
4198 FF07CE
4199 FF07CE D0 03 bne ?01
4200 FF07D0 4C 1B 0A jmp CmdErr3
4201 FF07D3 A5 BC ?01: lda SMTmpK
4202 ;ora SMTmpH
4203 FF07D5 F0 03 beq ?02
4204 FF07D7 4C 1B 0A jmp CmdErr3
4205 ?02: ;ldx SMTmpL
4206 ;pea $0000
4207 ;pea $0001
4208 ;pea $0002
4209 ;cop $13
4210 FF07DA 4C 74 08 jmp ?13
4211 FF07DD
4212 FF07DD A9 12 lda #18
4213 FF07DF 85 F8 sta SMdwTmp3
4214 FF07E1 64 F9 stz SMdwTmp3+1
4215 FF07E3 0A asl a
4216 FF07E4 85 EA sta SMdwTmp2
4217 FF07E6 64 EB stz SMdwTmp2+1
4218 FF07E8 A5 BB lda SMTmpH
4219 FF07EA EB xba
4220 FF07EB A5 BA lda SMTmpL
4221 FF07ED A2 10 ldx #16
4222 FF07EF CPU16
4223 FF07EF C2 30 rep #(PMFLAG.OR.PXFLAG)
4224 .LONGA on
4225 .LONGI on
4226 .MNLIST
4227 FF07F1 64 E6 stz SMdwTmp1 ; azzera rem
4228 FF07F3 2A ?04: rol a
4229 FF07F4 26 E6 rol SMdwTmp1
Tue Jul 17 11:00:24 2018 Page 31
4230 FF07F6 A8 tay
4231 FF07F7 38 sec
4232 FF07F8 A5 E6 lda SMdwTmp1
4233 FF07FA E5 EA sbc SMdwTmp2
4234 FF07FC 90 02 bcc ?06
4235 FF07FE 85 E6 sta SMdwTmp1
4236 FF0800 98 ?06: tya
4237 FF0801 CA dex
4238 FF0802 D0 EF bne ?04
4239 FF0804 2A rol a
4240 FF0805 CPU08
4241 FF0805 E2 30 sep #(PMFLAG.OR.PXFLAG)
4242 .LONGA off
4243 .LONGI off
4244 .MNLIST
4245 FF0807 85 F0 sta SMXPos2
4246 FF0809 A2 00 ldx #0
4247 FF080B 38 sec
4248 FF080C A5 E6 lda SMdwTmp1
4249 FF080E E5 F8 sbc SMdwTmp3
4250 FF0810 B0 04 bcs ?08
4251 FF0812 65 F8 adc SMdwTmp3
4252 FF0814 80 01 bra ?09
4253 FF0816 E8 ?08: inx
4254 FF0817 86 F1 ?09: stx SMYPos2
4255 FF0819 1A inc a
4256 FF081A 85 F2 sta SMXPos3
4257 FF081C
4258 FF081C A5 F0 lda SMXPos2
4259 FF081E 0A asl a
4260 FF081F 18 clc
4261 FF0820 65 F1 adc SMYPos2
4262 FF0822 85 BC sta SMTmpK
4263 FF0824 A9 00 lda #0
4264 FF0826 A2 09 ldx #9
4265 FF0828 18 clc
4266 FF0829 6A ?10: ror a
4267 FF082A 66 BC ror SMTmpK
4268 FF082C 90 03 bcc ?12
4269 FF082E 18 clc
4270 FF082F 65 F8 adc SMdwTmp3
4271 FF0831 CA ?12: dex
4272 FF0832 D0 F5 bne ?10
4273 FF0834 A6 F2 ldx SMXPos3
4274 FF0836 86 E6 stx SMdwTmp1
4275 FF0838 64 E7 stz SMdwTmp1+1
4276 FF083A 18 clc
4277 FF083B EB xba
4278 FF083C A5 BC lda SMTmpK
4279 FF083E ACC16
4280 FF083E C2 20 rep #PMFLAG
4281 .LONGA on
4282 .MNLIST
4283 FF0840 65 E6 adc SMdwTmp1
4284 FF0842 3A dec a
4285 FF0843 85 E6 sta SMdwTmp1
4286 FF0845 ACC08
Tue Jul 17 11:00:24 2018 Page 32
4287 FF0845 E2 20 sep #PMFLAG
4288 .LONGA off
4289 .MNLIST
4290 FF0847 20 5B 19 jsr PrintCR
4291 FF084A A5 BB lda SMTmpH
4292 FF084C 20 71 19 jsr PrintHex
4293 FF084F A5 BA lda SMTmpL
4294 FF0851 20 71 19 jsr PrintHex
4295 FF0854 20 5B 19 jsr PrintCR
4296 FF0857 A5 F0 lda SMXPos2
4297 FF0859 20 4E 19 jsr PrintByte
4298 FF085C A5 F1 lda SMYPos2
4299 FF085E 20 4E 19 jsr PrintByte
4300 FF0861 A5 F2 lda SMXPos3
4301 FF0863 20 4E 19 jsr PrintByte
4302 FF0866 20 5B 19 jsr PrintCR
4303 FF0869 A5 E7 lda SMdwTmp1+1
4304 FF086B 20 71 19 jsr PrintHex
4305 FF086E A5 E6 lda SMdwTmp1
4306 FF0870 20 71 19 jsr PrintHex
4307 FF0873 60 rts
4308 FF0874
4309 FF0874 ?13:
4310 FF0874 FDCGETFMT
4311 FF0874 02 30 cop $30
4312 FF0876 04 .DB $04
4313 .MNLIST
4314 FF0877 90 1C bcc ?16
4315 FF0879 SCNPRINT
4316 FF0879 02 01 cop $01
4317 .MNLIST
4318 FF087B 0D 3A 3A 65 72 .DB $0D, '::error code -> ', $00
72 6F 72 20 63
6F 64 65 20 2D
3E 20 00
4319 FF088D 98 tya
4320 FF088E 20 4E 19 jsr PrintByte
4321 FF0891 8A txa
4322 FF0892 4C 71 19 jmp PrintHex
4323
4324 FF0895 98 ?16: tya
4325 FF0896 SCN_CR
4326 FF0896 SCNPRCHAR
4327 .MLIST
4328 FF0896 02 07 cop $07
4329 .MNLIST
4330 FF0898 0D .DB $0D
4331 .MNLIST
4332 FF0899 4C 71 19 jmp PrintHex
4333 FF089C
4334 FF089C SCN_CR
4335 FF089C SCNPRCHAR
4336 .MLIST
4337 FF089C 02 07 cop $07
4338 .MNLIST
4339 FF089E 0D .DB $0D
4340 .MNLIST
Tue Jul 17 11:00:24 2018 Page 33
4341 FF089F ACC16
4342 FF089F C2 20 rep #PMFLAG
4343 .LONGA on
4344 .MNLIST
4345 FF08A1 A9 CB 08 lda #passtr1
4346 FF08A4 ACC08
4347 FF08A4 E2 20 sep #PMFLAG
4348 .LONGA off
4349 .MNLIST
4350 FF08A6 A2 FF ldx #^passtr1
4351 FF08A8 SCNPASSTR
4352 FF08A8 02 0B cop $0B
4353 .MNLIST
4354 FF08AA SCN_CR
4355 FF08AA SCNPRCHAR
4356 .MLIST
4357 FF08AA 02 07 cop $07
4358 .MNLIST
4359 FF08AC 0D .DB $0D
4360 .MNLIST
4361 FF08AD CPU16
4362 FF08AD C2 30 rep #(PMFLAG.OR.PXFLAG)
4363 .LONGA on
4364 .LONGI on
4365 .MNLIST
4366 FF08AF A9 DE 08 lda #bufstr1
4367 FF08B2 A2 FF 00 ldx #^bufstr1
4368 FF08B5 A0 0F 00 ldy #blen
4369 FF08B8 SCNBUFOUT
4370 FF08B8 02 0D cop $0D
4371 .MNLIST
4372 FF08BA CPU08
4373 FF08BA E2 30 sep #(PMFLAG.OR.PXFLAG)
4374 .LONGA off
4375 .LONGI off
4376 .MNLIST
4377 FF08BC 60 ?100: rts
4378 FF08BD
4379 FF08BD SCNPRCHAR
4380 FF08BD 02 07 cop $07
4381 .MNLIST
4382 FF08BF 56 .DB 'V'
4383 FF08C0 SCNPRCHAR
4384 FF08C0 02 07 cop $07
4385 .MNLIST
4386 FF08C2 0D .DB $0D
4387 FF08C3 A5 BA lda SMTmpL
4388 FF08C5 02 FF cop $FF
4389 FF08C7 SCNPRCHAR
4390 FF08C7 02 07 cop $07
4391 .MNLIST
4392 FF08C9 0D .DB $0D
4393 FF08CA 60 rts
4394
4395 FF08CB passtr1:
4396 FF08CB 12 .db plen
4397 FF08CC 50 61 73 63 61 .db 'Pascal String Test'
Tue Jul 17 11:00:24 2018 Page 34
6C 20 53 74 72
69 6E 67 20 54
65 73 74
4398 000012 plen .EQU ($ - passtr1 - 1)
4399
4400 FF08DE bufstr1:
4401 FF08DE 42 75 66 66 65 .db 'Buffer Out Test'
72 20 4F 75 74
20 54 65 73 74
4402 00000F blen .EQU ($ - bufstr1)
4403 FF08ED
4404 FF08ED Cmd_true:
4405 FF08ED B0 06 bcs ?10
4406 FF08EF A5 BC lda SMTmpK
4407 FF08F1 05 BB ora SMTmpH
4408 FF08F3 F0 03 beq ?12
4409 FF08F5 4C 1B 0A ?10: jmp CmdErr3
4410 FF08F8 A5 BA ?12: lda SMTmpL
4411 FF08FA 29 7F and #$7F
4412 FF08FC C9 06 cmp #$06
4413 FF08FE B0 F5 bcs ?10
4414 FF0900 8D 66 05 sta $0566
4415 FF0903 A5 BA lda SMTmpL
4416 FF0905 29 80 and #$80
4417 FF0907 85 E2 sta SMTmp2
4418 FF0909 20 48 1A ?14: jsr GetCurCh
4419 FF090C A6 C4 ldx SMbndx
4420 FF090E C9 00 cmp #$00
4421 FF0910 F0 03 beq ?16
4422 FF0912 C9 20 cmp #' '
4423 ;beq ?14
4424 FF0914 CA dex
4425 FF0915 ?16: CPU16
4426 FF0915 C2 30 rep #(PMFLAG.OR.PXFLAG)
4427 .LONGA on
4428 .LONGI on
4429 .MNLIST
4430 FF0917 18 clc
4431 FF0918 8A txa
4432 FF0919 69 00 99 adc #INPUTBUF
4433 FF091C INDEX08
4434 FF091C E2 10 sep #PXFLAG
4435 .LONGI off
4436 .MNLIST
4437 FF091E A2 01 ldx #^INPUTBUF
4438 FF0920 DA phx
4439 FF0921 48 pha
4440 FF0922 A2 40 ldx #$40
4441 FF0924 A9 80 03 lda #$0380
4442 FF0927 85 BA sta SMTmpL
4443 FF0929 86 BC stx SMTmpK
4444 FF092B DA phx
4445 ;pha
4446 FF092C D4 BA pei (SMTmpL)
4447 FF092E A4 E2 ldy SMTmp2
4448 FF0930 5A phy
4449 FF0931 CPU08
Tue Jul 17 11:00:24 2018 Page 35
4450 FF0931 E2 30 sep #(PMFLAG.OR.PXFLAG)
4451 .LONGA off
4452 .LONGI off
4453 .MNLIST
4454 FF0933 TRUENAM
4455 FF0933 02 FE cop $FE
4456 .MNLIST
4457 ;sta SMTmpL
4458 ;xba
4459 ;sta SMTmpH
4460 ;stx SMTmpK
4461 FF0935 90 18 bcc ?1000
4462 FF0937 98 tya
4463 FF0938 SCNPRINT
4464 FF0938 02 01 cop $01
4465 .MNLIST
4466 FF093A 0D 3A 3A 65 72 .DB $0D, '::error code -> ', $00
72 6F 72 20 63
6F 64 65 20 2D
3E 20 00
4467 FF094C 20 4E 19 jsr PrintByte
4468 FF094F ?1000: TXT_CR
4469 FF094F TXTPRCHAR
4470 .MLIST
4471 FF094F 02 08 cop $08
4472 .MNLIST
4473 FF0951 0D .DB $0D
4474 .MNLIST
4475 FF0952 A5 BB lda SMTmpH
4476 FF0954 EB xba
4477 FF0955 A5 BA lda SMTmpL
4478 FF0957 A6 BC ldx SMTmpK
4479 FF0959 SCNSTROUT
4480 FF0959 02 03 cop $03
4481 .MNLIST
4482 ;jsr PrintCR
4483 FF095B 60 rts
4484
4485 FF095C Cmd_dumbon:
4486 .EXTERN lspset, lspset2
4487 FF095C A5 BA lda SMTmpL
4488 FF095E 29 01 and #1
4489 FF0960 AA tax
4490 FF0961 A9 D4 lda #11010100B
4491 FF0963 22 78 0D F8 jsl lspset2
4492 FF0967 A5 BA lda SMTmpL
4493 FF0969 29 01 and #1
4494 FF096B E8 inx
4495 FF096C 8E 50 00 stx .ABS.DflTxtOut
4496 FF096F A2 80 ldx #$80
4497 FF0971 86 C6 stx SMdumb
4498 FF0973 60 rts
4499
4500 FF0974 Cmd_dumboff:
4501 .EXTERN lspres, lspres2
4502 FF0974 AE 50 00 ldx .ABS.DflTxtOut
4503 FF0977 CA dex
Tue Jul 17 11:00:24 2018 Page 36
4504 FF0978 22 8A 0D F8 jsl lspres2
4505 FF097C A2 03 ldx #TXTD_SCN
4506 FF097E 8E 50 00 stx .ABS.DflTxtOut
4507 FF0981 64 C6 stz SMdumb
4508 FF0983 60 rts
4509
4510 ;----------------------------------------------------------
4511 ; comando vdc 0|1 - 0 -> 16MHz, 1 -> 20MHz
4512
4513 .EXTERN VDCX20, VDCREG16
4514 FF0984
4515 FF0984 Cmd_vdc:
4516 FF0984 D0 03 bne ?01
4517 FF0986 4C 1B 0A jmp CmdErr3
4518 FF0989 A5 BC ?01: lda SMTmpK
4519 FF098B 05 BB ora SMTmpH
4520 FF098D F0 03 beq ?02
4521 FF098F 4C 1B 0A jmp CmdErr3
4522 FF0992 A6 BA ?02: ldx SMTmpL
4523 FF0994 E0 02 cpx #$02
4524 FF0996 90 03 bcc ?03
4525 FF0998 4C 1B 0A jmp CmdErr3
4526 FF099B AD 1F FD ?03: lda VIA1+VIAPRANH ; bit 1 -> dot clock
4527 FF099E 29 02 and #$02 ; maschera bit 1
4528 FF09A0 F0 0B beq ?04 ; dot clock = 16MHz
4529 FF09A2 E0 01 cpx #$01
4530 FF09A4 F0 30 beq ?20 ; gia' impostato su 20MHz
4531 FF09A6 1C 1F FD trb VIA1+VIAPRANH ; DOTCLOCK 16MHZ - PAL RGB
4532 FF09A9 A2 00 ldx #0 ; indice per setup 16MHZ
4533 FF09AB F0 0A beq ?08
4534 FF09AD 8A ?04: txa
4535 FF09AE F0 26 beq ?20 ; gia' impostato su 16MHz
4536 FF09B0 A9 02 lda #$02
4537 FF09B2 1C 1F FD trb VIA1+VIAPRANH ; DOTCLOCK 20MHZ - VGA
4538 FF09B5 A2 00 ldx #0 ; indice per setup 20MHZ
4539 FF09B7 A9 01 ?08: lda #$01 ; video VDC OFF
4540 FF09B9 0C 1F FD tsb VIA1+VIAPRANH
4541 FF09BC BF 48 AF F8 ?10: LDA >VDCREG16,X
4542 FF09C0 30 0F BMI ?12
4543 FF09C2 A8 tay
4544 FF09C3 E8 INX
4545 FF09C4 BF 48 AF F8 LDA >VDCREG16,X
4546 FF09C8 E8 INX
4547 FF09C9 8C 4E FD STY VDCAddr
4548 FF09CC 8D 4F FD STA VDCData
4549 FF09CF 80 EB BRA ?10
4550 FF09D1 A9 01 ?12: lda #$01 ; video VDC ON
4551 FF09D3 1C 1F FD trb VIA1+VIAPRANH
4552 FF09D6 60 ?20: rts
4553
4554 FF09D7
4555 ;----------------------------------------------------------
4556 ; diagnostica floppy disk
4557
4558 FF09D7
4559 ; fdtest [0|1] - controlla presenza/cambio disco nel drive
4560 FF09D7 Cmd_fdtest:
Tue Jul 17 11:00:24 2018 Page 37
4561 FF09D7 F0 42 beq CmdErr3
4562 FF09D9 A5 BC lda SMTmpK
4563 FF09DB 05 BB ora SMTmpH
4564 FF09DD D0 3C bne CmdErr3
4565 FF09DF A6 BA ldx SMTmpL
4566 FF09E1 E0 02 cpx #$02
4567 FF09E3 B0 36 bcs CmdErr3
4568 FF09E5 FDCTST
4569 FF09E5 02 30 cop $30
4570 FF09E7 03 .DB $03
4571 .MNLIST
4572 FF09E8 08 drs: php
4573 FF09E9 SCNPRINT
4574 FF09E9 02 01 cop $01
4575 .MNLIST
4576 FF09EB 0D 3A 3A 65 72 .DB $0D, '::error code -> ', $00
72 6F 72 20 63
6F 64 65 20 2D
3E 20 00
4577 FF09FD AD 48 00 lda !fdcerr
4578 FF0A00 20 71 19 jsr PrintHex
4579 FF0A03 SCNPRINT
4580 FF0A03 02 01 cop $01
4581 .MNLIST
4582 FF0A05 20 20 2D 20 20 .DB ' - CF -> ', $00
43 46 20 2D 3E
20 00
4583 FF0A11 28 plp
4584 FF0A12 A9 30 lda #'0'
4585 FF0A14 90 02 bcc ?03
4586 FF0A16 A9 31 lda #'1'
4587 FF0A18 ?03: SCNCHAROUT
4588 FF0A18 02 05 cop $05
4589 .MNLIST
4590 FF0A1A 60 rts
4591
4592 FF0A1B CmdErr3:
4593 FF0A1B 4C 34 01 jmp ErrCls2
4594
4595
4596 ; fdread drive+flag fmt buffer track [head sect sectnum vervbuf]
4597 ;Cmd_fdread:
4598 FF0A1E B0 FB bcs CmdErr3 ; no parametri
4599 FF0A20 20 C8 19 jsr GetFDCParm
4600 FF0A23 B0 07 bcs FdcClean
4601 FF0A25 FDCREAD
4602 FF0A25 02 31 cop $31
4603 FF0A27 00 .DB $00
4604 .MNLIST
4605 FF0A28 20 E8 09 jsr drs
4606 FF0A2B 18 clc
4607 FF0A2C FdcClean:
4608 FF0A2C 08 php
4609 FF0A2D FA plx
4610 FF0A2E ACC16
4611 FF0A2E C2 20 rep #PMFLAG
4612 .LONGA on
Tue Jul 17 11:00:24 2018 Page 38
4613 .MNLIST
4614 FF0A30 3B tsc
4615 FF0A31 18 clc
4616 FF0A32 69 09 00 adc #FDPBSIZE
4617 FF0A35 1B tcs
4618 FF0A36 ACC08
4619 FF0A36 E2 20 sep #PMFLAG
4620 .LONGA off
4621 .MNLIST
4622 FF0A38 DA phx
4623 FF0A39 28 plp
4624 FF0A3A B0 DF bcs CmdErr3
4625 FF0A3C 60 rts
4626
4627 ;Cmd_fdwrite:
4628 FF0A3D B0 DC bcs CmdErr3 ; no parametri
4629 FF0A3F 20 C8 19 jsr GetFDCParm
4630 FF0A42 B0 E8 bcs FdcClean
4631 FF0A44 FDCWRITE
4632 FF0A44 02 31 cop $31
4633 FF0A46 02 .DB $02
4634 .MNLIST
4635 FF0A47 20 E8 09 jsr drs
4636 FF0A4A 18 clc
4637 FF0A4B 90 DF bcc FdcClean
4638 FF0A4D
4639 FF0A4D
4640 ;----------------------------------------------------------
4641 ; comando m
4642
4643 FF0A4D Cmd_xmt:
4644 FF0A4D F0 13 beq ?00c ; no params - full test
4645 FF0A4F A5 BC lda SMTmpK
4646 FF0A51 05 BB ora SMTmpH
4647 FF0A53 D0 06 bne ?00a ; max . $1F
4648 FF0A55 A5 BA lda SMTmpL ; banco X mem in test
4649 FF0A57 C9 20 cmp #$20
4650 FF0A59 90 03 bcc ?00b ; OK
4651 FF0A5B 4C 34 01 ?00a: jmp ErrCls2 ; errore - banco > $1F
4652 FF0A5E A9 01 ?00b: lda #$01 ; un banco (64k)
4653 FF0A60 D0 04 bne ?00d
4654 FF0A62 A9 20 ?00c: lda #$20 ; numero banchi full test (2Mb)
4655 FF0A64 64 BA stz SMTmpL ; banco start = $00 per full test
4656 FF0A66 85 BB ?00d: sta SMTmpH ; numero banchi da 64k
4657 FF0A68 9C 4B 00 stz !CtrlBrk ; clear CTRL BREAK flag
4658 FF0A6B AE 0A FC ldx CRXME ; salva impostazione X mem
4659 FF0A6E DA phx
4660 FF0A6F AD 28 FD lda PIA0+PIAPRA ; salva banco X mem
4661 FF0A72 48 pha
4662 FF0A73 8D 0B FC sta CRXMEON ; abilita X mem
4663 FF0A76 A5 BA lda SMTmpL ; calcola pagina X mem
4664 FF0A78 0A asl a ; moltiplica x 8
4665 FF0A79 0A asl a
4666 FF0A7A 0A asl a
4667 FF0A7B 8D 28 FD sta PIA0+PIAPRA ; pagina fisica di start
4668 FF0A7E SCN_CR
4669 FF0A7E SCNPRCHAR
Tue Jul 17 11:00:24 2018 Page 39
4670 .MLIST
4671 FF0A7E 02 07 cop $07
4672 .MNLIST
4673 FF0A80 0D .DB $0D
4674 .MNLIST
4675 FF0A81 A5 BB lda SMTmpH
4676 FF0A83 C9 01 cmp #$01
4677 FF0A85 F0 23 beq ?00e ; testa un banco
4678 FF0A87 SCNPRINT
4679 FF0A87 02 01 cop $01
4680 .MNLIST
4681 FF0A89 3A 3A 46 75 6C .DB '::Full eXtended memory test: $', 0
6C 20 65 58 74
65 6E 64 65 64
20 6D 65 6D 6F
72 79 20 74 65
73 74 3A 20 24
00
4682 FF0AA8 80 21 bra ?00f
4683 FF0AAA ?00e: SCNPRINT
4684 FF0AAA 02 01 cop $01
4685 .MNLIST
4686 FF0AAC 3A 3A 65 58 74 .DB '::eXtended memory bank test: $', 0
65 6E 64 65 64
20 6D 65 6D 6F
72 79 20 62 61
6E 6B 20 74 65
73 74 3A 20 24
00
4687 FF0ACB ?00f: SCNGETPOS
4688 FF0ACB 02 18 cop $18
4689 FF0ACD 02 .DB $02
4690 .MNLIST
4691 FF0ACE 86 D6 stx SMAuxL
4692 FF0AD0 84 D7 sty SMAuxH
4693 FF0AD2 ?01: INDEX08
4694 FF0AD2 E2 10 sep #PXFLAG
4695 .LONGI off
4696 .MNLIST
4697 FF0AD4 A6 D6 ldx SMAuxL ; pos. banco
4698 FF0AD6 A4 D7 ldy SMAuxH
4699 FF0AD8 SCNSETPOS
4700 FF0AD8 02 18 cop $18
4701 FF0ADA 03 .DB $03
4702 .MNLIST
4703 FF0ADB A5 BA lda SMTmpL ; print banco
4704 FF0ADD 20 71 19 jsr PrintHex
4705 FF0AE0 SCNGETPOS ; pos. address
4706 FF0AE0 02 18 cop $18
4707 FF0AE2 02 .DB $02
4708 .MNLIST
4709 FF0AE3 86 F6 stx SMXPos
4710 FF0AE5 84 F7 sty SMYPos
4711 FF0AE7 A9 08 lda #$08 ; 8 cicli per banco
4712 FF0AE9 85 BC sta SMTmpK
4713 FF0AEB INDEX16
4714 FF0AEB C2 10 rep #PXFLAG
Tue Jul 17 11:00:24 2018 Page 40
4715 .LONGI on
4716 .MNLIST
4717 FF0AED A0 00 00 ?02: ldy #$0000
4718 FF0AF0 20 80 1A jsr CkStop
4719 FF0AF3 F0 5C beq ?10
4720 FF0AF5 B9 00 20 ?03: lda $012000,y ; finestra $2000 - $3FFF
4721 FF0AF8 EB xba
4722 FF0AF9 A9 55 lda #$55
4723 FF0AFB 99 00 20 sta $012000,y
4724 FF0AFE D9 00 20 cmp $012000,y
4725 FF0B01 D0 08 bne ?05
4726 FF0B03 A9 AA lda #$AA
4727 FF0B05 99 00 20 sta $012000,y
4728 FF0B08 D9 00 20 cmp $012000,y
4729 FF0B0B 08 ?05: php
4730 FF0B0C EB xba
4731 FF0B0D 99 00 20 sta $012000,y
4732 FF0B10 84 BE sty SMSizeL
4733 FF0B12 28 plp
4734 FF0B13 D0 2D bne ?09
4735 FF0B15 A5 BE lda SMSizeL ; stampa solo indirizzi di pagina
4736 FF0B17 D0 05 bne ?08
4737 FF0B19 20 5D 0B jsr XmtPrint
4738 FF0B1C INDEX16
4739 FF0B1C C2 10 rep #PXFLAG
4740 .LONGI on
4741 .MNLIST
4742 FF0B1E A4 BE ?08: ldy SMSizeL
4743 FF0B20 C8 iny
4744 FF0B21 C0 00 20 cpy #$2000 ; 8k
4745 FF0B24 90 CF bcc ?03
4746 FF0B26 EE 28 FD inc PIA0+PIAPRA ; banco successivo
4747 FF0B29 C6 BC dec SMTmpK ; loop 64k
4748 FF0B2B D0 C0 bne ?02
4749 FF0B2D E6 BA inc SMTmpL ; banco successivo
4750 FF0B2F C6 BB dec SMTmpH
4751 FF0B31 D0 9F bne ?01 ; loop banchi
4752 FF0B33 CE 28 FD dec PIA0+PIAPRA
4753 FF0B36 20 5D 0B jsr XmtPrint
4754 FF0B39 SCNPRINT
4755 FF0B39 02 01 cop $01
4756 .MNLIST
4757 FF0B3B 2D 20 4F 4B 00 .DB '- OK', 0
4758 FF0B40 80 0F bra ?10
4759 FF0B42 20 5D 0B ?09: jsr XmtPrint
4760 FF0B45 SCNPRINT
4761 FF0B45 02 01 cop $01
4762 .MNLIST
4763 FF0B47 2D 20 42 41 44 .DB '- BAD RAM', 0
20 52 41 4D 00
4764 FF0B51 ?10: INDEX08
4765 FF0B51 E2 10 sep #PXFLAG
4766 .LONGI off
4767 .MNLIST
4768 FF0B53 68 pla
4769 FF0B54 8D 28 FD sta PIA0+PIAPRA ; ripristina banco X mem
4770 FF0B57 FA plx ; ripristina bit CRX
Tue Jul 17 11:00:24 2018 Page 41
4771 FF0B58 9F 0A FC 00 sta CRXME,x
4772 FF0B5C 60 rts
4773
4774 FF0B5D XmtPrint:
4775 FF0B5D INDEX08
4776 FF0B5D E2 10 sep #PXFLAG
4777 .LONGI off
4778 .MNLIST
4779 FF0B5F A6 F6 ldx SMXPos
4780 FF0B61 A4 F7 ldy SMYPos
4781 FF0B63 SCNSETPOS
4782 FF0B63 02 18 cop $18
4783 FF0B65 03 .DB $03
4784 .MNLIST
4785 FF0B66 AD 28 FD lda PIA0+PIAPRA
4786 FF0B69 0A asl a
4787 FF0B6A 0A asl a
4788 FF0B6B 0A asl a
4789 FF0B6C 0A asl a
4790 FF0B6D 0A asl a
4791 FF0B6E 05 BF ora SMSizeH ; indirizzo fisico (Hi)
4792 FF0B70 AA tax
4793 FF0B71 A5 BE lda SMSizeL
4794 FF0B73 4C 48 19 jmp PrintWord
4795 FF0B76
4796 FF0B76 Cmd_kmt:
4797 FF0B76 F0 15 beq ?00c ; no params - full test
4798 FF0B78 A5 BC lda SMTmpK
4799 FF0B7A 05 BB ora SMTmpH
4800 FF0B7C D0 08 bne ?00a ; max . $F7
4801 FF0B7E A5 BA lda SMTmpL ; banco std mem in test
4802 FF0B80 F0 04 beq ?00a ; no test in banco 0 !
4803 FF0B82 C9 F8 cmp #$F8
4804 FF0B84 90 03 bcc ?00b ; OK
4805 FF0B86 4C 34 01 ?00a: jmp ErrCls2 ; errore - banco > $F7 oppure banco 0
4806 FF0B89 A9 01 ?00b: lda #$01 ; un banco (64k)
4807 FF0B8B D0 06 bne ?00d
4808 FF0B8D A9 F7 ?00c: lda #$F7 ; numero banchi full test (eccetto 0 e F8/FF)
4809 FF0B8F A2 01 ldx #$01
4810 FF0B91 86 BA stx SMTmpL ; banco start = $01 per full test
4811 FF0B93 85 BB ?00d: sta SMTmpH ; numero banchi da 64k
4812 FF0B95 9C 4B 00 stz !CtrlBrk ; clear CTRL BREAK flag
4813 FF0B98 SCN_CR
4814 FF0B98 SCNPRCHAR
4815 .MLIST
4816 FF0B98 02 07 cop $07
4817 .MNLIST
4818 FF0B9A 0D .DB $0D
4819 .MNLIST
4820 FF0B9B A5 BB lda SMTmpH
4821 FF0B9D C9 01 cmp #$01
4822 FF0B9F F0 1A beq ?00e ; testa un banco
4823 FF0BA1 SCNPRINT
4824 FF0BA1 02 01 cop $01
4825 .MNLIST
4826 FF0BA3 3A 3A 46 75 6C .DB '::Full memory test: $', 0
6C 20 6D 65 6D
Tue Jul 17 11:00:24 2018 Page 42
6F 72 79 20 74
65 73 74 3A 20
24 00
4827 FF0BB9 80 18 bra ?00f
4828 FF0BBB ?00e: SCNPRINT
4829 FF0BBB 02 01 cop $01
4830 .MNLIST
4831 FF0BBD 3A 3A 4D 65 6D .DB '::Memory bank test: $', 0
6F 72 79 20 62
61 6E 6B 20 74
65 73 74 3A 20
24 00
4832 FF0BD3 ?00f: SCNGETPOS
4833 FF0BD3 02 18 cop $18
4834 FF0BD5 02 .DB $02
4835 .MNLIST
4836 FF0BD6 86 D6 stx SMAuxL
4837 FF0BD8 84 D7 sty SMAuxH
4838 FF0BDA AE 0A FC ldx CRXME ; salva impostazione X mem
4839 FF0BDD DA phx
4840 FF0BDE AE 0C FC ldx CREME ; salva impostazione E mem
4841 FF0BE1 DA phx
4842 FF0BE2 AE 08 FC ldx CRXFE ; salva impostazione flash mem
4843 FF0BE5 DA phx
4844 FF0BE6 8D 0A FC sta CRXMEOFF ; disabilita X mem
4845 FF0BE9 8D 0C FC sta CREMEOFF ; disabilita E mem
4846 FF0BEC 8D 08 FC sta CRXFEOFF ; disabilita F mem
4847 FF0BEF 8B phb ; salva PBR
4848 FF0BF0 ?01: INDEX08
4849 FF0BF0 E2 10 sep #PXFLAG
4850 .LONGI off
4851 .MNLIST
4852 FF0BF2 A6 D6 ldx SMAuxL ; pos. banco
4853 FF0BF4 A4 D7 ldy SMAuxH
4854 FF0BF6 SCNSETPOS
4855 FF0BF6 02 18 cop $18
4856 FF0BF8 03 .DB $03
4857 .MNLIST
4858 FF0BF9 A5 BA lda SMTmpL ; print banco
4859 FF0BFB 20 71 19 jsr PrintHex
4860 FF0BFE SCNGETPOS ; pos. address
4861 FF0BFE 02 18 cop $18
4862 FF0C00 02 .DB $02
4863 .MNLIST
4864 FF0C01 86 F6 stx SMXPos
4865 FF0C03 84 F7 sty SMYPos
4866 FF0C05 INDEX16
4867 FF0C05 C2 10 rep #PXFLAG
4868 .LONGI on
4869 .MNLIST
4870 FF0C07 A5 BA lda SMTmpL ; imposta PBR corrente
4871 FF0C09 48 pha
4872 FF0C0A AB plb
4873 FF0C0B A0 00 00 ldy #$0000
4874 FF0C0E 20 80 1A jsr CkStop
4875 FF0C11 F0 4F beq ?10
4876 FF0C13 B9 00 00 ?02: lda !$0000,y
Tue Jul 17 11:00:24 2018 Page 43
4877 FF0C16 EB xba
4878 FF0C17 A9 55 lda #$55
4879 FF0C19 99 00 00 sta !$0000,y
4880 FF0C1C D9 00 00 cmp !$0000,y
4881 FF0C1F D0 08 bne ?05
4882 FF0C21 A9 AA lda #$AA
4883 FF0C23 99 00 00 sta !$0000,y
4884 FF0C26 D9 00 00 cmp !$0000,y
4885 FF0C29 08 ?05: php
4886 FF0C2A EB xba
4887 FF0C2B 99 00 00 sta !$0000,y
4888 FF0C2E 84 BE sty SMSizeL
4889 FF0C30 28 plp
4890 FF0C31 D0 20 bne ?09
4891 FF0C33 A5 BE lda SMSizeL
4892 FF0C35 D0 05 bne ?08
4893 FF0C37 20 72 0C jsr MemPrint
4894 FF0C3A INDEX16
4895 FF0C3A C2 10 rep #PXFLAG
4896 .LONGI on
4897 .MNLIST
4898 FF0C3C A4 BE ?08: ldy SMSizeL
4899 FF0C3E C8 iny
4900 FF0C3F D0 D2 bne ?02
4901 FF0C41 E6 BA inc SMTmpL ; banco successivo
4902 FF0C43 C6 BB dec SMTmpH
4903 FF0C45 D0 A9 bne ?01 ; loop banchi
4904 FF0C47 20 72 0C jsr MemPrint
4905 FF0C4A SCNPRINT
4906 FF0C4A 02 01 cop $01
4907 .MNLIST
4908 FF0C4C 2D 20 4F 4B 00 .DB '- OK', 0
4909 FF0C51 80 0F bra ?10
4910 FF0C53 20 72 0C ?09: jsr MemPrint
4911 FF0C56 SCNPRINT
4912 FF0C56 02 01 cop $01
4913 .MNLIST
4914 FF0C58 2D 20 42 41 44 .DB '- BAD RAM', 0
20 52 41 4D 00
4915 FF0C62
4916 FF0C62 ?10: INDEX08
4917 FF0C62 E2 10 sep #PXFLAG
4918 .LONGI off
4919 .MNLIST
4920 FF0C64 AB plb ; ripristina banco
4921 FF0C65 FA plx
4922 FF0C66 8D 08 FC sta CRXFE ; ripristina impostazione F mem
4923 FF0C69 FA plx
4924 FF0C6A 8D 0C FC sta CREME ; ripristina impostazione E mem
4925 FF0C6D FA plx
4926 FF0C6E 8D 0A FC sta CRXME ; ripristina impostazione M mem
4927 FF0C71 60 rts
4928
4929 FF0C72 MemPrint:
4930 FF0C72 INDEX08
4931 FF0C72 E2 10 sep #PXFLAG
4932 .LONGI off
Tue Jul 17 11:00:24 2018 Page 44
4933 .MNLIST
4934 FF0C74 A6 F6 ldx SMXPos
4935 FF0C76 A4 F7 ldy SMYPos
4936 FF0C78 SCNSETPOS
4937 FF0C78 02 18 cop $18
4938 FF0C7A 03 .DB $03
4939 .MNLIST
4940 FF0C7B A5 BE lda SMSizeL
4941 FF0C7D A6 BF ldx SMSizeH
4942 FF0C7F 4C 48 19 jmp PrintWord
4943 FF0C82
4944 ; r -> show registri CPU
4945 FF0C82 PrintReg:
4946 FF0C82 CPU16
4947 FF0C82 C2 30 rep #(PMFLAG.OR.PXFLAG)
4948 .LONGA on
4949 .LONGI on
4950 .MNLIST
4951 FF0C84 BA tsx
4952 FF0C85 E8 inx
4953 FF0C86 E8 inx
4954 FF0C87 86 D4 stx SMsp
4955 FF0C89 CPU08
4956 FF0C89 E2 30 sep #(PMFLAG.OR.PXFLAG)
4957 .LONGA off
4958 .LONGI off
4959 .MNLIST
4960 FF0C8B SCNPRINT
4961 FF0C8B 02 01 cop $01
4962 .MNLIST
4963 FF0C8D
4964 FF0C8D 0D 20 20 4B 52 .DB KB_CR, ' KR PC BR DP SR AC XR YR SP', KB_CR
20 20 50 43 20
20 42 52 20 20
44 50 20 20 53
52 20 20 41 43
20 20 20 58 52
20 20 20 59 52
20 20 20 53 50
0D
4965 FF0CB6 3B 20 1B 51 00 .DB '; ', KB_ESC, 'Q', 0
4966 FF0CBB
4967 FF0CBB A5 C7 lda SMkr ; stampa PBR (K)
4968 FF0CBD 20 4E 19 jsr PrintByte
4969 FF0CC0 A5 C8 lda SMpc ; stampa PCL
4970 FF0CC2 A6 C9 ldx SMpc+1 ; stampa PCH
4971 FF0CC4 20 48 19 jsr PrintWord
4972 FF0CC7 A5 CB lda SMbr ; stampa DBR (B)
4973 FF0CC9 20 4E 19 jsr PrintByte
4974 FF0CCC A5 CC lda SMdp ; stampa DPL
4975 FF0CCE A6 CD ldx SMdp+1 ; stampa DPH
4976 FF0CD0 20 48 19 jsr PrintWord
4977 FF0CD3 A5 CA lda SMsr ; stampa SR
4978 FF0CD5 20 4E 19 jsr PrintByte
4979 FF0CD8 A5 CE lda SMac ; stampa AL
4980 FF0CDA A6 CF ldx SMac+1 ; stampa AH
4981 FF0CDC 20 48 19 jsr PrintWord
Tue Jul 17 11:00:24 2018 Page 45
4982 FF0CDF A5 D0 lda SMxr ; stampa XL
4983 FF0CE1 A6 D1 ldx SMxr+1 ; stampa XH
4984 FF0CE3 20 48 19 jsr PrintWord
4985 FF0CE6 A5 D2 lda SMyr ; stampa XL
4986 FF0CE8 A6 D3 ldx SMyr+1 ; stampa YH
4987 FF0CEA 20 48 19 jsr PrintWord
4988 FF0CED A5 D4 lda SMsp ; stampa SPL
4989 FF0CEF A6 D5 ldx SMsp+1 ; stampa SPH
4990 FF0CF1 4C 48 19 jmp PrintWord
4991
4992 ; comando ';' -> set registri (escluso SP)
4993 FF0CF4 Cmd_SetReg:
4994 FF0CF4 B0 46 bcs ?10
4995 FF0CF6 A5 BA lda SMTmpL
4996 FF0CF8 85 C7 sta SMkr
4997 FF0CFA 20 5A 01 jsr GetParm
4998 FF0CFD B0 3D bcs ?10
4999 FF0CFF A5 BA lda SMTmpL ; pcl
5000 FF0D01 A4 BB ldy SMTmpH ; pch
5001 FF0D03 85 C8 sta SMpc
5002 FF0D05 84 C9 sty SMpc+1
5003 FF0D07 20 5A 01 jsr GetParm
5004 FF0D0A B0 30 bcs ?10
5005 FF0D0C A5 BA lda SMTmpL
5006 FF0D0E 85 CB sta SMbr
5007 FF0D10 20 5A 01 jsr GetParm
5008 FF0D13 B0 27 bcs ?10
5009 FF0D15 A5 BA lda SMTmpL ; dpl
5010 FF0D17 A4 BB ldy SMTmpH ; dph
5011 FF0D19 85 CC sta SMdp
5012 FF0D1B 84 CD sty SMdp+1
5013 FF0D1D 20 5A 01 jsr GetParm
5014 FF0D20 B0 1A bcs ?10
5015 FF0D22 A5 BA lda SMTmpL
5016 FF0D24 85 CA sta SMsr
5017 FF0D26 A0 00 ldy #0 ; legge 3 param. successivi (A, X, Y)
5018 FF0D28 20 5A 01 ?01: jsr GetParm ; non si imposta SP
5019 FF0D2B B0 0F bcs ?10
5020 FF0D2D ACC16
5021 FF0D2D C2 20 rep #PMFLAG
5022 .LONGA on
5023 .MNLIST
5024 FF0D2F A5 BA lda SMTmpL
5025 FF0D31 99 CE 01 sta DP01ADDR+SMac,y
5026 FF0D34 ACC08
5027 FF0D34 E2 20 sep #PMFLAG
5028 .LONGA off
5029 .MNLIST
5030 FF0D36 C8 iny
5031 FF0D37 C8 iny
5032 FF0D38 C0 06 cpy #6
5033 FF0D3A 90 EC bcc ?01
5034 FF0D3C 60 ?10: rts
5035 FF0D3D
5036 ; cre [0|1] -> Expanded Memory $010000-$011FFF off/on
5037 FF0D3D Cmd_cre:
5038 FF0D3D F0 23 beq Cmd_crs ; no paramteri - show
Tue Jul 17 11:00:24 2018 Page 46
5039 FF0D3F A5 BA lda SMTmpL
5040 FF0D41 29 01 and #$01
5041 FF0D43 AA tax
5042 FF0D44 9F 0C FC 00 sta CREME,x
5043 FF0D48 80 18 bra Cmd_crs
5044
5045 ; crx [0|1] -> eXtended Memory $012000-$013FFF off/on
5046 FF0D4A Cmd_crx:
5047 FF0D4A F0 16 beq Cmd_crs ; no paramteri - show
5048 FF0D4C A5 BA lda SMTmpL
5049 FF0D4E 29 01 and #$01
5050 FF0D50 AA tax
5051 FF0D51 9F 0A FC 00 sta CRXME,x
5052 FF0D55 80 0B bra Cmd_crs
5053 FF0D57
5054 ; crf [0|1] -> Flash Memory $F00000-$F0FFFF off/on
5055 FF0D57 Cmd_crf:
5056 FF0D57 F0 09 beq Cmd_crs ; no paramteri - show
5057 FF0D59 A5 BA lda SMTmpL
5058 FF0D5B 29 01 and #$01
5059 FF0D5D AA tax
5060 FF0D5E 9F 08 FC 00 sta CRXFE,x
5061
5062 ; crs -> show stato registro di controllo accesso memoria
5063 FF0D62 Cmd_crs:
5064 FF0D62 A2 00 ldx #0
5065 FF0D64 BF 8F 1C FF ?01: lda CRSTR,x ; copia stringa nel buffer
5066 FF0D68 9F 00 99 01 sta INPUTBUF,x
5067 FF0D6C F0 03 beq ?01a
5068 FF0D6E E8 inx
5069 FF0D6F D0 F3 bne ?01
5070 FF0D71 A2 17 ?01a: ldx #23 ; flag EM
5071 FF0D73 A9 30 lda #'0'
5072 FF0D75 AC 0C FC ldy CREME
5073 FF0D78 F0 01 beq ?02
5074 FF0D7A 1A inc a
5075 FF0D7B 9F 00 99 01 ?02: sta INPUTBUF,x
5076 FF0D7F A2 2F ldx #47 ; flag XM
5077 FF0D81 A9 30 lda #'0'
5078 FF0D83 AC 0A FC ldy CRXME
5079 FF0D86 F0 01 beq ?03
5080 FF0D88 1A inc a
5081 FF0D89 9F 00 99 01 ?03: sta INPUTBUF,x
5082 FF0D8D A2 47 ldx #71 ; flag FM
5083 FF0D8F A9 30 lda #'0'
5084 FF0D91 AC 08 FC ldy CRXFE
5085 FF0D94 F0 01 beq ?04
5086 FF0D96 1A inc a
5087 FF0D97 9F 00 99 01 ?04: sta INPUTBUF,x
5088 FF0D9B ACC16
5089 FF0D9B C2 20 rep #PMFLAG
5090 .LONGA on
5091 .MNLIST
5092 FF0D9D A9 00 99 lda #INPUTBUF
5093 FF0DA0 A2 01 ldx #.SEG.INPUTBUF
5094 FF0DA2 SCNSTROUT
5095 FF0DA2 02 03 cop $03
Tue Jul 17 11:00:24 2018 Page 47
5096 .MNLIST
5097 FF0DA4 CPU08
5098 FF0DA4 E2 30 sep #(PMFLAG.OR.PXFLAG)
5099 .LONGA off
5100 .LONGI off
5101 .MNLIST
5102 FF0DA6 60 rts
5103
5104 ; xmp [page] -> set page extended memory
5105 FF0DA7 Cmd_SetXMPage:
5106 FF0DA7 F0 0D beq ?10 ; no paramteri - show
5107 FF0DA9 ACC16
5108 FF0DA9 C2 20 rep #PMFLAG
5109 .LONGA on
5110 .MNLIST
5111 FF0DAB A5 BB lda SMTmpH
5112 FF0DAD ACC08
5113 FF0DAD E2 20 sep #PMFLAG
5114 .LONGA off
5115 .MNLIST
5116 FF0DAF D0 6F bne CmdErr
5117 FF0DB1 A5 BA lda SMTmpL
5118 FF0DB3 8D 28 FD sta PIA0+PIAPRA
5119 FF0DB6 ?10: SCNPRINT
5120 FF0DB6 02 01 cop $01
5121 .MNLIST
5122 FF0DB8 0D 3A 3A 20 43 .DB $0D, ':: Current XM Page -> $', 0
75 72 72 65 6E
74 20 58 4D 20
50 61 67 65 20
2D 3E 20 24 00
5123 FF0DD1
5124 FF0DD1 AD 28 FD lda PIA0+PIAPRA
5125 FF0DD4 20 71 19 jsr PrintHex
5126 FF0DD7 60 rts
5127
5128 ; m [start][stop] -> visualizza memoria standard
5129 FF0DD8 Cmd_m:
5130 FF0DD8 B0 08 bcs ?01
5131 FF0DDA 20 92 18 jsr TmpToAddr
5132 FF0DDD 20 5A 01 jsr GetParm
5133 FF0DE0 90 06 bcc ?02
5134 FF0DE2 A9 0B ?01: lda #11 ; numero righe x 16 bytes
5135 FF0DE4 85 BA sta SMTmpL
5136 FF0DE6 D0 1B bne ?03
5137 FF0DE8 20 9F 18 ?02: jsr SubTmpAddr
5138 FF0DEB 90 33 bcc CmdErr ; end address > start address - errore
5139 FF0DED 4A lsr a ; calcola numero righe (x 16 bytes)
5140 FF0DEE 66 BB ror SMTmpH
5141 FF0DF0 66 BA ror SMTmpL
5142 FF0DF2 4A lsr a
5143 FF0DF3 66 BB ror SMTmpH
5144 FF0DF5 66 BA ror SMTmpL
5145 FF0DF7 4A lsr a
5146 FF0DF8 66 BB ror SMTmpH
5147 FF0DFA 66 BA ror SMTmpL
5148 FF0DFC 4A lsr a
Tue Jul 17 11:00:24 2018 Page 48
5149 FF0DFD 66 BB ror SMTmpH
5150 FF0DFF 66 BA ror SMTmpL
5151 FF0E01 85 BC sta SMTmpK
5152 FF0E03 20 80 1A ?03: jsr CkStop
5153 FF0E06 F0 17 beq ?04
5154 FF0E08 20 F2 0E jsr DispMem
5155 FF0E0B C2 21 rep #(PMFLAG.OR.PCFLAG) ; 16 bit + clc
5156 .LONGA on
5157 FF0E0D A9 10 00 lda #16
5158 .LONGA off
5159 FF0E10 20 F4 18 jsr IncPtrA
5160 FF0E13 20 B1 18 jsr DecTmpPtr
5161 FF0E16 B0 EB bcs ?03
5162 FF0E18 A5 C6 lda SMdumb
5163 FF0E1A F0 03 beq ?04
5164 FF0E1C TXT_CR
5165 FF0E1C TXTPRCHAR
5166 .MLIST
5167 FF0E1C 02 08 cop $08
5168 .MNLIST
5169 FF0E1E 0D .DB $0D
5170 .MNLIST
5171 FF0E1F 60 ?04: rts
5172 FF0E20
5173 FF0E20 CmdErr:
5174 FF0E20 4C 34 01 jmp ErrCls2
5175
5176 ; rd addr -> read single memory addr.
5177 FF0E23 Cmd_rd:
5178 FF0E23 F0 FB beq CmdErr ; no params
5179 FF0E25 20 92 18 jsr TmpToAddr
5180 FF0E28 SCNPRINT
5181 FF0E28 02 01 cop $01
5182 .MNLIST
5183 FF0E2A 1B 4F 01 0D 72 .DB KB_ESC, 'O', SCN_CSRUP, $0D, 'rd ', 0
64 20 00
5184 FF0E32 20 37 19 jsr PrintAddr
5185 FF0E35 20 51 19 jsr PrintBlank
5186 FF0E38 A7 B6 lda [SMAddrL]
5187 FF0E3A 4C 71 19 jmp PrintHex
5188
5189 ; wr addr data -> write single memory addr.
5190 FF0E3D Cmd_wr:
5191 FF0E3D F0 E1 beq CmdErr ; no params
5192 FF0E3F B0 DF bcs CmdErr
5193 FF0E41 20 92 18 jsr TmpToAddr
5194 FF0E44 20 5A 01 jsr GetParm
5195 FF0E47 B0 D7 bcs CmdErr ; manca data
5196 FF0E49 A5 BA lda SMTmpL
5197 FF0E4B 87 B6 sta [SMAddrL]
5198 FF0E4D SCNPRINT
5199 FF0E4D 02 01 cop $01
5200 .MNLIST
5201 FF0E4F 1B 4F 01 0D 77 .DB KB_ESC, 'O', SCN_CSRUP, $0D, 'wr ', 0
72 20 00
5202 FF0E57 20 37 19 jsr PrintAddr
5203 FF0E5A 20 51 19 jsr PrintBlank
Tue Jul 17 11:00:24 2018 Page 49
5204 FF0E5D A5 BA lda SMTmpL
5205 FF0E5F 4C 71 19 jmp PrintHex
5206
5207 ; xs [sector]
5208 FF0E62 Cmd_xs:
5209 FF0E62 D0 04 bne ?02
5210 FF0E64 64 BA stz SMTmpL
5211 FF0E66 64 BB stz SMTmpH
5212 FF0E68 ?02: ACC16
5213 FF0E68 C2 20 rep #PMFLAG
5214 .LONGA on
5215 .MNLIST
5216 FF0E6A A5 BA lda SMTmpL
5217 FF0E6C 29 FF 0F and #$0FFF
5218 FF0E6F 0A asl a
5219 FF0E70 ACC08
5220 FF0E70 E2 20 sep #PMFLAG
5221 .LONGA off
5222 .MNLIST
5223 FF0E72 EB xba
5224 FF0E73 85 B8 sta SMAddrK
5225 FF0E75 EB xba
5226 FF0E76 85 B7 sta SMAddrH
5227 FF0E78 64 B6 stz SMAddrL
5228 ;stz SMTmpL
5229 FF0E7A 64 BB stz SMTmpH
5230 FF0E7C 80 10 bra __?01
5231 FF0E7E
5232 ; mx [start][stop] -> visualizza memoria estesa (max. 1FFFFF)
5233 FF0E7E Cmd_mx:
5234 FF0E7E B0 0E bcs __?01
5235 FF0E80 20 92 18 jsr TmpToAddr
5236 FF0E83 A5 B8 lda SMAddrK
5237 FF0E85 C9 20 cmp #$20
5238 FF0E87 B0 97 bcs CmdErr ; max. 1FFFFF
5239 FF0E89 20 5A 01 jsr GetParm
5240 FF0E8C 90 06 bcc __?02
5241 FF0E8E A9 0B __?01: lda #11 ; numero di righe di default (righe x 16 bytes)
5242 FF0E90 85 BA sta SMTmpL
5243 FF0E92 D0 21 bne __?03
5244 FF0E94 A5 BC __?02: lda SMTmpK ; max. possibile 1FFFFF
5245 FF0E96 C9 20 cmp #$20
5246 FF0E98 B0 86 bcs CmdErr ; errore
5247 FF0E9A 20 9F 18 jsr SubTmpAddr
5248 FF0E9D 90 81 bcc CmdErr ; end address > start address - errore
5249 FF0E9F 4A lsr a ; calcola numero righe (x 16 bytes)
5250 FF0EA0 66 BB ror SMTmpH
5251 FF0EA2 66 BA ror SMTmpL
5252 FF0EA4 4A lsr a
5253 FF0EA5 66 BB ror SMTmpH
5254 FF0EA7 66 BA ror SMTmpL
5255 FF0EA9 4A lsr a
5256 FF0EAA 66 BB ror SMTmpH
5257 FF0EAC 66 BA ror SMTmpL
5258 FF0EAE 4A lsr a
5259 FF0EAF 66 BB ror SMTmpH
5260 FF0EB1 66 BA ror SMTmpL
Tue Jul 17 11:00:24 2018 Page 50
5261 FF0EB3 85 BC sta SMTmpK
5262 FF0EB5 A5 B8 __?03: lda SMAddrK
5263 FF0EB7 C9 20 cmp #$20 ; MAX 1FFFFF
5264 FF0EB9 B0 1B bcs ?04
5265 FF0EBB 20 80 1A jsr CkStop
5266 FF0EBE F0 16 beq ?04
5267 FF0EC0 20 88 10 jsr DispXMem
5268 FF0EC3 C2 21 rep #(PMFLAG.OR.PCFLAG) ; 16 bit + clc
5269 .LONGA on
5270 FF0EC5 A9 10 00 lda #16
5271 .LONGA off
5272 FF0EC8 20 F4 18 jsr IncPtrA
5273 FF0ECB A5 B8 lda SMAddrK
5274 FF0ECD C9 20 cmp #$20 ; MAX 1FFFFF
5275 FF0ECF B0 05 bcs ?04
5276 FF0ED1 20 B1 18 jsr DecTmpPtr
5277 FF0ED4 B0 DF bcs __?03
5278 FF0ED6 60 ?04: rts
5279 FF0ED7
5280
5281 ; >addr data, data, data,... -> set standard memory
5282 FF0ED7 Cmd_SetMem:
5283 FF0ED7 B0 13 bcs ?02
5284 FF0ED9 20 92 18 jsr TmpToAddr
5285 FF0EDC A0 00 ldy #0
5286 FF0EDE 20 5A 01 ?01: jsr GetParm
5287 FF0EE1 B0 09 bcs ?02
5288 FF0EE3 A5 BA lda SMTmpL
5289 FF0EE5 97 B6 sta [SMAddrL],y
5290 FF0EE7 C8 iny
5291 FF0EE8 C0 10 cpy #16
5292 FF0EEA 90 F2 bcc ?01
5293 FF0EEC ?02: SCNPRINT
5294 FF0EEC 02 01 cop $01
5295 .MNLIST
5296 FF0EEE 1B 4F 01 00 .DB KB_ESC, 'O', SCN_CSRUP, 0
5297
5298 ; display 1 riga di memoria
5299 FF0EF2 DispMem:
5300 FF0EF2 TXT_CR
5301 FF0EF2 TXTPRCHAR
5302 .MLIST
5303 FF0EF2 02 08 cop $08
5304 .MNLIST
5305 FF0EF4 0D .DB $0D
5306 .MNLIST
5307 FF0EF5 TXTPRCHAR
5308 FF0EF5 02 08 cop $08
5309 .MNLIST
5310 FF0EF7 3E .DB '>'
5311 FF0EF8 20 37 19 jsr PrintAddr
5312 FF0EFB A0 00 ldy #0
5313 FF0EFD F0 03 beq ?02
5314 FF0EFF 20 51 19 ?01: jsr PrintBlank
5315 FF0F02 B7 B6 ?02: lda [SMAddrL],y ; fetch byte
5316 FF0F04 20 71 19 jsr PrintHex
5317 FF0F07 C8 iny
Tue Jul 17 11:00:24 2018 Page 51
5318 FF0F08 C0 10 cpy #16
5319 FF0F0A 90 F3 bcc ?01
5320 FF0F0C A5 C6 lda SMdumb
5321 FF0F0E D0 08 bne ?03a
5322 FF0F10 SCNPRINT
5323 FF0F10 02 01 cop $01
5324 .MNLIST
5325 FF0F12 20 14 3A 00 .DB ' ', SCN_RVSON, ':', 0
5326 FF0F16 80 05 bra ?03b
5327 FF0F18 ?03a: TXTPRINT
5328 FF0F18 02 02 cop $02
5329 .MNLIST
5330 FF0F1A 20 3A 00 .DB ' :', 0
5331 FF0F1D A0 00 ?03b: ldy #0
5332 FF0F1F B7 B6 ?03: lda [SMAddrL],y ; fetch byte
5333 FF0F21 C9 80 cmp #$80
5334 FF0F23 B0 04 bcs ?04
5335 FF0F25 C9 20 cmp #' '
5336 FF0F27 B0 02 bcs ?06
5337 FF0F29 A9 2E ?04: lda #'.'
5338 FF0F2B ?06: TXTCHAROUT
5339 FF0F2B 02 06 cop $06
5340 .MNLIST
5341 FF0F2D C8 iny
5342 FF0F2E C0 10 cpy #16
5343 FF0F30 90 ED bcc ?03
5344 FF0F32 60 rts
5345
5346 ; # km <src bank> <dest bank>(src bank = $01..$FF, dest bank = $01..$F7)
5347 ; move whole memory bank - src bank and dest bank must be not the same
5348 FF0F33 Cmd_km:
5349 FF0F33 D0 03 bne ?01
5350 FF0F35 4C 4F 10 ?00: jmp CmdErr2
5351 FF0F38 A5 BC ?01: lda SMTmpK
5352 FF0F3A 05 BB ora SMTmpH
5353 FF0F3C D0 F7 bne ?00
5354 FF0F3E A5 BA lda SMTmpL
5355 FF0F40 F0 F3 beq ?00
5356 FF0F42 85 E2 sta SMTmp2
5357 FF0F44 20 5A 01 jsr GetParm
5358 FF0F47 B0 EC bcs ?00
5359 FF0F49 A5 BC lda SMTmpK
5360 FF0F4B 05 BB ora SMTmpH
5361 FF0F4D D0 E6 bne ?00
5362 FF0F4F A5 BA lda SMTmpL
5363 FF0F51 F0 E2 beq ?00
5364 FF0F53 C9 F8 cmp #$F8
5365 FF0F55 B0 DE bcs ?00
5366 FF0F57 C5 E2 cmp SMTmp2
5367 FF0F59 F0 DA beq ?00
5368 FF0F5B 64 B6 stz SMAddrL
5369 FF0F5D 64 B7 stz SMAddrH
5370 FF0F5F 85 B8 sta SMAddrK
5371 FF0F61 8F 75 0F FF sta ?10+1 ; store dest bank for mvn istruction
5372 FF0F65 A5 E2 lda SMTmp2
5373 FF0F67 8F 76 0F FF sta ?10+2 ; store source bank for mvn istruction
5374 FF0F6B 8B phb
Tue Jul 17 11:00:24 2018 Page 52
5375 FF0F6C A2 00 ldx #0
5376 FF0F6E CPU16
5377 FF0F6E C2 30 rep #(PMFLAG.OR.PXFLAG)
5378 .LONGA on
5379 .LONGI on
5380 .MNLIST
5381 FF0F70 A9 FF FF lda #$FFFF
5382 FF0F73 9B txy
5383 FF0F74 54 00 00 ?10: mvn #0, #0
5384 FF0F77 CPU08
5385 FF0F77 E2 30 sep #(PMFLAG.OR.PXFLAG)
5386 .LONGA off
5387 .LONGI off
5388 .MNLIST
5389 FF0F79 AB plb
5390 FF0F7A 60 rts
5391
5392 ; # kF <bank> (bank = $01..$F7)
5393 ; fill whole memory bank with incr/decr pattern
5394 FF0F7B Cmd_kF:
5395 FF0F7B D0 03 bne ?01
5396 FF0F7D 4C 4F 10 ?00: jmp CmdErr2
5397 FF0F80 A5 BC ?01: lda SMTmpK
5398 FF0F82 05 BB ora SMTmpH
5399 FF0F84 D0 F7 bne ?00
5400 FF0F86 A5 BA lda SMTmpL
5401 FF0F88 F0 F3 beq ?00
5402 FF0F8A C9 F8 cmp #$F8
5403 FF0F8C B0 EF bcs ?00
5404 FF0F8E 85 B8 sta SMAddrK
5405 FF0F90 64 B6 stz SMAddrL
5406 FF0F92 64 B7 stz SMAddrH
5407 FF0F94 A9 00 lda #0
5408 FF0F96 85 E2 sta SMTmp2
5409 FF0F98 A8 tay
5410 FF0F99 INDEX16
5411 FF0F99 C2 10 rep #PXFLAG
5412 .LONGI on
5413 .MNLIST
5414 FF0F9B 97 B6 ?02: sta [SMAddrL],y
5415 FF0F9D 24 E2 bit SMTmp2
5416 FF0F9F 30 08 bmi ?04
5417 FF0FA1 1A inc a
5418 FF0FA2 D0 0D bne ?06
5419 FF0FA4 3A dec a
5420 FF0FA5 85 E2 sta SMTmp2
5421 FF0FA7 80 08 bra ?06
5422 FF0FA9 3A ?04: dec a
5423 FF0FAA D0 05 bne ?06
5424 FF0FAC 64 E2 stz SMTmp2
5425 FF0FAE C8 iny
5426 FF0FAF 97 B6 sta [SMAddrL],y
5427 FF0FB1 C8 ?06: iny
5428 FF0FB2 D0 E7 bne ?02
5429 FF0FB4 CPU08
5430 FF0FB4 E2 30 sep #(PMFLAG.OR.PXFLAG)
5431 .LONGA off
Tue Jul 17 11:00:24 2018 Page 53
5432 .LONGI off
5433 .MNLIST
5434 FF0FB6 60 rts
5435
5436 ; # kz <bank> (bank = $01..$F7)
5437 ; clear whole memory bank
5438 FF0FB7 Cmd_kz:
5439 FF0FB7 D0 03 bne ?01
5440 FF0FB9 4C 4F 10 ?00: jmp CmdErr2
5441 FF0FBC A5 BC ?01: lda SMTmpK
5442 FF0FBE 05 BB ora SMTmpH
5443 FF0FC0 D0 F7 bne ?00
5444 FF0FC2 A5 BA lda SMTmpL
5445 FF0FC4 F0 F3 beq ?00
5446 FF0FC6 C9 F8 cmp #$F8
5447 FF0FC8 B0 EF bcs ?00
5448 FF0FCA 85 BC sta SMTmpK
5449 FF0FCC 64 BA stz SMTmpL
5450 FF0FCE 64 BB stz SMTmpH
5451 FF0FD0 A0 00 ldy #0
5452 FF0FD2 CPU16
5453 FF0FD2 C2 30 rep #(PMFLAG.OR.PXFLAG)
5454 .LONGA on
5455 .LONGI on
5456 .MNLIST
5457 FF0FD4 98 tya
5458 FF0FD5 97 BA ?02: sta [SMTmpL],y
5459 FF0FD7 C8 iny
5460 FF0FD8 C8 iny
5461 FF0FD9 D0 FA bne ?02
5462 FF0FDB CPU08
5463 FF0FDB E2 30 sep #(PMFLAG.OR.PXFLAG)
5464 .LONGA off
5465 .LONGI off
5466 .MNLIST
5467 FF0FDD 60 rts
5468
5469 ; # kf <bank> <byte=0> (bank = $01..$F7)
5470 ; fill whole memory bank
5471 FF0FDE Cmd_kf:
5472 FF0FDE F0 6F beq CmdErr2
5473 FF0FE0 A5 BC lda SMTmpK
5474 FF0FE2 05 BB ora SMTmpH
5475 FF0FE4 D0 69 bne CmdErr2
5476 FF0FE6 A5 BA lda SMTmpL
5477 FF0FE8 F0 65 beq CmdErr2
5478 FF0FEA C9 F8 cmp #$F8
5479 FF0FEC B0 61 bcs CmdErr2
5480 FF0FEE 85 B8 sta SMAddrK
5481 FF0FF0 64 B6 stz SMAddrL
5482 FF0FF2 64 B7 stz SMAddrH
5483 FF0FF4 64 BA stz SMTmpL
5484 FF0FF6 20 5A 01 jsr GetParm
5485 FF0FF9 B0 06 bcs ?01
5486 FF0FFB A5 BC lda SMTmpK
5487 FF0FFD 05 BB ora SMTmpH
5488 FF0FFF D0 4E bne CmdErr2
Tue Jul 17 11:00:24 2018 Page 54
5489 FF1001 A5 BA ?01: lda SMTmpL
5490 FF1003 EB xba
5491 FF1004 A5 BA lda SMTmpL
5492 FF1006 A0 00 ldy #0
5493 FF1008 CPU16
5494 FF1008 C2 30 rep #(PMFLAG.OR.PXFLAG)
5495 .LONGA on
5496 .LONGI on
5497 .MNLIST
5498 FF100A 97 B6 ?02: sta [SMAddrL],y
5499 FF100C C8 iny
5500 FF100D C8 iny
5501 FF100E D0 FA bne ?02
5502 FF1010 CPU08
5503 FF1010 E2 30 sep #(PMFLAG.OR.PXFLAG)
5504 .LONGA off
5505 .LONGI off
5506 .MNLIST
5507 FF1012 60 rts
5508 FF1013
5509 FF1013 Cmd_z:
5510 FF1013 20 91 19 jsr GetStartStop ; indirizzi Start/Stop
5511 FF1016 B0 37 bcs CmdErr2
5512 FF1018 64 BA stz SMTmpL ; fill byte = 0
5513 FF101A 64 E2 stz SMTmp2 ; fill no inc.
5514 FF101C 80 19 bra _Fill
5515 FF101E
5516 FF101E Cmd_f:
5517 FF101E 20 91 19 jsr GetStartStop ; indirizzi Start/Stop
5518 FF1021 B0 2C bcs CmdErr2
5519 FF1023 20 5A 01 jsr GetParm ; Fill byte
5520 FF1026 B0 27 bcs CmdErr2
5521 FF1028 64 E2 stz SMTmp2 ; fill no inc.
5522 FF102A 80 0B bra _Fill
5523 FF102C
5524 FF102C Cmd_F:
5525 FF102C 20 91 19 jsr GetStartStop ; indirizzi Start/Stop
5526 FF102F B0 1E bcs CmdErr2
5527 FF1031 64 BA stz SMTmpL ; fill byte = 0
5528 FF1033 A9 80 lda #$80
5529 FF1035 85 E2 sta SMTmp2 ; flag fill-inc
5530 FF1037
5531 ; SMSizeL/H/K -> #bytes
5532 ; SMAddrL/H/K -> indirizzo start
5533 ; SMTmpL -> fill byte
5534 ; SMXddrL/H/K -> indirizzo finale
5535 ; SMTmp2 -> flag fill+inc.
5536
5537 FF1037 _Fill:
5538 FF1037 20 80 1A ?01: jsr CkStop
5539 FF103A F0 12 beq ?10
5540 FF103C A5 BA lda SMTmpL ; fill byte
5541 FF103E 87 B6 sta [SMAddrL]
5542 FF1040 24 E2 bit SMTmp2
5543 FF1042 10 02 bpl ?04
5544 FF1044 E6 BA inc SMTmpL
5545 FF1046 20 EF 18 ?04: jsr IncPtr
Tue Jul 17 11:00:24 2018 Page 55
5546 FF1049 20 DC 18 jsr DecSize
5547 FF104C B0 E9 bcs ?01
5548 FF104E 60 ?10: rts
5549
5550 FF104F CmdErr2:
5551 FF104F 4C 34 01 jmp ErrCls2
5552
5553 ; x>addr data, data, data,... -> set extended memory
5554 FF1052 Cmd_SetXMem:
5555 FF1052 AE 0A FC ldx CRXME ; salva bit CR
5556 FF1055 DA phx
5557 FF1056 8D 0B FC sta CRXMEON ; abilita memoria estesa
5558 FF1059 B0 1E bcs ?02
5559 FF105B 20 92 18 jsr TmpToAddr
5560 FF105E A5 C3 lda SMXAddrK
5561 FF1060 C9 20 cmp #$20
5562 FF1062 B0 EB bcs CmdErr2
5563 FF1064 A0 00 ldy #0
5564 FF1066 20 5A 01 ?01: jsr GetParm
5565 FF1069 B0 0E bcs ?02
5566 FF106B 20 0B 19 jsr XSetPtrY
5567 FF106E B0 09 bcs ?02 ; fine memoria estesa
5568 FF1070 A5 BA lda SMTmpL
5569 FF1072 87 C1 sta [SMXAddrL]
5570 FF1074 C8 iny
5571 FF1075 C0 10 cpy #16
5572 FF1077 90 ED bcc ?01
5573 FF1079 A5 C3 ?02: lda SMXAddrK
5574 FF107B C9 20 cmp #$20
5575 FF107D 90 01 bcc ?03
5576 FF107F 60 rts
5577 FF1080 ?03: SCNPRINT
5578 FF1080 02 01 cop $01
5579 .MNLIST
5580 FF1082 1B 4F 01 00 .DB KB_ESC, 'O', SCN_CSRUP, 0
5581 FF1086
5582 FF1086 80 07 bra _xdm
5583
5584 ; display 1 riga di memoria estesa
5585 FF1088 DispXMem:
5586 FF1088 AE 0A FC ldx CRXME ; salva bit CR
5587 FF108B DA phx
5588 FF108C 8D 0B FC sta CRXMEON ; abilita memoria estesa
5589 FF108F _xdm:
5590 FF108F A9 01 lda #$01
5591 FF1091 85 C3 sta SMXAddrK
5592 FF1093 TXT_CR
5593 FF1093 TXTPRCHAR
5594 .MLIST
5595 FF1093 02 08 cop $08
5596 .MNLIST
5597 FF1095 0D .DB $0D
5598 .MNLIST
5599 FF1096 TXTPRCHAR ; prompt memoria estesa
5600 FF1096 02 08 cop $08
5601 .MNLIST
5602 FF1098 78 .DB 'x'
Tue Jul 17 11:00:24 2018 Page 56
5603 FF1099 TXTPRCHAR
5604 FF1099 02 08 cop $08
5605 .MNLIST
5606 FF109B 3E .DB '>'
5607 FF109C 20 37 19 jsr PrintAddr
5608 FF109F A0 00 ldy #0
5609 FF10A1 F0 03 beq ?02
5610 FF10A3 20 51 19 ?01: jsr PrintBlank
5611 FF10A6 20 0B 19 ?02: jsr XSetPtrY
5612 FF10A9 90 04 bcc ?02a
5613 FF10AB A9 FF lda #$FF ; oltre limite memoria
5614 FF10AD 80 02 bra ?02b
5615 FF10AF A7 C1 ?02a: lda [SMXAddrL]
5616 FF10B1 20 71 19 ?02b: jsr PrintHex
5617 FF10B4 C8 iny
5618 FF10B5 C0 10 cpy #16
5619 FF10B7 90 EA bcc ?01
5620 FF10B9 A5 C6 lda SMdumb
5621 FF10BB D0 08 bne ?03a
5622 FF10BD SCNPRINT
5623 FF10BD 02 01 cop $01
5624 .MNLIST
5625 FF10BF 20 14 3A 00 .DB ' ', SCN_RVSON, ':', 0
5626 FF10C3 80 05 bra ?03b
5627 FF10C5 ?03a: TXTPRINT
5628 FF10C5 02 02 cop $02
5629 .MNLIST
5630 FF10C7 20 3A 00 .DB ' :', 0
5631 FF10CA A0 00 ?03b: ldy #0
5632 FF10CC 20 0B 19 ?03: jsr XSetPtrY
5633 FF10CF 90 04 bcc ?03c
5634 FF10D1 A9 58 lda #'X' ; indica fine memoria
5635 FF10D3 80 02 bra ?03d
5636 FF10D5 A7 C1 ?03c: lda [SMXAddrL]
5637 FF10D7 C9 80 ?03d: cmp #$80
5638 FF10D9 B0 04 bcs ?04
5639 FF10DB C9 20 cmp #' '
5640 FF10DD B0 02 bcs ?06
5641 FF10DF A9 2E ?04: lda #'.'
5642 FF10E1 ?06: TXTCHAROUT
5643 FF10E1 02 06 cop $06
5644 .MNLIST
5645 FF10E3 C8 iny
5646 FF10E4 C0 10 cpy #16
5647 FF10E6 90 E4 bcc ?03
5648 FF10E8 TXTPRINT
5649 FF10E8 02 02 cop $02
5650 .MNLIST
5651 FF10EA 18 20 00 .DB SCN_RVSOFF, ' ', 0
5652 FF10ED AD 28 FD lda PIA0+PIAPRA
5653 FF10F0 20 71 19 jsr PrintHex
5654 FF10F3 FA plx
5655 FF10F4 9F 0A FC 00 sta CRXME,x
5656 FF10F8 60 rts
5657
5658 ; te -> show RTC internal extended ram (128 bytes)
5659 FF10F9 Cmd_te:
Tue Jul 17 11:00:24 2018 Page 57
5660 FF10F9 64 DE stz rtcadr
5661 FF10FB 20 51 11 ?02: jsr rtcxmem
5662 FF10FE A5 DE lda rtcadr
5663 FF1100 18 clc
5664 FF1101 69 10 adc #16
5665 FF1103 85 DE sta rtcadr
5666 FF1105 10 F4 bpl ?02
5667 FF1107 60 rts
5668
5669 ; e>addr data, data, data,... -> set RTC extended memory
5670 FF1108 Cmd_stxm:
5671 FF1108 A2 0A ldx #RTCCTRLA ; setta banco 1 RTC
5672 FF110A 8E 4C FD stx RTCALE
5673 FF110D A9 10 lda #$10 ; setta banco 1
5674 FF110F 0C 4D FD tsb RTCDATA
5675 FF1112 B0 2E bcs ?06
5676 FF1114 A5 BA lda SMTmpL
5677 FF1116 C9 80 cmp #$80
5678 FF1118 90 03 bcc ?02
5679 FF111A 4C 34 01 jmp ErrCls2
5680 FF111D 85 DE ?02: sta rtcadr
5681 FF111F A0 00 ldy #0
5682 FF1121 20 5A 01 ?04: jsr GetParm
5683 FF1124 B0 1C bcs ?06
5684 FF1126 98 tya
5685 FF1127 65 DE adc rtcadr
5686 FF1129 30 12 bmi ?05
5687 FF112B A2 50 ldx #RTCEXTRAMADDR
5688 FF112D 8E 4C FD stx RTCALE
5689 FF1130 8D 4D FD sta RTCDATA
5690 FF1133 A2 53 ldx #RTCEXTRAMDATA
5691 FF1135 8E 4C FD stx RTCALE
5692 FF1138 A5 BA lda SMTmpL
5693 FF113A 8D 4D FD sta RTCDATA ; store byte
5694 FF113D C8 ?05: iny
5695 FF113E C0 10 cpy #16
5696 FF1140 90 DF bcc ?04
5697 FF1142 A5 DE ?06: lda rtcadr
5698 FF1144 C9 80 cmp #$80
5699 FF1146 90 01 bcc ?08
5700 FF1148 60 rts
5701 FF1149 ?08: SCNPRINT
5702 FF1149 02 01 cop $01
5703 .MNLIST
5704 FF114B 1B 4F 01 00 .DB KB_ESC, 'O', SCN_CSRUP, 0
5705 FF114F 80 0A bra rtcxmem2
5706
5707 ; show one row of RTC extended ram
5708 FF1151 rtcxmem:
5709 FF1151 A2 0A ldx #RTCCTRLA ; setta banco 1 RTC
5710 FF1153 8E 4C FD stx RTCALE
5711 FF1156 A9 10 lda #$10 ; setta banco 1
5712 FF1158 0C 4D FD tsb RTCDATA
5713 FF115B rtcxmem2:
5714 FF115B TXTPRINT
5715 FF115B 02 02 cop $02
5716 .MNLIST
Tue Jul 17 11:00:24 2018 Page 58
5717 FF115D 0D 65 3E 00 .DB 13, 'e>', 0
5718 FF1161 A5 DE lda rtcadr
5719 FF1163 20 4E 19 jsr PrintByte
5720 FF1166 A0 00 ldy #0
5721 FF1168 F0 03 beq ?02
5722 FF116A 20 51 19 ?01: jsr PrintBlank
5723 FF116D A2 50 ?02: ldx #RTCEXTRAMADDR
5724 FF116F 8E 4C FD stx RTCALE
5725 FF1172 98 tya
5726 FF1173 18 clc
5727 FF1174 65 DE adc rtcadr
5728 FF1176 10 08 bpl ?02b
5729 FF1178 20 51 19 jsr PrintBlank
5730 FF117B 20 51 19 jsr PrintBlank
5731 FF117E 80 0E bra ?02c
5732 FF1180 8D 4D FD ?02b: sta RTCDATA
5733 FF1183 A2 53 ldx #RTCEXTRAMDATA
5734 FF1185 8E 4C FD stx RTCALE
5735 FF1188 AD 4D FD lda RTCDATA ; fetch byte
5736 FF118B 20 71 19 jsr PrintHex
5737 FF118E C8 ?02c: iny
5738 FF118F C0 10 cpy #16
5739 FF1191 90 D7 bcc ?01
5740 FF1193 A5 C6 lda SMdumb
5741 FF1195 D0 08 bne ?03a
5742 FF1197 SCNPRINT
5743 FF1197 02 01 cop $01
5744 .MNLIST
5745 FF1199 20 14 3A 00 .DB ' ', SCN_RVSON, ':', 0
5746 FF119D 80 05 bra ?03b
5747 FF119F ?03a: TXTPRINT
5748 FF119F 02 02 cop $02
5749 .MNLIST
5750 FF11A1 20 3A 00 .DB ' :', 0
5751 FF11A4 A0 00 ?03b: ldy #0
5752 FF11A6 A2 50 ?03: ldx #RTCEXTRAMADDR
5753 FF11A8 8E 4C FD stx RTCALE
5754 FF11AB 98 tya
5755 FF11AC 18 clc
5756 FF11AD 65 DE adc rtcadr
5757 FF11AF 30 13 bmi ?04
5758 FF11B1 8D 4D FD sta RTCDATA
5759 FF11B4 A2 53 ldx #RTCEXTRAMDATA
5760 FF11B6 8E 4C FD stx RTCALE
5761 FF11B9 AD 4D FD lda RTCDATA ; fetch byte
5762 FF11BC C9 80 cmp #$80
5763 FF11BE B0 04 bcs ?04
5764 FF11C0 C9 20 cmp #' '
5765 FF11C2 B0 02 bcs ?06
5766 FF11C4 A9 2E ?04: lda #'.'
5767 FF11C6 ?06: TXTCHAROUT
5768 FF11C6 02 06 cop $06
5769 .MNLIST
5770 FF11C8 C8 iny
5771 FF11C9 C0 10 cpy #16
5772 FF11CB 90 D9 bcc ?03
5773 FF11CD 60 rts
Tue Jul 17 11:00:24 2018 Page 59
5774
5775 ; ts -> show RTC internal bank 1 ram 40..7F
5776 FF11CE Cmd_ts:
5777 FF11CE A9 01 lda #1
5778 FF11D0 85 DF sta rtcbnk
5779 FF11D2 80 02 bra _rtcm
5780
5781 ; tu -> show RTC internal bank 0 ram 40..7F
5782 FF11D4 Cmd_tu:
5783 FF11D4 64 DF stz rtcbnk
5784 FF11D6 _rtcm:
5785 FF11D6 A9 40 lda #$40
5786 FF11D8 85 DE sta rtcadr
5787 FF11DA 20 30 12 ?02: jsr rtcmem
5788 FF11DD A5 DE lda rtcadr
5789 FF11DF 18 clc
5790 FF11E0 69 10 adc #16
5791 FF11E2 85 DE sta rtcadr
5792 FF11E4 10 F4 bpl ?02
5793 FF11E6 60 rts
5794
5795 ; u>addr data, data, data,... -> set RTC user ram 40..7F bank 0
5796 FF11E7 Cmd_stum:
5797 FF11E7 64 DF stz rtcbnk
5798 FF11E9 A2 0A ldx #RTCCTRLA
5799 FF11EB 8E 4C FD stx RTCALE
5800 FF11EE A9 10 lda #$10
5801 FF11F0 1C 4D FD trb RTCDATA ; set bank 0
5802 FF11F3 B0 28 bcs ?06
5803 FF11F5 A5 BA lda SMTmpL
5804 FF11F7 C9 80 cmp #$80
5805 FF11F9 90 03 bcc ?02
5806 FF11FB 4C 34 01 ?01: jmp ErrCls2
5807 FF11FE C9 40 ?02: cmp #$40
5808 FF1200 90 F9 bcc ?01
5809 FF1202 85 DE sta rtcadr
5810 FF1204 A0 00 ldy #0
5811 FF1206 20 5A 01 ?04: jsr GetParm
5812 FF1209 B0 12 bcs ?06
5813 FF120B 98 tya
5814 FF120C 65 DE adc rtcadr
5815 FF120E 30 08 bmi ?05
5816 FF1210 8D 4C FD sta RTCALE
5817 FF1213 A5 BA lda SMTmpL
5818 FF1215 8D 4D FD sta RTCDATA ; store byte
5819 FF1218 C8 ?05: iny
5820 FF1219 C0 10 cpy #16
5821 FF121B 90 E9 bcc ?04
5822 FF121D A5 DE ?06: lda rtcadr
5823 FF121F C9 80 cmp #$80
5824 FF1221 B0 04 bcs ?07
5825 FF1223 C9 40 cmp #$40
5826 FF1225 B0 01 bcs ?08
5827 FF1227 60 ?07: rts
5828 FF1228 ?08: SCNPRINT
5829 FF1228 02 01 cop $01
5830 .MNLIST
Tue Jul 17 11:00:24 2018 Page 60
5831 FF122A 1B 4F 01 00 .DB KB_ESC, 'O', SCN_CSRUP, 0
5832 FF122E 80 13 bra rtcmem2
5833
5834 ; show one row of RTC ram 40..7F
5835 FF1230 rtcmem:
5836 FF1230 A2 0A ldx #RTCCTRLA
5837 FF1232 8E 4C FD stx RTCALE
5838 FF1235 A9 10 lda #$10
5839 FF1237 A4 DF ldy rtcbnk
5840 FF1239 F0 05 beq ?02
5841 FF123B 0C 4D FD tsb RTCDATA ; set bank 1
5842 FF123E 80 03 bra rtcmem2
5843 FF1240 1C 4D FD ?02: trb RTCDATA ; set bank 0
5844
5845 FF1243 rtcmem2:
5846 FF1243 A4 DF ldy rtcbnk
5847 FF1245 F0 08 beq ?00
5848 FF1247 TXTPRINT
5849 FF1247 02 02 cop $02
5850 .MNLIST
5851 FF1249 0D 3A 3E 00 .DB 13, ':>', 0
5852 FF124D 80 06 bra ?00a
5853 FF124F ?00: TXTPRINT
5854 FF124F 02 02 cop $02
5855 .MNLIST
5856 FF1251 0D 75 3E 00 .DB 13, 'u>', 0
5857 FF1255 A5 DE ?00a: lda rtcadr
5858 FF1257 20 4E 19 jsr PrintByte
5859 FF125A A0 00 ldy #0
5860 FF125C F0 03 beq ?02
5861 FF125E 20 51 19 ?01: jsr PrintBlank
5862 FF1261 98 ?02: tya
5863 FF1262 18 clc
5864 FF1263 65 DE adc rtcadr
5865 FF1265 10 08 bpl ?02b
5866 FF1267 20 51 19 jsr PrintBlank
5867 FF126A 20 51 19 jsr PrintBlank
5868 FF126D 80 09 bra ?02c
5869 FF126F 8D 4C FD ?02b: sta RTCALE
5870 FF1272 AD 4D FD lda RTCDATA ; fetch byte
5871 FF1275 20 71 19 jsr PrintHex
5872 FF1278 C8 ?02c: iny
5873 FF1279 C0 10 cpy #16
5874 FF127B 90 E1 bcc ?01
5875 FF127D A5 C6 lda SMdumb
5876 FF127F D0 08 bne ?03a
5877 FF1281 SCNPRINT
5878 FF1281 02 01 cop $01
5879 .MNLIST
5880 FF1283 20 14 3A 00 .DB ' ', SCN_RVSON, ':', 0
5881 FF1287 80 05 bra ?03b
5882 FF1289 ?03a: TXTPRINT
5883 FF1289 02 02 cop $02
5884 .MNLIST
5885 FF128B 20 3A 00 .DB ' :', 0
5886 FF128E A0 00 ?03b: ldy #0
5887 FF1290 98 ?03: tya
Tue Jul 17 11:00:24 2018 Page 61
5888 FF1291 18 clc
5889 FF1292 65 DE adc rtcadr
5890 FF1294 30 0E bmi ?04
5891 FF1296 8D 4C FD sta RTCALE
5892 FF1299 AD 4D FD lda RTCDATA ; fetch byte
5893 FF129C C9 80 cmp #$80
5894 FF129E B0 04 bcs ?04
5895 FF12A0 C9 20 cmp #' '
5896 FF12A2 B0 02 bcs ?06
5897 FF12A4 A9 2E ?04: lda #'.'
5898 FF12A6 ?06: TXTCHAROUT
5899 FF12A6 02 06 cop $06
5900 .MNLIST
5901 FF12A8 C8 iny
5902 FF12A9 C0 10 cpy #16
5903 FF12AB 90 E3 bcc ?03
5904 FF12AD 60 rts
5905
5906 ; tc -> show RTC internal bank 0&1 ram 0E..3F
5907 FF12AE Cmd_tc:
5908 FF12AE A9 02 lda #2
5909 FF12B0 85 DF sta rtcbnk
5910 FF12B2 A9 0E lda #$0E
5911 FF12B4 85 DE sta rtcadr
5912 FF12B6 20 11 13 jsr rtccm
5913 FF12B9 E6 DE inc rtcadr
5914 FF12BB E6 DE inc rtcadr
5915 FF12BD A9 10 lda #16
5916 FF12BF 85 DF sta rtcbnk
5917 FF12C1 20 11 13 ?02: jsr rtccm
5918 FF12C4 A5 DE lda rtcadr
5919 FF12C6 18 clc
5920 FF12C7 69 10 adc #16
5921 FF12C9 85 DE sta rtcadr
5922 FF12CB C9 40 cmp #$40
5923 FF12CD 90 F2 bcc ?02
5924 FF12CF 60 rts
5925
5926 ; c>addr data, data, data,... -> set RTC user ram 0E..3F bank 0&1
5927 FF12D0 Cmd_stcm:
5928 FF12D0 A9 10 lda #16
5929 FF12D2 85 DF sta rtcbnk
5930 FF12D4 B0 2A bcs ?06
5931 FF12D6 A5 BA lda SMTmpL
5932 FF12D8 C9 40 cmp #$40
5933 FF12DA 90 03 bcc ?02
5934 FF12DC 4C 34 01 ?01: jmp ErrCls2
5935 FF12DF C9 0E ?02: cmp #$0E
5936 FF12E1 90 F9 bcc ?01
5937 FF12E3 85 DE sta rtcadr
5938 FF12E5 A0 00 ldy #0
5939 FF12E7 20 5A 01 ?04: jsr GetParm
5940 FF12EA B0 14 bcs ?06
5941 FF12EC 98 tya
5942 FF12ED 65 DE adc rtcadr
5943 FF12EF C9 40 cmp #$40
5944 FF12F1 B0 08 bcs ?05
Tue Jul 17 11:00:24 2018 Page 62
5945 FF12F3 8D 4C FD sta RTCALE
5946 FF12F6 A5 BA lda SMTmpL
5947 FF12F8 8D 4D FD sta RTCDATA ; store byte
5948 FF12FB C8 ?05: iny
5949 FF12FC C0 10 cpy #16
5950 FF12FE 90 E7 bcc ?04
5951 FF1300 A5 DE ?06: lda rtcadr
5952 FF1302 C9 40 cmp #$40
5953 FF1304 B0 04 bcs ?07
5954 FF1306 C9 0E cmp #$0E
5955 FF1308 B0 01 bcs ?08
5956 FF130A 60 ?07: rts
5957 FF130B ?08: SCNPRINT
5958 FF130B 02 01 cop $01
5959 .MNLIST
5960 FF130D 1B 4F 01 00 .DB KB_ESC, 'O', SCN_CSRUP, 0
5961
5962 FF1311 rtccm:
5963 FF1311 TXTPRINT
5964 FF1311 02 02 cop $02
5965 .MNLIST
5966 FF1313 0D 63 3E 00 .DB 13, 'c>', 0
5967 FF1317 A5 DE lda rtcadr
5968 FF1319 20 4E 19 jsr PrintByte
5969 FF131C A0 00 ldy #0
5970 FF131E F0 03 beq ?02
5971 FF1320 20 51 19 ?01: jsr PrintBlank
5972 FF1323 98 ?02: tya
5973 FF1324 18 clc
5974 FF1325 65 DE adc rtcadr
5975 FF1327 C9 40 cmp #$40
5976 FF1329 90 08 bcc ?02b
5977 FF132B 20 51 19 jsr PrintBlank
5978 FF132E 20 51 19 jsr PrintBlank
5979 FF1331 80 09 bra ?02c
5980 FF1333 8D 4C FD ?02b: sta RTCALE
5981 FF1336 AD 4D FD lda RTCDATA ; fetch byte
5982 FF1339 20 71 19 jsr PrintHex
5983 FF133C C8 ?02c: iny
5984 FF133D C4 DF cpy rtcbnk
5985 FF133F 90 DF bcc ?01
5986 FF1341 A5 C6 lda SMdumb
5987 FF1343 D0 08 bne ?03a
5988 FF1345 SCNPRINT
5989 FF1345 02 01 cop $01
5990 .MNLIST
5991 FF1347 20 14 3A 00 .DB ' ', SCN_RVSON, ':', 0
5992 FF134B 80 05 bra ?03b
5993 FF134D ?03a: TXTPRINT
5994 FF134D 02 02 cop $02
5995 .MNLIST
5996 FF134F 20 3A 00 .DB ' :', 0
5997 FF1352 A0 00 ?03b: ldy #0
5998 FF1354 98 ?03: tya
5999 FF1355 18 clc
6000 FF1356 65 DE adc rtcadr
6001 FF1358 C9 40 cmp #$40
Tue Jul 17 11:00:24 2018 Page 63
6002 FF135A B0 0E bcs ?04
6003 FF135C 8D 4C FD sta RTCALE
6004 FF135F AD 4D FD lda RTCDATA ; fetch byte
6005 FF1362 C9 80 cmp #$80
6006 FF1364 B0 04 bcs ?04
6007 FF1366 C9 20 cmp #' '
6008 FF1368 B0 02 bcs ?06
6009 FF136A A9 2E ?04: lda #'.'
6010 FF136C ?06: TXTCHAROUT
6011 FF136C 02 06 cop $06
6012 .MNLIST
6013 FF136E C8 iny
6014 FF136F C4 DF cpy rtcbnk
6015 FF1371 90 E1 bcc ?03
6016 FF1373 60 rts
6017
6018 ; get rtc time
6019 FF1374 Cmd_gt:
6020 FF1374 RTCGETT
6021 FF1374 02 19 cop $19
6022 FF1376 02 .DB $02
6023 .MNLIST
6024 FF1377 EB xba
6025 FF1378 48 pha ; day of week (1=sunday...)
6026 FF1379 EB xba
6027 FF137A DA phx ; seconds
6028 FF137B 5A phy ; minutes
6029 FF137C 48 pha ; hours
6030 FF137D 4B phk
6031 FF137E F4 87 13 pea #!?10
6032 FF1381 A9 08 lda #8
6033 FF1383 48 pha
6034 FF1384 BPRINTF
6035 FF1384 02 11 cop $11
6036 .MNLIST
6037 FF1386 60 rts
6038 FF1387
6039 FF1387 0D 3A 20 63 75 ?10: .DB 13,': current time: %02bu:%02bu:%02bu (day: %bu)', 0
72 72 65 6E 74
20 74 69 6D 65
3A 20 25 30 32
62 75 3A 25 30
32 62 75 3A 25
30 32 62 75 20
28 64 61 79 3A
20 25 62 75 29
00
6040
6041 ; get rtc date
6042 FF13B5 Cmd_gd:
6043 FF13B5 RTCGETD
6044 FF13B5 02 19 cop $19
6045 FF13B7 03 .DB $03
6046 .MNLIST
6047 FF13B8 DA phx ; day
6048 FF13B9 5A phy ; month
6049 FF13BA 48 pha ; year
Tue Jul 17 11:00:24 2018 Page 64
6050 FF13BB EB xba
6051 FF13BC 48 pha ; century
6052 FF13BD 4B phk
6053 FF13BE F4 C7 13 pea #!?10
6054 FF13C1 A9 08 lda #8
6055 FF13C3 48 pha
6056 FF13C4 BPRINTF
6057 FF13C4 02 11 cop $11
6058 .MNLIST
6059 FF13C6 60 rts
6060 FF13C7
6061 FF13C7 0D 3A 20 63 75 ?10: .DB 13,': current date: %02bu%02bu/%02bu/%02bu', 0
72 72 65 6E 74
20 64 61 74 65
3A 20 25 30 32
62 75 25 30 32
62 75 2F 25 30
32 62 75 2F 25
30 32 62 75 00
6062
6063 ; set rtc time
6064 ; st HHMMSS
6065 FF13EF Cmd_st:
6066 FF13EF A6 E0 ldx cmdlin
6067 FF13F1 20 75 14 jsr asc2bin
6068 FF13F4 B0 0E bcs ?05
6069 FF13F6 85 E5 sta brtchour
6070 FF13F8 20 75 14 jsr asc2bin
6071 FF13FB B0 07 bcs ?05
6072 FF13FD 85 E4 sta brtcmin
6073 FF13FF 20 75 14 jsr asc2bin
6074 FF1402 90 03 bcc ?10
6075 FF1404 4C 34 01 ?05: jmp ErrCls2
6076 FF1407 85 E3 ?10: sta brtcsec
6077 FF1409 BF 00 99 01 lda >INPUTBUF,x
6078 FF140D F0 04 beq ?15
6079 FF140F C9 20 cmp #' '
6080 FF1411 D0 F1 bne ?05
6081 FF1413 A6 E3 ?15: ldx brtcsec
6082 FF1415 A4 E4 ldy brtcmin
6083 FF1417 A5 E5 lda brtchour
6084 FF1419 RTCSETT
6085 FF1419 02 19 cop $19
6086 FF141B 00 .DB $00
6087 .MNLIST
6088 FF141C 90 0E bcc ?20
6089 FF141E SCNPRINT
6090 FF141E 02 01 cop $01
6091 .MNLIST
6092 FF1420 0D 3A 3A 62 61 .DB 13, '::bad time', 0
64 20 74 69 6D
65 00
6093 FF142C 60 ?20: rts
6094
6095 ; set rtc date
6096 ; st CCYYMMDD
6097 FF142D Cmd_sd:
Tue Jul 17 11:00:24 2018 Page 65
6098 FF142D A6 E0 ldx cmdlin
6099 FF142F 20 75 14 jsr asc2bin
6100 FF1432 B0 15 bcs ?05
6101 FF1434 85 E9 sta brtcct
6102 FF1436 20 75 14 jsr asc2bin
6103 FF1439 B0 0E bcs ?05
6104 FF143B 85 E8 sta brtcyear
6105 FF143D 20 75 14 jsr asc2bin
6106 FF1440 B0 07 bcs ?05
6107 FF1442 85 E7 sta brtcmonth
6108 FF1444 20 75 14 jsr asc2bin
6109 FF1447 90 03 bcc ?10
6110 FF1449 4C 34 01 ?05: jmp ErrCls2
6111 FF144C 85 E6 ?10: sta brtcday
6112 FF144E BF 00 99 01 lda >INPUTBUF,x
6113 FF1452 F0 04 beq ?15
6114 FF1454 C9 20 cmp #' '
6115 FF1456 D0 F1 bne ?05
6116 FF1458 A6 E6 ?15: ldx brtcday
6117 FF145A A4 E7 ldy brtcmonth
6118 FF145C A5 E9 lda brtcct
6119 FF145E EB xba
6120 FF145F A5 E8 lda brtcyear
6121 FF1461 RTCSETD
6122 FF1461 02 19 cop $19
6123 FF1463 01 .DB $01
6124 .MNLIST
6125 FF1464 90 0E bcc ?20
6126 FF1466 SCNPRINT
6127 FF1466 02 01 cop $01
6128 .MNLIST
6129 FF1468 0D 3A 3A 62 61 .DB 13, '::bad date', 0
64 20 64 61 74
65 00
6130 FF1474 60 ?20: rts
6131
6132 FF1475 asc2bin:
6133 FF1475 BF 00 99 01 ?00: lda >INPUTBUF,x
6134 FF1479 08 php
6135 FF147A E8 inx
6136 FF147B 28 plp
6137 FF147C F0 37 beq ?08
6138 FF147E C9 20 cmp #' '
6139 FF1480 F0 F3 beq ?00
6140 FF1482 A0 02 ldy #2 ; convert 2 digits
6141 FF1484 64 E2 stz btmpx ; partial value
6142 FF1486 C9 30 ?02: cmp #'0' ; first char must be a digit
6143 FF1488 90 2B bcc ?08
6144 FF148A C9 3A cmp #'9'+1
6145 FF148C B0 28 bcs ?10
6146 FF148E E9 2F sbc #'0'-1 ; convert digit (here always CF = 0)
6147 FF1490 EB xba ; B = digit
6148 FF1491 18 clc
6149 FF1492 A5 E2 lda btmpx ; partial null?
6150 FF1494 F0 0B beq ?04 ; yes, skip mult * 10
6151 FF1496 C9 1A cmp #26 ; this value make overflow
6152 FF1498 B0 1B bcs ?08
Tue Jul 17 11:00:24 2018 Page 66
6153 FF149A 0A asl a ; safety multiply * 10
6154 FF149B 0A asl a
6155 FF149C 65 E2 adc btmpx
6156 FF149E 0A asl a ; always carry = 0 here
6157 FF149F 85 E2 sta btmpx
6158 FF14A1 EB ?04: xba
6159 FF14A2 65 E2 adc btmpx
6160 FF14A4 B0 0F bcs ?08 ; overflow
6161 FF14A6 85 E2 sta btmpx
6162 FF14A8 BF 00 99 01 lda >INPUTBUF,x
6163 FF14AC E8 inx
6164 FF14AD 88 dey
6165 FF14AE D0 D6 bne ?02
6166 FF14B0 CA dex
6167 FF14B1 A5 E2 ?06: lda btmpx
6168 FF14B3 18 clc
6169 FF14B4 60 rts
6170 FF14B5 38 ?08: sec
6171 FF14B6 60 ?10: rts
6172
6173 FF14B7 Cmd_fdisk:
6174 FF14B7 SCN_CR
6175 FF14B7 SCNPRCHAR
6176 .MLIST
6177 FF14B7 02 07 cop $07
6178 .MNLIST
6179 FF14B9 0D .DB $0D
6180 .MNLIST
6181 FF14BA A6 E0 ldx cmdlin
6182 FF14BC ACC16CLC
6183 FF14BC C2 21 rep #(PMFLAG.OR.PCFLAG)
6184 .LONGA on
6185 .MNLIST
6186 FF14BE 8A txa
6187 FF14BF 69 00 99 adc #INPUTBUF
6188 FF14C2 A2 01 ldx #^INPUTBUF
6189 FF14C4 DA phx
6190 FF14C5 48 pha
6191 FF14C6 ACC08
6192 FF14C6 E2 20 sep #PMFLAG
6193 .LONGA off
6194 .MNLIST
6195 FF14C8 02 60 cop $60
6196 FF14CA 00 .DB $00
6197 FF14CB 60 rts
6198 FF14CC
6199 .EXTERN _strcpy, _strcat, _getopt, _strlen, _strdel, _strins
6200 .EXTERN _strcmp, _strncmp, _strcasecmp, _strncasecmp
6201 .EXTERN _strchr, _strrchr, _strlchr, _strstr
6202
6203 FF14CC Cmd_strcpy:
6204 FF14CC SCN_CR
6205 FF14CC SCNPRCHAR
6206 .MLIST
6207 FF14CC 02 07 cop $07
6208 .MNLIST
6209 FF14CE 0D .DB $0D
Tue Jul 17 11:00:24 2018 Page 67
6210 .MNLIST
6211 FF14CF ACC16CLC
6212 FF14CF C2 21 rep #(PMFLAG.OR.PCFLAG)
6213 .LONGA on
6214 .MNLIST
6215 FF14D1 A2 20 ldx #$20
6216 FF14D3 DA phx
6217 FF14D4 F4 00 00 pea #0 ; dst
6218 FF14D7 A6 E0 ldx cmdlin
6219 FF14D9 8A txa
6220 FF14DA 69 00 99 adc #INPUTBUF
6221 FF14DD A2 01 ldx #^INPUTBUF
6222 FF14DF DA phx
6223 FF14E0 48 pha ; src
6224 FF14E1 22 1D 04 FA jsl _strcpy
6225 FF14E5 48 pha ; size
6226 FF14E6 A2 20 ldx #$20
6227 FF14E8 DA phx
6228 FF14E9 F4 00 00 pea #0
6229 FF14EC 4B phk ; dst
6230 FF14ED F4 F8 14 pea #!?00
6231 FF14F0 ACC08
6232 FF14F0 E2 20 sep #PMFLAG
6233 .LONGA off
6234 .MNLIST
6235 FF14F2 A9 09 lda #9
6236 FF14F4 48 pha
6237 FF14F5 BPRINTF
6238 FF14F5 02 11 cop $11
6239 .MNLIST
6240 FF14F7 60 rts
6241
6242 FF14F8 3C 25 73 3E 20 ?00: .DB '<%s> %hu', 13, 0
25 68 75 0D 00
6243
6244 FF1502 Cmd_test:
6245 0000BA s1 .SET SMTmpL
6246 0000E4 s2 .SET SMXTmp+2
6247 0000E2 k .SET SMXTmp
6248 0000E7 l .SET SMXTmp+5
6249 0000E9 chr .SET SMXTmp+7
6250
6251 FF1502 SCN_CR
6252 FF1502 SCNPRCHAR
6253 .MLIST
6254 FF1502 02 07 cop $07
6255 .MNLIST
6256 FF1504 0D .DB $0D
6257 .MNLIST
6258 FF1505 64 E9 stz <chr
6259 FF1507 ACC16CLC
6260 FF1507 C2 21 rep #(PMFLAG.OR.PCFLAG)
6261 .LONGA on
6262 .MNLIST
6263 FF1509 64 E7 stz <l
6264 FF150B 64 E2 stz <k
6265 FF150D A2 20 ldx #$20
Tue Jul 17 11:00:24 2018 Page 68
6266 FF150F 86 BC stx <s1+2
6267 FF1511 86 E6 stx <s2+2
6268 FF1513 64 BA stz <s1
6269 FF1515 A9 00 00 lda #0
6270 FF1518 8F 00 00 20 sta >$200000
6271 FF151C 8F 00 80 20 sta >$208000
6272 FF1520 A9 00 80 lda #$8000
6273 FF1523 85 E4 sta <s2
6274 FF1525 A6 E0 ldx cmdlin
6275 FF1527 8A txa
6276 FF1528 69 00 99 adc #INPUTBUF
6277 FF152B A2 01 ldx #^INPUTBUF
6278 FF152D A0 C0 ldy #$C0
6279 FF152F 5A phy ; flag
6280 FF1530 DA phx
6281 FF1531 48 pha ; command line
6282 FF1532 4B phk ; option string
6283 FF1533 F4 77 16 pea #!?1000
6284 FF1536 F4 00 00 pea #0 ; result
6285 FF1539 F4 00 00 pea #0
6286 FF153C CPU08
6287 FF153C E2 30 sep #(PMFLAG.OR.PXFLAG)
6288 .LONGA off
6289 .LONGI off
6290 .MNLIST
6291 FF153E 22 09 00 FA ?10: jsl _getopt ; get opttion's loop
6292 FF1542 B0 74 bcs ?20 ; error
6293 FF1544 AA tax ; option char
6294 FF1545 F0 71 beq ?20 ; end of command line
6295 FF1547 30 6E bmi ?16 ; no option argument
6296 FF1549 C9 73 cmp #'s' ; -s "string1"
6297 FF154B D0 16 bne ?11
6298 FF154D A5 BC lda <s1+2
6299 FF154F 48 pha
6300 FF1550 D4 BA pei (s1)
6301 FF1552 A3 04 lda $04,s
6302 FF1554 AA tax
6303 FF1555 A3 05 lda $05,s
6304 FF1557 A8 tay
6305 FF1558 A3 06 lda $06,s
6306 FF155A 48 pha
6307 FF155B 5A phy
6308 FF155C DA phx
6309 FF155D 22 1D 04 FA jsl _strcpy
6310 FF1561 80 DB bra ?10
6311 FF1563 C9 53 ?11: cmp #'S' ; -S "string2"
6312 FF1565 D0 16 bne ?12
6313 FF1567 A5 E6 lda <s2+2
6314 FF1569 48 pha
6315 FF156A D4 E4 pei (s2)
6316 FF156C A3 04 lda $04,s
6317 FF156E AA tax
6318 FF156F A3 05 lda $05,s
6319 FF1571 A8 tay
6320 FF1572 A3 06 lda $06,s
6321 FF1574 48 pha
6322 FF1575 5A phy
Tue Jul 17 11:00:24 2018 Page 69
6323 FF1576 DA phx
6324 FF1577 22 1D 04 FA jsl _strcpy
6325 FF157B 80 C1 bra ?10
6326 FF157D C9 7A ?12: cmp #'z' ; -z: null str1
6327 FF157F D0 06 bne ?13
6328 FF1581 A9 00 lda #0
6329 FF1583 87 BA sta [s1]
6330 FF1585 80 B7 bra ?10
6331 FF1587 C9 5A ?13: cmp #'Z' ; -Z: null str2
6332 FF1589 D0 06 bne ?14
6333 FF158B A9 00 lda #0
6334 FF158D 87 E4 sta [s2]
6335 FF158F 80 AD bra ?10
6336 FF1591 C9 6B ?14: cmp #'k' ; -k start
6337 FF1593 D0 0A bne ?15
6338 FF1595 A3 01 lda $01,s
6339 FF1597 85 E2 sta <k
6340 FF1599 A3 02 lda $02,s
6341 FF159B 85 E3 sta <k+1
6342 FF159D 80 9F bra ?10
6343 FF159F C9 6C ?15: cmp #'l' ; -l maxlen
6344 FF15A1 D0 0A bne ?15a
6345 FF15A3 A3 01 lda $01,s
6346 FF15A5 85 E7 sta <l
6347 FF15A7 A3 02 lda $02,s
6348 FF15A9 85 E8 sta <l+1
6349 FF15AB 80 91 bra ?10
6350 FF15AD C9 63 ?15a: cmp #'c' ; -c char
6351 FF15AF D0 06 bne ?16
6352 FF15B1 A3 01 lda $01,s
6353 FF15B3 85 E9 sta <chr
6354 FF15B5 80 87 bra ?10
6355 FF15B7 38 ?16: sec
6356 FF15B8 08 ?20: php ; clean stack
6357 FF15B9 FA plx ; save carry
6358 FF15BA ACC16CLC
6359 FF15BA C2 21 rep #(PMFLAG.OR.PCFLAG)
6360 .LONGA on
6361 .MNLIST
6362 FF15BC 3B tsc
6363 FF15BD 69 0B 00 adc #11
6364 FF15C0 1B tcs
6365 FF15C1 ACC08
6366 FF15C1 E2 20 sep #PMFLAG
6367 .LONGA off
6368 .MNLIST
6369 FF15C3 8A txa
6370 FF15C4 4A lsr a ; test carry
6371 ;bcs ?30 ; exit
6372 FF15C5 90 01 bcc ?19
6373 FF15C7 60 rts
6374 FF15C8 ?19:
6375 FF15C8 A5 BC lda <s1+2
6376 FF15CA 48 pha
6377 FF15CB D4 BA pei (s1)
6378 FF15CD 22 03 00 FA jsl strlen
6379 FF15D1 A6 E9 ldx <chr
Tue Jul 17 11:00:24 2018 Page 70
6380 FF15D3 DA phx ; chr
6381 FF15D4 D4 E7 pei (l)
6382 FF15D6 D4 E2 pei (k)
6383 FF15D8 ACC16
6384 FF15D8 C2 20 rep #PMFLAG
6385 .LONGA on
6386 .MNLIST
6387 FF15DA 48 pha
6388 FF15DB ACC08
6389 FF15DB E2 20 sep #PMFLAG
6390 .LONGA off
6391 .MNLIST
6392 FF15DD A5 BC lda <s1+2
6393 FF15DF 48 pha
6394 FF15E0 D4 BA pei (s1)
6395 FF15E2 4B phk ; fmt
6396 FF15E3 F4 38 16 pea #!?01
6397 FF15E6 A9 0E lda #14
6398 FF15E8 48 pha
6399 FF15E9 BPRINTF
6400 FF15E9 02 11 cop $11
6401 .MNLIST
6402
6403 FF15EB A5 E6 lda <s2+2
6404 FF15ED 48 pha
6405 FF15EE D4 E4 pei (s2)
6406 FF15F0 22 03 00 FA jsl strlen
6407 FF15F4 ACC16
6408 FF15F4 C2 20 rep #PMFLAG
6409 .LONGA on
6410 .MNLIST
6411 FF15F6 48 pha
6412 FF15F7 ACC08
6413 FF15F7 E2 20 sep #PMFLAG
6414 .LONGA off
6415 .MNLIST
6416 FF15F9 A5 E6 lda <s2+2
6417 FF15FB 48 pha
6418 FF15FC D4 E4 pei (s2)
6419 FF15FE 4B phk ; fmt
6420 FF15FF F4 2C 16 pea #!?00
6421 FF1602 A9 09 lda #9
6422 FF1604 48 pha
6423 FF1605 BPRINTF
6424 FF1605 02 11 cop $11
6425 .MNLIST
6426
6427
6428 FF1607 A5 BC lda <s1+2 ; strstr
6429 FF1609 48 pha
6430 FF160A D4 BA pei (s1)
6431 FF160C A5 E6 lda <s2+2
6432 FF160E 48 pha
6433 FF160F D4 E4 pei (s2)
6434 FF1611 22 81 07 FA jsl _strstr
6435 FF1615 F4 00 00 pea #0
6436 FF1618 EB xba
Tue Jul 17 11:00:24 2018 Page 71
6437 FF1619 48 pha
6438 FF161A EB xba
6439 FF161B 48 pha
6440 FF161C A2 00 ldx #0
6441 FF161E B0 01 bcs ?25a
6442 FF1620 E8 inx
6443 FF1621 DA ?25a: phx
6444 FF1622 4B phk ; fmt
6445 FF1623 F4 65 16 pea #!?03
6446 FF1626 A9 09 lda #9
6447 FF1628 48 pha
6448 FF1629 BPRINTF
6449 FF1629 02 11 cop $11
6450 .MNLIST
6451 FF162B
6452 FF162B 60 ?30: rts
6453
6454 FF162C 3C 25 73 3E 20 ?00: .DB '<%s> %hu ', 13, 0
25 68 75 20 20
0D 00
6455 FF1638 3C 25 73 3E 20 ?01: .DB '<%s> %hu - %hu - %hu - %bu <<<<', 13, 0
25 68 75 20 2D
20 25 68 75 20
2D 20 25 68 75
20 2D 20 25 62
75 20 20 20 20
3C 3C 3C 3C 0D
00
6456 FF165C 25 62 75 20 20 ?02: .DB '%bu ', 13, 0
20 20 0D 00
6457 FF1665 25 62 75 20 20 ?03: .DB '%bu %hu %hu', 13, 0
20 20 25 68 75
20 20 20 25 68
75 0D 00
6458
6459 FF1677 6B 23 6C 23 73 ?1000: .DB 'k#l#s:S:z Z c!', 0
3A 53 3A 7A 20
5A 20 63 21 00
6460
6461 FF1686 xxx:
6462 FF1686 A6 E0 ?01: ldx cmdlin
6463 FF1688 ACC16CLC
6464 FF1688 C2 21 rep #(PMFLAG.OR.PCFLAG)
6465 .LONGA on
6466 .MNLIST
6467 FF168A 8A txa
6468 FF168B 69 00 99 adc #INPUTBUF
6469 FF168E A2 E1 ldx #$E1
6470 FF1690 DA phx
6471 FF1691 A2 01 ldx #^INPUTBUF
6472 FF1693 DA phx
6473 FF1694 48 pha
6474 FF1695 4B phk
6475 FF1696 F4 2E 18 pea #!?100
6476 FF1699 48 pha
6477 FF169A 48 pha
6478 FF169B ACC08
Tue Jul 17 11:00:24 2018 Page 72
6479 FF169B E2 20 sep #PMFLAG
6480 .LONGA off
6481 .MNLIST
6482 FF169D 22 09 00 FA ?10: jsl _getopt
6483 FF16A1 90 03 bcc ?11
6484 FF16A3 4C 48 17 jmp ?20
6485 FF16A6 AA ?11: tax
6486 FF16A7 D0 03 bne ?11a
6487 FF16A9 4C 48 17 jmp ?20
6488 FF16AC 10 03 ?11a: bpl ?11b
6489 FF16AE 4C 31 17 jmp ?18
6490 FF16B1 C0 20 ?11b: cpy #' '
6491 FF16B3 F0 6F beq ?16
6492 FF16B5 C0 21 cpy #'!'
6493 FF16B7 F0 04 beq ?12
6494 FF16B9 C0 5E cpy #'^'
6495 FF16BB D0 10 bne ?14
6496 FF16BD A8 ?12: tay
6497 FF16BE A3 01 lda $01,s
6498 FF16C0 48 pha
6499 FF16C1 5A phy
6500 FF16C2 4B phk
6501 FF16C3 F4 90 17 pea #?60
6502 FF16C6 A9 06 lda #6
6503 FF16C8 48 pha
6504 FF16C9 BPRINTF
6505 FF16C9 02 11 cop $11
6506 .MNLIST
6507 FF16CB 80 D0 bra ?10
6508 FF16CD
6509 FF16CD C0 3A ?14: cpy #':'
6510 FF16CF F0 25 beq ?15
6511 FF16D1 C0 24 cpy #'$'
6512 FF16D3 F0 21 beq ?15
6513 FF16D5 C0 26 cpy #'&'
6514 FF16D7 F0 03 beq ?14a
6515 FF16D9 4C 47 18 jmp ?200
6516 FF16DC
6517 FF16DC A8 ?14a: tay
6518 FF16DD CPU16
6519 FF16DD C2 30 rep #(PMFLAG.OR.PXFLAG)
6520 .LONGA on
6521 .LONGI on
6522 .MNLIST
6523 FF16DF A3 03 lda $03,s
6524 FF16E1 AA tax
6525 FF16E2 A3 01 lda $01,s
6526 FF16E4 DA phx
6527 FF16E5 48 pha
6528 FF16E6 DA phx
6529 FF16E7 48 pha
6530 FF16E8 CPU08
6531 FF16E8 E2 30 sep #(PMFLAG.OR.PXFLAG)
6532 .LONGA off
6533 .LONGI off
6534 .MNLIST
6535 FF16EA 5A phy
Tue Jul 17 11:00:24 2018 Page 73
6536 FF16EB 4B phk
6537 FF16EC F4 AC 17 pea #?70
6538 FF16EF A9 0D lda #13
6539 FF16F1 48 pha
6540 FF16F2 BPRINTF
6541 FF16F2 02 11 cop $11
6542 .MNLIST
6543 FF16F4 80 A7 bra ?10
6544 FF16F6
6545 FF16F6 A8 ?15: tay
6546 FF16F7 A3 03 lda $03,s
6547 FF16F9 AA tax
6548 FF16FA ACC16
6549 FF16FA C2 20 rep #PMFLAG
6550 .LONGA on
6551 .MNLIST
6552 FF16FC A3 01 lda $01,s
6553 FF16FE DA phx
6554 FF16FF 48 pha
6555 FF1700 ACC08
6556 FF1700 E2 20 sep #PMFLAG
6557 .LONGA off
6558 .MNLIST
6559 FF1702 5A phy
6560 FF1703 4B phk
6561 FF1704 F4 52 17 pea #?30
6562 FF1707 A9 08 lda #8
6563 FF1709 48 pha
6564 FF170A BPRINTF
6565 FF170A 02 11 cop $11
6566 .MNLIST
6567 ;bra ?10
6568 FF170C A3 03 lda $03,s
6569 FF170E AA tax
6570 FF170F ACC16
6571 FF170F C2 20 rep #PMFLAG
6572 .LONGA on
6573 .MNLIST
6574 FF1711 A3 01 lda $01,s
6575 FF1713 DA phx
6576 FF1714 48 pha
6577 FF1715 ACC08
6578 FF1715 E2 20 sep #PMFLAG
6579 .LONGA off
6580 .MNLIST
6581 FF1717 22 03 00 FA jsl strlen
6582 FF171B 20 4E 19 jsr PrintByte
6583 FF171E SCN_CR
6584 FF171E SCNPRCHAR
6585 .MLIST
6586 FF171E 02 07 cop $07
6587 .MNLIST
6588 FF1720 0D .DB $0D
6589 .MNLIST
6590 FF1721 4C 9D 16 jmp ?10
6591 FF1724
6592 FF1724 48 ?16: pha
Tue Jul 17 11:00:24 2018 Page 74
6593 FF1725 4B phk
6594 FF1726 F4 6D 17 pea #?40
6595 FF1729 A9 05 lda #5
6596 FF172B 48 pha
6597 FF172C BPRINTF
6598 FF172C 02 11 cop $11
6599 .MNLIST
6600 FF172E 4C 9D 16 jmp ?10
6601 FF1731 A3 03 ?18: lda $03,s
6602 FF1733 AA tax
6603 FF1734 ACC16
6604 FF1734 C2 20 rep #PMFLAG
6605 .LONGA on
6606 .MNLIST
6607 FF1736 A3 01 lda $01,s
6608 FF1738 DA phx
6609 FF1739 48 pha
6610 FF173A ACC08
6611 FF173A E2 20 sep #PMFLAG
6612 .LONGA off
6613 .MNLIST
6614 FF173C 4B phk
6615 FF173D F4 85 17 pea #?50
6616 FF1740 A9 07 lda #7
6617 FF1742 48 pha
6618 FF1743 BPRINTF
6619 FF1743 02 11 cop $11
6620 .MNLIST
6621 FF1745 4C 9D 16 jmp ?10
6622 FF1748 ?20: ACC16CLC
6623 FF1748 C2 21 rep #(PMFLAG.OR.PCFLAG)
6624 .LONGA on
6625 .MNLIST
6626 FF174A 3B tsc
6627 FF174B 69 0B 00 adc #11
6628 FF174E 1B tcs
6629 FF174F ACC08
6630 FF174F E2 20 sep #PMFLAG
6631 .LONGA off
6632 .MNLIST
6633 FF1751 60 rts
6634
6635 FF1752 6F 70 74 69 6F ?30: .DB 'option ''-%c'' -- arg: <%s>', 13, 0
6E 20 27 2D 25
63 27 20 2D 2D
20 61 72 67 3A
20 3C 25 73 3E
0D 00
6636 FF176D 6F 70 74 69 6F ?40: .DB 'option ''-%c'' -- no arg', 13, 0
6E 20 27 2D 25
63 27 20 2D 2D
20 6E 6F 20 61
72 67 0D 00
6637 FF1785 61 72 67 3A 20 ?50: .DB 'arg: <%s>', 13, 0
3C 25 73 3E 0D
00
6638 FF1790 6F 70 74 69 6F ?60: .DB 'option ''-%c'' -- char: <%c>', 13, 0
Tue Jul 17 11:00:24 2018 Page 75
6E 20 27 2D 25
63 27 20 2D 2D
20 63 68 61 72
3A 20 3C 25 63
3E 0D 00
6639 FF17AC 6F 70 74 69 6F ?70: .DB 'option ''-%c'' -- int: <%d>, <%X>', 13, 0
6E 20 27 2D 25
63 27 20 2D 2D
20 69 6E 74 3A
20 3C 25 64 3E
2C 20 3C 25 58
3E 0D 00
6640 FF17CD 6F 70 74 69 6F ?80: .DB 'option ''-%c'' -- int: <%bd>, <%bX>', 13, 0
6E 20 27 2D 25
63 27 20 2D 2D
20 69 6E 74 3A
20 3C 25 62 64
3E 2C 20 3C 25
62 58 3E 0D 00
6641 FF17F0 6F 70 74 69 6F ?90: .DB 'option ''-%c'' -- int: <%hd>, <%hX>', 13, 0
6E 20 27 2D 25
63 27 20 2D 2D
20 69 6E 74 3A
20 3C 25 68 64
3E 2C 20 3C 25
68 58 3E 0D 00
6642 FF1813 6F 70 74 69 6F ?95: .DB 'option ''-%c'' -- PTR: <%P>', 13, 0
6E 20 27 2D 25
63 27 20 2D 2D
20 50 54 52 3A
20 3C 25 50 3E
0D 00
6643
6644 FF182E 72 20 43 20 6C ?100: .DB 'r C l:s u!p^b$z%x#v*w&y|', 0
3A 73 20 75 21
70 5E 62 24 7A
25 78 23 76 2A
77 26 79 7C 00
6645
6646 FF1847 C0 25 ?200: cpy #'%'
6647 FF1849 D0 13 bne ?210
6648 FF184B A8 tay
6649 FF184C A3 01 lda $01,s
6650 FF184E AA tax
6651 FF184F DA phx
6652 FF1850 48 pha
6653 FF1851 5A phy
6654 FF1852 4B phk
6655 FF1853 F4 CD 17 pea #?80
6656 FF1856 A9 07 lda #7
6657 FF1858 48 pha
6658 FF1859 BPRINTF
6659 FF1859 02 11 cop $11
6660 .MNLIST
6661 FF185B 4C 9D 16 jmp ?10
6662
6663 FF185E C0 23 ?210: cpy #'#'
Tue Jul 17 11:00:24 2018 Page 76
6664 FF1860 D0 17 bne ?220
6665 FF1862 A8 tay
6666 FF1863 A3 02 lda $02,s
6667 FF1865 AA tax
6668 FF1866 A3 01 lda $01,s
6669 FF1868 DA phx
6670 FF1869 48 pha
6671 FF186A DA phx
6672 FF186B 48 pha
6673 FF186C 5A phy
6674 FF186D 4B phk
6675 FF186E F4 F0 17 pea #?90
6676 FF1871 A9 09 lda #9
6677 FF1873 48 pha
6678 FF1874 BPRINTF
6679 FF1874 02 11 cop $11
6680 .MNLIST
6681 FF1876 4C 9D 16 jmp ?10
6682
6683 FF1879 A8 ?220: tay
6684 FF187A A3 03 lda $03,s
6685 FF187C AA tax
6686 FF187D ACC16
6687 FF187D C2 20 rep #PMFLAG
6688 .LONGA on
6689 .MNLIST
6690 FF187F A3 01 lda $01,s
6691 FF1881 DA phx
6692 FF1882 48 pha
6693 FF1883 ACC08
6694 FF1883 E2 20 sep #PMFLAG
6695 .LONGA off
6696 .MNLIST
6697 FF1885 5A phy
6698 FF1886 4B phk
6699 FF1887 F4 13 18 pea #?95
6700 FF188A A9 08 lda #8
6701 FF188C 48 pha
6702 FF188D BPRINTF
6703 FF188D 02 11 cop $11
6704 .MNLIST
6705 FF188F 4C 9D 16 jmp ?10
6706
6707 ;----------------------------------------------------------
6708 ; copia/incremento/decremento puntatori
6709
6710 FF1892 TmpToAddr:
6711 FF1892
6712 FF1892 A5 BA lda SMTmpL
6713 FF1894 85 B6 sta SMAddrL
6714 FF1896 A5 BB lda SMTmpH
6715 FF1898 85 B7 sta SMAddrH
6716 FF189A A5 BC lda SMTmpK
6717 FF189C 85 B8 sta SMAddrK
6718 FF189E 60 rts
6719 FF189F
6720 FF189F SubTmpAddr:
Tue Jul 17 11:00:24 2018 Page 77
6721 FF189F ACC16
6722 FF189F C2 20 rep #PMFLAG
6723 .LONGA on
6724 .MNLIST
6725 FF18A1 38 sec
6726 FF18A2 A5 BA lda SMTmpL
6727 FF18A4 E5 B6 sbc SMAddrL
6728 FF18A6 85 BA sta SMTmpL
6729 FF18A8 ACC08
6730 FF18A8 E2 20 sep #PMFLAG
6731 .LONGA off
6732 .MNLIST
6733 FF18AA A5 BC lda SMTmpK
6734 FF18AC E5 B8 sbc SMAddrK
6735 FF18AE 85 BC sta SMTmpK
6736 FF18B0 60 rts
6737
6738 FF18B1 DecTmpPtr:
6739 FF18B1 A9 01 lda #1
6740 FF18B3
6741 FF18B3 DecTmpPtrA:
6742 FF18B3 85 D6 sta SMAuxL
6743 FF18B5 64 D7 stz SMAuxH
6744 FF18B7 ACC16
6745 FF18B7 C2 20 rep #PMFLAG
6746 .LONGA on
6747 .MNLIST
6748 FF18B9 38 sec
6749 FF18BA A5 BA lda SMTmpL
6750 FF18BC E5 D6 sbc SMAuxL
6751 FF18BE 85 BA sta SMTmpL
6752 FF18C0 ACC08
6753 FF18C0 E2 20 sep #PMFLAG
6754 .LONGA off
6755 .MNLIST
6756 FF18C2 A5 BC lda SMTmpK
6757 FF18C4 E9 00 sbc #0
6758 FF18C6 85 BC sta SMTmpK
6759 FF18C8 60 rts
6760
6761 FF18C9 DecPtr:
6762 FF18C9 ACC16
6763 FF18C9 C2 20 rep #PMFLAG
6764 .LONGA on
6765 .MNLIST
6766 FF18CB 38 sec
6767 FF18CC A5 B6 lda SMAddrL
6768 FF18CE E9 01 00 sbc #1
6769 FF18D1 85 B6 sta SMAddrL
6770 FF18D3 ACC08
6771 FF18D3 E2 20 sep #PMFLAG
6772 .LONGA off
6773 .MNLIST
6774 FF18D5 A5 B8 lda SMAddrK
6775 FF18D7 E9 00 sbc #0
6776 FF18D9 85 B8 sta SMAddrK
6777 FF18DB 60 rts
Tue Jul 17 11:00:24 2018 Page 78
6778
6779 FF18DC DecSize:
6780 FF18DC ACC16
6781 FF18DC C2 20 rep #PMFLAG
6782 .LONGA on
6783 .MNLIST
6784 FF18DE 38 sec
6785 FF18DF A5 BE lda SMSizeL
6786 FF18E1 E9 01 00 sbc #1
6787 FF18E4 85 BE sta SMSizeL
6788 FF18E6 ACC08
6789 FF18E6 E2 20 sep #PMFLAG
6790 .LONGA off
6791 .MNLIST
6792 FF18E8 A5 C0 lda SMSizeK
6793 FF18EA E9 00 sbc #0
6794 FF18EC 85 C0 sta SMSizeK
6795 FF18EE 60 rts
6796 FF18EF
6797 FF18EF IncPtr:
6798 FF18EF C2 21 rep #(PMFLAG.OR.PCFLAG) ; 16 bit + clc
6799 .LONGA on
6800 FF18F1 A9 01 00 lda #1
6801 FF18F4 IncPtrA:
6802 FF18F4 65 B6 adc SMAddrL
6803 FF18F6 85 B6 sta SMAddrL
6804 FF18F8 ACC08
6805 FF18F8 E2 20 sep #PMFLAG
6806 .LONGA off
6807 .MNLIST
6808 FF18FA 90 02 bcc ?01
6809 FF18FC E6 B8 inc SMAddrK
6810 FF18FE 60 ?01: rts
6811
6812
6813 FF18FF XSetPtr:
6814 FF18FF ACC16
6815 FF18FF C2 20 rep #PMFLAG
6816 .LONGA on
6817 .MNLIST
6818 FF1901 A5 B6 lda SMAddrL
6819 FF1903 85 C1 sta SMXAddrL ; offset
6820 FF1905 ACC08
6821 FF1905 E2 20 sep #PMFLAG
6822 .LONGA off
6823 .MNLIST
6824 FF1907 A5 B8 lda SMAddrK ; bank
6825 FF1909 80 0F bra _xsptr
6826 FF190B
6827 FF190B XSetPtrY:
6828 FF190B C2 21 rep #(PMFLAG.OR.PCFLAG) ; A 16 bit + clc
6829 FF190D 98 tya ; YH = 0 !
6830 FF190E 65 B6 adc SMAddrL
6831 FF1910 85 C1 sta SMXAddrL ; offset
6832 FF1912 ACC08
6833 FF1912 E2 20 sep #PMFLAG
6834 .LONGA off
Tue Jul 17 11:00:24 2018 Page 79
6835 .MNLIST
6836 FF1914 A5 B8 lda SMAddrK ; hi
6837 FF1916 69 00 adc #0 ; A = bank
6838 FF1918 B0 1C bcs _?01
6839 FF191A _xsptr:
6840 FF191A C9 20 cmp #$20 ; limite max ?
6841 FF191C B0 18 bcs _?01 ; si - errore
6842 FF191E A6 C2 ldx SMXAddrH
6843 FF1920 86 D6 stx SMAuxL
6844 FF1922 A2 03 ldx #3 ; calcola pagina 8k
6845 FF1924 26 D6 ?01: rol SMAuxL
6846 FF1926 2A rol a
6847 FF1927 CA dex
6848 FF1928 D0 FA bne ?01
6849 FF192A 8D 28 FD sta PIA0+PIAPRA ; pagina XM
6850 FF192D A5 C2 lda SMXAddrH
6851 FF192F 29 1F and #$1F
6852 FF1931 09 20 ora #$20
6853 FF1933 85 C2 sta SMXAddrH
6854 FF1935 18 clc ; ptr OK
6855 FF1936 60 _?01: rts
6856
6857 ;----------------------------------------------------------
6858 ; funzioni elementari di stampa
6859
6860 ; PrintAddr - stampa a video address SMAddrL,H,K
6861 FF1937 PrintAddr:
6862 FF1937 ACC16
6863 FF1937 C2 20 rep #PMFLAG
6864 .LONGA on
6865 .MNLIST
6866 FF1939 A5 B6 lda SMAddrL
6867 FF193B A6 B8 ldx SMAddrK
6868 FF193D
6869 ; PrintAddr2 - stampa a video address A(offset)-X(bank)
6870 FF193D PrintAddr2:
6871 FF193D ACC16
6872 FF193D C2 20 rep #PMFLAG
6873 .LONGA on
6874 .MNLIST
6875 FF193F 48 pha
6876 FF1940 ACC08
6877 FF1940 E2 20 sep #PMFLAG
6878 .LONGA off
6879 .MNLIST
6880 FF1942 8A txa ; hi byte
6881 FF1943 20 71 19 jsr PrintHex
6882 FF1946 68 pla
6883 FF1947 FA plx
6884
6885 ; PrintWord - stampa a video word A(lo)-X(hi)
6886 FF1948 PrintWord:
6887 FF1948 48 pha
6888 FF1949 8A txa
6889 FF194A 20 71 19 jsr PrintHex
6890 FF194D 68 pla
6891
Tue Jul 17 11:00:24 2018 Page 80
6892 ; PrintByte - stampa a video byte A + spazio
6893 FF194E PrintByte:
6894 FF194E 20 71 19 jsr PrintHex
6895
6896 ; PrintBlank - stampa a video uno spazio
6897 FF1951 PrintBlank:
6898 FF1951 TXTPRCHAR
6899 FF1951 02 08 cop $08
6900 .MNLIST
6901 FF1953 20 .DB ' '
6902 FF1954 60 rts
6903
6904 ; PrintUp - CR + cursore up
6905 FF1955 PrintUp:
6906 FF1955 SCNPRINT
6907 FF1955 02 01 cop $01
6908 .MNLIST
6909 FF1957 0D 01 00 .DB KB_CR, SCN_CSRUP, 0
6910 FF195A 60 rts
6911 FF195B
6912 FF195B PrintCR:
6913 FF195B TXTPRCHAR
6914 FF195B 02 08 cop $08
6915 .MNLIST
6916 FF195D 0D .DB KB_CR
6917 FF195E 60 rts
6918 FF195F
6919 FF195F PrintBlankCR:
6920 FF195F SCNPRINT
6921 FF195F 02 01 cop $01
6922 .MNLIST
6923 FF1961 0D 1B 51 20 00 .DB KB_CR, KB_ESC, 'Q', ' ', 0
6924 FF1966 60 rts
6925
6926 FF1967 PrintHex1:
6927 FF1967 TXTPRCHAR
6928 FF1967 02 08 cop $08
6929 .MNLIST
6930 FF1969 24 .DB '$'
6931 FF196A 20 71 19 jsr PrintHex
6932 FF196D TXTPRCHAR
6933 FF196D 02 08 cop $08
6934 .MNLIST
6935 FF196F 2C .DB ','
6936 FF1970 60 rts
6937 FF1971
6938 ; PrintHex - stampa a video byte HEX
6939 ; In - A = byte
6940 ; Out - nessuno
6941 FF1971 PrintHex:
6942 FF1971 DA phx ; salva x
6943 FF1972 20 7C 19 jsr FF_Byte2Hex ; X,A = HEX
6944 FF1975 TXTCHAROUT ; stampa hi digit
6945 FF1975 02 06 cop $06
6946 .MNLIST
6947 FF1977 8A txa
6948 FF1978 FA plx ; ripristina x
Tue Jul 17 11:00:24 2018 Page 81
6949 FF1979 TXTCHAROUT ; stampa low digit
6950 FF1979 02 06 cop $06
6951 .MNLIST
6952 FF197B 60 rts
6953 FF197C
6954 ; FF_Byte2Hex - converte byte in HEX
6955 ; In - A = byte
6956 ; Out: - X = low digit
6957 ; A = hi digit
6958 FF197C FF_Byte2Hex:
6959 FF197C 48 pha ; salva A
6960 FF197D 20 86 19 jsr ?01 ; converte parte bassa
6961 FF1980 AA tax ; x = low digit
6962 FF1981 68 pla
6963 FF1982 4A lsr a ; parte alta
6964 FF1983 4A lsr a
6965 FF1984 4A lsr a
6966 FF1985 4A lsr a
6967 FF1986 29 0F ?01: and #$0F ; maschera nibble
6968 FF1988 C9 0A cmp #10
6969 FF198A 90 02 bcc ?02
6970 FF198C 69 06 adc #6
6971 FF198E 69 30 ?02: adc #'0'
6972 FF1990 60 _?02: rts
6973
6974 ; ritorna indirizzo start e indirizzo stop
6975 ; ritorna C=1 se non ci sono parametri o se Stop < Start
6976 FF1991 GetStartStop:
6977 FF1991 B0 FD bcs _?02 ; no parametri
6978 FF1993 FA plx ; return L
6979 FF1994 68 pla ; return H
6980 FF1995 E8 inx ; scarta stack - necessario per
6981 FF1996 D0 01 bne ?01 ; chiamare GetParm al giusto livello di stack
6982 FF1998 1A inc a ; X,A -> indirizzo di ritorno
6983 FF1999 86 E2 ?01: stx SMTmp2
6984 FF199B 85 E3 sta SMTmp2+1
6985 FF199D 20 92 18 jsr TmpToAddr ; salva SMTmpL/H/K in SMAddrL/H/K
6986 FF19A0 20 5A 01 jsr GetParm
6987 FF19A3 B0 20 bcs ?20 ; no stop address, esce
6988 FF19A5 A5 BA lda SMTmpL ; SMXAddrL/H/K = indirizzo di stop
6989 FF19A7 85 C1 sta SMXAddrL
6990 FF19A9 A5 BB lda SMTmpH
6991 FF19AB 85 C2 sta SMXAddrH
6992 FF19AD A5 BC lda SMTmpK
6993 FF19AF 85 C3 sta SMXAddrK
6994 FF19B1 20 9F 18 jsr SubTmpAddr ; stop - start = #bytes
6995 FF19B4 A5 BA lda SMTmpL ; salva #bytes in SMSizeL/H/K
6996 FF19B6 85 BE sta SMSizeL
6997 FF19B8 A5 BB lda SMTmpH
6998 FF19BA 85 BF sta SMSizeH
6999 FF19BC A5 BC lda SMTmpK
7000 FF19BE 85 C0 sta SMSizeK
7001 FF19C0 90 02 bcc ?19 ; errore: stop < start
7002 FF19C2 18 clc ; OK
7003 FF19C3 24 .DB $24 ; BIT $38
7004 FF19C4 38 ?19: sec ; errore
7005 FF19C5 6C E2 01 ?20: jmp (SMTMP2) ; return
Tue Jul 17 11:00:24 2018 Page 82
7006
7007
7008 ; ricava parametri per funzioni fdread/fdwrite
7009 FF19C8 GetFDCParm:
7010 FF19C8 FA plx ; return L
7011 FF19C9 68 pla ; return H
7012 FF19CA E8 inx ; scarta stack - necessario per
7013 FF19CB D0 01 bne ?01 ; chiamare GetParm al giusto livello di stack
7014 FF19CD 1A inc a ; X,A -> indirizzo di ritorno
7015 FF19CE 86 E2 ?01: stx SMTmp2
7016 FF19D0 85 E3 sta SMTmp2+1
7017 FF19D2 ACC16
7018 FF19D2 C2 20 rep #PMFLAG
7019 .LONGA on
7020 .MNLIST
7021 FF19D4 3B tsc ; stack frame
7022 FF19D5 38 sec
7023 FF19D6 E9 09 00 sbc #FDPBSIZE ; crea variabili locali
7024 FF19D9 1B tcs
7025 FF19DA 1A inc a
7026 FF19DB 85 BE sta SMSizeL ; salva stack frame
7027 FF19DD ACC08
7028 FF19DD E2 20 sep #PMFLAG
7029 .LONGA off
7030 .MNLIST
7031 FF19DF A5 BA lda SMTmpL ; parametro 1 - drive + flag
7032 FF19E1 AA tax
7033 FF19E2 29 01 and #$01 ; maschera drive
7034 FF19E4 83 01 sta $01,s ; drive
7035 FF19E6 8A txa
7036 FF19E7 29 E0 and #$E0 ; maschera flag
7037 FF19E9 83 0D sta $0D,s ; flag
7038 FF19EB 85 C0 sta SMSizeK ; salva flag
7039 FF19ED 20 5A 01 jsr GetParm ; parametro 2 - formato
7040 FF19F0 B0 53 bcs ?20
7041 FF19F2 A5 BA lda SMTmpL
7042 FF19F4 83 06 sta $06,s ; disk format
7043 FF19F6 20 5A 01 jsr GetParm ; parametro 3 - buffer
7044 FF19F9 B0 4A bcs ?20
7045 FF19FB A5 BA lda SMTmpL
7046 FF19FD 83 07 sta $07,s ; buffer ptr
7047 FF19FF A5 BB lda SMTmpH
7048 FF1A01 83 08 sta $08,s
7049 FF1A03 A5 BC lda SMTmpK
7050 FF1A05 83 09 sta $09,s
7051 FF1A07 20 5A 01 jsr GetParm ; parametro 4 - track
7052 FF1A0A B0 39 bcs ?20
7053 FF1A0C A5 BA lda SMTmpL
7054 FF1A0E 83 02 sta $02,s ; track
7055 FF1A10
7056 ; i restanti parametri : head, sector, sector number, vbuffer
7057 ; sono opzionali in funzione dei flag passati
7058 FF1A10 A9 00 lda #$00
7059 FF1A12 83 03 sta $03,s ; head
7060 FF1A14 83 04 sta $04,s ; sector
7061 FF1A16 83 05 sta $05,s ; sector num.
7062 FF1A18 83 0A sta $0A,s ; vbuffer
Tue Jul 17 11:00:24 2018 Page 83
7063 FF1A1A 83 0B sta $0B,s
7064 FF1A1C 83 0C sta $0C,s
7065 FF1A1E 24 C0 bit SMSizeK
7066 FF1A20 30 1B bmi ?18 ; MT -> ignora parametri successivi
7067 FF1A22 20 5A 01 jsr GetParm ; head opzionale
7068 FF1A25 B0 1E bcs ?20
7069 FF1A27 A5 BA lda SMTmpL
7070 FF1A29 83 03 sta $03,s ; head
7071 FF1A2B 20 5A 01 jsr GetParm
7072 FF1A2E B0 15 bcs ?20
7073 FF1A30 A5 BA lda SMTmpL
7074 FF1A32 83 04 sta $04,s ; sector
7075 FF1A34 20 5A 01 jsr GetParm
7076 FF1A37 B0 0C bcs ?20
7077 FF1A39 A5 BA lda SMTmpL
7078 FF1A3B 83 05 sta $05,s ; sector num.
7079 FF1A3D A5 BF ?18: lda SMSizeH ; C = stack frame
7080 FF1A3F EB xba
7081 FF1A40 A5 BE lda SMSizeL
7082 FF1A42 18 clc ; OK
7083 FF1A43 24 .DB $24 ; BIT $38
7084 FF1A44 38 ?19: sec ; errore
7085 FF1A45 6C E2 01 ?20: jmp (SMTMP2) ; return
7086 FF1A48
7087 ;----------------------------------------------------------
7088 ; funzioni riga di comando
7089
7090 ;GetPrevCh:
7091 ; dec SMbndx
7092 FF1A48
7093 FF1A48 GetCurCh:
7094 FF1A48 86 D6 stx SMAuxL
7095 FF1A4A A6 C4 ldx SMbndx
7096 FF1A4C BF 00 99 01 lda INPUTBUF,x
7097 FF1A50 38 sec
7098 FF1A51 F0 06 beq ?01
7099 FF1A53 C9 3A cmp #':'
7100 FF1A55 F0 02 beq ?01
7101 FF1A57 E6 C4 inc SMbndx
7102 FF1A59 08 ?01: php
7103 FF1A5A A6 D6 ldx SMAuxL
7104 FF1A5C 28 plp
7105 FF1A5D 60 rts
7106
7107 ; no case version
7108 FF1A5E GetCurCh2:
7109 FF1A5E 86 D6 stx SMAuxL
7110 FF1A60 A6 C4 ldx SMbndx
7111 FF1A62 BF 00 99 01 lda INPUTBUF,x
7112 FF1A66 F0 0A beq ?00
7113 FF1A68 C9 61 cmp #'a'
7114 FF1A6A 90 06 bcc ?00
7115 FF1A6C C9 7B cmp #'z'+1
7116 FF1A6E B0 02 bcs ?00
7117 FF1A70 29 DF and #$DF
7118 FF1A72 38 ?00: sec
7119 FF1A73 F0 06 beq ?01
Tue Jul 17 11:00:24 2018 Page 84
7120 FF1A75 C9 3A cmp #':'
7121 FF1A77 F0 02 beq ?01
7122 FF1A79 E6 C4 inc SMbndx
7123 FF1A7B 08 ?01: php
7124 FF1A7C A6 D6 ldx SMAuxL
7125 FF1A7E 28 plp
7126 FF1A7F 60 rts
7127
7128 FF1A80 CkStop:
7129 FF1A80 0B phd
7130 FF1A81 F4 00 00 pea #0
7131 FF1A84 2B pld
7132 FF1A85 A5 4B lda CtrlBrk
7133 FF1A87 64 4B stz CtrlBrk
7134 FF1A89 2B pld
7135 FF1A8A C9 80 cmp #$80
7136 FF1A8C 60 rts
7137
7138 ;----------------------------------------------------------
7139 ; UPDATE FLASH
7140 ;----------------------------------------------------------
7141
7142 ;;_FLASHSTART .EQU $
7143
7144 ; flag settori da programmare
7145 FF1A8D _SCTTBL:
7146 FF1A8D 80 80 80 80 80 .DB $80, $80, $80, $80, $80, $80, $80, $80
80 80 80
7147 FF1A95 _SRCBNK:
7148 FF1A95 F8 .DB $F8
7149 FF1A96 _DSTBNK:
7150 FF1A96 F0 .DB $F0
7151 FF1A97
7152 ; erase sector: X -> settore (0..7)
7153 FF1A97 _erase:
7154 .LONGI on
7155 FF1A97 8B phb
7156 FF1A98 4B phk
7157 FF1A99 AB plb
7158 FF1A9A BD 8D 1A lda !_SCTTBL,x
7159 FF1A9D 30 05 bmi ?02 ; erase
7160 FF1A9F AB plb
7161 FF1AA0 18 clc
7162 FF1AA1 E2 40 sep #PVFLAG ; V = 1
7163 FF1AA3 60 rts
7164 FF1AA4 8A ?02: txa
7165 FF1AA5 18 clc
7166 FF1AA6 6D 96 1A adc !_DSTBNK
7167 FF1AA9 85 B8 sta SMAddrK ; banco fisico
7168 FF1AAB 64 B6 stz SMAddrL
7169 FF1AAD 64 B7 stz SMAddrH
7170 FF1AAF AB plb
7171 FF1AB0 A0 00 00 ldy #0
7172 FF1AB3 B7 B6 ?04: lda [SMAddrL],y
7173 FF1AB5 C9 FF cmp #$FF ; test erased
7174 FF1AB7 D0 06 bne ?06 ; not erased
7175 FF1AB9 C8 iny
Tue Jul 17 11:00:24 2018 Page 85
7176 FF1ABA D0 F7 bne ?04
7177 FF1ABC B8 clv
7178 FF1ABD 18 clc
7179 FF1ABE 60 rts ; sector erased
7180 FF1ABF A0 55 05 ?06: ldy #$0555 ; inizia sequenza erase sector
7181 FF1AC2 A9 AA lda #$AA
7182 FF1AC4 97 B6 sta [SMAddrL],y
7183 FF1AC6 A0 AA 02 ldy #$02AA
7184 FF1AC9 A9 55 lda #$55
7185 FF1ACB 97 B6 sta [SMAddrL],y
7186 FF1ACD A0 55 05 ldy #$0555
7187 FF1AD0 A9 80 lda #$80
7188 FF1AD2 97 B6 sta [SMAddrL],y
7189 FF1AD4 A9 AA lda #$AA
7190 FF1AD6 97 B6 sta [SMAddrL],y
7191 FF1AD8 A0 AA 02 ldy #$02AA
7192 FF1ADB A9 55 lda #$55
7193 FF1ADD 97 B6 sta [SMAddrL],y
7194 FF1ADF A0 00 00 ldy #$00 ; SA - sector address (in banco)
7195 FF1AE2 A9 30 lda #$30 ; codice erase
7196 FF1AE4 87 B6 sta [SMAddrL]
7197 FF1AE6 20 5B 1B jsr _waitfl ; attende fine operazione
7198 FF1AE9 B0 0D bcs ?30 ; fail
7199 FF1AEB B7 B6 ?24: lda [SMAddrL],y
7200 FF1AED C9 FF cmp #$FF ; test erased
7201 FF1AEF D0 06 bne ?26 ; not erased
7202 FF1AF1 C8 iny
7203 FF1AF2 D0 F7 bne ?24
7204 FF1AF4 B8 clv
7205 FF1AF5 18 clc
7206 FF1AF6 60 rts ; sector erased
7207 FF1AF7 38 ?26: sec ; erased fail
7208 FF1AF8 60 ?30: rts
7209 FF1AF9
7210 ; pgm sector: X -> settore (0..7)
7211 FF1AF9 _sctrpgm:
7212 FF1AF9 8B phb
7213 FF1AFA 4B phk
7214 FF1AFB AB plb
7215 FF1AFC BD 8D 1A lda !_SCTTBL,x
7216 FF1AFF 30 05 bmi ?02 ; erase
7217 FF1B01 AB plb
7218 FF1B02 E2 40 sep #PVFLAG ; V = 1
7219 FF1B04 18 clc
7220 FF1B05 60 rts
7221 FF1B06 8A ?02: txa
7222 FF1B07 18 clc
7223 FF1B08 6D 96 1A adc !_DSTBNK
7224 FF1B0B 85 B8 sta SMAddrK ; banco fisico DST
7225 FF1B0D 64 B6 stz SMAddrL
7226 FF1B0F 64 B7 stz SMAddrH
7227 FF1B11 8A txa
7228 FF1B12 18 clc
7229 FF1B13 65 EE adc SMFsrc
7230 FF1B15 85 C3 sta SMXAddrK ; banco fisico SRC
7231 FF1B17 64 C1 stz SMXAddrL
7232 FF1B19 64 C2 stz SMXAddrH
Tue Jul 17 11:00:24 2018 Page 86
7233 FF1B1B AB plb
7234 FF1B1C A0 00 00 ldy #0
7235 FF1B1F B7 C1 ?04: lda [SMXAddrL],y
7236 FF1B21 EA nop
7237 FF1B22 D7 C1 cmp [SMXAddrL],y
7238 FF1B24 D0 F9 bne ?04
7239 FF1B26 85 E2 sta SMTmp2
7240 FF1B28 84 BE sty SMSizeL
7241 FF1B2A A0 55 05 ldy #$0555 ; inizia sequenza pgm
7242 FF1B2D A9 AA lda #$AA
7243 FF1B2F 97 B6 sta [SMAddrL],y
7244 FF1B31 A0 AA 02 ldy #$02AA
7245 FF1B34 A9 55 lda #$55
7246 FF1B36 97 B6 sta [SMAddrL],y
7247 FF1B38 A0 55 05 ldy #$0555
7248 FF1B3B A9 A0 lda #$A0
7249 FF1B3D 97 B6 sta [SMAddrL],y
7250 FF1B3F A4 BE ldy SMSizeL
7251 FF1B41 A5 E2 lda SMTmp2
7252 FF1B43 97 B6 sta [SMAddrL],y ; program byte
7253 FF1B45 20 5B 1B jsr _waitfl
7254 FF1B48 E2 40 sep #PVFLAG ; V = 1 -> pgm fail
7255 FF1B4A B0 0E bcs ?30 ; fail
7256 FF1B4C B7 B6 ?20: lda [SMAddrL],y
7257 FF1B4E C5 E2 cmp SMTmp2
7258 FF1B50 D0 06 bne ?28
7259 FF1B52 C8 iny
7260 FF1B53 D0 CA bne ?04
7261 FF1B55 B8 clv
7262 FF1B56 18 clc
7263 FF1B57 60 rts
7264 FF1B58 38 ?28: sec
7265 FF1B59 B8 clv ; V = 0 -> verf fail
7266 FF1B5A 60 ?30: rts
7267
7268 ; polling toggle bit (DQ6)
7269 FF1B5B _waitfl:
7270 FF1B5B B7 B6 ?08: lda [SMAddrL],y ; loop toggle bit
7271 FF1B5D 85 D6 sta SMAuxL
7272 FF1B5F B7 B6 ?10: lda [SMAddrL],y ; read toggle bit
7273 FF1B61 85 D7 sta SMAuxH
7274 FF1B63 45 D6 eor SMAuxL ; confronta
7275 FF1B65 29 40 and #$40 ; bit 6 toggle ?
7276 FF1B67 F0 20 beq ?20 ; no - operazione terminata
7277 FF1B69 A9 20 lda #00100000B ; test DQ5
7278 FF1B6B 24 D7 bit SMAuxH
7279 FF1B6D D0 06 bne ?12 ; DQ5 = 1 -> read toggle bit
7280 FF1B6F A5 D7 lda SMAuxH ; DQ5 = 0 -> loop
7281 FF1B71 85 D6 sta SMAuxL
7282 FF1B73 80 EA bra ?10
7283 FF1B75 A7 B6 ?12: lda [SMAddrL] ; read toggle bit
7284 FF1B77 85 D6 sta SMAuxL
7285 FF1B79 A7 B6 lda [SMAddrL] ; read toggle bit
7286 FF1B7B 85 D7 sta SMAuxH
7287 FF1B7D 45 D6 eor SMAuxL
7288 FF1B7F 29 40 and #$40 ; bit 6 toggle ?
7289 FF1B81 F0 06 beq ?20 ; no - operazione terminata
Tue Jul 17 11:00:24 2018 Page 87
7290 FF1B83 A9 F0 lda #$F0 ; fail - reset device
7291 FF1B85 87 B6 sta [SMAddrL]
7292 FF1B87 38 sec
7293 FF1B88 60 rts
7294 FF1B89 18 ?20: clc
7295 FF1B8A 60 rts
7296
7297 ; update flash from emulator
7298 FF1B8B Cmd_eflash:
7299 FF1B8B A9 E0 lda #$E0
7300 FF1B8D 85 B8 sta SMAddrL+2
7301 FF1B8F 64 B6 stz SMAddrL
7302 FF1B91 64 B7 stz SMAddrL+1
7303 FF1B93 9C 10 FC stz !VIA2+VIAPRB
7304 FF1B96 8D 0D FC sta !CREMEON
7305 FF1B99 INDEX16
7306 FF1B99 C2 10 rep #PXFLAG
7307 .LONGI on
7308 .MNLIST
7309 FF1B9B A0 00 00 ?lp1: ldy #0
7310 FF1B9E BB tyx
7311 FF1B9F BF 00 18 01 ?lp2: lda >EMURAM,x
7312 FF1BA3 97 B6 sta [SMAddrL],y
7313 FF1BA5 C8 iny
7314 FF1BA6 E8 inx
7315 FF1BA7 E0 00 08 cpx #$0800
7316 FF1BAA 90 F3 bcc ?lp2
7317 FF1BAC ACC16CLC
7318 FF1BAC C2 21 rep #(PMFLAG.OR.PCFLAG)
7319 .LONGA on
7320 .MNLIST
7321 FF1BAE 8A txa
7322 FF1BAF 65 B6 adc SMAddrL
7323 FF1BB1 85 B6 sta SMAddrL
7324 FF1BB3 ACC08
7325 FF1BB3 E2 20 sep #PMFLAG
7326 .LONGA off
7327 .MNLIST
7328 FF1BB5 90 02 bcc ?nxt
7329 FF1BB7 E6 B8 inc SMAddrL+2
7330 FF1BB9 EE 10 FC ?nxt: inc !VIA2+VIAPRB
7331 FF1BBC D0 DD bne ?lp1
7332 FF1BBE CPU08
7333 FF1BBE E2 30 sep #(PMFLAG.OR.PXFLAG)
7334 .LONGA off
7335 .LONGI off
7336 .MNLIST
7337 FF1BC0 A9 E0 lda #$E0 ; from bank $E0
7338 FF1BC2 80 0D bra _flash
7339
7340 ; update flash from file
7341 FF1BC4 Cmd_flash:
7342 FF1BC4 24 EF bit SMFflag
7343 FF1BC6 30 03 bmi ?01
7344 FF1BC8 4C 1B 0A jmp CmdErr3
7345 FF1BCB A9 E0 ?01: lda #$E0 ; from bank $E0
7346 FF1BCD 80 02 bra _flash
Tue Jul 17 11:00:24 2018 Page 88
7347 FF1BCF
7348 ; update flash from memory
7349 FF1BCF Cmd_mflash:
7350 FF1BCF A9 F8 lda #$F8 ; from memory
7351
7352 FF1BD1 _flash:
7353 FF1BD1 85 EE sta SMFsrc
7354 FF1BD3 CPU08
7355 FF1BD3 E2 30 sep #(PMFLAG.OR.PXFLAG)
7356 .LONGA off
7357 .LONGI off
7358 .MNLIST
7359 FF1BD5 F4 00 01 pea #DP01ADDR ; imposta nuova DP
7360 FF1BD8 2B pld
7361 FF1BD9 A9 00 lda #$00
7362 FF1BDB 48 pha
7363 FF1BDC AB plb
7364 FF1BDD 8D 07 FC sta !CRFWEON ; enable write flash
7365 FF1BE0 8D 08 FC sta !CRXFEOFF ; abilita flash banco $F0
7366 FF1BE3 A2 7F ldx #$7F
7367 FF1BE5 8E 0E FD stx VIA0+VIAIER ; disabilita interrupt VIA 0
7368 FF1BE8 8E 0D FD stx VIA0+VIAIFR ; ed azzera tutti i flag
7369 FF1BEB 8E 1E FD stx VIA1+VIAIER ; disabilita interrupt VIA 1
7370 FF1BEE 8E 1D FD stx VIA1+VIAIFR ; ed azzera tutti i flag
7371 FF1BF1 78 sei
7372 FF1BF2 INDEX16
7373 FF1BF2 C2 10 rep #PXFLAG
7374 .LONGI on
7375 .MNLIST
7376 FF1BF4 A2 07 00 ldx #$07
7377 FF1BF7 20 97 1A _?ff: jsr _erase ; erase sector X
7378 FF1BFA B0 1A bcs _fail1 ; fail sector
7379 FF1BFC 70 0D bvs ?02 ; salta settore
7380 FF1BFE 20 F9 1A jsr _sctrpgm
7381 FF1C01 B0 2C bcs _fail2 ; fail pgm
7382 FF1C03 70 06 bvs ?02 ; salta settore
7383 FF1C05 20 65 1C jsr _okbeep
7384 FF1C08 20 7D 1C jsr _delay
7385 FF1C0B CA ?02: dex
7386 FF1C0C 10 E9 bpl _?ff
7387 FF1C0E A9 80 lda #$80
7388 FF1C10 1C 01 FD trb VIA0+VIAPRA ; reset
7389 FF1C13 EA ?03: nop
7390 FF1C14 80 FD bra ?03
7391
7392 FF1C16 _fail1:
7393 FF1C16 A9 B0 lda #10110000B ; CTC 2 in modo 0 - 2 bytes
7394 FF1C18 8D 4B FD sta CTC0+CTCCTRL
7395 FF1C1B A9 D0 lda #<2000
7396 FF1C1D 8D 4A FD sta CTC0+CTCCNT2
7397 FF1C20 A9 07 lda #>2000
7398 FF1C22 8D 4A FD sta CTC0+CTCCNT2
7399 FF1C25 A9 08 lda #$08
7400 FF1C27 1C 2B FD trb PIA0+PIACRB
7401 FF1C2A 1C 29 FD trb PIA0+PIACRA
7402 ;bra _?ff
7403 FF1C2D 80 34 bra _fail3
Tue Jul 17 11:00:24 2018 Page 89
7404 FF1C2F
7405 FF1C2F _fail2:
7406 FF1C2F 50 20 bvc ?10
7407 FF1C31 A9 B0 lda #10110000B ; CTC counter 2 in modo 0 - 2 bytes
7408 FF1C33 8D 4B FD sta CTC0+CTCCTRL
7409 FF1C36 A9 76 lda #01110110B ; CTC counter 1 in modo 3 - 2 bytes
7410 FF1C38 8D 4B FD sta CTC0+CTCCTRL
7411 FF1C3B A9 90 lda #<400 ; beep 200ms - pausa 200ms
7412 FF1C3D 8D 49 FD sta CTC0+CTCCNT1
7413 FF1C40 A9 01 lda #>400
7414 FF1C42 8D 49 FD sta CTC0+CTCCNT1
7415 FF1C45 A9 40 lda #<1600 ; 4 beep
7416 FF1C47 8D 4A FD sta CTC0+CTCCNT2
7417 FF1C4A A9 06 lda #>1600
7418 FF1C4C 8D 4A FD sta CTC0+CTCCNT2
7419 FF1C4F 80 0A bra ?20
7420 FF1C51 A9 80 ?10: lda #<3200 ; 4 beep
7421 FF1C53 8D 4A FD sta CTC0+CTCCNT2
7422 FF1C56 A9 0C lda #>3200
7423 FF1C58 8D 4A FD sta CTC0+CTCCNT2
7424 FF1C5B
7425 FF1C5B A9 08 ?20: lda #$08 ; beep ... beep...
7426 FF1C5D 0C 2B FD tsb PIA0+PIACRB
7427 FF1C60 1C 29 FD trb PIA0+PIACRA
7428 ;bra _?ff
7429 FF1C63 _fail3:
7430 FF1C63 80 FE bra _fail3
7431 FF1C65
7432 FF1C65 _okbeep:
7433 FF1C65 A9 B0 lda #10110000B ; CTC 2 in modo 0 - 2 bytes
7434 FF1C67 8D 4B FD sta CTC0+CTCCTRL
7435 FF1C6A A9 96 lda #<150
7436 FF1C6C 8D 4A FD sta CTC0+CTCCNT2
7437 FF1C6F A9 00 lda #>150
7438 FF1C71 8D 4A FD sta CTC0+CTCCNT2
7439 FF1C74 A9 08 lda #$08
7440 FF1C76 1C 2B FD trb PIA0+PIACRB
7441 FF1C79 1C 29 FD trb PIA0+PIACRA
7442 FF1C7C 60 rts
7443 FF1C7D
7444 FF1C7D _delay:
7445 FF1C7D A9 2C lda #<300 ; timeout
7446 FF1C7F 8D 08 FD sta VIA0+VIAT2CL
7447 FF1C82 A9 01 lda #>300
7448 FF1C84 8D 09 FD sta VIA0+VIAT2CH
7449 FF1C87 A9 20 ?02: lda #T2IFRB
7450 FF1C89 2C 0D FD bit VIA0+VIAIFR ; test timeout
7451 FF1C8C F0 F9 beq ?02 ; loop
7452 FF1C8E 60 rts
7453
7454 ;;_startpgm:
7455 ;; jmp _flash
7456 FF1C8F
7457 ;;_FLASHEND .EQU $
7458 ;;_FLASHCNT .EQU ($ - _FLASHSTART)
7459
7460 FF1C8F
Tue Jul 17 11:00:24 2018 Page 90
7461 ;----------------------------------------------------------
7462 ; stringhe
7463
7464 FF1C8F CRSTR:
7465 FF1C8F 0D 3A 3A 45 4D .DB $0D, '::EM $010000-$011FFF->0 * XM $012000-$013FFF->0'
20 24 30 31 30
30 30 30 2D 24
30 31 31 46 46
46 2D 3E 30 20
2A 20 58 4D 20
24 30 31 32 30
30 30 2D 24 30
31 33 46 46 46
2D 3E 30
7466 FF1CBF 20 2A 20 46 4D .DB ' * FM $F00000-$F7FFFF->0', 0
20 24 46 30 30
30 30 30 2D 24
46 37 46 46 46
46 2D 3E 30 00
Lines Assembled : 6669 Errors : 0