Add "main loop" to host program, which executes user program
This commit is contained in:
parent
677b6a2f56
commit
c076aa2055
1 changed files with 45 additions and 0 deletions
45
host/mainloop.s
Normal file
45
host/mainloop.s
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
|
||||||
|
.scope mainsetup
|
||||||
|
USERPROG = $C000
|
||||||
|
.repeat 4, I
|
||||||
|
ldy #$00
|
||||||
|
:
|
||||||
|
lda batch_userprog+(I*256),Y
|
||||||
|
sta USERPROG+(I*256),Y
|
||||||
|
dey
|
||||||
|
bne :-
|
||||||
|
.endrep
|
||||||
|
.endscope
|
||||||
|
|
||||||
|
.scope mainloop
|
||||||
|
ml:
|
||||||
|
USERPROG = $C000
|
||||||
|
RASTER = $D012
|
||||||
|
;; Currently no code for fetching new programs, since we're testing with
|
||||||
|
;; batch compiled version of the whole to begin with.
|
||||||
|
|
||||||
|
;; Bank in character ROM
|
||||||
|
lda #%11111011
|
||||||
|
and $01
|
||||||
|
sta $01
|
||||||
|
|
||||||
|
jsr USERPROG
|
||||||
|
|
||||||
|
;; Bank out character ROM, I/O in
|
||||||
|
lda #%00000100
|
||||||
|
ora $01
|
||||||
|
sta $01
|
||||||
|
@framewait:
|
||||||
|
ldy RASTER
|
||||||
|
cpy #$66
|
||||||
|
beq @framewait
|
||||||
|
inc FRAMECOUNT
|
||||||
|
jmp ml
|
||||||
|
.endscope
|
||||||
|
|
||||||
|
.proc time ; user-procedure
|
||||||
|
lda FRAMECOUNT
|
||||||
|
rts
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
FRAMECOUNT: .byte 0
|
Loading…
Add table
Reference in a new issue