c64-livecoding/host/mainloop.s

45 lines
701 B
ArmAsm

;;; -*- 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