From c076aa2055c4ae071200eed1a06f129f295feea7 Mon Sep 17 00:00:00 2001 From: John Lorentzson Date: Thu, 24 Jul 2025 15:29:55 +0200 Subject: [PATCH] Add "main loop" to host program, which executes user program --- host/mainloop.s | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 host/mainloop.s diff --git a/host/mainloop.s b/host/mainloop.s new file mode 100644 index 0000000..65854b1 --- /dev/null +++ b/host/mainloop.s @@ -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