-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgameplay.s
More file actions
67 lines (52 loc) · 935 Bytes
/
gameplay.s
File metadata and controls
67 lines (52 loc) · 935 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
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
;; Make symbols from other files visible.
.autoimport +
;; Function to play level 1 of the game.
.export _play_level0
.export _irq_scheduler
;; Include macros to set raster IRQs.
.include "irqutil.s"
;; Activate ram at $e400
.macro disable_kernal
lda $0001
and #$fd
sta $0001
.endmacro
;; Activate rom at $e000
.macro enable_kernal
lda $0001
ora #$02
sta $0001
.endmacro
;; Play level 1 of the game
_play_level0:
sei
disable_kernal
;; Set 24 row mode
lda $d011
and #247
sta $d011
;;
;; Init scheduler
;;
jsr _scheduler_init
;;
;; Install raster irq
;;
set_irq_routine 10,_irq_scheduler
cli ; enable raster irq
continue_play:
jmp continue_play ; Continue the level
;; Set 25 row mode
lda $d011
ora #8
sta $d011
enable_kernal
cli
rts
;;
;; Rasterline routine for task scheduling
;;
_irq_scheduler:
start_irq_routine
jsr _scheduler_task
end_irq_routine