58 lines
968 B
ArmAsm
58 lines
968 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
|
|
|
|
@waitstart: ;; Wait until joystick 2 has been pulled down to start the program
|
|
lda $dc00
|
|
and #$02
|
|
bne @waitstart
|
|
|
|
jsr setup_loader
|
|
inc $d020
|
|
@trying:
|
|
dec $d020
|
|
jsr maybe_download_userprog
|
|
beq @trying
|
|
.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 maybe_download_userprog
|
|
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
|