Merge pull request #29 from FeralChild64/master

Various Kernal updates
This commit is contained in:
gardners authored and GitHub committed 2019-08-10 07:20:59 +09:30
commit d2759ded07
128 files changed
+720 -310

No files matched your search

+6 -2
View File
@@ -3,7 +3,7 @@
SRC_COMMON = $(wildcard c64/aliases/*.s)
SRC_BASIC_COMMON = $(SRC_COMMON) $(wildcard c64/basic/*.s)
SRC_KERNAL_COMMON = $(SRC_COMMON) $(wildcard c64/kernal/*.s c64/kernal/jumptable/*.s c64/kernal/iec/*.s)
SRC_KERNAL_COMMON = $(SRC_COMMON) $(wildcard c64/kernal/*.s c64/kernal/jumptable/*.s c64/kernal/iec/*.s c64/kernal/interrupts/*.s)
SRC_BASIC_generic = $(SRC_BASIC_COMMON) $(wildcard c64/basic/,target_generic/*.s)
SRC_BASIC_mega65 = $(SRC_BASIC_COMMON) $(wildcard c64/basic/,target_mega65/*.s)
@@ -23,6 +23,10 @@ TOOL_SIMILARITY = build/tools/similarity
TOOLS_LIST = $(TOOL_COLLECT_DATA) $(TOOL_COMPRESS_TEXT) $(TOOL_PNGPREPARE) $(TOOL_PREPROCESS) $(TOOL_SIMILARITY)
# GIT commit
GIT_COMMIT:= $(shell git log -1 --pretty='%h' | tr '[:lower:]' '[:upper:]')
# Rules - main
.PHONY: all clean updatebin
@@ -147,7 +151,7 @@ test: build/newkern_generic build/newbasic_generic
x64 -kernal build/newkern_generic -basic build/newbasic_generic -8 empty.d64
testremote: build/newkern_generic build/newbasic_generic
x64 -kernal build/newkern-generic -basic build/newbasic-generic -remotemonitor
x64 -kernal build/newkern_generic -basic build/newbasic_generic -remotemonitor
testm65: build/newc65
m65 -b ../mega65-core/bin/mega65r1.bit -k ../mega65-core/bin/KICKUP.M65 -R build/newc65 -4
+11 -10
View File
@@ -6,6 +6,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8
* improved keyboard scanning, supports multi-key roll-over and rejection of spurious joystick input
* joystick (port 1) can be used to move text cursor
* uses RAM under ROM and I/O: 61436 bytes free
* cold/warm start silences 4 SID chips - assumes addresses $D400, $D420, $D440, $D460
* extended `LOAD` command
* start/end addresses are displayed, in the Final cartridge style
* command with just the file name tries to use the last device if it's number seems sane; otherwise uses 8
@@ -25,12 +26,12 @@ The following ROM features are currently missing:
* floating point routines
* tape support
* RS-232 support
* warm start (RUN/STOP + RESTORE) - NMI is not implemented at all
* breaking Kernal routines with RUN/STOP key
* BRK handling; NMI/IRQ handling is incomplete
Features currently being worked on:
* IEC support needs more testing ang bugfixing; alternative drive ROMs (JiffyDOS, DolphinDOS, etc) usually don't work with current implementation, `@$` leaves the drive led on, most likely other problems can be found
* IEC support needs more work; alternative drive ROMs (JiffyDOS, DolphinDOS, etc) usually don't work with current implementation, SAVE / VERIFY are not implemented, etc.
# API status
@@ -70,10 +71,10 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on
| Address | Name | Status | Remarks |
| --------- | :------- | :------: | :------------------------------------------------: |
| `$FF81` | `CINT` | PARTIAL | at least PAL/NTSC detection is missing |
| `$FF84` | `IOINIT` | PARTIAL | at least SID volume handling is missing |
| `$FF81` | `CINT` | DONE | |
| `$FF84` | `IOINIT` | PARTIAL | CIA initialization incomplete |
| `$FF87` | `RAMTAS` | DONE | |
| `$FF8A` | `RESTOR` | PARTIAL | CBINV, NMINV, and USRCMD missing |
| `$FF8A` | `RESTOR` | DONE | |
| `$FF8D` | `VECTOR` | DONE | |
| `$FF90` | `SETMSG` | DONE | |
| `$FF93` | `SECOND` | DONE | |
@@ -81,7 +82,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on
| `$FF99` | `MEMTOP` | DONE | |
| `$FF9C` | `MEMBOT` | DONE | |
| `$FF9F` | `SCNKEY` | DONE | could be better integrated with ROM (aliases) |
| `$FFA2` | `SETTMO` | NOT DONE | |
| `$FFA2` | `SETTMO` | DONE | |
| `$FFA5` | `ACPTR` | DONE | |
| `$FFA8` | `CIOUT` | DONE | |
| `$FFAB` | `UNTLK` | DONE | |
@@ -92,20 +93,20 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on
| `$FFBA` | `SETFLS` | DONE | |
| `$FFBD` | `SETNAM` | DONE | |
| `$FFC0` | `OPEN` | DONE | |
| `$FFC3` | `CLOSE` | PARTIAL | most likely incompleete, @$ doesn't end properly |
| `$FFC3` | `CLOSE` | DONE | |
| `$FFC6` | `CHKIN` | DONE | |
| `$FFC9` | `CHKOUT` | PARTIAL | |
| `$FFCC` | `CLRCHN` | DONE | |
| `$FFCF` | `CHRIN` | PARTIAL | |
| `$FFD2` | `CHROUT` | PARTIAL | |
| `$FFD5` | `LOAD` | PARTIAL | no VERIFY support yet |
| `$FFD5` | `LOAD` | PARTIAL | no VERIFY support yet, no STOP key support |
| `$FFD8` | `SAVE` | NOT DONE | |
| `$FFDB` | `SETTIM` | NOT DONE | |
| `$FFDE` | `RDTIM` | NOT DONE | |
| `$FFE1` | `STOP` | PARTIAL | no connection with UDTIM |
| `$FFE1` | `STOP` | DONE | |
| `$FFE4` | `GETIN` | PARTIAL | only some devices supported |
| `$FFE7` | `CLALL` | DONE | |
| `$FFEA` | `UDTIM` | NOT DONE | |
| `$FFEA` | `UDTIM` | NOT DONE | checking for STOP key present in SCNKEY instead |
| `$FFED` | `SCREEN` | DONE | |
| `$FFF0` | `PLOT` | NOT DONE | |
| `$FFF3` | `IOBASE` | DONE | |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+33 -39
View File
@@ -5,8 +5,8 @@
;; CPU memory registers
.alias CPU_D6510 $0000
.alias CPU_R6510 $0001
.alias CPU_D6510 $00
.alias CPU_R6510 $01
;; VIC-II registers
@@ -28,7 +28,7 @@
.alias VIC_SP7Y $D00F
.alias VIC_MSIGX $D010
.alias VIC_SCROLLY $D011
.alias VIC_SCROLY $D011
.alias VIC_RASTER $D012
.alias VIC_LPENX $D013
.alias VIC_LPENY $D014
@@ -60,46 +60,40 @@
.alias VIC_SP6COL $D02D
.alias VIC_SP7COL $D02E
;; SID #1 registers
;; SID registers
.alias SID1_FRELO1 $D400
.alias SID1_FREHI1 $D401
.alias SID1_PWLO1 $D402
.alias SID1_PWHI1 $D403
.alias SID1_VCREG1 $D404
.alias SID1_ATDCY1 $D405
.alias SID1_SUREL1 $D406
.alias SID_FRELO1 $D400
.alias SID_FREHI1 $D401
.alias SID_PWLO1 $D402
.alias SID_PWHI1 $D403
.alias SID_VCREG1 $D404
.alias SID_ATDCY1 $D405
.alias SID_SUREL1 $D406
.alias SID1_FRELO2 $D407
.alias SID1_FREHI2 $D408
.alias SID1_PWLO2 $D409
.alias SID1_PWHI2 $D40A
.alias SID1_VCREG2 $D40B
.alias SID1_ATDCY2 $D40C
.alias SID1_SUREL2 $D40D
.alias SID_FRELO2 $D407
.alias SID_FREHI2 $D408
.alias SID_PWLO2 $D409
.alias SID_PWHI2 $D40A
.alias SID_VCREG2 $D40B
.alias SID_ATDCY2 $D40C
.alias SID_SUREL2 $D40D
.alias SID1_FRELO3 $D40E
.alias SID1_FREHI3 $D40F
.alias SID1_PWLO3 $D410
.alias SID1_PWHI3 $D411
.alias SID1_VCREG3 $D412
.alias SID1_ATDCY3 $D413
.alias SID1_SUREL3 $D414
.alias SID_FRELO3 $D40E
.alias SID_FREHI3 $D40F
.alias SID_PWLO3 $D410
.alias SID_PWHI3 $D411
.alias SID_VCREG3 $D412
.alias SID_ATDCY3 $D413
.alias SID_SUREL3 $D414
.alias SID1_CUTLO $D415
.alias SID1_CUTHI $D416
.alias SID1_RESON $D417
.alias SID1_SIGVOL $D418
.alias SID1_POTX $D419
.alias SID1_POTY $D41A
.alias SID1_RANDOM $D41B
.alias SID1_ENV3 $D41C
;; SID #2, #3, #4 registers
.alias SID2_SIGVOL $D438
.alias SID3_SIGVOL $D458
.alias SID4_SIGVOL $D478
.alias SID_CUTLO $D415
.alias SID_CUTHI $D416
.alias SID_RESON $D417
.alias SID_SIGVOL $D418
.alias SID_POTX $D419
.alias SID_POTY $D41A
.alias SID_RANDOM $D41B
.alias SID_ENV3 $D41C
;; CIA #1 registers
+3
View File
@@ -45,6 +45,7 @@
.alias FNADDR $BB ; $BB-$BC, current file name pointer
.alias STAL $C1 ; $C1-$C2 LOAD/SAVE start address
.alias MEMUS $C3 ; $C3-$C4 temporary address for tape LOAD/SAVE
;;
;; Other low memory addresses
@@ -60,6 +61,8 @@
.alias MEMSTR $281
.alias MEMSIZ $283 ; NOTE: Mapping the 64 erroniously has the hex as $282, while the DEC is correct
.alias TIMOUT $285 ; IEEE-488 timeout
.alias HIBASE $288 ; high byte of start of screen
.alias RSSTAT $297 ; RS-232 status
+5
View File
@@ -0,0 +1,5 @@
;; BASIC startup vector
.alias IBASIC_COLD_START $A000
.alias IBASIC_WARM_START $A002
+5
View File
@@ -0,0 +1,5 @@
;; Cartridge ROM locations
.alias ICART_COLD_START $8000 ; $8000-$8001, cartridge cold start vector
.alias ICART_WARM_START $8002 ; $8002-$8003, cartridge warm start vector (RESTORE key)
.alias CART_SIG $8004 ; 5 bytes, signature for cartridge detection
+1 -1
View File
@@ -4,6 +4,6 @@
.macro TARGET_HOOK_BANNER
.byte $05, " OPEN ROMS, ", $00
.byte " OPEN ROMS, ", $00
.macend
@@ -4,6 +4,6 @@
.macro TARGET_HOOK_BANNER
.byte $05, " OPEN ROMS FOR ULTIMATE 64", $0D, $0D, " ", $00
.byte " OPEN ROMS FOR ULTIMATE 64", $0D, $0D, " ", $00
.macend
+1 -1
View File
@@ -20,7 +20,7 @@ print_string_loop:
lda (temp_string_ptr),y
beq print_string_end
jsr via_IBSOUT
jsr JCHROUT
txa
tay
+12 -4
View File
@@ -17,6 +17,14 @@ startup_banner:
`TARGET_HOOK_BANNER
;; Print PAL/NTSC
ldx #30 ; NTSC
lda PALNTSC
beq +
ldx #31 ; PAL
*
jsr print_packed_message
;; Work out free bytes, and display
jsr basic_do_new
lda basic_top_of_memory_ptr+0
@@ -26,10 +34,10 @@ startup_banner:
lda basic_top_of_memory_ptr+1
sbc basic_end_of_text_ptr+1
jsr print_integer
jsr print_integer
lda #$20
jsr via_IBSOUT
jsr JCHROUT
;; Print the rest of the start up message
ldx #34
@@ -37,8 +45,8 @@ startup_banner:
;; jump into warm start loop
jmp basic_warm_start
startup_message:
;; Clear the screen
.byte $93
+5 -5
View File
@@ -7,9 +7,9 @@ basic_do_error:
;; Print ? at start
lda #$0d
jsr via_IBSOUT
jsr JCHROUT
lda #$3f
jsr via_IBSOUT
jsr JCHROUT
;; Print main part of error message
pla
@@ -18,7 +18,7 @@ basic_do_error:
;; Print ERROR at end
lda #$20
jsr via_IBSOUT
jsr JCHROUT
ldx #33
jsr print_packed_message
@@ -27,9 +27,9 @@ basic_do_error:
;; XXX print line number if not in direct mode
lda #$0d
jsr via_IBSOUT
jsr JCHROUT
lda #$0d
jsr via_IBSOUT
jsr JCHROUT
;; Reset stack, and go back to main loop
ldx #$fe
+1 -1
View File
@@ -52,7 +52,7 @@ rsl_l1: lda $0200,x
*
;; Do printing of the new line
lda #$0d
jsr via_IBSOUT
jsr JCHROUT
;; Ignore empty lines
lda tokenise_work1
+1 -1
View File
@@ -17,7 +17,7 @@ basic_do_break:
*
lda #$0d
jsr via_IBSOUT
jsr JCHROUT
cmd_end:
jmp basic_main_loop
+4 -4
View File
@@ -42,7 +42,7 @@ list_single_line: ; entry point needed by DOS wedge
pla
jsr print_integer
lda #$20
jsr via_IBSOUT
jsr JCHROUT
;; Iterate through printing out the line
;; contents
@@ -111,16 +111,16 @@ list_not_rem:
bne list_print_loop
list_is_literal:
jsr via_IBSOUT
jsr JCHROUT
iny
bne list_print_loop
list_end_of_line:
;; Clear reverse flag
lda #$92
jsr via_IBSOUT
jsr JCHROUT
;; Print end of line
lda #$0d
jsr via_IBSOUT
jsr JCHROUT
rts
+3 -2
View File
@@ -191,6 +191,7 @@ end_of_line_search:
pla
sta basic_current_line_ptr+0
jmp basic_relink_loop
via_ILOAD:
jmp (ILOAD)
+1 -1
View File
@@ -115,7 +115,7 @@ found_start_of_number:
;; Print digits
* lda $0100,y
ora #$30
jsr via_IBSOUT
jsr JCHROUT
iny
cpy #5
bne -
+5 -5
View File
@@ -38,7 +38,7 @@ found_message_in_token_stream:
beq +
jsr print_packed_word
lda #$20
jsr via_IBSOUT
jsr JCHROUT
pla
tay
iny
@@ -47,7 +47,7 @@ found_message_in_token_stream:
pla
;; Rub out space at the end
lda #$14
jsr via_IBSOUT
jsr JCHROUT
rts
print_packed_word:
@@ -144,7 +144,7 @@ next_packed_word_char:
;; X=1-14 = first 14 chars, so subtract one
lda packed_message_chars-1,x
jsr via_IBSOUT
jsr JCHROUT
;; See if there is a char in the low nybl to print
pla
@@ -171,7 +171,7 @@ has_nybl:
;; X=1-14 = first 14 chars, so subtract one
lda packed_message_chars-1,x
jsr via_IBSOUT
jsr JCHROUT
*
pla
tay
@@ -207,7 +207,7 @@ unpack_literal_char:
tya
pha
lda (temp_string_ptr),y
jsr via_IBSOUT
jsr JCHROUT
pla
tay
rts
+3 -3
View File
@@ -112,7 +112,7 @@ not_hexword:
not_pointer:
;; Print character
jsr via_IBSOUT
jsr JCHROUT
printf_nextchar:
jsr printf_advance
@@ -148,11 +148,11 @@ printf_printhexbyte:
cmp #$3A
bcc +
adc #6
* jsr via_IBSOUT
* jsr JCHROUT
pla
and #$0f
ora #$30
cmp #$3A
bcc +
adc #6
* jmp via_IBSOUT
* jmp JCHROUT
-42
View File
@@ -1,42 +0,0 @@
;;
;; Helper routines for jumping via vectors, to be used with JSR
;;
;; Note: they are not in the order of low memory vectors, to avoid
;; similarity with the original ROMs
via_ISAVE:
jmp (ISAVE)
via_ILOAD:
jmp (ILOAD)
via_ICLOSE:
jmp (ICLOSE)
via_IOPEN:
jmp (IOPEN)
via_ICHKIN:
jmp (ICHKIN)
via_IBASIN:
jmp (IBASIN)
via_IGETIN:
jmp (IGETIN)
via_ICKOUT:
jmp (ICKOUT)
via_IBSOUT:
jmp (IBSOUT)
via_ICLRCH:
jmp (ICLRCH)
via_ICLALL:
jmp (ICLALL)
via_ISTOP:
jmp (ISTOP)
+15 -15
View File
@@ -4,7 +4,7 @@
wedge_dos:
;; Close all the channels, so that wedge has full control
jsr via_ICLALL
jsr JCLALL
;; Set file parameters, channel 15 is a typical one for commands
jsr select_device ; sets X register
@@ -41,11 +41,11 @@ wedge_dos_command:
jsr wedge_dos_setnam
jsr JSETNAM
jsr via_IOPEN
jsr JOPEN
bcs wedge_dos_basic_error
;; Retrieve status, print it if not OK
jsr via_ICLALL
jsr JCLALL
jsr wedge_dos_status_get
lda BUF+0
cmp #$30 ; '0'
@@ -82,12 +82,12 @@ wedge_dos_status_get:
;; Set remaining file parameters, open the channel
lda #$00 ; empty file name
jsr JSETNAM
jsr via_IOPEN
jsr JOPEN
bcs wedge_dos_basic_error
;; Set channel for input
ldx #$0F
jsr via_ICHKIN
jsr JCHKIN
bcs wedge_dos_basic_error
ldy #$00
@@ -98,7 +98,7 @@ wedge_dos_status_get:
;; XXX error in case of status != EOF
;; Print out everything retrieved from the drive
bne +
jsr via_IBASIN
jsr JCHRIN
bcs wedge_dos_basic_error
sta BUF, y
iny
@@ -118,7 +118,7 @@ wedge_dos_status_print:
dey
bmi +
lda BUF, x
jsr via_IBSOUT
jsr JCHROUT
inx
bne -
*
@@ -139,18 +139,18 @@ wedge_dos_directory:
jsr wedge_dos_setnam
;; Open the file
jsr via_IOPEN
jsr JOPEN
bcs wedge_dos_basic_error
;; Set channel for file reading
ldx #$00
jsr via_ICHKIN
jsr JCHKIN
bcs wedge_dos_basic_error
;; Ignore start address (2 first bytes) - XXX check for errors
jsr via_IBASIN
jsr JCHRIN
bcs wedge_dos_basic_error
jsr via_IBASIN
jsr JCHRIN
bcs wedge_dos_basic_error
wedge_dos_directory_line:
@@ -159,7 +159,7 @@ wedge_dos_directory_line:
ldy #$FF
*
iny
jsr via_IBASIN
jsr JCHRIN
bcs wedge_dos_basic_error
sta BUF, y
cpy #$50
@@ -199,15 +199,15 @@ wedge_dos_directory_display:
;; FALLTROUGH
wedge_dos_clean_exit:
jsr via_ICLALL
jsr JCLALL
;; Print new line
lda #$0D
jsr via_IBSOUT
jsr JCHROUT
jmp basic_end_of_line
wedge_dos_basic_error:
pha
jsr via_ICLALL
jsr JCLALL
pla
tax
dex
+4 -4
View File
@@ -3,13 +3,13 @@
cartridge_check:
ldx #$04
cartridge_check_l1:
lda $8002,x
lda CART_SIG,x
cmp cartridge_signature,x
bne no_cartridge
dex
bpl cartridge_check_l1
jmp ($8000)
cartridge_signature:
.byte $C3,$C2,$CD,$38,$30
sec
rts
no_cartridge:
clc
rts
+3
View File
@@ -0,0 +1,3 @@
cartridge_signature:
.byte $C3,$C2,$CD,$38,$30
@@ -11,7 +11,7 @@
;; CHKIN implementation
chkin:
chkin_real:
;; Store Y for preservation
tya
@@ -88,11 +88,9 @@ chkinout_file_not_output:
tay
jmp kernalerror_FILE_NOT_OUTPUT
chkinout_common:
;; CKOUT implementation
ckout:
ckout_real:
;; Store Y for preservation
tya
@@ -14,7 +14,7 @@
;; If from keyboard, then it gets a whole line of input, and returns the first char.
;; Repeated calls after that read out the successive bytes of the line of input.
chrin:
chrin_real:
;; Determine the device number
lda DFLTN
@@ -9,7 +9,7 @@
;;
chrout:
chrout_real:
sta last_printed_character_ascii
+11 -7
View File
@@ -10,8 +10,15 @@
cint:
cint_brk: ; entry for BRK and STOP+RESTORE - XXX, where should it start?
jsr setup_vicii
;; According to [CM64], this routine also checks for PAL/NTSC - this must be a mistake,
;; it's too late (IOINIT already needs this information), besides - POKE something
;; to address 678 on a real C64, press STOP+RESTORE - the value won't change
;; Initialise cursor blink flags (Compute's Mapping the 64 p215)
lda #$00
sta cursor_blink_disable
@@ -34,8 +41,8 @@ cint:
stx key_first_repeat_delay
;; Set current colour for text (Compute's Mapping the 64 p215)
ldx #$0e ; light blue by default
stx $0286
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)
ldx #10
@@ -45,9 +52,6 @@ cint:
;; 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)
jmp clear_screen
rts
@@ -9,7 +9,7 @@
;;
clall:
clall_real:
;; Store .Y register
tya
@@ -23,7 +23,7 @@ clall:
beq +
dey
lda LAT, y
jsr close ; XXX jump through ICLOSE?
jsr JCLOSE
jmp -
*
;; Restore .Y register
+23
View File
@@ -0,0 +1,23 @@
;; Common ppart of CLOSE and LOAD routines
close_load:
tax
;; Command drive to stop talking and to close the file
jsr untlk
txa
jsr listen
lda #$E0 ; CLOSE command
sta IEC_TMP2
jsr iec_tx_command
jsr iec_tx_command_finalize
;; Tell drive to unlisten
jsr unlsn
rts
@@ -9,7 +9,7 @@
;;
clrchn:
clrchn_real:
;; Handle IEC input device
lda DFLTN
+3 -4
View File
@@ -1,21 +1,20 @@
;; Clear screen and initialise line link table
;; (Compute's Mapping the 64 p215-216)
clear_screen:
clear_screen:
;; Clear line link table
;; (Compute's Mapping the 64 p215)
lda #$00
ldy #24
clearscreen_l1:
clearscreen_l1:
sta screen_line_link_table,y
dey
bpl clearscreen_l1
;; Y now = #$FF
;; Clear screen RAM.
;; We should do this at HIBASE, which annoyingly
;; is no ZP, so we need to make a vector
+12 -11
View File
@@ -1,19 +1,20 @@
setup_vicii:
setup_vicii:
;; Set up default IO values (Compute's Mapping the 64 p215)
lda #$1b ; Enable text mode
sta $d011
lda #$c8 ; 40 column etc
sta $d016
lda #$1B ; Enable text mode
sta VIC_SCROLY
lda #$C8 ; 40 column etc
sta VIC_SCROLX
;; Compute's Mapping the 64, p156
;; We use a different colour scheme of white text on all blue
lda #$06
sta $D020
sta $D021
sta VIC_EXTCOL
sta VIC_BGCOL0
;; Turn off sprites
;; (observed hanging around after running programs and resetting)
;; Turn off sprites (observed hanging around after running programs and resetting)
lda #$00
sta $D015
sta VIC_SPENA
;;FALLTROUGH
File renamed without changes.
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
+6
View File
@@ -0,0 +1,6 @@
;; Our implementation is longer than the original one,
;; placing it here would cause a collision with CHROUT
chrin:
jmp chrin_real
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
+6
View File
@@ -0,0 +1,6 @@
;; Our implementation is longer than the original one,
;; placing it here would cause a collision with CHKIN
chrout:
jmp chrout_real
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
+6
View File
@@ -0,0 +1,6 @@
;; In our implementation CHKIN and CKOUT are closely tied,
;; placing it here would cause a collision
chkin:
jmp chkin_real
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
+6
View File
@@ -0,0 +1,6 @@
;; In our implementation CHKIN and CKOUT are closely tied,
;; placing it here would cause a collision
ckout:
jmp ckout_real
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
@@ -26,14 +26,19 @@ close:
;; IEC device
jsr iec_tx_flush ; make sure no byte is awaiting
*
lda SAT, y ; get secondary address
cmp #$60
bne +
;; workaround for using CLOSE on reading executable - XXX is this a proper way?
jsr close_load
jmp close_remove_from_table
*
ora $E0 ; CLOSE command
sta IEC_TMP2
jsr iec_tx_command
bcs close_remove_from_table
jsr iec_tx_command_finalize
close_remove_from_table:
;; Remove channel from the table
iny
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
+6
View File
@@ -0,0 +1,6 @@
;; Our implementation is longer than the original one,
;; placing it here would cause a collision with CLRCHN
clall:
jmp clall_real
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
+6
View File
@@ -0,0 +1,6 @@
;; Our implementation is longer than the original one,
;; placing it here would cause a collision with OPEN
clrchn:
jmp clrchn_real
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
File renamed without changes.
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
+1 -12
View File
@@ -125,19 +125,8 @@ load_loop:
;; Close file on drive
;; Command drive to stop talking and to close the file
jsr untlk
lda current_device_number
jsr listen
lda #$E0
sta IEC_TMP2
jsr iec_tx_command
jsr iec_tx_command_finalize
;; Tell drive to unlisten
jsr unlsn
jsr close_load
;; Return last address
jmp lvs_return_last_address
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
File renamed without changes.
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
+1 -2
View File
@@ -14,8 +14,7 @@ stop:
;; BASIC checks carry flag to indicate STOP or not
lda STKEY
and #$80
beq stop_pressed
bpl stop_pressed
;; By trial and error, we know that Z + C = BREAK
;; and that neither should be set otherwise
+84 -25
View File
@@ -15,40 +15,99 @@ ioinit:
; (https://www.c64-wiki.com/wiki/Zeropage)
;; XXX - Work around VICE bug: Writing $00 before $01 results in rubbish in $01
;; after. https://sourceforge.net/p/vice-emu/bugs/1057/
LDA #$27
LDX #$2F
STA $01
STX $00
lda #$27
ldx #$2F
sta CPU_R6510
stx CPU_D6510
;; Enable CIA1 IRQ and ~50Hz timer
;; (https://csdb.dk/forums/?roomid=11&topicid=69037)
lda #$7f
sta $DC0D ; First disable all
;; Silence the SID chips
ldy #$00
*
lda SID_SIGVOL, Y
and #$F0
sta SID_SIGVOL, Y
tya
clc
adc #$20
tay
cpy #$80 ; $20 * amount of chips to silence, $80 to silence 4 chips
bne -
;; 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
ioinit_w0:
lda VIC_RASTER
ioinit_w1:
cmp VIC_RASTER
beq ioinit_w1
bmi ioinit_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 ioinit_pal
ioinit_ntsc:
lda #$00
beq +
ioinit_pal:
lda #$01
*
sta PALNTSC
;; XXX: calibrate TOD for both CIA's, see here: https://codebase64.org/doku.php?id=base:efficient_tod_initialisation
;; Enable CIA1 IRQ and ~50Hz timer (https://csdb.dk/forums/?roomid=11&topicid=69037)
lda #$7F
sta CIA1_ICR ; disable all
;; Set timer interval to ~1/60th of a second
;; (This value was calculated by running a custom IRQ haandler on a C64
;; (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)
lda #<16380
sta $dc04
lda #>16380
sta $dc05
;; 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
lda PALNTSC
bne +
;; 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
;; Store the IRQ timing constant to CIA chip
*
sty CIA1_TIMALO
stx CIA1_TIMAHI
;; Enable timer interrupt
lda #$81
sta $dc0d
sta CIA1_ICR
;; Enable timer A to run continuously
;; (http://codebase64.org/doku.php?id=base:timerinterrupts)
;; Enable timer A to run continuously (http://codebase64.org/doku.php?id=base:timerinterrupts)
lda #$11
sta $dc0e
lda $dc0d
sta CIA1_CRA
lda CIA1_ICR
;; Set DDR on CIA2 for IEC bus, VIC-II banking
lda #$3b
sta $dd02
;; Set IEC bus oto its initial idle state
jsr iec_set_idle
rts
lda #$3B
sta CIA2_DDRA
;; Set IEC bus to its initial idle state
jmp iec_set_idle
+1
View File
@@ -0,0 +1 @@
Byte telling Kernal version; we can probably put just about anything here, but we want to be distinct from everyone else!
+31
View File
@@ -0,0 +1,31 @@
;;
;; This byte identifies Kernal revision. Sources:
;; - [CM64] Compute's Mapping the Commodore 64 (page 242/243)
;; - [MM] Marko Mäkelä article, http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c64/revisions.txt
;; - [VICE] Checked with ROMs included in VICE emulator
;;
;; IDEA: put here a value, that is different from any version currently known, as
;; a warning that this is not a Commodore Kernal. Currently known numbers for C64 are:
;;
;; - $00 - [CM64] then current number [MM] 901227-02 [VICE] C64 Revision 2
;; - $03 - [CM64] (not mentionned) [MM] 901227-02, 901227-03 [VICE] C64 Revision 3
;; - $43 - [CM64] (not mentionned) [MM] 251104-04 [VICE] SX-64
;; - $64 - [CM64] PET64 ROM [MM] (not mentionned) [VICE] PET64
;; - $AA - [CM64] first version of ROM [MM] 901227-01 [VICE] C64 Revision 1
;;
;; Values from unofficial ROMs:
;; - $03 - SuperCPU ROM 1.40, 2.04, also unofficial 0.7 ROM from [VICE]
;;
;; Values from other Commodore machines:
;; C128:
;; - $01 - see https://www.pagetable.com/?p=1058
;; - $02 - unreleased updated ROM, see https://www.pagetable.com/?p=1058
;;
;; XXX check more unofficial C64 ROMs (JiffyDOS, DolphinDOS, etc.) and other machines
;; VIC-20, PET, CBM II, 264 series, C65 prototypes, other sources for C128 ROMs
;;
kernal_revision:
.byte $FF
+1 -1
View File
@@ -6,7 +6,7 @@ iec_wait20us:
;; PAL:
;; - CPU frequency 0.985248 MHz, we need to waste at least 20 cycles
;; NTSC:
;; - CPU frequency 1.022727 MHZ, we need to waste at least 21 cycles
;; - CPU frequency 1.022727 MHz, we need to waste at least 21 cycles
;; Waste cycles by reading some unimportant memory location
;; in order not to clutter VICE debug logs
+1 -1
View File
@@ -6,7 +6,7 @@ iec_wait60us:
;; PAL:
;; - CPU frequency 0.985248 MHz, we need to waste at least 60 cycles
;; NTSC:
;; - CPU frequency 1.022727 MHZ, we need to waste at least 62 cycles
;; - CPU frequency 1.022727 MHz, we need to waste at least 62 cycles
;; Waste cycles in a loop
@@ -1,7 +1,9 @@
default_irq_handler:
jsr blink_cursor
jsr scan_keyboard
jsr JSCNKEY
jsr JUDTIM ; update jiffy clock
;; Acknowledge CIA interrupt and return
jmp clear_cia1_interrupt_flag_and_return_from_interrupt
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
File renamed without changes.
@@ -0,0 +1,30 @@
default_nmi_handler:
;; Implemented according to Compute's Mapping the Commodore 64, page 74
;; and to https://www.c64-wiki.com/wiki/Interrupt
;; Save registers, sequence according to Compute's Mapping the Commodore 64, page 73
pha
txa
pha
tya
pha
;; XXX: RS-232 support is not implemented
;; XXX confirm NMIs from CIA, or no other NMI will arrive!
jsr cartridge_check
bcc +
jmp (ICART_WARM_START)
*
;; According to C64 Wiki, if STOP key is pressed, the routine assumes warm start request
jsr JSTOP
bcs +
jmp return_from_interrupt ; no STOP pressed
*
jmp (CBINV) ; STOP + RESTORE
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
@@ -0,0 +1,15 @@
default_brk_handler:
;; Implemented according to Compute's Mapping the Commodore 64, pages 73-74
sei ; disable IRQs, to be sure they won't interfere
jsr JRESTOR
jsr JIOINIT
jsr CINT_BRK
cli
jmp (IBASIC_WARM_START)
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
@@ -1,3 +1,4 @@
irq_handler:
;; The IRQ is a commonly messed with thing on the C64,
;; so we need to handle entry points that are commonly
@@ -7,17 +8,32 @@ irq_handler:
;; $EA81 - https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb
;; Also the $0314 vector is widely used (e.g., https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb)
;; Save registers
;; Sequence according to Compute's Mapping the 64 p73
;; Save registers, sequence according to Compute's Mapping the Commodore 64, page 73
pha
txa
pha
tya
pha
;; Call interrupt routine
;; (but only if initialised)
;; Check if caused by BRK
;; XXX disabled for now - resets Duotris game, unknown why
; tsx
; lda $0104, x ; get the pre-interrupt processor state
; and #$10
; bne irq_handler_brk
;; Not caused by BRK - call interrupt routine (only if initialised)
lda CINV
ora CINV+1
beq default_irq_handler
beq +
jmp (CINV)
*
;; Vector not initialized - call default interrupt routine
jmp default_irq_handler
irq_handler_brk:
;; Interrupt caused by BRK
jmp (CBINV)
+18
View File
@@ -0,0 +1,18 @@
nmi_handler:
sei ;; don't allow IRQ to interfere, see https://www.c64-wiki.com/wiki/Interrupt
;; Call interrupt routine (only if initialised)
pha
lda NMINV
ora NMINV+1
beq +
pla
jmp (NMINV)
*
;; Vector not initialized - call default interrupt routine
pla
jmp default_nmi_handler
+1 -1
View File
@@ -1,3 +1,3 @@
; Scan keyboard
; C64 Programmer's Reference Guide Page 273
jmp scan_keyboard
jmp SCNKEY
+2 -1
View File
@@ -1,3 +1,4 @@
; open a logical file
; C64 Programmer's Reference Guide Page 272
jmp open
; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (IOPEN)
+2 -1
View File
@@ -1,3 +1,4 @@
; close a specified logical file
; C64 Programmer's Reference Guide Page 272
jmp close
; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (ICLOSE)
+2 -1
View File
@@ -1,3 +1,4 @@
; Open channel for input
; C64 Programmer's Reference Guide Page 272
jmp chkin
; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (ICHKIN)
+2 -1
View File
@@ -1,3 +1,4 @@
; Open channel for output
; C64 Programmer's Reference Guide Page 272
jmp ckout
; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (ICKOUT)
+2 -1
View File
@@ -1,3 +1,4 @@
; close input and output channels
; C64 Programmer's Reference Guide Page 272
jmp clrchn
; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (ICLRCH)
+2 -1
View File
@@ -1,3 +1,4 @@
; Input character from channel
; C64 Programmer's Reference Guide Page 272
jmp chrin
; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (IBASIN)
+2 -1
View File
@@ -1,3 +1,4 @@
; Output character to channel
; C64 Programmer's Reference Guide Page 272
jmp chrout
; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (IBSOUT)
+2 -1
View File
@@ -1,3 +1,4 @@
; Scan stop key
; C64 Programmer's Reference Guide Page 273
jmp stop
; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (ISTOP)
+2 -1
View File
@@ -1,3 +1,4 @@
; Get character from keyboard queue (keyboard buffer)
; C64 Programmer's Reference Guide Page 272
jmp getin
; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (IGETIN)
+2 -1
View File
@@ -1,3 +1,4 @@
; $FFE7 - Close all files vector
; (http://codebase64.org/doku.php?id=base:kernalreference)
jmp clall
; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (ICLALL)
+1 -1
View File
@@ -1,4 +1,4 @@
; $FFEA - Update jiffy clock vector
; (http://codebase64.org/doku.php?id=base:kernalreference)
jmp update_jiffy_clock
jmp UDTIM
-3
View File
@@ -1,3 +0,0 @@
nmi_handler:
inc $D020
rti
+21 -9
View File
@@ -11,24 +11,36 @@ reset_entry:
txs
sei
; C64 PRG p269
jsr cartridge_check
; The following routine is based on reading the public KERNAL jumptable routine
; list, and making unimaginative assumptions about what should be done on reset.
; Initialising IO is obviously required. also indicated by c64 prg p269.
jsr ioinit
; According to example here: https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image
; the cartridge does not call RAMTAS - despite it's obviously required. So, call RAMTAS
; before the cartridge check/takeover
; Setting up the screen and testing ram is obviously required
; also affirmed by p269 of c64 prg
jsr ramtas
jsr RAMTAS
; C64 PRG p269
jsr cartridge_check
bcc +
jmp (ICART_COLD_START)
*
; Initialising IO is obviously required. Also indicated by c64 prg p269.
; Has to be after ther RAMTAS, as it clears memory, including the PAL/NTSC flag,
; which is set by IOINIT
jsr IOINIT
; Resetting IO vectors is obviously required, if we want interrupts to run
; also affirmed by c64 prg p269
jsr restor
jsr RESTOR
;; "Compute's Mapping the 64" p236
jsr cint
jsr CINT
; What do we do when finished? A C64 jumps into the BASIC ROM
cli ; Allow interrupts to happen
; c64 prg p269
jmp ($a000)
jmp (IBASIC_COLD_START)
@@ -69,7 +69,7 @@
;// Operational Variables
.alias MaxKeyRollover 3
scan_keyboard:
scnkey:
lda #$00
sta BufferQuantity
@@ -204,12 +204,16 @@ ReturnNoKeys:
NoActivityDetected:
;; Cancel STKEY status
lda #$FF
sta STKEY ; XXX this variable should be set by UDTIM
;; So cancel all bucky keys
lda key_bucky_state
sta key_last_bucky_state
lda #$00
sta key_bucky_state
jmp ReturnNoKeys
;; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -334,7 +338,7 @@ next_row:
;; so that RUN/STOP etc can be checked easily
;; (Compute's Mapping the 64, p27)
lda ScanResult+0
sta STKEY
sta STKEY ; XXX this variable should be set by UDTIM
;; Store de-bounce data for bucky keys
;; (Compute's Mapping the 64, p58-59)
@@ -538,5 +542,3 @@ KeyCanRepeat:
KeyRepeatWait:
pla
jmp ConsiderNextKey
+1
View File
@@ -9,4 +9,5 @@
;;
settmo:
sta TIMOUT
rts
@@ -8,5 +8,5 @@
;; CPU registers that has to be preserved (see [RG64]): .Y
;;
update_jiffy_clock:
udtim:
rts
+7 -25
View File
@@ -20,8 +20,10 @@ vector:
.scope
;; Temporary storage location
.alias _caller_arr_ptr CMP0
;; Temporary storage location - checked on real C64 that this is the
;; address originally used; after calling VECTOR and checking zero page
;; area afterwards, the address could be found there
.alias _caller_arr_ptr MEMUS
;; According to 'Compute's Mapping the Commodore 64' page 237,
;; the CBM implementation does not disable IRQs - yet, the
@@ -32,9 +34,10 @@ vector:
php
cli
;; Prepare the user data pointer
stx _caller_arr_ptr + 0
;; Prepare the user data pointer - strange order to reduce risk
;; of potential similarity to the original routine
sty _caller_arr_ptr + 1
stx _caller_arr_ptr + 0
;; Select routine variant - store or restore vectors
ldy #$1F
@@ -65,24 +68,3 @@ vector_restore:
rts
.scend
;; XXX below we have quite a lot of data... should we decouple them?
vector_defaults:
.word default_irq_handler ;; CINV
.word $0000 ;; CBINV XXX implement this
.word $0000 ;; NMINV XXX implement this
.word open ;; IOPEN
.word close ;; ICLOSE
.word chkin ;; ICHKIN
.word ckout ;; ICKOUT
.word clrchn ;; ICLRCH
.word chrin ;; IBASIN
.word chrout ;; IBSOUT
.word stop ;; ISTOP
.word getin ;; IGETIN
.word clall ;; ICLALL
.word $0000 ;; USRCMD XXX implement this
.word load ;; ILOAD
.word save ;; ISAVE
+26
View File
@@ -0,0 +1,26 @@
;;
;; Default values for Kernal vectors - described in:
;;
;; - [RG64] C64 Programmer's Reference Guide - page 293 (RESTOR), 304 (VECTOR)
;; - [CM64] Compute's Mapping the Commodore 64 - page 237
;;
vector_defaults:
.word default_irq_handler ;; CINV
.word default_brk_handler ;; CBINV
.word default_nmi_handler ;; NMINV
.word open ;; IOPEN
.word close ;; ICLOSE
.word chkin ;; ICHKIN
.word ckout ;; ICKOUT
.word clrchn ;; ICLRCH
.word chrin ;; IBASIN
.word chrout ;; IBSOUT
.word stop ;; ISTOP
.word getin ;; IGETIN
.word clall ;; ICLALL
.word default_brk_handler ;; USRCMD
.word load ;; ILOAD
.word save ;; ISAVE
+9 -4
View File
@@ -159,15 +159,20 @@ char *error_list[]={
"LOAD", // https://www.discogs.com/Gimmik-Load-Error/release/482462
// Non-error messages
"READY.\r", // #29 // https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconc_whatistsonative.htm https://github.com/stefanhaustein/expressionparser
"LOADING", // #30 // https://community.tibco.com/wiki/how-show-loading-prompt-when-reloading-external-data
"VERIFYING", // https://discussions.apple.com/thread/8087203
"SAVING",
"NTSC, ", // #30
"PAL, ", // #31
"", // unused for now
"ERROR", // #33 // Simply the word error that is attached to the other parts of messages https://fjkraan.home.xs4all.nl/comp/apple2faq/app2asoftfaq.html
"BYTES FREE.\r\r", // #34 // https://github.com/stefanhaustein/expressionparser
"BYTES FREE\r\r", // #34 // https://github.com/stefanhaustein/expressionparser
"MEMORY CORRUPT", // #35
"NOT IMPLEMENTED", // #36
NULL};
// XXX: create separate list for Kernal
// "LOADING", // #30 // https://community.tibco.com/wiki/how-show-loading-prompt-when-reloading-external-data
// "VERIFYING", // https://discussions.apple.com/thread/8087203
// "SAVING",
// Token $FF is end of message, so we can have only 255 unique words
#define MAX_WORDS 255
char *words[MAX_WORDS];
+3
View File
@@ -0,0 +1,3 @@
$01 + STA $02A6 (PAL/NTSC flag)
Instruction and a part (storing data into a decumented variable). Not copyrightable.
+3
View File
@@ -0,0 +1,3 @@
$02 + LDA #$01 + STA (address does not match)
Instruction + some parts. Not copyrightable.
+3
View File
@@ -0,0 +1,3 @@
$02 + LDA #$7F + STA (address does not match)
Instruction + some parts. Not copyrightable.
+3
View File
@@ -0,0 +1,3 @@
$03 + JMP $F409
Instruction + some part. Not copyrightable.
Loaded 100 of 128 files, more files were not shown because too many files have changed in this diff. Show more