-
Notifications
You must be signed in to change notification settings - Fork 1
/
loader_plus4_tcbm.inc
70 lines (65 loc) · 1.03 KB
/
loader_plus4_tcbm.inc
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
.print ". plus/4 TCBM loader"
.namespace iolib {
.namespace plus4tcbm {
.pseudopc io_base {
.label tia = tcbm_9
.label padta = tia
.label pbdta = tia+1
.label pcdta = tia+2
.label padir = tia+3
.label pbdir = tia+4
.label pcdir = tia+5
jmp startload
jmp readbyte
jmp writebyte
jmp hardsync
jmp sync
ldx io_tcbmoffs
lda pcdta,x
and #%10111111
sta pcdta,x
!: lda pcdta,x
bmi !-
hardsync:
sync: rts
readbyte:
ldx io_tcbmoffs
!: lda pcdta,x //ACK=1?
bmi !- //yes
lda pcdta,x
ora #%01000000
sta pcdta,x //DAV=1
!: lda pcdta,x //ACK=1?
bpl !- //no
lda padta,x //get byte
pha
lda pcdta,x
and #%10111111
sta pcdta,x //DAV=0
pla
rts
writebyte:
ldx io_tcbmoffs
pha
lda #$ff
sta padir,x //dir=out
!: lda pcdta,x //ACK=1?
bmi !- //yes
pla
sta padta,x //put byte
lda pcdta,x
ora #%01000000
sta pcdta,x //DAV=1
!: lda pcdta,x //ACK=1?
bpl !- //no
lda pcdta,x
and #%10111111
sta pcdta,x //DAV=0
inc padir,x //dir=in
rts
#import "loader_plus4_core.inc"
startload:
plus4load(readbyte, writebyte, sync, hardsync)
}
}
}