Minimise performance issues of None Maskable Interupt
This commit is contained in:
parent
3bdf52d1a8
commit
1a8d4593ed
1 changed files with 93 additions and 66 deletions
|
@ -1,82 +1,109 @@
|
||||||
.scope STARTUP
|
.scope STARTUP
|
||||||
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
|
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
|
||||||
;;Settings positions
|
;; Settings positions
|
||||||
CR1 = $d011; ;Graphic settings
|
CR1 = $d011; Graphic settings
|
||||||
VIC_bank_settings = $DD00 ; Vic position
|
VIC_bank_settings = $DD00 ; Vic position
|
||||||
Screen_RAM_settings =$D018 ;Screen RAM position relative to VIC
|
Screen_RAM_settings =$D018 ; Screen RAM position relative to VIC
|
||||||
|
|
||||||
;;########## VIC_BANK ################
|
;;########## VIC_BANK ################
|
||||||
;;# BITMAP | $4000 -$5F3F
|
;;# BITMAP | $4000 -$5F3F
|
||||||
;;# Unused? | $5F3F - $6000
|
;;# Unused? | $5F3F - $6000
|
||||||
;;# SCREAN RAM (color) | $6000 -$63E7
|
;;# SCREAN RAM (color) | $6000 -$63E7
|
||||||
;;# Unused? | $63E8 - $7FFF
|
;;# Unused? | $63E8 - $7FFF
|
||||||
;;#
|
;;#
|
||||||
;;####################################
|
;;####################################
|
||||||
|
|
||||||
;;Memory positions
|
;; Memory positions
|
||||||
VIC_bank = $4000
|
VIC_bank = $4000
|
||||||
VIC_bank_end = VIC_bank + $3FFF
|
VIC_bank_end = VIC_bank + $3FFF
|
||||||
|
|
||||||
Bitmap = VIC_bank
|
Bitmap = VIC_bank
|
||||||
Bitmap_end = $5F3F
|
Bitmap_end = $5F3F
|
||||||
|
|
||||||
Screen_RAM = $2000 + VIC_bank
|
Screen_RAM = $2000 + VIC_bank
|
||||||
Screen_RAM_end = Screen_RAM + $03E7
|
Screen_RAM_end = Screen_RAM + $03E7
|
||||||
|
|
||||||
Character_generator_ROM = $D000
|
Character_generator_ROM = $D000
|
||||||
|
|
||||||
;;Free upp memory
|
;; Free upp memory
|
||||||
;;https://www.c64-wiki.com/wiki/Bank_Switching
|
;; 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
|
|
||||||
AND CR1
|
|
||||||
STA CR1
|
|
||||||
|
|
||||||
LDA #%00100000; BMM = True
|
;; Sets grafic mode [Standard bitmap mode]
|
||||||
ORA CR1
|
;; https://www.c64-wiki.com/wiki/Standard_Bitmap_Mode
|
||||||
STA CR1
|
LDA #%10111111 ; ECM = False
|
||||||
|
AND CR1
|
||||||
|
STA CR1
|
||||||
|
|
||||||
;;Set VIC bank to bank 1
|
LDA #%00100000; BMM = True
|
||||||
;;https://www.c64-wiki.com/wiki/VIC_bank
|
ORA CR1
|
||||||
LDA #%11111110 ;bit_0 = False
|
STA CR1
|
||||||
AND VIC_bank_settings
|
|
||||||
STA VIC_bank_settings
|
|
||||||
|
|
||||||
LDA #%00000010; bit_1 = True
|
;; Set VIC bank to bank 1
|
||||||
ORA VIC_bank_settings
|
;; https://www.c64-wiki.com/wiki/VIC_bank
|
||||||
STA VIC_bank_settings
|
LDA #%11111110 ;bit_0 = False
|
||||||
|
AND VIC_bank_settings
|
||||||
|
STA VIC_bank_settings
|
||||||
|
|
||||||
;;Set Scren-RAM to offset 8 ;https://www.c64-wiki.com/wiki/53272 (offset is 8k byte = 1024*8-ich)
|
LDA #%00000010; bit_1 = True
|
||||||
LDA #%10001111 ; bit_6 =bit_5=bit_4 = Falsw
|
ORA VIC_bank_settings
|
||||||
AND Screen_RAM_settings
|
STA VIC_bank_settings
|
||||||
STA Screen_RAM_settings
|
|
||||||
|
|
||||||
LDA #%10000000; bit_1 = True
|
;; Set Scren-RAM to offset 8 ;https://www.c64-wiki.com/wiki/53272 (offset is 8k byte = 1024*8-ich)
|
||||||
ORA Screen_RAM_settings
|
LDA #%10001111 ; bit_6 =bit_5=bit_4 = Falsw
|
||||||
STA Screen_RAM_settings
|
AND Screen_RAM_settings
|
||||||
|
STA Screen_RAM_settings
|
||||||
|
|
||||||
;;Paint the bitmap black. More bitmap: https://www.c64-wiki.com/wiki/53272, https://www.c64-wiki.com/wiki/Screen_RAM#Moving_of_screen_RAM
|
LDA #%10000000; bit_1 = True
|
||||||
Mov_16 B_start, B_start + 1, #<VIC_bank, #>VIC_bank
|
ORA Screen_RAM_settings
|
||||||
Mov_16 B_end, B_end + 1, #<$5f3f, #>$5f3f
|
STA Screen_RAM_settings
|
||||||
LDA #$00
|
|
||||||
jsr memset
|
;; Paint the bitmap black. More bitmap: https://www.c64-wiki.com/wiki/53272, https://www.c64-wiki.com/wiki/Screen_RAM#Moving_of_screen_RAM
|
||||||
|
Mov_16 B_start, B_start + 1, #<VIC_bank, #>VIC_bank
|
||||||
|
Mov_16 B_end, B_end + 1, #<$5f3f, #>$5f3f
|
||||||
|
LDA #$00
|
||||||
|
jsr memset
|
||||||
|
|
||||||
|
|
||||||
;;Sets the screen color to black and white
|
;; Sets the screen color to black and white
|
||||||
Mov_16 B_start, B_start + 1, #<Screen_RAM, #>Screen_RAM
|
Mov_16 B_start, B_start + 1, #<Screen_RAM, #>Screen_RAM
|
||||||
Mov_16 B_end, B_end + 1, #<Screen_RAM_end, #>Screen_RAM_end
|
Mov_16 B_end, B_end + 1, #<Screen_RAM_end, #>Screen_RAM_end
|
||||||
LDA #%11110000
|
LDA #%11110000
|
||||||
jsr memset
|
jsr memset
|
||||||
SEI ;Disable interups (not all)
|
|
||||||
;;Disable BASIC ROM mohahaha
|
;; Disable maskeble interups (not all)
|
||||||
LDA #%11111110
|
SEI
|
||||||
AND $0001
|
;; Disable BASIC ROM mohahaha
|
||||||
STA $0001
|
LDA #%11111110
|
||||||
;https://www.c64-wiki.com/wiki/Bank_Switching
|
AND $0001
|
||||||
;Disable IO, CHAREN =0
|
STA $0001
|
||||||
LDA #%11111011
|
; https://www.c64-wiki.com/wiki/Bank_Switching
|
||||||
AND $0001
|
; Disable IO, CHAREN =0
|
||||||
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
|
.endscope
|
||||||
|
|
Loading…
Add table
Reference in a new issue