Minimise performance issues of None Maskable Interupt

This commit is contained in:
hugova 2025-05-02 18:55:33 +02:00
parent 3bdf52d1a8
commit 1a8d4593ed

View file

@ -1,7 +1,7 @@
.scope STARTUP
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
;; Settings positions
CR1 = $d011; ;Graphic settings
CR1 = $d011; Graphic settings
VIC_bank_settings = $DD00 ; Vic position
Screen_RAM_settings =$D018 ; Screen RAM position relative to VIC
@ -27,7 +27,7 @@ Character_generator_ROM = $D000
;; Free upp memory
;; https://www.c64-wiki.com/wiki/Bank_Switching
;;
;; Sets grafic mode [Standard bitmap mode]
;; https://www.c64-wiki.com/wiki/Standard_Bitmap_Mode
LDA #%10111111 ; ECM = False
@ -69,7 +69,9 @@ Mov_16 B_start, B_start + 1, #<Screen_RAM, #>Screen_RAM
Mov_16 B_end, B_end + 1, #<Screen_RAM_end, #>Screen_RAM_end
LDA #%11110000
jsr memset
SEI ;Disable interups (not all)
;; Disable maskeble interups (not all)
SEI
;; Disable BASIC ROM mohahaha
LDA #%11111110
AND $0001
@ -79,4 +81,29 @@ STA $0001
LDA #%11111011
AND $0001
STA $0001
;;Disable non maskable interupts
;;https://codebase64.org/doku.php?id=base:nmi_lock_without_kernal
;; write to $FFFA/$FFFB possible (and needed) if BASIC ROM is disabled
LDA #$00
STA $CCCC
LDA #<NMI_routine
STA $FFFA
LDA #>NMI_routine
STA $FFFB
LDA #$00 ;; stop Timer A
STA $DD0E
STA $DD04 ;; set Timer A to 0, after starting
STA $DD05 ;; NMI will occur immediately
LDA #$81
STA $DD0D ;; set Timer A as source for NMI
LDA #$01
STA $DD0E ;; start Timer A -> NMI
;; from here on NMI is disabled
JMP NMI_routine_end
NMI_routine:
RTI ;; exit interrupt not acknowledged
NMI_routine_end:
.endscope