home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Go64!
/
Go64_1999-04_1999_CSW_Side_A.d64
/
src_ccass.pet
< prev
next >
Wrap
Text File
|
2023-02-26
|
12KB
|
612 lines
;Prog: CarreraCount
;Version: work 0.1 (28.6.98)
;Autor: Peter Steinmeyer
;
; Rundenzehlprogramm fNr Carrera Universal (4 Fahrer)
;
.BA $C000
PB2 .DE 56577
DRRB2 .DE 56579
CHRGET .DE $73
CHRGOT .DE $79
GETBYTE .DE $B79E
GETKOMMA .DE $AEFD
KOMMABYTE .DE $B7F1
ASCOUT .DE $e716
TIMER1A .DE 56324
SCREEN .DE 1024
count .de 828 ;828-830
bahnalt .de 831 ;831-842 jeweils 3 Byte
bahnneu .de 843 ;843-854 pro Bahn (4 Bahnen)
flag .de 855 ;855-858 Flag fNr Runde gefahren
limit .de 859 ;859-861 minimal m%gliche Rundenzeit
temp .de 862
event .de 863 ;Flag fNr Runde gefahren
rstactiv .de 864
count100l .de 865 ;dezimalzehler Gesamtzeit!
count100h .de 866
count60l .de 867
count60h .de 868
count1l .de 869
count1h .de 870
count1g .de 871
ib1 .de 874 ;Backup variablen fNr IRQ
ib2 .de 875
ib3 .de 876
ib4 .de 877
stopflag .de 879 ;unterbricht Zeit und Rundenzehlung
timex .de 880 ;X-Position Gesammtzeit
timey .de 881 ;Y-Position
lo1 .de 251
hi1 .de 252
lo2 .de 253
hi2 .de 254
;Basiceinspring +Offset auf Adresse 49152
jmp initia ;+0 Timer/IRQ aktivieren
jmp an ;+3 Relais an = Bahnstrom aus
jmp aus ;+6 Relais aus = Bahnstrom an
jmp resetan ;+9 Relais zurNcksetzen
jmp resetaus ;+12 Relais normal
jmp show ;+15 liest Portzustand aus
jmp initoff ;+18 Timer/IRQ auf normal
jmp out ;+21 Gibt Rundenzahl (0-99) aus
jmp resetbahn ;+24 Setzt Runden zeiten auf NULL
jmp color ;+27 Hintergrundfarbe auf schwarz
jmp cursor ;+30 setzt Cursor nach x,y
jmp scroll ;+33 scrollt Bildschirmbereich
jmp outbasic ;+36 Gibt Rundenzahl aus (0-99)
jmp resettime ;+39 l%scht Gesammtzeit
;-- daten
mult40
mult
.by 1024 1064 1104 1144 1184 1224 1264 1304
.by 1344 1384 1424 1464 1504 1544 1584 1624 1664
.by 1704 1744 1784 1824 1864 1904 1944 1984 2024
;
pot2 .by 1 2 4 8 16 32 64 128
;
mult3 .by 0 3 6 9 12
;
;
ziff
.by 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9
.by 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9
.by 2 0 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9
.by 3 0 3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3 9
.by 4 0 4 1 4 2 4 3 4 4 4 5 4 6 4 7 4 8 4 9
.by 5 0 5 1 5 2 5 3 5 4 5 5 5 6 5 7 5 8 5 9
.by 6 0 6 1 6 2 6 3 6 4 6 5 6 6 6 7 6 8 6 9
.by 7 0 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7 8 7 9
.by 8 0 8 1 8 2 8 3 8 4 8 5 8 6 8 7 8 8 8 9
.by 9 0 9 1 9 2 9 3 9 4 9 5 9 6 9 7 9 8 9 9
;
;
null .by 233 160 223 160 32 160 160 32 160 160 32 160 95 160 105
eins .by 32 32 233 32 32 160 32 32 160 32 32 160 32 32 105
zwei .by 233 160 223 32 32 160 160 160 160 160 32 32 160 160 160
drei .by 233 160 223 32 32 160 32 160 160 32 32 160 95 160 105
vier .by 233 32 233 160 32 160 160 160 160 32 32 160 32 32 160
fuenf .by 160 160 160 160 32 32 160 160 223 32 32 160 95 160 105
sechs .by 233 160 223 160 32 32 160 160 223 160 32 160 95 160 105
sieben .by 95 160 160 32 32 160 32 32 160 32 32 160 32 32 105
acht .by 233 160 223 160 32 160 160 160 160 160 32 160 95 160 105
neun .by 233 160 223 160 32 160 95 160 160 32 32 160 95 160 160
zahl .se null
.se eins
.se zwei
.se drei
.se vier
.se fuenf
.se sechs
.se sieben
.se acht
.se neun
timepos .by 1868 1877 1886 1895
;--- initia irq init
initia
lda #0
sta 53280
sta 53281
lda #15
sta 646
lda #128+64
sta drrb2
lda #%11000000
sta PB2
lda #38 ;38
sta TIMER1A+1
lda #125
sta TIMER1A
sei
lda #<irq
sta 788
lda #>irq
sta 789
lda #0
sta limit
sta limit+2
lda #2
sta limit+1
lda #0
sta flag
sta flag+1
sta flag+2
sta flag+3
jsr resettime
jsr resetbahn
cli
rts
;--- AN
an lda pb2
and #255-128
sta pb2
lda #12
sta 53280
rts
;
;--- aus
aus lda pb2
ora #128+64
sta pb2
lda #0
sta 53280
rts
;
;--- resetan
; l%scht die RelayFlipflops auf der Hardware
resetan lda pb2
and #255-64
sta pb2
lda #10
sta 53281
rts
resetaus lda pb2
ora #64
sta pb2
lda #0
sta 53281
rts
;
;--- show
;
show ldx #0
shloop lda pot2,x
and pb2
bne shno
jsr test
shno inx
cpx #4 ;4 Bahnen abfragen
bne shloop
lda event ;Wagen durchgefahren?
cmp #1
bne endshow
jsr resetan
ldx #255
w1 dex
bne w1
lda #0
sta event
jsr resetaus
endshow rts
;
;--- irq
; Interupt der 1/100s Takt zehlt
; und die Runden Relays auf der Hardware abfragt
irq
lda lo1
sta ib1
lda hi1
sta ib2
lda lo2
sta ib3
lda hi2
sta ib4
lda stopflag
beq i3 ;Rennen nicht aktiv
lda 653 ;Flag fNr Control Tasten
and #1
bne i2
inc count
bne i1
inc count+1
bne i1
inc count+2
i1
ldx #0
inc count100l ;1/100 hochzehlen
lda #10
cmp count100l
bne i2
stx count100l
inc count100h ;1/10 hochzehlen
lda #10
cmp count100h
bne i2
stx count100h
inc count60l ;sekunden hochzehlen
lda #10
cmp count60l
bne i2
stx count60l
inc count60h ;dezi sekunden hochzehlen
lda #6
cmp count60h
bne i2
stx count60h
inc count1l ;min hochzehlen
lda #10
cmp count1l
bne i2
stx count1l
inc count1h ;min hochzehlen
lda #10
cmp count1h
bne i2
stx count60h
inc count1g ;min hochzehlen
i2
ldx timex
ldy timey
jsr xytoprint
jsr printtime
jsr show
i3
lda ib1
sta lo1
lda ib2
sta hi1
lda ib3
sta lo2
lda ib4
sta hi2
jsr $ffea ;Zeit erh%hen
lda #0
sta $91 ;stop Tasten Flag l%schen
jmp $ea34
irloop
;
;
initoff lda #0
sta DRRB2
lda #62
sta TIMER1A+1
lda #$31
sta 788
lda #$ea
sta 789
rts
;
;--- OUT gibt Rundenzahl 2stellig aus
; 1000 = Rundenzahl
; 1001 = x-pos
; 1002 = y-pos
out lda 1002
asl
tay
lda mult,y
sta plot1+1
lda mult+1,y
sta plot1+2
lda 1001
clc
adc plot1+1
sta plot1+1
lda #0
adc plot1+2
sta plot1+2
lda 1000
asl
tay
lda ziff,y
asl
tay
lda zahl,y
sta lo2
lda zahl+1,y
sta hi2
ldy #0
ou1 ldx #0
ou2 lda (lo2),y
plot1 sta 1024,x
inx
iny
cpx #3
bne ou2
lda plot1+1
clc
adc #40
sta plot1+1
lda plot1+2
adc #0
sta plot1+2
cpy #15
bne ou1
lda plot1+1
sec
sbc #196
sta plot2+1
lda plot1+2
sbc #0
sta plot2+2
lda 1000
asl
tay
lda ziff+1,y
asl
tay
lda zahl,y
sta lo2
lda zahl+1,y
sta hi2
ldy #0
ou3 ldx #0
ou4 lda (lo2),y
plot2 sta 1024,x
inx
iny
cpx #3
bne ou4
lda plot2+1
clc
adc #40
sta plot2+1
lda plot2+2
adc #0
sta plot2+2
cpy #15
bne ou3
rts
;
;--- resetbahn
;
; Rundenzeiten auf momentane Zeit setzen
; Das hei{CBM-I}t Rundenzeit auf Startzeit!
resetbahn ldx #0
nop
res1 lda 828,x
sta 831,x
sta 834,x
sta 837,x
sta 840,x
inx
cpx #3
bne res1
rts
;
;--- test
test stx temp
lda flag,x
bne testend
lda mult3,x
tax
lda count
sec
sbc bahnalt,x
sta bahnneu,x
lda count+1
sbc bahnalt+1,x
sta bahnneu+1,x
lda count+2
sbc bahnalt+2,x
sta bahnneu+2,x
cmp limit+2
bcc testend
bne testok
lda bahnneu+1,x
cmp limit+1
bcc testend
bne testok
lda bahnneu,x
cmp limit
bcc testend
testok lda count
sta bahnalt,x
lda count+1
sta bahnalt+1,x
lda count+2
sta bahnalt+2,x
ldx temp
lda #1
sta flag,x
testend ldx temp
lda #1
sta event
rts
color lda #0
sta 53280
sta 53281
lda #1
sta 646
rts
;basiceinsprung: sys cursor,x,y
cursor jsr $b7f1
stx 211
jsr $b7f1
stx 214
jsr $e510
rts
outbasic
;basiceinsprung: sys outbasic,rundenzahl,x,y
jsr $b7f1
stx 1000
jsr $b7f1
stx 1001
jsr $b7f1
stx 1002
jmp out
rts
;--- scroll
;
;basiceinsprung: sys scroll,bahnnummer
scroll jsr $b7f1
;ass einsprung: x=bahnnummer
; cpx #4
; bcs endscroll
scrollass txa
asl
tax
lda timepos,x
sta lo2
lda timepos+1,x
sta hi2
ldx #7
scroll1 clc
lda lo2
adc #40
sta lo1
lda hi2
adc #0
sta hi1
ldy #0
scroll2 lda (lo2),y
sta (lo1),y
iny
cpy #8
bne scroll2
sec
lda lo2
sbc #40
sta lo2
lda hi2
sbc #0
sta hi2
dex
bne scroll1
endscroll rts
;------------------------------------------------------------------------
div100
;teilt durch 100
;a=hi ergebnis -> a
;y=mi ergebnis -> y
;x=lo ergebnis -> x
stx $22
sty $23
sta $24
rts
;------------------------------------------------------------------------
printtime
;gibt zeit an koordinate aus
ldy #0
lda count1g
clc
adc #48
sta (lo2),y
iny
lda count1h
adc #48
sta (lo2),y
iny
lda count1l
adc #48
sta (lo2),y
iny
lda #58
sta (lo2),y
iny
lda count60h
adc #48
sta (lo2),y
iny
lda count60l
adc #48
sta (lo2),y
iny
lda #39
sta (lo2),y
iny
lda count100h
adc #48
sta (lo2),y
iny
lda count100l
adc #48
sta (lo2),y
iny
rts
;------------------------------------------------------------------------
xytoprint
;rechnet x-y koordinate in bildschirmadresse um
;x:= x-pos
;y:= y-pos
;adresse -> lo2,hi2
tya
asl
tay
lda mult40,y
sta lo2
lda mult40+1,y
sta hi2
clc
txa
adc lo2
sta lo2
lda hi2
adc #0
sta hi2
rts
resettime
lda #0
sta count
sta count+1
sta count+2
sta count1l
sta count1h
sta count1g
sta count60l
sta count60h
sta count100l
sta count100h
sta count
sta count+1
sta count+2
sta flag
sta flag+1
sta flag+2
sta flag+3
rts