-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathC64UltimateSimpleOpenSideBorders.a
More file actions
115 lines (100 loc) · 2.02 KB
/
C64UltimateSimpleOpenSideBorders.a
File metadata and controls
115 lines (100 loc) · 2.02 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
; C64Ultimate open side border code, that doesn't use any IRQ/NMI/timer. Instead it jusy busy waits with suitable delays.
; This demonstrates just the CPU is plenty fast enough for the "cycle accurate VIC timing" needed for open side borders.
; Execute at 64MHz without badlines.
; ..\c64\acme.exe --lib ../C64/ -v9 -f cbm -o c:\temp\t.prg C64UltimateSimpleOpenSideBorders.a && ..\c64\bin\LZMPi.exe -pp $37 -c64mbu c:\temp\t.prg c:\temp\t.prg $400 && curl --request POST --data-binary "@C:\temp\t.prg" http://c64u/v1/runners:run_prg
!source "stdlib/stdlib.a"
* = $400
sei
clc
; Setup sprites to be visible
lda #%11111111
sta VIC2SpriteEnable
; Sprites Y pos
lda #100
!for .i , 4 {
sta VIC2Sprite0Y + (.i-1)*2
sta VIC2Sprite4Y + (.i-1)*2
adc #21
}
lda #VIC2Colour_Black
ldx #VIC2Colour_White
!for .i , 4 {
sta VIC2Sprite0Colour + (.i-1) * 2
stx VIC2Sprite1Colour + (.i-1) * 2
}
lda #0
!for .i , 4 {
sta VIC2Sprite0X + (.i-1)*2
adc #8
}
lda #72
!for .i , 4 {
sta VIC2Sprite4X + (.i-1)*2
adc #8
}
lda #%11110000
sta VIC2SpriteXMSB
; Open side borders, with screen colour change to show the position
.l1
ldy #80
.l2
jsr WaitRaster
; Even though "bad lines" are turned off, there seems to be 40 cycles at 64 MHz used for the line fetch.
; At least it's not 40 cycles at 1MHz, which would be much longer in terms of time.
tya
and #%111
cmp #3
beq .isBadLine
; Just waste some time to make the normal lines match with the bad lines timing
ldx #5
jsr Delay1
.isBadLine
ldx #200
jsr Delay2
ldx #46
jsr Delay3
jsr OpenSideBorder
iny
cpy #200
bne .l2
jmp .l1
WaitRaster
.wl1
cpy VIC2Raster
bne .wl1
rts
Delay1
.delay
dex
bne .delay
rts
Delay2
.delay2
!for .i , 5 {
nop
}
dex
bne .delay2
rts
Delay3
.delay3
!for .i , 2 {
nop
}
dex
bne .delay3
rts
OpenSideBorder
dec VIC2ScreenColour
dec VIC2ScreenControlH
ldx #8
jsr Delay1
inc VIC2ScreenColour
inc VIC2ScreenControlH
rts
!for .i , 40 {
!scr "testing... "
}
; Sprite pointers, using the code as sprite frame data
* = $7f8
!by 16,17,18,19,20,21,22,23