migrated to ACME assembler
commit 145d64aa6e78838ed07cefed372f0ad6a4687e97 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 20:16:57 2020 +0200 ACME adaptation commit 885209d7822286744ea53232ae7461472a01d5d6 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 19:57:25 2020 +0200 ACME adaptation commit 334d84486bc603551887e7cbeb59d329f2224cc7 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 18:29:15 2020 +0200 ACME adaptation commit b5966f49bcd8f0ca79cbec93819a31238924707e Author: FeralChild64 <you@example.com> Date: Sun Sep 20 18:09:31 2020 +0200 ACME adaptation commit 786536a93a5eab5e676fca99625b4eb094a554e7 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 17:24:48 2020 +0200 ACME adaptation commit 704c70dfb1f5d68775d6f3da220803b8a3990f56 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 15:07:12 2020 +0200 ACME adaptation commit 136874964c9083b375f151475310f9636871fc72 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 14:45:14 2020 +0200 ACME adaptation commit 8eca0d5700b72d04336e72c5cd3a68e18b85f96d Author: FeralChild64 <you@example.com> Date: Sun Sep 20 14:06:52 2020 +0200 ACME adaptation commit 11d29eb7ee318239d782f85498b6d0524624d5c4 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 13:56:45 2020 +0200 ACME apaptation commit c9b5e5e04cceb92c66bc027e6440bc0f7c5a499f Author: FeralChild64 <you@example.com> Date: Sun Sep 20 13:49:04 2020 +0200 ACME adaptation commit f5cc254cbc921f07863807468cb3fe26b410b409 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 13:01:18 2020 +0200 ACME adaptation commit e135a27bf9c30cc0965379c954564e06406303b1 Author: FeralChild64 <you@example.com> Date: Sat Sep 19 21:55:01 2020 +0200 ACME adaptation commit e9dfddf90d9e2795e88b7da40ae050d733faeb56 Author: FeralChild64 <you@example.com> Date: Sat Sep 19 21:48:47 2020 +0200 Makefile fix commit 07030104c65cf5e5beeacf6d629ccb9245e58657 Author: FeralChild64 <you@example.com> Date: Sat Sep 19 21:42:00 2020 +0200 ACME adaptation commit f824362ee5bcfbffca86c430b57773b2ffd65655 Author: FeralChild64 <you@example.com> Date: Sat Sep 19 20:14:56 2020 +0200 ACME adaptation commit 3a3c59007dcd4940d89b8669f34ca56b61c25fdf Author: FeralChild64 <you@example.com> Date: Fri Sep 18 21:51:45 2020 +0200 ACME adaptation commit 6790ef7bc88a41de2881c69b7524dd4ab8c74b5d Author: FeralChild64 <you@example.com> Date: Fri Sep 18 20:35:23 2020 +0200 ACME adaptation commit 38ad18b90e9ec713aa7ca49576b3388ce1733357 Author: FeralChild64 <you@example.com> Date: Fri Sep 18 18:46:20 2020 +0200 ACME adaptation commit 541340371122a9702f7b2d9771c298223cffd0e9 Author: FeralChild64 <you@example.com> Date: Fri Sep 18 16:49:46 2020 +0200 ACME adaptation commit 25cfd5e186459be1a260d3eb8cfff767838de370 Author: FeralChild64 <you@example.com> Date: Thu Sep 17 20:13:33 2020 +0200 ACME adaptation commit f61599444d5b1d03d8fd8e4a6a7c3b85069bedb3 Author: FeralChild64 <you@example.com> Date: Thu Sep 17 19:29:23 2020 +0200 ACME adaptation commit b290be31ec7bb2e5723607697da1bbc621c84429 Author: FeralChild64 <you@example.com> Date: Thu Sep 17 17:20:14 2020 +0200 ACME adaptation commit 877be9e856880d98fd4bcb25b42aaaacda9dc463 Author: FeralChild64 <you@example.com> Date: Wed Sep 16 21:47:38 2020 +0200 ACME adaptation commit bb20edaf85d386e41d5c2f715b745b68fbd3362e Author: FeralChild64 <you@example.com> Date: Wed Sep 16 21:31:30 2020 +0200 ACME adaptation commit c5d31bd8685abce37c8e254d15aac20bd1570d9f Author: FeralChild64 <you@example.com> Date: Wed Sep 16 18:40:49 2020 +0200 ACME adaptation commit 29349826b38f8a89649171559dc8cf24c560aff1 Author: FeralChild64 <you@example.com> Date: Mon Sep 14 23:35:47 2020 +0200 ACME adaptation commit 8bcd6a621c4b11766d0cf34f79858ba90a67248e Author: FeralChild64 <you@example.com> Date: Mon Sep 14 22:52:25 2020 +0200 ACME adaptation commit e87a69edc2ce4bfcc460c31e08dcc352a985f88d Author: FeralChild64 <you@example.com> Date: Mon Sep 14 22:43:27 2020 +0200 ACME adaptation commit f49a097bd52e96d00b866c02bda7121e4543233c Author: FeralChild64 <you@example.com> Date: Mon Sep 14 19:02:07 2020 +0200 ACME adaptation commit fa0e9214a633b8e8f867cc70925b390940dcd426 Author: FeralChild64 <you@example.com> Date: Mon Sep 14 17:47:19 2020 +0200 ACME adaptation commit 1b763b91e7a03e426227129c7f22f0ce57a4c197 Author: FeralChild64 <you@example.com> Date: Mon Sep 14 17:17:10 2020 +0200 ACME adaptation commit e92a4b57b232cd85eb1e71090b8a89c7c8461ebc Author: FeralChild64 <you@example.com> Date: Mon Sep 14 17:15:37 2020 +0200 ACME adaptation commit de3c693e8a7e73ea5289198946058e3240894e6a Author: FeralChild64 <you@example.com> Date: Mon Sep 14 17:10:05 2020 +0200 ACME adaptation commit f9bd7ae0f04e932d613be9ed5cb19af9be5d338e Author: FeralChild64 <you@example.com> Date: Sun Sep 13 14:34:44 2020 +0200 ACME adaptation commit 694dee52555dbfc2b1f7f452a9671ff51106c057 Author: FeralChild64 <you@example.com> Date: Sun Sep 13 14:16:14 2020 +0200 ACME adaptation commit 0af2c55edfcd22942d9f25417eb0d35f55b71604 Author: FeralChild64 <you@example.com> Date: Fri Sep 11 17:38:09 2020 +0200 ACME adaptation commit 2015e17334bd56a1e8a13a5abc098d9c2e7ea44f Author: FeralChild64 <you@example.com> Date: Fri Sep 11 16:46:05 2020 +0200 ACME adaptation commit b1e972162798d60f4483cd6cc261e856c20c2c8c Author: FeralChild64 <you@example.com> Date: Fri Sep 11 16:24:31 2020 +0200 ACME adaptation commit 9d027e868466901ba53bf074a79ec8cf16273021 Author: FeralChild64 <you@example.com> Date: Fri Sep 11 15:04:31 2020 +0200 ACME adaptation commit 957186deddd1aa4f3b4f1aa1f421e4239a584e57 Author: FeralChild64 <you@example.com> Date: Thu Sep 10 22:49:07 2020 +0200 ACME adaptation commit b8060f67a455cfac109f08d96b62c360d693b931 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 23:07:28 2020 +0200 ACME adaptation commit e54d004568f44bbfe5c070ef1d7cf3544112e497 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 22:58:20 2020 +0200 ACME adaptation commit f90b77f073c5a605cb31c6ee451f65c8a8aff7d8 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 22:12:09 2020 +0200 ACME adaptation commit b211bb4afcd9c58fe1f5c92f3007717d611cd531 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 22:01:40 2020 +0200 ACME adaptation commit 8d7ea343b07e9e08e5f77f3c414758a6cffd0440 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 21:38:34 2020 +0200 ACME adaptation commit 46413eb0d92d6400aba0ff8dfe556e61e8a44d78 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 21:07:47 2020 +0200 ACME adaptation commit 9f98f69ecc21f7b74a5eb89e247f5a2c6fcb655d Author: FeralChild64 <you@example.com> Date: Wed Sep 9 20:05:03 2020 +0200 ACME adaptation commit 7bb9f1cadc682c7e0a4a6796739d860d473ca110 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 19:55:12 2020 +0200 ACME adaptation commit 5fc115392b5bdca6b56f67ad866b1884d2d2bdf8 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 19:31:10 2020 +0200 ACME adaptation commit b7940fc60e568d859df9e3156f6bacc6d685b2cc Author: FeralChild64 <you@example.com> Date: Wed Sep 9 19:16:09 2020 +0200 ACME adaptation commit 56288cb97197561afa0816b29c134ec1190e8eab Author: FeralChild64 <you@example.com> Date: Wed Sep 9 18:48:23 2020 +0200 ACME adaptation commit 10401a60fc7922a53d782120ef6795d889140218 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 16:34:16 2020 +0200 ACME adaptation commit 8ce76e4d2b56837a691ae84b1a412a2ae32a157b Author: FeralChild64 <you@example.com> Date: Wed Sep 9 16:20:44 2020 +0200 ACME adaptation commit 33fade899fa6172ea6b5b5f6683bb61f544429fd Author: FeralChild64 <you@example.com> Date: Wed Sep 9 15:28:46 2020 +0200 ACME adaptation commit a416f04734402fcfbc57a933731376df2e0180a1 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 12:40:03 2020 +0200 ACME adaptation commit f8daee005b1d29f6912723be2ac94bc5fbeb0508 Author: FeralChild64 <you@example.com> Date: Mon Sep 7 23:29:54 2020 +0200 ACME adaptation commit 83fe6bdd0b08a44fdbfc6eefe323a4b194ccaf5b Author: FeralChild64 <you@example.com> Date: Mon Sep 7 22:23:16 2020 +0200 ACME adaptation commit cb1f75620b9c83000a15c9c7f7acefdfee79a979 Author: FeralChild64 <you@example.com> Date: Mon Sep 7 19:23:12 2020 +0200 ACME adaptation commit e524d517c933ae1f0aeb49764d307fadb4845025 Author: FeralChild64 <you@example.com> Date: Sun Sep 6 08:24:25 2020 +0200 ACME adaptation - replaced comments commit 2ab572c3a21f4a78a7312d0e684bc11d91d1717a Author: FeralChild64 <you@example.com> Date: Sat Sep 5 17:59:10 2020 +0200 ACME adaptation - replaced the assembler
This commit is contained in:
1 parent
bfc8291e41
commit
c8d255130c
685 files changed
+15835
-16296
No files matched your search
@@ -1,37 +1,37 @@
|
||||
|
||||
// Registers according to Ultimate 64 Command Interface description,
|
||||
// https://1541u-documentation.readthedocs.io/en/latest/command%20interface.html
|
||||
// and ultimate_dos_v1.0.pdf and command_interface_v1.0.pdf by Gideon Zweijtzer
|
||||
; Registers according to Ultimate 64 Command Interface description,
|
||||
; https://1541u-documentation.readthedocs.io/en/latest/command%20interface.html
|
||||
; and ultimate_dos_v1.0.pdf and command_interface_v1.0.pdf by Gideon Zweijtzer
|
||||
|
||||
// Command interface registers
|
||||
.label U64_CONTROL_STATUS = $DF1C // write = CONTROL, read = STATUS
|
||||
.label U64_COMMAND_DATA_IDENTIFY = $DF1D // write = COMMAND_DATA, read = IDENTIFICATION
|
||||
.label U64_RESPONSE_DATA = $DF1E // read only
|
||||
.label U64_STATUS_DATA = $DF1F // read only
|
||||
; Command interface registers
|
||||
.label U64_CONTROL_STATUS = $DF1C ; write = CONTROL, read = STATUS
|
||||
.label U64_COMMAND_DATA_IDENTIFY = $DF1D ; write = COMMAND_DATA, read = IDENTIFICATION
|
||||
.label U64_RESPONSE_DATA = $DF1E ; read only
|
||||
.label U64_STATUS_DATA = $DF1F ; read only
|
||||
|
||||
// Constant for U64_IDENTIFICATION register
|
||||
; Constant for U64_IDENTIFICATION register
|
||||
.const U64_MAGIC_ID = $C9
|
||||
|
||||
// Constants for U64_CONTROL register
|
||||
; Constants for U64_CONTROL register
|
||||
.const U64_CTRL_BIT_PUSH_CMD = $01
|
||||
.const U64_CTRL_BIT_DATA_ACC = $02
|
||||
.const U64_CTRL_BIT_ABORT = $04
|
||||
.const U64_CTRL_BIT_CLR_ERR = $08
|
||||
|
||||
// Constants for U64_STATUS register
|
||||
; Constants for U64_STATUS register
|
||||
.const U64_STAT_BIT_CMD_BUSY = $01
|
||||
.const U64_STAT_BIT_DATA_ACC = $02
|
||||
.const U64_STAT_BIT_ABORT_P = $04
|
||||
.const U64_STAT_BIT_ERROR = $08
|
||||
.const U64_STAT_MASK_STATE = $30 // two bits!
|
||||
.const U64_STAT_MASK_STATE = $30 ; two bits!
|
||||
.const U64_STAT_BIT_STAT_AV = $40
|
||||
.const U64_STAT_BIT_DATA_AV = $80
|
||||
|
||||
// Interface targets
|
||||
; Interface targets
|
||||
.const U64_TARGET_DOS1 = $01
|
||||
.const U64_TARGET_DOS2 = $02
|
||||
|
||||
// DOS command codes
|
||||
; DOS command codes
|
||||
.const U64_DOS_CMD_IDENTIFY = $01
|
||||
.const U64_DOS_CMD_OPEN_FILE = $02
|
||||
.const U64_DOS_CMD_CLOSE_FILE = $03
|
||||
@@ -48,7 +48,7 @@
|
||||
.const U64_DOS_CMD_SAVE_REU = $22
|
||||
.const U64_DOS_CMD_ECHO = $F0
|
||||
|
||||
// DOS file opening constants
|
||||
; DOS file opening constants
|
||||
.const U64_FA_READ = $01
|
||||
.const U64_FA_WRITE = $02
|
||||
.const U64_FA_CREATE_NEW = $03
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// LOAD routine hook for fast loading via UltiDOS
|
||||
//
|
||||
;
|
||||
; LOAD routine hook for fast loading via UltiDOS
|
||||
;
|
||||
|
||||
|
||||
u64_load:
|
||||
|
||||
// First check whether the command interface is enabled
|
||||
; First check whether the command interface is enabled
|
||||
lda U64_IDENTIFICATION
|
||||
cmp #U64_MAGIC_ID
|
||||
beq !+
|
||||
@@ -17,22 +17,22 @@ u64_load:
|
||||
u64_load_skip:
|
||||
rts
|
||||
!:
|
||||
// XXX find out which device number softIEC is mapped to
|
||||
; XXX find out which device number softIEC is mapped to
|
||||
lda current_device_number
|
||||
cmp #$20 // for now use device number 32
|
||||
cmp #$20 ; for now use device number 32
|
||||
bne u64_load_skip
|
||||
|
||||
// Takeover the flow completely
|
||||
; Takeover the flow completely
|
||||
pla
|
||||
pla
|
||||
|
||||
// Display SEARCHING FOR + filename
|
||||
; Display SEARCHING FOR + filename
|
||||
jsr lvs_display_searching_for
|
||||
|
||||
// Whatever the interface was doing - ask to abort it
|
||||
; Whatever the interface was doing - ask to abort it
|
||||
jsr u64_load_abort
|
||||
|
||||
// Send a command to open the file
|
||||
; Send a command to open the file
|
||||
lda #U64_DOS_CMD_OPEN_FILE
|
||||
jsr u64_load_send_cmd
|
||||
lda #U64_FA_READ
|
||||
@@ -40,13 +40,13 @@ u64_load_skip:
|
||||
jsr u64_load_send_filename
|
||||
jsr u64_load_finalize_cmd
|
||||
|
||||
// Check status
|
||||
; Check status
|
||||
jsr u64_load_check_status
|
||||
bcs lvs_file_not_found_error
|
||||
|
||||
// Load first two bytes to determine start address
|
||||
; Load first two bytes to determine start address
|
||||
|
||||
// XXX
|
||||
; XXX
|
||||
|
||||
jsr printf
|
||||
.text "DBG: NOT IMPLEMENTED"
|
||||
@@ -66,8 +66,8 @@ u64_load_abort:
|
||||
u64_load_send_cmd:
|
||||
|
||||
ldx #U64_TARGET_DOS2
|
||||
stx U64_COMMAND_DATA // target
|
||||
sta U64_COMMAND_DATA // command code
|
||||
stx U64_COMMAND_DATA ; target
|
||||
sta U64_COMMAND_DATA ; command code
|
||||
rts
|
||||
|
||||
u64_load_send_filename:
|
||||
@@ -85,10 +85,10 @@ u64_load_send_filename_loop:
|
||||
jmp u64_load_send_filename_loop
|
||||
|
||||
u64_load_finalize_cmd:
|
||||
// Push the command for execution
|
||||
; Push the command for execution
|
||||
lda #U64_CTRL_BIT_PUSH_CMD
|
||||
sta U64_CONTROL
|
||||
// Wait till it is complete
|
||||
; Wait till it is complete
|
||||
!:
|
||||
lda U64_STATUS
|
||||
and #U64_STAT_BIT_CMD_BUSY
|
||||
@@ -96,39 +96,39 @@ u64_load_finalize_cmd:
|
||||
rts
|
||||
|
||||
u64_load_check_status:
|
||||
// Wait till status is available
|
||||
; Wait till status is available
|
||||
lda U64_STATUS
|
||||
and #U64_STAT_BIT_STAT_AV
|
||||
beq u64_load_check_status
|
||||
|
||||
// Status is ready - check the first character
|
||||
; Status is ready - check the first character
|
||||
lda U64_STATUS_DATA
|
||||
jsr JCHROUT // XXX for test only
|
||||
cmp #$30 // '0'
|
||||
jsr JCHROUT ; XXX for test only
|
||||
cmp #$30 ; '0'
|
||||
bne u64_load_check_status_wrong
|
||||
|
||||
// Check the second status character
|
||||
; Check the second status character
|
||||
lda U64_STATUS
|
||||
and #U64_STAT_BIT_STAT_AV
|
||||
beq u64_load_check_status_ok
|
||||
lda U64_STATUS_DATA
|
||||
jsr JCHROUT // XXX for test only
|
||||
cmp #$30 // '0'
|
||||
jsr JCHROUT ; XXX for test only
|
||||
cmp #$30 ; '0'
|
||||
beq u64_load_check_status_ok
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
u64_load_check_status_wrong:
|
||||
sec
|
||||
bcs !+
|
||||
u64_load_check_status_ok:
|
||||
clc
|
||||
!:
|
||||
// Now empty the status queue
|
||||
; Now empty the status queue
|
||||
lda U64_STATUS
|
||||
and #U64_STAT_BIT_STAT_AV
|
||||
beq !+
|
||||
lda U64_STATUS_DATA
|
||||
jsr JCHROUT // XXX for test only
|
||||
jsr JCHROUT ; XXX for test only
|
||||
jmp !-
|
||||
!:
|
||||
rts
|
||||
@@ -1,8 +1,8 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// XXX provide documentation and implementation
|
||||
; XXX provide documentation and implementation
|
||||
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
@@ -1,8 +1,8 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// XXX provide documentation and implementation
|
||||
; XXX provide documentation and implementation
|
||||
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
@@ -1,8 +1,8 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// Screen CHROUT
|
||||
; Screen CHROUT
|
||||
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
@@ -1,8 +1,8 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// Insert line at top of screen
|
||||
; Insert line at top of screen
|
||||
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
@@ -1,8 +1,8 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// XXX provide documentation and implementation
|
||||
; XXX provide documentation and implementation
|
||||
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
@@ -1,8 +1,8 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// IEC close
|
||||
; IEC close
|
||||
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
@@ -1,8 +1,8 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// XXX provide documentation and implementation
|
||||
; XXX provide documentation and implementation
|
||||
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
@@ -1,9 +1,9 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
cartridge_signature:
|
||||
|
||||
.byte $C3,$C2,$CD,$38,$30
|
||||
!byte $C3,$C2,$CD,$38,$30
|
||||
@@ -1,10 +1,11 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// CHR$ codes for the 16 colours
|
||||
; CHR$ codes for the 16 colours
|
||||
|
||||
colour_codes:
|
||||
.byte 144,5,28,159,156,30,31,158
|
||||
.byte 129,149,150,151,152,153,154,155
|
||||
|
||||
!byte 144,5,28,159,156,30,31,158
|
||||
!byte 129,149,150,151,152,153,154,155
|
||||
@@ -1,29 +1,30 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Default values for Kernal vectors - described in:
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - page 293 (RESTOR), 304 (VECTOR)
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 237
|
||||
//
|
||||
;
|
||||
; Default values for Kernal vectors - described in:
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - page 293 (RESTOR), 304 (VECTOR)
|
||||
; - [CM64] Computes 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
|
||||
!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
|
||||
@@ -1,8 +1,8 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
filename_any:
|
||||
|
||||
.text "*"
|
||||
!byte $2A ; '*'
|
||||
@@ -1,42 +1,41 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Values for IRQ generation timer - original idea was:
|
||||
//
|
||||
// (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
|
||||
;
|
||||
; Values for IRQ generation timer - original idea was:
|
||||
;
|
||||
; (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
|
||||
|
||||
// Current values selected on the following assumptions:
|
||||
//
|
||||
// PAL C64 (https://codebase64.org/doku.php?id=base:cpu_clocking),
|
||||
// is clocked at 0.985248 MHz, so that 1/60s is 16421 ($4025) 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 ($4295) CPU cycles
|
||||
; Current values selected on the following assumptions:
|
||||
;
|
||||
; PAL C64 (https://codebase64.org/doku.php?id=base:cpu_clocking),
|
||||
; is clocked at 0.985248 MHz, so that 1/60s is 16421 ($4025) 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 ($4295) CPU cycles
|
||||
|
||||
|
||||
irq_timing_hi: // high bytes
|
||||
irq_timing_hi: ; high bytes
|
||||
|
||||
#if !CONFIG_RS232_UP9600
|
||||
!ifndef CONFIG_RS232_UP9600 {
|
||||
|
||||
.byte >17045 // NTSC
|
||||
.byte >16421 // PAL
|
||||
!byte >17045 ; NTSC
|
||||
!byte >16421 ; PAL
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
//
|
||||
// Timer values needed by UP9600
|
||||
//
|
||||
// Original driver code by Daniel Dallman with Bo Zimmerman adaptations,
|
||||
// these causes the tick to be generated 64 times per second
|
||||
//
|
||||
;
|
||||
; Timer values needed by UP9600
|
||||
;
|
||||
; Original driver code by Daniel Dallman with Bo Zimmerman adaptations,
|
||||
; these causes the tick to be generated 64 times per second
|
||||
;
|
||||
|
||||
.byte $42 // NTSC
|
||||
.byte $40 // PAL
|
||||
|
||||
#endif
|
||||
!byte $42 ; NTSC
|
||||
!byte $40 ; PAL
|
||||
}
|
||||
@@ -1,42 +1,41 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Values for IRQ generation timer - original idea was:
|
||||
//
|
||||
// (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
|
||||
;
|
||||
; Values for IRQ generation timer - original idea was:
|
||||
;
|
||||
; (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
|
||||
|
||||
// Current values selected on the following assumptions:
|
||||
//
|
||||
// PAL C64 (https://codebase64.org/doku.php?id=base:cpu_clocking),
|
||||
// is clocked at 0.985248 MHz, so that 1/60s is 16421 ($4025) 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 ($4295) CPU cycles
|
||||
; Current values selected on the following assumptions:
|
||||
;
|
||||
; PAL C64 (https://codebase64.org/doku.php?id=base:cpu_clocking),
|
||||
; is clocked at 0.985248 MHz, so that 1/60s is 16421 ($4025) 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 ($4295) CPU cycles
|
||||
|
||||
|
||||
irq_timing_lo: // low bytes
|
||||
irq_timing_lo: ; low bytes
|
||||
|
||||
#if !CONFIG_RS232_UP9600
|
||||
!ifndef CONFIG_RS232_UP9600 {
|
||||
|
||||
.byte <17045 // NTSC
|
||||
.byte <16421 // PAL
|
||||
!byte <17045 ; NTSC
|
||||
!byte <16421 ; PAL
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
//
|
||||
// Timer values needed by UP9600
|
||||
//
|
||||
// Original driver code by Daniel Dallman with Bo Zimmerman adaptations,
|
||||
// these causes the tick to be generated 64 times per second
|
||||
//
|
||||
;
|
||||
; Timer values needed by UP9600
|
||||
;
|
||||
; Original driver code by Daniel Dallman with Bo Zimmerman adaptations,
|
||||
; these causes the tick to be generated 64 times per second
|
||||
;
|
||||
|
||||
.byte $95 // NTSC
|
||||
.byte $25 // PAL
|
||||
|
||||
#endif
|
||||
!byte $95 ; NTSC
|
||||
!byte $25 ; PAL
|
||||
}
|
||||
@@ -1,98 +1,91 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Messages to be prined out by Kernal
|
||||
//
|
||||
|
||||
.encoding "petscii_upper"
|
||||
;
|
||||
; Messages to be prined out by Kernal
|
||||
;
|
||||
|
||||
|
||||
// Double underscore prevents labels from being passed to VICE (would confuse monitor)
|
||||
; Double underscore prevents labels from being passed to VICE (would confuse monitor)
|
||||
|
||||
.label __MSG_KERNAL_SEARCHING_FOR = __msg_kernalsearching_for - __msg_kernal_first
|
||||
.label __MSG_KERNAL_LOADING = __msg_kernalloading - __msg_kernal_first
|
||||
.label __MSG_KERNAL_VERIFYING = __msg_kernalverifying - __msg_kernal_first
|
||||
.label __MSG_KERNAL_SAVING = __msg_kernalsaving - __msg_kernal_first
|
||||
.label __MSG_KERNAL_FROM_HEX = __msg_kernalfrom_hex - __msg_kernal_first
|
||||
.label __MSG_KERNAL_TO_HEX = __msg_kernalto_hex - __msg_kernal_first
|
||||
!addr __MSG_KERNAL_SEARCHING_FOR = __msg_kernalsearching_for - __msg_kernal_first
|
||||
!addr __MSG_KERNAL_LOADING = __msg_kernalloading - __msg_kernal_first
|
||||
!addr __MSG_KERNAL_VERIFYING = __msg_kernalverifying - __msg_kernal_first
|
||||
!addr __MSG_KERNAL_SAVING = __msg_kernalsaving - __msg_kernal_first
|
||||
!addr __MSG_KERNAL_FROM_HEX = __msg_kernalfrom_hex - __msg_kernal_first
|
||||
!addr __MSG_KERNAL_TO_HEX = __msg_kernalto_hex - __msg_kernal_first
|
||||
|
||||
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
|
||||
.label __MSG_KERNAL_PRESS_PLAY = __msg_kernalplay - __msg_kernal_first
|
||||
.label __MSG_KERNAL_FOUND = __msg_kernalfound - __msg_kernal_first
|
||||
#if CONFIG_MB_MEGA_65
|
||||
.label __MSG_KERNAL_OK_SEARCHING = __msg_kernaloksearching - __msg_kernal_first
|
||||
#endif
|
||||
#endif
|
||||
!ifdef HAS_TAPE {
|
||||
!addr __MSG_KERNAL_PRESS_PLAY = __msg_kernalplay - __msg_kernal_first
|
||||
!addr __MSG_KERNAL_FOUND = __msg_kernalfound - __msg_kernal_first
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
!addr __MSG_KERNAL_OK_SEARCHING = __msg_kernaloksearching - __msg_kernal_first
|
||||
} }
|
||||
|
||||
#if CONFIG_PANIC_SCREEN
|
||||
.label __MSG_KERNAL_PANIC = __msg_kernalpanic - __msg_kernal_first
|
||||
.label __MSG_KERNAL_PANIC_ROM_MISMATCH = __msg_kernalpanic_rom_mismatch - __msg_kernal_first
|
||||
#endif
|
||||
!ifdef CONFIG_PANIC_SCREEN {
|
||||
!addr __MSG_KERNAL_PANIC = __msg_kernalpanic - __msg_kernal_first
|
||||
!addr __MSG_KERNAL_PANIC_ROM_MISMATCH = __msg_kernalpanic_rom_mismatch - __msg_kernal_first
|
||||
}
|
||||
|
||||
|
||||
__msg_kernal_first:
|
||||
|
||||
__msg_kernalsearching_for:
|
||||
.byte $0D
|
||||
.text "SEARCHING FOR"
|
||||
.byte $80 + $20 // end of string mark + space
|
||||
!byte $0D
|
||||
!pet "searching for"
|
||||
!byte $80 + $20 ; end of string mark + space
|
||||
|
||||
__msg_kernalloading:
|
||||
.byte $0D
|
||||
.text "LOADIN"
|
||||
.byte $80 + $47 // end of string mark + 'G'
|
||||
!byte $0D
|
||||
!pet "loadin"
|
||||
!byte $80 + $47 ; end of string mark + 'G'
|
||||
|
||||
__msg_kernalverifying:
|
||||
.byte $0D
|
||||
.text "VERIFYIN"
|
||||
.byte $80 + $47 // end of string mark + 'G'
|
||||
!byte $0D
|
||||
!pet "verifyin"
|
||||
!byte $80 + $47 ; end of string mark + 'G'
|
||||
|
||||
__msg_kernalsaving:
|
||||
.byte $0D
|
||||
.text "SAVING"
|
||||
.byte $80 + $20 // end of string mark + space
|
||||
!byte $0D
|
||||
!pet "saving"
|
||||
!byte $80 + $20 ; end of string mark + space
|
||||
|
||||
__msg_kernalfrom_hex:
|
||||
.text " FROM "
|
||||
.byte $80 + $24 // end of string mark + '$'
|
||||
!pet " from "
|
||||
!byte $80 + $24 ; end of string mark + '$'
|
||||
|
||||
__msg_kernalto_hex:
|
||||
.text " TO "
|
||||
.byte $80 + $24 // end of string mark + '$'
|
||||
!pet " to "
|
||||
!byte $80 + $24 ; end of string mark + '$'
|
||||
|
||||
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
|
||||
!ifdef HAS_TAPE {
|
||||
|
||||
__msg_kernalplay:
|
||||
.byte $0D
|
||||
.text "PRESS PLAY ON TAPE"
|
||||
.byte $80 + $0D // end of string mark + return
|
||||
!byte $0D
|
||||
!pet "press play on tape"
|
||||
!byte $80 + $0D ; end of string mark + return
|
||||
|
||||
__msg_kernalfound:
|
||||
.text "FOUND"
|
||||
.byte $80 + $20 // end of string mark + space
|
||||
!pet "found"
|
||||
!byte $80 + $20 ; end of string mark + space
|
||||
|
||||
#if CONFIG_MB_MEGA_65
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
|
||||
__msg_kernaloksearching:
|
||||
.text "OK"
|
||||
.byte $0D, $0D
|
||||
.text "SEARCHIN"
|
||||
.byte $80 + $47 // end of string mark + 'G'
|
||||
!pet "ok"
|
||||
!byte $0D, $0D
|
||||
!pet "searchin"
|
||||
!byte $80 + $47 ; end of string mark + 'G'
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if CONFIG_PANIC_SCREEN
|
||||
!ifdef CONFIG_PANIC_SCREEN {
|
||||
|
||||
__msg_kernalpanic:
|
||||
.text "KERNAL PANI"
|
||||
.byte $80 + $43 // end of string mark + 'C'
|
||||
!pet "kernal pani"
|
||||
!byte $80 + $43 ; end of string mark + 'C'
|
||||
|
||||
__msg_kernalpanic_rom_mismatch:
|
||||
.text " - ROM MISMATC"
|
||||
.byte $80 + $48 // end of string mark + 'H'
|
||||
|
||||
#endif // CONFIG_PANIC_SCREEN
|
||||
!pet " - rom mismatc"
|
||||
!byte $80 + $48 ; end of string mark + 'H'
|
||||
}
|
||||
@@ -1,128 +1,139 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Command string definitions for programmable keys
|
||||
//
|
||||
;
|
||||
; Command string definitions for programmable keys
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_PROGRAMMABLE_KEYS
|
||||
|
||||
|
||||
.macro PROGRAMMABLE_KEY_CODE(STR, CODE)
|
||||
{
|
||||
.if (STR.size() > 0)
|
||||
{
|
||||
.byte CODE
|
||||
}
|
||||
}
|
||||
|
||||
.macro PROGRAMMABLE_KEY_STRING(STR)
|
||||
{
|
||||
.if (STR.size() > 0)
|
||||
{
|
||||
.text STR
|
||||
.byte $00
|
||||
}
|
||||
}
|
||||
|
||||
.macro PROGRAMMABLE_KEY_OFFSET(STR, LABEL)
|
||||
{
|
||||
.if (STR.size() > 0)
|
||||
{
|
||||
.byte LABEL - programmable_keys_strings
|
||||
}
|
||||
}
|
||||
!ifdef CONFIG_PROGRAMMABLE_KEYS {
|
||||
|
||||
|
||||
programmable_keys_codes:
|
||||
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_RUN, KEY_RUN)
|
||||
!ifdef CONFIG_KEYCMD_RUN { !byte KEY_RUN }
|
||||
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F1, KEY_F1)
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F2, KEY_F2)
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F3, KEY_F3)
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F4, KEY_F4)
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F5, KEY_F5)
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F6, KEY_F6)
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F7, KEY_F7)
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F8, KEY_F8)
|
||||
!ifdef CONFIG_KEYCMD_F1 { !byte KEY_F1 }
|
||||
!ifdef CONFIG_KEYCMD_F2 { !byte KEY_F2 }
|
||||
!ifdef CONFIG_KEYCMD_F3 { !byte KEY_F3 }
|
||||
!ifdef CONFIG_KEYCMD_F4 { !byte KEY_F4 }
|
||||
!ifdef CONFIG_KEYCMD_F5 { !byte KEY_F5 }
|
||||
!ifdef CONFIG_KEYCMD_F6 { !byte KEY_F6 }
|
||||
!ifdef CONFIG_KEYCMD_F7 { !byte KEY_F7 }
|
||||
!ifdef CONFIG_KEYCMD_F8 { !byte KEY_F8 }
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65)
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_HELP, KEY_HELP)
|
||||
#endif
|
||||
!ifndef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
!ifdef CONFIG_KEYBOARD_C128 {
|
||||
|
||||
!ifdef CONFIG_KEYCMD_HELP { !byte KEY_HELP }
|
||||
|
||||
} else ifdef CONFIG_KEYBOARD_C65 {
|
||||
|
||||
!ifdef CONFIG_KEYCMD_HELP { !byte KEY_HELP }
|
||||
|
||||
!ifdef CONFIG_KEYCMD_F9 { !byte KEY_F9 }
|
||||
!ifdef CONFIG_KEYCMD_F10 { !byte KEY_F10 }
|
||||
!ifdef CONFIG_KEYCMD_F11 { !byte KEY_F11 }
|
||||
!ifdef CONFIG_KEYCMD_F12 { !byte KEY_F12 }
|
||||
!ifdef CONFIG_KEYCMD_F13 { !byte KEY_F13 }
|
||||
!ifdef CONFIG_KEYCMD_F14 { !byte KEY_F14 }
|
||||
|
||||
|
||||
} }
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY && CONFIG_KEYBOARD_C65
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F9, KEY_F9)
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F10, KEY_F10)
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F11, KEY_F11)
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F12, KEY_F12)
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F13, KEY_F13)
|
||||
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F14, KEY_F14)
|
||||
#endif
|
||||
|
||||
__programmable_keys_codes_end:
|
||||
|
||||
|
||||
programmable_keys_strings:
|
||||
|
||||
__str_offset_RUN: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_RUN)
|
||||
__str_offset_RUN: !ifdef CONFIG_KEYCMD_RUN { +CONFIG_KEYCMD_RUN
|
||||
!byte $00 }
|
||||
|
||||
__str_offset_F1: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F1)
|
||||
__str_offset_F2: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F2)
|
||||
__str_offset_F3: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F3)
|
||||
__str_offset_F4: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F4)
|
||||
__str_offset_F5: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F5)
|
||||
__str_offset_F6: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F6)
|
||||
__str_offset_F7: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F7)
|
||||
__str_offset_F8: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F8)
|
||||
__str_offset_F1: !ifdef CONFIG_KEYCMD_F1 { +CONFIG_KEYCMD_F1
|
||||
!byte $00 }
|
||||
__str_offset_F2: !ifdef CONFIG_KEYCMD_F2 { +CONFIG_KEYCMD_F2
|
||||
!byte $00 }
|
||||
__str_offset_F3: !ifdef CONFIG_KEYCMD_F3 { +CONFIG_KEYCMD_F3
|
||||
!byte $00 }
|
||||
__str_offset_F4: !ifdef CONFIG_KEYCMD_F4 { +CONFIG_KEYCMD_F4
|
||||
!byte $00 }
|
||||
__str_offset_F5: !ifdef CONFIG_KEYCMD_F5 { +CONFIG_KEYCMD_F5
|
||||
!byte $00 }
|
||||
__str_offset_F6: !ifdef CONFIG_KEYCMD_F6 { +CONFIG_KEYCMD_F6
|
||||
!byte $00 }
|
||||
__str_offset_F7: !ifdef CONFIG_KEYCMD_F7 { +CONFIG_KEYCMD_F7
|
||||
!byte $00 }
|
||||
__str_offset_F8: !ifdef CONFIG_KEYCMD_F8 { +CONFIG_KEYCMD_F8
|
||||
!byte $00 }
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65)
|
||||
__str_offset_HELP: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_HELP)
|
||||
#endif
|
||||
!ifndef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
!ifdef CONFIG_KEYBOARD_C128 {
|
||||
|
||||
__str_offset_HELP: !ifdef CONFIG_KEYCMD_HELP { +CONFIG_KEYCMD_HELP
|
||||
!byte $00 }
|
||||
|
||||
} else ifdef CONFIG_KEYBOARD_C65 {
|
||||
|
||||
__str_offset_HELP: !ifdef CONFIG_KEYCMD_HELP { +CONFIG_KEYCMD_HELP
|
||||
!byte $00 }
|
||||
|
||||
__str_offset_F9: !ifdef CONFIG_KEYCMD_F9 { +CONFIG_KEYCMD_F9
|
||||
!byte $00 }
|
||||
__str_offset_F10: !ifdef CONFIG_KEYCMD_F10 { +CONFIG_KEYCMD_F10
|
||||
!byte $00 }
|
||||
__str_offset_F11: !ifdef CONFIG_KEYCMD_F11 { +CONFIG_KEYCMD_F11
|
||||
!byte $00 }
|
||||
__str_offset_F12: !ifdef CONFIG_KEYCMD_F12 { +CONFIG_KEYCMD_F12
|
||||
!byte $00 }
|
||||
__str_offset_F13: !ifdef CONFIG_KEYCMD_F13 { +CONFIG_KEYCMD_F13
|
||||
!byte $00 }
|
||||
__str_offset_F14: !ifdef CONFIG_KEYCMD_F14 { +CONFIG_KEYCMD_F14
|
||||
!byte $00 }
|
||||
|
||||
} }
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY && CONFIG_KEYBOARD_C65
|
||||
__str_offset_F9: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F9)
|
||||
__str_offset_F10: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F10)
|
||||
__str_offset_F11: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F11)
|
||||
__str_offset_F12: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F12)
|
||||
__str_offset_F13: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F13)
|
||||
__str_offset_F14: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F14)
|
||||
#endif
|
||||
|
||||
__programmable_keys_strings_end:
|
||||
{
|
||||
.var offset = __programmable_keys_strings_end - programmable_keys_strings
|
||||
.if (offset >= 255) .error "Programmable keys took too much space"
|
||||
}
|
||||
|
||||
!if (__programmable_keys_strings_end - programmable_keys_strings > 255) {
|
||||
!error "Programmable keys took too much space"
|
||||
}
|
||||
|
||||
|
||||
programmable_keys_offsets:
|
||||
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_RUN, __str_offset_RUN)
|
||||
!ifdef CONFIG_KEYCMD_RUN { !byte __str_offset_RUN - programmable_keys_strings }
|
||||
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F1, __str_offset_F1)
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F2, __str_offset_F2)
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F3, __str_offset_F3)
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F4, __str_offset_F4)
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F5, __str_offset_F5)
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F6, __str_offset_F6)
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F7, __str_offset_F7)
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F8, __str_offset_F8)
|
||||
!ifdef CONFIG_KEYCMD_F1 { !byte __str_offset_F1 - programmable_keys_strings }
|
||||
!ifdef CONFIG_KEYCMD_F2 { !byte __str_offset_F2 - programmable_keys_strings }
|
||||
!ifdef CONFIG_KEYCMD_F3 { !byte __str_offset_F3 - programmable_keys_strings }
|
||||
!ifdef CONFIG_KEYCMD_F4 { !byte __str_offset_F4 - programmable_keys_strings }
|
||||
!ifdef CONFIG_KEYCMD_F5 { !byte __str_offset_F5 - programmable_keys_strings }
|
||||
!ifdef CONFIG_KEYCMD_F6 { !byte __str_offset_F6 - programmable_keys_strings }
|
||||
!ifdef CONFIG_KEYCMD_F7 { !byte __str_offset_F7 - programmable_keys_strings }
|
||||
!ifdef CONFIG_KEYCMD_F8 { !byte __str_offset_F8 - programmable_keys_strings }
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65)
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_HELP, __str_offset_HELP)
|
||||
#endif
|
||||
!ifndef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY && CONFIG_KEYBOARD_C65
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F9, __str_offset_F9)
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F10, __str_offset_F10)
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F11, __str_offset_F11)
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F12, __str_offset_F12)
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F13, __str_offset_F13)
|
||||
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F14, __str_offset_F14)
|
||||
#endif
|
||||
!ifdef CONFIG_KEYBOARD_C128 {
|
||||
|
||||
!ifdef CONFIG_KEYCMD_HELP { !byte __str_offset_HELP - programmable_keys_strings }
|
||||
|
||||
#endif // CONFIG_PROGRAMMABLE_KEYS
|
||||
} else ifdef CONFIG_KEYBOARD_C65 {
|
||||
|
||||
!ifdef CONFIG_KEYCMD_HELP { !byte __str_offset_HELP - programmable_keys_strings }
|
||||
|
||||
!ifdef CONFIG_KEYCMD_F9 { !byte __str_offset_F9 - programmable_keys_strings }
|
||||
!ifdef CONFIG_KEYCMD_F10 { !byte __str_offset_F10 - programmable_keys_strings }
|
||||
!ifdef CONFIG_KEYCMD_F11 { !byte __str_offset_F11 - programmable_keys_strings }
|
||||
!ifdef CONFIG_KEYCMD_F12 { !byte __str_offset_F12 - programmable_keys_strings }
|
||||
!ifdef CONFIG_KEYCMD_F13 { !byte __str_offset_F13 - programmable_keys_strings }
|
||||
!ifdef CONFIG_KEYCMD_F14 { !byte __str_offset_F14 - programmable_keys_strings }
|
||||
|
||||
} }
|
||||
|
||||
}
|
||||
@@ -1,72 +1,64 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE-FLOAT
|
||||
// #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE-FLOAT
|
||||
;; #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Definitions for communication with MEGA65 segment KERNAL_1 from KERNAL_0
|
||||
//
|
||||
;
|
||||
; Definitions for communication with MEGA65 segment KERNAL_1 from KERNAL_0
|
||||
;
|
||||
|
||||
|
||||
#if SEGMENT_KERNAL_0
|
||||
!ifdef SEGMENT_KERNAL_0 {
|
||||
|
||||
// Label definitions
|
||||
; Label definitions
|
||||
|
||||
.label VK1__IOINIT = $4000 + 2 * 0
|
||||
.label VK1__RAMTAS = $4000 + 2 * 1
|
||||
.label VK1__vicii_init = $4000 + 2 * 2
|
||||
.label VK1__load_tape_normal = $4000 + 2 * 3
|
||||
.label VK1__load_tape_turbo = $4000 + 2 * 4
|
||||
.label VK1__load_tape_auto = $4000 + 2 * 5
|
||||
.label VK1__tape_head_align = $4000 + 2 * 6
|
||||
.label VK1__m65_chrout_screen = $4000 + 2 * 7
|
||||
.label VK1__m65_chrin_keyboard = $4000 + 2 * 8
|
||||
.label VK1__M65_MODESET = $4000 + 2 * 9
|
||||
.label VK1__M65_SCRMODEGET = $4000 + 2 * 10
|
||||
.label VK1__M65_SCRMODESET = $4000 + 2 * 11
|
||||
.label VK1__M65_CLRSCR = $4000 + 2 * 12
|
||||
.label VK1__M65_CLRWIN = $4000 + 2 * 13
|
||||
.label VK1__m65_screen_upd_txtrow_off = $4000 + 2 * 14
|
||||
!addr VK1__IOINIT = $4000 + 2 * 0
|
||||
!addr VK1__RAMTAS = $4000 + 2 * 1
|
||||
!addr VK1__vicii_init = $4000 + 2 * 2
|
||||
!addr VK1__load_tape_normal = $4000 + 2 * 3
|
||||
!addr VK1__load_tape_turbo = $4000 + 2 * 4
|
||||
!addr VK1__load_tape_auto = $4000 + 2 * 5
|
||||
!addr VK1__tape_head_align = $4000 + 2 * 6
|
||||
!addr VK1__m65_chrout_screen = $4000 + 2 * 7
|
||||
!addr VK1__m65_chrin_keyboard = $4000 + 2 * 8
|
||||
!addr VK1__M65_MODESET = $4000 + 2 * 9
|
||||
!addr VK1__M65_SCRMODEGET = $4000 + 2 * 10
|
||||
!addr VK1__M65_SCRMODESET = $4000 + 2 * 11
|
||||
!addr VK1__M65_CLRSCR = $4000 + 2 * 12
|
||||
!addr VK1__M65_CLRWIN = $4000 + 2 * 13
|
||||
!addr VK1__m65_screen_upd_txtrow_off = $4000 + 2 * 14
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
// Vector table (Open ROMs private!)
|
||||
; Vector table (Open ROMs private!)
|
||||
|
||||
.word IOINIT
|
||||
.word RAMTAS
|
||||
.word vicii_init
|
||||
!word IOINIT
|
||||
!word RAMTAS
|
||||
!word vicii_init
|
||||
|
||||
#if CONFIG_TAPE_NORMAL && !CONFIG_TAPE_AUTODETECT
|
||||
.word load_tape_normal
|
||||
#else
|
||||
.word $0000
|
||||
#endif
|
||||
!ifdef CONFIG_TAPE_NORMAL { !ifndef CONFIG_TAPE_AUTODETECT {
|
||||
!word load_tape_normal
|
||||
} else { !word $0000 } } else { !word $0000 }
|
||||
|
||||
#if CONFIG_TAPE_TURBO && !CONFIG_TAPE_AUTODETECT
|
||||
.word load_tape_turbo
|
||||
#else
|
||||
.word $0000
|
||||
#endif
|
||||
!ifdef CONFIG_TAPE_TURBO { !ifndef CONFIG_TAPE_AUTODETECT {
|
||||
!word load_tape_turbo
|
||||
} else { !word $0000 } } else { !word $0000 }
|
||||
|
||||
#if CONFIG_TAPE_AUTODETECT
|
||||
.word load_tape_auto
|
||||
#else
|
||||
.word $0000
|
||||
#endif
|
||||
|
||||
#if CONFIG_TAPE_HEAD_ALIGN
|
||||
.word tape_head_align
|
||||
#else
|
||||
.word $0000
|
||||
#endif
|
||||
!ifdef CONFIG_TAPE_AUTODETECT {
|
||||
!word load_tape_auto
|
||||
} else { !word $0000 }
|
||||
|
||||
.word m65_chrout_screen
|
||||
.word m65_chrin_keyboard
|
||||
!ifdef CONFIG_TAPE_HEAD_ALIGN {
|
||||
!word tape_head_align
|
||||
} else { !word $0000 }
|
||||
|
||||
.word M65_MODESET
|
||||
.word M65_SCRMODEGET
|
||||
.word M65_SCRMODESET
|
||||
.word M65_CLRSCR
|
||||
.word M65_CLRWIN
|
||||
.word m65_screen_upd_txtrow_off
|
||||
!word m65_chrout_screen
|
||||
!word m65_chrin_keyboard
|
||||
|
||||
#endif
|
||||
!word M65_MODESET
|
||||
!word M65_SCRMODEGET
|
||||
!word M65_SCRMODESET
|
||||
!word M65_CLRSCR
|
||||
!word M65_CLRWIN
|
||||
!word m65_screen_upd_txtrow_off
|
||||
}
|
||||
@@ -1,79 +1,81 @@
|
||||
// #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
// Helper routines for DMAgic usage
|
||||
; Helper routines for DMAgic usage
|
||||
|
||||
// See:
|
||||
// - https://c65gs.blogspot.com/2019/03/auto-detecting-required-revision-of.html
|
||||
// - https://c65gs.blogspot.com/2018/01/improving-dmagic-controller-interface.html
|
||||
; See:
|
||||
; - https://c65gs.blogspot.com/2019/03/auto-detecting-required-revision-of.html
|
||||
; - https://c65gs.blogspot.com/2018/01/improving-dmagic-controller-interface.html
|
||||
|
||||
|
||||
m65_dmagic_oper_fill:
|
||||
|
||||
// To configure job parameters, use:
|
||||
// - M65_DMAJOB_SIZE_*
|
||||
// - M65_DMAJOB_DST_*
|
||||
// - .A - byte for filling
|
||||
// Afterwards, consider M65_DMAJOB_*_2 and M65_DMAJOB_*_3 destroyed.
|
||||
; To configure job parameters, use:
|
||||
; - M65_DMAJOB_SIZE_*
|
||||
; - M65_DMAJOB_DST_*
|
||||
; - .A - byte for filling
|
||||
; Afterwards, consider M65_DMAJOB_DST_2 and M65_DMAJOB_*_3 destroyed.
|
||||
|
||||
// Set fill address
|
||||
; Set fill address
|
||||
|
||||
sta M65_DMAJOB_SRC_0
|
||||
|
||||
// Set operation type
|
||||
; Set operation type
|
||||
|
||||
lda #($03 + $08) // operation: FILL + allow interrupts
|
||||
lda #($03 + $08) ; operation: FILL + allow interrupts
|
||||
sta M65_DMAGIC_LIST+6
|
||||
|
||||
// Adapt the addresses, launch the job
|
||||
; XXX! put 0 into M65_DMAJOB_SRC_3 to clear the flags
|
||||
|
||||
; Adapt the addresses, launch the job
|
||||
|
||||
jsr m65_dmagic_adapt_dst
|
||||
jmp_8 m65_dmagic_launch
|
||||
bra m65_dmagic_launch
|
||||
|
||||
m65_dmagic_oper_copy:
|
||||
|
||||
// To configure job parameters, use:
|
||||
// - M65_DMAJOB_SIZE_*
|
||||
// - M65_DMAJOB_SRC_*
|
||||
// - M65_DMAJOB_DST_*
|
||||
// Afterwards, consider M65_DMAJOB_DST_2 and M65_DMAJOB_DST_3 destroyed.
|
||||
; To configure job parameters, use:
|
||||
; - M65_DMAJOB_SIZE_*
|
||||
; - M65_DMAJOB_SRC_*
|
||||
; - M65_DMAJOB_DST_*
|
||||
; Afterwards, consider M65_DMAJOB_*_2 and M65_DMAJOB_*_3 destroyed.
|
||||
|
||||
// Set operation type
|
||||
; Set operation type
|
||||
|
||||
lda #($00 + $08) // operation: COPY + allow interrupts
|
||||
lda #($00 + $08) ; operation: COPY + allow interrupts
|
||||
sta M65_DMAGIC_LIST+6
|
||||
|
||||
// Adapt the addresses, launch the job
|
||||
; Adapt the addresses, launch the job
|
||||
|
||||
jsr m65_dmagic_adapt_src
|
||||
jsr m65_dmagic_adapt_dst
|
||||
|
||||
// XXX prepare separate version for the opposite direction - change direction
|
||||
// by setting bit 6 of M65_DMAJOB_*_2
|
||||
; XXX possibly prepare separate version for the opposite direction - change direction
|
||||
; by setting bit 6 of M65_DMAJOB_*_2
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
m65_dmagic_launch:
|
||||
|
||||
// Launch the DMA list
|
||||
; Launch the DMA list
|
||||
|
||||
lda #$00
|
||||
sta DMA_ADDRBANK // $D702
|
||||
sta DMA_ADDRMB // $D704
|
||||
sta DMA_ADDRBANK ; $D702
|
||||
sta DMA_ADDRMB ; $D704
|
||||
|
||||
lda #>M65_DMAGIC_LIST
|
||||
sta DMA_ADDRMSB // $D701
|
||||
sta DMA_ADDRMSB ; $D701
|
||||
lda #<M65_DMAGIC_LIST
|
||||
sta DMA_ETRIG // $D705
|
||||
sta DMA_ETRIG ; $D705
|
||||
|
||||
rts
|
||||
|
||||
|
||||
m65_dmagic_adapt_src:
|
||||
|
||||
// We need to adapt the addresses:
|
||||
// - M65_DMAJOB_SRC_2 - contain bits 16-23, should contain 16-19
|
||||
// - M65_DMAJOB_SRC_3 - contain bits 24-27, should contain 20-27
|
||||
; We need to adapt the addresses:
|
||||
; - M65_DMAJOB_SRC_2 - contain bits 16-23, should contain 16-19
|
||||
; - M65_DMAJOB_SRC_3 - contain bits 24-27, should contain 20-27
|
||||
|
||||
lda M65_DMAJOB_SRC_2
|
||||
pha
|
||||
@@ -96,9 +98,9 @@ m65_dmagic_adapt_src:
|
||||
|
||||
m65_dmagic_adapt_dst:
|
||||
|
||||
// We need to adapt the addresses:
|
||||
// - M65_DMAJOB_DST_2 - contain bits 16-23, should contain 16-19
|
||||
// - M65_DMAJOB_DST_3 - contain bits 24-27, should contain 20-27
|
||||
; We need to adapt the addresses:
|
||||
; - M65_DMAJOB_DST_2 - contain bits 16-23, should contain 16-19
|
||||
; - M65_DMAJOB_DST_3 - contain bits 24-27, should contain 20-27
|
||||
|
||||
lda M65_DMAJOB_DST_2
|
||||
pha
|
||||
@@ -121,19 +123,20 @@ m65_dmagic_adapt_dst:
|
||||
|
||||
m65_dmagic_init:
|
||||
|
||||
// Set common job parameters
|
||||
; Set common job parameters
|
||||
|
||||
lda #$0A
|
||||
sta M65_DMAGIC_LIST+0 // <- $0A = use F018A list format (it is shorter by 1 byte)
|
||||
sta M65_DMAGIC_LIST+0 ; <- $0A = use F018A list format (it is shorter by 1 byte)
|
||||
lda #$80
|
||||
sta M65_DMAGIC_LIST+1 // <- $80 = next byte is highest 8 bits of source address
|
||||
inc_a
|
||||
sta M65_DMAGIC_LIST+3 // <- $81 = next byte is highest 8 bits of destination address
|
||||
sta M65_DMAGIC_LIST+1 ; <- $80 = next byte is highest 8 bits of source address
|
||||
inc
|
||||
sta M65_DMAGIC_LIST+3 ; <- $81 = next byte is highest 8 bits of destination address
|
||||
|
||||
lda #$00
|
||||
sta M65_DMAGIC_LIST+5 // <- end of options
|
||||
sta M65_DMAGIC_LIST+5 ; <- end of options
|
||||
|
||||
sta M65_DMAGIC_LIST+15 // <- set modulo to 0
|
||||
; !XXX modulo is ignored - remove these, shift M65_DMAGIC_LIST up by 2 bytes
|
||||
sta M65_DMAGIC_LIST+15 ; <- set modulo to 0
|
||||
sta M65_DMAGIC_LIST+16
|
||||
|
||||
rts
|
||||
@@ -1,101 +1,81 @@
|
||||
// #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Definitions for calling MEGA65 segment KERNAL_0 routines from KERNAL_1
|
||||
//
|
||||
;; #IMPORT# KERNAL_0 = KERNAL_0_combined.sym
|
||||
|
||||
#import "KERNAL_0_combined.sym"
|
||||
;
|
||||
; Definitions for calling MEGA65 segment KERNAL_0 routines from KERNAL_1
|
||||
;
|
||||
|
||||
;; #ALIAS# CHROUT = KERNAL_0.proxy_K1_CHROUT
|
||||
;; #ALIAS# STOP = KERNAL_0.STOP
|
||||
;; #ALIAS# M65_SLOW = KERNAL_0.M65_SLOW
|
||||
;; #ALIAS# M65_FAST = KERNAL_0.M65_FAST
|
||||
;; #ALIAS# M65_MODEGET = KERNAL_0.M65_MODEGET
|
||||
;; #ALIAS# M65_SETWIN_XY = KERNAL_0.M65_SETWIN_XY
|
||||
;; #ALIAS# M65_SETWIN_WH = KERNAL_0.M65_SETWIN_WH
|
||||
;; #ALIAS# M65_SETWIN_N = KERNAL_0.M65_SETWIN_N
|
||||
;; #ALIAS# M65_SETWIN_Y = KERNAL_0.M65_SETWIN_Y
|
||||
|
||||
.label CHROUT = KERNAL_0.proxy_K1_CHROUT
|
||||
.label STOP = KERNAL_0.STOP
|
||||
.label M65_SLOW = KERNAL_0.M65_SLOW
|
||||
.label M65_FAST = KERNAL_0.M65_FAST
|
||||
.label M65_MODEGET = KERNAL_0.M65_MODEGET
|
||||
.label M65_SETWIN_XY = KERNAL_0.M65_SETWIN_XY
|
||||
.label M65_SETWIN_WH = KERNAL_0.M65_SETWIN_WH
|
||||
.label M65_SETWIN_N = KERNAL_0.M65_SETWIN_N
|
||||
.label M65_SETWIN_Y = KERNAL_0.M65_SETWIN_Y
|
||||
;; #ALIAS# map_NORMAL = KERNAL_0.map_NORMAL
|
||||
;; #ALIAS# map_KERNAL_1 = KERNAL_0.map_KERNAL_1
|
||||
|
||||
;; #ALIAS# screen_on = KERNAL_0.screen_on
|
||||
;; #ALIAS# screen_off = KERNAL_0.screen_off
|
||||
|
||||
#if (CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO) || (CONFIG_IEC_JIFFYDOS && !CONFIG_MEMORY_MODEL_60K)
|
||||
.label screen_on = KERNAL_0.screen_on
|
||||
.label screen_off = KERNAL_0.screen_off
|
||||
#endif
|
||||
;; #ALIAS# hw_entry_reset = KERNAL_0.hw_entry_reset
|
||||
;; #ALIAS# return_from_interrupt = KERNAL_0.return_from_interrupt
|
||||
;; #ALIAS# clrchn_reset = KERNAL_0.clrchn_reset
|
||||
;; #ALIAS# udtim_keyboard = KERNAL_0.udtim_keyboard
|
||||
;; #ALIAS# chrout_to_screen_code = KERNAL_0.chrout_to_screen_code
|
||||
;; #ALIAS# colour_codes = KERNAL_0.colour_codes
|
||||
;; #ALIAS# screen_check_toggle_quote = KERNAL_0.screen_check_toggle_quote
|
||||
;; #ALIAS# screen_code_to_petscii = KERNAL_0.screen_code_to_petscii
|
||||
|
||||
.label hw_entry_reset = KERNAL_0.hw_entry_reset
|
||||
.label return_from_interrupt = KERNAL_0.return_from_interrupt
|
||||
.label clrchn_reset = KERNAL_0.clrchn_reset
|
||||
.label udtim_keyboard = KERNAL_0.udtim_keyboard
|
||||
.label chrout_to_screen_code = KERNAL_0.chrout_to_screen_code
|
||||
.label colour_codes = KERNAL_0.colour_codes
|
||||
.label screen_check_toggle_quote = KERNAL_0.screen_check_toggle_quote
|
||||
.label screen_code_to_petscii = KERNAL_0.screen_code_to_petscii
|
||||
;; #ALIAS# setup_irq_timer = KERNAL_0.setup_irq_timer
|
||||
;; #ALIAS# wait_x_bars = KERNAL_0.wait_x_bars
|
||||
;; #ALIAS# viciv_unhide = KERNAL_0.viciv_unhide
|
||||
;; #ALIAS# viciv_init = KERNAL_0.viciv_init
|
||||
;; #ALIAS# viciv_shutdown = KERNAL_0.viciv_shutdown
|
||||
;; #ALIAS# viciv_hotregs_on = KERNAL_0.viciv_hotregs_on
|
||||
;; #ALIAS# viciv_hotregs_off = KERNAL_0.viciv_hotregs_off
|
||||
|
||||
.label setup_irq_timer = KERNAL_0.setup_irq_timer
|
||||
.label wait_x_bars = KERNAL_0.wait_x_bars
|
||||
.label viciv_unhide = KERNAL_0.viciv_unhide
|
||||
.label viciv_init = KERNAL_0.viciv_init
|
||||
.label viciv_shutdown = KERNAL_0.viciv_shutdown
|
||||
.label viciv_hotregs_on = KERNAL_0.viciv_hotregs_on
|
||||
.label viciv_hotregs_off = KERNAL_0.viciv_hotregs_off
|
||||
;; #ALIAS# m65_clr_magictstr = KERNAL_0.m65_clr_magictstr
|
||||
;; #ALIAS# m65_scrtab_txtwidth = KERNAL_0.m65_scrtab_txtwidth
|
||||
;; #ALIAS# m65_scrtab_txtheight = KERNAL_0.m65_scrtab_txtheight
|
||||
;; #ALIAS# m65_screen_set_indx = KERNAL_0.m65_screen_set_indx
|
||||
;; #ALIAS# cursor_enable = KERNAL_0.cursor_enable
|
||||
;; #ALIAS# cursor_undraw_cont = KERNAL_0.cursor_undraw_cont
|
||||
;; #ALIAS# cursor_timer_reset = KERNAL_0.cursor_timer_reset
|
||||
;; #ALIAS# cursor_show_if_enabled = KERNAL_0.cursor_show_if_enabled
|
||||
;; #ALIAS# chrin_programmable_keys = KERNAL_0.proxy_K1_chrin_programmable_keys
|
||||
;; #ALIAS# pop_keyboard_buffer = KERNAL_0.pop_keyboard_buffer
|
||||
|
||||
.label m65_clr_magictstr = KERNAL_0.m65_clr_magictstr
|
||||
.label m65_scrtab_txtwidth = KERNAL_0.m65_scrtab_txtwidth
|
||||
.label m65_scrtab_txtheight = KERNAL_0.m65_scrtab_txtheight
|
||||
.label m65_screen_set_indx = KERNAL_0.m65_screen_set_indx
|
||||
.label cursor_enable = KERNAL_0.cursor_enable
|
||||
.label cursor_undraw_cont = KERNAL_0.cursor_undraw_cont
|
||||
.label cursor_timer_reset = KERNAL_0.cursor_timer_reset
|
||||
.label cursor_show_if_enabled = KERNAL_0.cursor_show_if_enabled
|
||||
.label chrin_programmable_keys = KERNAL_0.proxy_K1_chrin_programmable_keys
|
||||
.label pop_keyboard_buffer = KERNAL_0.pop_keyboard_buffer
|
||||
;; #ALIAS# iec_set_idle = KERNAL_0.iec_set_idle
|
||||
|
||||
#if CONFIG_IEC
|
||||
;; #ALIAS# tape_motor_on = KERNAL_0.tape_motor_on
|
||||
;; #ALIAS# tape_motor_off = KERNAL_0.tape_motor_off
|
||||
|
||||
.label iec_set_idle = KERNAL_0.iec_set_idle
|
||||
;; #ALIAS# lvs_display_loading_verifying = KERNAL_0.proxy_K1_lvs_display_loading_verifying
|
||||
;; #ALIAS# lvs_display_done = KERNAL_0.proxy_K1_lvs_display_done
|
||||
;; #ALIAS# lvs_return_last_address = KERNAL_0.proxy_K1_lvs_return_last_address
|
||||
;; #ALIAS# lvs_device_not_found_error = KERNAL_0.proxy_K1_lvs_device_not_found_error
|
||||
;; #ALIAS# lvs_load_verify_error = KERNAL_0.proxy_K1_lvs_load_verify_error
|
||||
;; #ALIAS# m65_load_autoswitch_tape = KERNAL_0.proxy_K1_m65_load_autoswitch_tape
|
||||
|
||||
#endif
|
||||
;; #ALIAS# lvs_check_EAL = KERNAL_0.lvs_check_EAL
|
||||
;; #ALIAS# lvs_STAL_to_MEMUSS = KERNAL_0.lvs_STAL_to_MEMUSS
|
||||
|
||||
;; #ALIAS# kernalerror_ROUTINE_TERMINATED = KERNAL_0.proxy_K1_kernalerror_ROUTINE_TERMINATED
|
||||
|
||||
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
|
||||
;; #ALIAS# print_kernal_message = KERNAL_0.proxy_K1_print_kernal_message
|
||||
;; #ALIAS# print_return = KERNAL_0.proxy_K1_print_return
|
||||
|
||||
.label tape_motor_on = KERNAL_0.tape_motor_on
|
||||
.label tape_motor_off = KERNAL_0.tape_motor_off
|
||||
;; #ALIAS# __MSG_KERNAL_PRESS_PLAY = KERNAL_0.__MSG_KERNAL_PRESS_PLAY
|
||||
;; #ALIAS# __MSG_KERNAL_OK_SEARCHING = KERNAL_0.__MSG_KERNAL_OK_SEARCHING
|
||||
;; #ALIAS# __MSG_KERNAL_FOUND = KERNAL_0.__MSG_KERNAL_FOUND
|
||||
|
||||
.label lvs_display_loading_verifying = KERNAL_0.proxy_K1_lvs_display_loading_verifying
|
||||
.label lvs_display_done = KERNAL_0.proxy_K1_lvs_display_done
|
||||
.label lvs_return_last_address = KERNAL_0.proxy_K1_lvs_return_last_address
|
||||
.label lvs_device_not_found_error = KERNAL_0.proxy_K1_lvs_device_not_found_error
|
||||
.label lvs_load_verify_error = KERNAL_0.proxy_K1_lvs_load_verify_error
|
||||
.label m65_load_autoswitch_tape = KERNAL_0.proxy_K1_m65_load_autoswitch_tape
|
||||
;; #ALIAS# tape_normal_byte_store = KERNAL_0.tape_normal_byte_store
|
||||
|
||||
.label lvs_check_EAL = KERNAL_0.lvs_check_EAL
|
||||
.label lvs_STAL_to_MEMUSS = KERNAL_0.lvs_STAL_to_MEMUSS
|
||||
|
||||
.label kernalerror_ROUTINE_TERMINATED = KERNAL_0.proxy_K1_kernalerror_ROUTINE_TERMINATED
|
||||
|
||||
.label print_kernal_message = KERNAL_0.proxy_K1_print_kernal_message
|
||||
.label print_return = KERNAL_0.proxy_K1_print_return
|
||||
|
||||
.label __MSG_KERNAL_PRESS_PLAY = KERNAL_0.__MSG_KERNAL_PRESS_PLAY
|
||||
.label __MSG_KERNAL_OK_SEARCHING = KERNAL_0.__MSG_KERNAL_OK_SEARCHING
|
||||
.label __MSG_KERNAL_FOUND = KERNAL_0.__MSG_KERNAL_FOUND
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if CONFIG_TAPE_NORMAL
|
||||
|
||||
.label tape_normal_byte_store = KERNAL_0.tape_normal_byte_store
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if CONFIG_TAPE_HEAD_ALIGN
|
||||
|
||||
.label CLALL = KERNAL_0.proxy_K1_CLALL
|
||||
.label nmi_lock = KERNAL_0.nmi_lock
|
||||
|
||||
#endif
|
||||
;; #ALIAS# CLALL = KERNAL_0.proxy_K1_CLALL
|
||||
;; #ALIAS# nmi_lock = KERNAL_0.nmi_lock
|
||||
@@ -1,43 +1,43 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Automatic switching to legacy C64 mode if loading anything below $0800
|
||||
//
|
||||
;
|
||||
; Automatic switching to legacy C64 mode if loading anything below $0800
|
||||
;
|
||||
|
||||
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
|
||||
!ifdef HAS_TAPE {
|
||||
|
||||
|
||||
m65_load_autoswitch_tape:
|
||||
|
||||
lda VERCKK
|
||||
bne m65_load_autoswitch_done // no autoswitch for VERIFY
|
||||
bne m65_load_autoswitch_done ; no autoswitch for VERIFY
|
||||
|
||||
lda STAL+1
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
m65_load_autoswitch:
|
||||
|
||||
lda VERCKK
|
||||
bne m65_load_autoswitch_done // no autoswitch for VERIFY
|
||||
bne m65_load_autoswitch_done ; no autoswitch for VERIFY
|
||||
|
||||
lda EAL+1
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
m65_load_autoswitch_check:
|
||||
|
||||
cmp #$08
|
||||
bcs m65_load_autoswitch_done // no autoswitch if loading above $07FF
|
||||
bcs m65_load_autoswitch_done ; no autoswitch if loading above $07FF
|
||||
|
||||
jsr M65_MODEGET
|
||||
bcs m65_load_autoswitch_done // no autoswitch if already in legacy mode
|
||||
bcs m65_load_autoswitch_done ; no autoswitch if already in legacy mode
|
||||
|
||||
sec
|
||||
jmp M65_MODESET
|
||||
|
||||
// XXX consider displaying something here
|
||||
; XXX consider displaying something here
|
||||
|
||||
m65_load_autoswitch_done:
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// ROM mapping routines for MEGA65
|
||||
//
|
||||
;
|
||||
; ROM mapping routines for MEGA65
|
||||
;
|
||||
|
||||
// Available memory maps:
|
||||
// - NORMAL - nothing mapped in
|
||||
// - KERNAL_1 - for calling KERNAL_1 segment code
|
||||
// - DOS_1 - for swiching to DOS context
|
||||
// - NORMAL_from_DOS_1 - for switching bact from DOS context
|
||||
; Available memory maps:
|
||||
; - NORMAL - nothing mapped in
|
||||
; - KERNAL_1 - for calling KERNAL_1 segment code
|
||||
; - DOS_1 - for swiching to DOS context
|
||||
; - NORMAL_from_DOS_1 - for switching bact from DOS context
|
||||
|
||||
|
||||
map_NORMAL:
|
||||
@@ -22,7 +22,7 @@ map_NORMAL:
|
||||
|
||||
lda #$00
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
map_NORMAL_common:
|
||||
|
||||
@@ -30,14 +30,14 @@ map_NORMAL_common:
|
||||
tay
|
||||
taz
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
map_end:
|
||||
|
||||
map
|
||||
eom
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
map_end_no_eom:
|
||||
|
||||
@@ -62,9 +62,9 @@ map_KERNAL_1:
|
||||
tay
|
||||
taz
|
||||
|
||||
ldx #$42 // $4000 <- map 8KB from $20000
|
||||
ldx #$42 ; $4000 <- map 8KB from $20000
|
||||
|
||||
jmp_8 map_end
|
||||
bra map_end
|
||||
|
||||
map_DOS_1:
|
||||
|
||||
@@ -75,17 +75,17 @@ map_DOS_1:
|
||||
phz
|
||||
|
||||
lda #$80
|
||||
tab // from now on, zeropage starts from $C000
|
||||
tab ; from now on, zeropage starts from $C000
|
||||
|
||||
ldy #$80
|
||||
lda #$30
|
||||
taz // $8000 <- map 16KB RAM from $10000
|
||||
taz ; $8000 <- map 16KB RAM from $10000
|
||||
|
||||
lda #$C0
|
||||
ldx #$C1 // $4000 <- map 16KB ROM from $20000
|
||||
ldx #$C1 ; $4000 <- map 16KB ROM from $20000
|
||||
|
||||
map
|
||||
jmp_8 map_end_no_eom // no EOM, we do not want interrupts within DOS!
|
||||
bra map_end_no_eom ; no EOM, we do not want interrupts within DOS!
|
||||
|
||||
map_NORMAL_from_DOS_1:
|
||||
|
||||
@@ -98,4 +98,4 @@ map_NORMAL_from_DOS_1:
|
||||
lda #$00
|
||||
tab
|
||||
|
||||
jmp_8 map_NORMAL_common
|
||||
bra map_NORMAL_common
|
||||
@@ -1,21 +1,21 @@
|
||||
// #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
m65_native_meminit:
|
||||
|
||||
// Prepare generic DMAgic list
|
||||
; Prepare generic DMAgic list
|
||||
|
||||
jsr m65_dmagic_init
|
||||
|
||||
// Copy MEGA65 charset to target location - set size
|
||||
; Copy MEGA65 charset to target location - set size
|
||||
|
||||
lda #$00
|
||||
sta M65_DMAJOB_SIZE_0
|
||||
lda #$10
|
||||
sta M65_DMAJOB_SIZE_1
|
||||
|
||||
// Set destination
|
||||
; Set destination
|
||||
|
||||
lda #$00
|
||||
sta M65_DMAJOB_DST_3
|
||||
@@ -26,7 +26,7 @@ m65_native_meminit:
|
||||
lda #<MEMCONF_CHRBASE
|
||||
sta M65_DMAJOB_DST_0
|
||||
|
||||
// Set source
|
||||
; Set source
|
||||
|
||||
lda #$00
|
||||
sta M65_DMAJOB_SRC_3
|
||||
@@ -37,6 +37,6 @@ m65_native_meminit:
|
||||
lda #$00
|
||||
sta M65_DMAJOB_SRC_0
|
||||
|
||||
// Launch the DMA job
|
||||
; Launch the DMA job
|
||||
|
||||
jmp m65_dmagic_oper_copy
|
||||
@@ -1,25 +1,29 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Proxies for calling MEGA65 segment KERNAL_0 routines from KERNAL_1
|
||||
//
|
||||
;
|
||||
; Proxies for calling MEGA65 segment KERNAL_0 routines from KERNAL_1
|
||||
;
|
||||
|
||||
|
||||
proxy_K1_chrin_programmable_keys:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr chrin_programmable_keys
|
||||
jmp_8 !+
|
||||
bra proxy_K1_end
|
||||
|
||||
proxy_K1_CHROUT:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr CHROUT
|
||||
!:
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
proxy_K1_end:
|
||||
|
||||
jmp map_KERNAL_1
|
||||
|
||||
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
|
||||
!ifdef HAS_TAPE {
|
||||
|
||||
proxy_K1_kernalerror_ROUTINE_TERMINATED:
|
||||
|
||||
@@ -30,13 +34,13 @@ proxy_K1_lvs_display_loading_verifying:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr lvs_display_loading_verifying
|
||||
jmp_8 !-
|
||||
bra proxy_K1_end
|
||||
|
||||
proxy_K1_lvs_display_done:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr lvs_display_done
|
||||
jmp_8 !-
|
||||
bra proxy_K1_end
|
||||
|
||||
proxy_K1_lvs_return_last_address:
|
||||
|
||||
@@ -57,28 +61,27 @@ proxy_K1_m65_load_autoswitch_tape:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr m65_load_autoswitch_tape
|
||||
jmp_8 !-
|
||||
bra proxy_K1_end
|
||||
|
||||
proxy_K1_print_kernal_message:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr print_kernal_message
|
||||
jmp_8 !-
|
||||
bra proxy_K1_end
|
||||
|
||||
proxy_K1_print_return:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr print_return
|
||||
jmp_8 !-
|
||||
bra proxy_K1_end
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if CONFIG_TAPE_HEAD_ALIGN
|
||||
!ifdef CONFIG_TAPE_HEAD_ALIGN {
|
||||
|
||||
proxy_K1_CLALL:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr CLALL
|
||||
jmp_8 !-
|
||||
|
||||
#endif
|
||||
bra proxy_K1_end
|
||||
}
|
||||
@@ -1,41 +1,41 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// ROM routine call redirect for MEGA65 API routines
|
||||
//
|
||||
;
|
||||
; ROM routine call redirect for MEGA65 API routines
|
||||
;
|
||||
|
||||
M65_MODESET:
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr_ind VK1__M65_MODESET
|
||||
bra m65_api_end
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__M65_MODESET)
|
||||
bra m65_api_end
|
||||
|
||||
M65_SCRMODEGET:
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr_ind VK1__M65_SCRMODEGET
|
||||
bra m65_api_end
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__M65_SCRMODEGET)
|
||||
bra m65_api_end
|
||||
|
||||
M65_SCRMODESET:
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr_ind VK1__M65_SCRMODESET
|
||||
bra m65_api_end
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__M65_SCRMODESET)
|
||||
bra m65_api_end
|
||||
|
||||
M65_CLRSCR:
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr_ind VK1__M65_CLRSCR
|
||||
bra m65_api_end
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__M65_CLRSCR)
|
||||
bra m65_api_end
|
||||
|
||||
M65_CLRWIN:
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr_ind VK1__M65_CLRWIN
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__M65_CLRWIN)
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
m65_api_end:
|
||||
|
||||
jmp map_NORMAL
|
||||
jmp map_NORMAL
|
||||
@@ -1,26 +1,26 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// ROM routine call redirect for MEGA65 screen routines
|
||||
//
|
||||
;
|
||||
; ROM routine call redirect for MEGA65 screen routines
|
||||
;
|
||||
|
||||
|
||||
m65_chrout_screen:
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr_ind VK1__m65_chrout_screen
|
||||
jsr map_NORMAL
|
||||
jmp chrout_done_success
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__m65_chrout_screen)
|
||||
jsr map_NORMAL
|
||||
jmp chrout_done_success
|
||||
|
||||
m65_chrin_keyboard:
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr_ind VK1__m65_chrin_keyboard
|
||||
jmp map_NORMAL
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__m65_chrin_keyboard)
|
||||
jmp map_NORMAL
|
||||
|
||||
m65_screen_upd_txtrow_off:
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr_ind VK1__m65_screen_upd_txtrow_off
|
||||
jmp map_NORMAL
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__m65_screen_upd_txtrow_off)
|
||||
jmp map_NORMAL
|
||||
@@ -1,50 +1,46 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// ROM routine call redirect for tape routines
|
||||
//
|
||||
;
|
||||
; ROM routine call redirect for tape routines
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_TAPE_NORMAL && !CONFIG_TAPE_AUTODETECT
|
||||
!ifdef CONFIG_TAPE_NORMAL { !ifndef CONFIG_TAPE_AUTODETECT {
|
||||
|
||||
load_tape_normal:
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr_ind VK1__load_tape_normal
|
||||
jmp map_NORMAL
|
||||
|
||||
#endif
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__load_tape_normal)
|
||||
jmp map_NORMAL
|
||||
} }
|
||||
|
||||
|
||||
#if CONFIG_TAPE_TURBO && !CONFIG_TAPE_AUTODETECT
|
||||
!ifdef CONFIG_TAPE_TURBO { !ifndef CONFIG_TAPE_AUTODETECT {
|
||||
|
||||
load_tape_turbo:
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr_ind VK1__load_tape_turbo
|
||||
jmp map_NORMAL
|
||||
|
||||
#endif
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__load_tape_turbo)
|
||||
jmp map_NORMAL
|
||||
} }
|
||||
|
||||
|
||||
#if CONFIG_TAPE_AUTODETECT
|
||||
!ifdef CONFIG_TAPE_AUTODETECT {
|
||||
|
||||
load_tape_auto:
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr_ind VK1__load_tape_auto
|
||||
jmp map_NORMAL
|
||||
|
||||
#endif
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__load_tape_auto)
|
||||
jmp map_NORMAL
|
||||
}
|
||||
|
||||
|
||||
#if CONFIG_TAPE_HEAD_ALIGN
|
||||
!ifdef CONFIG_TAPE_HEAD_ALIGN {
|
||||
|
||||
tape_head_align:
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr_ind VK1__tape_head_align
|
||||
jmp map_NORMAL
|
||||
|
||||
#endif
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__tape_head_align)
|
||||
jmp map_NORMAL
|
||||
}
|
||||
@@ -1,26 +1,28 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
// MEGA65 specific part of the hardware
|
||||
; MEGA65 specific part of the hardware
|
||||
|
||||
|
||||
m65_reset_part:
|
||||
|
||||
jsr map_NORMAL // we want normal memory mapping
|
||||
jsr viciv_shutdown // by default we do not want the VIC-IV
|
||||
jsr map_NORMAL ; we want normal memory mapping
|
||||
jsr viciv_shutdown ; by default we do not want the VIC-IV
|
||||
|
||||
jsr M65_MODEGET
|
||||
bcs !+
|
||||
bcs m65_clr_end
|
||||
|
||||
// Clear MEAGA65 native mode mark, it might cause confusion
|
||||
; Clear MEAGA65 native mode mark, it might cause confusion
|
||||
|
||||
m65_clr_magictstr: // entry point for mode switching routine
|
||||
m65_clr_magictstr: ; entry point for mode switching routine
|
||||
|
||||
lda #$00
|
||||
sta M65_MAGICSTR+0
|
||||
sta M65_MAGICSTR+1
|
||||
sta M65_MAGICSTR+2
|
||||
|
||||
// FALLTROUGH
|
||||
!:
|
||||
; FALLTROUGH
|
||||
|
||||
m65_clr_end:
|
||||
|
||||
rts
|
||||
@@ -1,12 +1,12 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Tape (normal) helper routine - byte storage when banking change is needed
|
||||
//
|
||||
;
|
||||
; Tape (normal) helper routine - byte storage when banking change is needed
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_TAPE_NORMAL
|
||||
!ifdef CONFIG_TAPE_NORMAL {
|
||||
|
||||
|
||||
tape_normal_byte_store:
|
||||
@@ -14,6 +14,4 @@ tape_normal_byte_store:
|
||||
jsr map_NORMAL
|
||||
sta (MEMUSS), y
|
||||
jmp map_KERNAL_1
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -1,36 +1,40 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Routine to initialize VIC-IV for entering MEGA65 native mode
|
||||
//
|
||||
;
|
||||
; Routine to initialize VIC-IV for entering MEGA65 native mode
|
||||
;
|
||||
|
||||
|
||||
viciv_init:
|
||||
|
||||
// Switch VIC to VIC-IV mode
|
||||
; Switch VIC to VIC-IV mode
|
||||
|
||||
jsr viciv_unhide
|
||||
|
||||
// Disable badlines and slow interrupt emulation
|
||||
; Disable badlines and slow interrupt emulation
|
||||
|
||||
lda #$00
|
||||
sta MISC_EMU
|
||||
|
||||
// Set misc VIC-IV flags
|
||||
; Set misc VIC-IV flags
|
||||
|
||||
lda #%01000000 // enable C65 character set
|
||||
lda #%01000000 ; enable C65 character set
|
||||
sta VIC_CTRLA
|
||||
|
||||
// Disable hot registers
|
||||
; Disable hot registers
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
viciv_hotregs_off:
|
||||
|
||||
lda VIC_SRH
|
||||
and #$7F
|
||||
!:
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
viciv_hotregs_common:
|
||||
|
||||
sta VIC_SRH
|
||||
|
||||
rts
|
||||
@@ -39,4 +43,4 @@ viciv_hotregs_on:
|
||||
|
||||
lda VIC_SRH
|
||||
ora #$80
|
||||
bra !-
|
||||
bra viciv_hotregs_common
|
||||
@@ -1,33 +1,33 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Routine to shutdown VIC-IV for leaving MEGA65 native mode
|
||||
//
|
||||
;
|
||||
; Routine to shutdown VIC-IV for leaving MEGA65 native mode
|
||||
;
|
||||
|
||||
|
||||
viciv_shutdown:
|
||||
|
||||
// Switch VIC to VIC-IV mode, temporarily
|
||||
; Switch VIC to VIC-IV mode, temporarily
|
||||
|
||||
jsr viciv_unhide
|
||||
|
||||
// Reenable badlines and slow interrupt emulation
|
||||
; Reenable badlines and slow interrupt emulation
|
||||
|
||||
lda #$03
|
||||
sta MISC_EMU
|
||||
|
||||
// Set misc VIC-IV flags
|
||||
; Set misc VIC-IV flags
|
||||
|
||||
lda #%00000000
|
||||
sta VIC_CTRLA // enable C64 character set
|
||||
sta VIC_CTRLB // disable extended resolution and attributes
|
||||
sta VIC_CTRLA ; enable C64 character set
|
||||
sta VIC_CTRLB ; disable extended resolution and attributes
|
||||
|
||||
// Reenable hot registers
|
||||
; Reenable hot registers
|
||||
|
||||
jsr viciv_hotregs_on
|
||||
|
||||
// Hide VIC-IV registers and quit
|
||||
; Hide VIC-IV registers and quit
|
||||
|
||||
sta VIC_KEY
|
||||
rts
|
||||
@@ -1,9 +1,9 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Routine to unhide MEGA65 extra registers
|
||||
//
|
||||
;
|
||||
; Routine to unhide MEGA65 extra registers
|
||||
;
|
||||
|
||||
|
||||
viciv_unhide:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// #LAYOUT# X16 KERNAL_1 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# X16 KERNAL_1 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// Dummy, just to have anything in segment 1
|
||||
; Dummy, just to have anything in segment 1
|
||||
|
||||
brk
|
||||
@@ -1,41 +1,41 @@
|
||||
// #LAYOUT# X16 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# X16 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
// Stubs for Commander X16 support
|
||||
; Stubs for Commander X16 support
|
||||
|
||||
|
||||
scnkey_set_keytab:
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
|
||||
clear_screen:
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
|
||||
vicii_init:
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
|
||||
cursor_blink:
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
|
||||
chrin_keyboard:
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
|
||||
chrout_screen:
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
|
||||
IOINIT:
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
|
||||
SCNKEY:
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
|
||||
SCREEN:
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
|
||||
screen_calculate_pointers:
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
|
||||
setup_pal_ntsc:
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
|
||||
wait_x_bars:
|
||||
STUB_IMPLEMENTATION()
|
||||
+STUB_IMPLEMENTATION
|
||||
+29
-29
@@ -1,90 +1,90 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// Kernal error codes are described in 'Commodore 64 Programmers Reference Guide', page 306
|
||||
; Kernal error codes are described in 'Commodore 64 Programmers Reference Guide', page 306
|
||||
|
||||
kernalerror_ROUTINE_TERMINATED: // by a STOP key
|
||||
kernalerror_ROUTINE_TERMINATED: ; by a STOP key
|
||||
|
||||
lda #K_ERR_ROUTINE_TERMINATED
|
||||
skip_2_bytes_trash_nvz
|
||||
+skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
kernalerror_TOO_MANY_OPEN_FILES:
|
||||
|
||||
lda #K_ERR_TOO_MANY_OPEN_FILES
|
||||
skip_2_bytes_trash_nvz
|
||||
+skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
kernalerror_FILE_ALREADY_OPEN:
|
||||
|
||||
lda #K_ERR_FILE_ALREADY_OPEN
|
||||
skip_2_bytes_trash_nvz
|
||||
+skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
kernalerror_FILE_NOT_OPEN:
|
||||
|
||||
lda #K_ERR_FILE_NOT_OPEN
|
||||
skip_2_bytes_trash_nvz
|
||||
+skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
kernalerror_FILE_NOT_FOUND:
|
||||
|
||||
lda #K_ERR_FILE_NOT_FOUND
|
||||
skip_2_bytes_trash_nvz
|
||||
+skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
kernalerror_DEVICE_NOT_FOUND:
|
||||
|
||||
lda #K_ERR_DEVICE_NOT_FOUND
|
||||
skip_2_bytes_trash_nvz
|
||||
+skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
kernalerror_FILE_NOT_INPUT:
|
||||
|
||||
lda #K_ERR_FILE_NOT_INPUT
|
||||
skip_2_bytes_trash_nvz
|
||||
+skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
kernalerror_FILE_NOT_OUTPUT:
|
||||
|
||||
lda #K_ERR_FILE_NOT_OUTPUT
|
||||
skip_2_bytes_trash_nvz
|
||||
+skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
kernalerror_FILE_NAME_MISSING:
|
||||
|
||||
lda #K_ERR_FILE_NAME_MISSING
|
||||
skip_2_bytes_trash_nvz
|
||||
+skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
kernalerror_ILLEGAL_DEVICE_NUMBER:
|
||||
|
||||
lda #K_ERR_ILLEGAL_DEVICE_NUMBER
|
||||
skip_2_bytes_trash_nvz
|
||||
+skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
|
||||
kernalerror_IEC_TIMEOUT_READ:
|
||||
|
||||
lda #K_STS_TIMEOUT_READ
|
||||
skip_2_bytes_trash_nvz
|
||||
+skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
#endif // CONFIG_IEC_JIFFYDOS
|
||||
} ; CONFIG_IEC_JIFFYDOS
|
||||
|
||||
kernalerror_TOP_MEM_RS232:
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Not this is not an official Kernal API extension (yet)! It is subject to change!
|
||||
//
|
||||
// XXX consider turning this into vector table, the only jumptable extension
|
||||
// would copy the vector table to given memory location
|
||||
;
|
||||
; Not this is not an official Kernal API extension (yet)! It is subject to change!
|
||||
;
|
||||
; XXX consider turning this into vector table, the only jumptable extension
|
||||
; would copy the vector table to given memory location
|
||||
|
||||
|
||||
M65_JMODEGET:
|
||||
@@ -26,13 +26,13 @@ M65_JSELDEV:
|
||||
M65_JCLRSCR:
|
||||
jsr M65_CLRSCR
|
||||
|
||||
M65_JCLRWIN: // XXX consider combining with M65_JCLRSCR
|
||||
M65_JCLRWIN: ; XXX consider combining with M65_JCLRSCR
|
||||
jsr M65_CLRWIN
|
||||
|
||||
M65_JSETWIN_XY:
|
||||
jsr M65_SETWIN_XY
|
||||
|
||||
M65_JSETWIN_WH: // XXX combine this with M65_JSETWIN_N, M65_JSETWIN_Y, and possibly M65_JSETWIN_XY
|
||||
M65_JSETWIN_WH: ; XXX combine this with M65_JSETWIN_N, M65_JSETWIN_Y, and possibly M65_JSETWIN_XY
|
||||
jsr M65_SETWIN_WH
|
||||
|
||||
M65_JSETWIN_N:
|
||||
@@ -41,4 +41,4 @@ M65_JSETWIN_N:
|
||||
M65_JSETWIN_Y:
|
||||
jsr M65_SETWIN_Y
|
||||
|
||||
// XXX add M65_HOME
|
||||
; XXX add M65_HOME
|
||||
@@ -1,30 +1,30 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
M65_MODEGET:
|
||||
|
||||
// Checks if mode is native M65 one; Carry clear = native mode, Carry set = legacy mode
|
||||
; Checks if mode is native M65 one; Carry clear = native mode, Carry set = legacy mode
|
||||
|
||||
pha
|
||||
|
||||
lda M65_MAGICSTR+0
|
||||
cmp #$4D // 'M'
|
||||
bne !+
|
||||
cmp #$4D ; 'M'
|
||||
bne @1
|
||||
lda M65_MAGICSTR+1
|
||||
cmp #$36 // '6'
|
||||
bne !+
|
||||
cmp #$36 ; '6'
|
||||
bne @1
|
||||
lda M65_MAGICSTR+2
|
||||
cmp #$35 // '5'
|
||||
bne !+
|
||||
cmp #$35 ; '5'
|
||||
bne @1
|
||||
|
||||
// M65 native mode
|
||||
; M65 native mode
|
||||
|
||||
clc
|
||||
pla
|
||||
rts
|
||||
!:
|
||||
// C64 compatibility mode
|
||||
@1:
|
||||
; C64 compatibility mode
|
||||
|
||||
sec
|
||||
pla
|
||||
|
||||
@@ -1,72 +1,72 @@
|
||||
// #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
M65_MODESET:
|
||||
|
||||
// Carry clear = set native mode; Carry set = set legacy mode
|
||||
; Carry clear = set native mode; Carry set = set legacy mode
|
||||
|
||||
bcc m65_mode65
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
m65_mode64:
|
||||
|
||||
// Disable interrupts, they might interfere
|
||||
; Disable interrupts, they might interfere
|
||||
|
||||
sei
|
||||
|
||||
// Set the magic string to mark legacy mode
|
||||
; Set the magic string to mark legacy mode
|
||||
|
||||
jsr m65_clr_magictstr
|
||||
|
||||
// Restore VIC-II configuration
|
||||
; Restore VIC-II configuration
|
||||
|
||||
jsr viciv_shutdown
|
||||
jsr vicii_init
|
||||
|
||||
// Reenable interrupts
|
||||
; Reenable interrupts
|
||||
|
||||
cli
|
||||
|
||||
// Switch CPU speed back to slow and quit
|
||||
; Switch CPU speed back to slow and quit
|
||||
|
||||
jmp M65_SLOW
|
||||
|
||||
|
||||
m65_mode65:
|
||||
|
||||
// Disable interrupts, they might interfere
|
||||
; Disable interrupts, they might interfere
|
||||
|
||||
sei
|
||||
|
||||
// Switch CPU speed to fast
|
||||
; Switch CPU speed to fast
|
||||
|
||||
jsr M65_FAST
|
||||
|
||||
// Set the magic string to mark native mode
|
||||
; Set the magic string to mark native mode
|
||||
|
||||
lda #$4D // 'M'
|
||||
lda #$4D ; 'M'
|
||||
sta M65_MAGICSTR+0
|
||||
lda #$36 // '6'
|
||||
lda #$36 ; '6'
|
||||
sta M65_MAGICSTR+1
|
||||
lda #$35 // '5'
|
||||
lda #$35 ; '5'
|
||||
sta M65_MAGICSTR+2
|
||||
|
||||
// Initialize VIC-IV
|
||||
; Initialize VIC-IV
|
||||
|
||||
jsr vicii_init
|
||||
jsr viciv_init
|
||||
|
||||
// Initialize various memory structures
|
||||
; Initialize various memory structures
|
||||
|
||||
jsr m65_native_meminit
|
||||
|
||||
// Set screen mode to 80x50
|
||||
; Set screen mode to 80x50
|
||||
|
||||
lda #$02
|
||||
jsr m65_scrmodeset_internal
|
||||
|
||||
// Clear the screen
|
||||
; Clear the screen
|
||||
|
||||
jmp M65_CLRSCR
|
||||
@@ -1,15 +1,15 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
M65_SLOW: // set CPU speed to 1 MHz
|
||||
M65_SLOW: ; set CPU speed to 1 MHz
|
||||
|
||||
lda #$40
|
||||
skip_2_bytes_trash_nvz
|
||||
+skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
M65_FAST: // set CPU speed to 40 MHz
|
||||
M65_FAST: ; set CPU speed to 40 MHz
|
||||
|
||||
lda #$41
|
||||
sta CPU_D6510
|
||||
|
||||
+23
-23
@@ -1,38 +1,38 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - page 274
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 224/225
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): .Y
|
||||
//
|
||||
;
|
||||
; Official Kernal routine, described in:
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - page 274
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 224/225
|
||||
;
|
||||
; CPU registers that has to be preserved (see [RG64]): .Y
|
||||
;
|
||||
|
||||
|
||||
ACPTR:
|
||||
|
||||
lda IOSTATUS
|
||||
beq !+
|
||||
beq @1
|
||||
|
||||
clc
|
||||
lda #$0D // tested on real ROMs
|
||||
lda #$0D ; tested on real ROMs
|
||||
rts
|
||||
!:
|
||||
@1:
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
jsr m65dos_check
|
||||
bcc_16 m65dos_acptr // branch if device is handeld by internal DOS
|
||||
#endif
|
||||
+bcc m65dos_acptr ; branch if device is handeld by internal DOS
|
||||
}
|
||||
|
||||
#if CONFIG_IEC
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC {
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
jmp iec_rx_dispatch
|
||||
#else
|
||||
} else {
|
||||
jmp iec_rx_byte
|
||||
#endif
|
||||
#else
|
||||
}
|
||||
} else { ; no CONFIG_IEC
|
||||
jmp kernalerror_ILLEGAL_DEVICE_NUMBER
|
||||
#endif
|
||||
}
|
||||
+13
-13
@@ -1,34 +1,34 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// IEC part of the CHKIN routine
|
||||
//
|
||||
;
|
||||
; IEC part of the CHKIN routine
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
chkin_iec:
|
||||
|
||||
// Fail if the file is open for writing (secondary address 1)
|
||||
; Fail if the file is open for writing (secondary address 1)
|
||||
|
||||
lda LAT, Y
|
||||
cmp #$01
|
||||
beq_16 chkin_file_not_input
|
||||
+beq chkin_file_not_input
|
||||
|
||||
// Send TALK + TKSA first
|
||||
; Send TALK + TKSA first
|
||||
lda FAT,Y
|
||||
|
||||
jsr TALK
|
||||
bcs_16 chkinout_device_not_present
|
||||
+bcs chkinout_device_not_present
|
||||
|
||||
lda LAT, Y
|
||||
ora #$60
|
||||
jsr TKSA
|
||||
bcs_16 chkinout_device_not_present
|
||||
+bcs chkinout_device_not_present
|
||||
|
||||
jmp chkin_set_device
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
} ; CONFIG_IEC
|
||||
@@ -1,13 +1,13 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// IEC part of the CHRIN routine
|
||||
//
|
||||
;
|
||||
; IEC part of the CHRIN routine
|
||||
;
|
||||
|
||||
|
||||
chrin_iec:
|
||||
|
||||
// XXX is this really all?
|
||||
; XXX is this really all?
|
||||
jmp JACPTR
|
||||
@@ -1,15 +1,15 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// IEC part of the CHROUT routine
|
||||
//
|
||||
;
|
||||
; IEC part of the CHROUT routine
|
||||
;
|
||||
|
||||
|
||||
chrout_iec:
|
||||
|
||||
lda SCHAR
|
||||
jsr JCIOUT
|
||||
bcc_16 chrout_done_success
|
||||
+bcc chrout_done_success
|
||||
jmp chrout_done_fail
|
||||
+26
-27
@@ -1,57 +1,56 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - page 279/280
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 224
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||
//
|
||||
;
|
||||
; Official Kernal routine, described in:
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - page 279/280
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 224
|
||||
;
|
||||
; CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||
;
|
||||
|
||||
|
||||
CIOUT:
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
pha
|
||||
lda C3PO
|
||||
bne ciout_send_byte
|
||||
|
||||
// Nothing to send - set buffer as valid, store byte there
|
||||
; Nothing to send - set buffer as valid, store byte there
|
||||
inc C3PO
|
||||
|
||||
// Clear carry flag to indicate success
|
||||
; Clear carry flag to indicate success
|
||||
clc
|
||||
|
||||
ciout_store_in_buffer:
|
||||
|
||||
// Store in the buffer data to be sent next, return
|
||||
; Store in the buffer data to be sent next, return
|
||||
pla
|
||||
sta BSOUR
|
||||
rts
|
||||
|
||||
ciout_send_byte:
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
jsr m65dos_check
|
||||
bcc_16 m65dos_ciout // branch if device is handeld by internal DOS
|
||||
#endif
|
||||
+bcc m65dos_ciout ; branch if device is handeld by internal DOS
|
||||
}
|
||||
|
||||
clc // send without EOI
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
clc ; send without EOI
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
jsr iec_tx_dispatch
|
||||
#else
|
||||
} else {
|
||||
jsr iec_tx_byte
|
||||
#endif
|
||||
inc C3PO // tx byte routine sets to 0, but we still have something to send
|
||||
}
|
||||
inc C3PO ; tx byte routine sets to 0, but we still have something to send
|
||||
jmp ciout_store_in_buffer
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
sec // indicate failure
|
||||
sec ; indicate failure
|
||||
rts
|
||||
|
||||
#endif
|
||||
}
|
||||
+13
-13
@@ -1,34 +1,34 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// IEC part of the CKOUT routine
|
||||
//
|
||||
;
|
||||
; IEC part of the CKOUT routine
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
ckout_iec:
|
||||
|
||||
// Fail if the file is open for reading (secondary address 0)
|
||||
; Fail if the file is open for reading (secondary address 0)
|
||||
|
||||
lda LAT, Y
|
||||
beq_16 ckout_file_not_output
|
||||
+beq ckout_file_not_output
|
||||
|
||||
// Send LISTEN + SECOND first
|
||||
; Send LISTEN + SECOND first
|
||||
lda FAT,Y
|
||||
|
||||
jsr LISTEN
|
||||
bcs_16 chkinout_device_not_present
|
||||
+bcs chkinout_device_not_present
|
||||
|
||||
lda LAT, Y
|
||||
ora #$60
|
||||
jsr SECOND
|
||||
bcs_16 chkinout_device_not_present
|
||||
+bcs chkinout_device_not_present
|
||||
|
||||
jmp ckout_set_device
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
} ; CONFIG_IEC
|
||||
+17
-16
@@ -1,38 +1,39 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// IEC part of the CLOSE routine
|
||||
//
|
||||
;
|
||||
; IEC part of the CLOSE routine
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
// .Y contains LAT/FAT/SAT table index, it should stay this way
|
||||
; .Y contains LAT/FAT/SAT table index, it should stay this way
|
||||
|
||||
close_iec:
|
||||
|
||||
jsr iec_tx_flush // make sure no byte is awaiting
|
||||
lda SAT, y // get secondary address
|
||||
jsr iec_tx_flush ; make sure no byte is awaiting
|
||||
lda SAT, y ; get secondary address
|
||||
cmp #$60
|
||||
bne !+
|
||||
bne @1
|
||||
|
||||
// workaround for using CLOSE on reading executable - XXX is this a proper way?
|
||||
; workaround for using CLOSE on reading executable - XXX is this a proper way?
|
||||
jsr iec_close_load
|
||||
jmp close_remove_from_table
|
||||
|
||||
!:
|
||||
ora $E0 // CLOSE command
|
||||
@1:
|
||||
ora $E0 ; CLOSE command
|
||||
sta TBTCNT
|
||||
jsr iec_tx_command
|
||||
bcs close_iec_end
|
||||
jsr iec_tx_command_finalize
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
close_iec_end:
|
||||
|
||||
jmp close_remove_from_table
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
} ; CONFIG_IEC
|
||||
+15
-15
@@ -1,33 +1,33 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// IEC part of the CLRCHN routine
|
||||
//
|
||||
;
|
||||
; IEC part of the CLRCHN routine
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
clrchn_iec:
|
||||
|
||||
// Check input device
|
||||
; Check input device
|
||||
lda DFLTN
|
||||
jsr iec_check_devnum_oc
|
||||
bcs !+
|
||||
bcs @1
|
||||
|
||||
// It was IEC device - send UNTALK first
|
||||
; It was IEC device - send UNTALK first
|
||||
jsr UNTLK
|
||||
!:
|
||||
// Check output device
|
||||
@1:
|
||||
; Check output device
|
||||
lda DFLTO
|
||||
jsr iec_check_devnum_oc
|
||||
|
||||
// If it was IEC device - send UNLSN first
|
||||
bcc_16 UNLSN
|
||||
; If it was IEC device - send UNLSN first
|
||||
+bcc UNLSN
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
} ; CONFIG_IEC
|
||||
@@ -1,36 +1,36 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Checks whether device number (in .A) is a correct IEC device number
|
||||
//
|
||||
// Preserves .A, .X and .Y
|
||||
//
|
||||
;
|
||||
; Checks whether device number (in .A) is a correct IEC device number
|
||||
;
|
||||
; Preserves .A, .X and .Y
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
iec_check_devnum_lvs: // for load/verify/save
|
||||
iec_check_devnum_lvs: ; for load/verify/save
|
||||
|
||||
cmp #$08 // below 8 are illegal for load/save
|
||||
cmp #$08 ; below 8 are illegal for load/save
|
||||
bcc iec_check_devnum_failed
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
iec_check_devnum_oc: // for open/close
|
||||
iec_check_devnum_oc: ; for open/close
|
||||
|
||||
cmp #$04 // below 4 are illegal, reserved for non-IEC devices on Commodore
|
||||
cmp #$04 ; below 4 are illegal, reserved for non-IEC devices on Commodore
|
||||
bcc iec_check_devnum_failed
|
||||
|
||||
// 31 and above are illegal too, due to IEC command encoding scheme,
|
||||
// see https://www.pagetable.com/?p=1031
|
||||
cmp #$1F // sets carry for 31 or above
|
||||
; 31 and above are illegal too, due to IEC command encoding scheme,
|
||||
; see https://www.pagetable.com/?p=1031
|
||||
cmp #$1F ; sets carry for 31 or above
|
||||
rts
|
||||
|
||||
iec_check_devnum_failed:
|
||||
|
||||
sec // indicate non-IEC device
|
||||
sec ; indicate non-IEC device
|
||||
rts
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
} ; CONFIG_IEC
|
||||
@@ -1,34 +1,34 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Common part of CLOSE and LOAD/SAVE routines for IEC
|
||||
//
|
||||
;
|
||||
; Common part of CLOSE and LOAD/SAVE routines for IEC
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_close_load:
|
||||
|
||||
tax
|
||||
|
||||
// Command drive to stop talking before closing the file
|
||||
; Command drive to stop talking before closing the file
|
||||
jsr UNTLK
|
||||
|
||||
txa
|
||||
jsr LISTEN
|
||||
|
||||
lda #$E0 // CLOSE command
|
||||
lda #$E0 ; CLOSE command
|
||||
sta TBTCNT
|
||||
jsr iec_tx_command
|
||||
jsr iec_tx_command_finalize
|
||||
|
||||
// Tell drive to unlisten
|
||||
; Tell drive to unlisten
|
||||
jsr UNLSN
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
} ; CONFIG_IEC
|
||||
@@ -1,33 +1,29 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Kernal internal IEC routine
|
||||
//
|
||||
// - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
|
||||
//
|
||||
;
|
||||
; Kernal internal IEC routine
|
||||
;
|
||||
; - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_cmd_close:
|
||||
|
||||
jsr iec_check_channel_openclose
|
||||
bcc !+
|
||||
jmp kernalerror_FILE_NOT_INPUT
|
||||
!:
|
||||
+bcs kernalerror_FILE_NOT_INPUT
|
||||
|
||||
ora #$E0
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
|
||||
jsr m65dos_check
|
||||
bcc_16 m65dos_second // branch if device is handeld by internal DOS
|
||||
|
||||
#endif
|
||||
+bcc m65dos_second ; branch if device is handeld by internal DOS
|
||||
}
|
||||
|
||||
jmp common_open_close_unlsn_second
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
@@ -1,78 +1,73 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Kernal internal IEC routine
|
||||
//
|
||||
// - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
|
||||
//
|
||||
;
|
||||
; Kernal internal IEC routine
|
||||
;
|
||||
; - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_cmd_open: // similar to TKSA, but without turnaround
|
||||
iec_cmd_open: ; similar to TKSA, but without turnaround
|
||||
|
||||
jsr iec_check_channel_openclose
|
||||
bcc !+
|
||||
jmp kernalerror_FILE_NOT_INPUT
|
||||
!:
|
||||
+bcs kernalerror_FILE_NOT_INPUT
|
||||
|
||||
ora #$F0
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
|
||||
jsr m65dos_check
|
||||
bcc_16 m65dos_second // branch if device is handeld by internal DOS
|
||||
+bcc m65dos_second ; branch if device is handeld by internal DOS
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_MEGA_65
|
||||
!ifdef HAS_IEC_BURST {
|
||||
pha
|
||||
jsr burst_advertise
|
||||
pla
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_IEC_DOLPHINDOS
|
||||
!ifdef CONFIG_IEC_DOLPHINDOS {
|
||||
|
||||
sta TBTCNT
|
||||
jsr iec_tx_command
|
||||
bcs !+ // branch if error
|
||||
|
||||
bcs common_open_close_unlsn_second_done
|
||||
jsr dolphindos_detect
|
||||
|
||||
jmp iec_tx_command_finalize
|
||||
}
|
||||
; FALLTROUGH
|
||||
|
||||
#else
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
#endif
|
||||
|
||||
common_open_close_unlsn_second: // common part of several commands
|
||||
common_open_close_unlsn_second: ; common part of several commands
|
||||
|
||||
sta TBTCNT
|
||||
jsr iec_tx_command
|
||||
bcs !+ // branch if error
|
||||
jmp iec_tx_command_finalize
|
||||
!:
|
||||
+bcc iec_tx_command_finalize
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
common_open_close_unlsn_second_done:
|
||||
|
||||
rts
|
||||
|
||||
iec_check_channel_openclose:
|
||||
// Due to OPEN/CLOSE/TKSA/SECOND command encoding (see https://www.pagetable.com/?p=1031),
|
||||
// allowed channels are 0-15; report error if out of range
|
||||
; Due to OPEN/CLOSE/TKSA/SECOND command encoding (see https://www.pagetable.com/?p=1031),
|
||||
; allowed channels are 0-15; report error if out of range
|
||||
cmp #$10
|
||||
bcc !+
|
||||
// Workaround to allow reading executable files and disk directory
|
||||
// using OPEN routine - see https://www.pagetable.com/?p=273 for
|
||||
// example usage
|
||||
bcc @1
|
||||
; Workaround to allow reading executable files and disk directory
|
||||
; using OPEN routine - see https://www.pagetable.com/?p=273 for
|
||||
; example usage
|
||||
cmp #$60
|
||||
beq !+
|
||||
sec // mark unsuitable channel number
|
||||
beq @1
|
||||
sec ; mark unsuitable channel number
|
||||
rts
|
||||
!:
|
||||
clc // mark suitable channel number
|
||||
@1:
|
||||
clc ; mark suitable channel number
|
||||
rts
|
||||
}
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
@@ -1,88 +1,90 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Helper IEC routines to pull/release certain lines
|
||||
//
|
||||
// Order of operation is set for extra robustness, on non-emulated hardware
|
||||
// lines might need few cycles to stabilize (released CLK = DATA considered valid),
|
||||
// see page 10 of http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
//
|
||||
;
|
||||
; Helper IEC routines to pull/release certain lines
|
||||
;
|
||||
; Order of operation is set for extra robustness, on non-emulated hardware
|
||||
; lines might need few cycles to stabilize (released CLK = DATA considered valid),
|
||||
; see page 10 of http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
;
|
||||
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_pull_atn_clk_release_data:
|
||||
|
||||
lda CIA2_PRA
|
||||
ora #BIT_CIA2_PRA_ATN_OUT // pull
|
||||
ora #BIT_CIA2_PRA_ATN_OUT ; pull
|
||||
sta CIA2_PRA
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
iec_pull_clk_release_data:
|
||||
|
||||
lda CIA2_PRA
|
||||
ora #BIT_CIA2_PRA_CLK_OUT // pull
|
||||
ora #BIT_CIA2_PRA_CLK_OUT ; pull
|
||||
sta CIA2_PRA
|
||||
!:
|
||||
and #$FF - BIT_CIA2_PRA_DAT_OUT // release
|
||||
bne iec_pull_release_end // branch always
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
iec_pull_clk_release_data_1:
|
||||
|
||||
and #$FF - BIT_CIA2_PRA_DAT_OUT ; release
|
||||
bne iec_pull_release_end ; branch always
|
||||
|
||||
iec_pull_clk_release_data_oneshot:
|
||||
|
||||
lda CIA2_PRA
|
||||
ora #BIT_CIA2_PRA_CLK_OUT // pull
|
||||
bne !- // branch always
|
||||
ora #BIT_CIA2_PRA_CLK_OUT ; pull
|
||||
bne iec_pull_clk_release_data_1 ; branch always
|
||||
|
||||
iec_release_atn_clk_data:
|
||||
|
||||
lda CIA2_PRA
|
||||
and #$FF - BIT_CIA2_PRA_ATN_OUT // release
|
||||
and #$FF - BIT_CIA2_PRA_ATN_OUT ; release
|
||||
sta CIA2_PRA
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
iec_release_clk_data:
|
||||
|
||||
lda CIA2_PRA
|
||||
and #$FF - BIT_CIA2_PRA_DAT_OUT // release
|
||||
and #$FF - BIT_CIA2_PRA_DAT_OUT ; release
|
||||
sta CIA2_PRA
|
||||
and #$FF - BIT_CIA2_PRA_CLK_OUT // release
|
||||
and #$FF - BIT_CIA2_PRA_CLK_OUT ; release
|
||||
jmp iec_pull_release_end
|
||||
|
||||
iec_release_clk_pull_data:
|
||||
|
||||
lda CIA2_PRA
|
||||
ora #BIT_CIA2_PRA_DAT_OUT // pull
|
||||
ora #BIT_CIA2_PRA_DAT_OUT ; pull
|
||||
sta CIA2_PRA
|
||||
and #$FF - BIT_CIA2_PRA_CLK_OUT // release
|
||||
bne iec_pull_release_end // branch always
|
||||
and #$FF - BIT_CIA2_PRA_CLK_OUT ; release
|
||||
bne iec_pull_release_end ; branch always
|
||||
|
||||
iec_pull_data_release_atn_clk:
|
||||
|
||||
lda CIA2_PRA
|
||||
ora #BIT_CIA2_PRA_DAT_OUT // pull
|
||||
ora #BIT_CIA2_PRA_DAT_OUT ; pull
|
||||
sta CIA2_PRA
|
||||
and #$FF - BIT_CIA2_PRA_CLK_OUT // release
|
||||
and #$FF - BIT_CIA2_PRA_CLK_OUT ; release
|
||||
sta CIA2_PRA
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
iec_release_atn:
|
||||
|
||||
lda CIA2_PRA
|
||||
and #$FF - BIT_CIA2_PRA_ATN_OUT // release
|
||||
and #$FF - BIT_CIA2_PRA_ATN_OUT ; release
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
iec_pull_release_end:
|
||||
|
||||
sta CIA2_PRA
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
+24
-26
@@ -1,44 +1,42 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Helper routines to return with error/success
|
||||
//
|
||||
// All of them restore X/Y registers from stack,
|
||||
// they take care about Carry flag,
|
||||
// error return reeset IEC line to default state,
|
||||
// take care about .A and IOSTATUS
|
||||
//
|
||||
;
|
||||
; Helper routines to return with error/success
|
||||
;
|
||||
; All of them restore X/Y registers from stack,
|
||||
; they take care about Carry flag,
|
||||
; error return reeset IEC line to default state,
|
||||
; take care about .A and IOSTATUS
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_return_success:
|
||||
|
||||
// BSOUR is certainly not valid anymore
|
||||
; BSOUR is certainly not valid anymore
|
||||
lda #$00
|
||||
sta C3PO
|
||||
// Restore registers
|
||||
ply_trash_a
|
||||
plx_trash_a
|
||||
// Report success
|
||||
; Restore registers
|
||||
+ply_trash_a
|
||||
+plx_trash_a
|
||||
; Report success
|
||||
clc
|
||||
rts
|
||||
|
||||
iec_return_DEVICE_NOT_FOUND:
|
||||
|
||||
// Set IEC line to normal idle state
|
||||
; Set IEC line to normal idle state
|
||||
jsr iec_set_idle
|
||||
// BSOUR is certainly not valid anymore
|
||||
; BSOUR is certainly not valid anymore
|
||||
lda #$00
|
||||
sta C3PO
|
||||
// Restore registers
|
||||
ply_trash_a
|
||||
plx_trash_a
|
||||
// Report error
|
||||
; Restore registers
|
||||
+ply_trash_a
|
||||
+plx_trash_a
|
||||
; Report error
|
||||
jmp kernalerror_DEVICE_NOT_FOUND
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
@@ -1,161 +1,160 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
// Receive a byte from the IEC bus.
|
||||
// Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc,
|
||||
// http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf (page 11)
|
||||
//
|
||||
// Preserves .X and .Y registers
|
||||
; Receive a byte from the IEC bus.
|
||||
; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc,
|
||||
; http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf (page 11)
|
||||
;
|
||||
; Preserves .X and .Y registers
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
|
||||
iec_rx_dispatch:
|
||||
|
||||
lda IECPROTO
|
||||
cmp #IEC_JIFFY
|
||||
beq_16 jiffydos_rx_byte
|
||||
+beq jiffydos_rx_byte
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
#endif // CONFIG_IEC_JIFFYDOS
|
||||
} ; CONFIG_IEC_JIFFYDOS
|
||||
|
||||
|
||||
iec_rx_byte:
|
||||
|
||||
// Store .X and .Y on the stack - preserve them
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
; Store .X and .Y on the stack - preserve them
|
||||
+phx_trash_a
|
||||
+phy_trash_a
|
||||
|
||||
// Timing is critical here - execute on disabled IRQs
|
||||
// The best practice would be to do PHP first, but it seems this is not
|
||||
// what the original ROM does; furthermore, pushing additional bytes to
|
||||
// stack can wreck autostart softwaree loading at $0100
|
||||
; Timing is critical here - execute on disabled IRQs
|
||||
; The best practice would be to do PHP first, but it seems this is not
|
||||
; what the original ROM does; furthermore, pushing additional bytes to
|
||||
; stack can wreck autostart softwaree loading at $0100
|
||||
sei
|
||||
|
||||
// First, we wait for the talker to release the CLK line
|
||||
; First, we wait for the talker to release the CLK line
|
||||
jsr iec_wait_for_clk_release
|
||||
|
||||
// We then release the DATA to signal we are ready
|
||||
// We can use this routine, since we were not pulling CLK anyway
|
||||
; We then release the DATA to signal we are ready
|
||||
; We can use this routine, since we were not pulling CLK anyway
|
||||
jsr iec_release_clk_data
|
||||
|
||||
// Wait till data line is released (someone else might be holding it)
|
||||
; Wait till data line is released (someone else might be holding it)
|
||||
jsr iec_wait_for_data_release
|
||||
|
||||
// Check if EOI
|
||||
; Check if EOI
|
||||
jsr iec_rx_check_eoi
|
||||
|
||||
#if CONFIG_IEC_DOLPHINDOS
|
||||
!ifdef CONFIG_IEC_DOLPHINDOS {
|
||||
|
||||
// Check if DolphinDOS was detected
|
||||
; Check if DolphinDOS was detected
|
||||
lda IECPROTO
|
||||
cmp #IEC_DOLPHIN
|
||||
bne iec_rx_no_dolphindos
|
||||
|
||||
// For DolphinDOS just fetch the byte from parallel port
|
||||
; For DolphinDOS just fetch the byte from parallel port
|
||||
lda CIA2_PRB
|
||||
pha
|
||||
jmp iec_rx_acknowledge
|
||||
|
||||
iec_rx_no_dolphindos:
|
||||
|
||||
#endif // CONFIG_IEC_DOLPHINDOS
|
||||
} ; CONFIG_IEC_DOLPHINDOS
|
||||
|
||||
// Latch input bits in on rising edge of CLK, eight times for eight bits.
|
||||
; Latch input bits in on rising edge of CLK, eight times for eight bits.
|
||||
ldx #7
|
||||
|
||||
// Get empty byte to load into.
|
||||
; Get empty byte to load into.
|
||||
lda #$00
|
||||
pha
|
||||
|
||||
iec_rx_bit_loop:
|
||||
|
||||
// Wait for CLK to release
|
||||
; Wait for CLK to release
|
||||
jsr iec_wait_for_clk_release
|
||||
|
||||
// (we do this implicitly below, with a tighter routine,
|
||||
// so that we do not have timing problems, as the requirements
|
||||
// are quite tight. Basically we need to read the clock and data
|
||||
// bit from the same byte read.
|
||||
; (we do this implicitly below, with a tighter routine,
|
||||
; so that we do not have timing problems, as the requirements
|
||||
; are quite tight. Basically we need to read the clock and data
|
||||
; bit from the same byte read.
|
||||
|
||||
// DATA now has the next bit, but inverted (well, except that it turns out not to be).
|
||||
// DATA is in bit 7, which is a bit annoying.
|
||||
// But we can clock it out with a ROL instruction
|
||||
// so that it is in C. We can then ROR it into the
|
||||
// partial data byte.
|
||||
// We use ROR so that we shift in from the top, so that
|
||||
// the first bit we shift in ends up in bit 0 after all
|
||||
// 8 bits have been read.
|
||||
// ODD: For some reason we don't need to invert the
|
||||
// received bits. This is weird, because we invert them
|
||||
// on the way out, and everything in the protocol seems
|
||||
// to indicate that we sould do so. But experimentation
|
||||
// has confirmed the bits don't need inversion on reception.
|
||||
; DATA now has the next bit, but inverted (well, except that it turns out not to be).
|
||||
; DATA is in bit 7, which is a bit annoying.
|
||||
; But we can clock it out with a ROL instruction
|
||||
; so that it is in C. We can then ROR it into the
|
||||
; partial data byte.
|
||||
; We use ROR so that we shift in from the top, so that
|
||||
; the first bit we shift in ends up in bit 0 after all
|
||||
; 8 bits have been read.
|
||||
; ODD: For some reason we don't need to invert the
|
||||
; received bits. This is weird, because we invert them
|
||||
; on the way out, and everything in the protocol seems
|
||||
; to indicate that we sould do so. But experimentation
|
||||
; has confirmed the bits don't need inversion on reception.
|
||||
|
||||
// Move data bit into C flag, and loop until bit 6 clears
|
||||
// i.e., the clock has been released.
|
||||
; Move data bit into C flag, and loop until bit 6 clears
|
||||
; i.e., the clock has been released.
|
||||
|
||||
!: lda CIA2_PRA
|
||||
@1:
|
||||
lda CIA2_PRA
|
||||
rol
|
||||
bpl !-
|
||||
bpl @1
|
||||
|
||||
// Pull it into the data byte
|
||||
; Pull it into the data byte
|
||||
pla
|
||||
ror
|
||||
pha
|
||||
|
||||
// Wait for CLK to be pulled again, over 300 usec (307 cycles on NTSC)
|
||||
// consider this a timeout
|
||||
ldy #$19 // 2 cycles
|
||||
; Wait for CLK to be pulled again, over 300 usec (307 cycles on NTSC)
|
||||
; consider this a timeout
|
||||
ldy #$19 ; 2 cycles
|
||||
iec_rx_clk_wait2:
|
||||
lda CIA2_PRA // 4 cycles
|
||||
rol // 2 cycles, to put CLK in as the last bit
|
||||
bpl !+ // 2 cycles if not jumped
|
||||
dey // 2 cycles
|
||||
bne iec_rx_clk_wait2 // 3 cycles if jumped
|
||||
lda CIA2_PRA ; 4 cycles
|
||||
rol ; 2 cycles, to put CLK in as the last bit
|
||||
bpl @2 ; 2 cycles if not jumped
|
||||
dey ; 2 cycles
|
||||
bne iec_rx_clk_wait2 ; 3 cycles if jumped
|
||||
|
||||
// Timeout
|
||||
; Timeout
|
||||
jsr kernalstatus_EOI
|
||||
pla
|
||||
|
||||
jmp iec_rx_end
|
||||
!:
|
||||
// More bits?
|
||||
@2:
|
||||
; More bits?
|
||||
dex
|
||||
bpl iec_rx_bit_loop
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
iec_rx_acknowledge:
|
||||
|
||||
// Then we must within 1000 usec acknowledge the byte by
|
||||
// pulling DATA. At this point, CLK is pulled by the
|
||||
// talker and DATA by us, i.e., we are ready to receive
|
||||
// the next byte. (p11).
|
||||
; Then we must within 1000 usec acknowledge the byte by
|
||||
; pulling DATA. At this point, CLK is pulled by the
|
||||
; talker and DATA by us, i.e., we are ready to receive
|
||||
; the next byte. (p11).
|
||||
jsr iec_release_clk_pull_data
|
||||
|
||||
// Retrieve the received byte
|
||||
; Retrieve the received byte
|
||||
pla
|
||||
|
||||
// Restore registers
|
||||
sta TBTCNT // $A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html
|
||||
; Restore registers
|
||||
sta TBTCNT ; $A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
iec_rx_end:
|
||||
|
||||
ply_trash_a
|
||||
plx_trash_a
|
||||
+ply_trash_a
|
||||
+plx_trash_a
|
||||
lda TBTCNT
|
||||
|
||||
clc
|
||||
cli
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
@@ -1,37 +1,36 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Helper routine to check for EOI while receiving byte from IEC
|
||||
//
|
||||
;
|
||||
; Helper routine to check for EOI while receiving byte from IEC
|
||||
;
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_rx_check_eoi:
|
||||
|
||||
// Wait for talker to pull CLK.
|
||||
// If over 200 usec (205 cycles on NTSC machine) , then it is EOI.
|
||||
// Loop iteraction takes 11 cycles, 19 full iterations are enough
|
||||
; Wait for talker to pull CLK.
|
||||
; If over 200 usec (205 cycles on NTSC machine) , then it is EOI.
|
||||
; Loop iteraction takes 11 cycles, 19 full iterations are enough
|
||||
|
||||
ldx #$13 // 2 cycles
|
||||
ldx #$13 ; 2 cycles
|
||||
@1:
|
||||
bit CIA2_PRA ; 4 cycles
|
||||
bvc iec_rx_check_eoi_done ; 2 cycles if not jumped
|
||||
dex ; 2 cycles
|
||||
bne @1 ; 3 cycles if jumped
|
||||
|
||||
!:
|
||||
bit CIA2_PRA // 4 cycles
|
||||
bvc iec_rx_check_eoi_done // 2 cycles if not jumped
|
||||
dex // 2 cycles
|
||||
bne !- // 3 cycles if jumped
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
iec_rx_check_eoi_confirm:
|
||||
|
||||
// Timeout - either this is the last byte of stream, or the stream is empty at all.
|
||||
// Mark end of stream in IOSTATUS
|
||||
; Timeout - either this is the last byte of stream, or the stream is empty at all.
|
||||
; Mark end of stream in IOSTATUS
|
||||
jsr kernalstatus_EOI
|
||||
|
||||
// Pull data for 60 usec to confirm it
|
||||
; Pull data for 60 usec to confirm it
|
||||
jsr iec_release_clk_pull_data
|
||||
jsr iec_wait60us
|
||||
jsr iec_release_clk_data
|
||||
@@ -39,6 +38,4 @@ iec_rx_check_eoi_confirm:
|
||||
iec_rx_check_eoi_done:
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Sends file (stream) name to IEC device
|
||||
//
|
||||
;
|
||||
; Sends file (stream) name to IEC device
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_send_file_name:
|
||||
@@ -17,33 +17,31 @@ iec_send_file_name_loop:
|
||||
cpy FNLEN
|
||||
beq iec_send_file_name_done
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
!ifdef CONFIG_MEMORY_MODEL_60K {
|
||||
ldx #<FNADDR+0
|
||||
jsr peek_under_roms
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
} else ifdef CONFIG_MEMORY_MODEL_46K_OR_50K {
|
||||
jsr peek_under_roms_via_FNADDR
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
} else { ; CONFIG_MEMORY_MODEL_38K
|
||||
lda (FNADDR),y
|
||||
#endif
|
||||
}
|
||||
|
||||
iny
|
||||
// Set Carry flag on the last file name character, to mark EOI
|
||||
; Set Carry flag on the last file name character, to mark EOI
|
||||
cpy FNLEN
|
||||
clc
|
||||
bne !+
|
||||
bne @1
|
||||
sec
|
||||
!:
|
||||
// Transmit one character
|
||||
@1:
|
||||
; Transmit one character
|
||||
sta TBTCNT
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
jsr iec_tx_dispatch
|
||||
#else
|
||||
} else {
|
||||
jsr iec_tx_byte
|
||||
#endif
|
||||
}
|
||||
jmp iec_send_file_name_loop
|
||||
|
||||
iec_send_file_name_done:
|
||||
jmp UNLSN
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_set_idle:
|
||||
|
||||
lda CIA2_PRA
|
||||
ora #BIT_CIA2_PRA_CLK_OUT // pull
|
||||
and #$FF - BIT_CIA2_PRA_DAT_OUT - BIT_CIA2_PRA_ATN_OUT // release
|
||||
ora #BIT_CIA2_PRA_CLK_OUT ; pull
|
||||
and #$FF - BIT_CIA2_PRA_DAT_OUT - BIT_CIA2_PRA_ATN_OUT ; release
|
||||
sta CIA2_PRA
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
@@ -1,45 +1,43 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
// According to http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
// pages 7--8.
|
||||
// See also https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
; According to http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
; pages 7--8.
|
||||
; See also https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_turnaround_to_listen:
|
||||
|
||||
// Store .X and .Y on the stack - preserve them
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
; Store .X and .Y on the stack - preserve them
|
||||
+phx_trash_a
|
||||
+phy_trash_a
|
||||
|
||||
// Timing is critical here - execute on disabled IRQs
|
||||
; Timing is critical here - execute on disabled IRQs
|
||||
php
|
||||
sei
|
||||
|
||||
// Pull DATA, release CLK and ATN (we are not sending commands)
|
||||
; Pull DATA, release CLK and ATN (we are not sending commands)
|
||||
jsr iec_pull_data_release_atn_clk
|
||||
|
||||
// Wait for clock line to be pulled by the drive
|
||||
ldx #$FF // XXX should we really use that high number?
|
||||
!:
|
||||
; Wait for clock line to be pulled by the drive
|
||||
ldx #$FF ; XXX should we really use that high number?
|
||||
@1:
|
||||
lda CIA2_PRA
|
||||
rol // to put BIT_CIA2_PRA_CLK_IN as the last (sign) bit
|
||||
bpl !+
|
||||
rol ; to put BIT_CIA2_PRA_CLK_IN as the last (sign) bit
|
||||
bpl @2
|
||||
dex
|
||||
bne !-
|
||||
bne @1
|
||||
|
||||
// Timeout - XXX what errors do original Kernal report?
|
||||
; Timeout - XXX what errors do original Kernal report?
|
||||
plp
|
||||
jmp iec_return_DEVICE_NOT_FOUND
|
||||
|
||||
// CLK is pulled by the device, OK
|
||||
!:
|
||||
; CLK is pulled by the device, OK
|
||||
@2:
|
||||
plp
|
||||
jmp iec_return_success
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
@@ -1,37 +1,35 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
// According to http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
// pages 7--8.
|
||||
// See also https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
; According to http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
; pages 7--8.
|
||||
; See also https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_turnaround_to_talk:
|
||||
|
||||
// Store .X and .Y on the stack - preserve them
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
; Store .X and .Y on the stack - preserve them
|
||||
+phx_trash_a
|
||||
+phy_trash_a
|
||||
|
||||
// Timing is critical here - execute on disabled IRQs
|
||||
; Timing is critical here - execute on disabled IRQs
|
||||
php
|
||||
sei
|
||||
|
||||
// First make sure both CLK, DATA and ATN are released at our side
|
||||
; First make sure both CLK, DATA and ATN are released at our side
|
||||
jsr iec_release_atn
|
||||
jsr iec_release_clk_data
|
||||
|
||||
// Wait till device releases CLK line
|
||||
; Wait till device releases CLK line
|
||||
jsr iec_wait_for_clk_release
|
||||
|
||||
// Pull CLK line, it should be held by talker
|
||||
; Pull CLK line, it should be held by talker
|
||||
jsr iec_pull_clk_release_data
|
||||
|
||||
plp
|
||||
jmp iec_return_success
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
@@ -1,166 +1,164 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
// Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
|
||||
// Expects byte to send in TBTCNT ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html)
|
||||
// Carry flag set = signal EOI
|
||||
//
|
||||
// Preserves .X and .Y registers
|
||||
; Expects byte to send in TBTCNT ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html)
|
||||
; Carry flag set = signal EOI
|
||||
;
|
||||
; Preserves .X and .Y registers
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
|
||||
iec_tx_dispatch:
|
||||
|
||||
php // preserve C flag for EOI indication
|
||||
php ; preserve C flag for EOI indication
|
||||
lda IECPROTO
|
||||
cmp #IEC_JIFFY
|
||||
bne !+
|
||||
bne @1
|
||||
|
||||
plp
|
||||
jmp jiffydos_tx_byte
|
||||
!:
|
||||
@1:
|
||||
plp
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
#endif // CONFIG_IEC_JIFFYDOS
|
||||
} ; CONFIG_IEC_JIFFYDOS
|
||||
|
||||
|
||||
iec_tx_byte:
|
||||
|
||||
// Store .X and .Y on the stack - preserve them
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
; Store .X and .Y on the stack - preserve them
|
||||
+phx_trash_a
|
||||
+phy_trash_a
|
||||
|
||||
// Notify all devices that we are going to send a byte
|
||||
// and it is going to be a data byte (released ATN)
|
||||
; Notify all devices that we are going to send a byte
|
||||
; and it is going to be a data byte (released ATN)
|
||||
jsr iec_release_atn_clk_data
|
||||
|
||||
// Common part of iec_tx_byte and iec_tx_command
|
||||
// Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
// and http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
; Common part of iec_tx_byte and iec_tx_command
|
||||
; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
; and http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
|
||||
iec_tx_common:
|
||||
|
||||
// Timing is critical here - execute on disabled IRQs
|
||||
// The best practice would be to do PHP first, but it seems this is not
|
||||
// what the original ROM does; furthermore, pushing additional bytes to
|
||||
// stack can wreck autostart software loading at $0100
|
||||
; Timing is critical here - execute on disabled IRQs
|
||||
; The best practice would be to do PHP first, but it seems this is not
|
||||
; what the original ROM does; furthermore, pushing additional bytes to
|
||||
; stack can wreck autostart software loading at $0100
|
||||
sei
|
||||
|
||||
// Wait till all receivers are ready, they should all release DATA
|
||||
; Wait till all receivers are ready, they should all release DATA
|
||||
jsr iec_wait_for_data_release
|
||||
|
||||
bcc !+
|
||||
bcc @2
|
||||
|
||||
// At this point a delay 256 usec or more is considered EOI,
|
||||
// receiver should now acknowledge it by pulling data for at least 60 usec
|
||||
// Keep the implementation as simple as possible: data should be released now
|
||||
// so wait until it is pushed and released again
|
||||
; At this point a delay 256 usec or more is considered EOI,
|
||||
; receiver should now acknowledge it by pulling data for at least 60 usec
|
||||
; Keep the implementation as simple as possible: data should be released now
|
||||
; so wait until it is pushed and released again
|
||||
|
||||
jsr iec_wait_for_data_pull
|
||||
jsr iec_wait_for_data_release
|
||||
!:
|
||||
#if CONFIG_IEC_DOLPHINDOS
|
||||
@2:
|
||||
!ifdef CONFIG_IEC_DOLPHINDOS {
|
||||
|
||||
// Check if DolphinDOS was detected
|
||||
; Check if DolphinDOS was detected
|
||||
lda IECPROTO
|
||||
cmp #IEC_DOLPHIN
|
||||
bne iec_tx_no_dolphindos
|
||||
|
||||
// For DolphinDOS just push the byte to parallel port (set it to output first)
|
||||
; For DolphinDOS just push the byte to parallel port (set it to output first)
|
||||
lda #$FF
|
||||
sta CIA2_DDRB
|
||||
lda TBTCNT
|
||||
sta CIA2_PRB
|
||||
|
||||
// Pull CLK to indicate data is now valid (we should not hold DATA nevertheless)
|
||||
; Pull CLK to indicate data is now valid (we should not hold DATA nevertheless)
|
||||
jsr iec_pull_clk_release_data_oneshot
|
||||
|
||||
// Finish the flow
|
||||
; Finish the flow
|
||||
jmp iec_tx_common_finalize
|
||||
|
||||
iec_tx_no_dolphindos:
|
||||
|
||||
#endif // CONFIG_IEC_DOLPHINDOS
|
||||
} ; CONFIG_IEC_DOLPHINDOS
|
||||
|
||||
// Pull CLK back to indicate that DATA is not valid, keep it for 60us
|
||||
// We can use this routine as we don't hold DATA anyway (and its state doesn't even matter)
|
||||
; Pull CLK back to indicate that DATA is not valid, keep it for 60us
|
||||
; We can use this routine as we don't hold DATA anyway (and its state doesn't even matter)
|
||||
|
||||
jsr iec_pull_clk_release_data_oneshot
|
||||
jsr iec_wait60us
|
||||
|
||||
// Now, we can start transmission of 8 bits of data
|
||||
; Now, we can start transmission of 8 bits of data
|
||||
ldx #7
|
||||
|
||||
iec_tx_common_sendbit:
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
|
||||
bne !+ // branch if not sending the last bit
|
||||
bne @3 ; branch if not sending the last bit
|
||||
lda IECPROTO
|
||||
beq !+ // branch if standard protocol
|
||||
beq @3 ; branch if standard protocol
|
||||
|
||||
// JiffyDOS ROM performs detection loop on every command; it seems we have to
|
||||
// replicate this behaviour for compatibility with at least 1541 JiffyDOS ROM
|
||||
; JiffyDOS ROM performs detection loop on every command; it seems we have to
|
||||
; replicate this behaviour for compatibility with at least 1541 JiffyDOS ROM
|
||||
|
||||
jsr jiffydos_detect
|
||||
!:
|
||||
#endif // CONFIG_IEC_JIFFYDOS
|
||||
@3:
|
||||
} ; CONFIG_IEC_JIFFYDOS
|
||||
|
||||
// Is next bit 0 or 1?
|
||||
; Is next bit 0 or 1?
|
||||
lda TBTCNT
|
||||
lsr
|
||||
sta TBTCNT
|
||||
bcs !+
|
||||
bcs @4
|
||||
|
||||
// Bit is 0
|
||||
; Bit is 0
|
||||
jsr iec_release_clk_pull_data
|
||||
jmp iec_tx_common_bit_is_sent
|
||||
!:
|
||||
// Bit is 1
|
||||
@4:
|
||||
; Bit is 1
|
||||
jsr iec_release_clk_data
|
||||
|
||||
iec_tx_common_bit_is_sent:
|
||||
|
||||
// Wait 20us, so that device(s) can pick DATA
|
||||
; Wait 20us, so that device(s) can pick DATA
|
||||
jsr iec_wait20us
|
||||
|
||||
// Pull CLK for 20us again, before sending the next bit
|
||||
// or performing any other action
|
||||
; Pull CLK for 20us again, before sending the next bit
|
||||
; or performing any other action
|
||||
jsr iec_pull_clk_release_data_oneshot
|
||||
jsr iec_wait20us
|
||||
|
||||
// More bits to send?
|
||||
; More bits to send?
|
||||
dex
|
||||
bpl iec_tx_common_sendbit
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
iec_tx_common_finalize:
|
||||
|
||||
cli
|
||||
|
||||
// Give devices time to tell if they are busy by pulling DATA
|
||||
// They should do it within 1ms
|
||||
; Give devices time to tell if they are busy by pulling DATA
|
||||
; They should do it within 1ms
|
||||
ldx #$FF
|
||||
!:
|
||||
@5:
|
||||
lda CIA2_PRA
|
||||
// BPL here is checking that bit 7 clears,
|
||||
// i.e, that the DATA line is pulled by drive
|
||||
bpl !+
|
||||
; BPL here is checking that bit 7 clears,
|
||||
; i.e, that the DATA line is pulled by drive
|
||||
bpl @6
|
||||
dex
|
||||
bne !-
|
||||
bmi !+
|
||||
bne @5
|
||||
bmi @6
|
||||
jmp iec_return_DEVICE_NOT_FOUND
|
||||
!:
|
||||
@6:
|
||||
jmp iec_return_success
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
@@ -1,46 +1,43 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
// Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
|
||||
// Expects byte to send in TBTCNT ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html)
|
||||
// Carry flag set = signal EOI
|
||||
//
|
||||
// Preserves .X and .Y registers
|
||||
; Expects byte to send in TBTCNT ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html)
|
||||
; Carry flag set = signal EOI
|
||||
;
|
||||
; Preserves .X and .Y registers
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_tx_command:
|
||||
|
||||
// Store .X and .Y on the stack - preserve them
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
; Store .X and .Y on the stack - preserve them
|
||||
+phx_trash_a
|
||||
+phy_trash_a
|
||||
|
||||
// Notify all devices that we are going to send a byte
|
||||
// and it is going to be a command (pulled ATN)
|
||||
; Notify all devices that we are going to send a byte
|
||||
; and it is going to be a command (pulled ATN)
|
||||
jsr iec_pull_atn_clk_release_data
|
||||
|
||||
// Give devices time to respond (response is mandatory!) by pulling DATA
|
||||
; Give devices time to respond (response is mandatory!) by pulling DATA
|
||||
jsr iec_wait1ms
|
||||
lda CIA2_PRA // pulled DATA = highest bit 0 = 'plus'
|
||||
bpl !+
|
||||
jmp iec_return_DEVICE_NOT_FOUND
|
||||
!:
|
||||
// At least one device responded, but they are still allowed to stall
|
||||
// (can be busy processing something), we have to wait till they are all
|
||||
// ready (or bored with DOS attack...)
|
||||
// Release back CLK, keep DATA released - to ask devices for status.
|
||||
lda CIA2_PRA ; pulled DATA = highest bit 0 = 'plus'
|
||||
+bmi iec_return_DEVICE_NOT_FOUND
|
||||
|
||||
; At least one device responded, but they are still allowed to stall
|
||||
; (can be busy processing something), we have to wait till they are all
|
||||
; ready (or bored with DOS attack...)
|
||||
; Release back CLK, keep DATA released - to ask devices for status.
|
||||
|
||||
jsr iec_release_clk_data
|
||||
|
||||
// Common part of iec_txbyte and iec_tx_common - waits for devices
|
||||
// and transmits a byte
|
||||
; Common part of iec_txbyte and iec_tx_common - waits for devices
|
||||
; and transmits a byte
|
||||
|
||||
clc // Carry flag set is used for EOI mark
|
||||
clc ; Carry flag set is used for EOI mark
|
||||
jmp iec_tx_common
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
@@ -1,27 +1,25 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
// Routine to finalize some IEC commands - which do not end in turnaround and are not followed by others
|
||||
// Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
; Routine to finalize some IEC commands - which do not end in turnaround and are not followed by others
|
||||
; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_tx_command_finalize:
|
||||
|
||||
// Store .X and .Y on the stack - preserve them
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
; Store .X and .Y on the stack - preserve them
|
||||
+phx_trash_a
|
||||
+phy_trash_a
|
||||
|
||||
// Give device some time to complete command reception, release ATN,
|
||||
// give it some time again before (possible) next command
|
||||
; Give device some time to complete command reception, release ATN,
|
||||
; give it some time again before (possible) next command
|
||||
jsr iec_wait20us
|
||||
jsr iec_set_idle
|
||||
jsr iec_wait20us
|
||||
|
||||
jmp iec_return_success
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
@@ -1,25 +1,23 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
// Flush the IEC output buffer (if not empty) - send byte with EOI
|
||||
//
|
||||
// Preserves .X, .Y and .A registers
|
||||
; Flush the IEC output buffer (if not empty) - send byte with EOI
|
||||
;
|
||||
; Preserves .X, .Y and .A registers
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_tx_flush:
|
||||
|
||||
pha
|
||||
lda C3PO
|
||||
beq !+
|
||||
sec // send it with EOI
|
||||
jsr iec_tx_byte // send the command regardless of the status
|
||||
!:
|
||||
beq @1
|
||||
sec ; send it with EOI
|
||||
jsr iec_tx_byte ; send the command regardless of the status
|
||||
@1:
|
||||
pla
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
@@ -1,24 +1,22 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Common EAL update routine
|
||||
//
|
||||
;
|
||||
; Common EAL update routine
|
||||
;
|
||||
|
||||
|
||||
#if (CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS) && !CONFIG_MEMORY_MODEL_60K
|
||||
!ifdef CONFIG_IEC_JIFFYDOS_OR_DOLPHINDOS { !ifndef CONFIG_MEMORY_MODEL_60K {
|
||||
|
||||
|
||||
iec_update_EAL_by_Y: // note: Carry has to be set by caller!
|
||||
iec_update_EAL_by_Y: ; note: Carry has to be set by caller!
|
||||
|
||||
tya
|
||||
adc EAL+0
|
||||
sta EAL+0
|
||||
bcc !+
|
||||
bcc @1
|
||||
inc EAL+1
|
||||
!:
|
||||
@1:
|
||||
rts
|
||||
|
||||
|
||||
#endif
|
||||
} }
|
||||
@@ -1,37 +1,41 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Wait 1 ms (1000 usec)
|
||||
//
|
||||
// On NTSC this means 1023 cycles (slightly less on PAL, but we have to be sure).
|
||||
// We cant count on badlines, as the screen might be disabled.
|
||||
// Delay here is implemented using VIC-II raster register. Since one raster is
|
||||
// 63 cycles, we need at least 17 full rasters to be 100% sure we wait enough
|
||||
;
|
||||
; Wait 1 ms (1000 usec)
|
||||
;
|
||||
; On NTSC this means 1023 cycles (slightly less on PAL, but we have to be sure).
|
||||
; We cant count on badlines, as the screen might be disabled.
|
||||
; Delay here is implemented using VIC-II raster register. Since one raster is
|
||||
; 63 cycles, we need at least 17 full rasters to be 100% sure we wait enough
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_wait1ms:
|
||||
|
||||
ldx #18 // we probably won't start with the beginning of raster
|
||||
ldx #18 ; we probably won't start with the beginning of raster
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
} ; CONFIG_IEC
|
||||
|
||||
wait_x_bars: // additional entry point for delayy in screen and tape support
|
||||
// has to preserve .Y and put .X to 0
|
||||
; FALLTROUGH
|
||||
|
||||
wait_x_bars: ; additional entry point for delayy in screen and tape support
|
||||
; has to preserve .Y and put .X to 0
|
||||
|
||||
lda VIC_RASTER
|
||||
!:
|
||||
@1:
|
||||
cmp VIC_RASTER
|
||||
beq !-
|
||||
beq @1
|
||||
lda VIC_RASTER
|
||||
dex
|
||||
bne !-
|
||||
bne @1
|
||||
|
||||
iec_wait_rts: // dummy RTS, for very short waits
|
||||
; FALLTROUGH
|
||||
|
||||
iec_wait_rts: ; dummy RTS, for very short waits
|
||||
|
||||
rts
|
||||
@@ -1,31 +1,30 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_wait20us:
|
||||
|
||||
// Wait 20usec
|
||||
; Wait 20usec
|
||||
|
||||
// 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
|
||||
; 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
|
||||
|
||||
// Waste cycles by reading some unimportant memory location
|
||||
// in order not to clutter VICE debug logs
|
||||
; Waste cycles by reading some unimportant memory location
|
||||
; in order not to clutter VICE debug logs
|
||||
|
||||
ora $03FF // 4 cycles
|
||||
ora $03FF // 4 cycles
|
||||
rts // 6 cycles
|
||||
ora $03FF ; 4 cycles
|
||||
ora $03FF ; 4 cycles
|
||||
rts ; 6 cycles
|
||||
|
||||
// 6 cycles JSR to routine,
|
||||
// 14 cycles routine with RTS
|
||||
// 1 cycle to fetch next instruction
|
||||
// ---
|
||||
// 21 cycles
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
; 6 cycles JSR to routine,
|
||||
; 14 cycles routine with RTS
|
||||
; 1 cycle to fetch next instruction
|
||||
; ---
|
||||
; 21 cycles
|
||||
}
|
||||
@@ -1,36 +1,35 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Note: damages .X
|
||||
//
|
||||
;
|
||||
; Note: damages .X
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_wait60us:
|
||||
|
||||
// Wait 60usec
|
||||
; Wait 60usec
|
||||
|
||||
// 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
|
||||
; 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
|
||||
|
||||
// Waste cycles in a loop
|
||||
; Waste cycles in a loop
|
||||
|
||||
ldx #$0A // 2 cycles
|
||||
!: dex // 2 cycles * 10
|
||||
bpl !- // 3 cycles * 9 + 2 cycles
|
||||
rts // 6 cycles
|
||||
ldx #$0A ; 2 cycles
|
||||
@1:
|
||||
dex ; 2 cycles * 10
|
||||
bpl @1 ; 3 cycles * 9 + 2 cycles
|
||||
rts ; 6 cycles
|
||||
|
||||
// 6 cycles JSR to routine,
|
||||
// 57 cycles routine with RTS
|
||||
// 1 cycle to fetch next instruction
|
||||
// ---
|
||||
// 64 cycles
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
; 6 cycles JSR to routine,
|
||||
; 57 cycles routine with RTS
|
||||
; 1 cycle to fetch next instruction
|
||||
; ---
|
||||
; 64 cycles
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_wait_for_clk_release:
|
||||
@@ -11,6 +11,4 @@ iec_wait_for_clk_release:
|
||||
bit CIA2_PRA
|
||||
bvc iec_wait_for_clk_release
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
@@ -1,18 +1,16 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_wait_for_data_pull:
|
||||
|
||||
lda CIA2_PRA
|
||||
// Check the highest bit, which is DATA IN,
|
||||
// (highest bit set = negative value)
|
||||
; Check the highest bit, which is DATA IN,
|
||||
; (highest bit set = negative value)
|
||||
bmi iec_wait_for_data_pull
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
iec_wait_for_data_release:
|
||||
|
||||
lda CIA2_PRA
|
||||
// Check the highest bit, which is DATA IN,
|
||||
// (highest bit set = negative value)
|
||||
; Check the highest bit, which is DATA IN,
|
||||
; (highest bit set = negative value)
|
||||
bpl iec_wait_for_data_release
|
||||
rts
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
+29
-29
@@ -1,49 +1,49 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - page 285
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 223
|
||||
// - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
|
||||
// - http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||
//
|
||||
;
|
||||
; Official Kernal routine, described in:
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - page 285
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 223
|
||||
; - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
|
||||
; - http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
;
|
||||
; CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||
;
|
||||
|
||||
|
||||
LISTEN:
|
||||
|
||||
#if CONFIG_IEC || ROM_LAYOUT_M65
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
|
||||
// According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
|
||||
; According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
|
||||
jsr iec_tx_flush
|
||||
|
||||
#endif
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
|
||||
jsr m65dos_detect
|
||||
bcc_16 m65dos_listen // branch if device is handeld by internal DOS
|
||||
+bcc m65dos_listen ; branch if device is handeld by internal DOS
|
||||
|
||||
#endif
|
||||
} else ifdef CONFIG_IEC {
|
||||
|
||||
#if CONFIG_IEC
|
||||
; According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
|
||||
jsr iec_tx_flush
|
||||
}
|
||||
|
||||
// Check whether device number is correct
|
||||
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
; Check whether device number is correct
|
||||
jsr iec_check_devnum_oc
|
||||
bcc !+
|
||||
bcc @1
|
||||
jmp kernalerror_DEVICE_NOT_FOUND
|
||||
!:
|
||||
// Encode and execute the command
|
||||
@1:
|
||||
; Encode and execute the command
|
||||
ora #$20
|
||||
|
||||
jmp common_talk_listen
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
jmp kernalerror_ILLEGAL_DEVICE_NUMBER
|
||||
|
||||
#endif
|
||||
}
|
||||
+74
-75
@@ -1,13 +1,13 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// IEC part of the LOAD routine
|
||||
//
|
||||
;
|
||||
; IEC part of the LOAD routine
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
load_iec_dev_not_found:
|
||||
@@ -30,55 +30,55 @@ load_break_error:
|
||||
|
||||
load_iec:
|
||||
|
||||
// Check file name
|
||||
; Check file name
|
||||
lda FNLEN
|
||||
beq_16 kernalerror_FILE_NAME_MISSING
|
||||
+beq kernalerror_FILE_NAME_MISSING
|
||||
|
||||
// Display SEARCHING FOR + filename
|
||||
; Display SEARCHING FOR + filename
|
||||
jsr lvs_display_searching_for
|
||||
|
||||
// http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
// p13, 16; also p16 tells us this routine does not mess with the file
|
||||
// table in the C64, only in the drive.
|
||||
; http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
; p13, 16; also p16 tells us this routine does not mess with the file
|
||||
; table in the C64, only in the drive.
|
||||
|
||||
// Call device to LISTEN (p16)
|
||||
; Call device to LISTEN (p16)
|
||||
lda FA
|
||||
jsr LISTEN
|
||||
bcs load_iec_dev_not_found
|
||||
|
||||
// Open channel 0 (reserved for file reading)
|
||||
; Open channel 0 (reserved for file reading)
|
||||
lda #$00
|
||||
jsr iec_cmd_open
|
||||
bcs load_iec_dev_not_found
|
||||
|
||||
// Send file name
|
||||
; Send file name
|
||||
jsr iec_send_file_name
|
||||
bcs load_iec_error
|
||||
|
||||
// Now command device to talk (p16)
|
||||
; Now command device to talk (p16)
|
||||
lda FA
|
||||
jsr TALK
|
||||
bcs load_iec_error
|
||||
|
||||
#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_MEGA_65
|
||||
!ifdef HAS_IEC_BURST {
|
||||
jsr burst_advertise
|
||||
#endif
|
||||
}
|
||||
|
||||
lda #$60 // open channel / data (p3) , required according to p13
|
||||
lda #$60 ; open channel / data (p3) , required according to p13
|
||||
sta TBTCNT
|
||||
jsr iec_tx_command
|
||||
bcs load_iec_error
|
||||
|
||||
#if CONFIG_IEC_DOLPHINDOS
|
||||
!ifdef CONFIG_IEC_DOLPHINDOS {
|
||||
jsr dolphindos_detect
|
||||
#endif
|
||||
}
|
||||
|
||||
// We are currently talker, so do the IEC turn around so that we
|
||||
// are the listener (p16)
|
||||
; We are currently talker, so do the IEC turn around so that we
|
||||
; are the listener (p16)
|
||||
jsr iec_turnaround_to_listen
|
||||
bcs load_iec_error
|
||||
|
||||
// Get load address
|
||||
; Get load address
|
||||
|
||||
jsr load_iec_get_addr_byte
|
||||
sta EAL+0
|
||||
@@ -86,121 +86,120 @@ load_iec:
|
||||
jsr load_iec_get_addr_byte
|
||||
sta EAL+1
|
||||
|
||||
// If secondary address is 0, override EAL with STAL
|
||||
; If secondary address is 0, override EAL with STAL
|
||||
|
||||
lda SA
|
||||
bne !+
|
||||
bne @1
|
||||
lda STAL+0
|
||||
sta EAL+0
|
||||
lda STAL+1
|
||||
sta EAL+1
|
||||
!:
|
||||
#if ROM_LAYOUT_M65
|
||||
@1:
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
|
||||
// Switch to legacy mode if needed
|
||||
; Switch to legacy mode if needed
|
||||
|
||||
jsr m65_load_autoswitch
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Display start address
|
||||
; Display start address
|
||||
|
||||
jsr lvs_display_loading_verifying
|
||||
|
||||
#if (CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS) && !CONFIG_MEMORY_MODEL_60K
|
||||
!ifdef CONFIG_IEC_JIFFYDOS_OR_DOLPHINDOS { !ifndef CONFIG_MEMORY_MODEL_60K {
|
||||
|
||||
// If feasible, use protocol-specific optimized LOAD loop
|
||||
; If feasible, use protocol-specific optimized LOAD loop
|
||||
|
||||
lda VERCKK
|
||||
bne load_iec_loop // branch if VERIFY
|
||||
bne load_iec_loop ; branch if VERIFY
|
||||
lda IECPROTO
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
cmp #IEC_JIFFY
|
||||
beq_16 jiffydos_load // branch if JiffyDOS
|
||||
#endif
|
||||
+beq jiffydos_load ; branch if JiffyDOS
|
||||
}
|
||||
|
||||
#if CONFIG_IEC_DOLPHINDOS
|
||||
!ifdef CONFIG_IEC_DOLPHINDOS {
|
||||
cmp #IEC_DOLPHIN
|
||||
beq_16 dolphindos_load // branch if DolphinDOS
|
||||
#endif
|
||||
+beq dolphindos_load ; branch if DolphinDOS
|
||||
}
|
||||
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
||||
load_iec_loop:
|
||||
|
||||
// We are now ready to receive bytes
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
; We are now ready to receive bytes
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
jsr iec_rx_dispatch
|
||||
#else
|
||||
} else {
|
||||
jsr iec_rx_byte
|
||||
#endif
|
||||
}
|
||||
bcs load_iec_error
|
||||
|
||||
// Handle the byte (store in memory / verify)
|
||||
; Handle the byte (store in memory / verify)
|
||||
jsr lvs_handle_byte_load_verify
|
||||
bcs load_iec_error
|
||||
|
||||
// Advance pointer to data; it is OK if it advances past $FFFF,
|
||||
// one autostart technique does exactly this
|
||||
#if !HAS_OPCODES_65CE02
|
||||
; Advance pointer to data; it is OK if it advances past $FFFF,
|
||||
; one autostart technique does exactly this
|
||||
!ifndef HAS_OPCODES_65CE02 {
|
||||
inc EAL+0
|
||||
bne !+
|
||||
bne @2
|
||||
inc EAL+1
|
||||
!:
|
||||
#else
|
||||
@2:
|
||||
} else {
|
||||
inw EAL+0
|
||||
#endif
|
||||
}
|
||||
|
||||
// Handle STOP key; it is probably an overkill to do it
|
||||
// with every byte, once per 32 bytes should be enough
|
||||
; Handle STOP key; it is probably an overkill to do it
|
||||
; with every byte, once per 32 bytes should be enough
|
||||
lda EAL
|
||||
and #$1F
|
||||
bne !+
|
||||
phx_trash_a
|
||||
bne @3
|
||||
+phx_trash_a
|
||||
jsr udtim_keyboard
|
||||
jsr STOP
|
||||
bcs_16 load_break_error
|
||||
plx_trash_a
|
||||
!:
|
||||
// Check for EOI - if so, this was the last byte
|
||||
+bcs load_break_error
|
||||
+plx_trash_a
|
||||
@3:
|
||||
; Check for EOI - if so, this was the last byte
|
||||
bit IOSTATUS
|
||||
bvc load_iec_loop
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
load_iec_loop_end:
|
||||
|
||||
// Display end address
|
||||
; Display end address
|
||||
jsr lvs_display_done
|
||||
|
||||
// Close file on drive
|
||||
; Close file on drive
|
||||
|
||||
lda FA
|
||||
jsr iec_close_load
|
||||
|
||||
// Return last address
|
||||
; Return last address
|
||||
jmp lvs_return_last_address
|
||||
|
||||
|
||||
load_iec_get_addr_byte:
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
jsr iec_rx_dispatch
|
||||
#else // no turbo supported
|
||||
} else {
|
||||
jsr iec_rx_byte
|
||||
#endif
|
||||
|
||||
bcs !+
|
||||
}
|
||||
bcs @4
|
||||
lda IOSTATUS
|
||||
and #K_STS_EOI
|
||||
bne !+
|
||||
bne @4
|
||||
lda TBTCNT
|
||||
rts
|
||||
!:
|
||||
@4:
|
||||
pla
|
||||
pla
|
||||
jmp load_iec_file_not_found
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
} ; CONFIG_IEC
|
||||
+18
-20
@@ -1,43 +1,41 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// IEC part of the OPEN routine
|
||||
//
|
||||
;
|
||||
; IEC part of the OPEN routine
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
open_iec:
|
||||
|
||||
// Check for command to send
|
||||
; Check for command to send
|
||||
ldy FNLEN
|
||||
beq open_iec_done
|
||||
|
||||
// We have a command to send to IEC device
|
||||
; We have a command to send to IEC device
|
||||
jsr LISTEN
|
||||
bcc !+
|
||||
bcc @1
|
||||
jmp kernalerror_DEVICE_NOT_FOUND
|
||||
!:
|
||||
@1:
|
||||
lda SA
|
||||
jsr iec_cmd_open
|
||||
bcc !+
|
||||
bcc @2
|
||||
jmp kernalerror_DEVICE_NOT_FOUND
|
||||
!:
|
||||
@2:
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
// We need our helpers to get to filenames under ROMs or IO area
|
||||
!ifdef CONFIG_MEMORY_MODEL_60K {
|
||||
; We need our helpers to get to filenames under ROMs or IO area
|
||||
jsr install_ram_routines
|
||||
#endif
|
||||
}
|
||||
|
||||
// Send command ('file name')
|
||||
; Send command ('file name')
|
||||
jsr iec_send_file_name
|
||||
|
||||
open_iec_done:
|
||||
|
||||
jmp open_done_success
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
+47
-46
@@ -1,13 +1,13 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// IEC part of the SAVE routine
|
||||
//
|
||||
;
|
||||
; IEC part of the SAVE routine
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
save_iec_dev_not_found:
|
||||
@@ -16,117 +16,118 @@ save_iec_dev_not_found:
|
||||
|
||||
save_iec:
|
||||
|
||||
// Check file name
|
||||
; Check file name
|
||||
lda FNLEN
|
||||
beq_16 kernalerror_FILE_NAME_MISSING
|
||||
+beq kernalerror_FILE_NAME_MISSING
|
||||
|
||||
// Display SAVING
|
||||
; Display SAVING
|
||||
jsr lvs_display_saving
|
||||
|
||||
// Call device to LISTEN
|
||||
; Call device to LISTEN
|
||||
lda FA
|
||||
jsr LISTEN
|
||||
bcs save_iec_dev_not_found
|
||||
|
||||
// Open channel 1 (reserved for file writing)
|
||||
; Open channel 1 (reserved for file writing)
|
||||
lda #$01
|
||||
jsr iec_cmd_open
|
||||
bcs save_iec_dev_not_found
|
||||
|
||||
// Send file name
|
||||
; Send file name
|
||||
jsr iec_send_file_name
|
||||
bcs save_iec_dev_not_found
|
||||
|
||||
// Call device to LISTEN once again
|
||||
; Call device to LISTEN once again
|
||||
lda FA
|
||||
jsr LISTEN
|
||||
bcs save_iec_dev_not_found
|
||||
|
||||
#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_MEGA_65
|
||||
!ifdef HAS_BURST {
|
||||
jsr burst_advertise
|
||||
#endif
|
||||
}
|
||||
|
||||
lda #$61 // open channel / data (p3) , required according to p13
|
||||
lda #$61 ; open channel / data (p3) , required according to p13
|
||||
sta TBTCNT
|
||||
jsr iec_tx_command
|
||||
bcs save_iec_dev_not_found
|
||||
|
||||
#if CONFIG_IEC_DOLPHINDOS
|
||||
!ifdef CONFIG_IEC_DOLPHINDOS {
|
||||
jsr dolphindos_detect
|
||||
#endif
|
||||
}
|
||||
|
||||
// Save start address
|
||||
; Save start address
|
||||
lda STAL+0
|
||||
sta TBTCNT
|
||||
clc
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
jsr iec_tx_dispatch
|
||||
#else
|
||||
} else {
|
||||
jsr iec_tx_byte
|
||||
#endif
|
||||
}
|
||||
|
||||
lda STAL+1
|
||||
sta TBTCNT
|
||||
clc
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
jsr iec_tx_dispatch
|
||||
#else
|
||||
} else {
|
||||
jsr iec_tx_byte
|
||||
#endif
|
||||
}
|
||||
|
||||
jsr lvs_STAL_to_MEMUSS
|
||||
ldy #$00
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
iec_save_loop:
|
||||
|
||||
// Retrieve byte to send
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
; Retrieve byte to send
|
||||
!ifdef CONFIG_MEMORY_MODEL_60K {
|
||||
ldx #<MEMUSS+0
|
||||
jsr peek_under_roms
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
} else ifdef CONFIG_MEMORY_MODEL_46K_OR_50K {
|
||||
jsr peek_under_roms_via_MEMUSS
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
} else { ; CONFIG_MEMORY_MODEL_38K
|
||||
lda (MEMUSS),y
|
||||
#endif
|
||||
}
|
||||
|
||||
// Send the byte
|
||||
; Send the byte
|
||||
sta TBTCNT
|
||||
clc
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
jsr iec_tx_dispatch
|
||||
#else
|
||||
} else {
|
||||
jsr iec_tx_byte
|
||||
#endif
|
||||
}
|
||||
|
||||
// Next iteration
|
||||
#if !HAS_OPCODES_65CE02
|
||||
; Next iteration
|
||||
!ifndef HAS_OPCODES_65CE02 {
|
||||
jsr lvs_advance_MEMUSS
|
||||
#else
|
||||
} else {
|
||||
inw MEMUSS+0
|
||||
#endif
|
||||
}
|
||||
jsr lvs_check_EAL
|
||||
bne iec_save_loop
|
||||
|
||||
iec_save_loop_end:
|
||||
|
||||
// Close file on drive
|
||||
; Close file on drive
|
||||
lda FA
|
||||
jsr UNLSN
|
||||
|
||||
lda FA
|
||||
jsr LISTEN
|
||||
|
||||
lda #$E1 // CLOSE command
|
||||
lda #$E1 ; CLOSE command
|
||||
sta TBTCNT
|
||||
jsr iec_tx_command
|
||||
jsr iec_tx_command_finalize
|
||||
|
||||
// Tell drive to unlisten
|
||||
; Tell drive to unlisten
|
||||
lda FA
|
||||
jsr UNLSN
|
||||
|
||||
// Return success
|
||||
; Return success
|
||||
clc
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
}
|
||||
+23
-25
@@ -1,41 +1,39 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - page 296
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 223/224
|
||||
// - https://www.pagetable.com/?p=1031, , https://github.com/mist64/cbmbus_doc
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||
//
|
||||
;
|
||||
; Official Kernal routine, described in:
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - page 296
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 223/224
|
||||
; - https://www.pagetable.com/?p=1031, , https://github.com/mist64/cbmbus_doc
|
||||
;
|
||||
; CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||
;
|
||||
|
||||
|
||||
// XXX cleanup: iec_cmd_open and iec_cmd_close should just do ORA and jump directly here
|
||||
; XXX cleanup: iec_cmd_open and iec_cmd_close should just do ORA and jump directly here
|
||||
|
||||
|
||||
SECOND:
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
|
||||
jsr m65dos_check
|
||||
bcc_16 m65dos_second // branch if device is handeld by internal DOS
|
||||
+bcc m65dos_second ; branch if device is handeld by internal DOS
|
||||
}
|
||||
|
||||
#endif
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
#if CONFIG_IEC
|
||||
|
||||
// Due to OPEN/CLOSE/TKSA/SECOND command encoding, allowed channels are 0-15; it is the caller
|
||||
// responsibility, hovewer, to provide value ORed with $60
|
||||
// - https://www.lemon64.com/forum/viewtopic.php?t=57694&sid=531ba3592bcffadef2ac8b9162f2e529
|
||||
// - https://www.pagetable.com/?p=1031 (Kernal API description)
|
||||
; Due to OPEN/CLOSE/TKSA/SECOND command encoding, allowed channels are 0-15; it is the caller
|
||||
; responsibility, hovewer, to provide value ORed with $60
|
||||
; - https://www.lemon64.com/forum/viewtopic.php?t=57694&sid=531ba3592bcffadef2ac8b9162f2e529
|
||||
; - https://www.pagetable.com/?p=1031 (Kernal API description)
|
||||
|
||||
jmp common_open_close_unlsn_second
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
jmp kernalerror_ILLEGAL_DEVICE_NUMBER
|
||||
|
||||
#endif
|
||||
}
|
||||
+34
-36
@@ -1,62 +1,60 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - page 301/302
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 223
|
||||
// - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
|
||||
// - http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||
//
|
||||
;
|
||||
; Official Kernal routine, described in:
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - page 301/302
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 223
|
||||
; - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
|
||||
; - http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
;
|
||||
; CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||
;
|
||||
|
||||
|
||||
TALK:
|
||||
|
||||
#if CONFIG_IEC || ROM_LAYOUT_M65
|
||||
|
||||
// According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
|
||||
; According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
|
||||
jsr iec_tx_flush
|
||||
|
||||
#endif
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
|
||||
jsr m65dos_detect
|
||||
bcc_16 m65dos_talk // branch if device is handeld by internal DOS
|
||||
+bcc m65dos_talk ; branch if device is handeld by internal DOS
|
||||
|
||||
#endif
|
||||
} else ifdef CONFIG_IEC {
|
||||
|
||||
#if CONFIG_IEC
|
||||
; According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
|
||||
jsr iec_tx_flush
|
||||
}
|
||||
|
||||
// Check whether device number is correct
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
; Check whether device number is correct
|
||||
jsr iec_check_devnum_oc
|
||||
bcc !+
|
||||
jmp kernalerror_DEVICE_NOT_FOUND
|
||||
!:
|
||||
// Encode and execute the command
|
||||
+bcs kernalerror_DEVICE_NOT_FOUND
|
||||
|
||||
; Encode and execute the command
|
||||
ora #$40
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
common_talk_listen: // common part of TALK and LISTEN
|
||||
common_talk_listen: ; common part of TALK and LISTEN
|
||||
|
||||
sta TBTCNT
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS_OR_DOLPHINDOS {
|
||||
|
||||
lda #$FF // force JiffyDOS detection, clear DolphinDOS mark
|
||||
lda #$FF ; force JiffyDOS detection, clear DolphinDOS mark
|
||||
sta IECPROTO
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
jmp iec_tx_command
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
jmp kernalerror_ILLEGAL_DEVICE_NUMBER
|
||||
|
||||
#endif
|
||||
}
|
||||
+22
-24
@@ -1,40 +1,38 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - page 302
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 224
|
||||
// - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||
//
|
||||
;
|
||||
; Official Kernal routine, described in:
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - page 302
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 224
|
||||
; - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
|
||||
;
|
||||
; CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||
;
|
||||
|
||||
|
||||
TKSA:
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
!ifdef CONFIG_MB_MEGA65 {
|
||||
|
||||
jsr m65dos_check
|
||||
bcc_16 m65dos_tksa // branch if device is handeld by internal DOS
|
||||
+bcc m65dos_tksa ; branch if device is handeld by internal DOS
|
||||
}
|
||||
|
||||
#endif
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
#if CONFIG_IEC
|
||||
|
||||
// Due to OPEN/CLOSE/TKSA/SECOND command encoding, allowed channels are 0-15; it is the caller
|
||||
// responsibility, hovewer, to provide value ORed with $60
|
||||
// - https://www.lemon64.com/forum/viewtopic.php?t=57694&sid=531ba3592bcffadef2ac8b9162f2e529
|
||||
// - https://www.pagetable.com/?p=1031 (Kernal API description)
|
||||
; Due to OPEN/CLOSE/TKSA/SECOND command encoding, allowed channels are 0-15; it is the caller
|
||||
; responsibility, hovewer, to provide value ORed with $60
|
||||
; - https://www.lemon64.com/forum/viewtopic.php?t=57694&sid=531ba3592bcffadef2ac8b9162f2e529
|
||||
; - https://www.pagetable.com/?p=1031 (Kernal API description)
|
||||
|
||||
ora #$90
|
||||
|
||||
jmp common_untlk_tksa
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
jmp kernalerror_ILLEGAL_DEVICE_NUMBER
|
||||
|
||||
#endif
|
||||
}
|
||||
+29
-30
@@ -1,51 +1,50 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - page 303
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 224
|
||||
// - https://www.pagetable.com/?p=1031, , https://github.com/mist64/cbmbus_doc
|
||||
// - http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||
//
|
||||
;
|
||||
; Official Kernal routine, described in:
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - page 303
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 224
|
||||
; - https://www.pagetable.com/?p=1031, , https://github.com/mist64/cbmbus_doc
|
||||
; - http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
;
|
||||
; CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||
;
|
||||
|
||||
|
||||
UNLSN:
|
||||
|
||||
#if CONFIG_IEC || ROM_LAYOUT_M65
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
|
||||
// According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
|
||||
; According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
|
||||
jsr iec_tx_flush
|
||||
|
||||
#endif
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
|
||||
jsr m65dos_check
|
||||
bcc_16 m65dos_unlsn // branch if device is handeld by internal DOS
|
||||
+bcc m65dos_unlsn ; branch if device is handeld by internal DOS
|
||||
|
||||
#endif
|
||||
} else ifdef CONFIG_IEC {
|
||||
|
||||
#if CONFIG_IEC
|
||||
; According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
|
||||
jsr iec_tx_flush
|
||||
}
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS
|
||||
|
||||
lda #$FF // do not use JiffyDOS / DolphinDOS anymore, trigger JiffyDOS detection
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
!ifdef CONFIG_IEC_JIFFYDOS_OR_DOLPHINDOS {
|
||||
|
||||
lda #$FF ; do not use JiffyDOS / DolphinDOS anymore, trigger JiffyDOS detection
|
||||
sta IECPROTO
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Buffer empty, send the command
|
||||
; Buffer empty, send the command
|
||||
lda #$3F
|
||||
|
||||
jmp common_open_close_unlsn_second
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
jmp kernalerror_ILLEGAL_DEVICE_NUMBER
|
||||
|
||||
#endif
|
||||
}
|
||||
+37
-38
@@ -1,62 +1,61 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - page 304
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 224
|
||||
// - https://www.pagetable.com/?p=1031, , https://github.com/mist64/cbmbus_doc
|
||||
// - http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||
//
|
||||
;
|
||||
; Official Kernal routine, described in:
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - page 304
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 224
|
||||
; - https://www.pagetable.com/?p=1031, , https://github.com/mist64/cbmbus_doc
|
||||
; - http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
;
|
||||
; CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||
;
|
||||
|
||||
|
||||
UNTLK:
|
||||
|
||||
#if CONFIG_IEC || ROM_LAYOUT_M65
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
|
||||
// According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
|
||||
; According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
|
||||
jsr iec_tx_flush
|
||||
|
||||
#endif
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
|
||||
jsr m65dos_check
|
||||
bcc_16 m65dos_untlk // branch if device is handeld by internal DOS
|
||||
+bcc m65dos_untlk ; branch if device is handeld by internal DOS
|
||||
|
||||
#endif
|
||||
} else ifdef CONFIG_IEC {
|
||||
|
||||
#if CONFIG_IEC
|
||||
; According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
|
||||
jsr iec_tx_flush
|
||||
}
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS
|
||||
|
||||
lda #$FF // do not use JiffyDOS / DolphinDOS anymore, trigger JiffyDOS detection
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
!ifdef CONFIG_IEC_JIFFYDOS_OR_DOLPHINDOS {
|
||||
|
||||
lda #$FF ; do not use JiffyDOS / DolphinDOS anymore, trigger JiffyDOS detection
|
||||
sta IECPROTO
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Buffer empty, send the command
|
||||
; Buffer empty, send the command
|
||||
lda #$5F
|
||||
|
||||
common_untlk_tksa: // common part of UNTLK and TKSA
|
||||
common_untlk_tksa: ; common part of UNTLK and TKSA
|
||||
|
||||
; XXX - for TKSA, is it really the right place to do a turnaround? I have some doubts
|
||||
; (it forces us to send the TKSA command 'manually' sometimes), but
|
||||
; Luigi Di Fraia (https://luigidifraia.wordpress.com/2017/06/27/codebase64-on-the-kernal-behaviour/)
|
||||
; claims TKSA Kernal routine actually does the turnaround
|
||||
|
||||
sta TBTCNT
|
||||
jsr iec_tx_command
|
||||
bcs !+ // branch if error
|
||||
// XXX - for TKSA, is it really the right place to do a turnaround? I have some doubts
|
||||
// (it forces us to send the TKSA command 'manually' sometimes), but
|
||||
// Luigi Di Fraia (https://luigidifraia.wordpress.com/2017/06/27/codebase64-on-the-kernal-behaviour/)
|
||||
// claims TKSA Kernal routine actually does the turnaround
|
||||
jmp iec_turnaround_to_listen
|
||||
!:
|
||||
+bcc iec_turnaround_to_listen
|
||||
|
||||
rts
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
jmp kernalerror_ILLEGAL_DEVICE_NUMBER
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -1,36 +1,34 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Advertise burst IEC protocol support to the receiver
|
||||
//
|
||||
;
|
||||
; Advertise burst IEC protocol support to the receiver
|
||||
;
|
||||
|
||||
//
|
||||
// Based on idea by Pasi 'Albert' Ojala and description from
|
||||
// https://sites.google.com/site/h2obsession/CBM/C128/fast-serial-for-uiec
|
||||
//
|
||||
;
|
||||
; Based on idea by Pasi 'Albert' Ojala and description from
|
||||
; https://sites.google.com/site/h2obsession/CBM/C128/fast-serial-for-uiec
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC_BURST_CIA1
|
||||
!ifdef CONFIG_IEC_BURST_CIA1 {
|
||||
|
||||
|
||||
burst_advertise:
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
|
||||
// Skip if other protocol (only JiffyDOS is possible at this moment) already detected
|
||||
; Skip if other protocol (only JiffyDOS is possible at this moment) already detected
|
||||
lda IECPROTO
|
||||
bmi !+
|
||||
bmi @1
|
||||
bne burst_advertise_done
|
||||
!:
|
||||
#endif
|
||||
@1:
|
||||
}
|
||||
|
||||
panic #$FF // XXX implement this
|
||||
+panic #$FF ; XXX implement this
|
||||
|
||||
burst_advertise_done:
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -1,60 +1,58 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Advertise burst IEC protocol support to the receiver
|
||||
//
|
||||
;
|
||||
; Advertise burst IEC protocol support to the receiver
|
||||
;
|
||||
|
||||
//
|
||||
// Based on idea by Pasi 'Albert' Ojala and description from
|
||||
// https://sites.google.com/site/h2obsession/CBM/C128/fast-serial-for-uiec
|
||||
//
|
||||
;
|
||||
; Based on idea by Pasi 'Albert' Ojala and description from
|
||||
; https://sites.google.com/site/h2obsession/CBM/C128/fast-serial-for-uiec
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC_BURST_CIA2
|
||||
!ifdef CONFIG_IEC_BURST_CIA2 {
|
||||
|
||||
|
||||
burst_advertise:
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
|
||||
// Skip if other protocol (only JiffyDOS is possible at this moment) already detected
|
||||
; Skip if other protocol (only JiffyDOS is possible at this moment) already detected
|
||||
lda IECPROTO
|
||||
bmi !+
|
||||
bmi @1
|
||||
bne burst_advertise_done
|
||||
!:
|
||||
#endif
|
||||
@1:
|
||||
}
|
||||
|
||||
// Make sure this is not done under ATN
|
||||
; Make sure this is not done under ATN
|
||||
jst iec_release_atn
|
||||
|
||||
// Set the clock rate to the fastest possible
|
||||
; Set the clock rate to the fastest possible
|
||||
ldy #$01
|
||||
sty CIA2_TIMALO
|
||||
dey
|
||||
sty CIA2_TIMAHI
|
||||
|
||||
// Prepare registers for transfer
|
||||
; Prepare registers for transfer
|
||||
lda #$C1
|
||||
sta CIA2_CRA // start timer A, serial out, TOD 50Hz
|
||||
bit CIA2_ICR // clear interrupt register
|
||||
sta CIA2_CRA ; start timer A, serial out, TOD 50Hz
|
||||
bit CIA2_ICR ; clear interrupt register
|
||||
|
||||
// Send test byte
|
||||
lda #$FF // $FF keeps DATA released, see https://www.c64-wiki.com/wiki/Fast_serial_bus_protocol
|
||||
; Send test byte
|
||||
lda #$FF ; $FF keeps DATA released, see https://www.c64-wiki.com/wiki/Fast_serial_bus_protocol
|
||||
sta CIA2_SDR
|
||||
|
||||
// Wait until byte sent
|
||||
lda #$08 // interrupt mask
|
||||
!:
|
||||
; Wait until byte sent
|
||||
lda #$08 ; interrupt mask
|
||||
@2:
|
||||
bit CIA2_ICR
|
||||
beq !-
|
||||
beq @2
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
burst_advertise_done:
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -1,31 +1,29 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Advertise burst IEC protocol support to the receiver
|
||||
//
|
||||
;
|
||||
; Advertise burst IEC protocol support to the receiver
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC_BURST_MEGA_65
|
||||
!ifdef CONFIG_IEC_BURST_M65 {
|
||||
|
||||
|
||||
burst_advertise:
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
|
||||
// Skip if other protocol (only JiffyDOS is possible at this moment) already detected
|
||||
; Skip if other protocol (only JiffyDOS is possible at this moment) already detected
|
||||
lda IECPROTO
|
||||
bmi !+
|
||||
bmi @1
|
||||
bne burst_advertise_done:
|
||||
!:
|
||||
#endif
|
||||
@1:
|
||||
}
|
||||
|
||||
panic #$FF // XXX implement this
|
||||
+panic #$FF ; XXX implement this
|
||||
|
||||
burst_advertise_done:
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -1,38 +1,38 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Helper routine for JiffyDOS detection
|
||||
//
|
||||
;
|
||||
; Helper routine for JiffyDOS detection
|
||||
;
|
||||
|
||||
// The standard parallel cable (used by SpeedDOS, DolphinDOS 2, etc.) connects the following UserPort lines:
|
||||
// - PB0-PB7 - CIA2_PRB ($DD01), CIA #2 port B
|
||||
// - PC2, FLAG2 - CIA2_ICR ($DD0D), CIA #2 handshaking line
|
||||
//
|
||||
// See:
|
||||
// - http://sta.c64.org/cbmpar41c.html
|
||||
// - http://sta.c64.org/cbmpar71c.html
|
||||
// - Commodore 64 Programers Referencee Guide, pages 360-361, 429
|
||||
// - Computes Mapping the C64, page 183
|
||||
; The standard parallel cable (used by SpeedDOS, DolphinDOS 2, etc.) connects the following UserPort lines:
|
||||
; - PB0-PB7 - CIA2_PRB ($DD01), CIA #2 port B
|
||||
; - PC2, FLAG2 - CIA2_ICR ($DD0D), CIA #2 handshaking line
|
||||
;
|
||||
; See:
|
||||
; - http://sta.c64.org/cbmpar41c.html
|
||||
; - http://sta.c64.org/cbmpar71c.html
|
||||
; - Commodore 64 Programers Referencee Guide, pages 360-361, 429
|
||||
; - Computes Mapping the C64, page 183
|
||||
|
||||
|
||||
|
||||
#if CONFIG_IEC_DOLPHINDOS
|
||||
!ifdef CONFIG_IEC_DOLPHINDOS {
|
||||
|
||||
|
||||
dolphindos_detect:
|
||||
|
||||
// Make sure the port settings are correct
|
||||
; Make sure the port settings are correct
|
||||
|
||||
lda #$7F
|
||||
sta CIA2_ICR // disable interrupt generation
|
||||
sta CIA2_ICR ; disable interrupt generation
|
||||
lda #$00
|
||||
sta CIA2_DDRB // set all port B lines as input
|
||||
sta CIA2_DDRB ; set all port B lines as input
|
||||
|
||||
// According to logs collected from modified VICE emulator, original DolphinDOS ROM
|
||||
// constantly reads $DD0D and $DD01 until handshake bit of $DD0D is set, or some kind
|
||||
// of timeout occurs
|
||||
; According to logs collected from modified VICE emulator, original DolphinDOS ROM
|
||||
; constantly reads $DD0D and $DD01 until handshake bit of $DD0D is set, or some kind
|
||||
; of timeout occurs
|
||||
|
||||
ldx #$20
|
||||
|
||||
@@ -41,12 +41,12 @@ dolphindos_detect_loop:
|
||||
lda CIA2_ICR
|
||||
cmp #$10
|
||||
beq dolphindos_detect_success
|
||||
lda CIA2_PRB // XXX do we need this read?
|
||||
lda CIA2_PRB ; XXX do we need this read?
|
||||
|
||||
dex
|
||||
bne dolphindos_detect_loop
|
||||
|
||||
// FALLTROUGH - protocol not detected
|
||||
; FALLTROUGH - protocol not detected
|
||||
|
||||
dolphindos_detect_fail:
|
||||
|
||||
@@ -54,7 +54,7 @@ dolphindos_detect_fail:
|
||||
|
||||
dolphindos_detect_success:
|
||||
|
||||
// Protocol detected
|
||||
; Protocol detected
|
||||
|
||||
lda #IEC_DOLPHIN
|
||||
sta IECPROTO
|
||||
@@ -62,4 +62,4 @@ dolphindos_detect_success:
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC_DOLPHINDOS
|
||||
} ; CONFIG_IEC_DOLPHINDOS
|
||||
@@ -1,122 +1,121 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// DolphinDOS protocol support for IEC - optimized load loop
|
||||
//
|
||||
;
|
||||
; DolphinDOS protocol support for IEC - optimized load loop
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC_DOLPHINDOS && !CONFIG_MEMORY_MODEL_60K
|
||||
!ifdef CONFIG_IEC_DOLPHINDOS { !ifndef CONFIG_MEMORY_MODEL_60K {
|
||||
|
||||
|
||||
dolphindos_load:
|
||||
|
||||
// Timing is critical for some parts, do not allow interrupts
|
||||
; Timing is critical for some parts, do not allow interrupts
|
||||
sei
|
||||
|
||||
// A trick to shorten EAL update time
|
||||
; A trick to shorten EAL update time
|
||||
ldy #$00
|
||||
|
||||
#if CONFIG_IEC_DOLPHINDOS_FAST
|
||||
// Another trick: prepare values for quickly setting/releasing DATA
|
||||
!ifdef CONFIG_IEC_DOLPHINDOS_FAST {
|
||||
|
||||
; Another trick: prepare values for quickly setting/releasing DATA
|
||||
lda CIA2_PRA
|
||||
and #$FF - BIT_CIA2_PRA_DAT_OUT - BIT_CIA2_PRA_CLK_OUT - BIT_CIA2_PRA_ATN_OUT
|
||||
sta IECPROTO // release DATA
|
||||
sta IECPROTO ; release DATA
|
||||
ora #BIT_CIA2_PRA_DAT_OUT
|
||||
sta TBTCNT // pull DATA
|
||||
#endif
|
||||
|
||||
// FALLTROUGH
|
||||
sta TBTCNT ; pull DATA
|
||||
}
|
||||
; FALLTROUGH
|
||||
|
||||
dolphindos_load_loop:
|
||||
|
||||
#if !CONFIG_IEC_DOLPHINDOS_FAST
|
||||
// Check if this was EOI
|
||||
!ifndef CONFIG_IEC_DOLPHINDOS_FAST {
|
||||
; Check if this was EOI
|
||||
bit IOSTATUS
|
||||
bvs dolphindos_load_end
|
||||
#endif
|
||||
}
|
||||
|
||||
// Wait for the talker to release the CLK line
|
||||
!:
|
||||
; Wait for the talker to release the CLK line
|
||||
@1:
|
||||
bit CIA2_PRA
|
||||
bvc !-
|
||||
bvc @1
|
||||
|
||||
// Release the DATA to signal we are ready
|
||||
#if !CONFIG_IEC_DOLPHINDOS_FAST
|
||||
; Release the DATA to signal we are ready
|
||||
!ifndef CONFIG_IEC_DOLPHINDOS_FAST {
|
||||
lda CIA2_PRA
|
||||
and #$FF - BIT_CIA2_PRA_DAT_OUT // release
|
||||
#else
|
||||
and #$FF - BIT_CIA2_PRA_DAT_OUT ; release
|
||||
} else {
|
||||
lda IECPROTO
|
||||
#endif
|
||||
}
|
||||
sta CIA2_PRA
|
||||
|
||||
#if !CONFIG_IEC_DOLPHINDOS_FAST
|
||||
!ifndef CONFIG_IEC_DOLPHINDOS_FAST {
|
||||
|
||||
// Check if EOI
|
||||
jsr iec_rx_check_eoi // can damage .X, but this is safe
|
||||
; Check if EOI
|
||||
jsr iec_rx_check_eoi ; can damage .X, but this is safe
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
// Check if EOI - inlined code to avoid wasting cycles on RTS
|
||||
; Check if EOI - inlined code to avoid wasting cycles on RTS
|
||||
ldx #$13
|
||||
!:
|
||||
@2:
|
||||
bit CIA2_PRA
|
||||
bvc dolphindos_load_no_eoi
|
||||
dex
|
||||
bne !-
|
||||
bne @2
|
||||
|
||||
// EOI - mark it and retrieve the last byte
|
||||
; EOI - mark it and retrieve the last byte
|
||||
jsr iec_rx_check_eoi_confirm
|
||||
lda CIA2_PRB
|
||||
sta (EAL),y
|
||||
|
||||
// Update EAL for the last time
|
||||
; Update EAL for the last time
|
||||
sec
|
||||
jsr iec_update_EAL_by_Y
|
||||
|
||||
// Restore proper IECPROTO value
|
||||
; Restore proper IECPROTO value
|
||||
lda #IEC_DOLPHIN
|
||||
sta IECPROTO
|
||||
|
||||
// End of load loop
|
||||
; End of load loop
|
||||
jmp load_iec_loop_end
|
||||
|
||||
dolphindos_load_no_eoi:
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
// Retrieve and store byte
|
||||
; Retrieve and store byte
|
||||
lda CIA2_PRB
|
||||
sta (EAL),y
|
||||
|
||||
// Pull DATA to acknowledge
|
||||
#if !CONFIG_IEC_DOLPHINDOS_FAST
|
||||
; Pull DATA to acknowledge
|
||||
!ifndef CONFIG_IEC_DOLPHINDOS_FAST {
|
||||
lda CIA2_PRA
|
||||
ora #BIT_CIA2_PRA_DAT_OUT
|
||||
#else
|
||||
} else {
|
||||
lda TBTCNT
|
||||
#endif
|
||||
}
|
||||
sta CIA2_PRA
|
||||
|
||||
// Handle EAL
|
||||
; Handle EAL
|
||||
iny
|
||||
bne dolphindos_load_loop
|
||||
inc EAL+1
|
||||
jmp dolphindos_load_loop
|
||||
|
||||
#if !CONFIG_IEC_DOLPHINDOS_FAST
|
||||
!ifndef CONFIG_IEC_DOLPHINDOS_FAST {
|
||||
|
||||
dolphindos_load_end:
|
||||
|
||||
// Update EAL
|
||||
; Update EAL
|
||||
clc
|
||||
jsr iec_update_EAL_by_Y
|
||||
|
||||
// End of load loop
|
||||
; End of load loop
|
||||
jmp load_iec_loop_end
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif // CONFIG_IEC_DOLPHINDOS and not CONFIG_MEMORY_MODEL_60K
|
||||
} } ; CONFIG_IEC_DOLPHINDOS and not CONFIG_MEMORY_MODEL_60K
|
||||
@@ -1,42 +1,41 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Helper table for encoding lower nibble for JiffyDOS,
|
||||
// values found by observing the actual transfer using
|
||||
// original ROMs
|
||||
//
|
||||
;
|
||||
; Helper table for encoding lower nibble for JiffyDOS,
|
||||
; values found by observing the actual transfer using
|
||||
; original ROMs
|
||||
;
|
||||
|
||||
// Similar tables are probably used by nearly all the disk turbo loaders,
|
||||
// either on the C64 or drive side, soometimes generated in RAM on the fly;
|
||||
// example disk turbo presented below has a very similar table - but the
|
||||
// values are in reversed order:
|
||||
// - https://www.pagetable.com/?p=568
|
||||
; Similar tables are probably used by nearly all the disk turbo loaders,
|
||||
; either on the C64 or drive side, soometimes generated in RAM on the fly;
|
||||
; example disk turbo presented below has a very similar table - but the
|
||||
; values are in reversed order:
|
||||
; - https://www.pagetable.com/?p=568
|
||||
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
|
||||
|
||||
jiffydos_bittable:
|
||||
|
||||
.byte $00
|
||||
.byte $80 // $10 + $70
|
||||
.byte $20
|
||||
.byte $A0 // $30 + $70
|
||||
.byte $40
|
||||
.byte $C0 // $50 + $70
|
||||
.byte $60
|
||||
.byte $E0 // $70 + $70
|
||||
!byte $00
|
||||
!byte $80 ; $10 + $70
|
||||
!byte $20
|
||||
!byte $A0 ; $30 + $70
|
||||
!byte $40
|
||||
!byte $C0 ; $50 + $70
|
||||
!byte $60
|
||||
!byte $E0 ; $70 + $70
|
||||
|
||||
.byte $10 // $80 - $70
|
||||
.byte $90
|
||||
.byte $30 // $A0 - $70
|
||||
.byte $B0
|
||||
.byte $50 // $C0 - $70
|
||||
.byte $D0
|
||||
.byte $70 // $E0 - $70
|
||||
.byte $F0
|
||||
!byte $10 ; $80 - $70
|
||||
!byte $90
|
||||
!byte $30 ; $A0 - $70
|
||||
!byte $B0
|
||||
!byte $50 ; $C0 - $70
|
||||
!byte $D0
|
||||
!byte $70 ; $E0 - $70
|
||||
!byte $F0
|
||||
|
||||
|
||||
#endif // CONFIG_IEC_JIFFYDOS
|
||||
} ; CONFIG_IEC_JIFFYDOS
|
||||
@@ -1,54 +1,52 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Helper routine for JiffyDOS detection
|
||||
//
|
||||
;
|
||||
; Helper routine for JiffyDOS detection
|
||||
;
|
||||
|
||||
// Detection is done by inserting a long delay (above 400us?) during sending command last bit, see:
|
||||
// - https://sites.google.com/site/h2obsession/CBM/C128/JiffySoft128
|
||||
// - https://github.com/rkrajnc/sd2iec/blob/master/src/iec.c
|
||||
// The 'iec.s' suggests, that the drive should respond by pulling data
|
||||
; Detection is done by inserting a long delay (above 400us?) during sending command last bit, see:
|
||||
; - https://sites.google.com/site/h2obsession/CBM/C128/JiffySoft128
|
||||
; - https://github.com/rkrajnc/sd2iec/blob/master/src/iec.c
|
||||
; The 'iec.s' suggests, that the drive should respond by pulling data
|
||||
|
||||
// The original JiffyDOS ROM seems to perform detection with every command
|
||||
// (even though for many of them it always fails) and we have to replicate
|
||||
// this behaviour for compatibility with at least 1541 JiffyDOS ROM
|
||||
; The original JiffyDOS ROM seems to perform detection with every command
|
||||
; (even though for many of them it always fails) and we have to replicate
|
||||
; this behaviour for compatibility with at least 1541 JiffyDOS ROM
|
||||
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
|
||||
|
||||
jiffydos_detect:
|
||||
|
||||
ldy #$25 // 400us is nearly 410 cycles on NTSC
|
||||
// loop iteration below is 11 cycles,
|
||||
// and several cycles were already used
|
||||
ldy #$25 ; 400us is nearly 410 cycles on NTSC
|
||||
; loop iteration below is 11 cycles,
|
||||
; and several cycles were already used
|
||||
jiffydos_detect_loop:
|
||||
lda CIA2_PRA // 4 cycles
|
||||
bpl jiffydos_detected // 2 cycles
|
||||
dey // 2 cycles
|
||||
bne jiffydos_detect_loop // 3 cycles if branch
|
||||
lda CIA2_PRA ; 4 cycles
|
||||
bpl jiffydos_detected ; 2 cycles
|
||||
dey ; 2 cycles
|
||||
bne jiffydos_detect_loop ; 3 cycles if branch
|
||||
|
||||
lda IECPROTO
|
||||
bpl jiffydos_detect_end // no detection requested, preserve existing protocol
|
||||
bpl jiffydos_detect_end ; no detection requested, preserve existing protocol
|
||||
|
||||
lda #IEC_NORMAL // normal protocol
|
||||
beq jiffydos_store_proto // branch always
|
||||
lda #IEC_NORMAL ; normal protocol
|
||||
beq jiffydos_store_proto ; branch always
|
||||
|
||||
jiffydos_detected:
|
||||
jsr iec_wait_for_data_release // guessed from VICE logs
|
||||
lda #IEC_JIFFY // JiffyDOS protocol
|
||||
jsr iec_wait_for_data_release ; guessed from VICE logs
|
||||
lda #IEC_JIFFY ; JiffyDOS protocol
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
jiffydos_store_proto:
|
||||
sta IECPROTO
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
jiffydos_detect_end:
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC_JIFFYDOS
|
||||
}
|
||||
@@ -1,131 +1,129 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// JiffyDOS protocol support for IEC - optimized load loop
|
||||
//
|
||||
;
|
||||
; JiffyDOS protocol support for IEC - optimized load loop
|
||||
;
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS && !CONFIG_MEMORY_MODEL_60K
|
||||
!ifdef CONFIG_IEC_JIFFYDOS { !ifndef CONFIG_MEMORY_MODEL_60K {
|
||||
|
||||
|
||||
// Note: original JiffyDOS LOAD loop checks for RUN/STOP key every time a sector is read,
|
||||
// see description at https://sites.google.com/site/h2obsession/CBM/C128/JiffySoft128
|
||||
//
|
||||
// For simplicity and some space savings, our routine does not check the RUN/STOP key at all;
|
||||
// the protocol is fast enough (especially with modern flash mediums) that probably nobody
|
||||
// will want to terminate the loading.
|
||||
; Note: original JiffyDOS LOAD loop checks for RUN/STOP key every time a sector is read,
|
||||
; see description at https://sites.google.com/site/h2obsession/CBM/C128/JiffySoft128
|
||||
;
|
||||
; For simplicity and some space savings, our routine does not check the RUN/STOP key at all;
|
||||
; the protocol is fast enough (especially with modern flash mediums) that probably nobody
|
||||
; will want to terminate the loading.
|
||||
|
||||
|
||||
jiffydos_load:
|
||||
|
||||
// XXX implement JiffyDOS optimized LOAD protocol, this one is ineffective
|
||||
; XXX implement JiffyDOS optimized LOAD protocol, this one is ineffective
|
||||
|
||||
|
||||
// Timing is critical, do not allow interrupts
|
||||
; Timing is critical, do not allow interrupts
|
||||
sei
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS_BLANK
|
||||
!ifdef CONFIG_IEC_JIFFYDOS_BLANK {
|
||||
|
||||
// Preserve register with screen status (blank/visible)
|
||||
; Preserve register with screen status (blank/visible)
|
||||
lda VIC_SCROLY
|
||||
sta TBTCNT
|
||||
|
||||
// Blank screen to make sure no sprite/badline will interrupt
|
||||
; Blank screen to make sure no sprite/badline will interrupt
|
||||
jsr screen_off
|
||||
|
||||
// Preserve 3 lowest bits of CIA2_PRA XXX deduplicate this
|
||||
; Preserve 3 lowest bits of CIA2_PRA XXX deduplicate this
|
||||
|
||||
lda CIA2_PRA
|
||||
and #%00000111
|
||||
sta C3PO
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
// Store previous sprite status in temporary variable
|
||||
; Store previous sprite status in temporary variable
|
||||
jsr jiffydos_prepare
|
||||
sta TBTCNT
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// A trick to shorten EAL update time
|
||||
; A trick to shorten EAL update time
|
||||
ldy #$FF
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
jiffydos_load_loop:
|
||||
|
||||
// Wait until device is ready to send (releases CLK)
|
||||
; Wait until device is ready to send (releases CLK)
|
||||
jsr iec_wait_for_clk_release
|
||||
|
||||
// Prepare 'start sending' message
|
||||
; Prepare 'start sending' message
|
||||
lda CIA2_PRA
|
||||
and #$FF - BIT_CIA2_PRA_DAT_OUT // release
|
||||
and #$FF - BIT_CIA2_PRA_DAT_OUT ; release
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS_BLANK
|
||||
!ifdef CONFIG_IEC_JIFFYDOS_BLANK {
|
||||
|
||||
// It seems JiffyDOS needs some time here; waste few cycles
|
||||
nop
|
||||
; It seems JiffyDOS needs some time here; waste few cycles
|
||||
+nop
|
||||
jsr iec_wait_rts
|
||||
|
||||
// Ask device to start sending bits
|
||||
; Ask device to start sending bits
|
||||
sta CIA2_PRA
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
// Wait for appropriate moment, ask device to start sending bits
|
||||
; Wait for appropriate moment, ask device to start sending bits
|
||||
tax
|
||||
jsr jiffydos_wait_line
|
||||
stx CIA2_PRA // cycles: 4
|
||||
stx CIA2_PRA ; cycles: 4
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Prepare 'data pull' byte, cycles: 3 + 2 + 2 = 7
|
||||
; Prepare 'data pull' byte, cycles: 3 + 2 + 2 = 7
|
||||
lda C3PO
|
||||
ora #BIT_CIA2_PRA_DAT_OUT // pull
|
||||
ora #BIT_CIA2_PRA_DAT_OUT ; pull
|
||||
tax
|
||||
|
||||
// Delay, JiffyDOS needs some time, 4 cycles
|
||||
nop
|
||||
nop
|
||||
; Delay, JiffyDOS needs some time, 4 cycles
|
||||
+nop
|
||||
+nop
|
||||
|
||||
// Get bits, cycles: 4 + 2 + 2 = 8
|
||||
lda CIA2_PRA // bits 0 and 1 on CLK/DATA
|
||||
; Get bits, cycles: 4 + 2 + 2 = 8
|
||||
lda CIA2_PRA ; bits 0 and 1 on CLK/DATA
|
||||
lsr
|
||||
lsr
|
||||
|
||||
// Delay, JiffyDOS needs some time, 2 cycles
|
||||
nop
|
||||
; Delay, JiffyDOS needs some time, 2 cycles
|
||||
+nop
|
||||
|
||||
// Get bits, cycles: 4 + 2 + 2 = 8
|
||||
ora CIA2_PRA // bits 2 and 3 on CLK/DATA
|
||||
; Get bits, cycles: 4 + 2 + 2 = 8
|
||||
ora CIA2_PRA ; bits 2 and 3 on CLK/DATA
|
||||
lsr
|
||||
lsr
|
||||
|
||||
// Get bits, cycles: 3 + 4 + 2 + 2 = 11
|
||||
; Get bits, cycles: 3 + 4 + 2 + 2 = 11
|
||||
eor C3PO
|
||||
eor CIA2_PRA // bits 4 and 5 on CLK/DATA
|
||||
eor CIA2_PRA ; bits 4 and 5 on CLK/DATA
|
||||
lsr
|
||||
lsr
|
||||
|
||||
// Get bits, cycles: 3 + 4 = 7
|
||||
; Get bits, cycles: 3 + 4 = 7
|
||||
eor C3PO
|
||||
eor CIA2_PRA // bits 6 and 7 on CLK/DATA
|
||||
eor CIA2_PRA ; bits 6 and 7 on CLK/DATA
|
||||
|
||||
// Store retrieved byte, cycles: 2 + 6 = 8
|
||||
iny // NTSC needs this delay
|
||||
sta (EAL),y // not compatible with CONFIG_MEMORY_MODEL_60K
|
||||
; Store retrieved byte, cycles: 2 + 6 = 8
|
||||
iny ; NTSC needs this delay
|
||||
sta (EAL),y ; not compatible with CONFIG_MEMORY_MODEL_60K
|
||||
|
||||
// Retrieve status bits, cycles: 4
|
||||
; Retrieve status bits, cycles: 4
|
||||
bit CIA2_PRA
|
||||
|
||||
// Pull DATA at the end, cycles: 4
|
||||
; Pull DATA at the end, cycles: 4
|
||||
stx CIA2_PRA
|
||||
|
||||
// If CLK line not active - this was the last byte
|
||||
; If CLK line not active - this was the last byte
|
||||
bvs jiffydos_load_end
|
||||
|
||||
// Handle EAL
|
||||
; Handle EAL
|
||||
cpy #$FF
|
||||
bne jiffydos_load_loop
|
||||
inc EAL+1
|
||||
@@ -133,43 +131,42 @@ jiffydos_load_loop:
|
||||
|
||||
jiffydos_load_end:
|
||||
|
||||
// Save last byte
|
||||
; Save last byte
|
||||
tax
|
||||
|
||||
// Update EAL
|
||||
; Update EAL
|
||||
sec
|
||||
jsr iec_update_EAL_by_Y
|
||||
|
||||
// Indicate that no byte waits in output buffer
|
||||
; Indicate that no byte waits in output buffer
|
||||
lda #$00
|
||||
sta C3PO
|
||||
|
||||
// Restore proper IECPROTO value
|
||||
; Restore proper IECPROTO value
|
||||
lda #IEC_JIFFY
|
||||
sta IECPROTO
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS_BLANK
|
||||
!ifdef CONFIG_IEC_JIFFYDOS_BLANK {
|
||||
|
||||
// Restore screen state
|
||||
; Restore screen state
|
||||
lda TBTCNT
|
||||
sta VIC_SCROLY
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
// Re-enable sprites
|
||||
; Re-enable sprites
|
||||
lda TBTCNT
|
||||
sta VIC_SPENA
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Store last byte as unoptimized LOAD routine would
|
||||
; Store last byte as unoptimized LOAD routine would
|
||||
stx TBTCNT
|
||||
|
||||
// No need to re-enable interrupts; other IEC routines
|
||||
// called by LOAD will do this nevertheless
|
||||
; No need to re-enable interrupts; other IEC routines
|
||||
; called by LOAD will do this nevertheless
|
||||
|
||||
// End of load loop
|
||||
; End of load loop
|
||||
jmp load_iec_loop_end
|
||||
|
||||
|
||||
#endif // CONFIG_IEC_JIFFYDOS and not CONFIG_MEMORY_MODEL_60K
|
||||
} } ; CONFIG_IEC_JIFFYDOS and not CONFIG_MEMORY_MODEL_60K
|
||||
@@ -1,32 +1,30 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// JiffyDOS transfer preparation routine
|
||||
//
|
||||
;
|
||||
; JiffyDOS transfer preparation routine
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
|
||||
|
||||
jiffydos_prepare:
|
||||
|
||||
// We need to preserve 3 lowest bits of CIA2_PRA, they contain important
|
||||
// data - fortunately, the bits are never changed by external devices
|
||||
// Use C3PO for this, as afterwards we have to set there 0 nevertheless
|
||||
; We need to preserve 3 lowest bits of CIA2_PRA, they contain important
|
||||
; data - fortunately, the bits are never changed by external devices
|
||||
; Use C3PO for this, as afterwards we have to set there 0 nevertheless
|
||||
lda CIA2_PRA
|
||||
and #%00000111
|
||||
sta C3PO
|
||||
|
||||
// Hide sprites; JiffyDOS timing regime is very strict, before transmitting
|
||||
// anything we need to make sure nothing will steal the cycles
|
||||
; Hide sprites; JiffyDOS timing regime is very strict, before transmitting
|
||||
; anything we need to make sure nothing will steal the cycles
|
||||
|
||||
lda VIC_SPENA
|
||||
ldx #$00
|
||||
stx VIC_SPENA
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC_JIFFYDOS
|
||||
}
|
||||
@@ -1,121 +1,119 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// JiffyDOS protocol support for IEC - byte reception
|
||||
//
|
||||
;
|
||||
; JiffyDOS protocol support for IEC - byte reception
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
|
||||
|
||||
jiffydos_rx_byte:
|
||||
|
||||
// Timing is critical, do not allow interrupts
|
||||
; Timing is critical, do not allow interrupts
|
||||
sei
|
||||
|
||||
// Store .X and .Y on the stack - preserve them
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
; Store .X and .Y on the stack - preserve them
|
||||
+phx_trash_a
|
||||
+phy_trash_a
|
||||
|
||||
// Store previous sprite status on stack
|
||||
; Store previous sprite status on stack
|
||||
jsr jiffydos_prepare
|
||||
pha
|
||||
|
||||
// Wait until device is ready to send (releases CLK)
|
||||
; Wait until device is ready to send (releases CLK)
|
||||
jsr iec_wait_for_clk_release
|
||||
|
||||
// Prepare 'start sending' message
|
||||
; Prepare 'start sending' message
|
||||
lda CIA2_PRA
|
||||
and #$FF - BIT_CIA2_PRA_DAT_OUT // release
|
||||
and #$FF - BIT_CIA2_PRA_DAT_OUT ; release
|
||||
tax
|
||||
|
||||
// Wait for appropriate moment
|
||||
; Wait for appropriate moment
|
||||
jsr jiffydos_wait_line
|
||||
|
||||
// Ask device to start sending bits
|
||||
stx CIA2_PRA // cycles: 4
|
||||
; Ask device to start sending bits
|
||||
stx CIA2_PRA ; cycles: 4
|
||||
|
||||
// Prepare 'data pull' byte, cycles: 3 + 2 + 2 = 7
|
||||
; Prepare 'data pull' byte, cycles: 3 + 2 + 2 = 7
|
||||
lda C3PO
|
||||
ora #BIT_CIA2_PRA_DAT_OUT // pull
|
||||
ora #BIT_CIA2_PRA_DAT_OUT ; pull
|
||||
tax
|
||||
|
||||
// Delay, JiffyDOS needs some time, 4 cycles
|
||||
nop
|
||||
nop
|
||||
; Delay, JiffyDOS needs some time, 4 cycles
|
||||
+nop
|
||||
+nop
|
||||
|
||||
// Get bits, cycles: 4 + 2 + 2 = 8
|
||||
lda CIA2_PRA // bits 0 and 1 on CLK/DATA
|
||||
; Get bits, cycles: 4 + 2 + 2 = 8
|
||||
lda CIA2_PRA ; bits 0 and 1 on CLK/DATA
|
||||
lsr
|
||||
lsr
|
||||
|
||||
// Wait for the drive, cycles: 2
|
||||
nop
|
||||
; Wait for the drive, cycles: 2
|
||||
+nop
|
||||
|
||||
// Get bits, cycles: 4 + 2 + 2 = 8
|
||||
ora CIA2_PRA // bits 2 and 3 on CLK/DATA
|
||||
; Get bits, cycles: 4 + 2 + 2 = 8
|
||||
ora CIA2_PRA ; bits 2 and 3 on CLK/DATA
|
||||
lsr
|
||||
lsr
|
||||
|
||||
// Get bits, cycles: 3 + 4 + 2 + 2 = 11
|
||||
; Get bits, cycles: 3 + 4 + 2 + 2 = 11
|
||||
eor C3PO
|
||||
eor CIA2_PRA // bits 4 and 5 on CLK/DATA
|
||||
eor CIA2_PRA ; bits 4 and 5 on CLK/DATA
|
||||
lsr
|
||||
lsr
|
||||
|
||||
// Get bits, cycles: 3 + 4 = 7
|
||||
; Get bits, cycles: 3 + 4 = 7
|
||||
eor C3PO
|
||||
eor CIA2_PRA // bits 6 and 7 on CLK/DATA
|
||||
eor CIA2_PRA ; bits 6 and 7 on CLK/DATA
|
||||
|
||||
// Preserve read byte, cycles: 3
|
||||
sta TBTCNT // $A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html
|
||||
; Preserve read byte, cycles: 3
|
||||
sta TBTCNT ; $A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html
|
||||
|
||||
// Delay, JiffyDOS needs some time; for PAL one NOP would be enough,
|
||||
// but NTSC machines are clocked slightly faster; cycles: 4
|
||||
nop
|
||||
nop
|
||||
; Delay, JiffyDOS needs some time; for PAL one NOP would be enough,
|
||||
; but NTSC machines are clocked slightly faster; cycles: 4
|
||||
+nop
|
||||
+nop
|
||||
|
||||
// Retrieve status bits, cycles: 4
|
||||
; Retrieve status bits, cycles: 4
|
||||
bit CIA2_PRA
|
||||
|
||||
// Pull DATA at the end, cycles: 4
|
||||
; Pull DATA at the end, cycles: 4
|
||||
stx CIA2_PRA
|
||||
|
||||
// If CLK line active - success
|
||||
; If CLK line active - success
|
||||
bvc jiffydos_rx_byte_end
|
||||
|
||||
// EOI or error, released DATA (highest byte set to 1) means error - see protocol analysis by Michael Steil, step R7a
|
||||
; EOI or error, released DATA (highest byte set to 1) means error - see protocol analysis by Michael Steil, step R7a
|
||||
lda CIA2_PRA
|
||||
bmi jiffydos_rx_byte_error
|
||||
|
||||
// EOI - no error
|
||||
; EOI - no error
|
||||
jsr kernalstatus_EOI
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
jiffydos_rx_byte_end:
|
||||
|
||||
// Indicate that no byte waits in output buffer
|
||||
; Indicate that no byte waits in output buffer
|
||||
lda #$00
|
||||
sta C3PO
|
||||
|
||||
// Restore proper IECPROTO value
|
||||
; Restore proper IECPROTO value
|
||||
lda #IEC_JIFFY
|
||||
sta IECPROTO
|
||||
|
||||
// Re-enable sprites
|
||||
; Re-enable sprites
|
||||
pla
|
||||
sta VIC_SPENA
|
||||
|
||||
// End byte reception
|
||||
; End byte reception
|
||||
jmp iec_rx_end
|
||||
|
||||
jiffydos_rx_byte_error:
|
||||
|
||||
jsr kernalerror_IEC_TIMEOUT_READ
|
||||
bcs jiffydos_rx_byte_end // branch always
|
||||
|
||||
|
||||
#endif // CONFIG_IEC_JIFFYDOS
|
||||
bcs jiffydos_rx_byte_end ; branch always
|
||||
}
|
||||
@@ -1,97 +1,97 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// JiffyDOS protocol support for IEC - byte transfer
|
||||
//
|
||||
;
|
||||
; JiffyDOS protocol support for IEC - byte transfer
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
|
||||
|
||||
jiffydos_tx_byte:
|
||||
|
||||
// Timing is critical, do not allow interrupts
|
||||
; Timing is critical, do not allow interrupts
|
||||
sei
|
||||
|
||||
// If EOI requested (carry flag set), mark this in IECPROTO as 0
|
||||
bcc !+
|
||||
dec IECPROTO // turns 1 into 0
|
||||
!:
|
||||
// Store .X and .Y on the stack - preserve them
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
; If EOI requested (carry flag set), mark this in IECPROTO as 0
|
||||
bcc @1
|
||||
dec IECPROTO ; turns 1 into 0
|
||||
@1:
|
||||
; Store .X and .Y on the stack - preserve them
|
||||
+phx_trash_a
|
||||
+phy_trash_a
|
||||
|
||||
// Make sure we are not sending data on ATN
|
||||
; Make sure we are not sending data on ATN
|
||||
jsr iec_release_atn
|
||||
|
||||
// Store previous sprite status on stack
|
||||
; Store previous sprite status on stack
|
||||
jsr jiffydos_prepare
|
||||
pha
|
||||
|
||||
// Prepare nibbles to send
|
||||
; Prepare nibbles to send
|
||||
lda TBTCNT
|
||||
and #$0F
|
||||
tax
|
||||
lda jiffydos_bittable, X // low nibble has to be encoded
|
||||
lda jiffydos_bittable, X ; low nibble has to be encoded
|
||||
pha
|
||||
lda TBTCNT
|
||||
and #$F0
|
||||
pha
|
||||
|
||||
// Prepare value for device notification
|
||||
; Prepare value for device notification
|
||||
ldx C3PO
|
||||
|
||||
// Wait till receiver is ready
|
||||
; Wait till receiver is ready
|
||||
jsr iec_wait_for_data_release
|
||||
|
||||
// Wait till it is safe to send data
|
||||
; Wait till it is safe to send data
|
||||
jsr jiffydos_wait_line
|
||||
|
||||
// Notify device that we are going to send byte by releasing everything
|
||||
stx CIA2_PRA // cycles: 4
|
||||
// Send high nibble; cycles: 4 + 3 + 4 + 2 + 2 + 2 + 3 + 4 = 24
|
||||
pla // retrieve high nibble from stack
|
||||
ora C3PO // restore VIC-II and RS-232 bits
|
||||
sta CIA2_PRA // bits 4 and 5 on CLK/DATA
|
||||
lsr // move bits 6 and 7 to positions 4 and 5
|
||||
; Notify device that we are going to send byte by releasing everything
|
||||
stx CIA2_PRA ; cycles: 4
|
||||
; Send high nibble; cycles: 4 + 3 + 4 + 2 + 2 + 2 + 3 + 4 = 24
|
||||
pla ; retrieve high nibble from stack
|
||||
ora C3PO ; restore VIC-II and RS-232 bits
|
||||
sta CIA2_PRA ; bits 4 and 5 on CLK/DATA
|
||||
lsr ; move bits 6 and 7 to positions 4 and 5
|
||||
lsr
|
||||
and #%00110000 // clear everything but CLK/DATA
|
||||
and #%00110000 ; clear everything but CLK/DATA
|
||||
ora C3PO
|
||||
sta CIA2_PRA // bits 6 and 7 on CLK/DATA
|
||||
sta CIA2_PRA ; bits 6 and 7 on CLK/DATA
|
||||
|
||||
// Send low nibble; cycles: 4 + 3 + 4 + 2 + 2 + 2 + 4 = 21
|
||||
pla // retrieve low nibble from stack
|
||||
ora C3PO // restore VIC-II and RS-232 bits
|
||||
; Send low nibble; cycles: 4 + 3 + 4 + 2 + 2 + 2 + 4 = 21
|
||||
pla ; retrieve low nibble from stack
|
||||
ora C3PO ; restore VIC-II and RS-232 bits
|
||||
sta CIA2_PRA
|
||||
lsr
|
||||
lsr
|
||||
and #%00110000 // clear everything but CLK/DATA
|
||||
and #%00110000 ; clear everything but CLK/DATA
|
||||
sta CIA2_PRA
|
||||
|
||||
// Signal EOI if needed; cycles till no EOI: 3 + 3 + 2 + 2 + 4 = 14
|
||||
; Signal EOI if needed; cycles till no EOI: 3 + 3 + 2 + 2 + 4 = 14
|
||||
lda C3PO
|
||||
ldx IECPROTO
|
||||
beq jiffydos_tx_byte_wait_eoi
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
jiffydos_tx_byte_finalize:
|
||||
|
||||
ora #BIT_CIA2_PRA_CLK_OUT // pull CLK
|
||||
ora #BIT_CIA2_PRA_CLK_OUT ; pull CLK
|
||||
sta CIA2_PRA
|
||||
|
||||
// Restore proper IECPROTO value
|
||||
; Restore proper IECPROTO value
|
||||
lda #IEC_JIFFY
|
||||
sta IECPROTO
|
||||
|
||||
// Re-enable sprites and interrupts
|
||||
; Re-enable sprites and interrupts
|
||||
pla
|
||||
sta VIC_SPENA
|
||||
cli
|
||||
|
||||
// Return success
|
||||
; Return success
|
||||
jmp iec_return_success
|
||||
|
||||
|
||||
@@ -101,11 +101,9 @@ jiffydos_tx_byte_wait_eoi:
|
||||
jsr iec_wait20us
|
||||
lda C3PO
|
||||
|
||||
// According to protocol analysis by Michael Steil (step S8) we should pull the DATA here
|
||||
// to signal there was no error; but DATA pulled by the controller is a normal state
|
||||
// (which should be stored in C3PO), so there is nothing to do here.
|
||||
; According to protocol analysis by Michael Steil (step S8) we should pull the DATA here
|
||||
; to signal there was no error; but DATA pulled by the controller is a normal state
|
||||
; (which should be stored in C3PO), so there is nothing to do here.
|
||||
|
||||
jmp jiffydos_tx_byte_finalize
|
||||
|
||||
|
||||
#endif // CONFIG_IEC_JIFFYDOS
|
||||
}
|
||||
@@ -1,37 +1,35 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// JiffyDOS helper routine to wait for appropriate moment,
|
||||
// where no badline will interrupt the transmission
|
||||
//
|
||||
;
|
||||
; JiffyDOS helper routine to wait for appropriate moment,
|
||||
; where no badline will interrupt the transmission
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_IEC_JIFFYDOS
|
||||
!ifdef CONFIG_IEC_JIFFYDOS {
|
||||
|
||||
|
||||
jiffydos_wait_line:
|
||||
|
||||
// One might try to optimize the code by checking for disabled screen
|
||||
// (bit 4 of VIC_SCROLY); problem: VIC checks this bit only once per frame:
|
||||
// - https://www.lemon64.com/forum/viewtopic.php?t=56582
|
||||
// so it would complicated the code
|
||||
; One might try to optimize the code by checking for disabled screen
|
||||
; (bit 4 of VIC_SCROLY); problem: VIC checks this bit only once per frame:
|
||||
; - https://www.lemon64.com/forum/viewtopic.php?t=56582
|
||||
; so it would complicated the code
|
||||
|
||||
// Avoid 2 lines before the badline, otherwise VIC will ruin the synchronization
|
||||
; Avoid 2 lines before the badline, otherwise VIC will ruin the synchronization
|
||||
lda VIC_RASTER
|
||||
cmp #$2E
|
||||
bcc jiffydos_wait_line_done // we are safe, border - lot of time till badline
|
||||
!:
|
||||
lda VIC_RASTER // carry+ is definitely set here!
|
||||
bcc jiffydos_wait_line_done ; we are safe, border - lot of time till badline
|
||||
@1:
|
||||
lda VIC_RASTER ; carry+ is definitely set here!
|
||||
sbc VIC_SCROLY
|
||||
and #$07 // we want 8 lowest bits
|
||||
and #$07 ; we want 8 lowest bits
|
||||
cmp #$06
|
||||
bcs !-
|
||||
bcs @1
|
||||
|
||||
jiffydos_wait_line_done:
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC_JIFFYDOS
|
||||
}
|
||||
@@ -1,98 +1,106 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// MEGA65 pseudo-IEC internal DOS support
|
||||
//
|
||||
;
|
||||
; MEGA65 pseudo-IEC internal DOS support
|
||||
;
|
||||
|
||||
|
||||
.label VDOS_INIT = $4000 + 0 * 2
|
||||
.label VDOS_CHKUNIT = $4000 + 1 * 2
|
||||
.label VDOS_SETUNIT = $4000 + 2 * 2
|
||||
.label VDOS_ACPTR = $4000 + 3 * 2
|
||||
.label VDOS_CIOUT = $4000 + 4 * 2
|
||||
.label VDOS_LISTEN = $4000 + 5 * 2
|
||||
.label VDOS_SECOND = $4000 + 6 * 2
|
||||
.label VDOS_TALK = $4000 + 7 * 2
|
||||
.label VDOS_TKSA = $4000 + 8 * 2
|
||||
.label VDOS_UNTLK = $4000 + 9 * 2
|
||||
.label VDOS_UNLSN = $4000 + 10 * 2
|
||||
!addr VDOS_INIT = $4000 + 0 * 2
|
||||
!addr VDOS_CHKUNIT = $4000 + 1 * 2
|
||||
!addr VDOS_SETUNIT = $4000 + 2 * 2
|
||||
!addr VDOS_ACPTR = $4000 + 3 * 2
|
||||
!addr VDOS_CIOUT = $4000 + 4 * 2
|
||||
!addr VDOS_LISTEN = $4000 + 5 * 2
|
||||
!addr VDOS_SECOND = $4000 + 6 * 2
|
||||
!addr VDOS_TALK = $4000 + 7 * 2
|
||||
!addr VDOS_TKSA = $4000 + 8 * 2
|
||||
!addr VDOS_UNTLK = $4000 + 9 * 2
|
||||
!addr VDOS_UNLSN = $4000 + 10 * 2
|
||||
|
||||
|
||||
m65dos_init:
|
||||
|
||||
// Initializes the DOS internal variables
|
||||
; Initializes the DOS internal variables
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr_ind VDOS_INIT
|
||||
jmp_8 !+
|
||||
jsr (VDOS_INIT)
|
||||
bra m65dos_end_1
|
||||
|
||||
m65dos_chkunit: // XXX expose to BASIC
|
||||
m65dos_chkunit: ; XXX expose to BASIC
|
||||
|
||||
// Checks is the unit number is supported by the internal DOS
|
||||
// Input: .A - unit number to check
|
||||
// Output: Carry set if not supported, otherwise .A contains unit type (0 = SD card, 1 = internal floppy, 2 = RAM disk)
|
||||
; Checks is the unit number is supported by the internal DOS
|
||||
; Input: .A - unit number to check
|
||||
; Output: Carry set if not supported, otherwise .A contains unit type (0 = SD card, 1 = internal floppy, 2 = RAM disk)
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr_ind VDOS_CHKUNIT
|
||||
jmp_8 !+
|
||||
jsr (VDOS_CHKUNIT)
|
||||
bra m65dos_end_1
|
||||
|
||||
m65dos_setunit: // XXX expose to BASIC
|
||||
m65dos_setunit: ; XXX expose to BASIC
|
||||
|
||||
// Set the unit number
|
||||
// Input: .A - unit number, .X - unit type (as in m65dos_chkunit)
|
||||
// Output: Carry set means error
|
||||
; Set the unit number
|
||||
; Input: .A - unit number, .X - unit type (as in m65dos_chkunit)
|
||||
; Output: Carry set means error
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr_ind VDOS_SETUNIT
|
||||
jmp_8 !+
|
||||
jsr (VDOS_SETUNIT)
|
||||
bra m65dos_end_1
|
||||
|
||||
m65dos_acptr:
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr_ind VDOS_ACPTR
|
||||
!:
|
||||
jmp map_NORMAL_from_DOS_1 // ACPTR is slightly faster
|
||||
jsr (VDOS_ACPTR)
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
m65dos_end_1:
|
||||
|
||||
jmp map_NORMAL_from_DOS_1 ; ACPTR is slightly faster
|
||||
|
||||
m65dos_ciout:
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr_ind VDOS_CIOUT
|
||||
!:
|
||||
jmp map_NORMAL_from_DOS_1 // CIOUT is slightly faster
|
||||
jsr (VDOS_CIOUT)
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
m65dos_end_2:
|
||||
|
||||
jmp map_NORMAL_from_DOS_1 ; CIOUT is slightly faster
|
||||
|
||||
m65dos_listen:
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr_ind VDOS_LISTEN
|
||||
jmp_8 !-
|
||||
jsr (VDOS_LISTEN)
|
||||
bra m65dos_end_2
|
||||
|
||||
m65dos_second:
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr_ind VDOS_SECOND
|
||||
jmp_8 !-
|
||||
jsr (VDOS_SECOND)
|
||||
bra m65dos_end_2
|
||||
|
||||
m65dos_talk:
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr_ind VDOS_TALK
|
||||
jmp_8 !-
|
||||
jsr (VDOS_TALK)
|
||||
bra m65dos_end_2
|
||||
|
||||
m65dos_tksa:
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr_ind VDOS_TKSA
|
||||
jmp_8 !-
|
||||
jsr (VDOS_TKSA)
|
||||
bra m65dos_end_2
|
||||
|
||||
m65dos_untlk:
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr_ind VDOS_UNTLK
|
||||
jmp_8 !-
|
||||
jsr (VDOS_UNTLK)
|
||||
bra m65dos_end_2
|
||||
|
||||
m65dos_unlsn:
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr_ind VDOS_UNLSN
|
||||
jmp_8 !-
|
||||
jsr (VDOS_UNLSN)
|
||||
bra m65dos_end_2
|
||||
@@ -1,9 +1,9 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// MEGA65 pseudo-IEC internal DOS support - check if the current device is already handled by internal DOS
|
||||
//
|
||||
;
|
||||
; MEGA65 pseudo-IEC internal DOS support - check if the current device is already handled by internal DOS
|
||||
;
|
||||
|
||||
|
||||
m65dos_check:
|
||||
@@ -11,12 +11,12 @@ m65dos_check:
|
||||
pha
|
||||
lda IECPROTO
|
||||
cmp #IEC_ROMDOS
|
||||
beq !+
|
||||
beq @1
|
||||
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
!:
|
||||
@1:
|
||||
pla
|
||||
clc
|
||||
rts
|
||||
@@ -1,22 +1,22 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// MEGA65 pseudo-IEC internal DOS support - detect if a drive should be handled by internal DOS
|
||||
//
|
||||
;
|
||||
; MEGA65 pseudo-IEC internal DOS support - detect if a drive should be handled by internal DOS
|
||||
;
|
||||
|
||||
|
||||
m65dos_detect:
|
||||
|
||||
// Checks if drive is supported by internal DOS
|
||||
// Output: Carry set if not supported, if supported IECPROTO isset to IEC_ROMDOS
|
||||
; Checks if drive is supported by internal DOS
|
||||
; Output: Carry set if not supported, if supported IECPROTO isset to IEC_ROMDOS
|
||||
|
||||
pha
|
||||
jsr m65dos_chkunit
|
||||
bcs !+
|
||||
bcs @1
|
||||
|
||||
lda #IEC_ROMDOS
|
||||
sta IECPROTO
|
||||
!:
|
||||
@1:
|
||||
pla
|
||||
rts
|
||||
@@ -1,22 +1,22 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// c64 prg p263
|
||||
; c64 prg p263
|
||||
|
||||
cartridge_check:
|
||||
|
||||
ldx #$05
|
||||
!:
|
||||
@1:
|
||||
lda CART_SIG-1,x
|
||||
cmp cartridge_signature-1,x
|
||||
bne cartridge_check_end
|
||||
dex
|
||||
bne !-
|
||||
bne @1
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
cartridge_check_end:
|
||||
|
||||
|
||||
@@ -1,76 +1,75 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// This is a part CINT which initializes screen and keyboard
|
||||
//
|
||||
// For more details see:
|
||||
// - [RG64] C64 Programmers Reference Guide - page 280
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 242
|
||||
//
|
||||
;
|
||||
; This is a part CINT which initializes screen and keyboard
|
||||
;
|
||||
; For more details see:
|
||||
; - [RG64] C64 Programmers Reference Guide - page 280
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 242
|
||||
;
|
||||
|
||||
|
||||
cint_screen_keyboard:
|
||||
|
||||
// Setup KEYLOG vector
|
||||
; Setup KEYLOG vector
|
||||
|
||||
lda #<scnkey_set_keytab
|
||||
sta KEYLOG+0
|
||||
lda #>scnkey_set_keytab
|
||||
sta KEYLOG+1
|
||||
|
||||
// Initialise cursor blink flags (Computes Mapping the 64 p215)
|
||||
; Initialise cursor blink flags (Computes Mapping the 64 p215)
|
||||
|
||||
lda #$01
|
||||
sta BLNCT
|
||||
sta BLNSW
|
||||
|
||||
// Enable cursor repeat - XXX make it configurable
|
||||
; Enable cursor repeat - XXX make it configurable
|
||||
|
||||
#if CONFIG_KEY_REPEAT_DEFAULT && !CONFIG_KEY_REPEAT_ALWAYS
|
||||
!ifdef CONFIG_KEY_REPEAT_DEFAULT { !ifndef CONFIG_KEY_REPEAT_ALWAYS {
|
||||
|
||||
lda #$80
|
||||
sta RPTFLG
|
||||
} }
|
||||
|
||||
#endif
|
||||
; Set keyboard decode vector (Computes Mapping the 64 p215)
|
||||
|
||||
// Set keyboard decode vector (Computes Mapping the 64 p215)
|
||||
!ifdef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
#if CONFIG_LEGACY_SCNKEY
|
||||
|
||||
// Set initial variables for our improved keyboard scan routine
|
||||
; Set initial variables for our improved keyboard scan routine
|
||||
lda #$FF
|
||||
ldx #6
|
||||
!: sta BufferOld,x
|
||||
@1:
|
||||
sta BufferOld,x
|
||||
dex
|
||||
bpl !-
|
||||
bpl @1
|
||||
sta BufferQuantity
|
||||
|
||||
// Set key repeat delay (Computes 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 (Computes Mapping the 64 p58)
|
||||
; Set key repeat delay (Computes 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 (Computes Mapping the 64 p58)
|
||||
|
||||
// Not needed for default keyboard scanning code
|
||||
; Not needed for default keyboard scanning code
|
||||
|
||||
ldx #22-2 // Fudge factor to match speed
|
||||
ldx #22-2 ; Fudge factor to match speed
|
||||
stx DELAY
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
// Set current colour for text (Computes Mapping the 64 p215)
|
||||
; Set current colour for text (Computes Mapping the 64 p215)
|
||||
ldx #CONFIG_COLOR_TXT
|
||||
stx COLOR
|
||||
|
||||
// Set maximum keyboard buffer size (Computes Mapping the 64 p215)
|
||||
; Set maximum keyboard buffer size (Computes Mapping the 64 p215)
|
||||
ldx #10
|
||||
stx XMAX
|
||||
|
||||
// Put non-zero value in MODE to enable case switch
|
||||
; Put non-zero value in MODE to enable case switch
|
||||
ldx #$00
|
||||
stx MODE
|
||||
|
||||
// Fallthrough/jump to screen clear routine (Computes Mapping the 64 p215)
|
||||
; Fallthrough/jump to screen clear routine (Computes Mapping the 64 p215)
|
||||
|
||||
jmp clear_screen
|
||||
@@ -1,40 +1,39 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Part of the official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - page 280
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 242
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): none
|
||||
//
|
||||
;
|
||||
; Part of the official Kernal routine, described in:
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - page 280
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 242
|
||||
;
|
||||
; CPU registers that has to be preserved (see [RG64]): none
|
||||
;
|
||||
|
||||
|
||||
cint_legacy: // $E518
|
||||
cint_legacy: ; $E518
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
|
||||
jsr M65_MODEGET
|
||||
bcs !+
|
||||
bcs @1
|
||||
|
||||
jsr M65_MODESET
|
||||
bra cint_legacy_end
|
||||
!:
|
||||
#endif
|
||||
|
||||
// Setup video and I/O
|
||||
// See here: https://csdb.dk/forums/index.php?roomid=11&topicid=17048&firstpost=22
|
||||
@1:
|
||||
}
|
||||
; Setup video and I/O
|
||||
; See here: https://csdb.dk/forums/index.php?roomid=11&topicid=17048&firstpost=22
|
||||
|
||||
jsr vicii_init
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
cint_legacy_end:
|
||||
|
||||
// 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.
|
||||
; 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
|
||||
jmp cint_screen_keyboard ; XXX try to fit the code here
|
||||
@@ -1,71 +1,74 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# M65 KERNAL_1 #TAKE-FLOAT
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# M65 KERNAL_1 #TAKE-FLOAT
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Well-known Kernal routine, described in:
|
||||
//
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 215
|
||||
//
|
||||
;
|
||||
; Well-known Kernal routine, described in:
|
||||
;
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 215
|
||||
;
|
||||
|
||||
|
||||
vicii_init:
|
||||
|
||||
#if (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
|
||||
!ifdef SEGMENT_M65_KERNAL_0 {
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr_ind VK1__vicii_init
|
||||
jmp map_NORMAL
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__vicii_init)
|
||||
jmp map_NORMAL
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
// Clear everything - turn off sprites (observed hanging around after
|
||||
// running programs and resetting), etc.
|
||||
; Clear everything - turn off sprites (observed hanging around after
|
||||
; running programs and resetting), etc.
|
||||
|
||||
lda #$00
|
||||
ldx #$2E
|
||||
!:
|
||||
@1:
|
||||
sta __VIC_BASE, x
|
||||
dex
|
||||
bpl !-
|
||||
bpl @1
|
||||
|
||||
#if !CONFIG_MB_MEGA_65 && !CONFIG_MB_ULTIMATE_64
|
||||
!ifndef CONFIG_MB_M65 { !ifndef CONFIG_MB_U64 {
|
||||
|
||||
// Disable C128 extra keys - just to be sure they will not interfere with anything
|
||||
; Disable C128 extra keys - just to be sure they will not interfere with anything
|
||||
|
||||
stx VIC_XSCAN
|
||||
|
||||
// Disable the C128 2MHz mode, it prevents VIC-II display from working correctly
|
||||
; Disable the C128 2MHz mode, it prevents VIC-II display from working correctly
|
||||
|
||||
stx VIC_CLKRATE
|
||||
} }
|
||||
|
||||
#endif
|
||||
; Set up default IO values
|
||||
; - [CM64] page 129 - VIC_SCROLY
|
||||
; - [CM64] pages 140-144 - VIC_SCROLX
|
||||
; - [CM64] pages 145-146 - VIC_YMCSB
|
||||
|
||||
// Set up default IO values
|
||||
// - [CM64] page 129 - VIC_SCROLY
|
||||
// - [CM64] pages 140-144 - VIC_SCROLX
|
||||
// - [CM64] pages 145-146 - VIC_YMCSB
|
||||
|
||||
lda #$1B // according to [CM64] page 137 some software assumes oldest bit is 0
|
||||
lda #$1B ; according to [CM64] page 137 some software assumes oldest bit is 0
|
||||
sta VIC_SCROLY
|
||||
lda #$C8
|
||||
sta VIC_SCROLX // 40 column, etc.
|
||||
sta VIC_SCROLX ; 40 column, etc.
|
||||
lda #$14
|
||||
sta VIC_YMCSB
|
||||
lda #$0F
|
||||
sta VIC_IRQ // clear all interrupts
|
||||
sta VIC_IRQ ; clear all interrupts
|
||||
|
||||
// We use a different colour scheme of white text on all blue by default,
|
||||
// but brand-specific color scheme can also be enabled
|
||||
; We use a different colour scheme of white text on all blue by default,
|
||||
; but brand-specific color scheme can also be enabled
|
||||
|
||||
lda #CONFIG_COLOR_BG
|
||||
sta VIC_EXTCOL
|
||||
sta VIC_BGCOL0
|
||||
|
||||
// Setup default I/O devices
|
||||
; Setup default I/O devices
|
||||
|
||||
!ifdef CONFIG_IEC {
|
||||
jmp clrchn_reset
|
||||
} else {
|
||||
jmp CLRCHN
|
||||
}
|
||||
|
||||
#endif // ROM layout
|
||||
} ; ROM layout
|
||||
@@ -1,78 +1,72 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
// Resources describing the C64 reset sequence:
|
||||
// https://www.c64-wiki.com/wiki/Reset_(Process)
|
||||
; Resources describing the C64 reset sequence:
|
||||
; https://www.c64-wiki.com/wiki/Reset_(Process)
|
||||
|
||||
|
||||
hw_entry_reset:
|
||||
|
||||
// The GPL program at https://github.com/Klaus2m5/6502_65C02_functional_tests/blob/master/6502_functional_test.a65
|
||||
// uses the similar initial reset sequence, affirmed by c64 PRG p269
|
||||
; The GPL program at https://github.com/Klaus2m5/6502_65C02_functional_tests/blob/master/6502_functional_test.a65
|
||||
; uses the similar initial reset sequence, affirmed by c64 PRG p269
|
||||
|
||||
sei // disable the interrupts, as fast as possible - they are disabled in case of HW reset,
|
||||
// but this routine can be also called manually
|
||||
sei ; disable the interrupts, as fast as possible - they are disabled in case of HW reset,
|
||||
; but this routine can be also called manually
|
||||
|
||||
cld // required for all CPUs - due to possibility of manual call
|
||||
cld ; required for all CPUs - due to possibility of manual call
|
||||
|
||||
#if HAS_OPCODES_65CE02
|
||||
!ifdef HAS_OPCODES_65CE02 {
|
||||
|
||||
see // disable extended stack
|
||||
|
||||
#endif
|
||||
see ; disable extended stack
|
||||
}
|
||||
|
||||
ldx #$FF
|
||||
txs
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
|
||||
jsr m65_reset_part
|
||||
}
|
||||
|
||||
#endif
|
||||
!ifdef CONFIG_PLATFORM_COMMODORE_64 {
|
||||
|
||||
#if CONFIG_PLATFORM_COMMODORE_64
|
||||
; The following routine is based on reading the public KERNAL jumptable routine
|
||||
; list, and making unimaginative assumptions about what should be done on reset.
|
||||
; Also, https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image was used
|
||||
; as it shows example startup sequence, to be followe by cartridge creators
|
||||
|
||||
// The following routine is based on reading the public KERNAL jumptable routine
|
||||
// list, and making unimaginative assumptions about what should be done on reset.
|
||||
// Also, https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image was used
|
||||
// as it shows example startup sequence, to be followe by cartridge creators
|
||||
|
||||
// C64 PRG p269
|
||||
; C64 PRG p269
|
||||
jsr cartridge_check
|
||||
bne !+
|
||||
bne @1
|
||||
jmp (ICART_COLD_START)
|
||||
!:
|
||||
@1:
|
||||
|
||||
// Disable the screen (and set 40 columns) to prevent visual glitches later
|
||||
; Disable the screen (and set 40 columns) to prevent visual glitches later
|
||||
ldx #$28
|
||||
stx VIC_SCROLX
|
||||
|
||||
#endif
|
||||
|
||||
// Initialising IO is obviously required. Also indicated by c64 prg p269.
|
||||
}
|
||||
; Initialising IO is obviously required. Also indicated by c64 prg p269.
|
||||
jsr JIOINIT
|
||||
|
||||
// Setting up the screen and testing ram is obviously required
|
||||
// also affirmed by p269 of c64 prg
|
||||
jsr JRAMTAS // called RANTAM on Codebase64 wiki
|
||||
; Setting up the screen and testing ram is obviously required
|
||||
; also affirmed by p269 of c64 prg
|
||||
jsr JRAMTAS ; called RANTAM on Codebase64 wiki
|
||||
|
||||
// Resetting IO vectors is obviously required, if we want interrupts to run
|
||||
// also affirmed by c64 prg p269
|
||||
; Resetting IO vectors is obviously required, if we want interrupts to run
|
||||
; also affirmed by c64 prg p269
|
||||
jsr JRESTOR
|
||||
|
||||
// "Compute's Mapping the 64" p236
|
||||
; "Compute's Mapping the 64" p236
|
||||
jsr JCINT
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
|
||||
clc
|
||||
jsr M65_MODESET // on MEGA65 go to native mode by default
|
||||
jsr M65_MODESET ; on MEGA65 go to native mode by default
|
||||
}
|
||||
; What do we do when finished? A C64 jumps into the BASIC ROM
|
||||
cli ; allow interrupts to happen
|
||||
|
||||
#endif
|
||||
|
||||
// What do we do when finished? A C64 jumps into the BASIC ROM
|
||||
cli // allow interrupts to happen
|
||||
|
||||
// c64 prg p269
|
||||
; c64 prg p269
|
||||
jmp (IBASIC_COLD_START)
|
||||
@@ -1,71 +1,71 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# M65 KERNAL_1 #TAKE-FLOAT
|
||||
// #LAYOUT# X16 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# M65 KERNAL_1 #TAKE-FLOAT
|
||||
;; #LAYOUT# X16 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - page 291
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 237
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): none
|
||||
//
|
||||
;
|
||||
; Official Kernal routine, described in:
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - page 291
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 237
|
||||
;
|
||||
; CPU registers that has to be preserved (see [RG64]): none
|
||||
;
|
||||
|
||||
RAMTAS:
|
||||
|
||||
#if (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
|
||||
!ifdef SEGMENT_M65_KERNAL_0 {
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr_ind VK1__RAMTAS
|
||||
jmp map_NORMAL
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__RAMTAS)
|
||||
jmp map_NORMAL
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
// C64 Programmers Reference guide p291:
|
||||
// Clear $0000-$0101, $0200-$03ff
|
||||
// PGS: $0000, $0001 are CPU IO ports, so should not get written to
|
||||
; C64 Programmers Reference guide p291:
|
||||
; Clear $0000-$0101, $0200-$03ff
|
||||
; PGS: $0000, $0001 are CPU IO ports, so should not get written to
|
||||
|
||||
// How many ways are there to efficiently erase these two pages
|
||||
// of RAM? We would like to avoid any unnecessary byte similarity
|
||||
// with the C64 KERNAL. Thus we do $0300 before $0200, even though
|
||||
// with the longer sequence of identicale bytes we see no basis for
|
||||
// it being copyrightable. Again, we just want to redue the attack
|
||||
// surface for any misguided suit.
|
||||
; How many ways are there to efficiently erase these two pages
|
||||
; of RAM? We would like to avoid any unnecessary byte similarity
|
||||
; with the C64 KERNAL. Thus we do $0300 before $0200, even though
|
||||
; with the longer sequence of identicale bytes we see no basis for
|
||||
; it being copyrightable. Again, we just want to redue the attack
|
||||
; surface for any misguided suit.
|
||||
|
||||
ldy #$00
|
||||
lda #$00
|
||||
!:
|
||||
@1:
|
||||
sta $0300,Y
|
||||
sta $0200,Y
|
||||
sta $0002,Y // that is why we do not use .X for index, we do not want zeropage addressing here!
|
||||
sta $0002,Y ; that is why we do not use .X for index, we do not want zeropage addressing here!
|
||||
iny
|
||||
bne !-
|
||||
bne @1
|
||||
|
||||
// Allocate cassette buffer
|
||||
; Allocate cassette buffer
|
||||
ldx #<$033C
|
||||
stx TAPE1+0
|
||||
ldx #>$033C
|
||||
stx TAPE1+1
|
||||
|
||||
#if CONFIG_PLATFORM_COMMODORE_64
|
||||
!ifdef CONFIG_PLATFORM_COMMODORE_64 {
|
||||
|
||||
// Set screen address pointer ("Compute's Mapping the 64" p238)
|
||||
// This is obvious boiler plate containing no creative input, but to avoid
|
||||
// unnecessarily similarity to the C64 KERNAL, we use X instead of A to do this,
|
||||
// and several following
|
||||
; Set screen address pointer ("Compute's Mapping the 64" p238)
|
||||
; This is obvious boiler plate containing no creative input, but to avoid
|
||||
; unnecessarily similarity to the C64 KERNAL, we use X instead of A to do this,
|
||||
; and several following
|
||||
ldx #>$0400
|
||||
stx HIBASE
|
||||
|
||||
// Set BASIC start text pointer
|
||||
// (remember, that low memory is 0 initialized at this moment)
|
||||
; Set BASIC start text pointer
|
||||
; (remember, that low memory is 0 initialized at this moment)
|
||||
|
||||
ldx #>$0800
|
||||
stx MEMSTR+1
|
||||
|
||||
// Work out RAM size and put in MEMSIZK
|
||||
// Try to modify $8000, if it fails then RAM ends at $7FFF, else $9FFF
|
||||
; Work out RAM size and put in MEMSIZK
|
||||
; Try to modify $8000, if it fails then RAM ends at $7FFF, else $9FFF
|
||||
|
||||
ldx $8000
|
||||
inx
|
||||
@@ -73,17 +73,21 @@ RAMTAS:
|
||||
cpx $8000
|
||||
bne ramtas_32k
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
ramtas_40k:
|
||||
|
||||
// 40K RAM - restore memory content, set MEMSIZK
|
||||
; 40K RAM - restore memory content, set MEMSIZK
|
||||
|
||||
ldy #$A0
|
||||
!:
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
ramtas_xxk:
|
||||
|
||||
sty MEMSIZK+1
|
||||
|
||||
// Always restore memory, cartridge might have RAM under ROM
|
||||
; Always restore memory, cartridge might have RAM under ROM
|
||||
|
||||
dex
|
||||
stx $8000
|
||||
@@ -92,12 +96,12 @@ ramtas_40k:
|
||||
|
||||
ramtas_32k:
|
||||
|
||||
// 32K RAM - restore memory content, set MEMSIZK
|
||||
; 32K RAM - restore memory content, set MEMSIZK
|
||||
|
||||
ldy #$80
|
||||
bne !- // branch always
|
||||
bne ramtas_xxk ; branch always
|
||||
|
||||
#elif CONFIG_PLATFORM_COMMANDER_X16
|
||||
} else ifdef CONFIG_PLATFORM_COMMANDER_X16 {
|
||||
|
||||
ldx #>$0800
|
||||
stx MEMSTR+1
|
||||
@@ -105,11 +109,11 @@ ramtas_32k:
|
||||
ldy #$9F
|
||||
sty MEMSIZK+1
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
.error "Please fill-in RAMTAS"
|
||||
!error "Please fill-in RAMTAS"
|
||||
|
||||
#endif // platform
|
||||
} ; platform
|
||||
|
||||
|
||||
#endif // ROM layout
|
||||
} ; ROM layout
|
||||
Loaded 100 of 685 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user