OpenCores
URL https://opencores.org/ocsvn/socgen/socgen/trunk

Subversion Repositories socgen

[/] [socgen/] [trunk/] [Projects/] [opencores.org/] [Mos6502/] [sw/] [boot_basic/] [boot_basic.asm] - Blame information for rev 131

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 131 jt_eaton
 
2
; minimal monitor for EhBASIC and 6502 simulator V1.05
3
 
4
; To run EhBASIC on the simulator load and assemble [F7] this file, start the simulator
5
; running [F6] then start the code with the RESET [CTRL][SHIFT]R. Just selecting RUN
6
; will do nothing, you'll still have to do a reset to run the code.
7
 
8
        .include "basic.asm"
9
 
10
; put the IRQ and MNI code in RAM so that it can be changed
11
 
12
IRQ_vec = VEC_SV+2              ; IRQ code vector
13
NMI_vec = IRQ_vec+$0A   ; NMI code vector
14
 
15
; setup for the 6502 simulator environment
16
 
17
IO_AREA = $F000         ; set I/O area for this monitor
18
 
19
ACIAsimwr       = IO_AREA+$01   ; simulated ACIA write port
20
ACIAsimrd       = IO_AREA+$04   ; simulated ACIA read port
21
 
22
; now the code. all this does is set up the vectors and interrupt code
23
; and wait for the user to select [C]old or [W]arm start. nothing else
24
; fits in less than 128 bytes
25
 
26
        *=      $FF80                   ; pretend this is in a 1/8K ROM
27
 
28
; reset vector points here
29
 
30
RES_vec
31
        CLD                             ; clear decimal mode
32
        LDX     #$FF                    ; empty stack
33
        TXS                             ; set the stack
34
 
35
; set up vectors and interrupt code, copy them to page 2
36
 
37
        LDY     #END_CODE-LAB_vec       ; set index/count
38
LAB_stlp
39
        LDA     LAB_vec-1,Y             ; get byte from interrupt code
40
        STA     VEC_IN-1,Y              ; save to RAM
41
        DEY                             ; decrement index/count
42
        BNE     LAB_stlp                ; loop if more to do
43
 
44
; now do the signon message, Y = $00 here
45
 
46
LAB_signon
47
        LDA     LAB_mess,Y              ; get byte from sign on message
48
        BEQ     LAB_nokey               ; exit loop if done
49
 
50
        JSR     V_OUTP          ; output character
51
        INY                             ; increment index
52
        BNE     LAB_signon              ; loop, branch always
53
 
54
LAB_nokey
55
        JSR     V_INPT          ; call scan input device
56
        BCC     LAB_nokey               ; loop if no key
57
 
58
        AND     #$DF                    ; mask xx0x xxxx, ensure upper case
59
        CMP     #'W'                    ; compare with [W]arm start
60
        BEQ     LAB_dowarm              ; branch if [W]arm start
61
 
62
        CMP     #'C'                    ; compare with [C]old start
63
        BNE     RES_vec         ; loop if not [C]old start
64
 
65
        JMP     LAB_COLD                ; do EhBASIC cold start
66
 
67
LAB_dowarm
68
        JMP     LAB_WARM                ; do EhBASIC warm start
69
 
70
; byte out to simulated ACIA
71
 
72
ACIAout
73
        STA     ACIAsimwr               ; save byte to simulated ACIA
74
        RTS
75
 
76
; byte in from simulated ACIA
77
 
78
ACIAin
79
        LDA     ACIAsimrd               ; get byte from simulated ACIA
80
        BEQ     LAB_nobyw               ; branch if no byte waiting
81
 
82
        SEC                             ; flag byte received
83
        RTS
84
 
85
LAB_nobyw
86
        CLC                             ; flag no byte received
87
no_load                         ; empty load vector for EhBASIC
88
no_save                         ; empty save vector for EhBASIC
89
        RTS
90
 
91
; vector tables
92
 
93
LAB_vec
94
        .word   ACIAin          ; byte in from simulated ACIA
95
        .word   ACIAout         ; byte out to simulated ACIA
96
        .word   no_load         ; null load vector for EhBASIC
97
        .word   no_save         ; null save vector for EhBASIC
98
 
99
; EhBASIC IRQ support
100
 
101
IRQ_CODE
102
        PHA                             ; save A
103
        LDA     IrqBase         ; get the IRQ flag byte
104
        LSR                             ; shift the set b7 to b6, and on down ...
105
        ORA     IrqBase         ; OR the original back in
106
        STA     IrqBase         ; save the new IRQ flag byte
107
        PLA                             ; restore A
108
        RTI
109
 
110
; EhBASIC NMI support
111
 
112
NMI_CODE
113
        PHA                             ; save A
114
        LDA     NmiBase         ; get the NMI flag byte
115
        LSR                             ; shift the set b7 to b6, and on down ...
116
        ORA     NmiBase         ; OR the original back in
117
        STA     NmiBase         ; save the new NMI flag byte
118
        PLA                             ; restore A
119
        RTI
120
 
121
END_CODE
122
 
123
LAB_mess
124
        .byte   $0D,$0A,"6502 EhBASIC [C]old/[W]arm ?",$00
125
                                        ; sign on string
126
 
127
; system vectors
128
 
129
        *=      $FFFA
130
 
131
        .word   NMI_vec         ; NMI vector
132
        .word   RES_vec         ; RESET vector
133
        .word   IRQ_vec         ; IRQ vector
134
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.