1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-05-31 18:41:30 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Marq Watkin
11bef277cf
Merge b0e8b5c8d6 into 6f294d6dec 2022-02-28 10:17:18 +09:00
pmprog
b0e8b5c8d6 Formatting update 2021-03-24 15:40:50 +00:00
pmprog
db4a5eed00 C64 VIC-II RasterIRQ methods and example 2021-03-24 15:27:19 +00:00
2 changed files with 89 additions and 1 deletions

View File

@ -0,0 +1,48 @@
void RasterA() {
vic_rasterirq_acknowledge()
// First raster split, set border to black
vic_border = black
// Set up next raster split
vic_rasterirq_reconfigure(RasterB.addr, $40)
vic_rasterirq_return()
}
void RasterB() {
vic_rasterirq_acknowledge()
// Second raster split, Dark grey
vic_border = dark_grey
// Set up next raster split
vic_rasterirq_reconfigure(RasterC.addr, $A0)
vic_rasterirq_return()
}
void RasterC() {
vic_rasterirq_acknowledge()
// Third raster split, Light grey
vic_border = light_grey
// Set up next raster split
vic_rasterirq_reconfigure(RasterA.addr, $00)
vic_rasterirq_return()
}
void main() {
byte i
// Configure Raster IRQ
vic_rasterirq_configure(RasterA.addr, $00)
// Loop forever
while true {
i = 0 // Do nothing here
}
}

View File

@ -164,4 +164,44 @@ const byte medium_gray = 12
const byte light_green = 13
const byte light_blue = 14
const byte light_grey = 15
const byte light_gray = 15
const byte light_gray = 15
asm void vic_rasterirq_configure(pointer CallbackFunction, byte RasterLine) {
sei
ldx CallbackFunction.lo
stx $0314
ldy CallbackFunction.hi
sty $0315
lda #$7f ;CIA interrupt off
sta $dc0d
lda #$01 ;Raster interrupt on
sta $d01a
lda #27 ;High bit of interrupt position = 0
sta $d011
lda RasterLine ;Line where next IRQ happens
sta $d012
lda $dc0d ;Acknowledge IRQ (to be sure)
cli
rts
}
asm void vic_rasterirq_reconfigure(pointer CallbackFunction, byte RasterLine) {
ldx CallbackFunction.lo
stx $0314
ldy CallbackFunction.hi
sty $0315
lda RasterLine ;Line where next IRQ happens
sta $d012
rts
}
asm macro void vic_rasterirq_acknowledge() {
lda #$FF
sta $D019
}
asm macro void vic_rasterirq_return() {
lda #$00
jmp $EA81
}