adapted to Kick Assembler, some documentation update

This commit is contained in:
FeralChild64 committed 2019-09-07 12:35:21 +02:00
1 parent ae23dbae7b
commit de27124b4f
198 files changed
+4181 -3976

No files matched your search

+40 -40
View File
@@ -1,24 +1,24 @@
;;
;; Official Kernal routine, described in:
;;
;; - [RG64] C64 Programmer's Reference Guide - page 280
;; - [CM64] Compute's Mapping the Commodore 64 - page 242
;;
;; CPU registers that has to be preserved (see [RG64]): none
;;
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 280
// - [CM64] Compute's Mapping the Commodore 64 - page 242
//
// CPU registers that has to be preserved (see [RG64]): none
//
cint_real:
;; According to [CM64], this routine checks for PAL/NTSC. It's definitely not done
;; within the 'BRK' part, this can be easily checked - POKE something
;; to address 678 on a real C64, press STOP+RESTORE, the value won't change
// According to [CM64], this routine checks for PAL/NTSC. It's definitely not done
// within the 'BRK' part, this can be easily checked - POKE something
// to address 678 on a real C64, press STOP+RESTORE, the value won't change
;; Detect video system (PAL/NTSC), use Graham's method, as it's short and reliable
;; see here: https://codebase64.org/doku.php?id=base:detect_pal_ntsc
// Detect video system (PAL/NTSC), use Graham's method, as it's short and reliable
// see here: https://codebase64.org/doku.php?id=base:detect_pal_ntsc
lda #$C8 ; preparation, as the VIC might be uninitialized
lda #$C8 // preparation, as the VIC might be uninitialized
sta VIC_SCROLX
cint_w0:
@@ -28,18 +28,18 @@ cint_w1:
beq cint_w1
bmi cint_w0
;; Result in A, if no interrupt happened during the test:
;; #$37 -> 312 rasterlines, PAL, VIC 6569
;; #$06 -> 263 rasterlines, NTSC, VIC 6567R8
;; #$05 -> 262 rasterlines, NTSC, VIC 6567R56A
// Result in A, if no interrupt happened during the test:
// #$37 -> 312 rasterlines, PAL, VIC 6569
// #$06 -> 263 rasterlines, NTSC, VIC 6567R8
// #$05 -> 262 rasterlines, NTSC, VIC 6567R56A
cmp #$07
bcs cint_pal
cint_ntsc:
;; NTSC C64 (https://codebase64.org/doku.php?id=base:cpu_clocking),
;; is clocked at 1.022727 MHz, so that 1/60s is 17045 CPU cycles
// NTSC C64 (https://codebase64.org/doku.php?id=base:cpu_clocking),
// is clocked at 1.022727 MHz, so that 1/60s is 17045 CPU cycles
ldy #<17045
ldx #>17045
@@ -48,51 +48,51 @@ cint_ntsc:
stx CIA1_TIMAHI
lda #$00
beq +
beq !+
cint_pal:
lda #$01
*
!:
sta PALNTSC
cint_brk: ; entry for BRK and STOP+RESTORE - XXX, where should it start?
cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start?
jsr setup_vicii
;; Initialise cursor blink flags (Compute's Mapping the 64 p215)
// Initialise cursor blink flags (Compute's Mapping the 64 p215)
lda #$00
sta cursor_blink_disable
;; Set keyboard decode vector (Compute's Mapping the 64 p215)
// Set keyboard decode vector (Compute's Mapping the 64 p215)
;; Set initial variables for our improved keyboard scan routine
lda #$ff
// Set initial variables for our improved keyboard scan routine
lda #$FF
ldx #6
* sta BufferOld,x
!: sta BufferOld,x
dex
bpl -
bpl !-
sta BufferQuantity
;; Set key repeat delay (Compute's Mapping the 64 p215)
;; Making some numbers up here: Repeat every ~1/10th sec
;; But require key to be held for ~1/3sec before
;; repeating (Compute's Mapping the 64 p58)
ldx #22-2 ; Fudge factor to match speed
// Set key repeat delay (Compute's Mapping the 64 p215)
// Making some numbers up here: Repeat every ~1/10th sec
// But require key to be held for ~1/3sec before
// repeating (Compute's Mapping the 64 p58)
ldx #22-2 // Fudge factor to match speed
stx key_first_repeat_delay
;; Set current colour for text (Compute's Mapping the 64 p215)
ldx #$01 ; default is light blue ($0E), but we use a different one
// Set current colour for text (Compute's Mapping the 64 p215)
ldx #$01 // default is light blue ($0E), but we use a different one
stx text_colour
;; Set maximum keyboard buffer size (Compute's Mapping the 64 p215)
// Set maximum keyboard buffer size (Compute's Mapping the 64 p215)
ldx #10
stx key_buffer_size
;; Put non-zero value in enable_case_switch
// Put non-zero value in enable_case_switch
stx enable_case_switch
;; Set default I/O devices (see SCINIT description at http://sta.c64.org/cbm64krnfunc.html)
// Set default I/O devices (see SCINIT description at http://sta.c64.org/cbm64krnfunc.html)
jsr clrchn_reset
;; Fallthrough/jump to screen clear routine (Compute's Mapping the 64 p215)
// Fallthrough/jump to screen clear routine (Compute's Mapping the 64 p215)
jmp clear_screen