-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy paththuffir.s
More file actions
36 lines (31 loc) · 780 Bytes
/
Copy paththuffir.s
File metadata and controls
36 lines (31 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
.segment "BIOS"
; Read one character from terminal
MONRDKEY:
lda TERMIO ; Poll character
cmp #$FF ; If anything received
bne MONCOUT ; Echo it back
rts
; Output one character to terminal
MONCOUT:
sta TERMIO ; Output character to terminal
rts
; Dummy interrupt handler
EMPTYINT:
rti
; Entry point
START:
sei ; Disable interrupts
cld ; Clear decimal mode
ldx #$FF ; Initialize stack pointer
txs
@loop: inx ; Show header message
lda HEADER,x ; Get next character
beq @done ; Until zero termination
jsr MONCOUT ; Output character
bne @loop ; Do nex character
@done: jmp COLD_START ; Jump to basic start
; Interrupt and reset vectors
.segment "INTVEC"
.word EMPTYINT ; NMI vector
.word START ; Reset vector
.word EMPTYINT ; INT vector