CINT should be complete now
This commit is contained in:
1 parent
a9d167810b
commit
98860e9831
9 files changed
+88
-77
No files matched your search
@@ -102,8 +102,8 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on
|
|||||||
| Address | Unofficial | Name | Status | Remarks |
|
| Address | Unofficial | Name | Status | Remarks |
|
||||||
| :-------: | :--------: | :---------- | :------: | :--------------------------------------------------: |
|
| :-------: | :--------: | :---------- | :------: | :--------------------------------------------------: |
|
||||||
| `($028F)` | | `KEYLOG` | DONE | |
|
| `($028F)` | | `KEYLOG` | DONE | |
|
||||||
| `$FF81` | `$FF5B` | `CINT` | PARTIAL | probably incomplete, needs adjustments for compat. |
|
| `$FF81` | `$FF5B` | `CINT` | DONE | |
|
||||||
| `$FF84` | `$FDA3` | `IOINIT` | PARTIAL | CIA initialization incomplete |
|
| `$FF84` | `$FDA3` | `IOINIT` | PARTIAL | CIA initialization might be incomplete |
|
||||||
| `$FF87` | `$FD50` | `RAMTAS` | PARTIAL | probably shouldn't touch VIC and CIA's |
|
| `$FF87` | `$FD50` | `RAMTAS` | PARTIAL | probably shouldn't touch VIC and CIA's |
|
||||||
| `$FF8A` | `$FD15` | `RESTOR` | DONE | |
|
| `$FF8A` | `$FD15` | `RESTOR` | DONE | |
|
||||||
| `$FF8D` | `$FD1A` | `VECTOR` | DONE | |
|
| `$FF8D` | `$FD1A` | `VECTOR` | DONE | |
|
||||||
@@ -157,7 +157,8 @@ Not all of them - only these we want to have implemented.
|
|||||||
|
|
||||||
| Address | Name | Status | Remarks |
|
| Address | Name | Status | Remarks |
|
||||||
| :-------: | :--------------------------- | :------: | :------------------------------------------------: |
|
| :-------: | :--------------------------- | :------: | :------------------------------------------------: |
|
||||||
| `$E51B` | init screen keyboard, no VIC | PARTIAL | not sure if correct |
|
| `$E518` | legacy part of CINT | DONE | |
|
||||||
|
| `$E51B` | init screen keyboard, no VIC | DONE | |
|
||||||
| `$E544` | clear screen | DONE | |
|
| `$E544` | clear screen | DONE | |
|
||||||
| `$E50C` | set cursor position | PARTIAL | |
|
| `$E50C` | set cursor position | PARTIAL | |
|
||||||
| `$E566` | home cursor | NOT DONE | |
|
| `$E566` | home cursor | NOT DONE | |
|
||||||
|
|||||||
+2
-52
@@ -1,62 +1,12 @@
|
|||||||
|
|
||||||
//
|
//
|
||||||
// It seems this is a part CINT which initializes screen and keyboard, but does not
|
// This is a part CINT which initializes screen and keyboard
|
||||||
// reset VIC-II. See here: https://csdb.dk/forums/index.php?roomid=11&topicid=17048&firstpost=22
|
|
||||||
//
|
//
|
||||||
// For more details see:
|
// For more details see:
|
||||||
// - [RG64] C64 Programmer's Reference Guide - page 280
|
// - [RG64] C64 Programmer's Reference Guide - page 280
|
||||||
// - [CM64] Compute's Mapping the Commodore 64 - page 242
|
// - [CM64] Compute's Mapping the Commodore 64 - page 242
|
||||||
|
|
||||||
cint_screen_keyboard_real:
|
cint_screen_keyboard:
|
||||||
|
|
||||||
// XXX check what really is performed here
|
|
||||||
|
|
||||||
// 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
|
|
||||||
|
|
||||||
lda #$C8 // preparation, as the VIC might be uninitialized
|
|
||||||
sta VIC_SCROLX
|
|
||||||
|
|
||||||
cint_w0:
|
|
||||||
lda VIC_RASTER
|
|
||||||
cint_w1:
|
|
||||||
cmp VIC_RASTER
|
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
ldy #<17045
|
|
||||||
ldx #>17045
|
|
||||||
|
|
||||||
sty CIA1_TIMALO
|
|
||||||
stx CIA1_TIMAHI
|
|
||||||
|
|
||||||
lda #$00
|
|
||||||
beq !+
|
|
||||||
|
|
||||||
cint_pal:
|
|
||||||
|
|
||||||
lda #$01
|
|
||||||
!:
|
|
||||||
sta TVSFLG
|
|
||||||
|
|
||||||
cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start?
|
|
||||||
|
|
||||||
// Setup KEYLOG vector
|
// Setup KEYLOG vector
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Part of the 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_legacy: // $E518
|
||||||
|
|
||||||
|
// Setup video and I/O
|
||||||
|
// See here: https://csdb.dk/forums/index.php?roomid=11&topicid=17048&firstpost=22
|
||||||
|
jsr setup_vicii
|
||||||
|
|
||||||
|
// Code below must be placed under $E51B, or some code will break - see here:
|
||||||
|
// - https://csdb.dk/forums/index.php?roomid=11&topicid=17048&firstpost=2
|
||||||
|
// Game 'Operacja Proboszcz' is one example.
|
||||||
|
|
||||||
|
jmp cint_screen_keyboard // XXX try to fit the code here
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
Game 'Operacja Proboszcz' explicitly calls $E51B - thus, it is sane
|
||||||
|
to place old CINT routine in it's original place
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
|
|
||||||
// Routine too long to fit here
|
|
||||||
|
|
||||||
cint_screen_keyboard:
|
|
||||||
|
|
||||||
jmp cint_screen_keyboard_real
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
|
|
||||||
Game 'Operacja Proboszcz' explicitly calls this location.
|
|
||||||
@@ -77,17 +77,16 @@ IOINIT:
|
|||||||
|
|
||||||
// Set timer interval to ~1/60th of a second
|
// Set timer interval to ~1/60th of a second
|
||||||
|
|
||||||
// (This value was calculated by running a custom IRQ handler on a C64
|
// Probably NTSC is the default one, as PAL support was introduced later,
|
||||||
// with original KERNAL, and writing the values of $DC04/5 to the screen
|
// in a patch - see [CM64] page 242 and page:
|
||||||
// in the IRQ handler to see roughly what value the timers must be set to)
|
// - http://commodore64.se/wiki/index.php/Commodore_64_KERNAL_ROM_versions
|
||||||
// ldy #<16380
|
// "The KERNAL ROM R1 was obviously used only in early NTSC systems. It lacks the PAL/NTSC detection"
|
||||||
// ldx #>16380
|
|
||||||
|
|
||||||
// PAL C64 (https://codebase64.org/doku.php?id=base:cpu_clocking),
|
// NTSC C64 (https://codebase64.org/doku.php?id=base:cpu_clocking),
|
||||||
// is clocked at 0.985248 MHz, so that 1/60s is 16421 CPU cycles
|
// is clocked at 1.022727 MHz, so that 1/60s is 17045 CPU cycles
|
||||||
|
|
||||||
ldy #<16421
|
ldy #<17045
|
||||||
ldx #>16421
|
ldx #>17045
|
||||||
|
|
||||||
sty CIA1_TIMALO
|
sty CIA1_TIMALO
|
||||||
stx CIA1_TIMAHI
|
stx CIA1_TIMAHI
|
||||||
|
|||||||
@@ -10,7 +10,47 @@
|
|||||||
|
|
||||||
CINT:
|
CINT:
|
||||||
|
|
||||||
// Setup video and I/O
|
jsr cint_legacy
|
||||||
jsr setup_vicii
|
|
||||||
|
|
||||||
jmp cint_screen_keyboard
|
cint_check_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 VIC_RASTER
|
||||||
|
!:
|
||||||
|
cmp VIC_RASTER
|
||||||
|
beq !-
|
||||||
|
bmi cint_check_pal_ntsc
|
||||||
|
|
||||||
|
// 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
|
||||||
|
bcc cont_done
|
||||||
|
|
||||||
|
cint_pal:
|
||||||
|
|
||||||
|
// (This value was calculated by running a custom IRQ handler on a C64
|
||||||
|
// with original KERNAL, and writing the values of $DC04/5 to the screen
|
||||||
|
// in the IRQ handler to see roughly what value the timers must be set to)
|
||||||
|
// ldy #<16380
|
||||||
|
// ldx #>16380
|
||||||
|
|
||||||
|
// PAL C64 (https://codebase64.org/doku.php?id=base:cpu_clocking),
|
||||||
|
// is clocked at 0.985248 MHz, so that 1/60s is 16421 CPU cycles
|
||||||
|
|
||||||
|
ldy #<16421
|
||||||
|
ldx #>16421
|
||||||
|
|
||||||
|
sty CIA1_TIMALO
|
||||||
|
stx CIA1_TIMAHI
|
||||||
|
|
||||||
|
lda #$01
|
||||||
|
!:
|
||||||
|
sta TVSFLG
|
||||||
|
|
||||||
|
cont_done:
|
||||||
|
rts
|
||||||
@@ -12,8 +12,12 @@ default_brk_handler:
|
|||||||
|
|
||||||
jsr JRESTOR
|
jsr JRESTOR
|
||||||
jsr JIOINIT
|
jsr JIOINIT
|
||||||
jsr setup_vicii // XXX should probably be a part of cint_brk
|
|
||||||
jsr cint_brk
|
// Original routine calls just a part of CINT - but I'm not sure which one. Most likely it
|
||||||
|
// skips the PAL/NTSC check by calling $E518. I suspect bug in the original ROM, let's
|
||||||
|
// call the whole CINT, just to be sure everything is initialized.
|
||||||
|
|
||||||
|
jsr CINT
|
||||||
|
|
||||||
cli
|
cli
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user