Blame | Last modification | View Log | Download | RSS feed
Tue Jul 17 11:00:17 2018 Page 1
2500 A.D. 65816 Macro Assembler #26960 - Version 5.02g
-----------------------------------------------------
Input Filename : src\F8\bios.asm
Output Filename : obj\F8\bios.obj
Listing Has Been Relocated
2605 .LIST on
2606
2607 F8FFB1 .INCLUDE inc\dirp00.inc
2608 ;----------------------------------------------------------
2609 ; DIRP00.ASM
2610 ; PROGETTO: B1601
2611 ;
2612 ; Variabili in Direct Page $00
2613 ;----------------------------------------------------------
2614
2615 ; sezione COMMON -- questo permette di includere il file in piu' file
2616
2617 .LIST on
2618
2619 DIRP00: .SECTION page0, ref_only, common ;Direct-Page 00
2620
2621 000000 .ABSOLUTE ;; inizia sempre da $00
2622 000000 .ORG 0x00
2623 000000
2624 000000 0000 JiffyClk .DW ; contatore 10ms 32 bit
2625 000002 0000 .DW
2626 000004 SysTmr .DS SYSTMRCNT ; system timer 0 (10ms)
2627 000008 SysTMF .DS SYSTMRCNT ; flag timer (80 -> start)
2628 00000C 00 Bnk0Flag .DB ; <7>: flag test RAM banco 0 ok
2629 ; <6>: flag warm reset
2630 00000D 00 RTCFlag .DB
2631
2632 00000E diskstat .DS 2 ; flag device on ata bus #0 & #1
2633 ; <7>: device ready
2634 ; <6>: compact flash device (C.F.)
2635 ; <5>: device identification ok
2636 ; <4>: MBR loaded
2637 ; <3>: valid signature in MBR
2638 ; <2>: first partition found&active
2639 ; <1>:
2640 ; <0>: valid partition flag
2641
2642 ; <7>: device ready
2643 ; <6>: USB device
2644 ; <5>: compact flash device (C.F.)
2645 ; <4>: device identification ok
2646 ; <3>: MBR loaded
2647 ; <2>: first partition found&active
2648 ; <1>: always 1
2649 ; <0>: valid partition flag
2650 000010
Tue Jul 17 11:00:17 2018 Page 2
2651
2652 00000E atadev .EQU diskstat
2653
2654 000010 usbdev .DS 2 ; flag flash disk on usb bus #0
2655 ; <7>: device plugged and ready
2656 ; <6>: always 1
2657 ; <5>: device identification ok
2658 ; <4>: MBR loaded
2659 ; <3>: valid signature in MBR
2660 ; <2>: first partition found&active
2661 ; <1>:
2662 ; <0>: valid partition flag
2663
2664 000012 diskmax .DS 16 ; disk max. sector's
2665 000012 atasec .EQU diskmax
2666 00001A usbsec .EQU diskmax+8
2667
2668
2669 000022 atambr .DS 8 ; data for first partition found in mbr
2670 ; first 3 bytes for start sector of partition
2671 ; last byte for partition type
2672 00002A usbmbr .DS 8
2673
2674 000032 ataprt .DS 8 ; total sec's of first partition
2675 00003A usbprt .DS 8 ; total sec's of first partition
2676
2677
2678 000042 00 usb0ch .DB ; usb0 (ch375/ch376) flag
2679 ; <7>: module on
2680 ; <6>: ch376 flag
2681 ; <5:0>: chip version
2682
2683 000043 00 usb0st .DB ; usb0 status
2684 ; <7>: usb0 host mode ok
2685 ; <6>: flash disk attached flag
2686 ; <5>: usb device attached
2687
2688 000044 00 fdcdrv .DB ; phisycal drive status (drive #0)
2689 ; <7>: disk format established in bit 0&1
2690 ; <6>: double step seek done
2691 ; <5>: trust format bit's (set after ok r/w)
2692 ; <4>: write protect bit (if disk in drive)
2693 ; <3>: don't care
2694 ; <2>: don't care
2695 ; <1>: HD disk if set else DD disk
2696 ; <0>: CBM format if set else IBM format
2697
2698 000045 00 vdrive .DB ; virtual drive status (ram disk, drive #1)
2699 ; <7>: disk format established in bit 0&1
2700 ; <6>: change disk simulation (after format)
2701 ; <5>: don't care
2702 ; <4>: write protect bit (under sw control)
2703 ; <3>: don't care
2704 ; <2>: don't care
2705 ; <1>: HD disk if set else DD disk
2706 ; <0>: CBM format if set else IBM format
2707
Tue Jul 17 11:00:17 2018 Page 3
2708 000046 00 fdcctl .DB ; fdc controller status
2709 ; <7>: drive is attached
2710 ; <6>: drive need recalibration (restore)
2711 ; <5>: FDC controller ok
2712 ; <4>: motor on
2713 ; <3>: dma is active
2714 ; <2>: dma chip ok (post routine)
2715 ; <1>: clock rate (1=HD,0=DD)
2716 ; <0>: disk ready
2717
2718 000047 00 fdctrk .DB ; fd: current seek track
2719 000048 00 fdcerr .DB ; fd: last error code
2720 000049 00 ataerr .DB ; ata: last error code
2721 00004A 00 ataxer .DB ; ata: last extended error code
2722
2723 00004B 00 CtrlBrk .DB ; flag CTRL+BREAK (NMI)
2724
2725 00004C 0000 MemTop .DW ; top memoria RAM
2726 00004E 00 .DB ; banco top mem
2727
2728 00004F 00 DflTxtIn .DB ; device di default text input
2729 000050 00 DflTxtOut .DB ; device di default text output
2730
2731 000051 COPPtr LP ; long pointer for COP decoding
2732 000054 00 COPIdx .DB ; COP signature/index
2733
2734 000055 00 BiosEnt .DB ; flag accesso a bios setup
2735
2736 ; variabili utilizzate da ACIA
2737 000056 spwrk .DS $30
2738
2739 ; bios mem
2740 000086 0000 nsize .DW ; dimensione blocco da allocare
2741 ;bsize .DW ; dimensione vera blocco free
2742 000088 0000 splitsz .DW ; dimensione blocco splittato
2743 00008A 0000 bfree .DW ; puntatore blocco free
2744 00008C 0000 hdrptr .DW ; puntatore header heap
2745
2746 00008E 0000 pbrklv .DW ; current break level of current process
2747 000090 0000 pbrkmin .DW ; minimum breal level of current process
2748 000092 0000 pbrkmax .DW ; maximum breal level of current process
2749 000094
2750 ; bios temp. work area
2751 000094 bwrktmp .DS $28
2752
2753 0000BC 00 coptmp .DB ; temp. used while cop
2754
2755 0000BD 00 tstser .DB ; check ser/usb test board post
2756 ; <7>: VIA2 ok
2757 ; <6>: PICRAM ok
2758 ; <1>: UART 16C550 ok
2759 ; <0>: R65C51 ok
2760
2761
2762 ;crc16 .DW
2763
2764 0000BD .RELATIVE
Tue Jul 17 11:00:17 2018 Page 4
2765
2766 .ENDS
2767
2768 [01] .IFDEF _ACIA_INC_
2769 .INCLUDE INC\SP.INC
2770 [00] .ENDIF
2771
2785 .LIST on
2786
2787 000060 KBDBUFLEN .EQU 96 ; dimensione buffer di tastiera
2788
2789 DIRP01: .SECTION page0, ref_only, common ;Direct-Page 01
2790
2791 000000 .ABSOLUTE ;; inizia sempre da $00
2792 000000 .ORG 0x00
2793
2794 000000
2795 000000 KbdBuf .DS KBDBUFLEN ; buffer della tastiera
2796 000060 00 KbdITail .DB ; coda buffer tastiera
2797 000061 00 KbdIHead .DB ; testa buffer tastiera
2798 000062 00 KbdCnt .DB ; numero bytes nel buffer
2799 000063 00 KbdShift .DB
2800 000064 00 KbdFlag .DB
2801 000065 00 KbdToggle .DB
2802 000066 00 KbdSt .DB ; status tastiera dopo reset
2803 000067 00 PS2Ctl .DB ; flag controller PS2 keyboard
2804
2805 000068 00 LCDFlag .DB
2806 000069 00 LCDTmp .DB
2807 00006A 0000 LCDVal .DW
2808
2809 00006C 00 VBBFlag .DB ; flag video board
2810 00006D 00 VBBRam .DB ; flag video RAM
2811
2812 00006E 00 ScnLinTmp .DB
2813 00006F 00 ScnChBase .DB ; base video ram VDC
2814 000070 00 ScnAttBase .DB ; base ram attributi VDC
2815 000071 00 ScnCursMode .DB ; VDC cursore default
2816 000072 00 ScnSaveAttr .DB
2817 000073 00 ScnInsert .DB
2818 000074 00 ScnAutoIns .DB ; bit 7 -> autoins - bit 6 -> modo input
2819 000075 00 ScnScroll .DB
2820 000076 00 ScnMaxRow .DB ; max. righe finestra (-1)
2821 000077 00 ScnMaxCols .DB ; max. colonne finestra (-1)
2822
2823 000078 ScnMapTabs1 .DS 10
2824 000082 ScnMapTabs2 .DS 4
2825 000086
2826 000086 0000 ScnPtr .DW ; puntatore video ram linea corrente
2827 000088 00 .DB
2828
2829 000089 00 ScnFiltLen .DB ; lunghezza set caratteri filtro
2830
2831 00008A 0000 ScnAtPtr .DW ; puntatore attributi ram linea corrente
2832 00008C 00 .DB
2833
2834 00008D 00 ScnTmpx .DB ; temporaneo: durante put char
Tue Jul 17 11:00:17 2018 Page 5
2835 00008E
2836 00008E 00 ScnTop .DB ; riga superiore finestra
2837 00008F 00 ScnLeft .DB ; colonna sinistra finestra
2838 000090 00 ScnBottom .DB ; riga inferiore finestra
2839 000091 00 ScnRight .DB ; colonna destra finestra
2840 000092 00 ScnAttr .DB ; attributo default
2841 000093 00 ScnAttr2 .DB ; attributo alternativo
2842 000094 00 ScnRow .DB ; riga cursore
2843 000095 00 ScnCol .DB ; colonna cursore
2844 000096 00 ScnRowStart .DB ; riga di start input
2845 000097 00 ScnInput .DB ; riga di fine input
2846 000098 00 ScnColStart .DB ; colonna di start input
2847 000099 00 ScnSaveX .DB
2848 00009A 00 ScnSaveY .DB
2849 00009B 00 ScnTmpL .DB
2850 00009C 00 ScnTmpH .DB
2851 00009D 00 ScnSaveRow .DB
2852 00009E 00 ScnSaveCol .DB
2853 00009F 00 ScnCurChr .DB
2854 0000A0 00 ScnLstChr .DB
2855 0000A1 00 ScnCR .DB
2856 0000A2 0000 ScnPrm .DW ; puntatore long utilizzato da print imm
2857 0000A4 00 .DB ; banco puntatore ScnPrm
2858 0000A5 00 ScnMode .DB ; flag modo schermo
2859
2860 0000A6 ScnPtr1 LP
2861
2862 0000A9 00 ScnDefCol .DB ; default foreground color
2863
2864 0000AA ScnPtr2 LP
2865
2866 0000AD 00 ScnDefBkgCol .DB ; default background color
2867 0000AE 00 ScnInpRow .DB ; modo input line: riga start input
2868 0000AF 00 ScnInpCol .DB ; modo input line: colonna start input
2869 0000B0 00 ScnLstRow .DB ; modo input line: riga stop input
2870 0000B1 00 ScnLstCol .DB ; modo input line: colonna stop input
2871 0000B2 00 ScnFlag .DB ; Bit 7: input line - Bit 6: input riga unica
2872 0000B3 00 ScnMask .DB ; flag tasti funzione editor di linea
2873 0000B4 00 ScnFilt .DB ; filtro tasti editor di linea
2874 0000B5 00 ScnCntrl .DB ; flag ASCII/CONTROL
2875 ;DflTxtIn .DB ; device di default text input
2876 ;DflTxtOut .DB ; device di default text output
2877 0000B6
2878 000047 SCNCLRLEN .EQU ($ - ScnLinTmp - 1)
2879
2880 ;SCNCLRLEN .EQU (DflTxtOut - ScnLinTmp)
2881
2882 ; variabili monitor
2883 0000B6 00 SMAddrL .DB ; address low/high
2884 0000B7 00 SMAddrH .DB
2885 0000B8 00 SMAddrK .DB ; address bank
2886 0000B9 00 SMFlag32 .DB ; flag parametro 32 bit
2887 0000BA 00 SMTmpL .DB ; temp. low/high
2888 0000BB 00 SMTmpH .DB
2889 0000BC 00 SMTmpK .DB ; temp. bank
2890 0000BD 00 SMTmpKK .DB ; high byte param. 32 bit
2891 0000BE 00 SMSizeL .DB ; size low/high
Tue Jul 17 11:00:17 2018 Page 6
2892 0000BF 00 SMSizeH .DB
2893 0000C0 00 SMSizeK .DB ; size bank
2894 0000C1 00 SMXAddrL .DB ; address low/high XM
2895 0000C2 00 SMXAddrH .DB
2896 0000C3 00 SMXAddrK .DB ; address bank XM
2897 0000C4 00 SMbndx .DB ; indice input buffer
2898 0000C5 00 SMnprm .DB ; numero parametri riga di comando
2899 0000C6 00 SMdumb .DB
2900 0000C7 00 SMkr .DB
2901 0000C8 0000 SMpc .DW
2902 0000CA 00 SMsr .DB
2903 0000CB 00 SMbr .DB
2904 0000CC 0000 SMdp .DW
2905 0000CE 0000 SMac .DW
2906 0000D0 0000 SMxr .DW
2907 0000D2 0000 SMyr .DW
2908 0000D4 0000 SMsp .DW
2909
2910 0000D6 00 SMAuxL .DB
2911 0000D7 00 SMAuxH .DB
2912
2913 0000D8 00 asmlong .DB ; flag for CPU in 16 mode
2914 ; <7> -> A/M in 16 bit mode
2915 ; <6> -> X/Y in 16 bit mode
2916 0000D9 00 asmcpu .DB ; <7> -> 8 bit family
2917 ; <6> -> 65C02 cmos version
2918
2919 0000DA 00 SMctx .DB ; context (if = $00 no quit command)
2920 0000DB SMrsm LP ; long pointer to resume caller context
2921
2922 0000DE 00 rtcadr .DB ; rtc internal ram address
2923 0000DF 00 rtcbnk .DB ; RTC internal bank ram
2924 0000E0 00 cmdlin .DB ;
2925 0000E1 00 SMesc .DB
2926
2927 0000E2 SMXTmp: .DS 26 ; 26 bytes tmp
2928
2929 0000E2 SMTmp2 .EQU SMXTmp
2930 0000E4 SMTmp3 .EQU SMXTmp+2
2931 0000E6 SMdwTmp1 .EQU SMXTmp+4
2932 0000EA SMdwTmp2 .EQU SMXTmp+8
2933 0000EE SMFsrc .EQU SMXTmp+12 ; source bank for flash update
2934 0000EF SMFflag .EQU SMXTmp+13 ; flag file for flash update
2935 0000F0 SMXPos2 .EQU SMXTmp+14
2936 0000F1 SMYPos2 .EQU SMXTmp+15
2937 0000F2 SMXPos3 .EQU SMXTmp+16
2938 0000F3 SMYPos3 .EQU SMXTmp+17
2939 ;SMAuxL .EQU SMXTmp+18
2940 ;SMAuxH .EQU SMXTmp+19
2941 0000F6 SMXPos .EQU SMXTmp+20
2942 0000F7 SMYPos .EQU SMXTmp+21
2943 0000F8 SMdwTmp3 .EQU SMXTmp+22
2944
2945 0000E2 atcmd .EQU SMXTmp ; save @ command
2946 0000E3 atnum .EQU SMXTmp+1 ; @ command index
2947 0000E4 atflag .EQU SMXTmp+2 ; @ L,S,V,R,W start address flag
2948 0000E5 atbnk .EQU SMXTmp+3 ; @ L,S,V,R,W bank
Tue Jul 17 11:00:17 2018 Page 7
2949 0000E6 atstr .EQU SMXTmp+4 ; @ command string start (word)
2950 0000E8 atstart .EQU SMXTmp+6 ; @ L,S,V,R,W start address (word)
2951 0000EA atend .EQU SMXTmp+8 ; @ S,W end address (word)
2952 0000EC atbuf .EQU SMXTmp+10 ; @ local buffer pointer (word)
2953 0000EE atipb .EQU SMXTmp+12 ; @ bank of input buffer
2954 0000EF atdir .EQU SMXTmp+13 ; @ load dir flag
2955 0000F0 atptr .EQU SMXTmp+14 ; @ load dir pointer (word)
2956 0000F2 atsiz .EQU SMXTmp+16 ; @ buffer size (word)
2957 0000F5 atlp .EQU SMXTmp+19 ; @ long pointer
2958 0000F8 atsa .EQU SMXTmp+22 ; @ sa
2959
2960 0000E2 btmpx .EQU SMXTmp ; asc2bin conversion
2961 0000E3 brtcsec .EQU SMXTmp+1
2962 0000E4 brtcmin .EQU SMXTmp+2
2963 0000E5 brtchour .EQU SMXTmp+3
2964 0000E6 brtcday .EQU SMXTmp+4
2965 0000E7 brtcmonth .EQU SMXTmp+5
2966 0000E8 brtcyear .EQU SMXTmp+6
2967 0000E9 brtcct .EQU SMXTmp+7
2968
2969
2970 0000FC .RELATIVE
2971
2972 .ENDS
2973
2977 .LIST on
2978 F8FFB1
2979 .CODEF8
2980
2981 .EXTERN _ScnCharOut, _ScnCharIn, cinit, LF8Tst
2982
2983 .LONGA off
2984 .LONGI off
2985
2986 ;---------------------------------------------------------------------------
2987 ; system bios call interface
2988 ;---------------------------------------------------------------------------
2989 F80200
2990 ;---------------------------------------------------------------------------
2991
2992 ; tabella funzioni text char output
2993 F80200 TXTOTBL:
2994 F80200 7502 3F02 3F02 .DW _KeybOut, _SerOut, _SerOut, _ScnOut, _PrnOut, _PrnOut
4103 6D02 6D02
2995
2996 ; tabella funzioni text char input
2997 F8020C TXTITBL:
2998 F8020C FA03 3D02 3D02 .DW _KeybIn, _SerIn, _SerIn, _ScnIn, _PrnIn, _PrnIn
2402 6902 6902
2999
3000 ; tabella funzioni text string output
3001 F80218 TXTSTBL:
3002 F80218 7502 4C02 4C02 .DW _KeybOut, _SerStrOut, _SerStrOut, $0000
0000
3003 F80220 7102 7102 .DW _PrnStrOut, _PrnStrOut
3004
3005
Tue Jul 17 11:00:17 2018 Page 8
3006 ;---------------------------------------------------------------------------
3007 ;---------------------------------------------------------------------------
3008
3009 ; char in da schermo (rediretto)
3010 F80224 _ScnIn:
3011 .LONGA off
3012 .LONGI off
3013 F80224
3014 ;lda DflTxtIn
3015 F80224 A9 03 lda #TXTD_SCN
3016 F80226 F4 00 01 pea #DP01ADDR ; imposta nuova DP
3017 F80229 2B pld
3018 F8022A 05 A1 ora ScnCR ; input rediretto da video
3019 F8022C 85 A1 sta ScnCR
3020 F8022E A5 94 lda ScnRow
3021 F80230 85 6E sta ScnLinTmp
3022 F80232 A5 91 lda ScnRight
3023 F80234 85 97 sta ScnInput
3024 F80236 20 D5 A4 jsr _ScnCharIn
3025 F80239 83 0D sta STKCR,s
3026 F8023B 18 clc
3027 F8023C 6B rtl
3028 F8023D
3029 ; char in da porta seriale
3030 F8023D _SerIn:
3031 F8023D 38 sec
3032 F8023E 6B rtl
3033
3034 ; char out su porta seriale
3035 F8023F _SerOut:
3036 .EXTERN _spput0
3037 .EXTERN lspput2
3038 F8023F
3039 F8023F A6 50 ldx DflTxtOut
3040 F80241 CA dex
3041 ?02: ;jsr _spput0
3042
3043 F80242 22 66 0D F8 jsl lspput2
3044 F80246 90 03 bcc ?10
3045 F80248 C8 iny
3046 F80249 D0 F7 bne ?02
3047 F8024B 6B ?10: rtl
3048
3049 ; string out su porta seriale
3050 F8024C _SerStrOut:
3051 F8024C A6 50 ldx DflTxtOut
3052 F8024E CA dex
3053 F8024F A7 51 ?02: lda [COPPtr]
3054 F80251 F0 15 beq ?20
3055 F80253 20 08 05 ?05: jsr _spput0
3056 F80256 90 04 bcc ?10
3057 F80258 C8 iny
3058 F80259 D0 F8 bne ?05
3059 F8025B 6B rtl
3060 F8025C C6 BC ?10: dec coptmp
3061 F8025E F0 08 beq ?20
3062 F80260 E6 51 inc COPPtr
Tue Jul 17 11:00:17 2018 Page 9
3063 F80262 D0 EB bne ?02
3064 F80264 E6 52 inc COPPtr+1
3065 F80266 80 E7 bra ?02
3066 F80268 6B ?20: rtl
3067
3068 ; char in da porta LPT - errore permanente
3069 F80269 _PrnIn:
3070 F80269 CPU08
3071 F80269 E2 30 sep #(PMFLAG.OR.PXFLAG)
3072 .LONGA off
3073 .LONGI off
3074 .MNLIST
3075 F8026B 38 sec
3076 F8026C 6B rtl
3077
3078 ; char out su porta LPT
3079 F8026D _PrnOut:
3080 F8026D CPU08
3081 F8026D E2 30 sep #(PMFLAG.OR.PXFLAG)
3082 .LONGA off
3083 .LONGI off
3084 .MNLIST
3085 F8026F 38 sec
3086 F80270 6B rtl
3087
3088 ; string out su porta LPT
3089 F80271 _PrnStrOut:
3090 F80271 CPU08
3091 F80271 E2 30 sep #(PMFLAG.OR.PXFLAG)
3092 .LONGA off
3093 .LONGI off
3094 .MNLIST
3095 F80273 38 sec
3096 F80274 6B rtl
3097
3098 ; char out su tastiera - errore permanente
3099 F80275 _KeybOut:
3100 F80275 CPU08
3101 F80275 E2 30 sep #(PMFLAG.OR.PXFLAG)
3102 .LONGA off
3103 .LONGI off
3104 .MNLIST
3105 F80277 38 sec
3106 F80278 6B rtl
3107 F80279
3108 F80279 COP_ScnPrint:
3109 .GLOBAL COP_ScnPrint
3110 F80279 LONG_OFF
3111 .LONGA off
3112 .LONGI off
3113 .MNLIST
3114 F80279
3115 F80279 A0 00 ldy #0 ; indice stringa
3116 F8027B CPU16
3117 F8027B C2 30 rep #(PMFLAG.OR.PXFLAG)
3118 .LONGA on
3119 .LONGI on
Tue Jul 17 11:00:17 2018 Page 10
3120 .MNLIST
3121 F8027D A9 00 01 lda #DP01ADDR ; imposta nuova DP
3122 F80280 5B tcd
3123 F80281 A3 10 lda STKPCL,s ; ricava ptr stringa
3124 F80283 85 A2 sta ScnPrm
3125 F80285 ACC08 ; A,M -> 8 bit
3126 F80285 E2 20 sep #PMFLAG
3127 .LONGA off
3128 .MNLIST
3129 F80287 A3 12 lda STKPBR,s ; banco stringa
3130 F80289 85 A4 sta ScnPrm+2
3131 F8028B 64 B2 stz ScnFlag
3132 F8028D A9 40 lda #$40
3133 F8028F 14 74 trb ScnAutoIns ; modo output
3134 F80291 B7 A2 ?01: lda [ScnPrm],y ; loop
3135 F80293 F0 0C beq ?02 ; fine stringa
3136 F80295 5A phy
3137 F80296 INDEX08
3138 F80296 E2 10 sep #PXFLAG
3139 .LONGI off
3140 .MNLIST
3141 F80298 20 C1 AD jsr _ScnCharOut
3142 F8029B INDEX16
3143 F8029B C2 10 rep #PXFLAG
3144 .LONGI on
3145 .MNLIST
3146 F8029D 7A ply
3147 F8029E C8 iny
3148 F8029F D0 F0 bne ?01
3149 F802A1 ?02: CPU16
3150 F802A1 C2 30 rep #(PMFLAG.OR.PXFLAG)
3151 .LONGA on
3152 .LONGI on
3153 .MNLIST
3154 F802A3 C8 iny
3155 F802A4 98 tya ; ptr terminatore stringa
3156 F802A5 18 clc
3157 F802A6 65 A2 adc ScnPrm
3158 F802A8 83 10 sta STKPCL,s ; update indirizzo di ritorno
3159 F802AA RTL1:
3160 F802AA CPU08
3161 F802AA E2 30 sep #(PMFLAG.OR.PXFLAG)
3162 .LONGA off
3163 .LONGI off
3164 .MNLIST
3165 F802AC 18 clc
3166 F802AD 6B rtl
3167
3168 F802AE COP_TxtPrint:
3169 .GLOBAL COP_TxtPrint
3170 F802AE LONG_OFF
3171 .LONGA off
3172 .LONGI off
3173 .MNLIST
3174 F802AE
3175 F802AE A5 50 lda DflTxtOut
3176 F802B0 C9 03 cmp #TXTD_SCN
Tue Jul 17 11:00:17 2018 Page 11
3177 F802B2 F0 C5 beq COP_ScnPrint
3178 F802B4 0A asl a
3179 F802B5 AA tax
3180 F802B6 A0 00 ldy #0 ; indice stringa
3181 F802B8 ACC16
3182 F802B8 C2 20 rep #PMFLAG
3183 .LONGA on
3184 .MNLIST
3185 F802BA A3 10 lda STKPCL,s ; ricava ptr stringa
3186 F802BC 85 51 sta COPPtr
3187 F802BE ACC08 ; A,M -> 8 bit
3188 F802BE E2 20 sep #PMFLAG
3189 .LONGA off
3190 .MNLIST
3191 F802C0 A3 12 lda STKPBR,s ; banco stringa
3192 F802C2 85 53 sta COPPtr+2
3193 F802C4 B7 51 ?01: lda [COPPtr],y ; loop
3194 F802C6 F0 03 beq ?02 ; fine stringa
3195 F802C8 C8 iny
3196 F802C9 D0 F9 bne ?01
3197 F802CB ?02: CPU16
3198 F802CB C2 30 rep #(PMFLAG.OR.PXFLAG)
3199 .LONGA on
3200 .LONGI on
3201 .MNLIST
3202 F802CD C8 iny ; skip final NUL
3203 F802CE 98 tya ; ptr terminatore stringa
3204 F802CF 18 clc
3205 F802D0 65 51 adc COPPtr
3206 F802D2 83 10 sta STKPCL,s ; update indirizzo di ritorno
3207 F802D4 CPU08
3208 F802D4 E2 30 sep #(PMFLAG.OR.PXFLAG)
3209 .LONGA off
3210 .LONGI off
3211 .MNLIST
3212 F802D6 88 dey ; string length
3213 F802D7 F0 D1 beq RTL1 ; exit if empty
3214 F802D9 84 BC sty coptmp
3215 F802DB 7C 18 02 jmp (TXTSTBL,x)
3216 F802DE
3217 F802DE
3218 ; output stringa a video
3219 ;In - A offset stringa (16 bit)
3220 ; X banco stringa (8 bit)
3221 ; registri tutti preservati
3222 F802DE COP_ScnStrOut:
3223 .GLOBAL COP_ScnStrOut
3224 F802DE LONG_OFF
3225 .LONGA off
3226 .LONGI off
3227 .MNLIST
3228
3229 F802DE A0 00 ldy #0
3230 F802E0 CPU16
3231 F802E0 C2 30 rep #(PMFLAG.OR.PXFLAG)
3232 .LONGA on
3233 .LONGI on
Tue Jul 17 11:00:17 2018 Page 12
3234 .MNLIST
3235 F802E2 A9 00 01 lda #DP01ADDR ; imposta nuova DP
3236 F802E5 5B tcd
3237 F802E6 A3 0D lda STKCR,s ; ricava ptr stringa
3238 F802E8 85 A2 sta ScnPrm
3239 F802EA ACC08 ; A,M -> 8 bit
3240 F802EA E2 20 sep #PMFLAG
3241 .LONGA off
3242 .MNLIST
3243 F802EC A3 0B lda STKXR,s ; banco stringa
3244 F802EE 85 A4 sta ScnPrm+2
3245 F802F0 64 B2 stz ScnFlag
3246 F802F2 A9 40 lda #$40
3247 F802F4 14 74 trb ScnAutoIns ; modo output
3248 F802F6 B7 A2 ?01: lda [ScnPrm],y ; loop
3249 F802F8 F0 0C beq ?02 ; fine stringa
3250 F802FA 5A phy
3251 F802FB INDEX08
3252 F802FB E2 10 sep #PXFLAG
3253 .LONGI off
3254 .MNLIST
3255 F802FD 20 C1 AD jsr _ScnCharOut
3256 F80300 INDEX16
3257 F80300 C2 10 rep #PXFLAG
3258 .LONGI on
3259 .MNLIST
3260 F80302 7A ply
3261 F80303 C8 iny
3262 F80304 D0 F0 bne ?01
3263 F80306 ?02: CPU08
3264 F80306 E2 30 sep #(PMFLAG.OR.PXFLAG)
3265 .LONGA off
3266 .LONGI off
3267 .MNLIST
3268 F80308 18 clc
3269 F80309 6B rtl
3270
3271 F8030A COP_TxtStrOut:
3272 .GLOBAL COP_TxtStrOut
3273 F8030A LONG_OFF
3274 .LONGA off
3275 .LONGI off
3276 .MNLIST
3277 F8030A
3278 F8030A A5 50 lda DflTxtOut
3279 F8030C C9 03 cmp #TXTD_SCN
3280 F8030E F0 CE beq COP_ScnStrOut
3281 F80310 0A asl a
3282 F80311 AA tax
3283 F80312 A0 00 ldy #0 ; indice stringa
3284 F80314 ACC16
3285 F80314 C2 20 rep #PMFLAG
3286 .LONGA on
3287 .MNLIST
3288 F80316 A3 10 lda STKPCL,s ; ricava ptr stringa
3289 F80318 85 51 sta COPPtr
3290 F8031A ACC08 ; A,M -> 8 bit
Tue Jul 17 11:00:17 2018 Page 13
3291 F8031A E2 20 sep #PMFLAG
3292 .LONGA off
3293 .MNLIST
3294 F8031C A3 12 lda STKPBR,s ; banco stringa
3295 F8031E 85 53 sta COPPtr+2
3296 F80320 B7 51 ?01: lda [COPPtr],y ; loop
3297 F80322 F0 03 beq ?02 ; fine stringa
3298 F80324 C8 iny
3299 F80325 D0 F9 bne ?01
3300 F80327 C8 ?02: iny ; skip final NUL
3301 F80328 88 dey ; string length
3302 F80329 F0 14 beq RTL2 ; exit if empty
3303 F8032B 84 BC sty coptmp
3304 F8032D 7C 18 02 jmp (TXTSTBL,x)
3305 F80330
3306 ; Output carattere a schermo
3307 F80330 COP_ScnCharOut:
3308 .GLOBAL COP_ScnCharOut
3309 F80330 LONG_OFF
3310 .LONGA off
3311 .LONGI off
3312 .MNLIST
3313
3314 F80330 F4 00 01 pea #DP01ADDR ; imposta nuova DP
3315 F80333 2B pld
3316 F80334 A9 40 lda #$40
3317 F80336 14 74 trb ScnAutoIns ; modo output
3318 F80338 A3 0D lda STKCR,s
3319 F8033A COP?01:
3320 F8033A 64 B2 stz ScnFlag
3321 F8033C 20 C1 AD jsr _ScnCharOut
3322 F8033F RTL2:
3323 F8033F 18 clc ; no error
3324 F80340 6B rtl
3325
3326 F80341 _ScnOut:
3327 F80341 F4 00 01 pea #DP01ADDR ; imposta nuova DP
3328 F80344 2B pld
3329 F80345 AA tax
3330 F80346 A9 40 lda #$40
3331 F80348 14 74 trb ScnAutoIns ; modo output
3332 F8034A 8A txa
3333 F8034B 80 ED bra COP?01
3334 F8034D
3335 F8034D COP_ScnPrChar:
3336 .GLOBAL COP_ScnPrChar
3337 F8034D LONG_OFF
3338 .LONGA off
3339 .LONGI off
3340 .MNLIST
3341 F8034D
3342 F8034D ACC16
3343 F8034D C2 20 rep #PMFLAG
3344 .LONGA on
3345 .MNLIST
3346 F8034F A9 00 01 lda #DP01ADDR ; imposta nuova DP
3347 F80352 5B tcd
Tue Jul 17 11:00:17 2018 Page 14
3348 F80353 A3 10 lda STKPCL,s ; ricava ptr stringa
3349 F80355 85 A2 sta ScnPrm
3350 F80357 1A inc a ; update return address
3351 F80358 83 10 sta STKPCL,s
3352 F8035A ACC08 ; A,M -> 8 bit
3353 F8035A E2 20 sep #PMFLAG
3354 .LONGA off
3355 .MNLIST
3356 F8035C A3 12 lda STKPBR,s ; banco stringa
3357 F8035E 85 A4 sta ScnPrm+2
3358 F80360 A9 40 lda #$40
3359 F80362 14 74 trb ScnAutoIns ; modo output
3360 F80364 A7 A2 lda [ScnPrm] ; char to print
3361 F80366 80 D2 bra COP?01
3362
3363 F80368 COP_TxtCharOut:
3364 .GLOBAL COP_TxtCharOut
3365 F80368 LONG_OFF
3366 .LONGA off
3367 .LONGI off
3368 .MNLIST
3369 F80368
3370 F80368 A5 50 lda DflTxtOut
3371 F8036A 0A asl a
3372 F8036B AA tax
3373 F8036C A3 0D lda STKCR,s
3374 F8036E 7C 00 02 jmp (TXTOTBL,x)
3375
3376 F80371 COP_DevCharOut:
3377 .GLOBAL COP_DevCharOut
3378 F80371 LONG_OFF
3379 .LONGA off
3380 .LONGI off
3381 .MNLIST
3382 F80371
3383 F80371 A3 0E lda STKCR+1,s ; # device
3384 F80373 A8 tay
3385 F80374 0A asl a
3386 F80375 AA tax
3387 F80376 A3 0D lda STKCR,s ; character
3388 F80378 7C 00 02 jmp (TXTOTBL,x)
3389
3390 F8037B COP_TxtPrChar:
3391 .GLOBAL COP_TxtPrChar
3392 F8037B LONG_OFF
3393 .LONGA off
3394 .LONGI off
3395 .MNLIST
3396 F8037B
3397 F8037B ACC16
3398 F8037B C2 20 rep #PMFLAG
3399 .LONGA on
3400 .MNLIST
3401 F8037D A3 10 lda STKPCL,s ; ricava ptr stringa
3402 F8037F 85 51 sta COPPtr
3403 F80381 1A inc a ; update return address
3404 F80382 83 10 sta STKPCL,s
Tue Jul 17 11:00:17 2018 Page 15
3405 F80384 ACC08 ; A,M -> 8 bit
3406 F80384 E2 20 sep #PMFLAG
3407 .LONGA off
3408 .MNLIST
3409 F80386 A3 12 lda STKPBR,s ; banco stringa
3410 F80388 85 53 sta COPPtr+2
3411 F8038A A5 50 lda DflTxtOut
3412 F8038C 0A asl a
3413 F8038D AA tax
3414 F8038E A7 51 lda [COPPtr] ; char to print
3415 F80390 7C 00 02 jmp (TXTOTBL,x)
3416
3417 F80393 COP_ScnPasStr:
3418 .GLOBAL COP_ScnPasStr
3419 F80393 LONG_OFF
3420 .LONGA off
3421 .LONGI off
3422 .MNLIST
3423
3424 F80393 CPU16
3425 F80393 C2 30 rep #(PMFLAG.OR.PXFLAG)
3426 .LONGA on
3427 .LONGI on
3428 .MNLIST
3429 F80395 A9 00 01 lda #DP01ADDR ; imposta nuova DP
3430 F80398 5B tcd
3431 F80399 A3 0D lda STKCR,s ; ricava ptr stringa
3432 F8039B 85 A2 sta ScnPrm
3433 F8039D CPU08 ; A,M -> 8 bit
3434 F8039D E2 30 sep #(PMFLAG.OR.PXFLAG)
3435 .LONGA off
3436 .LONGI off
3437 .MNLIST
3438 F8039F A3 0B lda STKXR,s ; banco stringa
3439 F803A1 85 A4 sta ScnPrm+2
3440 F803A3 A9 00 lda #0
3441 F803A5 85 B2 sta ScnFlag
3442 F803A7 EB xba ; B = 0
3443 F803A8 A9 40 lda #$40
3444 F803AA 14 74 trb ScnAutoIns ; modo output
3445 F803AC A7 A2 lda [ScnPrm] ; str len
3446 F803AE A0 01 ldy #1 ; first index
3447 F803B0 CPU16
3448 F803B0 C2 30 rep #(PMFLAG.OR.PXFLAG)
3449 .LONGA on
3450 .LONGI on
3451 .MNLIST
3452 F803B2
3453 F803B2 _ScnBufOut:
3454 F803B2 AA tax ; buf len
3455 F803B3 F0 13 beq ?02
3456 F803B5 ACC08
3457 F803B5 E2 20 sep #PMFLAG
3458 .LONGA off
3459 .MNLIST
3460 F803B7 B7 A2 ?01: lda [ScnPrm],y ; loop
3461 F803B9 DA phx
Tue Jul 17 11:00:17 2018 Page 16
3462 F803BA 5A phy
3463 F803BB INDEX08
3464 F803BB E2 10 sep #PXFLAG
3465 .LONGI off
3466 .MNLIST
3467 F803BD 20 C1 AD jsr _ScnCharOut
3468 F803C0 INDEX16
3469 F803C0 C2 10 rep #PXFLAG
3470 .LONGI on
3471 .MNLIST
3472 F803C2 7A ply
3473 F803C3 FA plx
3474 F803C4 C8 iny
3475 F803C5 CA dex
3476 F803C6 D0 EF bne ?01
3477 F803C8 ?02: CPU08
3478 F803C8 E2 30 sep #(PMFLAG.OR.PXFLAG)
3479 .LONGA off
3480 .LONGI off
3481 .MNLIST
3482 F803CA 18 clc
3483 F803CB 6B rtl
3484
3485 F803CC COP_TxtPasStr:
3486 .GLOBAL COP_TxtPasStr
3487 F803CC LONG_OFF
3488 .LONGA off
3489 .LONGI off
3490 .MNLIST
3491
3492 F803CC A5 50 lda DflTxtOut
3493 F803CE C9 03 cmp #TXTD_SCN
3494 F803D0 F0 C1 beq COP_ScnPasStr
3495 F803D2 38 sec
3496 F803D3 6B rtl
3497
3498 F803D4 COP_ScnBufOut:
3499 .GLOBAL COP_ScnBufOut
3500 F803D4 LONG_OFF
3501 .LONGA off
3502 .LONGI off
3503 .MNLIST
3504
3505 F803D4 A0 00 ldy #0 ; first index
3506 F803D6 CPU16
3507 F803D6 C2 30 rep #(PMFLAG.OR.PXFLAG)
3508 .LONGA on
3509 .LONGI on
3510 .MNLIST
3511 F803D8 A9 00 01 lda #DP01ADDR ; imposta nuova DP
3512 F803DB 5B tcd
3513 F803DC A3 0D lda STKCR,s ; ricava ptr stringa
3514 F803DE 85 A2 sta ScnPrm
3515 F803E0 CPU08 ; A,M -> 8 bit
3516 F803E0 E2 30 sep #(PMFLAG.OR.PXFLAG)
3517 .LONGA off
3518 .LONGI off
Tue Jul 17 11:00:17 2018 Page 17
3519 .MNLIST
3520 F803E2 A3 0B lda STKXR,s ; banco stringa
3521 F803E4 85 A4 sta ScnPrm+2
3522 F803E6 64 B2 stz ScnFlag
3523 F803E8 A9 40 lda #$40
3524 F803EA 14 74 trb ScnAutoIns ; modo output
3525 F803EC CPU16
3526 F803EC C2 30 rep #(PMFLAG.OR.PXFLAG)
3527 .LONGA on
3528 .LONGI on
3529 .MNLIST
3530 F803EE A3 09 lda STKYR,s ; buf len
3531 F803F0 80 C0 bra _ScnBufOut
3532 F803F2 LONG_OFF
3533 .LONGA off
3534 .LONGI off
3535 .MNLIST
3536 F803F2
3537 F803F2 COP_TxtBufOut:
3538 .GLOBAL COP_TxtBufOut
3539 F803F2 LONG_OFF
3540 .LONGA off
3541 .LONGI off
3542 .MNLIST
3543
3544 F803F2 A5 50 lda DflTxtOut
3545 F803F4 C9 03 cmp #TXTD_SCN
3546 F803F6 F0 DC beq COP_ScnBufOut
3547 F803F8 38 sec
3548 F803F9 6B rtl
3549 F803FA
3550 F803FA COP_KbCharIn:
3551 .GLOBAL COP_KbCharIn
3552
3553 ; char in da tastiera
3554 F803FA _KeybIn:
3555 .LONGA off
3556 .LONGI off
3557
3558 F803FA F4 00 01 pea #DP01ADDR ; imposta nuova DP
3559 F803FD 2B pld
3560 F803FE A5 95 lda ScnCol ; input tastiera - full editor
3561 F80400 85 98 sta ScnColStart
3562 F80402 A5 94 lda ScnRow
3563 F80404 85 96 sta ScnRowStart
3564 F80406 20 D5 A4 jsr _ScnCharIn
3565 F80409 83 0D sta STKCR,s
3566 F8040B 18 clc
3567 F8040C 6B rtl
3568
3569 F8040D COP_TxtCharIn:
3570 .GLOBAL COP_TxtCharIn
3571 .LONGA off
3572 .LONGI off
3573
3574 F8040D A5 4F lda DflTxtIn
3575 F8040F 0A asl a
Tue Jul 17 11:00:17 2018 Page 18
3576 F80410 AA tax
3577 F80411 7C 0C 02 jmp (TXTITBL,x)
3578
3579 F80414 COP_DevCharIn:
3580 .GLOBAL COP_DevCharIn
3581 .LONGA off
3582 .LONGI off
3583
3584 F80414 A3 0D lda STKCR,s ; device
3585 F80416 A8 tay
3586 F80417 0A asl a
3587 F80418 AA tax
3588 F80419 7C 0C 02 jmp (TXTITBL,x)
3589
3590 F8041C COP_ScnXchg:
3591 .GLOBAL COP_ScnXchg
3592 F8041C LONG_OFF
3593 .LONGA off
3594 .LONGI off
3595 .MNLIST
3596 F8041C
3597 F8041C F4 00 01 pea #DP01ADDR ; imposta nuova DP
3598 F8041F 2B pld
3599 F80420 A3 0D lda STKCR,s ; A = 0..1
3600 F80422 D0 08 bne ?04 ; switch to VGA
3601 F80424 A5 6D lda VBBRam
3602 F80426 10 13 bpl ?10 ; already PAL -- exit
3603 F80428 64 6D stz VBBRam
3604 F8042A 80 0C bra ?08
3605 F8042C 24 6D ?04: bit VBBRam
3606 F8042E 30 0B bmi ?10 ; already VGA -- exit
3607 F80430 24 6C bit VBBFlag ; VGA installed?
3608 F80432 10 07 bpl ?10 ; no
3609 F80434 A9 80 lda #$80
3610 F80436 85 6D sta VBBRam
3611 F80438 20 08 A3 ?08: jsr cinit
3612 F8043B 18 ?10: clc
3613 F8043C 6B rtl
3614 F8043D
3615 F8043D sys_tasksw:
3616 F8043D
3617 .PUBLIC sys_tasksw
3618
3619 F8043D ACC16 ; retrieve subfunction number
3620 F8043D C2 20 rep #PMFLAG
3621 .LONGA on
3622 .MNLIST
3623 F8043F A3 10 lda STKPCL,s ; pointer to byte after signature
3624 F80441 85 51 sta COPPtr
3625 F80443 1A inc a ; update return address
3626 F80444 83 10 sta STKPCL,s
3627 F80446 ACC08 ; A,M -> 8 bit
3628 F80446 E2 20 sep #PMFLAG
3629 .LONGA off
3630 .MNLIST
3631 F80448 A3 12 lda STKPBR,s ; bank where was executed cop instruction
3632 F8044A 85 53 sta COPPtr+2
Tue Jul 17 11:00:17 2018 Page 19
3633 F8044C A7 51 lda [COPPtr] ; byte after signature
3634 F8044E F0 04 beq ?80
3635 ;bcc ?02 ; ok
3636 F80450 38 sec
3637 F80451 A9 01 lda #EINV ; error
3638 F80453 6B rtl
3639
3640 F80454 20 8B 1E ?80: jsr LF8Tst
3641 F80457 18 clc
3642 F80458 6B rtl
3643
3644
3645 F80459 sys_mkfs:
3646 .PUBLIC sys_mkfs
3647
3648 F80459 18 clc
3649 F8045A 6B rtl
Lines Assembled : 3464 Errors : 0