diff --git a/wip-hugo/STARTUP.s b/wip-hugo/STARTUP.s index a065f3c..82b4cb6 100755 --- a/wip-hugo/STARTUP.s +++ b/wip-hugo/STARTUP.s @@ -1,82 +1,109 @@ .scope STARTUP -;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- -;;Settings positions -CR1 = $d011; ;Graphic settings -VIC_bank_settings = $DD00 ; Vic position -Screen_RAM_settings =$D018 ;Screen RAM position relative to VIC + ;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- + ;; Settings positions + CR1 = $d011; Graphic settings + VIC_bank_settings = $DD00 ; Vic position + Screen_RAM_settings =$D018 ; Screen RAM position relative to VIC -;;########## VIC_BANK ################ -;;# BITMAP | $4000 -$5F3F -;;# Unused? | $5F3F - $6000 -;;# SCREAN RAM (color) | $6000 -$63E7 -;;# Unused? | $63E8 - $7FFF -;;# -;;#################################### + ;;########## VIC_BANK ################ + ;;# BITMAP | $4000 -$5F3F + ;;# Unused? | $5F3F - $6000 + ;;# SCREAN RAM (color) | $6000 -$63E7 + ;;# Unused? | $63E8 - $7FFF + ;;# + ;;#################################### -;;Memory positions -VIC_bank = $4000 -VIC_bank_end = VIC_bank + $3FFF + ;; Memory positions + VIC_bank = $4000 + VIC_bank_end = VIC_bank + $3FFF -Bitmap = VIC_bank -Bitmap_end = $5F3F + Bitmap = VIC_bank + Bitmap_end = $5F3F -Screen_RAM = $2000 + VIC_bank -Screen_RAM_end = Screen_RAM + $03E7 + Screen_RAM = $2000 + VIC_bank + Screen_RAM_end = Screen_RAM + $03E7 -Character_generator_ROM = $D000 + 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 -AND CR1 -STA CR1 + ;; Free upp memory + ;; https://www.c64-wiki.com/wiki/Bank_Switching -LDA #%00100000; BMM = True -ORA CR1 -STA CR1 + ;; Sets grafic mode [Standard bitmap mode] + ;; https://www.c64-wiki.com/wiki/Standard_Bitmap_Mode + LDA #%10111111 ; ECM = False + AND CR1 + STA CR1 -;;Set VIC bank to bank 1 -;;https://www.c64-wiki.com/wiki/VIC_bank -LDA #%11111110 ;bit_0 = False -AND VIC_bank_settings -STA VIC_bank_settings + LDA #%00100000; BMM = True + ORA CR1 + STA CR1 -LDA #%00000010; bit_1 = True -ORA VIC_bank_settings -STA VIC_bank_settings + ;; Set VIC bank to bank 1 + ;; https://www.c64-wiki.com/wiki/VIC_bank + 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 #%10001111 ; bit_6 =bit_5=bit_4 = Falsw -AND Screen_RAM_settings -STA Screen_RAM_settings + LDA #%00000010; bit_1 = True + ORA VIC_bank_settings + STA VIC_bank_settings -LDA #%10000000; bit_1 = True -ORA Screen_RAM_settings -STA Screen_RAM_settings + ;; Set Scren-RAM to offset 8 ;https://www.c64-wiki.com/wiki/53272 (offset is 8k byte = 1024*8-ich) + LDA #%10001111 ; bit_6 =bit_5=bit_4 = Falsw + 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 -Mov_16 B_start, B_start + 1, #VIC_bank -Mov_16 B_end, B_end + 1, #<$5f3f, #>$5f3f -LDA #$00 -jsr memset + LDA #%10000000; bit_1 = True + ORA 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 + Mov_16 B_start, B_start + 1, #VIC_bank + Mov_16 B_end, B_end + 1, #<$5f3f, #>$5f3f + LDA #$00 + jsr memset -;;Sets the screen color to black and white -Mov_16 B_start, B_start + 1, #Screen_RAM -Mov_16 B_end, B_end + 1, #Screen_RAM_end -LDA #%11110000 -jsr memset -SEI ;Disable interups (not all) -;;Disable BASIC ROM mohahaha -LDA #%11111110 -AND $0001 -STA $0001 -;https://www.c64-wiki.com/wiki/Bank_Switching -;Disable IO, CHAREN =0 -LDA #%11111011 -AND $0001 -STA $0001 + ;; Sets the screen color to black and white + Mov_16 B_start, B_start + 1, #Screen_RAM + Mov_16 B_end, B_end + 1, #Screen_RAM_end + LDA #%11110000 + jsr memset + + ;; Disable maskeble interups (not all) + SEI + ;; Disable BASIC ROM mohahaha + LDA #%11111110 + AND $0001 + STA $0001 + ; https://www.c64-wiki.com/wiki/Bank_Switching + ; Disable IO, CHAREN =0 + 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 $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