From 1706cc7c31fc918b3ca4b7d368b39bd84d0ec2bd Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 5 Oct 2019 23:55:35 +0200 Subject: [PATCH 01/85] fancy startup logo is now available for all the targets --- CONFIG.md | 6 ++++++ c64/,,config_generic.s | 1 + c64/,,config_mega65.s | 1 + c64/,,config_ultimate64.s | 1 + c64/basic/,target_generic/,hooks_generic.s | 20 +++++++++++++++++-- c64/basic/,target_mega65/,hooks_mega65.s | 15 ++++++++++++-- .../,target_ultimate64/,hooks_ultimate64.s | 16 ++++++++++++++- 7 files changed, 55 insertions(+), 5 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index 8e85748f..9bf8544b 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -82,6 +82,12 @@ Each of them needs a couple of bytes in KERNAL segment - but they can share some ## Miscelaneous features +### `CONFIG_FANCY_BANNER` + +If enabled, prints more colorful startup banner. Eye candy only. + +Needs some space in BASIC segment, varies between targets. + ### `CONFIG_DOS_WEDGE` If enabled, a simple DOS wedge is available from the direct mode - supports `@`, `@`, `@$`, `@$` and `@` commands. diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 3843ec00..7b4de20f 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -20,6 +20,7 @@ // #define CONFIG_SID_D4XX // #define CONFIG_SID_D5XX +#define CONFIG_FANCY_BANNER #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS #define CONFIG_EXTENDED_SCNKEY // for now has to be enabled diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index e856a52c..8a693b68 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -20,6 +20,7 @@ // #define CONFIG_SID_D4XX // #define CONFIG_SID_D5XX +#define CONFIG_FANCY_BANNER #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS #define CONFIG_EXTENDED_SCNKEY // for now has to be enabled diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index f7ce1b93..a29773e3 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -20,6 +20,7 @@ #define CONFIG_SID_D4XX #define CONFIG_SID_D5XX +#define CONFIG_FANCY_BANNER #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS #define CONFIG_EXTENDED_SCNKEY // for now has to be enabled diff --git a/c64/basic/,target_generic/,hooks_generic.s b/c64/basic/,target_generic/,hooks_generic.s index c87cffd9..3224bfb8 100644 --- a/c64/basic/,target_generic/,hooks_generic.s +++ b/c64/basic/,target_generic/,hooks_generic.s @@ -4,7 +4,23 @@ .macro TARGET_HOOK_BANNER() { - .text " OPEN ROMS, " - .byte $00 +#if CONFIG_FANCY_BANNER + .byte $1C, $12, $A3, $A3, $A3, $A3, $A3, $A3, $A3, $92, $0D + .byte $9E, $12, $A3, $A3, $A3, $A3, $A3, $A3, $92, $05, $20 + .text " OPEN ROMS GENERIC BUILD" + .byte $0D + .byte $1E, $12, $A3, $A3, $A3, $A3, $A3, $92, $0D + .byte $9F, $12, $A3, $A3, $A3, $A3, $92, $20, $05, $20, $20 + .text " " + +#else + + .text " OPEN ROMS GENERIC BUILD" + .byte $0D, $0D + .text " " + +#endif + + .byte $00 // end of banner } diff --git a/c64/basic/,target_mega65/,hooks_mega65.s b/c64/basic/,target_mega65/,hooks_mega65.s index 07b2b58e..0ffad48e 100644 --- a/c64/basic/,target_mega65/,hooks_mega65.s +++ b/c64/basic/,target_mega65/,hooks_mega65.s @@ -4,6 +4,8 @@ .macro TARGET_HOOK_BANNER() { +#if CONFIG_FANCY_BANNER + // New banner from Retrofan .byte $9a, $12, $20, $20, $7f, $a9, $20, $20, $1f, $20, $9a, $20, $20, $20 .byte $20, $1f, $20, $9a, $a9, $20, $20, $20, $92, $a1, $1f, $12, $20, $9a, $a9, $20 @@ -19,7 +21,7 @@ .byte $12, $20, $20, $1f, $20, $20, $9a, $20, $20, $1f, $20, $9a, $20, $20, $20, $20 .byte $1f, $20, $9a, $20, $20, $20, $20, $20, $1f, $20, $9a, $20, $20, $1f, $20, $9a .byte $20, $20, $1f, $20, $20, $96, $a3, $a3, $a3, $a3, $1f - .byte $92, $0D, $0D, $05, $00 + .byte $92, $0D, $0D, $05 // Original Deft-supplied banner // .byte $9A,$12,$A3,$A3,$A3,$A3,$A3,$A3,$DF,$9B,$92,$20,$05,$12,$A0,$A0 @@ -36,6 +38,15 @@ // .byte $A3,$A3,$A3,$A3,$DF,$9A,$92,$7F,$12,$DF,$92,$7F,$9B,$20,$9A,$7F // .byte $12,$A0,$A0,$9B,$92,$20,$9A,$7F,$12,$A0,$A0,$9B,$92,$20,$9A,$7F // .byte $12,$DF,$92,$7F,$9B,$20,$9A,$20,$9B,"0.2.0.0",$0D - // .byte $0D,$05,$92,$00 + // .byte $0D,$05,$92 +#else + + .text " OPEN ROMS FOR MEGA65" + .byte $0D, $0D + .text " " + +#endif + + .byte $00 // end of banner } diff --git a/c64/basic/,target_ultimate64/,hooks_ultimate64.s b/c64/basic/,target_ultimate64/,hooks_ultimate64.s index 985ea57d..5d6ea6c6 100644 --- a/c64/basic/,target_ultimate64/,hooks_ultimate64.s +++ b/c64/basic/,target_ultimate64/,hooks_ultimate64.s @@ -4,9 +4,23 @@ .macro TARGET_HOOK_BANNER() { +#if CONFIG_FANCY_BANNER + + .byte $1C, $12, $A3, $A3, $A3, $A3, $A3, $A3, $A3, $92, $0D + .byte $9E, $12, $A3, $A3, $A3, $A3, $A3, $A3, $92, $05, $20 + .text " OPEN ROMS FOR ULTIMATE 64" + .byte $0D + .byte $1E, $12, $A3, $A3, $A3, $A3, $A3, $92, $0D + .byte $9F, $12, $A3, $A3, $A3, $A3, $92, $20, $05, $20, $20 + .text " " + +#else + .text " OPEN ROMS FOR ULTIMATE 64" .byte $0D, $0D .text " " - .byte $00 +#endif + + .byte $00 // end of banner } From 77320e2e9157e8879d9b23aa3b407f03d5e13974 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 6 Oct 2019 12:21:24 +0200 Subject: [PATCH 02/85] fix for RETURN not clearin inverse mode --- bin/basic_generic.rom | Bin 8192 -> 8192 bytes bin/basic_mega65.rom | Bin 8192 -> 8192 bytes bin/basic_ultimate64.rom | Bin 8192 -> 8192 bytes bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/basic/cmd_list.s | 3 --- c64/kernal/chrout_real.s | 3 ++- 8 files changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index 7d407af190d226713705a083c74c425b65913ef0..ca209d637ad2bd8f15e95617cd644e7f6329f9c5 100644 GIT binary patch delta 2126 zcmcgtYiv_x7(Sv-xaQ2bNT8^SKn~{2ZN1UY9bmf7L!sw7%Jt1tf!X+HN#0drD@4- z9N#-?I+k3XbgW+jS|U_k+bY?cB6m2wqb2L7UZaKVceJ#zhIJVRTQLVbE#KAZH6=vm zyUY`ot6UOdN+{-FWd+@zO87T)u`a%%Phu+~2*F#DeT{j-zRGm$t6FXQQWRjDw!Jpr zbtQh%iBRFaQB>4BDkR%ym|lB6ZccmcdbD%i$%lAUhl)TW>$&*T8+j=a%6C=Knt=QJ z8WBrZb4|D%vE1mm0QaS&230*N;BNi zCV9*!7bKUt#H!;{S2%2n{>jaAW9?>V%x!k(6kPHtYcbx+Hp$FQ9?Ec!>5D1!L!Gqi zu~R>9lC6*MG}9ara)u<=&&~4BKAFD5Q5)(yyt7$0U$tCp3a#*OY?9G3JVXQBOywTd zkWzJbMdhmbjit~XdO?!Ex-4zY9xm-^u#V|!8RIg)T(~Ta;Zntj(N*YjJvmUFBO7xJ zl_Getrc5{K35xtdeO1Nr`Ob@s7H4Zr#dr2mG3*=@ZkQoNL&lCDn0rW=K-D z`;I4T#=o2yQY4%jH0o1~PoqtWp+}n)vg8o`uAq@`r}_HY4YhY+cs|v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?X$O`sOh=~PdiPX|WFtsER1TEFX_F~X$1ii|5^Hkm{GdC9OnWM_FEHnI? z!IX1t7N0w;k~TKeHgXtd3N^?ig-BhmJx-dn4Y(^t{O*9$Rsh(EW4|x#0wuO!hjkw2 zwH~l`_G6s5sGF8hkxI0bmQk60k-CtYN9WT8)I;BizfHWfoX({xXeF(p)pQ|!fcj`{ z@5Si{X=Hj4T};14FHC=%E}=^)rVr6&bU9r?AEuAcm9&P|(p7XdT|?_=J^c<{OTSCk z(eKemX#;JfkI^Q&o;K6R=?3bj0r~{pNH@{V^hx>@-9op1LqEqGwT8~1j(QS94YmY( zu#;x28=-{S8H9vrJOM4C1SD$M?a_zWd+!bSMDP3t(gQ4uUy~V<9wM`tlZj_002R*_ z1ZyfNKg|*u()hC!!kz6CnWb`AxO(5cTmvcPlWN`m6n?K-H01(GM~OslP^r6vvrmk$HCz*L0=q6vrv6`zO3tbu^4P z%biKPtXohjUCT07+HKub5#kWy5pp3UA+7`oJSuT zHod4d78I8bHPm|GI|DZ{)L`DR_=yZNlL0dqbB)UR{vO}{2CacKLfkVA5JL8I<{f(* z9KhRZZF@85+oo;r9BOzLob7y+1oyXcW09e81-Kb8b`9EN*e)N!>qZ=X|_aY8&+N& zjaS90Emv$!d^L>t=ez`5Sxv;9m{5M3ZLd3Ck57!^<1wJl;IG57b1LJ{8F8AiZUc*v z0mjB3lyubXuVHkh&UF{=ij8QEf3tXIHrMU$tb(VRIndK9cxR0djT3~*7_&dH&A>;SHWZE zO*)_41D7-7`Q%P^L$i(j*$TuIdk4S@SoSi@a@rNSI*fR0#&#JSwMg0>S;(%O_$X@k pNBQuBw~NeW(Ai=pBq6ag&d$6(bZ;s)e~=v9ad8Le*<74nUDYg diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom index 2ccae4bd8a2715d347905055d5c4d8ad0ddec3b1..66d3282205cbf0c709d3e085c00ef6cbf3273a75 100644 GIT binary patch delta 2078 zcmX|CYfu~472XGE1u{iogXM?Jwc7^a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yeu4%dyxpaLEmBxC|=WYi7>R&6N6s>{N z8F24%Wz!^-*D1d!-vWRA{bB=LI{8h8)v_lg0Zp~T@u|M5x@(}f-^sAPv1JnMfgLYt zrzQbEr_|W>K9t{Z6+9pB@lAuJuC^Mw$Z$1Y+3j09tgZ)N+dMM*3RkjLhfvgT8$dueuABeO19+`2F2nn9>_J!XB6b+}*q2E82Pub`7T_q*|LH z!Rpdg%py{7^GJRgG05)Lw?ilL7ihL>Uj@CTND(@gbUwY?QU--Ew-FV3khxE<+idOfgSuYyt%eV@8QMMCtLn6k z(5bb&m=1w`u-^y1X#zVxpMg66bbdN`K1&C`hU<;m6=$#|v&YV&tqwE8cHBbX=8iL| zIeQ%j13w@;=Z&`^bnGmD4(-0j4-kXu{j8TqV}DCld5hia=-pXjw87V-r@i6m8Xgk^ zwiKtG_R=;r2_(c~{_)YAe!h4#7hOAp8nJCT(KDd$9YU@*Qb67S`o&RfP#HY`bE1z>fPY>;+MzR=z5@j|yx;ZP* zVw87;+W$^AaUm2qP3)qC`BPNFH0ywI^j$evVJtS$%cZ7U8U;y$m8q;e2)h zshpb^5OQu>K$*^G7LdlNUqHo9T?lavOVuRf{-s4p2j**>-L!@l7u7hzdb;VB7WVb| z7WTlrt2atVyOha`D5-zTQ`kh6r~WnC+K<|14x_n%!)-c+)=i*c&Xn>yHO9T5E?fM? ZD0^j;Ju=IloMPvu+3r!cjdQ9u{RhUrA`Ack diff --git a/c64/basic/cmd_list.s b/c64/basic/cmd_list.s index 2aef7ccb..b096210d 100644 --- a/c64/basic/cmd_list.s +++ b/c64/basic/cmd_list.s @@ -140,9 +140,6 @@ list_is_literal: bne list_print_loop list_end_of_line: - // Clear reverse flag - lda #$92 - jsr JCHROUT // Print end of line jmp print_return diff --git a/c64/kernal/chrout_real.s b/c64/kernal/chrout_real.s index 578383c0..f30d2e16 100644 --- a/c64/kernal/chrout_real.s +++ b/c64/kernal/chrout_real.s @@ -108,10 +108,11 @@ not_0a: // Carriage return cmp #$0d bne not_0d - // RETURN clears quote and insert modes + // RETURN clears quote and insert modes, it also clears reverse flag lda #$00 sta QTSW sta INSRT + sta RVS jmp screen_advance_to_next_line not_0d: From 1480350bfb133d3d4d84e2dd2d932907323a7392 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 6 Oct 2019 13:02:14 +0200 Subject: [PATCH 03/85] IEC code compatibility improvements --- c64/kernal/iec/iec_rx_byte.s | 12 ++++++------ c64/kernal/iec/iec_tx_byte.s | 6 ++++-- c64/kernal/lvs_helpers.s | 6 ++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/c64/kernal/iec/iec_rx_byte.s b/c64/kernal/iec/iec_rx_byte.s index bb9328ef..01f34846 100644 --- a/c64/kernal/iec/iec_rx_byte.s +++ b/c64/kernal/iec/iec_rx_byte.s @@ -13,7 +13,9 @@ iec_rx_byte: pha // Timing is critical here - execute on disabled IRQs - php + // 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 @@ -107,8 +109,7 @@ iec_rx_clk_wait2: // Timeout jsr kernalstatus_EOI pla - plp - + // Restore registers pla tay @@ -116,6 +117,7 @@ iec_rx_clk_wait2: tax sec // XXX confirm that sec is really a way to report timeout here + cli rts !: // More bits? @@ -130,9 +132,6 @@ iec_rx_clk_wait2: // Retreive the received byte pla - - // Return no-error - plp // Restore registers sta TBTCNT // $A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html @@ -143,5 +142,6 @@ iec_rx_clk_wait2: lda TBTCNT clc + cli rts diff --git a/c64/kernal/iec/iec_tx_byte.s b/c64/kernal/iec/iec_tx_byte.s index 69e71f52..7721cc0e 100644 --- a/c64/kernal/iec/iec_tx_byte.s +++ b/c64/kernal/iec/iec_tx_byte.s @@ -26,7 +26,9 @@ iec_tx_byte: iec_tx_common: // Timing is critical here - execute on disabled IRQs - php + // 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 // Wait till all receivers are ready, they should all release DATA @@ -79,7 +81,7 @@ iec_tx_common_bit_is_sent: dex bpl iec_tx_common_sendbit - plp + cli // Give device time to tell if they are busy by pulling DATA // They should do it within 1ms diff --git a/c64/kernal/lvs_helpers.s b/c64/kernal/lvs_helpers.s index 4548f58e..948de153 100644 --- a/c64/kernal/lvs_helpers.s +++ b/c64/kernal/lvs_helpers.s @@ -41,6 +41,7 @@ lvs_handle_byte_load_verify: // Thus we have to use a helper routine in low memory // to do the memory access +#if CONFIG_MEMORY_MODEL_60K // Save byte under ROMs and IO if required php sei @@ -52,6 +53,11 @@ lvs_handle_byte_load_verify: ldx #$37 stx $01 plp +#else + ldy #0 + sta (STAL),y +#endif + rts lvs_advance_pointer: From 43d7e869e0eaa3debd08d990a40bb11e87cda25d Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 6 Oct 2019 15:02:26 +0200 Subject: [PATCH 04/85] fixes in PLOT routine - fixes some Duotris glitches, FB64 now allows browsing --- c64/kernal/e50a.plot.s | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/c64/kernal/e50a.plot.s b/c64/kernal/e50a.plot.s index 58afa453..dbf08d43 100644 --- a/c64/kernal/e50a.plot.s +++ b/c64/kernal/e50a.plot.s @@ -17,15 +17,16 @@ PLOT: // - 'Duotris' game calls $E50C during startup screen initialization plot_set: - sty TBLX - stx PNTR + sty PNTR + stx TBLX - // XXX handle cursor blink - // XXX should we update some more variables? + jsr calculate_screen_line_pointer + + // XXX cursor blink might need to be handled too // FALLTROUGH to save one byte on RTS plot_get: - ldy TBLX - ldx PNTR + ldy PNTR + ldx TBLX rts From 0ac3d1dfd83882154ef7a6b3eb4d7c1023057230 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 6 Oct 2019 15:41:51 +0200 Subject: [PATCH 05/85] fixed MSGFLG handling, prevents FB64 display glitches --- c64/basic/basic_main_loop.s | 4 ++++ c64/basic/cmd_load.s | 9 --------- c64/basic/cmd_run.s | 9 +++++---- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/c64/basic/basic_main_loop.s b/c64/basic/basic_main_loop.s index 4318aa78..911e0f7f 100644 --- a/c64/basic/basic_main_loop.s +++ b/c64/basic/basic_main_loop.s @@ -7,6 +7,10 @@ basic_main_loop: // Tell user we are ready jsr ready_message + // Enable Kernal messages + lda #$80 + jsr JSETMSG + basic_read_next_line: // Read a line of input ldx #$00 diff --git a/c64/basic/cmd_load.s b/c64/basic/cmd_load.s index 2af77bd3..d54960a4 100644 --- a/c64/basic/cmd_load.s +++ b/c64/basic/cmd_load.s @@ -11,15 +11,6 @@ cmd_load: // middle of a program. For safety, we do. jsr basic_do_clr - // Setup Kernal to print control messages or not - lda #$80 // display control messages and omit error messages - ldx CURLIN+1 - cpx #$FF - beq !+ - lda #$00 // direct mode - don't display anything -!: - jsr JSETMSG - // Set filename and length lda #$00 sta FNLEN diff --git a/c64/basic/cmd_run.s b/c64/basic/cmd_run.s index fefd6e6d..6e718c81 100644 --- a/c64/basic/cmd_run.s +++ b/c64/basic/cmd_run.s @@ -2,11 +2,12 @@ cmd_run: // RUN clears all variables jsr basic_do_clr cmd_goto: + // Disable Kernal messages + lda #$00 + jsr JSETMSG + // Reset line pointer to first line of program. - lda TXTTAB+0 - sta OLDTXT+0 - lda TXTTAB+1 - sta OLDTXT+1 + jsr init_oldtxt jsr basic_end_of_statement_check bcs !+ From b625b4d58a26f0f816d43a63369c3e4df365a60f Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 6 Oct 2019 15:59:30 +0200 Subject: [PATCH 06/85] temporary implementation of LINPTR, FB64 now displays drive number --- STATUS.md | 2 +- c64/basic/bdcd.linprt.s | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/STATUS.md b/STATUS.md index 96d2da0c..92e8e0cd 100644 --- a/STATUS.md +++ b/STATUS.md @@ -79,7 +79,7 @@ Not all of them - only these we want to have implemented. | `$A68E` | RUNC | NOT DONE | | | `$A7AE` | NEWSTT | NOT DONE | | | `$AB1E` | STROUT | DONE | | -| `$BDCD` | LINPRT | NOT DONE | | +| `$BDCD` | LINPRT | DONE | temporary implementation | | `$E3BF` | INIT | NOT DONE | | | `$E422` | INITMSG | DONE | | | `$E453` | RVECT | NOT DONE | | diff --git a/c64/basic/bdcd.linprt.s b/c64/basic/bdcd.linprt.s index 32afbf1b..7e58bebe 100644 --- a/c64/basic/bdcd.linprt.s +++ b/c64/basic/bdcd.linprt.s @@ -7,4 +7,6 @@ LINPRT: - STUB_IMPLEMENTATION() + // XXX This is temporary, to allow some software to work! + // To be replaced by real impleementation. + jmp print_integer From 47fdf8c08ccfff05a1730b8d002909fee601730f Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 6 Oct 2019 16:53:08 +0200 Subject: [PATCH 07/85] added more stubs to BASIC --- Makefile | 2 +- STATUS.md | 2 ++ c64/basic/a533.interop | 7 +++++++ c64/basic/a533.linkprg.s | 6 ++++++ c64/basic/a659.interop | 6 ++++++ c64/basic/a659.setcharptr.s | 7 +++++++ c64/basic/a7ae.interop | 10 ++++++++-- c64/basic/a7ae.newstt.s | 5 ++++- c64/kernal/f4a5.load.s | 2 +- 9 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 c64/basic/a533.interop create mode 100644 c64/basic/a533.linkprg.s create mode 100644 c64/basic/a659.interop create mode 100644 c64/basic/a659.setcharptr.s diff --git a/Makefile b/Makefile index 4495652a..8445120a 100644 --- a/Makefile +++ b/Makefile @@ -192,7 +192,7 @@ build/newc65.rom: build/kernal_mega65.rom build/basic_mega65.rom build/chargen.r # Rules - tests -.PHONY: test test_generic test_mega65 test_ultimate64 test_m65 testremote testsimilarity +.PHONY: test test_generic test_mega65 test_ultimate64 test_hybrid test_m65 testremote testsimilarity test: test_generic diff --git a/STATUS.md b/STATUS.md index 92e8e0cd..dd27dfb2 100644 --- a/STATUS.md +++ b/STATUS.md @@ -76,6 +76,8 @@ Not all of them - only these we want to have implemented. | Address | Name | Status | Remarks | | :-------: | :----------- | :------: | :------------------------------------------------: | | `$A004` | revision str | DONE | | +| `$A533` | LINKPRG | NOT DONE | | +| `$A659` | set txt ptr | NOT DONE | | | `$A68E` | RUNC | NOT DONE | | | `$A7AE` | NEWSTT | NOT DONE | | | `$AB1E` | STROUT | DONE | | diff --git a/c64/basic/a533.interop b/c64/basic/a533.interop new file mode 100644 index 00000000..46ed7adf --- /dev/null +++ b/c64/basic/a533.interop @@ -0,0 +1,7 @@ +This routine is used to launch other software. It is used by: + +- Uncrunch (see https://github.com/mist64/pucrunch/blob/master/uncrunch.asm) +- FileBrowser64 (FB64) - found by debugging + +and probably others. + diff --git a/c64/basic/a533.linkprg.s b/c64/basic/a533.linkprg.s new file mode 100644 index 00000000..b7b11e80 --- /dev/null +++ b/c64/basic/a533.linkprg.s @@ -0,0 +1,6 @@ + +// XXX provide documentation and implementation +// see: https://www.lemon64.com/forum/viewtopic.php?t=64721&sid=bc400a5a6d404f8f092e4d32a92f5de7 + +LINKPRG: + STUB_IMPLEMENTATION() diff --git a/c64/basic/a659.interop b/c64/basic/a659.interop new file mode 100644 index 00000000..925b8462 --- /dev/null +++ b/c64/basic/a659.interop @@ -0,0 +1,6 @@ +This routine is used to launch other software. It is used by: + +- Exomizer (see https://github.com/bitshifters/exomizer/blob/master/exomizer/exomizer115.txt) +- FileBrowser64 (FB64) - found by debugging + +and probably others. diff --git a/c64/basic/a659.setcharptr.s b/c64/basic/a659.setcharptr.s new file mode 100644 index 00000000..b7383332 --- /dev/null +++ b/c64/basic/a659.setcharptr.s @@ -0,0 +1,7 @@ + +// XXX provide documentation and implementation +// see: https://www.lemon64.com/forum/viewtopic.php?t=64721&sid=bc400a5a6d404f8f092e4d32a92f5de7 +// https://www.lemon64.com/forum/viewtopic.php?t=70680&sid=3ff66caf7f5fdf2a3c2ff2ee31fc3fd8 + +setcharptr: + STUB_IMPLEMENTATION() diff --git a/c64/basic/a7ae.interop b/c64/basic/a7ae.interop index f5ae9e65..25da9736 100644 --- a/c64/basic/a7ae.interop +++ b/c64/basic/a7ae.interop @@ -1,3 +1,9 @@ -This routine is mentionned in the cartridge writing tutorial here: https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image +This routine is used to launch other software. It is used by: + +- Exomizer (see https://github.com/bitshifters/exomizer/blob/master/exomizer/exomizer115.txt) +- FileBrowser64 (FB64) - found by debugging + +and probably others. It is also mentionned in the cartridge writing tutorial here: + +- https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image -We have to implement (or at least provide stub), otherwise cartridges will crash. diff --git a/c64/basic/a7ae.newstt.s b/c64/basic/a7ae.newstt.s index 55b97764..542e7bc6 100644 --- a/c64/basic/a7ae.newstt.s +++ b/c64/basic/a7ae.newstt.s @@ -1,5 +1,8 @@ // XXX provide documentation and implementation +// see: https://www.lemon64.com/forum/viewtopic.php?t=64721&sid=bc400a5a6d404f8f092e4d32a92f5de7 +// https://www.lemon64.com/forum/viewtopic.php?t=70680&sid=3ff66caf7f5fdf2a3c2ff2ee31fc3fd8 +// https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image NEWSTT: - STUB_IMPLEMENTATION() + STUB_IMPLEMENTATION() diff --git a/c64/kernal/f4a5.load.s b/c64/kernal/f4a5.load.s index e1cccc1d..0a838d91 100644 --- a/c64/kernal/f4a5.load.s +++ b/c64/kernal/f4a5.load.s @@ -142,6 +142,6 @@ load_loop: lda FA jsr close_load - +.break // Return last address jmp lvs_return_last_address From 68b61f4c8cea540d89537be56c05f1a9edc03536 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 6 Oct 2019 17:06:42 +0200 Subject: [PATCH 08/85] provided LINKPRG routine --- STATUS.md | 2 +- c64/basic/a533.linkprg.s | 91 ++++++++++++++++++++++++++++++++++++++-- c64/basic/cmd_load.s | 86 +------------------------------------ c64/kernal/f4a5.load.s | 2 +- 4 files changed, 91 insertions(+), 90 deletions(-) diff --git a/STATUS.md b/STATUS.md index dd27dfb2..65edf246 100644 --- a/STATUS.md +++ b/STATUS.md @@ -76,7 +76,7 @@ Not all of them - only these we want to have implemented. | Address | Name | Status | Remarks | | :-------: | :----------- | :------: | :------------------------------------------------: | | `$A004` | revision str | DONE | | -| `$A533` | LINKPRG | NOT DONE | | +| `$A533` | LINKPRG | DONE | | | `$A659` | set txt ptr | NOT DONE | | | `$A68E` | RUNC | NOT DONE | | | `$A7AE` | NEWSTT | NOT DONE | | diff --git a/c64/basic/a533.linkprg.s b/c64/basic/a533.linkprg.s index b7b11e80..675a794e 100644 --- a/c64/basic/a533.linkprg.s +++ b/c64/basic/a533.linkprg.s @@ -1,6 +1,91 @@ -// XXX provide documentation and implementation -// see: https://www.lemon64.com/forum/viewtopic.php?t=64721&sid=bc400a5a6d404f8f092e4d32a92f5de7 +// +// Well-known BASIC routine, described in: +// +// - [CM64] Compute's Mapping the Commodore 64 - page 95 +// - https://www.lemon64.com/forum/viewtopic.php?t=64721&sid=bc400a5a6d404f8f092e4d32a92f5de7 +// LINKPRG: - STUB_IMPLEMENTATION() + + // Start by getting pointer to the first line + jsr init_oldtxt + +linkprg_loop: + // Is the pointer to the end of the program + ldy #1 + +#if CONFIG_MEMORY_MODEL_60K + ldx # Date: Sun, 6 Oct 2019 17:55:54 +0200 Subject: [PATCH 09/85] implemented RUNC routine --- STATUS.md | 2 +- c64/basic/a68e.runc.s | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/STATUS.md b/STATUS.md index 65edf246..53f37638 100644 --- a/STATUS.md +++ b/STATUS.md @@ -78,7 +78,7 @@ Not all of them - only these we want to have implemented. | `$A004` | revision str | DONE | | | `$A533` | LINKPRG | DONE | | | `$A659` | set txt ptr | NOT DONE | | -| `$A68E` | RUNC | NOT DONE | | +| `$A68E` | RUNC | DONE | | | `$A7AE` | NEWSTT | NOT DONE | | | `$AB1E` | STROUT | DONE | | | `$BDCD` | LINPRT | DONE | temporary implementation | diff --git a/c64/basic/a68e.runc.s b/c64/basic/a68e.runc.s index dfec0e32..5daa4b22 100644 --- a/c64/basic/a68e.runc.s +++ b/c64/basic/a68e.runc.s @@ -1,5 +1,27 @@ -// XXX provide documentation and implementation +// Well-known BASIC routine, described in: +// +// - [CM64] Compute's Mapping the Commodore 64 - page 97 +// - https://www.c64-wiki.com/wiki/BASIC-ROM +// - https://csdb.dk/forums/?roomid=11&topicid=137233 +// + +// XXX use this routine to initialize TXTPTR RUNC: - STUB_IMPLEMENTATION() + // According to WIKI, we should load $7A/$7B with $2B-1/$2C-1), this does not makes sense. + // But CSDB claims, that it should 'set current character pointer to start of basic - 1' - this + // looks sane, also checked that the original BASIC routine does this (short test program) + + // Let's initialize TXTPTR using TXTTAB + + lda TXTTAB+0 + sec + sbc #$01 + sta TXTPTR+0 + + lda TXTTAB+1 + sbc #$00 + sta TXTPTR+1 + + rts From 090419262a79b0413d3da8f8550d31a71270f4f6 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 6 Oct 2019 18:16:16 +0200 Subject: [PATCH 10/85] redirected NEWSTT to RUN, should provide some compatibility --- STATUS.md | 2 +- c64/basic/a7ae.newstt.s | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/STATUS.md b/STATUS.md index 53f37638..4d338117 100644 --- a/STATUS.md +++ b/STATUS.md @@ -79,7 +79,7 @@ Not all of them - only these we want to have implemented. | `$A533` | LINKPRG | DONE | | | `$A659` | set txt ptr | NOT DONE | | | `$A68E` | RUNC | DONE | | -| `$A7AE` | NEWSTT | NOT DONE | | +| `$A7AE` | NEWSTT | PARTIAL | redirected to RUN command | | `$AB1E` | STROUT | DONE | | | `$BDCD` | LINPRT | DONE | temporary implementation | | `$E3BF` | INIT | NOT DONE | | diff --git a/c64/basic/a7ae.newstt.s b/c64/basic/a7ae.newstt.s index 542e7bc6..6dde6ca2 100644 --- a/c64/basic/a7ae.newstt.s +++ b/c64/basic/a7ae.newstt.s @@ -1,8 +1,18 @@ -// XXX provide documentation and implementation -// see: https://www.lemon64.com/forum/viewtopic.php?t=64721&sid=bc400a5a6d404f8f092e4d32a92f5de7 -// https://www.lemon64.com/forum/viewtopic.php?t=70680&sid=3ff66caf7f5fdf2a3c2ff2ee31fc3fd8 -// https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image +// Well-known BASIC routine, described in: +// +// - [CM64] Compute's Mapping the Commodore 64 - page 97 +// - https://www.lemon64.com/forum/viewtopic.php?t=64721&sid=bc400a5a6d404f8f092e4d32a92f5de7 +// - https://www.lemon64.com/forum/viewtopic.php?t=70680&sid=3ff66caf7f5fdf2a3c2ff2ee31fc3fd8 +// - https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image NEWSTT: - STUB_IMPLEMENTATION() + + // XXX Real implementation is more complicated, it's actually a part + // of the BASIC main loop. It is, however, often called by various + // utilities to simply run the software which was just loaded or + // uncompressed. + + // For now, let's cheat a little - this should provide some compatibility: + + jmp cmd_run From 057e3d687146593604988944bb5b70d4f087cb23 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 6 Oct 2019 20:00:18 +0200 Subject: [PATCH 11/85] separated screen part of CHROUT --- c64/kernal/{chrout_real.s => chrout_screen.s} | 79 +----------------- c64/kernal/f1ca.chrout.jmp.s | 6 -- c64/kernal/f1ca.chrout.s | 82 +++++++++++++++++++ 3 files changed, 83 insertions(+), 84 deletions(-) rename c64/kernal/{chrout_real.s => chrout_screen.s} (92%) delete mode 100644 c64/kernal/f1ca.chrout.jmp.s create mode 100644 c64/kernal/f1ca.chrout.s diff --git a/c64/kernal/chrout_real.s b/c64/kernal/chrout_screen.s similarity index 92% rename from c64/kernal/chrout_real.s rename to c64/kernal/chrout_screen.s index f30d2e16..898f1b53 100644 --- a/c64/kernal/chrout_real.s +++ b/c64/kernal/chrout_screen.s @@ -1,86 +1,9 @@ // -// Official Kernal routine, described in: -// -// - [RG64] C64 Programmer's Reference Guide - page 278/279 -// - [CM64] Compute's Mapping the Commodore 64 - page 228 -// -// CPU registers that has to be preserved (see [RG64]): .Y +// CHROUT routine - screen support // -chrout_real: - - sta SCHAR - - // Save X and Y values - // (Confirmed by writing a test program that X and Y - // don't get modified, in agreement with C64 PRG's - // description of CHROUT) - txa - pha - tya - pha - php - - // Determine the device number - lda DFLTO - - cmp #$03 // screen - beq chrout_screen - - jsr iec_check_devnum - bcs chrout_done_unknown_device // not a supported device - -chrout_iec: - - lda SCHAR - jsr JCIOUT - bcc chrout_done - - // FALLTROUGH - -chrout_done_fail: - jsr show_cursor_if_enabled - - plp - - // Restore X and Y - pla - tay - pla - tax - sec // indicate failure - rts - -chrout_done_unknown_device: - jsr show_cursor_if_enabled - - plp - - // Restore X and Y - pla - tay - pla - tax - - // End wioth error - jmp lvs_device_not_found_error - -chrout_done: - jsr show_cursor_if_enabled - - plp - - // Restore X and Y - pla - tay - pla - tax - lda SCHAR - clc // indicate success - rts - chrout_screen: // Crude implementation of character output diff --git a/c64/kernal/f1ca.chrout.jmp.s b/c64/kernal/f1ca.chrout.jmp.s deleted file mode 100644 index 6a1993c3..00000000 --- a/c64/kernal/f1ca.chrout.jmp.s +++ /dev/null @@ -1,6 +0,0 @@ - -// Our implementation is longer than the original one, -// placing it here would cause a collision with CHKIN - -CHROUT: - jmp chrout_real diff --git a/c64/kernal/f1ca.chrout.s b/c64/kernal/f1ca.chrout.s new file mode 100644 index 00000000..e13da0f8 --- /dev/null +++ b/c64/kernal/f1ca.chrout.s @@ -0,0 +1,82 @@ + +// +// Official Kernal routine, described in: +// +// - [RG64] C64 Programmer's Reference Guide - page 278/279 +// - [CM64] Compute's Mapping the Commodore 64 - page 228 +// +// CPU registers that has to be preserved (see [RG64]): .Y +// + +CHROUT: + + sta SCHAR + + // Save X and Y values + // (Confirmed by writing a test program that X and Y + // don't get modified, in agreement with C64 PRG's + // description of CHROUT) + txa + pha + tya + pha + php + + // Determine the device number + lda DFLTO + + cmp #$03 // screen + bne !+ + jmp chrout_screen +!: + jsr iec_check_devnum + bcs chrout_done_unknown_device // not a supported device + +chrout_iec: + + lda SCHAR + jsr JCIOUT + bcc chrout_done + + // FALLTROUGH + +chrout_done_fail: + jsr show_cursor_if_enabled + + plp + + // Restore X and Y + pla + tay + pla + tax + sec // indicate failure + rts + +chrout_done_unknown_device: + jsr show_cursor_if_enabled + + plp + + // Restore X and Y + pla + tay + pla + tax + + // End wioth error + jmp lvs_device_not_found_error + +chrout_done: + jsr show_cursor_if_enabled + + plp + + // Restore X and Y + pla + tay + pla + tax + lda SCHAR + clc // indicate success + rts From 3ca8c0ead51e05d3b0c8ad0b9f656e67c2add912 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 6 Oct 2019 20:14:21 +0200 Subject: [PATCH 12/85] fixed cursor movement at top-left screen character --- c64/kernal/chrout_screen.s | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/c64/kernal/chrout_screen.s b/c64/kernal/chrout_screen.s index 898f1b53..41924496 100644 --- a/c64/kernal/chrout_screen.s +++ b/c64/kernal/chrout_screen.s @@ -250,8 +250,12 @@ not_1d: not_91: cmp #$9d bne not_9d + lda TBLX + ora PNTR + beq !+ // branch if top-left screen character dec PNTR jsr calculate_screen_line_pointer +!: jmp chrout_done not_9d: From 8339e363240841dd81eca90eae418e0394a35d87 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 6 Oct 2019 22:27:30 +0200 Subject: [PATCH 13/85] PAL/NTSC display is now optional --- CONFIG.md | 8 +++++++- c64/,,config_generic.s | 3 ++- c64/,,config_mega65.s | 3 ++- c64/,,config_ultimate64.s | 3 ++- c64/basic/,imports.s | 4 ++++ c64/basic/,target_generic/,hooks_generic.s | 2 +- c64/basic/,target_mega65/,hooks_mega65.s | 2 +- .../,target_ultimate64/,hooks_ultimate64.s | 2 +- c64/basic/cmd_break.s | 4 ++-- c64/basic/do_basic_error.s | 2 +- c64/basic/e422.initmsg.s | 20 ++++++++++--------- c64/kernal/assets/kernal_messages.s | 17 ++++++++++++++++ c64/kernal/print/print_pal_ntsc.s | 17 ++++++++++++++++ src/compress_text.c | 10 ++++------ 14 files changed, 72 insertions(+), 25 deletions(-) create mode 100644 c64/kernal/print/print_pal_ntsc.s diff --git a/CONFIG.md b/CONFIG.md index 9bf8544b..26c426da 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -82,12 +82,18 @@ Each of them needs a couple of bytes in KERNAL segment - but they can share some ## Miscelaneous features -### `CONFIG_FANCY_BANNER` +### `CONFIG_BANNER_FANCY` If enabled, prints more colorful startup banner. Eye candy only. Needs some space in BASIC segment, varies between targets. +### `CONFIG_BANNER_PAL_NTSC` + +If enabled, prints video system on startup banner. Eye candy only. + +Feature needs 3 bytes in BASIC and 23 bytes in KERNAL segment. + ### `CONFIG_DOS_WEDGE` If enabled, a simple DOS wedge is available from the direct mode - supports `@`, `@`, `@$`, `@$` and `@` commands. diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 7b4de20f..11c29f43 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -20,7 +20,8 @@ // #define CONFIG_SID_D4XX // #define CONFIG_SID_D5XX -#define CONFIG_FANCY_BANNER +#define CONFIG_BANNER_FANCY +#define CONFIG_BANNER_PAL_NTSC #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS #define CONFIG_EXTENDED_SCNKEY // for now has to be enabled diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 8a693b68..8466b5ff 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -20,7 +20,8 @@ // #define CONFIG_SID_D4XX // #define CONFIG_SID_D5XX -#define CONFIG_FANCY_BANNER +#define CONFIG_BANNER_FANCY +#define CONFIG_BANNER_PAL_NTSC #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS #define CONFIG_EXTENDED_SCNKEY // for now has to be enabled diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index a29773e3..3e63e6a1 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -20,7 +20,8 @@ #define CONFIG_SID_D4XX #define CONFIG_SID_D5XX -#define CONFIG_FANCY_BANNER +#define CONFIG_BANNER_FANCY +#define CONFIG_BANNER_PAL_NTSC #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS #define CONFIG_EXTENDED_SCNKEY // for now has to be enabled diff --git a/c64/basic/,imports.s b/c64/basic/,imports.s index b195dcac..2f230d67 100644 --- a/c64/basic/,imports.s +++ b/c64/basic/,imports.s @@ -11,3 +11,7 @@ .label print_hex_byte = KERNAL.print_hex_byte .label print_return = KERNAL.print_return .label print_space = KERNAL.print_space + +#if CONFIG_BANNER_PAL_NTSC +.label print_pal_ntsc = KERNAL.print_pal_ntsc +#endif diff --git a/c64/basic/,target_generic/,hooks_generic.s b/c64/basic/,target_generic/,hooks_generic.s index 3224bfb8..76f0744d 100644 --- a/c64/basic/,target_generic/,hooks_generic.s +++ b/c64/basic/,target_generic/,hooks_generic.s @@ -4,7 +4,7 @@ .macro TARGET_HOOK_BANNER() { -#if CONFIG_FANCY_BANNER +#if CONFIG_BANNER_FANCY .byte $1C, $12, $A3, $A3, $A3, $A3, $A3, $A3, $A3, $92, $0D .byte $9E, $12, $A3, $A3, $A3, $A3, $A3, $A3, $92, $05, $20 diff --git a/c64/basic/,target_mega65/,hooks_mega65.s b/c64/basic/,target_mega65/,hooks_mega65.s index 0ffad48e..4bb36fc2 100644 --- a/c64/basic/,target_mega65/,hooks_mega65.s +++ b/c64/basic/,target_mega65/,hooks_mega65.s @@ -4,7 +4,7 @@ .macro TARGET_HOOK_BANNER() { -#if CONFIG_FANCY_BANNER +#if CONFIG_BANNER_FANCY // New banner from Retrofan .byte $9a, $12, $20, $20, $7f, $a9, $20, $20, $1f, $20, $9a, $20, $20, $20 diff --git a/c64/basic/,target_ultimate64/,hooks_ultimate64.s b/c64/basic/,target_ultimate64/,hooks_ultimate64.s index 5d6ea6c6..e752ed01 100644 --- a/c64/basic/,target_ultimate64/,hooks_ultimate64.s +++ b/c64/basic/,target_ultimate64/,hooks_ultimate64.s @@ -4,7 +4,7 @@ .macro TARGET_HOOK_BANNER() { -#if CONFIG_FANCY_BANNER +#if CONFIG_BANNER_FANCY .byte $1C, $12, $A3, $A3, $A3, $A3, $A3, $A3, $A3, $92, $0D .byte $9E, $12, $A3, $A3, $A3, $A3, $A3, $A3, $92, $05, $20 diff --git a/c64/basic/cmd_break.s b/c64/basic/cmd_break.s index d3aa3cd3..82909193 100644 --- a/c64/basic/cmd_break.s +++ b/c64/basic/cmd_break.s @@ -1,5 +1,5 @@ cmd_stop: - ldx #38 // "BREAK" + ldx #30 // "BREAK" jsr print_packed_message // Are we in direct mode @@ -8,7 +8,7 @@ cmd_stop: beq !+ // Not direct mode - ldx #37 + ldx #31 jsr print_packed_message lda CURLIN+1 diff --git a/c64/basic/do_basic_error.s b/c64/basic/do_basic_error.s index 31bd947f..1135e102 100644 --- a/c64/basic/do_basic_error.s +++ b/c64/basic/do_basic_error.s @@ -150,7 +150,7 @@ do_basic_error: beq !+ // We were in a program, so show IN - ldx #37 + ldx #31 jsr print_packed_message lda CURLIN+1 diff --git a/c64/basic/e422.initmsg.s b/c64/basic/e422.initmsg.s index 2520c5bd..6c2cd302 100644 --- a/c64/basic/e422.initmsg.s +++ b/c64/basic/e422.initmsg.s @@ -19,13 +19,12 @@ INITMSG: bne !- !: - // Print PAL/NTSC - ldx #30 // NTSC - lda TVSFLG - beq !+ - ldx #31 // PAL -!: - jsr print_packed_message + + // Print PAL/NTSC, if configured + +#if CONFIG_BANNER_PAL_NTSC + jsr print_pal_ntsc +#endif // Work out free bytes, display them jsr basic_do_new @@ -37,8 +36,11 @@ INITMSG: sbc TXTTAB+1 jsr print_integer - jsr print_space // Print rest of the start up message ldx #34 - jmp print_packed_message + jsr print_packed_message + + // XXX put them into packed message + jsr print_return + jmp print_return diff --git a/c64/kernal/assets/kernal_messages.s b/c64/kernal/assets/kernal_messages.s index b87bce48..8827bf91 100644 --- a/c64/kernal/assets/kernal_messages.s +++ b/c64/kernal/assets/kernal_messages.s @@ -12,6 +12,11 @@ .label __MSG_KERNAL_FROM_HEX = __kernal_message_from_hex - __kernal_messages_start .label __MSG_KERNAL_TO_HEX = __kernal_message_to_hex - __kernal_messages_start +#if CONFIG_BANNER_PAL_NTSC +.label __MSG_KERNAL_PAL = __kernal_message_pal - __kernal_messages_start +.label __MSG_KERNAL_NTSC = __kernal_message_ntsc - __kernal_messages_start +#endif + __kernal_messages_start: @@ -42,3 +47,15 @@ __kernal_message_from_hex: __kernal_message_to_hex: .text " TO " .byte $80 + $24 // end of string mark + '$' + +#if CONFIG_BANNER_PAL_NTSC + +__kernal_message_pal: + .text "PAL," + .byte $80 + $20 // end of string mark + space + +__kernal_message_ntsc: + .text "NTSC," + .byte $80 + $20 // end of string mark + space + +#endif // CONFIG_BANNER_PAL_NTSC diff --git a/c64/kernal/print/print_pal_ntsc.s b/c64/kernal/print/print_pal_ntsc.s new file mode 100644 index 00000000..3cccd080 --- /dev/null +++ b/c64/kernal/print/print_pal_ntsc.s @@ -0,0 +1,17 @@ + +// +// Print video system on startup banner +// + +#if CONFIG_BANNER_PAL_NTSC + +print_pal_ntsc: + + ldx #__MSG_KERNAL_NTSC + lda TVSFLG + beq !+ + ldx #__MSG_KERNAL_PAL +!: + jmp print_kernal_message + +#endif // CONFIG_BANNER_PAL_NTSC \ No newline at end of file diff --git a/src/compress_text.c b/src/compress_text.c index 85a62d06..fcfc7dca 100644 --- a/src/compress_text.c +++ b/src/compress_text.c @@ -159,15 +159,13 @@ char *error_list[]={ "LOAD", // https://www.discogs.com/Gimmik-Load-Error/release/482462 // Non-error messages "READY.\r", // #29 // https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconc_whatistsonative.htm https://github.com/stefanhaustein/expressionparser - "NTSC, ", // #30 - "PAL, ", // #31 - "BREAK AT $", // #32 + "BREAK", // #30 + " IN ", // #31 + "BRK AT $", // #32 "ERROR", // #33 // Simply the word error that is attached to the other parts of messages https://fjkraan.home.xs4all.nl/comp/apple2faq/app2asoftfaq.html - "BYTES FREE\r\r", // #34 // https://github.com/stefanhaustein/expressionparser + " BASIC BYTES FREE", // #34 // https://github.com/stefanhaustein/expressionparser "MEMORY CORRUPT", // #35 "NOT IMPLEMENTED", // #36 - " IN ", // #37 - "BREAK", // #38 NULL}; // XXX: create separate list for Kernal From dda0fa98638ae2e0f1b5f78bb3fc2440466105b1 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 6 Oct 2019 22:33:14 +0200 Subject: [PATCH 14/85] minor startup banner tweaks --- c64/basic/,target_generic/,hooks_generic.s | 8 ++++---- c64/basic/,target_ultimate64/,hooks_ultimate64.s | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/c64/basic/,target_generic/,hooks_generic.s b/c64/basic/,target_generic/,hooks_generic.s index 76f0744d..6c6fc033 100644 --- a/c64/basic/,target_generic/,hooks_generic.s +++ b/c64/basic/,target_generic/,hooks_generic.s @@ -6,12 +6,12 @@ #if CONFIG_BANNER_FANCY - .byte $1C, $12, $A3, $A3, $A3, $A3, $A3, $A3, $A3, $92, $0D - .byte $9E, $12, $A3, $A3, $A3, $A3, $A3, $A3, $92, $05, $20 + .byte $1C, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $92, $0D + .byte $9E, $12, $A4, $A4, $A4, $A4, $A4, $A4, $92, $05, $20 .text " OPEN ROMS GENERIC BUILD" .byte $0D - .byte $1E, $12, $A3, $A3, $A3, $A3, $A3, $92, $0D - .byte $9F, $12, $A3, $A3, $A3, $A3, $92, $20, $05, $20, $20 + .byte $1E, $12, $A4, $A4, $A4, $A4, $A4, $92, $0D + .byte $9F, $12, $A4, $A4, $A4, $A4, $92, $20, $05, $20, $20 .text " " #else diff --git a/c64/basic/,target_ultimate64/,hooks_ultimate64.s b/c64/basic/,target_ultimate64/,hooks_ultimate64.s index e752ed01..05c8d324 100644 --- a/c64/basic/,target_ultimate64/,hooks_ultimate64.s +++ b/c64/basic/,target_ultimate64/,hooks_ultimate64.s @@ -6,12 +6,12 @@ #if CONFIG_BANNER_FANCY - .byte $1C, $12, $A3, $A3, $A3, $A3, $A3, $A3, $A3, $92, $0D - .byte $9E, $12, $A3, $A3, $A3, $A3, $A3, $A3, $92, $05, $20 + .byte $1C, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $92, $0D + .byte $9E, $12, $A4, $A4, $A4, $A4, $A4, $A4, $92, $05, $20 .text " OPEN ROMS FOR ULTIMATE 64" .byte $0D - .byte $1E, $12, $A3, $A3, $A3, $A3, $A3, $92, $0D - .byte $9F, $12, $A3, $A3, $A3, $A3, $92, $20, $05, $20, $20 + .byte $1E, $12, $A4, $A4, $A4, $A4, $A4, $92, $0D + .byte $9F, $12, $A4, $A4, $A4, $A4, $92, $20, $05, $20, $20 .text " " #else From 99583f19c521a84443bcb8522add5f0bb5e55edc Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 6 Oct 2019 23:09:51 +0200 Subject: [PATCH 15/85] ugly temporary hack to support some crunchers --- bin/basic_generic.rom | Bin 8192 -> 8192 bytes bin/basic_mega65.rom | Bin 8192 -> 8192 bytes bin/basic_ultimate64.rom | Bin 8192 -> 8192 bytes bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/basic/cmd_sys.s | 39 +++++++++++++++++++++++++++++++++++++- 7 files changed, 38 insertions(+), 1 deletion(-) diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index ca209d637ad2bd8f15e95617cd644e7f6329f9c5..6b576b12637ac1fa24941022c0e68ee2e796da5e 100644 GIT binary patch literal 8192 zcmeHM4@?`^8UM~_gTVnisY#utg-alX@W)UR9EV^+APG*n1QKWx(kVS?=?qEJDr%>O zObSK03}wxN6J;XO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!5c{o zZ3GJbmQTy1ypqVAjWLDp^i}p}o&63k*>_K_d=6Z@!4-jQi2uk=Up<31lK{6?wK$3(Z6*yjGPr`fO8ss@zo zPXhcfJ3K}+`d_p&f!uha2jQLCppIOZr3CW+6B13y1bfHFQT@ zx!()!VdSXK)E~jUZ1?7?ZqX5ZH|h?(RKsHydTNQiF_fwM(w7(9HrEMuROaY3DoYS* znPur59adlURC=WbG}LSI$V20@1=x?qgnMxY`$kU-uMxA0?rHdJG3PVjb5f#x(?(mS zpU_Jtj#}$}>T1>jup5aO<0LlXvXJp2fl#SXu+NMP26<^ KS={}9`u+#+tRZ#) diff --git a/bin/basic_ultimate64.rom b/bin/basic_ultimate64.rom index 7694af194b7bee83463411b99a4b5e542b8d25bb..d33d9139494f397ba204995c11b05d2f0fd7ee0e 100644 GIT binary patch delta 2392 zcma)8eQZKrg9bqiv`=-|{j2B_#|PwN*;jH>p8ugL8~9K=iRu#^i;+7;=-rEALno&F&J6yLg=p}IEd!|g#+|~%+J{MBd#n( zSsj)mDX#3e=&nMJN#$en`Vnll;93jTnjUEkJ&BfKRDe+rX_bPW5sPxe(-R04ZqNXe$8 zp~;lg2F}E3gFVh4o|G1E9lCY+))6V1_d*kr79SrHvbEZs@$_5b$*23vA(_xL&@!TP zdR2S@^`Ve2@-n|^JUn`7xS;-BEEz#<%D1o z5^f|V2zQbUt>$Omjc7u)4byz0eX=X(|D~8#?u1NN-_+i+t$9a%8~gg^ovm9Nn>rhI zS=M&!&fT(oP2QfOWx}}juw5=KE0xPDD&_TZsi~@3Ub#U|tdZB0{Jo_UE;${SoM6^N zBf5A~yfC-FQFqs%NA34fjqwlg=w$meHEDVPozCfZfPLPO3H4v0#U1lC=puKfv%%g0 z*204@ZTh$YYS0ECx$w;&8+OdV#$B1C8+XHlsiU2CxOrhbSL{2MrAM>9aBB8UWA_AD z@$+2q$3K_>JlD}yH#-CJp3D+#jiTbtJMici$D;Gl*WJ&js+bMFiYyX07%u0PQe)bPF7V1;{+W&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cmd_sys_setup_call: lda #$4C // JMP opcode sta USRPOK lda LINNUM+0 @@ -29,3 +58,11 @@ cmd_sys: jsr USRPOK jmp basic_execute_statement + + + // + // XXX Temporary ugly hack to support 'SYS PI*656' + // + +cmd_sys_hack_str: + .byte $FF, $AC, $36, $35, $36, $00 From 66f719af73b54852538bdd1c9d076622076fee5a Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 7 Oct 2019 17:30:34 +0200 Subject: [PATCH 16/85] fix for PI tooken not displayed correctly by LIST --- c64/basic/cmd_list.s | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/c64/basic/cmd_list.s b/c64/basic/cmd_list.s index b096210d..08afa852 100644 --- a/c64/basic/cmd_list.s +++ b/c64/basic/cmd_list.s @@ -4,10 +4,7 @@ cmd_list: // Set current line pointer to start of memory - lda TXTTAB+0 - sta OLDTXT+0 - lda TXTTAB+1 - sta OLDTXT+1 + jsr init_oldtxt list_loop: @@ -82,25 +79,34 @@ list_print_loop: cmp #$22 bne list_not_quote lda QTSW - eor #$ff + eor #$FF sta QTSW lda #$22 jmp list_is_literal + list_not_quote: // Check quote mode, and display as literal if required ldx QTSW bne list_is_literal - cmp #$7f + cmp #$FF + beq list_is_pi + + cmp #$7F bcc list_is_literal // Display a token // Save registers +#if CONFIG_CPU_MOS_6502 tax pha tya pha +#else + phx + phy +#endif // Get pointer to compressed keyword list lda # Date: Mon, 7 Oct 2019 17:32:56 +0200 Subject: [PATCH 17/85] added target to test with XEMU emulator --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8445120a..c8f9f776 100644 --- a/Makefile +++ b/Makefile @@ -192,7 +192,7 @@ build/newc65.rom: build/kernal_mega65.rom build/basic_mega65.rom build/chargen.r # Rules - tests -.PHONY: test test_generic test_mega65 test_ultimate64 test_hybrid test_m65 testremote testsimilarity +.PHONY: test test_generic test_mega65 test_ultimate64 test_hybrid test_m65 test_xemu testremote testsimilarity test: test_generic @@ -217,6 +217,9 @@ test_hybrid: build/kernal_hybrid.rom build/symbols_hybrid.vs test_m65: build/newc65.rom m65 -b ../mega65-core/bin/mega65r1.bit -k ../mega65-core/bin/KICKUP.M65 -R build/newc65.rom -4 +test_xemu: build/newc65.rom + ../xemu/build/bin/xc65.native -dmarev 2 -rom build/newc65.rom + testremote: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -moncommands build/symbols_generic.vs -remotemonitor From 1ef37c2a8c614426d6b27c959b2c0f4b3d849f71 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 7 Oct 2019 21:49:26 +0200 Subject: [PATCH 18/85] fixed DOS wedge operating on tokenized string --- c64/basic/basic_execute_line.s | 20 ------------------- c64/basic/basic_main_loop.s | 35 +++++++++++++++++++++++----------- c64/basic/wedge_dos.s | 19 +++++++++++++++++- 3 files changed, 42 insertions(+), 32 deletions(-) diff --git a/c64/basic/basic_execute_line.s b/c64/basic/basic_execute_line.s index 15c533fa..e8c2c191 100644 --- a/c64/basic/basic_execute_line.s +++ b/c64/basic/basic_execute_line.s @@ -112,26 +112,6 @@ not_a_token: cmp #$3a beq basic_skip_char -#if CONFIG_DOS_WEDGE - - // Are we in direct mode? - // DOS Wedge is a hacky solution (inelegant, but convenient), - // BASIC programmers should implement communication with drives - // the standard way, handling channels properly. Besides, - // current implementation does not support characters under ROM - ldx CURLIN+1 - cpx #$ff - bne !+ - // We are in direct mode, allow wedge to handle '@' sign - // XXX Maybe it should be allowed only as the first command? - cmp #$40 - bne !+ - jsr basic_consume_character - jmp wedge_dos -!: - -#endif // CONFIG_DOS_WEDGE - // If all else fails, it's a syntax error jmp do_SYNTAX_error diff --git a/c64/basic/basic_main_loop.s b/c64/basic/basic_main_loop.s index 911e0f7f..0c93e2a8 100644 --- a/c64/basic/basic_main_loop.s +++ b/c64/basic/basic_main_loop.s @@ -39,12 +39,13 @@ got_line_of_input: // Strip leading spaces from the line remove_leading_spaces: - lda $0200 + lda BUF cmp #$20 bne !+ ldx #1 -rsl_l1: lda $0200,x - sta $01ff,x +rsl_l1: + lda BUF,x + sta BUF-1,x inx cpx __tokenise_work1 bne rsl_l1 @@ -61,11 +62,23 @@ rsl_l1: lda $0200,x lda __tokenise_work1 beq basic_read_next_line +#if CONFIG_DOS_WEDGE + + // Check if DOS wedge should take over + lda BUF + cmp #$40 // '@' + bne !+ + ldx __tokenise_work1 // here is the size of input + jmp wedge_dos +!: + +#endif // CONFIG_DOS_WEDGE + // Else, tokenise the line jsr tokenise_line // Has the user entered a line of BASIC beginning with a number? - lda $0200 + lda BUF cmp #$30 bcc not_a_line cmp #$39 @@ -82,9 +95,9 @@ rsl_l1: lda $0200,x sta __tokenise_work1 // Try to read line number - lda #<$0200 + lda #$0200 + lda #>BUF sta TXTPTR+1 jsr basic_parse_line_number @@ -98,13 +111,13 @@ rsl_l1: lda $0200,x // Skip any spaces after the line number ldx __tokenise_work1 skip_spaces: - lda $0200,x + lda BUF,x cmp #$20 bne !+ inx bne skip_spaces !: stx __tokenise_work1 - + // First, clear all variables, so that we only have to shove BASIC text around. // (We could later remove this requirement, and the only effect should be // to slow things down, and that you might have to either CLR if there is no @@ -135,9 +148,9 @@ not_a_line: // Actually interpret the line // Setup pointer to the statement - lda #<$0200 + lda #$0200 + lda #>BUF sta TXTPTR+1 // There is no stored line, so zero that pointer out @@ -148,7 +161,7 @@ not_a_line: // Put invalid line number in current line number value, // so that we know we are in direct mode // (Compute's Mapping the 64 p19) - lda #$ff + lda #$FF sta CURLIN+1 jmp basic_execute_statement diff --git a/c64/basic/wedge_dos.s b/c64/basic/wedge_dos.s index 47322a6a..7ede8e76 100644 --- a/c64/basic/wedge_dos.s +++ b/c64/basic/wedge_dos.s @@ -1,8 +1,15 @@ #if CONFIG_DOS_WEDGE +// .X has to contain size of the buffer + wedge_dos: + // Prepare buffer - finish it with '0' + + lda #$00 + sta BUF,x + // Close all the channels, so that wedge has full control jsr JCLALL @@ -12,6 +19,16 @@ wedge_dos: ldy #$0F jsr JSETFLS + // Setup necessary parts of BASIC + + lda #<(BUF+1) + sta TXTPTR+0 + lda #>(BUF+1) + sta TXTPTR+1 + + lda #$FF + sta CURLIN+1 + // Now we have to check what the user wants us to do // Check if user asked for a status @@ -210,7 +227,7 @@ wedge_dos_clean_exit: jsr JCLALL // Print new line jsr print_return - jmp basic_end_of_line + jmp basic_main_loop wedge_dos_basic_error: pha From 982ac815128a876d43897c80395e35eef345493d Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 7 Oct 2019 21:58:43 +0200 Subject: [PATCH 19/85] fixed improper error message in LOAD --- c64/basic/cmd_load.s | 2 ++ 1 file changed, 2 insertions(+) diff --git a/c64/basic/cmd_load.s b/c64/basic/cmd_load.s index 6fa4adc6..9dfe60f0 100644 --- a/c64/basic/cmd_load.s +++ b/c64/basic/cmd_load.s @@ -93,7 +93,9 @@ got_loadaddress: lda #$00 // LOAD not verify jsr JLOAD php + pha jsr print_return + pla plp bcc !+ From e6e921e740c619f85de6c96f894d581ff5b03303 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 7 Oct 2019 22:40:25 +0200 Subject: [PATCH 20/85] removed some dead code, updated binaries --- bin/basic_generic.rom | Bin 8192 -> 8192 bytes bin/basic_mega65.rom | Bin 8192 -> 8192 bytes bin/basic_ultimate64.rom | Bin 8192 -> 8192 bytes bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/kernal/chrout_screen.s | 17 ----------------- 7 files changed, 17 deletions(-) diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index 6b576b12637ac1fa24941022c0e68ee2e796da5e..8e22472dac293024eb992a7cdfc388064ba02fbb 100644 GIT binary patch delta 1955 zcmYjSeQaCR6@Smq&U5;b+DX&OT~~7(p(ZJ5XvAC;{MRY~i{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+*xsrd54>LtDc6M?Ftk=-t_qn$OEk%Z#M}3Uy_&obx9%T4TtW;$jW#T!L3pkh(|2;IHn(aQdFT z2JZZ_2GS0;LSGh`srX<2=x$epf%#y!!TJTIdmkgM-z#uq%tzd-%(dMUqX<$SaxPFm ziEMm8y&OSj<}QDT&U1@Jr17|t-C<#7J|tYr%CR|nENMA26IiCMN9N44B~tEe<6Hyj zi$7u=X^`4!&3uv?6)rcuZbOGT(*7hIPAlcK(1bI%|?miQ=DEZ`;ya&Dp?)I zjp0lZd7_He6Q$mW&gzyym2dnxs5W#2n1vCAExL=yEl3ihBysDBvZwPMt+wc_UN(Lm zMO8%=DuVc(mSpme2&b3T8#;Pcmk2|amkz<&oWNeo-}}5Wf<#1$VOyX+Ceg`xVym2E zp<8G!=ulISM-&5Pko7Bq+#?32iwfpfE-!djm<2CE(PT94BRChq?U`#`$5Mgl+2uR< zXHs~D_!e7ks6wP1N10<>E7OL!InJ$Vm(-+0AwV&HQIXgoLs{;vXitQF)lhNJ6*WPas$*9bE zB?(eLBjt`;X!Jxpj2UA#*@&bi^7ACF?A9^;so1(Ga(=lmdp)Sp4oA7!!xgo~B=UzV zgk(ndwm)fl$h^q@TVH-?E>fYBFis8lip|pPZa5xE`4P(@4llDpTT}$+fJ2>QXBH zF8tSKCeHc_%X7kU_I%;D17RG(iFJ^RmOmB9U8G80$I{&v`ieKZm-Wb}jNuU>A^m+M zY$hX@o)331&TyD`QHlBn{D fqX><@TvZmewwk!&jXASuT7g?$C?Z(ux2yjF0O?h4 diff --git a/bin/basic_mega65.rom b/bin/basic_mega65.rom index cc080222aa6d2350cacec1042b778fbbafe8ed45..53c01b59a32a93ad85feade40751860dd16f21bb 100644 GIT binary patch delta 1668 zcmcIkdu&rx7{8CcSm)Y}4a%!Kn?abcWs!7_xy^x53cC=ZWa<=hH-mOD7>z{8ChHQp zh^SCXp<=umXylk3*3UGvN%DkBBZdL?W>(cb%P#(fvY@W~sUi@B|e{Hn8B zUh24fd@bwaSy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w(6#P1h|M^SAB%D)T08V3EfqFhH+6yuHolEAiPsojvX_+QxiQf zstLkMqo8ssAOk8Il=yS0E4H| z=FpvFQ1{VLof3PjjY`5}ThwO72@k-xrKQ;6n9lYYo_N3pNx;$tX}#X72$RZVE_60IkQN!+YQ|dPSQ_ z&AHJLZG0ql5`jzaxGA4xp|jcy(uJ;R6G$x@(;g&CkSY4Llq#>4=grZUQmR5(M<^$?_1%b?8Jj~je1D*g7veY0$-GQ zP=dN+GRX=w97ZfcGp4&THkyn` zU*vy~BCJI3*A%#kth$)QriG5HOK-YB`MB-N_hqttMUlW(k!~I+d(N8kvcBH zoVaKs8X71&c|VO7NKwHl!R&%SiJ=^Mrh)RWXx!u#OEM)~2*MOfrl_7%##Xb8LVc z=M6A%o^O)dhX%D?zS)n)W^e~L*=V+zG1uYO1mvT=>v9vaJs^7)o8z0Y5f{d*gUkxw zBt^;1Xj``zUyX%z$H;tiM4z6L<%O5su-^?w-0;Ezyf6nB=V84Y)_URC40O4n)&nz8 OuRbq$qvx>izUyBZ2q<{~ diff --git a/c64/kernal/chrout_screen.s b/c64/kernal/chrout_screen.s index 41924496..8ed05fd7 100644 --- a/c64/kernal/chrout_screen.s +++ b/c64/kernal/chrout_screen.s @@ -798,20 +798,3 @@ update_colour_line_pointer: sta USER+1 rts - -advance_screen_pointer_40_bytes: - lda PNT+0 - clc - adc #<40 - sta PNT+0 - sta USER+0 - lda PNT+1 - adc #>40 - sta PNT+1 - sec - sbc HIBASE - clc - adc #>$D800 - sta USER+1 - - jmp update_colour_line_pointer From a442bf910f8065afd50ea66cfe21d7a12c40099d Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 8 Oct 2019 16:27:07 +0200 Subject: [PATCH 21/85] reordered and size-optimized some screen routines --- Makefile | 2 +- c64/kernal/blink_cursor.s | 96 ------------------- c64/kernal/chrin_real.s | 51 ++-------- c64/kernal/chrout_screen.s | 4 +- c64/kernal/e544.clear_screen.s | 4 +- c64/kernal/f1ca.chrout.s | 6 +- .../interrupts/ea31.default_irq_handler.s | 2 +- c64/kernal/screen/cursor.s | 81 ++++++++++++++++ c64/kernal/screen/cursor_enable.s | 10 ++ .../{home_cursor.s => screen/cursor_home.s} | 8 +- c64/kernal/screen/cursor_show.s | 34 +++++++ c64/kernal/screen/screen_code_to_petscii.s | 36 +++++++ 12 files changed, 183 insertions(+), 151 deletions(-) delete mode 100644 c64/kernal/blink_cursor.s create mode 100644 c64/kernal/screen/cursor.s create mode 100644 c64/kernal/screen/cursor_enable.s rename c64/kernal/{home_cursor.s => screen/cursor_home.s} (58%) create mode 100644 c64/kernal/screen/cursor_show.s create mode 100644 c64/kernal/screen/screen_code_to_petscii.s diff --git a/Makefile b/Makefile index c8f9f776..bd47fec9 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ SRCDIR_COMMON = c64/aliases SRCDIR_BASIC_COMMON = $(SRCDIR_COMMON) c64/basic -SRCDIR_KERNAL_COMMON = $(SRCDIR_COMMON) c64/kernal c64/kernal/assets c64/kernal/jumptable c64/kernal/iec c64/kernal/interrupts c64/kernal/print +SRCDIR_KERNAL_COMMON = $(SRCDIR_COMMON) c64/kernal c64/kernal/assets c64/kernal/jumptable c64/kernal/iec c64/kernal/interrupts c64/kernal/print c64/kernal/screen SRCDIR_BASIC_generic = $(SRCDIR_BASIC_COMMON) c64/basic/,target_generic SRCDIR_BASIC_mega65 = $(SRCDIR_BASIC_COMMON) c64/basic/,target_mega65 diff --git a/c64/kernal/blink_cursor.s b/c64/kernal/blink_cursor.s deleted file mode 100644 index 5d3c5446..00000000 --- a/c64/kernal/blink_cursor.s +++ /dev/null @@ -1,96 +0,0 @@ -// We have the following variables: -// BLNSW (cursor blink switch) -// BLNCT (cursor blink countdown) -// GDBLN (cursor saved character) -// BLNON (if cursor is visible) -// GDCOL (colour under cursor) -// USER (current screen line colour pointer) -// PNT (current screen line pointer) -// PNTR (current screen x position) - -show_cursor_if_enabled: - lda BLNSW - beq !+ - rts -!: lda BLNON - beq show_cursor - rts - -show_cursor: - // Set cursor as though it had just finished the off phase, - // so that the call to blink_cursor paints it - lda #$00 - sta BLNCT - sta BLNON - jsr blink_cursor - // Then set the timeout to 1 frame, so that the cursor - // blinks under key repeat conditions, like on the original KERNAL - lda #$01 - sta BLNCT - rts - -blink_cursor: - // Is the cursor enabled? - lda BLNSW - bne no_blink_cursor - - // Do we need to redraw things? - dec BLNCT - bpl no_blink_cursor - - // Check if cursor was visible or not, and toggle - lda BLNON - bne undraw_cursor -draw_cursor: - jsr calculate_screen_line_pointer - - ldy PNTR - lda (PNT),y - sta GDBLN - eor #$80 - sta (PNT),y - // Also set cursor colour - lda (USER),y - sta GDCOL - lda COLOR - sta (USER),y - - lda #1 - sta BLNON - - jmp reset_blink_timer - -undraw_cursor: - jsr calculate_screen_line_pointer - - lda GDBLN - ldy PNTR - sta (PNT),y - lda GDCOL - sta (USER),y - - lda #0 - sta BLNON - // Fall through -reset_blink_timer: - // Rest blink counter - // (Compute's Mapping the 64, p39-40) - lda #20 - sta BLNCT -no_blink_cursor: - rts - -disable_cursor: - lda #$80 - sta BLNSW - // FALL THROUGH -hide_cursor_if_visible: - lda BLNON - bne undraw_cursor - rts - -enable_cursor: - lda #$00 - sta BLNSW - rts - diff --git a/c64/kernal/chrin_real.s b/c64/kernal/chrin_real.s index cbed585e..4d1a3a87 100644 --- a/c64/kernal/chrin_real.s +++ b/c64/kernal/chrin_real.s @@ -9,6 +9,7 @@ // // XXX keyboard part currently does not preserve register Y, to be fixed! +// XXX try to make chrin_real unnecessary (try to fit this into original location) // Reads a byte of input, unless from keyboard. // If from keyboard, then it gets a whole line of input, and returns the first char. @@ -84,8 +85,8 @@ not_end_of_input: read_from_keyboard: - jsr enable_cursor - + jsr cursor_enable + // Wait for a key lda NDX beq chrin_repeat @@ -94,12 +95,12 @@ read_from_keyboard: cmp #$0d bne not_enter - jsr disable_cursor - + jsr cursor_disable + jsr pop_keyboard_buffer - jsr hide_cursor_if_visible - + jsr cursor_hide_if_visible + // It was enter. // Note that we have a line of input to return, and return the first byte thereof // after computing and storing its length. @@ -170,41 +171,3 @@ pop_keyboard_buffer: cli rts - -screen_code_to_petscii: - cmp #$1b - bcs not_alpha - - clc - adc #$40 - rts - -not_alpha: - cmp #$40 - bcs not_punctuation - - rts - -not_punctuation: - cmp #$5b - bcs not_shifted - - clc - adc #$80 - - rts - -not_shifted: - - cmp #$80 - bcs not_vendor - - // $60-$7F -> $A0-$BF - - clc - adc #$40 - - // FALLTROUGH -not_vendor: - rts - diff --git a/c64/kernal/chrout_screen.s b/c64/kernal/chrout_screen.s index 8ed05fd7..6e4b0ac5 100644 --- a/c64/kernal/chrout_screen.s +++ b/c64/kernal/chrout_screen.s @@ -9,7 +9,7 @@ chrout_screen: // Crude implementation of character output sei // XXX why do we need to disable interrupts? - jsr hide_cursor_if_visible + jsr cursor_hide_if_visible lda SCHAR tax @@ -620,7 +620,7 @@ line_not_linked_del: screen_advance_to_next_line: - // jsr hide_cursor_if_visible + // jsr cursor_hide_if_visible // Go to start of line lda #0 diff --git a/c64/kernal/e544.clear_screen.s b/c64/kernal/e544.clear_screen.s index 90d1999d..9c790007 100644 --- a/c64/kernal/e544.clear_screen.s +++ b/c64/kernal/e544.clear_screen.s @@ -3,6 +3,8 @@ clear_screen: + // XXX it is probably a good idea to hide cursor first + // Clear line link table // (Compute's Mapping the 64 p215) @@ -57,4 +59,4 @@ clearscreen_l3: bne clearscreen_l3 // (Compute's Mapping the 64 p216) - jmp home_cursor + jmp cursor_home diff --git a/c64/kernal/f1ca.chrout.s b/c64/kernal/f1ca.chrout.s index e13da0f8..6c37056a 100644 --- a/c64/kernal/f1ca.chrout.s +++ b/c64/kernal/f1ca.chrout.s @@ -41,7 +41,7 @@ chrout_iec: // FALLTROUGH chrout_done_fail: - jsr show_cursor_if_enabled + jsr cursor_show_if_enabled plp @@ -54,7 +54,7 @@ chrout_done_fail: rts chrout_done_unknown_device: - jsr show_cursor_if_enabled + jsr cursor_show_if_enabled plp @@ -68,7 +68,7 @@ chrout_done_unknown_device: jmp lvs_device_not_found_error chrout_done: - jsr show_cursor_if_enabled + jsr cursor_show_if_enabled plp diff --git a/c64/kernal/interrupts/ea31.default_irq_handler.s b/c64/kernal/interrupts/ea31.default_irq_handler.s index 5ce46892..304fa343 100644 --- a/c64/kernal/interrupts/ea31.default_irq_handler.s +++ b/c64/kernal/interrupts/ea31.default_irq_handler.s @@ -1,7 +1,7 @@ default_irq_handler: - jsr blink_cursor + jsr cursor_blink jsr JSCNKEY jsr JUDTIM // update jiffy clock diff --git a/c64/kernal/screen/cursor.s b/c64/kernal/screen/cursor.s new file mode 100644 index 00000000..59cae342 --- /dev/null +++ b/c64/kernal/screen/cursor.s @@ -0,0 +1,81 @@ + +// +// Variables used: +// - BLNSW (cursor blink switch) +// - BLNCT (cursor blink countdown) +// - GDBLN (cursor saved character) +// - BLNON (if cursor is visible) +// - GDCOL (colour under cursor) +// - USER (current screen line colour pointer) +// - PNT (current screen line pointer) +// - PNTR (current screen x position) +// + + +cursor_blink: + // Is the cursor enabled? + lda BLNSW + bne cursor_blink_end + + // Do we need to redraw things? + dec BLNCT + bpl cursor_blink_end + + // Check if cursor was visible or not, and toggle + lda BLNON + bne cursor_undraw + + // FALLTROUGH + +cursor_draw: + jsr calculate_screen_line_pointer // XXX make sure this is not needed and remove the call + + ldy PNTR + lda (PNT),y + sta GDBLN + eor #$80 + sta (PNT),y + // Also set cursor colour + lda (USER),y + sta GDCOL + lda COLOR + sta (USER),y + + lda #1 + sta BLNON + + bne cursor_blink_timer_reset // branches always + +cursor_disable: + lda #$80 + sta BLNSW + + // FALLTHROUGH + +cursor_hide_if_visible: + lda BLNON + beq cursor_blink_end + +cursor_undraw: + + lda GDBLN + ldy PNTR + sta (PNT),y + lda GDCOL + sta (USER),y + + lda #0 + sta BLNON + + // FALLTROUGH + +cursor_blink_timer_reset: + + // Rest blink counter (Mapping the 64, p39-40) + lda #20 + sta BLNCT + + // FALLTROUGH + +cursor_blink_end: + rts diff --git a/c64/kernal/screen/cursor_enable.s b/c64/kernal/screen/cursor_enable.s new file mode 100644 index 00000000..72646312 --- /dev/null +++ b/c64/kernal/screen/cursor_enable.s @@ -0,0 +1,10 @@ + +// +// Variables used: +// - BLNSW (cursor blink switch) +// + +cursor_enable: + lda #$00 + sta BLNSW + rts diff --git a/c64/kernal/home_cursor.s b/c64/kernal/screen/cursor_home.s similarity index 58% rename from c64/kernal/home_cursor.s rename to c64/kernal/screen/cursor_home.s index 37965f96..42718ce1 100644 --- a/c64/kernal/home_cursor.s +++ b/c64/kernal/screen/cursor_home.s @@ -1,7 +1,9 @@ -// Home the cursor -// (Compute's Mapping the 64 p216) -home_cursor: +// +// Home the cursor (Compute's Mapping the 64 p216) +// + +cursor_home: lda #$00 sta PNTR // x position diff --git a/c64/kernal/screen/cursor_show.s b/c64/kernal/screen/cursor_show.s new file mode 100644 index 00000000..c21b092c --- /dev/null +++ b/c64/kernal/screen/cursor_show.s @@ -0,0 +1,34 @@ + +// +// Variables used: +// - BLNSW (cursor blink switch) +// - BLNON (if cursor is visible) +// - BLNCT (cursor blink countdown) +// + +cursor_show_if_enabled: + lda BLNSW + bne cursor_show_end + lda BLNON + bne cursor_show_end + + // FALLTROUGH + +cursor_show: + + // Set cursor as though it had just finished the off phase, + // so that the call to cursor_blink paints it + lda #$00 + sta BLNCT + sta BLNON + jsr cursor_blink + + // Then set the timeout to 1 frame, so that the cursor + // blinks under key repeat conditions, like on the original KERNAL + lda #$01 + sta BLNCT + + // FALLTROUGH + +cursor_show_end: + rts diff --git a/c64/kernal/screen/screen_code_to_petscii.s b/c64/kernal/screen/screen_code_to_petscii.s new file mode 100644 index 00000000..3485a3b9 --- /dev/null +++ b/c64/kernal/screen/screen_code_to_petscii.s @@ -0,0 +1,36 @@ + +screen_code_to_petscii: + cmp #$1B + bcc s2p_adc_40 + +s2p_not_alpha: + cmp #$40 + bcc s2p_end + + // FALLTROUGH + +s2p_not_punctuation: + cmp #$5B + bcs s2p_not_shifted + + // carry already clear here + adc #$80 + + rts + +s2p_not_shifted: + + cmp #$80 + bcs s2p_end // not vendor + + // $60-$7F -> $A0-$BF + +s2p_adc_40: + + clc + adc #$40 + + // FALLTROUGH + +s2p_end: + rts From 2cc6587b5cfa46350795b00f79fad504f315fd29 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 9 Oct 2019 18:45:37 +0200 Subject: [PATCH 22/85] CHROUT screen output routine split, size and performance optimizations --- c64/kernal/chrout_screen.s | 537 +----------------- c64/kernal/screen/chrout_screen_control.s | 206 +++++++ c64/kernal/screen/chrout_screen_del.s | 63 ++ c64/kernal/screen/chrout_screen_ins.s | 64 +++ c64/kernal/screen/chrout_screen_quote.s | 20 + .../screen/screen_calculate_line_pointer.s | 54 ++ c64/kernal/screen/screen_grow_logical_line.s | 122 ++++ c64/kernal/screen/screen_normalize_xy.s | 82 +++ 8 files changed, 627 insertions(+), 521 deletions(-) create mode 100644 c64/kernal/screen/chrout_screen_control.s create mode 100644 c64/kernal/screen/chrout_screen_del.s create mode 100644 c64/kernal/screen/chrout_screen_ins.s create mode 100644 c64/kernal/screen/chrout_screen_quote.s create mode 100644 c64/kernal/screen/screen_calculate_line_pointer.s create mode 100644 c64/kernal/screen/screen_grow_logical_line.s create mode 100644 c64/kernal/screen/screen_normalize_xy.s diff --git a/c64/kernal/chrout_screen.s b/c64/kernal/chrout_screen.s index 6e4b0ac5..c516dcf4 100644 --- a/c64/kernal/chrout_screen.s +++ b/c64/kernal/chrout_screen.s @@ -14,285 +14,24 @@ chrout_screen: lda SCHAR tax - // Check for special characters + // All the PETSCII control codes are within $0x, $1x, $8x, $9x, remaining + // ones are always printable characters; separate away control codes - cmp #$00 - bne not_00 - jmp chrout_done -not_00: - - // Linefeed (simply ignored) - // Trivia: BASIC does CRLF with READY. prompt - cmp #$0a - bne not_0a - jmp chrout_done -not_0a: - - // Carriage return - cmp #$0d - bne not_0d - // RETURN clears quote and insert modes, it also clears reverse flag - lda #$00 - sta QTSW - sta INSRT - sta RVS - jmp screen_advance_to_next_line -not_0d: - - cmp #$94 - bne not_94 - - // Insert (shift-DELETE) - - // Abort if line already max length, ie 79th char is not a space - jsr get_current_line_logical_length - cmp #79 - bne definitely_not_too_long - tay - lda (PNT),y - cmp #$20 - beq definitely_not_too_long - - // Line is too long to extend - jmp chrout_done - -definitely_not_too_long: - // Work out if line needs to be expanded, and if so expand it - ldy #39 - lda (PNT),y - cmp #$20 - beq no_need_to_extend - - jsr screen_grow_logical_line - -no_need_to_extend: - // Shuffle chars towards end of line - jsr get_current_line_logical_length - tay -!: - // Note: While the following routine is obvious to any skilled - // in the art as the most obvious simple and efficient solution, - // if the screen writes are before the colour writes, it results - // in a relatively long verbatim stretch of bytes when compared to - // the C64 KERNAL. Thus we have swapped the order, just to reduce - // the potential for any argument of copyright infringement, even - // though we really don't believe that the routine can be copyrighted - // due to the lack of creativity. - dey - lda (USER),y - iny - sta (USER),y - dey - lda (PNT),y - iny - sta (PNT),y - - dey - cpy PNTR - bne !- - - // Increase insert mode count (which causes quote-mode like behaviour) - inc INSRT - - // Put space in the inserted gap - lda #$20 - sta (PNT),y - - jmp chrout_done -not_94: - - // DELETE in insert mode embeds control character - ldx INSRT - bne not_14 - - cmp #$14 - bne not_14 - - // Delete - ldx PNTR - bne delete_non_zero_column -delete_at_column_0: - ldy TBLX - bne not_row_0 - // delete from row 0, col 0 does nothing - jmp chrout_done -not_row_0: - // Column 0 delete just moves us to the end of the - // previous line, without actually deleting anything - dec TBLX - jsr get_current_line_logical_length - lda LNMX - - sta PNTR - jsr calculate_screen_line_pointer - jmp chrout_done - -delete_non_zero_column: - // Copy rest of line down - jsr get_current_line_logical_length - ldy PNTR - cpy LNMX - beq done_delete - dey -!: - iny - lda (PNT),y - dey - sta (PNT),y - iny - lda (USER),y - dey - sta (USER),y - iny - cpy LNMX - bne !- - - // Clear char at end of line - jsr get_current_line_logical_length - tay - lda #$20 - sta (PNT),y - -done_delete: - dec PNTR - jmp chrout_done -not_14: - - // Check for quote mode - ldx QTSW - bne is_quote_mode - ldx INSRT - bne is_quote_mode - jmp not_quote_mode - -is_quote_mode: - // Is it a control code? - // control codes are $00-$1f and $80-$9f - // (from reading C64 PRG p379-381) - // so we can just check if bits 5 or 6 are set, and if so, - // then it isn't a control character. - pha and #$60 bne !+ - - // Yes, a control code in quote mode means we display it as a reverse character - pla - - // Low control codes are just +$80 - clc - adc #$80 - // If it overflowed, then it is a high control code, - // so we need to make it be $80 + $40 + char - // as we will have flipped back to just $00 + char, we should - // now add $c0 if C is set from overflow - bcc low_ctrl_char - adc #$bf // C=1, so adding $BF + C = add $C0 -low_ctrl_char: - jmp output_literal_char + jmp chrout_screen_control !: - pla -not_quote_mode: + txa - // Check for colours - ldx #$f -colour_check_loop: - cmp colour_codes,x - bne !+ - stx COLOR - jmp chrout_done -!: dex - bpl colour_check_loop - - // Compute's Mapping the 64 p38 - cmp #$12 - bne not_12 - lda #$80 - sta RVS - jmp chrout_done -not_12: - // Compute's Mapping the 64 p 38 - cmp #$92 - bne not_92 - lda #$00 - sta RVS - jmp chrout_done -not_92: - - // Check for cursor movement keys - cmp #$11 - bne not_11 - lda PNTR - clc - adc #40 - sta PNTR - // We need to advance the pointer manually, as normalising - // now will break things. The pointer update is required - // so that we can tell if we really are on the bottom phys - // screen line or not - jsr scroll_up_if_on_last_line - jsr calculate_screen_line_pointer - jmp chrout_done -not_11: - cmp #$1d - bne not_1d - inc PNTR - jsr calculate_screen_line_pointer - jmp chrout_done -not_1d: - cmp #$91 - bne not_91 - lda PNTR - sec - sbc #40 - sta PNTR - jsr calculate_screen_line_pointer - jmp chrout_done -not_91: - cmp #$9d - bne not_9d - lda TBLX - ora PNTR - beq !+ // branch if top-left screen character - dec PNTR - jsr calculate_screen_line_pointer -!: - jmp chrout_done -not_9d: - - // Home cursor - cmp #$13 - bne not_13 - lda #0 - sta PNTR - sta TBLX - jsr calculate_screen_line_pointer - jmp chrout_done -not_13: - - // Clear screen - cmp #$93 - bne not_clearscreen - jsr clear_screen - jmp chrout_done - -not_clearscreen: - - // Convert PETSCII to screen code - - // Don't print other control codes - cmp #$1f - bcs !+ - jmp chrout_done -!: + // Literals - first convert PETSCII to screen code // Codes $C0-$DF become $40-$5F - // But - cmp #$e0 + cmp #$E0 bcs !+ - cmp #$c0 + cmp #$C0 bcc !+ - and #$7f + and #$7F jmp output_literal_char // not high char !: @@ -368,127 +107,9 @@ not_quote: no_screen_advance_to_next_line: jmp chrout_done -screen_grow_logical_line: - ldy TBLX - // Don't grow line if it is already grown - lda LDTBL,y - bpl !+ - jmp not_last_line // doneb grow line -!: - lda #$80 - sta LDTBL,y - // Now make space for the extra line added. - // If we are on the last physical line of the screen, - // Then we need to scroll the screen up - jsr scroll_up_if_on_last_line - - // Scroll screen down to make space - // As we are scrolling down, we start from the end, - // and work backwards. We can't be as simple and efficient - // here as we are for scrolling up, because we don't know - // how much must be scrolled. - // Simple solution is to work out how many physical lines - // need shifting down, and then move lines at a time after - // initialising the pointers to the end area of the screen. - ldx #25-2 - ldy #0 -count_rows_loop: - dex - lda LDTBL,y - bpl !+ - dex -!: iny - cpy TBLX - bne count_rows_loop - cpx #0 - beq no_copy_down - bmi no_copy_down - - // Set pointers to end of screen line, and one line - // above. (It is always one physical line, because - // this can only happen when expanding a line from 40 to - // 80 characters). - // XXX - This is not very efficient, and longer than it - // needs to be. Better would be to work out size to - // copy, and count it down in a pointer somewhere, so - // that loop iteration logic is simpler. - lda HIBASE - clc - adc #3 - sta PNT+1 - sta SAL+1 - lda #>$DBC0 - sta EAL+1 - sta USER+1 - lda #<$03C0 - sta PNT+0 - sta USER+0 - // souce address is line above - sec - sbc #40 - sta SAL+0 - sta EAL+0 - -copy_line_down_loop: - ldy #39 -cl_inner: - lda (EAL),y - sta (USER),y - lda (SAL),y - sta (PNT),y - dey - bpl cl_inner - - // Decrement all pointers by 40 - // Low bytes are in common pairs - - // Old source is new destination - // Use different registers to minimise byte similarity with C64 KERNAl - ldy SAL+1 - sty PNT+1 - lda EAL+1 - ldy SAL+0 - sta USER+1 - sty PNT+0 - sty USER+0 - - // Decrementing source pointers - lda SAL+0 - sec - sbc #<40 - sta SAL+0 - sta EAL+0 - lda SAL+1 - sbc #>40 - sta SAL+1 - // convert to screen equivalent - sec - sbc HIBASE - clc - adc #>$D800 - sta EAL+1 - - dex - bne copy_line_down_loop - -no_copy_down: - jsr calculate_screen_line_pointer - - // Erase newly inserted line - ldy #79 -!: - lda COLOR - sta (USER),y - lda #$20 - sta (PNT),y - dey - cpy #40 - bne !- - - rts not_last_line: rts @@ -607,6 +228,14 @@ link_copy: rts + + + + + + + + get_current_line_logical_length: ldy TBLX lda LDTBL,y @@ -663,138 +292,4 @@ screen_advance_to_next_line: !: jsr calculate_screen_line_pointer - jmp chrout_done - -add_40_to_screen_x: - lda PNTR - clc - adc #40 - sta PNTR - rts - -normalise_screen_x_y: - // Normalise X and Y values - - // If X < 0, then make X = X + 40 (or 80, if previous line is linked) -!: lda PNTR - bpl x_not_negative - dec TBLX - // Check that we didn't go backwards off the top of the screen - bpl !+ - lda #0 - sta TBLX - -!: jsr add_40_to_screen_x - - // Check if line is linked, if so, add 40 again - ldy TBLX - lda LDTBL,y - bpl !+ - jsr add_40_to_screen_x -!: - -x_not_negative: - // Work out if X is too big - ldy TBLX - lda LDTBL,y - bpl !+ - lda #79 - .byte $2C // BIT $nnnn, used to skip next instruction -!: lda #39 - cmp PNTR - bcs x_not_too_big - - // X value is too big, so subtract 40 and increment Y - lda PNTR - sec - sbc #40 - sta PNTR - inc TBLX - -x_not_too_big: - - // Make sure Y isn't negative - lda TBLX - bpl !+ - lda #0 - sta TBLX -!: - // Make sure Y isn't too large for absolute size of - // screen - cmp #24 - bcc !+ - lda #24 - sta TBLX -!: - // Make sure Y isn't too much for the screen, taking - // into account the line link table - ldy #24 // max allowable line - ldx #0 -link_count_loop: - lda LDTBL,x - bpl !+ - dey -!: inx - cpx #25 - bne link_count_loop - tya - cmp TBLX - bcs y_ok - sta TBLX -y_ok: - rts - -calculate_screen_line_pointer: - jsr normalise_screen_x_y - - // Reset pointer to start of screen - lda HIBASE - sta PNT+1 - lda #0 - sta PNT+0 - - // Add 40 for every line, or 80 if the lines are linked - ldx TBLX - -!: - // Stop if we have counted enough lines - beq !+ - - // Add 40 or 80 based on whether the line is linked - // or not. - ldy #40 - // -1 offset is because we count down from N to 1, not - // N-1 to 0. - lda LDTBL-1,x - bpl cslp_l1 - ldy #80 -cslp_l1: - // Add computed line length to pointer value - tya - clc - adc PNT+0 - sta PNT+0 - lda PNT+1 - adc #0 - sta PNT+1 - - // Loop back to next line - dex - jmp !- -!: - - // FALL THROUGH - -update_colour_line_pointer: - // Now setup pointer to colour RAM - lda PNT+0 - sta USER+0 - lda PNT+1 - sec - sbc HIBASE - clc - adc #>$d800 - sta USER+1 - - rts diff --git a/c64/kernal/screen/chrout_screen_control.s b/c64/kernal/screen/chrout_screen_control.s new file mode 100644 index 00000000..11bb2608 --- /dev/null +++ b/c64/kernal/screen/chrout_screen_control.s @@ -0,0 +1,206 @@ + +// +// CHROUT routine - screen support, control codes +// + +chrout_screen_control: + + txa + + // Order here is not random + // 1. First handle the ones that do not depend on quoote mode + // 2. Handle remaining control codes starting from the most commonly used + // in situations when speed might matter, we want to be + // as snappy as possible + +chrout_try_RETURN: + + cmp #$0D + bne !+ + + // RETURN clears quote and insert modes, it also clears reverse flag + lda #$00 + sta QTSW + sta INSRT + sta RVS + jmp screen_advance_to_next_line +!: +chrout_try_DEL: + + cmp #$14 + bne !+ + jmp chrout_screen_del +!: +chrout_try_quote: + + lda QTSW + ora INSRT + beq !+ + jmp chrout_screen_quote +!: + txa + +chrout_try_CRSR_UP: + + cmp #$91 + bne !+ + + lda PNTR + sec + sbc #40 + sta PNTR + jsr calculate_screen_line_pointer + jmp chrout_done +!: +chrout_try_CRSR_DOWN: + + cmp #$11 + bne !+ + + lda PNTR + clc + adc #40 + sta PNTR + // We need to advance the pointer manually, as normalising + // now will break things. The pointer update is required + // so that we can tell if we really are on the bottom phys + // screen line or not + jsr scroll_up_if_on_last_line + jsr calculate_screen_line_pointer + jmp chrout_done +!: +chrout_try_CRSR_LEFT: + + cmp #$9D + bne !+ + + lda TBLX + ora PNTR + beq chrout_screen_control_done // if top-left screen character + dec PNTR + jmp chrout_screen_control_calcptr_done +!: +chrout_try_CRSR_RIGHT: + + cmp #$1D + bne !+ + + inc PNTR + jsr calculate_screen_line_pointer + jmp chrout_done +!: +chrout_try_RVS_ON: + + cmp #$12 + bne !+ + + lda #$80 + sta RVS + bne chrout_screen_control_done // branch always +!: +chrout_try_RVS_OFF: + + cmp #$92 + bne !+ + + lda #$00 + sta RVS + beq chrout_screen_control_done // branch always +!: +chrout_try_MODE_TXT: + + cmp #$0E + bne !+ + + // XXX + + jmp chrout_done +!: +chrout_try_MODE_GFX: + + cmp #$8E + bne !+ + + // XXX + + jmp chrout_done +!: +chrout_try_COLOR: + + ldx #$0F +colour_check_loop: + cmp colour_codes,x + bne !+ + stx COLOR + jmp chrout_done +!: + dex + bpl colour_check_loop + +chrout_try_SHIFT_ENABLE: + + cmp #$09 + bne !+ + + // XXX + + jmp chrout_done +!: +chrout_try_SHIFT_DISABLE: + + cmp #$08 + bne !+ + + // XXX + + jmp chrout_done +!: +chrout_try_HOME: + + cmp #$13 + bne !+ + + // XXX try cursor_home instead + lda #$00 + sta PNTR + sta TBLX + beq chrout_screen_control_calcptr_done // branch always +!: +chrout_try_CLR: + + cmp #$93 + bne !+ + + jsr clear_screen + jmp chrout_done +!: +chrout_try_INS: + + cmp #$94 + bne !+ + + jmp chrout_screen_ins +!: +chrout_try_RUN_STOP: + + cmp #$03 + bne !+ + + // XXX + + jmp chrout_done +!: +chrout_try_FKEY: + + // XXX + + // FALLTROUGH + +chrout_screen_control_done: // unknown, LF, or no more actions required // XXX to !csc_done + + jmp chrout_done + +chrout_screen_control_calcptr_done: // XXX to !csc_calcptr_done + + jsr calculate_screen_line_pointer + jmp chrout_done diff --git a/c64/kernal/screen/chrout_screen_del.s b/c64/kernal/screen/chrout_screen_del.s new file mode 100644 index 00000000..7ef44b8b --- /dev/null +++ b/c64/kernal/screen/chrout_screen_del.s @@ -0,0 +1,63 @@ + +// +// CHROUT routine - screen support, DEL key handling +// + +chrout_screen_del: + + // In insert mode it embeds control character + ldx INSRT + beq !+ + jmp chrout_screen_quote +!: + ldx PNTR + bne chrout_screen_del_column_non_0 + + // FALLTROUGH + +chrout_screen_del_column_0: + + ldy TBLX + beq chrout_screen_del_done // delete from row 0, col 0 does nothing + + // Column 0 delete just moves us to the end of the + // previous line, without actually deleting anything + + dec TBLX + jsr get_current_line_logical_length + lda LNMX + sta PNTR + + jmp chrout_screen_control_calcptr_done + +chrout_screen_del_column_non_0: + + // Copy rest of line down + jsr get_current_line_logical_length + ldy PNTR + cpy LNMX + beq !++ + dey +!: + iny + lda (PNT),y + dey + sta (PNT),y + iny + lda (USER),y + dey + sta (USER),y + iny + cpy LNMX + bne !- + + // Clear char at end of line + jsr get_current_line_logical_length + tay + lda #$20 + sta (PNT),y +!: + dec PNTR + +chrout_screen_del_done: + jmp chrout_done diff --git a/c64/kernal/screen/chrout_screen_ins.s b/c64/kernal/screen/chrout_screen_ins.s new file mode 100644 index 00000000..a56b6a80 --- /dev/null +++ b/c64/kernal/screen/chrout_screen_ins.s @@ -0,0 +1,64 @@ + +// +// CHROUT routine - screen support, INS key handling +// + +chrout_screen_ins: + + // Insert (shift-DELETE) + + // Abort if line already max length, ie 79th char is not a space + jsr get_current_line_logical_length + cmp #79 + bne !+ + tay + lda (PNT),y + cmp #$20 + beq !+ + + // Line is too long to extend + jmp chrout_done + +!: + // Work out if line needs to be expanded, and if so expand it + ldy #39 + lda (PNT),y + cmp #$20 + beq !+ + + jsr screen_grow_logical_line + +!: + // Shuffle chars towards end of line + jsr get_current_line_logical_length + tay +!: + // Note: While the following routine is obvious to any skilled + // in the art as the most obvious simple and efficient solution, + // if the screen writes are before the colour writes, it results + // in a relatively long verbatim stretch of bytes when compared to + // the C64 KERNAL. Thus we have swapped the order, just to reduce + // the potential for any argument of copyright infringement, even + // though we really don't believe that the routine can be copyrighted + // due to the lack of creativity. + dey + lda (USER),y + iny + sta (USER),y + dey + lda (PNT),y + iny + sta (PNT),y + + dey + cpy PNTR + bne !- + + // Increase insert mode count (which causes quote-mode like behaviour) + inc INSRT + + // Put space in the inserted gap + lda #$20 + sta (PNT),y + + jmp chrout_done diff --git a/c64/kernal/screen/chrout_screen_quote.s b/c64/kernal/screen/chrout_screen_quote.s new file mode 100644 index 00000000..266f6d36 --- /dev/null +++ b/c64/kernal/screen/chrout_screen_quote.s @@ -0,0 +1,20 @@ + +// +// CHROUT routine - screen support, control codes in quote mode +// + + +chrout_screen_quote: + + // Low control codes are just +$80 + clc + adc #$80 + + // If it overflowed, then it is a high control code, + // so we need to make it be $80 + $40 + char + // as we will have flipped back to just $00 + char, we should + // now add $c0 if C is set from overflow + bcc !+ + adc #$BF // C=1, so adding $BF + C = add $C0 +!: + jmp output_literal_char diff --git a/c64/kernal/screen/screen_calculate_line_pointer.s b/c64/kernal/screen/screen_calculate_line_pointer.s new file mode 100644 index 00000000..de1aa1d3 --- /dev/null +++ b/c64/kernal/screen/screen_calculate_line_pointer.s @@ -0,0 +1,54 @@ + +calculate_screen_line_pointer: // XXX rename to screen_calculate_line_pointer + jsr screen_normalize_xy + + // Reset pointer to start of screen + lda HIBASE + sta PNT+1 + lda #0 + sta PNT+0 + + // Add 40 for every line, or 80 if the lines are linked + ldx TBLX + +!: + // Stop if we have counted enough lines + beq !+ + + // Add 40 or 80 based on whether the line is linked + // or not. + ldy #40 + // -1 offset is because we count down from N to 1, not + // N-1 to 0. + lda LDTBL-1,x + bpl cslp_l1 + ldy #80 +cslp_l1: + // Add computed line length to pointer value + tya + clc + adc PNT+0 + sta PNT+0 + lda PNT+1 + adc #0 + sta PNT+1 + + // Loop back to next line + dex + jmp !- +!: + + // FALLTHROUGH + +update_colour_line_pointer: + // Now setup pointer to colour RAM + lda PNT+0 + sta USER+0 + lda PNT+1 + sec + sbc HIBASE + clc + adc #>$d800 + sta USER+1 + + rts diff --git a/c64/kernal/screen/screen_grow_logical_line.s b/c64/kernal/screen/screen_grow_logical_line.s new file mode 100644 index 00000000..26bd5ac9 --- /dev/null +++ b/c64/kernal/screen/screen_grow_logical_line.s @@ -0,0 +1,122 @@ + +screen_grow_logical_line: + ldy TBLX + // Don't grow line if it is already grown + lda LDTBL,y + bpl !+ + jmp not_last_line // doneb grow line +!: + lda #$80 + sta LDTBL,y + + // Now make space for the extra line added. + // If we are on the last physical line of the screen, + // Then we need to scroll the screen up + jsr scroll_up_if_on_last_line + + // Scroll screen down to make space + // As we are scrolling down, we start from the end, + // and work backwards. We can't be as simple and efficient + // here as we are for scrolling up, because we don't know + // how much must be scrolled. + // Simple solution is to work out how many physical lines + // need shifting down, and then move lines at a time after + // initialising the pointers to the end area of the screen. + ldx #25-2 + ldy #0 +count_rows_loop: + dex + lda LDTBL,y + bpl !+ + dex +!: iny + cpy TBLX + bne count_rows_loop + + cpx #0 + beq no_copy_down + bmi no_copy_down + + // Set pointers to end of screen line, and one line + // above. (It is always one physical line, because + // this can only happen when expanding a line from 40 to + // 80 characters). + // XXX - This is not very efficient, and longer than it + // needs to be. Better would be to work out size to + // copy, and count it down in a pointer somewhere, so + // that loop iteration logic is simpler. + lda HIBASE + clc + adc #3 + sta PNT+1 + sta SAL+1 + lda #>$DBC0 + sta EAL+1 + sta USER+1 + + lda #<$03C0 + sta PNT+0 + sta USER+0 + // souce address is line above + sec + sbc #40 + sta SAL+0 + sta EAL+0 + +copy_line_down_loop: + ldy #39 +cl_inner: + lda (EAL),y + sta (USER),y + lda (SAL),y + sta (PNT),y + dey + bpl cl_inner + + // Decrement all pointers by 40 + // Low bytes are in common pairs + + // Old source is new destination + // Use different registers to minimise byte similarity with C64 KERNAl + ldy SAL+1 + sty PNT+1 + lda EAL+1 + ldy SAL+0 + sta USER+1 + sty PNT+0 + sty USER+0 + + // Decrementing source pointers + lda SAL+0 + sec + sbc #<40 + sta SAL+0 + sta EAL+0 + lda SAL+1 + sbc #>40 + sta SAL+1 + // convert to screen equivalent + sec + sbc HIBASE + clc + adc #>$D800 + sta EAL+1 + + dex + bne copy_line_down_loop + +no_copy_down: + jsr calculate_screen_line_pointer + + // Erase newly inserted line + ldy #79 +!: + lda COLOR + sta (USER),y + lda #$20 + sta (PNT),y + dey + cpy #40 + bne !- + + rts diff --git a/c64/kernal/screen/screen_normalize_xy.s b/c64/kernal/screen/screen_normalize_xy.s new file mode 100644 index 00000000..147895a4 --- /dev/null +++ b/c64/kernal/screen/screen_normalize_xy.s @@ -0,0 +1,82 @@ + +// +// Normalise X and Y values +// If X < 0, then make X = X + 40 (or 80, if previous line is linked) +// + +screen_normalize_xy: + + lda PNTR + bpl x_not_negative + dec TBLX + // Check that we didn't go backwards off the top of the screen + bpl !+ + lda #0 + sta TBLX + +!: jsr add_40_to_screen_x + + // Check if line is linked, if so, add 40 again + ldy TBLX + lda LDTBL,y + bpl !+ + jsr add_40_to_screen_x +!: + +x_not_negative: + // Work out if X is too big + ldy TBLX + lda LDTBL,y + bpl !+ + lda #79 + .byte $2C // BIT $nnnn, used to skip next instruction +!: lda #39 + cmp PNTR + bcs x_not_too_big + + // X value is too big, so subtract 40 and increment Y + lda PNTR + sec + sbc #40 + sta PNTR + inc TBLX + +x_not_too_big: + + // Make sure Y isn't negative + lda TBLX + bpl !+ + lda #0 + sta TBLX +!: + // Make sure Y isn't too large for absolute size of + // screen + cmp #24 + bcc !+ + lda #24 + sta TBLX +!: + // Make sure Y isn't too much for the screen, taking + // into account the line link table + ldy #24 // max allowable line + ldx #0 +link_count_loop: + lda LDTBL,x + bpl !+ + dey +!: inx + cpx #25 + bne link_count_loop + tya + cmp TBLX + bcs y_ok + sta TBLX +y_ok: + rts + +add_40_to_screen_x: + lda PNTR + clc + adc #40 + sta PNTR + rts From 20899a49d9d126ded5d566bc6aeed66be9c4ffdb Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 9 Oct 2019 20:06:53 +0200 Subject: [PATCH 23/85] simplified directory structure, updated configuration system --- CONFIG.md | 24 ++++- Makefile | 50 +++++------ c64/,,config_generic.s | 25 +++++- c64/,,config_mega65.s | 25 +++++- c64/,,config_ultimate64.s | 25 +++++- c64/aliases/,aliases_config.s | 69 ++++++++++++--- c64/aliases/,aliases_hardware.s | 7 +- c64/aliases/,aliases_ram_lowmem.s | 10 +-- c64/basic/,target_generic/,hooks_generic.s | 26 ------ c64/basic/,target_mega65/,hooks_mega65.s | 52 ----------- .../,target_ultimate64/,hooks_ultimate64.s | 26 ------ c64/basic/startup_banner.s | 88 ++++++++++++++++++- .../,aliases_ultimate64.s | 0 .../u64_load.s} | 0 c64/kernal/,target_generic/,hooks_generic.s | 6 -- c64/kernal/,target_mega65/,hooks_mega65.s | 6 -- .../,target_ultimate64/,hooks_ultimate64.s | 9 -- c64/kernal/f4a5.load.s | 3 - c64/kernal/{scnkey.s => scnkey_tww_ctr.s} | 7 ++ 19 files changed, 281 insertions(+), 177 deletions(-) delete mode 100644 c64/basic/,target_generic/,hooks_generic.s delete mode 100644 c64/basic/,target_mega65/,hooks_mega65.s delete mode 100644 c64/basic/,target_ultimate64/,hooks_ultimate64.s rename c64/kernal/{,target_ultimate64 => ,disabled}/,aliases_ultimate64.s (100%) rename c64/kernal/{,target_ultimate64/u64_load.s.disabled => ,disabled/u64_load.s} (100%) delete mode 100644 c64/kernal/,target_generic/,hooks_generic.s delete mode 100644 c64/kernal/,target_mega65/,hooks_mega65.s delete mode 100644 c64/kernal/,target_ultimate64/,hooks_ultimate64.s rename c64/kernal/{scnkey.s => scnkey_tww_ctr.s} (99%) diff --git a/CONFIG.md b/CONFIG.md index 26c426da..69dc2575 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -13,6 +13,26 @@ Note however, that features do not came for free - enabling them needs some addi Sane defaults are already present - different for each target. +## Hardware platform and variant + +### `CONFIG_PLATFORM_COMMODORE_64` + +Commodore 64 is the only hardware platform available now - and the main one, as the Open ROMs API is meant to be compatible with the Commodore 64. + +Since Open ROMs is highly modular, it should be possible to add other platforms in the future (like 8-bit Atari computers or Commander X16), if they share the following common characteristics: + +* MOS 6502 CPU or compatible +* 8KB ROM area `$A000`-`$BFFF` +* 8KB ROM area `$E000`-`$FFFF` + +### `CONFIG_VARIANT_GENERIC` + +If you don't know which variant to choose - select this one. + +### `CONFIG_VARIANT_MEGA_65`, `CONFIG_VARIANT_ULTIMATE_64` + +Select if you are using appropriate motherboard. + ## Processor instruction set ### `CONFIG_CPU_MOS_6502` @@ -44,7 +64,7 @@ Choose if your CPU supports the 16-bit Western Design Center 65816 instruction s It enables some speed/size code optimizations. Warning - this is untested! -## Memory models +## Memory model Different layouts of memory are possible - but they can be selected at compile time only. @@ -80,7 +100,7 @@ Cause the system to support SIDs in `$D4xx` and `$D5xx` ranges, respectively. Each of them needs a couple of bytes in KERNAL segment - but they can share some code, and `$D4xx` range support replaces the standard `$D400` address handling, so exact amount depends on the exact configuration. -## Miscelaneous features +## Software features ### `CONFIG_BANNER_FANCY` diff --git a/Makefile b/Makefile index bd47fec9..d73f87c5 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,17 @@ # Source files -SRCDIR_COMMON = c64/aliases -SRCDIR_BASIC_COMMON = $(SRCDIR_COMMON) c64/basic -SRCDIR_KERNAL_COMMON = $(SRCDIR_COMMON) c64/kernal c64/kernal/assets c64/kernal/jumptable c64/kernal/iec c64/kernal/interrupts c64/kernal/print c64/kernal/screen - -SRCDIR_BASIC_generic = $(SRCDIR_BASIC_COMMON) c64/basic/,target_generic -SRCDIR_BASIC_mega65 = $(SRCDIR_BASIC_COMMON) c64/basic/,target_mega65 -SRCDIR_BASIC_ultimate64 = $(SRCDIR_BASIC_COMMON) c64/basic/,target_ultimate64 - -SRCDIR_KERNAL_generic = $(SRCDIR_KERNAL_COMMON) c64/kernal/,target_generic -SRCDIR_KERNAL_mega65 = $(SRCDIR_KERNAL_COMMON) c64/kernal/,target_mega65 -SRCDIR_KERNAL_ultimate64 = $(SRCDIR_KERNAL_COMMON) c64/kernal/,target_ultimate64 +SRCDIR_COMMON = c64/aliases +SRCDIR_BASIC = $(SRCDIR_COMMON) \ + c64/basic +SRCDIR_KERNAL = $(SRCDIR_COMMON) \ + c64/kernal \ + c64/kernal/assets \ + c64/kernal/jumptable \ + c64/kernal/iec \ + c64/kernal/interrupts \ + c64/kernal/print \ + c64/kernal/screen SRC_TOOLS = $(wildcard src/tools/*.c,src/tools/*.cc) @@ -94,30 +94,30 @@ build/chargen.rom: $(TOOL_PNGPREPARE) assets/8x8font.png # Dependencies - BASIC and KERNAL build/target_generic/OUTB.BIN build/target_generic/BASIC_combined.vs: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC_generic) \ + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC) \ c64/,,config_generic.s build/target_generic/KERNAL_combined.sym \ - $(foreach dir,$(SRCDIR_BASIC_generic),$(wildcard $(dir)/*.s)) + $(foreach dir,$(SRCDIR_BASIC),$(wildcard $(dir)/*.s)) build/target_mega65/OUTB.BIN build/target_mega65/BASIC_combined.vs: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC_mega65) \ + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC) \ c64/,,config_mega65.s build/target_mega65/KERNAL_combined.sym \ - $(foreach dir,$(SRCDIR_BASIC_mega65),$(wildcard $(dir)/*.s)) + $(foreach dir,$(SRCDIR_BASIC),$(wildcard $(dir)/*.s)) build/target_ultimate64/OUTB.BIN build/target_ultimate64/BASIC_combined.vs: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC_ultimate64) \ + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC) \ c64/,,config_ultimate64.s build/target_ultimate64/KERNAL_combined.sym \ - $(foreach dir,$(SRCDIR_BASIC_ultimate64),$(wildcard $(dir)/*.s)) + $(foreach dir,$(SRCDIR_BASIC),$(wildcard $(dir)/*.s)) build/target_generic/OUTK.BIN build/target_generic/KERNAL_combined.vs build/target_generic/KERNAL_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL_generic) \ + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL) \ c64/,,config_generic.s \ - $(foreach dir,$(SRCDIR_KERNAL_generic),$(wildcard $(dir)/*.s)) + $(foreach dir,$(SRCDIR_KERNAL),$(wildcard $(dir)/*.s)) build/target_mega65/OUTK.BIN build/target_mega65/KERNAL_combined.vs build/target_mega65/KERNAL_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL_mega65) \ + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL) \ c64/,,config_mega65.s \ - $(foreach dir,$(SRCDIR_KERNAL_mega65),$(wildcard $(dir)/*.s)) + $(foreach dir,$(SRCDIR_KERNAL),$(wildcard $(dir)/*.s)) build/target_ultimate64/OUTK.BIN build/target_ultimate64/KERNAL_combined.vs build/target_ultimate64/KERNAL_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL_ultimate64) \ + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL) \ c64/,,config_ultimate64.s \ - $(foreach dir,$(SRCDIR_KERNAL_ultimate64),$(wildcard $(dir)/*.s)) + $(foreach dir,$(SRCDIR_KERNAL),$(wildcard $(dir)/*.s)) build/target_generic/newrom: build/target_generic/OUTB.BIN build/target_generic/OUTK.BIN build/target_mega65/newrom: build/target_mega65/OUTB.BIN build/target_mega65/OUTK.BIN @@ -145,13 +145,13 @@ build/,generated/packed_messages.s: $(TOOL_COMPRESS_TEXT) build/target_%/OUTB.BIN build/target_%/BASIC_combined.vs: @mkdir -p build/target_$* @rm -f $@* build/target_$*/BASIC* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -s BASIC -i BASIC-$* -o OUTB.BIN -d build/target_$* -l a000 -h e4d2 c64/,,config_$*.s $(SRCDIR_BASIC_$*) $(GEN_BASIC) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -s BASIC -i BASIC-$* -o OUTB.BIN -d build/target_$* -l a000 -h e4d2 c64/,,config_$*.s $(SRCDIR_BASIC) $(GEN_BASIC) .PRECIOUS: build/target_%/OUTK.BIN build/target_%/KERNAL_combined.vs build/target_%/KERNAL_combined.sym build/target_%/OUTK.BIN build/target_%/KERNAL_combined.vs build/target_%/KERNAL_combined.sym: @mkdir -p build/target_$* @rm -f $@* build/target_$*/KERNAL* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -s KERNAL -i KERNAL-$* -o OUTK.BIN -d build/target_$* -l e4d3 -h ffff c64/,,config_$*.s $(SRCDIR_KERNAL_$*) $(GEN_KERNAL) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -s KERNAL -i KERNAL-$* -o OUTK.BIN -d build/target_$* -l e4d3 -h ffff c64/,,config_$*.s $(SRCDIR_KERNAL) $(GEN_KERNAL) .PRECIOUS: build/target_%/newrom build/target_%/newrom: diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 11c29f43..d8c319e2 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -4,13 +4,30 @@ // +// Hardware platform and variant + +#define CONFIG_PLATFORM_COMMODORE_64 + +#define CONFIG_VARIANT_GENERIC +// #define CONFIG_VARIANT_MEGA_65 +// #define CONFIG_VARIANT_ULTIMATE_64 + + +// Processor instruction set + #define CONFIG_CPU_MOS_6502 // #define CONFIG_CPU_WDC_65C02 // #define CONFIG_CPU_WDC_65816 + +// Memory model + #define CONFIG_MEMORY_MODEL_38K // #define CONFIG_MEMORY_MODEL_60K + +// Multiple SID support + // #define CONFIG_SID_2ND .const CONFIG_SID_2ND_ADDRESS = $D420 @@ -20,11 +37,17 @@ // #define CONFIG_SID_D4XX // #define CONFIG_SID_D5XX + +// Software features + #define CONFIG_BANNER_FANCY #define CONFIG_BANNER_PAL_NTSC #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS -#define CONFIG_EXTENDED_SCNKEY // for now has to be enabled +#define CONFIG_SCNKEY_TWW_CTR // for now has to be enabled + + +// Debug options // #define CONFIG_DBG_STUBS_BRK // #define CONFIG_DBG_PRINTF diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 8466b5ff..fca49f1d 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -4,13 +4,30 @@ // +// Hardware platform and variant + +#define CONFIG_PLATFORM_COMMODORE_64 + +// #define CONFIG_VARIANT_GENERIC +#define CONFIG_VARIANT_MEGA_65 +// #define CONFIG_VARIANT_ULTIMATE_64 + + +// Processor instruction set + #define CONFIG_CPU_MOS_6502 // #define CONFIG_CPU_WDC_65C02 // #define CONFIG_CPU_WDC_65816 + +// Memory model configuration + // #define CONFIG_MEMORY_MODEL_38K #define CONFIG_MEMORY_MODEL_60K + +// Multiple SID support + #define CONFIG_SID_2ND .const CONFIG_SID_2ND_ADDRESS = $D420 @@ -20,11 +37,17 @@ // #define CONFIG_SID_D4XX // #define CONFIG_SID_D5XX + +// Software features + #define CONFIG_BANNER_FANCY #define CONFIG_BANNER_PAL_NTSC #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS -#define CONFIG_EXTENDED_SCNKEY // for now has to be enabled +#define CONFIG_SCNKEY_TWW_CTR // for now has to be enabled + + +// Debug options // #define CONFIG_DBG_STUBS_BRK // #define CONFIG_DBG_PRINTF diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index 3e63e6a1..5631c865 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -4,13 +4,30 @@ // +// Hardware platform and variant + +#define CONFIG_PLATFORM_COMMODORE_64 + +// #define CONFIG_VARIANT_GENERIC +// #define CONFIG_VARIANT_MEGA_65 +#define CONFIG_VARIANT_ULTIMATE_64 + + +// Processor instruction set + #define CONFIG_CPU_MOS_6502 // #define CONFIG_CPU_WDC_65C02 // #define CONFIG_CPU_WDC_65816 + +// Memory model configuration + #define CONFIG_MEMORY_MODEL_38K // #define CONFIG_MEMORY_MODEL_60K + +// Multiple SID support + // #define CONFIG_SID_2ND .const CONFIG_SID_2ND_ADDRESS = $D420 @@ -20,11 +37,17 @@ #define CONFIG_SID_D4XX #define CONFIG_SID_D5XX + +// Software features + #define CONFIG_BANNER_FANCY #define CONFIG_BANNER_PAL_NTSC #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS -#define CONFIG_EXTENDED_SCNKEY // for now has to be enabled +#define CONFIG_SCNKEY_TWW_CTR // for now has to be enabled + + +// Debug options // #define CONFIG_DBG_STUBS_BRK // #define CONFIG_DBG_PRINTF diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index 868fc670..ea8a5d0d 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -1,26 +1,52 @@ - // Various configuration dependent aliases/macros/checks +// +// Various configuration dependent aliases/macros/checks +// - // Check that memory model configuration is correct +// Check that platform configuration is correct { .var selected = 0; -#if CONFIG_MEMORY_MODEL_38K - .eval selected++ -#endif -#if CONFIG_MEMORY_MODEL_60K +#if CONFIG_PLATFORM_COMMODORE_64 .eval selected++ #endif - .if (selected != 1) .error "Please select exactly one CONFIG_MEMORY_MODEL_* option" + .if (selected != 1) .error "Please select exactly one CONFIG_PLATFORM_* option" } - // Check that processor configuration is correct +// Check that platform variant configuration is correct + +{ + .var selected = 0; + +#if CONFIG_VARIANT_GENERIC + .eval selected++ +#endif +#if CONFIG_VARIANT_MEGA_65 + .eval selected++ +#endif +#if CONFIG_VARIANT_ULTIMATE_64 + .eval selected++ +#endif + + .if (selected != 1) .error "Please select exactly one CONFIG_VARIANT_* option" + +#if !CONFIG_PLATFORM_COMMODORE_64 && CONFIG_VARIANT_MEGA_65 && + .error "CONFIG_VARIANT_MEGA_65 can only be used with CONFIG_PLATFORM_COMMODORE_64" +#endif +#if !CONFIG_PLATFORM_COMMODORE_64 && CONFIG_VARIANT_ULTIMATE_64 && + .error "CONFIG_VARIANT_ULTIMATE_64 can only be used with CONFIG_PLATFORM_COMMODORE_64" +#endif +} + + + +// Check that processor configuration is correct { .var selected = 0; @@ -40,7 +66,24 @@ - // Handle processor configuration +// Check that memory model configuration is correct + +{ + .var selected = 0; + +#if CONFIG_MEMORY_MODEL_38K + .eval selected++ +#endif +#if CONFIG_MEMORY_MODEL_60K + .eval selected++ +#endif + + .if (selected != 1) .error "Please select exactly one CONFIG_MEMORY_MODEL_* option" +} + + + +// Handle processor configuration #if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 @@ -54,13 +97,17 @@ #endif - // Handle misc configuration entrues + + +// Handle configuration of various features #if CONFIG_BCD_SAFE_INTERRUPTS #define HAS_BCD_SAFE_INTERRUPTS #endif - // Stub configuration + + +// Handle configuration of debug infrastructure .macro STUB_IMPLEMENTATION_RTS() { rts diff --git a/c64/aliases/,aliases_hardware.s b/c64/aliases/,aliases_hardware.s index 73abfd8c..5d3dc91b 100644 --- a/c64/aliases/,aliases_hardware.s +++ b/c64/aliases/,aliases_hardware.s @@ -1,8 +1,11 @@ // -// Names of hardware registers - slightly modified names from C64 Programmer's Reference Guide +// Names of hardware registers - names from C64 Programmer's Reference Guide, sometimes slightly modified // + +#if CONFIG_PLATFORM_COMMODORE_64 + // CPU memory registers .label CPU_D6510 = $00 @@ -154,3 +157,5 @@ .const BIT_CIA2_PRA_DAT_OUT = $20 // 1 - low (pulled), 0 - high (released) .const BIT_CIA2_PRA_CLK_IN = $40 // 0 - low (pulled), 1 - high (released) .const BIT_CIA2_PRA_DAT_IN = $80 // 0 - low (pulled), 1 - high (released) + +#endif diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index bc391aae..a7fa7f02 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -105,7 +105,7 @@ .label BUFPNT = $A6 // -- NOT IMPLEMENTED -- .label INBIT = $A7 // -- NOT IMPLEMENTED -- -#if CONFIG_EXTENDED_SCNKEY +#if CONFIG_SCNKEY_TWW_CTR // Reuse RS232 variables, since they should not be used by other things. // Carefully avoid $A7 which is used by 64NET @@ -125,7 +125,7 @@ .label CMP0 = $B0 // $B0-$B1 temporary tape storage, [!] here used for BRK instruction address .label TAPE1 = $B2 // $B2-$B3 tape buffer pointer -#if CONFIG_EXTENDED_SCNKEY +#if CONFIG_SCNKEY_TWW_CTR // Reuse RS232 variables, since they should not be used by other things. // This one should be initialized in cinit to $FF @@ -139,7 +139,7 @@ .label NXTBIT = $B5 // -- NOT IMPLEMENTED -- -#if CONFIG_EXTENDED_SCNKEY +#if CONFIG_SCNKEY_TWW_CTR // Reuse RS232 variables, since they should not be used by other things. // Carefully avoiding $A7 which is used by 64NET @@ -200,7 +200,7 @@ .label BUF = $200 // $200-$250, BASIC line editor input buffer (81 bytes) -#if CONFIG_EXTENDED_SCNKEY +#if CONFIG_SCNKEY_TWW_CTR // $250-$258 is the 81st - 88th characters in BASIC input, a carry over from VIC-20 // and not used on C64, so safe for us to use, probably. @@ -229,7 +229,7 @@ .label MODE = $291 // flag, is case switch allowed .label AUTODN = $292 // -- NOT IMPLEMENTED -- screen scroll disable -#if CONFIG_EXTENDED_SCNKEY +#if CONFIG_SCNKEY_TWW_CTR // Reuse RS232 variables, since they should not be used by other things. // This one should be initialized in cinit to $FF diff --git a/c64/basic/,target_generic/,hooks_generic.s b/c64/basic/,target_generic/,hooks_generic.s deleted file mode 100644 index 6c6fc033..00000000 --- a/c64/basic/,target_generic/,hooks_generic.s +++ /dev/null @@ -1,26 +0,0 @@ - -// Target-specific hooks - - -.macro TARGET_HOOK_BANNER() { - -#if CONFIG_BANNER_FANCY - - .byte $1C, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $92, $0D - .byte $9E, $12, $A4, $A4, $A4, $A4, $A4, $A4, $92, $05, $20 - .text " OPEN ROMS GENERIC BUILD" - .byte $0D - .byte $1E, $12, $A4, $A4, $A4, $A4, $A4, $92, $0D - .byte $9F, $12, $A4, $A4, $A4, $A4, $92, $20, $05, $20, $20 - .text " " - -#else - - .text " OPEN ROMS GENERIC BUILD" - .byte $0D, $0D - .text " " - -#endif - - .byte $00 // end of banner -} diff --git a/c64/basic/,target_mega65/,hooks_mega65.s b/c64/basic/,target_mega65/,hooks_mega65.s deleted file mode 100644 index 4bb36fc2..00000000 --- a/c64/basic/,target_mega65/,hooks_mega65.s +++ /dev/null @@ -1,52 +0,0 @@ - -// Target-specific hooks - - -.macro TARGET_HOOK_BANNER() { - -#if CONFIG_BANNER_FANCY - - // New banner from Retrofan - .byte $9a, $12, $20, $20, $7f, $a9, $20, $20, $1f, $20, $9a, $20, $20, $20 - .byte $20, $1f, $20, $9a, $a9, $20, $20, $20, $92, $a1, $1f, $12, $20, $9a, $a9, $20 - .byte $20, $20, $7f, $1f, $20, $20, $9a, $a3, $a3, $a3, $a3, $a3, $a3, $a3, $1f, $20 - .byte $20, $20, $20, $05, $92, $4d, $45, $47, $41, $9a, $12, $20, $20, $20, $20, $20 - .byte $20, $1f, $20, $9a, $20, $20, $92, $a2, $bb, $1f, $12, $20, $9a, $20, $20, $92 - .byte $ac, $a2, $a2, $1f, $12, $20, $9a, $20, $20, $1f, $20, $9a, $20, $20, $1f, $20 - .byte $20, $1e, $a3, $a3, $a3, $a3, $a3, $a3, $1f, $20, $20, $20, $20, $05, $92, $42 - .byte $41, $53, $49, $43, $9a, $12, $20, $20, $92, $7f, $a9, $12, $20, $20, $1f, $20 - .byte $9a, $20, $20, $a2, $92, $be, $1f, $12, $20, $9a, $20, $20, $92, $bc, $12, $20 - .byte $20, $1f, $20, $9a, $20, $20, $20, $20, $20, $1f, $20, $20, $9e, $a3, $a3, $a3 - .byte $a3, $a3, $1f, $20, $20, $20, $20, $05, $92, $2d, $2d, $2d, $2d, $2d, $2d, $9a - .byte $12, $20, $20, $1f, $20, $20, $9a, $20, $20, $1f, $20, $9a, $20, $20, $20, $20 - .byte $1f, $20, $9a, $20, $20, $20, $20, $20, $1f, $20, $9a, $20, $20, $1f, $20, $9a - .byte $20, $20, $1f, $20, $20, $96, $a3, $a3, $a3, $a3, $1f - .byte $92, $0D, $0D, $05 - - // Original Deft-supplied banner - // .byte $9A,$12,$A3,$A3,$A3,$A3,$A3,$A3,$DF,$9B,$92,$20,$05,$12,$A0,$A0 - // .byte $DF,$9B,$92,$20,$05,$12,$A0,$A0,$DF,$9B,$92,$20,$05,$12,$A0,$A0 - // .byte $DF,$9B,$92,$20,$05,$12,$A0,$A0,$DF,$9A,$92,$20,$05,$20,$20,$20 - // .byte $4D,$20,$45,$20,$47,$20,$41,$0D,$99,$12,$A3,$A3,$A3,$A3,$A3,$A3 - // .byte $A3,$DF,$92,$7F,$12,$CD,$CD,$DF,$92,$7F,$12,$DF,$05,$92,$20,$20 - // .byte $99,$7F,$12,$DF,$05,$92,$20,$20,$99,$7F,$12,$DF,$92,$7F,$12,$DF - // .byte $05,$92,$20,$20,$99,$42,$20,$41,$20,$53,$20,$49,$20,$43,$0D,$9E - // .byte $12,$A3,$A3,$A3,$A3,$A3,$A3,$A3,$A3,$DF,$9B,$92,$7F,$12,$DF,$92 - // .byte $7F,$12,$DF,$92,$7F,$12,$CD,$05,$92,$20,$20,$9B,$7F,$12,$CD,$92 - // .byte $7F,$12,$DF,$92,$7F,$12,$CD,$92,$7F,$12,$DF,$9A,$92,$20,$05,$20 - // .byte $9A,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$0D,$96,$12,$A3,$A3,$A3,$A3,$A3 - // .byte $A3,$A3,$A3,$A3,$DF,$9A,$92,$7F,$12,$DF,$92,$7F,$9B,$20,$9A,$7F - // .byte $12,$A0,$A0,$9B,$92,$20,$9A,$7F,$12,$A0,$A0,$9B,$92,$20,$9A,$7F - // .byte $12,$DF,$92,$7F,$9B,$20,$9A,$20,$9B,"0.2.0.0",$0D - // .byte $0D,$05,$92 - -#else - - .text " OPEN ROMS FOR MEGA65" - .byte $0D, $0D - .text " " - -#endif - - .byte $00 // end of banner -} diff --git a/c64/basic/,target_ultimate64/,hooks_ultimate64.s b/c64/basic/,target_ultimate64/,hooks_ultimate64.s deleted file mode 100644 index 05c8d324..00000000 --- a/c64/basic/,target_ultimate64/,hooks_ultimate64.s +++ /dev/null @@ -1,26 +0,0 @@ - -// Target-specific hooks - - -.macro TARGET_HOOK_BANNER() { - -#if CONFIG_BANNER_FANCY - - .byte $1C, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $92, $0D - .byte $9E, $12, $A4, $A4, $A4, $A4, $A4, $A4, $92, $05, $20 - .text " OPEN ROMS FOR ULTIMATE 64" - .byte $0D - .byte $1E, $12, $A4, $A4, $A4, $A4, $A4, $92, $0D - .byte $9F, $12, $A4, $A4, $A4, $A4, $92, $20, $05, $20, $20 - .text " " - -#else - - .text " OPEN ROMS FOR ULTIMATE 64" - .byte $0D, $0D - .text " " - -#endif - - .byte $00 // end of banner -} diff --git a/c64/basic/startup_banner.s b/c64/basic/startup_banner.s index 957ab11d..3e099df4 100644 --- a/c64/basic/startup_banner.s +++ b/c64/basic/startup_banner.s @@ -1,7 +1,91 @@ // -// Startup banner, to be displayed durin cold start +// Startup banner, to be displayed during cold start // + +.macro BANNER_TEXT() { + +#if CONFIG_VARIANT_GENERIC + .text "OPEN ROMS GENERIC BUILD" +#elif CONFIG_VARIANT_MEGA_65 + .text "OPEN ROMS FOR MEGA65" +#elif CONFIG_VARIANT_ULTIMATE_64 + .text "OPEN ROMS FOR ULTIMATE 64" +#endif + +} + + startup_banner: - TARGET_HOOK_BANNER() + + +#if !CONFIG_BANNER_FANCY + + // Simple banner + + .text " " + BANNER_TEXT() + .byte $0D, $0D + .text " " + +#endif + + +#if CONFIG_BANNER_FANCY && !CONFIG_VARIANT_MEGA_65 + + // Fancy banner + + .byte $1C, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $92, $0D + .byte $9E, $12, $A4, $A4, $A4, $A4, $A4, $A4, $92, $05, $20 + .text " " + BANNER_TEXT() + .byte $0D + .byte $1E, $12, $A4, $A4, $A4, $A4, $A4, $92, $0D + .byte $9F, $12, $A4, $A4, $A4, $A4, $92, $20, $05, $20, $20 + .text " " + +#endif + + +#if CONFIG_BANNER_FANCY && CONFIG_VARIANT_MEGA_65 + + // Fancy Mega65 banner - from Retrofan + .byte $9a, $12, $20, $20, $7f, $a9, $20, $20, $1f, $20, $9a, $20, $20, $20 + .byte $20, $1f, $20, $9a, $a9, $20, $20, $20, $92, $a1, $1f, $12, $20, $9a, $a9, $20 + .byte $20, $20, $7f, $1f, $20, $20, $9a, $a3, $a3, $a3, $a3, $a3, $a3, $a3, $1f, $20 + .byte $20, $20, $20, $05, $92, $4d, $45, $47, $41, $9a, $12, $20, $20, $20, $20, $20 + .byte $20, $1f, $20, $9a, $20, $20, $92, $a2, $bb, $1f, $12, $20, $9a, $20, $20, $92 + .byte $ac, $a2, $a2, $1f, $12, $20, $9a, $20, $20, $1f, $20, $9a, $20, $20, $1f, $20 + .byte $20, $1e, $a3, $a3, $a3, $a3, $a3, $a3, $1f, $20, $20, $20, $20, $05, $92, $42 + .byte $41, $53, $49, $43, $9a, $12, $20, $20, $92, $7f, $a9, $12, $20, $20, $1f, $20 + .byte $9a, $20, $20, $a2, $92, $be, $1f, $12, $20, $9a, $20, $20, $92, $bc, $12, $20 + .byte $20, $1f, $20, $9a, $20, $20, $20, $20, $20, $1f, $20, $20, $9e, $a3, $a3, $a3 + .byte $a3, $a3, $1f, $20, $20, $20, $20, $05, $92, $2d, $2d, $2d, $2d, $2d, $2d, $9a + .byte $12, $20, $20, $1f, $20, $20, $9a, $20, $20, $1f, $20, $9a, $20, $20, $20, $20 + .byte $1f, $20, $9a, $20, $20, $20, $20, $20, $1f, $20, $9a, $20, $20, $1f, $20, $9a + .byte $20, $20, $1f, $20, $20, $96, $a3, $a3, $a3, $a3, $1f + .byte $92, $0D, $0D, $05 + + // Original Mega65 banner - supplied by Deft + // .byte $9A,$12,$A3,$A3,$A3,$A3,$A3,$A3,$DF,$9B,$92,$20,$05,$12,$A0,$A0 + // .byte $DF,$9B,$92,$20,$05,$12,$A0,$A0,$DF,$9B,$92,$20,$05,$12,$A0,$A0 + // .byte $DF,$9B,$92,$20,$05,$12,$A0,$A0,$DF,$9A,$92,$20,$05,$20,$20,$20 + // .byte $4D,$20,$45,$20,$47,$20,$41,$0D,$99,$12,$A3,$A3,$A3,$A3,$A3,$A3 + // .byte $A3,$DF,$92,$7F,$12,$CD,$CD,$DF,$92,$7F,$12,$DF,$05,$92,$20,$20 + // .byte $99,$7F,$12,$DF,$05,$92,$20,$20,$99,$7F,$12,$DF,$92,$7F,$12,$DF + // .byte $05,$92,$20,$20,$99,$42,$20,$41,$20,$53,$20,$49,$20,$43,$0D,$9E + // .byte $12,$A3,$A3,$A3,$A3,$A3,$A3,$A3,$A3,$DF,$9B,$92,$7F,$12,$DF,$92 + // .byte $7F,$12,$DF,$92,$7F,$12,$CD,$05,$92,$20,$20,$9B,$7F,$12,$CD,$92 + // .byte $7F,$12,$DF,$92,$7F,$12,$CD,$92,$7F,$12,$DF,$9A,$92,$20,$05,$20 + // .byte $9A,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$0D,$96,$12,$A3,$A3,$A3,$A3,$A3 + // .byte $A3,$A3,$A3,$A3,$DF,$9A,$92,$7F,$12,$DF,$92,$7F,$9B,$20,$9A,$7F + // .byte $12,$A0,$A0,$9B,$92,$20,$9A,$7F,$12,$A0,$A0,$9B,$92,$20,$9A,$7F + // .byte $12,$DF,$92,$7F,$9B,$20,$9A,$20,$9B,"0.2.0.0",$0D + // .byte $0D,$05,$92 + +#endif + + + + .byte $00 // end of banner diff --git a/c64/kernal/,target_ultimate64/,aliases_ultimate64.s b/c64/kernal/,disabled/,aliases_ultimate64.s similarity index 100% rename from c64/kernal/,target_ultimate64/,aliases_ultimate64.s rename to c64/kernal/,disabled/,aliases_ultimate64.s diff --git a/c64/kernal/,target_ultimate64/u64_load.s.disabled b/c64/kernal/,disabled/u64_load.s similarity index 100% rename from c64/kernal/,target_ultimate64/u64_load.s.disabled rename to c64/kernal/,disabled/u64_load.s diff --git a/c64/kernal/,target_generic/,hooks_generic.s b/c64/kernal/,target_generic/,hooks_generic.s deleted file mode 100644 index 84c261a2..00000000 --- a/c64/kernal/,target_generic/,hooks_generic.s +++ /dev/null @@ -1,6 +0,0 @@ - -// Target-specific hooks - - -.macro TARGET_HOOK_LOAD() { -} diff --git a/c64/kernal/,target_mega65/,hooks_mega65.s b/c64/kernal/,target_mega65/,hooks_mega65.s deleted file mode 100644 index 84c261a2..00000000 --- a/c64/kernal/,target_mega65/,hooks_mega65.s +++ /dev/null @@ -1,6 +0,0 @@ - -// Target-specific hooks - - -.macro TARGET_HOOK_LOAD() { -} diff --git a/c64/kernal/,target_ultimate64/,hooks_ultimate64.s b/c64/kernal/,target_ultimate64/,hooks_ultimate64.s deleted file mode 100644 index efc1f52f..00000000 --- a/c64/kernal/,target_ultimate64/,hooks_ultimate64.s +++ /dev/null @@ -1,9 +0,0 @@ - -// Target-specific hooks - - -.macro TARGET_HOOK_LOAD() { - // XXX disabled for now - the current file opening API is not - // really suitable for easy usage from Kernal - // jsr u64_load -} diff --git a/c64/kernal/f4a5.load.s b/c64/kernal/f4a5.load.s index e1cccc1d..76307dc6 100644 --- a/c64/kernal/f4a5.load.s +++ b/c64/kernal/f4a5.load.s @@ -36,9 +36,6 @@ LOAD: jsr install_ram_routines #endif - // Allow platform-specific routine to takeover the flow - TARGET_HOOK_LOAD() - // Check whether we support the requested device lda FA and #$FC diff --git a/c64/kernal/scnkey.s b/c64/kernal/scnkey_tww_ctr.s similarity index 99% rename from c64/kernal/scnkey.s rename to c64/kernal/scnkey_tww_ctr.s index ac22a7ca..899ecf94 100644 --- a/c64/kernal/scnkey.s +++ b/c64/kernal/scnkey_tww_ctr.s @@ -8,6 +8,10 @@ // CPU registers that has to be preserved (see [RG64]): none // + +#if CONFIG_SCNKEY_TWW_CTR + + // Scan the keyboard.. // Here we don't use the horrible buggy original routine, // not just because of copyright. Instead, we use the @@ -513,3 +517,6 @@ KeyCanRepeat: KeyRepeatWait: pla jmp ConsiderNextKey + + +#endif // #if CONFIG_SCNKEY_TWW_CTR From e53dcaf3453bf39f5e65695bed3336cf585c5bc2 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 9 Oct 2019 20:53:42 +0200 Subject: [PATCH 24/85] reached target granularity in screen code --- CONFIG.md | 6 +- c64/kernal/chrin_real.s | 2 +- c64/kernal/chrout_screen.s | 295 ------------------ c64/kernal/e50a.plot.s | 2 +- c64/kernal/f1ca.chrout.s | 27 ++ c64/kernal/screen/chrout_screen.s | 108 +++++++ c64/kernal/screen/chrout_screen_control.s | 10 +- c64/kernal/screen/chrout_screen_del.s | 6 +- c64/kernal/screen/chrout_screen_ins.s | 4 +- c64/kernal/screen/cursor.s | 2 +- c64/kernal/screen/cursor_home.s | 2 +- .../screen/screen_advance_to_next_line.s | 47 +++ .../screen/screen_calculate_line_pointer.s | 6 +- .../screen_get_current_line_logical_length.s | 11 + c64/kernal/screen/screen_grow_logical_line.s | 4 +- .../screen/screen_scroll_up_if_on_last_line.s | 115 +++++++ .../screen_set_pointer_to_current_line.s} | 11 +- 17 files changed, 335 insertions(+), 323 deletions(-) delete mode 100644 c64/kernal/chrout_screen.s create mode 100644 c64/kernal/screen/chrout_screen.s create mode 100644 c64/kernal/screen/screen_advance_to_next_line.s create mode 100644 c64/kernal/screen/screen_get_current_line_logical_length.s create mode 100644 c64/kernal/screen/screen_scroll_up_if_on_last_line.s rename c64/kernal/{set_pointer_to_current_screen_line.s => screen/screen_set_pointer_to_current_line.s} (85%) diff --git a/CONFIG.md b/CONFIG.md index 69dc2575..5d09de23 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -1,7 +1,7 @@ # Configuring the build -It's not possible to provide ROM builds that suit everyone needs - therefore configuration files were introduced, separately for each of the hardware targets: +It's not possible to provide ROM builds that suit everyone needs - therefore configuration files were introduced, few predefined configurations are provided with sane defaults: * [`c64/,,config_generic.s`](c64/,,config_generic.s) * [`c64/,,config_mega65.s`](c64/,,config_mega65.s) @@ -11,8 +11,6 @@ Just edit them and recompile the project. To enable particular option - uncommen Note however, that features do not came for free - enabling them needs some additional ROM space (in BASIC segment, in KERNAL segment, or in both), which is VERY limited on the target machines. Some options might be unavailable for speecific targets - read the comments in the configuration files. Some options might also carry compatibility and/or performance hit - so choose wisely. -Sane defaults are already present - different for each target. - ## Hardware platform and variant ### `CONFIG_PLATFORM_COMMODORE_64` @@ -136,4 +134,4 @@ Replaces `RTS` stubbed routines implementation with one causing a break. ### `CONFIG_DBG_PRINTF` -Makes 'printf' routine available. +Makes `printf` routine available. diff --git a/c64/kernal/chrin_real.s b/c64/kernal/chrin_real.s index 4d1a3a87..cf7f54f6 100644 --- a/c64/kernal/chrin_real.s +++ b/c64/kernal/chrin_real.s @@ -113,7 +113,7 @@ read_from_keyboard: sta LXSP+1 // Calculate length - jsr get_current_line_logical_length + jsr screen_get_current_line_logical_length tay iny !: dey diff --git a/c64/kernal/chrout_screen.s b/c64/kernal/chrout_screen.s deleted file mode 100644 index c516dcf4..00000000 --- a/c64/kernal/chrout_screen.s +++ /dev/null @@ -1,295 +0,0 @@ - -// -// CHROUT routine - screen support -// - - -chrout_screen: - - // Crude implementation of character output - sei // XXX why do we need to disable interrupts? - - jsr cursor_hide_if_visible - - lda SCHAR - tax - - // All the PETSCII control codes are within $0x, $1x, $8x, $9x, remaining - // ones are always printable characters; separate away control codes - - and #$60 - bne !+ - jmp chrout_screen_control -!: - txa - - // Literals - first convert PETSCII to screen code - - // Codes $C0-$DF become $40-$5F - cmp #$E0 - bcs !+ - cmp #$C0 - bcc !+ - - and #$7F - jmp output_literal_char // not high char - -!: - // Range $20-$3F is unchanged - cmp #$40 - bcc output_literal_char // not high char - - // Unshifted letters and symbols from $40-$5F - // all end up being -$40 - // (C64 PRG p376) - - // But anything >= $80 needs to be -$40 - // (C64 PRG p380-381) - // And bit 7 should be cleared, only to be - // set by reverse video - sec - sbc #$40 - - // Fix shifted chars by adding $20 again - cmp #$20 - bcc output_literal_char // not high char - cmp #$40 - bcs output_literal_char // not high char - clc - adc #$20 - -output_literal_char: - - // Write normal character on the screen - - pha - - ldy PNTR - ora RVS // Compute's Mapping the 64 p38 - sta (PNT),y - - // Decrement number of chars waiting to be inserted - lda INSRT - beq !+ - dec INSRT -!: - pla - cmp #$22 - bne not_quote - - // Toggle quote flag if required - lda QTSW - eor #$80 - sta QTSW - -not_quote: - - // Set colour - lda COLOR - sta (USER),y - - // Advance the column, and scroll screen down if we need - // to insert a 2nd line in this logical line. - // (eg Compute's Mapping the 64 p41) - ldx TBLX - iny - sty PNTR - cpy #40 - bne !+ - jsr screen_grow_logical_line - ldy PNTR -!: - cpy #80 - bcc no_screen_advance_to_next_line - lda #0 - sta PNTR - jmp screen_advance_to_next_line -no_screen_advance_to_next_line: - jmp chrout_done - - - - - -not_last_line: - rts - -scroll_up_if_on_last_line: - - // Colour RAM is always in fixed place, so is easiest - // to use to check if we are on the last line. - // The last line is at $D800 + 24*40 = $DBC0 - lda USER+1 - cmp #>$DBC0 - bne not_last_line - - lda USER+0 - cmp #<$DBC0 - beq is_last_line - - jsr get_current_line_logical_length - clc - adc USER+0 - cmp #<$DBE7-1 - bcc not_last_line - -is_last_line: - - dec TBLX - - // FALL THROUGH - -scroll_screen_up: - // Now scroll the whole screen up either one or two lines - // based on whether the first screen line is linked or not. - - // Get pointers to start of screen + colour RAM - lda HIBASE - sta PNT+1 - sta SAL+1 - lda #>$D800 - sta USER+1 - sta EAL+1 - lda #$00 - sta PNT+0 - sta USER+0 - - // Get pointers to screen/colour RAM source - lda LDTBL+0 - bmi !+ - lda #40 - .byte $2C // BIT $nnnn to skip next instruction -!: - lda #80 - sta SAL+0 - sta EAL+0 - - // Copy first three pages - ldy #$00 - ldx #3 -scroll_copy_loop: - lda (EAL),y - sta (USER),y - lda (SAL),y - sta (PNT),y - - iny - bne scroll_copy_loop - - inc SAL+1 - inc PNT+1 - inc EAL+1 - inc USER+1 - dex - bne scroll_copy_loop - - // Copy last partial page - // We need to copy 1000-(3*256)-line length - // = 232 - line length - lda SAL+0 - lda #232 - sec - sbc SAL+0 - tax -scroll_copy_loop2: - lda (EAL),y - sta (USER),y - lda (SAL),y - sta (PNT),y - iny - dex - bne scroll_copy_loop2 - - // Fill in scrolled up area - ldx SAL+0 -scroll_copy_loop3: - lda COLOR - sta (USER),y - lda #$20 - sta (PNT),y - iny - dex - bne scroll_copy_loop3 - - // Shift line linkage list - ldy #0 - ldx #24 -link_copy: - lda LDTBL+1,y - sta LDTBL+0,y - iny - dex - bne link_copy - // Clear line link flag of last line - stx LDTBL+24 - - // Restore correct line pointers - jsr calculate_screen_line_pointer - - rts - - - - - - - - - -get_current_line_logical_length: - ldy TBLX - lda LDTBL,y - bpl line_not_linked_del - lda #79 - .byte $2c // BIT absolute mode, which we use to skip the next two instruction bytes -line_not_linked_del: - lda #39 - sta LNMX - rts - -screen_advance_to_next_line: - - // jsr cursor_hide_if_visible - - // Go to start of line - lda #0 - sta PNTR - // Advance line number - ldy TBLX - - // Do quick fix to line pointer to work out if it is off - // the bottom of the screen. - ldx #40 - lda LDTBL,y - bmi !+ - .byte $2c -!: ldx #80 - txa - clc - adc PNT+0 - sta PNT+0 - lda PNT+1 - adc #0 - sta PNT+1 - - inc TBLX - - // Check if it will trigger scrolling - // Work out if we have gone off the bottom of the screen? - // 1040 > 1024, so if high byte of screen pointer is >= (HIBASE+4), - // then we are off the bottom of the screen - lda PNT+1 - sec - sbc HIBASE - cmp #3 - bcc !+ - lda PNT+0 - cmp #$e7 - bcc !+ - - // Off the bottom of the screen - jsr scroll_screen_up -!: - - jsr calculate_screen_line_pointer - jmp chrout_done diff --git a/c64/kernal/e50a.plot.s b/c64/kernal/e50a.plot.s index dbf08d43..ae9d32ff 100644 --- a/c64/kernal/e50a.plot.s +++ b/c64/kernal/e50a.plot.s @@ -20,7 +20,7 @@ plot_set: sty PNTR stx TBLX - jsr calculate_screen_line_pointer + jsr screen_calculate_line_pointer // XXX cursor blink might need to be handled too diff --git a/c64/kernal/f1ca.chrout.s b/c64/kernal/f1ca.chrout.s index 6c37056a..4e84808e 100644 --- a/c64/kernal/f1ca.chrout.s +++ b/c64/kernal/f1ca.chrout.s @@ -16,10 +16,17 @@ CHROUT: // (Confirmed by writing a test program that X and Y // don't get modified, in agreement with C64 PRG's // description of CHROUT) + +#if CONFIG_CPU_MOS_6502 txa pha tya pha +#else + phx + phy +#endif + php // Determine the device number @@ -46,10 +53,17 @@ chrout_done_fail: plp // Restore X and Y + +#if CONFIG_CPU_MOS_6502 pla tay pla tax +#else + ply + plx +#endif + sec // indicate failure rts @@ -59,10 +73,16 @@ chrout_done_unknown_device: plp // Restore X and Y + +#if CONFIG_CPU_MOS_6502 pla tay pla tax +#else + ply + plx +#endif // End wioth error jmp lvs_device_not_found_error @@ -73,10 +93,17 @@ chrout_done: plp // Restore X and Y + +#if CONFIG_CPU_MOS_6502 pla tay pla tax +#else + ply + plx +#endif + lda SCHAR clc // indicate success rts diff --git a/c64/kernal/screen/chrout_screen.s b/c64/kernal/screen/chrout_screen.s new file mode 100644 index 00000000..9025040e --- /dev/null +++ b/c64/kernal/screen/chrout_screen.s @@ -0,0 +1,108 @@ + +// +// CHROUT routine - screen support (character output) +// + + +chrout_screen: + + sei // XXX why do we need to disable interrupts? + + jsr cursor_hide_if_visible + + lda SCHAR + tax + + // All the PETSCII control codes are within $0x, $1x, $8x, $9x, remaining + // ones are always printable characters; separate away control codes + + and #$60 + bne !+ + jmp chrout_screen_control +!: + txa + + // Literals - first convert PETSCII to screen code + + // Codes $C0-$DF become $40-$5F + cmp #$E0 + bcs !+ + cmp #$C0 + bcc !+ + + and #$7F + jmp output_literal_char // not high char + +!: + // Range $20-$3F is unchanged + cmp #$40 + bcc output_literal_char // not high char + + // Unshifted letters and symbols from $40-$5F + // all end up being -$40 + // (C64 PRG p376) + + // But anything >= $80 needs to be -$40 + // (C64 PRG p380-381) + // And bit 7 should be cleared, only to be + // set by reverse video + sec + sbc #$40 + + // Fix shifted chars by adding $20 again + cmp #$20 + bcc output_literal_char // not high char + cmp #$40 + bcs output_literal_char // not high char + clc + adc #$20 + +output_literal_char: + + // Write normal character on the screen + + pha + + ldy PNTR + ora RVS // Compute's Mapping the 64 p38 + sta (PNT),y + + // Decrement number of chars waiting to be inserted + lda INSRT + beq !+ + dec INSRT +!: + pla + cmp #$22 + bne not_quote + + // Toggle quote flag if required + lda QTSW + eor #$80 + sta QTSW + +not_quote: + + // Set colour + lda COLOR + sta (USER),y + + // Advance the column, and scroll screen down if we need + // to insert a 2nd line in this logical line. + // (eg Compute's Mapping the 64 p41) + ldx TBLX + iny + sty PNTR + cpy #40 + bne !+ + jsr screen_grow_logical_line + ldy PNTR +!: + cpy #80 + bcc no_screen_advance_to_next_line + lda #0 + sta PNTR + jmp screen_advance_to_next_line + +no_screen_advance_to_next_line: + jmp chrout_done diff --git a/c64/kernal/screen/chrout_screen_control.s b/c64/kernal/screen/chrout_screen_control.s index 11bb2608..6b300daa 100644 --- a/c64/kernal/screen/chrout_screen_control.s +++ b/c64/kernal/screen/chrout_screen_control.s @@ -49,7 +49,7 @@ chrout_try_CRSR_UP: sec sbc #40 sta PNTR - jsr calculate_screen_line_pointer + jsr screen_calculate_line_pointer jmp chrout_done !: chrout_try_CRSR_DOWN: @@ -65,8 +65,8 @@ chrout_try_CRSR_DOWN: // now will break things. The pointer update is required // so that we can tell if we really are on the bottom phys // screen line or not - jsr scroll_up_if_on_last_line - jsr calculate_screen_line_pointer + jsr screen_scroll_up_if_on_last_line + jsr screen_calculate_line_pointer jmp chrout_done !: chrout_try_CRSR_LEFT: @@ -86,7 +86,7 @@ chrout_try_CRSR_RIGHT: bne !+ inc PNTR - jsr calculate_screen_line_pointer + jsr screen_calculate_line_pointer jmp chrout_done !: chrout_try_RVS_ON: @@ -202,5 +202,5 @@ chrout_screen_control_done: // unknown, LF, or no more actions required // XXX chrout_screen_control_calcptr_done: // XXX to !csc_calcptr_done - jsr calculate_screen_line_pointer + jsr screen_calculate_line_pointer jmp chrout_done diff --git a/c64/kernal/screen/chrout_screen_del.s b/c64/kernal/screen/chrout_screen_del.s index 7ef44b8b..e1362ea3 100644 --- a/c64/kernal/screen/chrout_screen_del.s +++ b/c64/kernal/screen/chrout_screen_del.s @@ -24,7 +24,7 @@ chrout_screen_del_column_0: // previous line, without actually deleting anything dec TBLX - jsr get_current_line_logical_length + jsr screen_get_current_line_logical_length lda LNMX sta PNTR @@ -33,7 +33,7 @@ chrout_screen_del_column_0: chrout_screen_del_column_non_0: // Copy rest of line down - jsr get_current_line_logical_length + jsr screen_get_current_line_logical_length ldy PNTR cpy LNMX beq !++ @@ -52,7 +52,7 @@ chrout_screen_del_column_non_0: bne !- // Clear char at end of line - jsr get_current_line_logical_length + jsr screen_get_current_line_logical_length tay lda #$20 sta (PNT),y diff --git a/c64/kernal/screen/chrout_screen_ins.s b/c64/kernal/screen/chrout_screen_ins.s index a56b6a80..04899d13 100644 --- a/c64/kernal/screen/chrout_screen_ins.s +++ b/c64/kernal/screen/chrout_screen_ins.s @@ -8,7 +8,7 @@ chrout_screen_ins: // Insert (shift-DELETE) // Abort if line already max length, ie 79th char is not a space - jsr get_current_line_logical_length + jsr screen_get_current_line_logical_length cmp #79 bne !+ tay @@ -30,7 +30,7 @@ chrout_screen_ins: !: // Shuffle chars towards end of line - jsr get_current_line_logical_length + jsr screen_get_current_line_logical_length tay !: // Note: While the following routine is obvious to any skilled diff --git a/c64/kernal/screen/cursor.s b/c64/kernal/screen/cursor.s index 59cae342..69364edd 100644 --- a/c64/kernal/screen/cursor.s +++ b/c64/kernal/screen/cursor.s @@ -28,7 +28,7 @@ cursor_blink: // FALLTROUGH cursor_draw: - jsr calculate_screen_line_pointer // XXX make sure this is not needed and remove the call + jsr screen_calculate_line_pointer // XXX make sure this is not needed and remove the call ldy PNTR lda (PNT),y diff --git a/c64/kernal/screen/cursor_home.s b/c64/kernal/screen/cursor_home.s index 42718ce1..7d8549a6 100644 --- a/c64/kernal/screen/cursor_home.s +++ b/c64/kernal/screen/cursor_home.s @@ -9,4 +9,4 @@ cursor_home: sta PNTR // x position sta TBLX // y position - jmp set_pointer_to_current_screen_line + jmp screen_set_pointer_to_current_line diff --git a/c64/kernal/screen/screen_advance_to_next_line.s b/c64/kernal/screen/screen_advance_to_next_line.s new file mode 100644 index 00000000..7aff572d --- /dev/null +++ b/c64/kernal/screen/screen_advance_to_next_line.s @@ -0,0 +1,47 @@ + +screen_advance_to_next_line: + + // jsr cursor_hide_if_visible + + // Go to start of line + lda #0 + sta PNTR + // Advance line number + ldy TBLX + + // Do quick fix to line pointer to work out if it is off + // the bottom of the screen. + ldx #40 + lda LDTBL,y + bmi !+ + .byte $2c +!: ldx #80 + txa + clc + adc PNT+0 + sta PNT+0 + lda PNT+1 + adc #0 + sta PNT+1 + + inc TBLX + + // Check if it will trigger scrolling + // Work out if we have gone off the bottom of the screen? + // 1040 > 1024, so if high byte of screen pointer is >= (HIBASE+4), + // then we are off the bottom of the screen + lda PNT+1 + sec + sbc HIBASE + cmp #3 + bcc !+ + lda PNT+0 + cmp #$e7 + bcc !+ + + // Off the bottom of the screen + jsr scroll_screen_up +!: + + jsr screen_calculate_line_pointer + jmp chrout_done diff --git a/c64/kernal/screen/screen_calculate_line_pointer.s b/c64/kernal/screen/screen_calculate_line_pointer.s index de1aa1d3..d982a38d 100644 --- a/c64/kernal/screen/screen_calculate_line_pointer.s +++ b/c64/kernal/screen/screen_calculate_line_pointer.s @@ -1,5 +1,5 @@ -calculate_screen_line_pointer: // XXX rename to screen_calculate_line_pointer +screen_calculate_line_pointer: jsr screen_normalize_xy // Reset pointer to start of screen @@ -21,9 +21,9 @@ calculate_screen_line_pointer: // XXX rename to screen_calculate_line_pointer // -1 offset is because we count down from N to 1, not // N-1 to 0. lda LDTBL-1,x - bpl cslp_l1 + bpl sclp_l1 ldy #80 -cslp_l1: +sclp_l1: // Add computed line length to pointer value tya clc diff --git a/c64/kernal/screen/screen_get_current_line_logical_length.s b/c64/kernal/screen/screen_get_current_line_logical_length.s new file mode 100644 index 00000000..9d8aafc1 --- /dev/null +++ b/c64/kernal/screen/screen_get_current_line_logical_length.s @@ -0,0 +1,11 @@ + +screen_get_current_line_logical_length: + ldy TBLX + lda LDTBL,y + bpl !+ + lda #79 + .byte $2c // BIT absolute mode, which we use to skip the next two instruction bytes +!: + lda #39 + sta LNMX + rts \ No newline at end of file diff --git a/c64/kernal/screen/screen_grow_logical_line.s b/c64/kernal/screen/screen_grow_logical_line.s index 26bd5ac9..d2995b3c 100644 --- a/c64/kernal/screen/screen_grow_logical_line.s +++ b/c64/kernal/screen/screen_grow_logical_line.s @@ -12,7 +12,7 @@ screen_grow_logical_line: // Now make space for the extra line added. // If we are on the last physical line of the screen, // Then we need to scroll the screen up - jsr scroll_up_if_on_last_line + jsr screen_scroll_up_if_on_last_line // Scroll screen down to make space // As we are scrolling down, we start from the end, @@ -106,7 +106,7 @@ cl_inner: bne copy_line_down_loop no_copy_down: - jsr calculate_screen_line_pointer + jsr screen_calculate_line_pointer // Erase newly inserted line ldy #79 diff --git a/c64/kernal/screen/screen_scroll_up_if_on_last_line.s b/c64/kernal/screen/screen_scroll_up_if_on_last_line.s new file mode 100644 index 00000000..8f8281b9 --- /dev/null +++ b/c64/kernal/screen/screen_scroll_up_if_on_last_line.s @@ -0,0 +1,115 @@ + +not_last_line: + rts + +screen_scroll_up_if_on_last_line: + + // Colour RAM is always in fixed place, so is easiest + // to use to check if we are on the last line. + // The last line is at $D800 + 24*40 = $DBC0 + lda USER+1 + cmp #>$DBC0 + bne not_last_line + + lda USER+0 + cmp #<$DBC0 + beq is_last_line + + jsr screen_get_current_line_logical_length + clc + adc USER+0 + cmp #<$DBE7-1 + bcc not_last_line + +is_last_line: + + dec TBLX + + // FALLTHROUGH + +scroll_screen_up: + // Now scroll the whole screen up either one or two lines + // based on whether the first screen line is linked or not. + + // Get pointers to start of screen + colour RAM + lda HIBASE + sta PNT+1 + sta SAL+1 + lda #>$D800 + sta USER+1 + sta EAL+1 + lda #$00 + sta PNT+0 + sta USER+0 + + // Get pointers to screen/colour RAM source + lda LDTBL+0 + bmi !+ + lda #40 + .byte $2C // BIT $nnnn to skip next instruction +!: + lda #80 + sta SAL+0 + sta EAL+0 + + // Copy first three pages + ldy #$00 + ldx #3 +scroll_copy_loop: + lda (EAL),y + sta (USER),y + lda (SAL),y + sta (PNT),y + + iny + bne scroll_copy_loop + + inc SAL+1 + inc PNT+1 + inc EAL+1 + inc USER+1 + dex + bne scroll_copy_loop + + // Copy last partial page + // We need to copy 1000-(3*256)-line length + // = 232 - line length + lda SAL+0 + lda #232 + sec + sbc SAL+0 + tax +scroll_copy_loop2: + lda (EAL),y + sta (USER),y + lda (SAL),y + sta (PNT),y + iny + dex + bne scroll_copy_loop2 + + // Fill in scrolled up area + ldx SAL+0 +scroll_copy_loop3: + lda COLOR + sta (USER),y + lda #$20 + sta (PNT),y + iny + dex + bne scroll_copy_loop3 + + // Shift line linkage list + ldy #0 + ldx #24 +link_copy: + lda LDTBL+1,y + sta LDTBL+0,y + iny + dex + bne link_copy + // Clear line link flag of last line + stx LDTBL+24 + + // Restore correct line pointers + jmp screen_calculate_line_pointer diff --git a/c64/kernal/set_pointer_to_current_screen_line.s b/c64/kernal/screen/screen_set_pointer_to_current_line.s similarity index 85% rename from c64/kernal/set_pointer_to_current_screen_line.s rename to c64/kernal/screen/screen_set_pointer_to_current_line.s index a6edef4c..e6beecfc 100644 --- a/c64/kernal/set_pointer_to_current_screen_line.s +++ b/c64/kernal/screen/screen_set_pointer_to_current_line.s @@ -2,7 +2,8 @@ // into the pointer at $D1 (PNT). // It must take into account the screen line link table // (Compute's Mapping the 64 p216) -set_pointer_to_current_screen_line: + +screen_set_pointer_to_current_line: // Get pointer to start of the screen lda HIBASE sta PNT+1 @@ -12,15 +13,15 @@ set_pointer_to_current_screen_line: // Now advance for the number of lines ldx TBLX -sptcsl_l2: +sptcl_l2: // XXX - Should we read the columns per line from // somewhere? ldy #<40 // Double line length if line is linked lda LDTBL,x - bpl sptcsl_l1 + bpl sptcl_l1 ldy #<80 -sptcsl_l1: +sptcl_l1: tya clc adc PNT+0 @@ -29,6 +30,6 @@ sptcsl_l1: sta PNT+1 dex - bpl sptcsl_l2 + bpl sptcl_l2 rts From d3ef25c441c29353274cd66392052c39beb4c1d9 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 9 Oct 2019 22:10:13 +0200 Subject: [PATCH 25/85] further CHROUT fixes and optimizations --- c64/kernal/f1ca.chrout.s | 9 ++-- c64/kernal/screen/chrout_screen.s | 17 +++++-- ...s => chrout_screen_advance_to_next_line.s} | 7 ++- c64/kernal/screen/chrout_screen_control.s | 48 ++++++++----------- c64/kernal/screen/chrout_screen_del.s | 6 ++- c64/kernal/screen/chrout_screen_ins.s | 4 +- 6 files changed, 46 insertions(+), 45 deletions(-) rename c64/kernal/screen/{screen_advance_to_next_line.s => chrout_screen_advance_to_next_line.s} (89%) diff --git a/c64/kernal/f1ca.chrout.s b/c64/kernal/f1ca.chrout.s index 4e84808e..46e187b4 100644 --- a/c64/kernal/f1ca.chrout.s +++ b/c64/kernal/f1ca.chrout.s @@ -43,12 +43,11 @@ chrout_iec: lda SCHAR jsr JCIOUT - bcc chrout_done + bcc chrout_done_success // FALLTROUGH chrout_done_fail: - jsr cursor_show_if_enabled plp @@ -68,7 +67,6 @@ chrout_done_fail: rts chrout_done_unknown_device: - jsr cursor_show_if_enabled plp @@ -87,9 +85,8 @@ chrout_done_unknown_device: // End wioth error jmp lvs_device_not_found_error -chrout_done: - jsr cursor_show_if_enabled - +chrout_done_success: + plp // Restore X and Y diff --git a/c64/kernal/screen/chrout_screen.s b/c64/kernal/screen/chrout_screen.s index 9025040e..119c11d2 100644 --- a/c64/kernal/screen/chrout_screen.s +++ b/c64/kernal/screen/chrout_screen.s @@ -99,10 +99,19 @@ not_quote: ldy PNTR !: cpy #80 - bcc no_screen_advance_to_next_line + bcc chrout_screen_done lda #0 sta PNTR - jmp screen_advance_to_next_line + jmp chrout_screen_advance_to_next_line -no_screen_advance_to_next_line: - jmp chrout_done + +chrout_screen_calc_lptr_done: + + jsr screen_calculate_line_pointer + + // FALLTROUGH + +chrout_screen_done: + + jsr cursor_show_if_enabled + jmp chrout_done_success diff --git a/c64/kernal/screen/screen_advance_to_next_line.s b/c64/kernal/screen/chrout_screen_advance_to_next_line.s similarity index 89% rename from c64/kernal/screen/screen_advance_to_next_line.s rename to c64/kernal/screen/chrout_screen_advance_to_next_line.s index 7aff572d..e62f13e1 100644 --- a/c64/kernal/screen/screen_advance_to_next_line.s +++ b/c64/kernal/screen/chrout_screen_advance_to_next_line.s @@ -1,5 +1,5 @@ -screen_advance_to_next_line: +chrout_screen_advance_to_next_line: // jsr cursor_hide_if_visible @@ -42,6 +42,5 @@ screen_advance_to_next_line: // Off the bottom of the screen jsr scroll_screen_up !: - - jsr screen_calculate_line_pointer - jmp chrout_done + + jmp chrout_screen_calc_lptr_done diff --git a/c64/kernal/screen/chrout_screen_control.s b/c64/kernal/screen/chrout_screen_control.s index 6b300daa..d78829a2 100644 --- a/c64/kernal/screen/chrout_screen_control.s +++ b/c64/kernal/screen/chrout_screen_control.s @@ -23,7 +23,7 @@ chrout_try_RETURN: sta QTSW sta INSRT sta RVS - jmp screen_advance_to_next_line + jmp chrout_screen_advance_to_next_line !: chrout_try_DEL: @@ -49,8 +49,7 @@ chrout_try_CRSR_UP: sec sbc #40 sta PNTR - jsr screen_calculate_line_pointer - jmp chrout_done + jmp chrout_screen_calc_lptr_done !: chrout_try_CRSR_DOWN: @@ -66,8 +65,7 @@ chrout_try_CRSR_DOWN: // so that we can tell if we really are on the bottom phys // screen line or not jsr screen_scroll_up_if_on_last_line - jsr screen_calculate_line_pointer - jmp chrout_done + jmp chrout_screen_calc_lptr_done !: chrout_try_CRSR_LEFT: @@ -76,9 +74,11 @@ chrout_try_CRSR_LEFT: lda TBLX ora PNTR - beq chrout_screen_control_done // if top-left screen character + bne position_not_top_left + jmp chrout_screen_done +position_not_top_left: dec PNTR - jmp chrout_screen_control_calcptr_done + jmp chrout_screen_calc_lptr_done !: chrout_try_CRSR_RIGHT: @@ -86,17 +86,16 @@ chrout_try_CRSR_RIGHT: bne !+ inc PNTR - jsr screen_calculate_line_pointer - jmp chrout_done + jmp chrout_screen_calc_lptr_done !: -chrout_try_RVS_ON: +chrout_try_RVS_ON: // XXX deduplicate with RVS_OFF cmp #$12 bne !+ lda #$80 sta RVS - bne chrout_screen_control_done // branch always + jmp chrout_screen_done !: chrout_try_RVS_OFF: @@ -105,7 +104,7 @@ chrout_try_RVS_OFF: lda #$00 sta RVS - beq chrout_screen_control_done // branch always + jmp chrout_screen_done !: chrout_try_MODE_TXT: @@ -114,7 +113,7 @@ chrout_try_MODE_TXT: // XXX - jmp chrout_done + jmp chrout_screen_done !: chrout_try_MODE_GFX: @@ -123,7 +122,7 @@ chrout_try_MODE_GFX: // XXX - jmp chrout_done + jmp chrout_screen_done !: chrout_try_COLOR: @@ -132,7 +131,7 @@ colour_check_loop: cmp colour_codes,x bne !+ stx COLOR - jmp chrout_done + jmp chrout_screen_done !: dex bpl colour_check_loop @@ -144,7 +143,7 @@ chrout_try_SHIFT_ENABLE: // XXX - jmp chrout_done + jmp chrout_screen_done !: chrout_try_SHIFT_DISABLE: @@ -153,7 +152,7 @@ chrout_try_SHIFT_DISABLE: // XXX - jmp chrout_done + jmp chrout_screen_done !: chrout_try_HOME: @@ -164,7 +163,7 @@ chrout_try_HOME: lda #$00 sta PNTR sta TBLX - beq chrout_screen_control_calcptr_done // branch always + jmp chrout_screen_calc_lptr_done !: chrout_try_CLR: @@ -172,7 +171,7 @@ chrout_try_CLR: bne !+ jsr clear_screen - jmp chrout_done + jmp chrout_screen_done !: chrout_try_INS: @@ -188,7 +187,7 @@ chrout_try_RUN_STOP: // XXX - jmp chrout_done + jmp chrout_screen_done !: chrout_try_FKEY: @@ -196,11 +195,6 @@ chrout_try_FKEY: // FALLTROUGH -chrout_screen_control_done: // unknown, LF, or no more actions required // XXX to !csc_done +!: // unknown, LF, or no more actions required // XXX to !csc_done - jmp chrout_done - -chrout_screen_control_calcptr_done: // XXX to !csc_calcptr_done - - jsr screen_calculate_line_pointer - jmp chrout_done + jmp chrout_screen_done diff --git a/c64/kernal/screen/chrout_screen_del.s b/c64/kernal/screen/chrout_screen_del.s index e1362ea3..135f4777 100644 --- a/c64/kernal/screen/chrout_screen_del.s +++ b/c64/kernal/screen/chrout_screen_del.s @@ -28,7 +28,7 @@ chrout_screen_del_column_0: lda LNMX sta PNTR - jmp chrout_screen_control_calcptr_done + jmp chrout_screen_calc_lptr_done chrout_screen_del_column_non_0: @@ -59,5 +59,7 @@ chrout_screen_del_column_non_0: !: dec PNTR + // FALLTROUGH + chrout_screen_del_done: - jmp chrout_done + jmp chrout_screen_done diff --git a/c64/kernal/screen/chrout_screen_ins.s b/c64/kernal/screen/chrout_screen_ins.s index 04899d13..8e0e7f63 100644 --- a/c64/kernal/screen/chrout_screen_ins.s +++ b/c64/kernal/screen/chrout_screen_ins.s @@ -17,7 +17,7 @@ chrout_screen_ins: beq !+ // Line is too long to extend - jmp chrout_done + jmp chrout_screen_done !: // Work out if line needs to be expanded, and if so expand it @@ -61,4 +61,4 @@ chrout_screen_ins: lda #$20 sta (PNT),y - jmp chrout_done + jmp chrout_screen_done From e24a6f344dcdb2c0295ab8d12b757b3198f15d3e Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 9 Oct 2019 22:47:48 +0200 Subject: [PATCH 26/85] saved few more bytes in CHROUT --- c64/kernal/screen/chrout_screen_control.s | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/c64/kernal/screen/chrout_screen_control.s b/c64/kernal/screen/chrout_screen_control.s index d78829a2..fe6bfc1f 100644 --- a/c64/kernal/screen/chrout_screen_control.s +++ b/c64/kernal/screen/chrout_screen_control.s @@ -74,10 +74,9 @@ chrout_try_CRSR_LEFT: lda TBLX ora PNTR - bne position_not_top_left - jmp chrout_screen_done -position_not_top_left: + beq crsr_l1 // recalculating pointer is not really necessary, but this is a very rare case nevertheless dec PNTR +crsr_l1: jmp chrout_screen_calc_lptr_done !: chrout_try_CRSR_RIGHT: @@ -88,14 +87,13 @@ chrout_try_CRSR_RIGHT: inc PNTR jmp chrout_screen_calc_lptr_done !: -chrout_try_RVS_ON: // XXX deduplicate with RVS_OFF +chrout_try_RVS_ON: cmp #$12 bne !+ lda #$80 - sta RVS - jmp chrout_screen_done + bne rvs_l1 !: chrout_try_RVS_OFF: @@ -103,6 +101,7 @@ chrout_try_RVS_OFF: bne !+ lda #$00 +rvs_l1: sta RVS jmp chrout_screen_done !: @@ -195,6 +194,6 @@ chrout_try_FKEY: // FALLTROUGH -!: // unknown, LF, or no more actions required // XXX to !csc_done +!: // unknown, LF, or no more actions required jmp chrout_screen_done From 4c04cebde6fda4dcaf2b31222cca8ca8997c3e65 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Thu, 10 Oct 2019 18:01:53 +0200 Subject: [PATCH 27/85] screen handling fixes, remaining glitches on 'Duotris' menu screen are gone --- c64/kernal/chrin_real.s | 5 +-- c64/kernal/cint_real.s | 3 +- c64/kernal/screen/chrout_screen.s | 2 -- .../chrout_screen_advance_to_next_line.s | 2 -- c64/kernal/screen/chrout_screen_control.s | 25 +++---------- c64/kernal/screen/cursor.s | 2 +- c64/kernal/screen/cursor_home.s | 2 +- .../screen_set_pointer_to_current_line.s | 35 ------------------- 8 files changed, 11 insertions(+), 65 deletions(-) delete mode 100644 c64/kernal/screen/screen_set_pointer_to_current_line.s diff --git a/c64/kernal/chrin_real.s b/c64/kernal/chrin_real.s index cf7f54f6..5e0a7e17 100644 --- a/c64/kernal/chrin_real.s +++ b/c64/kernal/chrin_real.s @@ -82,7 +82,6 @@ not_end_of_input: clc rts - read_from_keyboard: jsr cursor_enable @@ -92,7 +91,7 @@ read_from_keyboard: beq chrin_repeat lda KEYD - cmp #$0d + cmp #$0D bne not_enter jsr cursor_disable @@ -145,8 +144,10 @@ empty_line: rts not_enter: + // Print character lda KEYD + // XXX add support for SHIFT + RUN/STOP ($84) and function keys (should be configurable) jsr CHROUT jsr pop_keyboard_buffer diff --git a/c64/kernal/cint_real.s b/c64/kernal/cint_real.s index 1daf056c..9111700a 100644 --- a/c64/kernal/cint_real.s +++ b/c64/kernal/cint_real.s @@ -68,7 +68,8 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? jsr setup_vicii // Initialise cursor blink flags (Compute's Mapping the 64 p215) - lda #$00 + lda #$01 + sta BLNCT sta BLNSW // Set keyboard decode vector (Compute's Mapping the 64 p215) diff --git a/c64/kernal/screen/chrout_screen.s b/c64/kernal/screen/chrout_screen.s index 119c11d2..0b447fad 100644 --- a/c64/kernal/screen/chrout_screen.s +++ b/c64/kernal/screen/chrout_screen.s @@ -6,8 +6,6 @@ chrout_screen: - sei // XXX why do we need to disable interrupts? - jsr cursor_hide_if_visible lda SCHAR diff --git a/c64/kernal/screen/chrout_screen_advance_to_next_line.s b/c64/kernal/screen/chrout_screen_advance_to_next_line.s index e62f13e1..323c47e8 100644 --- a/c64/kernal/screen/chrout_screen_advance_to_next_line.s +++ b/c64/kernal/screen/chrout_screen_advance_to_next_line.s @@ -1,8 +1,6 @@ chrout_screen_advance_to_next_line: - // jsr cursor_hide_if_visible - // Go to start of line lda #0 sta PNTR diff --git a/c64/kernal/screen/chrout_screen_control.s b/c64/kernal/screen/chrout_screen_control.s index fe6bfc1f..d028d077 100644 --- a/c64/kernal/screen/chrout_screen_control.s +++ b/c64/kernal/screen/chrout_screen_control.s @@ -158,11 +158,8 @@ chrout_try_HOME: cmp #$13 bne !+ - // XXX try cursor_home instead - lda #$00 - sta PNTR - sta TBLX - jmp chrout_screen_calc_lptr_done + jsr cursor_home + jmp chrout_screen_done !: chrout_try_CLR: @@ -179,21 +176,7 @@ chrout_try_INS: jmp chrout_screen_ins !: -chrout_try_RUN_STOP: - - cmp #$03 - bne !+ - - // XXX - - jmp chrout_screen_done -!: -chrout_try_FKEY: - - // XXX - - // FALLTROUGH - -!: // unknown, LF, or no more actions required +chrout_screen_control_done: + // unknown code or key does not needs jmp chrout_screen_done diff --git a/c64/kernal/screen/cursor.s b/c64/kernal/screen/cursor.s index 69364edd..0221cf18 100644 --- a/c64/kernal/screen/cursor.s +++ b/c64/kernal/screen/cursor.s @@ -28,7 +28,7 @@ cursor_blink: // FALLTROUGH cursor_draw: - jsr screen_calculate_line_pointer // XXX make sure this is not needed and remove the call + jsr screen_calculate_line_pointer // XXX try to make this call not needed ldy PNTR lda (PNT),y diff --git a/c64/kernal/screen/cursor_home.s b/c64/kernal/screen/cursor_home.s index 7d8549a6..bb9d9bd2 100644 --- a/c64/kernal/screen/cursor_home.s +++ b/c64/kernal/screen/cursor_home.s @@ -9,4 +9,4 @@ cursor_home: sta PNTR // x position sta TBLX // y position - jmp screen_set_pointer_to_current_line + jmp screen_calculate_line_pointer diff --git a/c64/kernal/screen/screen_set_pointer_to_current_line.s b/c64/kernal/screen/screen_set_pointer_to_current_line.s deleted file mode 100644 index e6beecfc..00000000 --- a/c64/kernal/screen/screen_set_pointer_to_current_line.s +++ /dev/null @@ -1,35 +0,0 @@ - // Put the address of the screen current line - // into the pointer at $D1 (PNT). - // It must take into account the screen line link table - // (Compute's Mapping the 64 p216) - -screen_set_pointer_to_current_line: - // Get pointer to start of the screen - lda HIBASE - sta PNT+1 - lda #$00 - sta PNT+0 - - // Now advance for the number of lines - ldx TBLX - -sptcl_l2: - // XXX - Should we read the columns per line from - // somewhere? - ldy #<40 - // Double line length if line is linked - lda LDTBL,x - bpl sptcl_l1 - ldy #<80 -sptcl_l1: - tya - clc - adc PNT+0 - lda PNT+1 - adc #>40 - sta PNT+1 - - dex - bpl sptcl_l2 - - rts From 3e5c80bbf1af641b1e8243b911e3f3609d949730 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Thu, 10 Oct 2019 18:34:28 +0200 Subject: [PATCH 28/85] case switch fixes, support missing PETSCII control codes --- bin/basic_generic.rom | Bin 8192 -> 8192 bytes bin/basic_mega65.rom | Bin 8192 -> 8192 bytes bin/basic_ultimate64.rom | Bin 8192 -> 8192 bytes bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/kernal/cint_real.s | 2 ++ c64/kernal/scnkey_tww_ctr.s | 6 ++--- c64/kernal/screen/chrout_screen_control.s | 26 +++++++++++----------- 9 files changed, 18 insertions(+), 16 deletions(-) diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index 8e22472dac293024eb992a7cdfc388064ba02fbb..11b0d17c71c181a77417ca610bdc78d22188aec0 100644 GIT binary patch delta 46 ucmZp0XmHqYh=s}K>*gaY^O=G431F#!OvP7%@o delta 46 ucmZp0XmHqYh=s}a)#f8C^O=G431F#!Or8xf!Y diff --git a/bin/basic_mega65.rom b/bin/basic_mega65.rom index 53c01b59a32a93ad85feade40751860dd16f21bb..fe3ebcf3ef2fcefc2696624f5098bde1feb278a4 100644 GIT binary patch delta 91 zcmZp0XmHqYh=r-`>EZ6CSygqR-vovbJq4m4$QmE2(v&tCo@0Q#pZmjD0& del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j$a{X;m=#%gG8jzSPy@W4KVslb`Jp?&X z80H4lo4Vg#!KR)CN`Ff~40p+;v2_JRycK#59wpvf3a9aadXjX{HM%t}ZFd8L!W-)! z`~XR@zCP%@6@DFCS53ugzm|$Wh0XH1W-2!O85K*`&Ui62&8Rzhx)E>Y50|X5lqqDH zLYxXYqmWxq$eAe;pCQM?I#JD5?Me diff --git a/bin/kernal_ultimate64.rom b/bin/kernal_ultimate64.rom index e1db9442a32e63df05694585c239c6742faa927a..bc015e103378dcd1e14cf78af7bea938edd935f0 100644 GIT binary patch delta 2695 zcmY*beNa@_6<_Y#WdQ}259MJ%uVWk`;)vF!*l2@ErdgfqN3}`8w#iMMB#T4;$k?e& zCL?RhTL}hc*Jr9=jmvf)<6~TBcTC5Eaf-;`K1RaBRlu*QlW`G=t&iP>w~)g2yxnc4 zWtew==brmzk2EZDN%=S#Ylr&r_+f#F2IeD>Ja}x|HF;dA$Oo-gqnquioOC@&s!+22-+Dk z7fM$+H~x6R%aA83l}z?ji7Kdqvi$3YZ7A@Vw;48;U+*2PC{L?u=(AmSuCN=s@)^f< zufcb{HJ@oTMN23ZBGP?%RtQTyN(TPdG=Dek_eXEum%%$G_yGH3^v(pIUHHQGLldH|xfyv<9+WatifnKhVS$9?3|C4^ zGfGH|!jQhF+LFbR9+n_&N!ovxXcDOTLxrWsd1s>a6!JIlhnKDYVDhQia~zc;d68MvHy=k93%UQ)LMESLw1CgW@MMe}ndJV~ z&}HkU5PNC2oN?YaEMf4KpL4EBK>Xe~=*~C#!hT1%(Kqae!1o2@=i_5q4q)M>BN>CK zMK`7`EafgYd}X^r$+l@RliZ4VbPr1_m08Mn<{fyG8*MV5Hm3<~5+gHY-5g%4db5O4 zd_HE+F0q`qbXL&#Kx~otD2%eyeOk$AEH~b*Msk#;6_osHhR?~ZT;!d>Sz$6Xi!X%v zf2Xf{<-?FL%!P$p75{8RY|R)Kp?G1+`&!olq}@`4*7aTqSs#!n)G9XRj} zJ`^d0<01T3xR|?1g;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-`?sI@~z+!g%)v#a=2 zB)Q;=;GZRh;h!txrHEiPn&k)h?~!T{55D{)0)8)fqO@CM417=RO!q}Or~Q(*`=VY_ znLzR08L}gy^esDMyF!CkWR_fu1g}agxg60`;jAv#!QfxV5*stxFF{-PlDde(c;d(w zco{jC0^4DLk8l-7XM`&RKH9UodyZlvMEKw37VcTcewE+%A&!aus;$CXBY1ZV&yV44 zF#~kjGo^_>obZ2~q(?31@VCNbffC45O0q$y%R_S$2s1ykc>Qk3R9D=QewIhQx@qo$ zBe(G+a;TtZIWilMp++0Rn`g=M0VS2I6jh+Ge8!Oj4q2N*qtHOo`f@r=6_ zflJmC@J6SIB-RzDg7vG*io)p~>dS1+z1L^?H-zL4? z7o-Rk<8nc%y8#(BZ5HE}yd#rsmyg8c`K>*Vjv-ln_Am4alt;HnO5hQadyN07EjtDGew&VM~xbmbGrZv>i3*CHMCcSjOT{CmmY%9+aeX?(d~2y?b|x!tU}EWpM9GQ6=v0rYMuU zEJdLYT_7;Ok4Lhh?-Y^?``$rvzVkvC3km&bvgtJP*7Bnn#mlOuOWh|>36kcOy3!g> zAd7`mPFqOT^m$w69;DUVXB;JD>lmMxw|-Y!7~-pYlDxf|JS^2ua$>Ng;R2x32Med zCre+1pO{%$0wrNFW-HVXwDUyMtilI^2_b8B8b~q&2vIUzXj1we3(p3jIZ54B61vI7 za?P|f@#-+~FXvVRqhcOd zuP1ayXp(b4D7fu{#2api^L<3wSA>s4L@ z-ue=K;^`6d)_URIknD`5tzE>MA>pCyTv-%$<6dPa>6oo@Fm_ePVFWoi;=OSUN#UNJ z3M#Jfr0FZoR5W{3RQv%)_NN|j(V?-0;y9!pW_CF-Aj2|+vht{%(idgdF5UC50 S%z%B^!BB>IHn=}N{P2Hz7*d`9 diff --git a/c64/kernal/cint_real.s b/c64/kernal/cint_real.s index 9111700a..21a5490f 100644 --- a/c64/kernal/cint_real.s +++ b/c64/kernal/cint_real.s @@ -96,7 +96,9 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? // Set maximum keyboard buffer size (Compute's Mapping the 64 p215) ldx #10 stx XMAX + // Put non-zero value in MODE to enable case switch + ldx #$00 stx MODE // Set default I/O devices (see SCINIT description at http://sta.c64.org/cbm64krnfunc.html) diff --git a/c64/kernal/scnkey_tww_ctr.s b/c64/kernal/scnkey_tww_ctr.s index 899ecf94..a678082e 100644 --- a/c64/kernal/scnkey_tww_ctr.s +++ b/c64/kernal/scnkey_tww_ctr.s @@ -367,11 +367,11 @@ next_row: beq no_case_toggle lda MODE - beq no_case_toggle + bne no_case_toggle - lda $D018 + lda VIC_YMCSB eor #$02 - sta $d018 + sta VIC_YMCSB no_case_toggle: diff --git a/c64/kernal/screen/chrout_screen_control.s b/c64/kernal/screen/chrout_screen_control.s index d028d077..440ace12 100644 --- a/c64/kernal/screen/chrout_screen_control.s +++ b/c64/kernal/screen/chrout_screen_control.s @@ -110,17 +110,19 @@ chrout_try_MODE_TXT: cmp #$0E bne !+ - // XXX - - jmp chrout_screen_done + lda VIC_YMCSB + ora #$02 // to lower case + bne mode_l1 // branch always !: chrout_try_MODE_GFX: cmp #$8E bne !+ - // XXX - + lda VIC_YMCSB + and #$02 // to upper case +mode_l1: + sta VIC_YMCSB jmp chrout_screen_done !: chrout_try_COLOR: @@ -140,7 +142,8 @@ chrout_try_SHIFT_ENABLE: cmp #$09 bne !+ - // XXX + lda #$00 // enable SHIFT+VENDOR combination + sta MODE jmp chrout_screen_done !: @@ -149,7 +152,8 @@ chrout_try_SHIFT_DISABLE: cmp #$08 bne !+ - // XXX + lda #$80 // disable SHIFT+VENDOR combination + sta MODE jmp chrout_screen_done !: @@ -167,16 +171,12 @@ chrout_try_CLR: bne !+ jsr clear_screen +clr_l1: jmp chrout_screen_done !: chrout_try_INS: cmp #$94 - bne !+ + bne clr_l1 // unknown code or key does not need handling jmp chrout_screen_ins -!: -chrout_screen_control_done: - - // unknown code or key does not needs - jmp chrout_screen_done From ce8c84a20c5383e6156a27d374e3f7851a007617 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Thu, 10 Oct 2019 19:45:40 +0200 Subject: [PATCH 29/85] small 65C02 optimizations in many places --- CONFIG.md | 4 +- c64/aliases/,aliases_cpu.s | 45 ++++++++++++++++++ c64/basic/ab1e.strout.s | 7 ++- c64/basic/basic_do_error.s | 6 +-- c64/basic/cmd_list.s | 16 +------ c64/basic/print_integer.s | 3 +- c64/basic/print_packed_message.s | 24 ++++------ c64/basic/wedge_dos.s | 3 +- c64/kernal/chkinout_real.s | 4 +- c64/kernal/chrin_real.s | 15 ++---- c64/kernal/clall_real.s | 6 +-- c64/kernal/f1ca.chrout.s | 47 ++++--------------- c64/kernal/iec/iec_return.s | 12 ++--- c64/kernal/iec/iec_rx_byte.s | 6 +-- c64/kernal/iec/iec_turnaround_to_listen.s | 6 +-- c64/kernal/iec/iec_turnaround_to_talk.s | 6 +-- c64/kernal/iec/iec_tx_byte.s | 6 +-- c64/kernal/iec/iec_tx_command.s | 6 +-- c64/kernal/iec/iec_tx_command_finalize.s | 6 +-- .../interrupts/ea81.return_from_interrupt.s | 12 +---- .../interrupts/fe47.default_nmi_handler.s | 11 +---- c64/kernal/interrupts/hw_entry_irq.s | 11 +---- 22 files changed, 103 insertions(+), 159 deletions(-) create mode 100644 c64/aliases/,aliases_cpu.s diff --git a/CONFIG.md b/CONFIG.md index 5d09de23..8310b8d8 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -51,7 +51,7 @@ Choose if your CPU supports the Western Design Center 65C02 instruction set, lik * CSG 65CE02 * CSG 4510 - used in the Commodore 65 prototypes -It enables some speed/size code optimizations. Warning - this is untested! +It enables some speed/size code optimizations. ### `CONFIG_CPU_WDC_65816` @@ -60,7 +60,7 @@ Choose if your CPU supports the 16-bit Western Design Center 65816 instruction s * WDC 65C816 - used in the Flash 8 accelerator * WDC 65C816S - used in the SuperCPU accelerator -It enables some speed/size code optimizations. Warning - this is untested! +It enables some speed/size code optimizations. ## Memory model diff --git a/c64/aliases/,aliases_cpu.s b/c64/aliases/,aliases_cpu.s new file mode 100644 index 00000000..45f4727b --- /dev/null +++ b/c64/aliases/,aliases_cpu.s @@ -0,0 +1,45 @@ + +// +// Provide pseudocommands to make CPU optimizations easier +// + + +.pseudocommand _phx +{ +#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 + phx +#else + txa + pha +#endif +} + +.pseudocommand _phy +{ +#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 + phy +#else + tya + pha +#endif +} + +.pseudocommand _plx +{ +#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 + plx +#else + pla + tax +#endif +} + +.pseudocommand _ply +{ +#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 + ply +#else + pla + tay +#endif +} diff --git a/c64/basic/ab1e.strout.s b/c64/basic/ab1e.strout.s index 165af8b1..0526a6b1 100644 --- a/c64/basic/ab1e.strout.s +++ b/c64/basic/ab1e.strout.s @@ -7,9 +7,8 @@ STROUT: // Setup pointer sty FRESPC+1 sta FRESPC+0 - - txa - pha + + _phx // Get offset ready ldy #$00 @@ -29,6 +28,6 @@ STROUT: iny bne !- !: - pla + pla // XXX can we use _plx here? tax rts diff --git a/c64/basic/basic_do_error.s b/c64/basic/basic_do_error.s index 6266b0ef..984e71eb 100644 --- a/c64/basic/basic_do_error.s +++ b/c64/basic/basic_do_error.s @@ -2,8 +2,7 @@ basic_do_error: // Save error number - txa - pha + _phx // Print ? at start jsr print_return @@ -11,8 +10,7 @@ basic_do_error: jsr JCHROUT // Print main part of error message - pla - tax + _plx jsr print_packed_message // Print ERROR at end diff --git a/c64/basic/cmd_list.s b/c64/basic/cmd_list.s index 08afa852..190c6ca5 100644 --- a/c64/basic/cmd_list.s +++ b/c64/basic/cmd_list.s @@ -98,15 +98,9 @@ list_not_quote: // Display a token // Save registers -#if CONFIG_CPU_MOS_6502 tax pha - tya - pha -#else - phx - phy -#endif + _phy // Get pointer to compressed keyword list lda # Date: Fri, 11 Oct 2019 18:14:12 +0200 Subject: [PATCH 30/85] various cleanups --- CONFIG.md | 9 ++- Makefile | 11 ++-- STATUS.md | 2 +- bin/basic_ultimate64.rom | Bin 8192 -> 8192 bytes bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/,,config_generic.s | 1 + c64/,,config_mega65.s | 1 + c64/,,config_ultimate64.s | 1 + c64/aliases/,aliases_config.s | 5 +- c64/aliases/,aliases_cpu.s | 16 ++--- c64/aliases/,aliases_hardware.s | 3 + c64/aliases/,aliases_ram_lowmem.s | 57 ++---------------- c64/basic/ab1e.strout.s | 4 +- c64/basic/basic_do_error.s | 4 +- c64/basic/cmd_list.s | 4 +- c64/basic/print_integer.s | 2 +- c64/basic/print_packed_message.s | 16 ++--- c64/basic/wedge_dos.s | 2 +- c64/kernal/assets/keyboard_matrix.s | 4 +- c64/kernal/chkinout_real.s | 2 +- c64/kernal/chrin_real.s | 10 +-- c64/kernal/clall_real.s | 4 +- c64/kernal/f1ca.chrout.s | 16 ++--- c64/kernal/iec/iec_return.s | 8 +-- c64/kernal/iec/iec_rx_byte.s | 4 +- c64/kernal/iec/iec_turnaround_to_listen.s | 4 +- c64/kernal/iec/iec_turnaround_to_talk.s | 4 +- c64/kernal/iec/iec_tx_byte.s | 4 +- c64/kernal/iec/iec_tx_command.s | 4 +- c64/kernal/iec/iec_tx_command_finalize.s | 4 +- .../interrupts/ea81.return_from_interrupt.s | 4 +- .../interrupts/fe47.default_nmi_handler.s | 4 +- c64/kernal/interrupts/hw_entry_irq.s | 4 +- c64/kernal/scnkey_tww_ctr.s | 20 +++++- 36 files changed, 114 insertions(+), 124 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index 8310b8d8..48451cd6 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -48,8 +48,15 @@ If unsure - select this one. Choose if your CPU supports the Western Design Center 65C02 instruction set, like: * WDC 65C02 - used in the Turbo Master accelerator + +It enables some speed/size code optimizations. + +### `CONFIG_CPU_CSG_65CE02` + +Choose if your CPU supports the Commodore Semiconductor Group 65CE02 instruction set, like: + * CSG 65CE02 -* CSG 4510 - used in the Commodore 65 prototypes +* CSG 4510 - microcontroller used in the Commodore 65 prototypes It enables some speed/size code optimizations. diff --git a/Makefile b/Makefile index d73f87c5..c5eb20c9 100644 --- a/Makefile +++ b/Makefile @@ -192,16 +192,22 @@ build/newc65.rom: build/kernal_mega65.rom build/basic_mega65.rom build/chargen.r # Rules - tests -.PHONY: test test_generic test_mega65 test_ultimate64 test_hybrid test_m65 test_xemu testremote testsimilarity +.PHONY: test test_generic test_generic_x128 test_mega65 test_mega65_xemu test_ultimate64 test_hybrid test_m65 testremote testsimilarity test: test_generic test_generic: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -moncommands build/symbols_generic.vs -8 empty.d64 +test_generic_x128: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs + x128 -go64 -kernal64 build/kernal_generic.rom -basic64 build/basic_generic.rom -moncommands build/symbols_generic.vs -8 empty.d64 + test_mega65: build/kernal_mega65.rom build/basic_mega65.rom build/symbols_mega65.vs x64 -kernal build/kernal_mega65.rom -basic build/basic_mega65.rom -moncommands build/symbols_mega65.vs -8 empty.d64 +test_mega65_xemu: build/newc65.rom + ../xemu/build/bin/xc65.native -dmarev 2 -rom build/newc65.rom + test_ultimate64: build/kernal_ultimate64.rom build/basic_ultimate64.rom build/symbols_ultimate64.vs x64 -kernal build/kernal_ultimate64.rom -basic build/basic_ultimate64.rom -moncommands build/symbols_ultimate64.vs -8 empty.d64 @@ -217,9 +223,6 @@ test_hybrid: build/kernal_hybrid.rom build/symbols_hybrid.vs test_m65: build/newc65.rom m65 -b ../mega65-core/bin/mega65r1.bit -k ../mega65-core/bin/KICKUP.M65 -R build/newc65.rom -4 -test_xemu: build/newc65.rom - ../xemu/build/bin/xc65.native -dmarev 2 -rom build/newc65.rom - testremote: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -moncommands build/symbols_generic.vs -remotemonitor diff --git a/STATUS.md b/STATUS.md index 4d338117..73dcd39c 100644 --- a/STATUS.md +++ b/STATUS.md @@ -29,7 +29,7 @@ The following ROM features are currently missing: * tape support * RS-232 support * breaking Kernal routines with RUN/STOP key -* NMI andling is incomplete +* NMI handling is incomplete # API status diff --git a/bin/basic_ultimate64.rom b/bin/basic_ultimate64.rom index 5c33e194ee4377bc6d5a099dffaedac83a950ab7..1c579875bf75472b09d3464860e60f2088fdd544 100644 GIT binary patch delta 19 bcmZp0XmHrDijD2+kEI(Fu5RAI79a@#SJamX%K$Zk{;r-|AO z4k65$cHdmoWLTOVLdl4&TsZ25(QKoqap5c7uq-suNLk{X#hWkBd;Yxd z^LyTNyhpr8!b^H%T9w0)#t-yobRIf?xJu9SMcio!^U?W7hGSL7QbqWo3|nRN#g=qy zbYUziLX;}UiFqcHP#~*EBc;HL`w|8=*u9zYNIvGzk4F+Qe`5T0lKi`o3V}a?M&>^^ zpQ+~Ec-2Y-uZp5M!(Y-3_-rq%haz66|HLq-ipYxJXgF_~^GFgA2pt{ znN*)1UD*kVm3b8n1-#w(Ht)q>qDXzi9#t%6wbTl>^ z3-J;OaGu$S0@v_Qw!VXQb>ir^M=yYdf{()RUeL;nw+VG|LgD#5Oj6i;0zUkL{bha< zAGddyOlsJ%oS{sjKpe%7K0%+QmZDT}sozoW_0JvXgmD6gY1#UDE^))!P! zn*vo7rt<7WcW|}y{SG#ejlD=)(H&L(gIMJyQXAr=d(sl5ip=RfaTYe|1Z)>V`!TbS zea<$=kE&+|I`Zh*JbU`8XT~$@6j@`OaJDtSr3T9tf@((4ik8$$^Y5UYvK?(=m+R9O zZ)rNkw*GK;I!S~ZE7{lXuCScs2T~GwOAy5oSCfV1rfvLg5{=*$S1)hC%}oxz4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*mjy(RT@zqg$OfrvuExYl7 z*@yf4vdb3)mR$Q_cU8X zB{DTyFDu-9>H`#*dx3lDHP*`?n2rJM`E^qE0_!s{L+Ap_%7zPUCnsHC2bz1_=h@`H za*`g;el6m^yZieEw!StdpJ%^L34A)qd4XdkL+?Zo_aq09-2i0^Utm-C`3)pG8OU;Z U3Sv#U@YBcTm5<`D$#L?F0Q#Vew*UYD diff --git a/bin/kernal_ultimate64.rom b/bin/kernal_ultimate64.rom index bc015e103378dcd1e14cf78af7bea938edd935f0..e1f031b546613e6383339ada56f17842deca857d 100644 GIT binary patch delta 878 zcmY+CT}TvB6vt;~-Bnl2S#{mDvTj9b_C*hdL4ps0LI*0M$iA59Dd?ek>5EE;iOsN@ z?mpNNG`m0LJXFxA+4>IRz8{I{$aFw(uBSFH(UB>n+4lpHbW}+PBC)6v3k(_L z$5cW?N(_Si7u*L5`HgtgbCD-_U->Ta28E}V^RpaA=l=9LPzn!}pLVKLf@0iIv4^Ml zTE&x1)=UpK^w=zpJVPI|QD~i()H~v@P??HNA>>2WOsI|p^(Bf^^##Q7smkr_<@3rV z+x+yV18z-g(n5g+jlSn|h-8?ztlj}rkYD`gUZOqIh+waGC4U1qdJnU{akqExB33;$ z=&?k5?Irk_#q-|%u9^(ABsqMrY7Otlm#cEbqg6Zk1GwI|f}g8Ynd?oM4p?FL8bl0_n44dZuwANg*#KpZsjx8= zHx~z@kyt>9MI-5el8z3=$&cK^bK8AwKoGyLKErx%UEEsIo-dwLkcXi?qgN6K zbY;{}&OB(Rt`N6sG=8mHVAMUNR5kp^m_wsU2Cd&ACF+RNFa^fOYz=WvEr@cF6lfj9 zrQafj?Ehf~KEJHGH8>Y4n<%2hb^VIKj{1#g>BXc-gmz!_~c(gO2gp* delta 857 zcmY+CT}TvB6vuaF9amS(@nhZHQoGrgSrR=M1_eF@3LUTrW3`Nlo`N2#mnE-hOAGr7Y{^#84!s^1d ze1V(CM};-OV9-d0R$N8`;<&0Qoz*}ATDtpoG%{DWd$K5G61+O7N9L`TI zR)Z~#enxA^7h+!5Te^e1-20#FL#4~ehi$fOt_~O2F0$OX!FDdm zJKjBI63uGKA$7m}MZ$k<)4J49>}?2IYr4yL^f3%A__d=jtHkhx zTTQdMqGgEC9OyT4SS#f@>%?Y0fm58fQ2koVWY7$|Xp5hS-tpj({&BWS<%{fx`ZcET zE2lGo?KZN=em`LBb5^pL#oLP#Tp?7Zqe=r-es{R7cX({ed>GSjKo9n04p-%^x~}p~ zth=}#O?%ux$Ce`A%s|i+>Huk@R!bxaEZvwqDGz`vq@@uvJPs*iLKLc2a}%rLFZiCb z#iJ#YM8)s8!W^0kFhH%5Bq-y8KgcsSW;2N}w Date: Fri, 11 Oct 2019 18:38:43 +0200 Subject: [PATCH 31/85] changes to avoid accidental similarity --- bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/aliases/,aliases_cpu.s | 6 +- c64/kernal/assets/keyboard_matrix.s | 92 ++++++++++++++-------- c64/kernal/screen/chrout_screen_control.s | 18 ++--- 6 files changed, 72 insertions(+), 44 deletions(-) diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom index 9e5f655fa2808d1c65034ee91fc106f42a0d37ad..4795ba13d79c587d63291e375748d9985cfcdcdd 100644 GIT binary patch delta 37 scmZp0XmHr@Urw^`0{2>p3z|&55*K`$f1TvJzz*bcGF^B-Swj8=05x3@jQ{`u delta 37 scmZp0XmHr@Urv(m0{dEt3!F?BI8XLn;07`^nR+EI_%#2TEFu2_03a9-rvLx| diff --git a/bin/kernal_mega65.rom b/bin/kernal_mega65.rom index b108fb6e757fe41e5dfaadd42281616e64cbd3aa..87da23d18a8bea770fc37b8a6a65b79fd548837e 100644 GIT binary patch delta 37 scmZp0XmHr@Urw^`0{2>p3z|&55*K`)|2oNcfgQ-@WV-NvvV{B#06YN@@c;k- delta 37 scmZp0XmHr@Urv(m0{dEt3!F?BI8XLn;07`^nR+EI_&onLSwj8=03vV@3jhEB diff --git a/bin/kernal_ultimate64.rom b/bin/kernal_ultimate64.rom index e1f031b546613e6383339ada56f17842deca857d..48b7482a12f8be9de5170975df2825f03ed964a3 100644 GIT binary patch delta 37 scmZp0XmHr@Urw^`0{2>p3z|&55*K`?{5r{ZfgQ-@WV-NvvV{B#05*OQo&W#< delta 37 scmZp0XmHr@Urv(m0{dEt3!F?BI8XLn;07`^nR+EI_)PgVSwj8=03d!3xBvhE diff --git a/c64/aliases/,aliases_cpu.s b/c64/aliases/,aliases_cpu.s index 38d7a572..7e2bbfa5 100644 --- a/c64/aliases/,aliases_cpu.s +++ b/c64/aliases/,aliases_cpu.s @@ -1,9 +1,13 @@ - // // Provide pseudocommands to make CPU optimizations easier // +// +// Stack manipulation - some CPUs will leave .A unchanged, some will use it as temporary storage, so consider .A trashed +// + + .pseudocommand phx_trash_a { #if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816 diff --git a/c64/kernal/assets/keyboard_matrix.s b/c64/kernal/assets/keyboard_matrix.s index 1c36c586..b5f2af05 100644 --- a/c64/kernal/assets/keyboard_matrix.s +++ b/c64/kernal/assets/keyboard_matrix.s @@ -1,26 +1,32 @@ -// Key board matrixes: unshifted, shifted, control and C= modified -// 64 bytes for each +// +// Keyboard matrix, based on +// +// - [RG64] C64 Programmer's Reference Guide - pages 379-381 +// - [CM64] Compute's Mapping the Commodore 64 - pages 38-39 +// - http://commodore128.mirkosoft.sk/keyboard.html (C128 extension) +// - http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt + +// Values can be computed by running a program like: +// 10 GET A$ : IF A$ = "" GOTO10 +// 20 PRINT ASC(A$) : GOTO10 +// and converting the values + keyboard_matrix: - // Unshifted matrix built by refering to - // Compute's Mapping the 64 p38-39 - // and C64 PRG pages 379-381 - .byte $14,$0D,$1D,$88,$85,$86,$87,17 - .byte $33,87,$41,$34,$5A,83,$45,$00 - .byte $35,$52,$44,$36,$43,$46,$54,88 + + // Normal + .byte $14,$0D,$1D,$88,$85,$86,$87,$11 + .byte $33,$57,$41,$34,$5A,$53,$45,$00 + .byte $35,$52,$44,$36,$43,$46,$54,$58 .byte $37,$59,$47,$38,$42,$48,$55,$56 .byte $39,$49,$4A,$30,$4D,$4B,$4F,$4E - .byte $2B,$50,$4C,45,46,58,$40,44 - .byte $5C,$2A,59,$13,$00,$3D,$5E,$2F + .byte $2B,$50,$4C,$2D,$2E,$3A,$40,$2C + .byte $5C,$2A,$3B,$13,$00,$3D,$5E,$2F .byte $31,$5F,$00,$32,$20,$00,$51,$03 - // Shifted keyboard - // Values computed by running a program like: - // 10 GETA$:IFA$=""GOTO10 - // 20 ?ASC(A$):GOTO10 - // and converting the values + // With SHIFT .byte $94,$8D,$9D,$8C,$89,$8A,$8B,$91 .byte $23,$77,$61,$24,$7A,$73,$65,$00 .byte $25,$72,$64,$26,$63,$66,$74,$78 @@ -30,7 +36,7 @@ keyboard_matrix: .byte $A9,$C0,$5D,$93,$00,$3D,$DE,$3F .byte $21,$5F,$00,$22,$A0,$00,$71,$83 - // Vendor key modified keyboard + // With VENDOR key .byte $94,$8D,$9D,$8C,$89,$8A,$8B,$91 .byte $96,$B3,$B0,$97,$AD,$AE,$B1,$00 .byte $98,$B2,$AC,$99,$BC,$BB,$A3,$BD @@ -40,7 +46,7 @@ keyboard_matrix: .byte $A8,$DF,$5D,$93,$00,$3D,$DE,$3F .byte $81,$5F,$00,$95,$a0,$00,$AB,$83 - // Control modified keyboard + // With CTRL .byte $00,$00,$00,$00,$00,$00,$00,$00 .byte $1C,$17,$01,$9F,$1A,$13,$05,$00 .byte $9C,$12,$04,$1E,$03,$06,$14,$18 @@ -50,23 +56,41 @@ keyboard_matrix: .byte $1C,$00,$1D,$00,$00,$1F,$1E,$00 .byte $90,$06,$00,$05,$00,$00,$11,$00 - keyboard_matrix_lookup: - // Work out if normal, shifted, control or Vendor - // modified keyboard. - // Table contains the offsets into keyboard_matrixes - // that should be used for different values of - // the bottom 3 bits of key_bucky_state - // Interaction is simple to work out when playing - // with a C64: - // CONTROL trumps SHIFT or Vendor - // Vendor + SHIFT = DOES NOTHING + // Work out if normal, shifted, control or Vendor modified keyboard. + // Table contains the offsets into keyboard_matrixes that should be used + // for different values of the bottom 3 bits of key_bucky_state XXX + // Interaction is simple to work out when playing with a C64: + // CTRL trumps SHIFT or VENDOR + // VENDOR + SHIFT = DOES NOTHING // All 3 does CONTROL .byte $00 // Normal - .byte $40 // Shifted - .byte $80 // Control - .byte $80 // Control + SHIFT - .byte $C0 // Vendor - .byte $C0 // Vendor + SHIFT - .byte $80 // Vendor+ CTRL - .byte $80 // Vendor + CTRL + SHIFT + .byte $40 // SHIFT + .byte $80 // CTRL + .byte $80 // CTRL + SHIFT + .byte $C0 // VENDOR + .byte $C0 // VENDOR + SHIFT + .byte $80 // VENDOR + CTRL + .byte $80 // VENDOR + CTRL + SHIFT + + +// keyboard_matrix_ext128: $D02F + + // .byte (HELP),$38,$35,(TAB),$32,$34,$37,$31 // $FE + // .byte $1B, $2B, $2D,$0A,$0D,$36,$39,$33 // $FD + // .byte $00,$30,$2E,$91,$11,$9D,$1D,(NO_SCRL) // $FB + +// keyboard_matrix_ext65: + + // Last column - normal + // .byte (NO_SCRL),(TAB),$00,(HELP),(F9),(F11),(F13),$1B + + // Last column - shifted + // .byte (NO_SCRL),(TAB),$00,(HELP),(F10),(F12),(F14),$1B + + + // XXX ESC : $1B (alias: CTRL [ ) + // XXX HELP : (to be determined, ?) + // XXX TAB : (to be determined, $18 ?) + // XXX NO_SCRL : (to be determined, ?) + // XXX ALT : bucky, 128: row 3, 1st, 65: 3rd \ No newline at end of file diff --git a/c64/kernal/screen/chrout_screen_control.s b/c64/kernal/screen/chrout_screen_control.s index 440ace12..ff4f5706 100644 --- a/c64/kernal/screen/chrout_screen_control.s +++ b/c64/kernal/screen/chrout_screen_control.s @@ -105,15 +105,6 @@ rvs_l1: sta RVS jmp chrout_screen_done !: -chrout_try_MODE_TXT: - - cmp #$0E - bne !+ - - lda VIC_YMCSB - ora #$02 // to lower case - bne mode_l1 // branch always -!: chrout_try_MODE_GFX: cmp #$8E @@ -125,6 +116,15 @@ mode_l1: sta VIC_YMCSB jmp chrout_screen_done !: +chrout_try_MODE_TXT: + + cmp #$0E + bne !+ + + lda VIC_YMCSB + ora #$02 // to lower case + bne mode_l1 // branch always +!: chrout_try_COLOR: ldx #$0F From a64da02dad9e88eb66199086cbae5abf7684432f Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 11 Oct 2019 19:56:34 +0200 Subject: [PATCH 32/85] added pseudocommands for branch word-relative instructions --- c64/aliases/,aliases_cpu.s | 102 +++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/c64/aliases/,aliases_cpu.s b/c64/aliases/,aliases_cpu.s index 7e2bbfa5..7a61c8aa 100644 --- a/c64/aliases/,aliases_cpu.s +++ b/c64/aliases/,aliases_cpu.s @@ -47,3 +47,105 @@ tay #endif } + + +// +// Branches with far offsets, substitutes by Bxx + JMP for CPUs not supporting the instruction +// + + +.pseudocommand bcs_far dst +{ +#if CONFIG_CPU_CSG_65CE02 + .var offset = mod($10000 + dst.getValue() - *, $10000) + .byte $B3, mod(offset, $100), floor(offset / $100) +#else + bcc __l + jmp dst +__l: +#endif +} + +.pseudocommand bcc_far dst +{ +#if CONFIG_CPU_CSG_65CE02 + .var offset = mod($10000 + dst.getValue() - *, $10000) + .byte $93, mod(offset, $100), floor(offset / $100) +#else + bcs __l + jmp dst +__l: +#endif +} + +.pseudocommand beq_far dst +{ +#if CONFIG_CPU_CSG_65CE02 + .var offset = mod($10000 + dst.getValue() - *, $10000) + .byte $F3, mod(offset, $100), floor(offset / $100) +#else + bne __l + jmp dst +__l: +#endif +} + +.pseudocommand bne_far dst +{ +#if CONFIG_CPU_CSG_65CE02 + .var offset = mod($10000 + dst.getValue() - *, $10000) + .byte $D3, mod(offset, $100), floor(offset / $100) +#else + beq __l + jmp dst +__l: +#endif +} + +.pseudocommand bmi_far dst +{ +#if CONFIG_CPU_CSG_65CE02 + .var offset = mod($10000 + dst.getValue() - *, $10000) + .byte $33, mod(offset, $100), floor(offset / $100) +#else + bpl __l + jmp dst +__l: +#endif +} + +.pseudocommand bpl_far dst +{ +#if CONFIG_CPU_CSG_65CE02 + .var offset = mod($10000 + dst.getValue() - *, $10000) + .byte $13, mod(offset, $100), floor(offset / $100) +#else + bmi __l + jmp dst +__l: +#endif +} + +.pseudocommand bvc_far dst +{ +#if CONFIG_CPU_CSG_65CE02 + .var offset = mod($10000 + dst.getValue() - *, $10000) + .byte $53, mod(offset, $100), floor(offset / $100) +#else + bvs __l + jmp dst +__l: +#endif +} + +.pseudocommand bvs_far dst +{ +#if CONFIG_CPU_CSG_65CE02 + .var offset = mod($10000 + dst.getValue() - *, $10000) + .byte $73, mod(offset, $100), floor(offset / $100) +#else + bvc __l + jmp dst +__l: +#endif +} From deac5dcb518b20ebc273b3d2c4b0627b1ae41823 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 11 Oct 2019 22:26:03 +0200 Subject: [PATCH 33/85] implemented routine pointed by KEYTAB --- STATUS.md | 2 +- c64/aliases/,aliases_ram_lowmem.s | 2 +- c64/kernal/cint_real.s | 4 +- c64/kernal/scnkey.s | 83 +++++++++++++++++++++++++++++++ c64/kernal/scnkey_set_keytab.s | 53 ++++++++++++++++++++ c64/kernal/setup_keydecode.s | 5 -- 6 files changed, 140 insertions(+), 9 deletions(-) create mode 100644 c64/kernal/scnkey.s create mode 100644 c64/kernal/scnkey_set_keytab.s delete mode 100644 c64/kernal/setup_keydecode.s diff --git a/STATUS.md b/STATUS.md index 73dcd39c..6c5ebc5b 100644 --- a/STATUS.md +++ b/STATUS.md @@ -98,7 +98,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | Address | Unofficial | Name | Status | Remarks | | :-------: | :--------: | :---------- | :------: | :------------------------------------------------: | -| `($028F)` | | `KEYLOG` | NOT DONE | | +| `($028F)` | | `KEYLOG` | DONE | | | `$FF81` | `$FF5B` | `CINT` | DONE | | | `$FF84` | `$FDA3` | `IOINIT` | PARTIAL | CIA initialization incomplete | | `$FF87` | `$FD50` | `RAMTAS` | DONE | | diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index b336613e..e597a011 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -153,7 +153,7 @@ .label INSRT = $D8 // insert mode flag/counter .label LDTBL = $D9 // $D9-$F2 screen line link table, [!] our usage is different XXX give more details .label USER = $F3 // $F3-$F4 pointer to current color RAM location - .label KEYTAB = $F5 // $F5-$F6 -- NOT IMPLEMENTED -- + .label KEYTAB = $F5 // $F5-$F6 pointer to keyboard lookup table .label RIBUF = $F7 // $F7-$F8 -- NOT IMPLEMENTED -- .label ROBUF = $F9 // $F9-$FA -- NOT IMPLEMENTED -- // $FB $FB-$FE -- UNUSED -- free for user software diff --git a/c64/kernal/cint_real.s b/c64/kernal/cint_real.s index 21a5490f..dc6088e7 100644 --- a/c64/kernal/cint_real.s +++ b/c64/kernal/cint_real.s @@ -58,9 +58,9 @@ cint_pal: // Setup KEYLOG vector - XXX is it proper place? - lda #setup_keydecode + lda #>scnkey_set_keytab sta KEYLOG+1 cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? diff --git a/c64/kernal/scnkey.s b/c64/kernal/scnkey.s new file mode 100644 index 00000000..a1946dc0 --- /dev/null +++ b/c64/kernal/scnkey.s @@ -0,0 +1,83 @@ + +// +// Official Kernal routine, described in: +// +// - [RG64] C64 Programmer's Reference Guide - page 295 +// - [CM64] Compute's Mapping the Commodore 64 - page 220 +// +// CPU registers that has to be preserved (see [RG64]): none +// + +// Variables used: +// - KEYTAB - keyboard matrix pointer +// - DELAY - counter for first delay between key repeats +// - KOUNT - counter for next delays between key repeats +// - SHFLAG - SHIFT / CTRL / VENDOR keypress status +// - NDX - number of characters in keyboard buffer +// - XMAX - maximum size of keyboard buffer +// - LSTX - matrix coordinate of last pressed key +// - LSTSHF - previous status of SHFLAG +// - MODE - flag, whether charset toggle (SHIFT+VENDOR) is allowed + + +#if !CONFIG_SCNKEY_TWW_CTR + +// Routine is heavily inspired by TWW/CTR proposal, see here: +// - http://codebase64.org/doku.php?id=base:scanning_the_keyboard_the_correct_and_non_kernal_way + + +SCNKEY: + + // Handle repeat timer + + ldx KOUNT + beq sk_start + dec KOUNT + + // Setup the CIA registers + + ldx #$FF + stx CIA1_DDRA // output + ldy #$00 + sty CIA1_DDRB // input + + // Prepare for SHFLAG update + + lda SHFLAG + sta LSTSHF + sty SHFLAG + + // XXX retrieve ALT and NO_SCRL status for C128/C65 keyboards + + // Check for any activity + + sty CIA1_PRA // connect all the lines + cpx CIA1_PRB + beq scnkey_no_keys + + // XXX retrieve SHIFT / CTRL / VENDOR status + + // Set pointer in KEYTAB + jsr scnkey_via_keytab + + // XXX scan the keyboard matrix + + + + + + + + // XXX + +scnkey_no_keys: + + // ldx #$FF + stx LSTX + + rts + +scnkey_via_keytab: + jmp (KEYTAB) + +#endif // No CONFIG_SCNKEY_TWW_CTR diff --git a/c64/kernal/scnkey_set_keytab.s b/c64/kernal/scnkey_set_keytab.s new file mode 100644 index 00000000..e9ae5671 --- /dev/null +++ b/c64/kernal/scnkey_set_keytab.s @@ -0,0 +1,53 @@ + +// +// Well-known Kernal routine, described in: +// +// - [CM64] Compute's Mapping the Commodore 64 - pages 220, 221 +// + +scnkey_set_keytab: + + // Set initial KEYTAB value + + lda #keyboard_matrix + sta KEYTAB+1 + + // Calculate table index + + lda SHFLAG + and #$07 // we are only interested in SHIFT / CTRL / VENDOR keys + tax + + // Retrieve table offset + lda keyboard_matrix_lookup, x + + // Add offset to the vector + sec + adc KEYTAB+0 + sta KEYTAB+0 + lda #$00 + adc KEYTAB+1 + sta KEYTAB+1 + + // Check if we should toggle the character set + + lda MODE + bne !+ // not allowed to toggle + lda SHFLAG + and #$03 + cmp #$03 + bne !+ // no SHIFT + VENDOR pressed + lda LSTSHF + and #$03 + cmp #$03 + beq !+ // alreeady toggled + + // Toggle char set + + lda VIC_YMCSB + eor #$02 + sta VIC_YMCSB +!: + rts diff --git a/c64/kernal/setup_keydecode.s b/c64/kernal/setup_keydecode.s deleted file mode 100644 index d6010685..00000000 --- a/c64/kernal/setup_keydecode.s +++ /dev/null @@ -1,5 +0,0 @@ - -// XXX provide documentation and implementation - -setup_keydecode: - STUB_IMPLEMENTATION() From 0487488751e7da3914d47d7dfc91a0d864f170eb Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 11 Oct 2019 23:02:35 +0200 Subject: [PATCH 34/85] improved CIA #1 initialization, some cleanups --- Makefile | 1 + c64/kernal/fda3.ioinit.s | 8 ++++ c64/kernal/{ => interrupts}/udtim.s | 0 c64/kernal/{ => keyboard}/scnkey.s | 8 +++- c64/kernal/{ => keyboard}/scnkey_set_keytab.s | 2 + c64/kernal/{ => keyboard}/scnkey_tww_ctr.s | 44 +++++++------------ 6 files changed, 32 insertions(+), 31 deletions(-) rename c64/kernal/{ => interrupts}/udtim.s (100%) rename c64/kernal/{ => keyboard}/scnkey.s (90%) rename c64/kernal/{ => keyboard}/scnkey_set_keytab.s (92%) rename c64/kernal/{ => keyboard}/scnkey_tww_ctr.s (94%) diff --git a/Makefile b/Makefile index c5eb20c9..e737cd4b 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ SRCDIR_KERNAL = $(SRCDIR_COMMON) \ c64/kernal/jumptable \ c64/kernal/iec \ c64/kernal/interrupts \ + c64/kernal/keyboard \ c64/kernal/print \ c64/kernal/screen diff --git a/c64/kernal/fda3.ioinit.s b/c64/kernal/fda3.ioinit.s index 778d5492..7bb0cc06 100644 --- a/c64/kernal/fda3.ioinit.s +++ b/c64/kernal/fda3.ioinit.s @@ -101,6 +101,14 @@ IOINIT: sta CIA1_CRA lda CIA1_ICR + // Setup the CIA1 for reading the keyboard - 'POKE 56322, 0' on original ROMs proves this + // is done during initialization, not during the interrupt + + ldx #$FF + stx CIA1_DDRA // output + ldy #$00 + sty CIA1_DDRB // input + // Set DDR on CIA2 for IEC bus, VIC-II banking lda #$3B sta CIA2_DDRA diff --git a/c64/kernal/udtim.s b/c64/kernal/interrupts/udtim.s similarity index 100% rename from c64/kernal/udtim.s rename to c64/kernal/interrupts/udtim.s diff --git a/c64/kernal/scnkey.s b/c64/kernal/keyboard/scnkey.s similarity index 90% rename from c64/kernal/scnkey.s rename to c64/kernal/keyboard/scnkey.s index a1946dc0..1ea166da 100644 --- a/c64/kernal/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -34,7 +34,7 @@ SCNKEY: beq sk_start dec KOUNT - // Setup the CIA registers + // Setup the CIA registers XXX check whether the C64 does it every time ldx #$FF stx CIA1_DDRA // output @@ -45,6 +45,7 @@ SCNKEY: lda SHFLAG sta LSTSHF + ldy #$00 sty SHFLAG // XXX retrieve ALT and NO_SCRL status for C128/C65 keyboards @@ -52,6 +53,7 @@ SCNKEY: // Check for any activity sty CIA1_PRA // connect all the lines + ldx #$FF cpx CIA1_PRB beq scnkey_no_keys @@ -60,7 +62,9 @@ SCNKEY: // Set pointer in KEYTAB jsr scnkey_via_keytab - // XXX scan the keyboard matrix + // XXX check for joystick activity + + // Scan the keyboard matrix diff --git a/c64/kernal/scnkey_set_keytab.s b/c64/kernal/keyboard/scnkey_set_keytab.s similarity index 92% rename from c64/kernal/scnkey_set_keytab.s rename to c64/kernal/keyboard/scnkey_set_keytab.s index e9ae5671..52db9f7d 100644 --- a/c64/kernal/scnkey_set_keytab.s +++ b/c64/kernal/keyboard/scnkey_set_keytab.s @@ -31,6 +31,8 @@ scnkey_set_keytab: adc KEYTAB+1 sta KEYTAB+1 +scnkey_toggle_if_needed: // entry for SCNKEY (TWW/CTR version) + // Check if we should toggle the character set lda MODE diff --git a/c64/kernal/scnkey_tww_ctr.s b/c64/kernal/keyboard/scnkey_tww_ctr.s similarity index 94% rename from c64/kernal/scnkey_tww_ctr.s rename to c64/kernal/keyboard/scnkey_tww_ctr.s index 83db260a..954ec933 100644 --- a/c64/kernal/scnkey_tww_ctr.s +++ b/c64/kernal/keyboard/scnkey_tww_ctr.s @@ -218,18 +218,15 @@ Main: sta BufferNew+0 sta BufferNew+1 sta BufferNew+2 - - ldx #$ff - stx $dc02 // Port A - Output - ldy #$00 - sty $dc03 // Port B - Input - // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Check for Port Activity - sty $dc00 // Connect all Keyboard Rows - cpx $dc01 + ldx #$FF + ldy #$00 + + sty CIA1_PRA // Connect all Keyboard Rows + cpx CIA1_PRB bne skip0 jmp NoActivityDetected @@ -240,7 +237,7 @@ JoystickActivity: lda #$00 sta SHFLAG - lda $dc01 + lda CIA1_PRB and #$03 cmp #$01 bne !+ @@ -267,7 +264,7 @@ JoystickActivity: beq !+ jmp skdone !: - lda $dc01 + lda CIA1_PRB and #$0c cmp #$04 bne !+ @@ -293,8 +290,8 @@ skip0: // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Check for Control Port #1 Activity - stx $dc00 // Disconnect all Keyboard Rows - cpx $dc01 // Only Control Port activity will be detected + stx CIA1_PRA // Disconnect all Keyboard Rows + cpx CIA1_PRB // Only Control Port activity will be detected bne JoystickActivity // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -303,9 +300,9 @@ skip0: ldx #7 lda #%11111110 next_row: - sta $dc00 + sta CIA1_PRA pha - lda $dc01 + lda CIA1_PRB sta ScanResult,x pla sec @@ -318,8 +315,8 @@ next_row: // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Check for Control Port #1 Activity (again) - stx $dc00 // Disconnect all Keyboard Rows - cpx $dc01 // Only Control Port activity will be detected + stx CIA1_PRA // Disconnect all Keyboard Rows + cpx CIA1_PRB // Only Control Port activity will be detected beq !+ jmp ReturnNoKeys !: @@ -375,19 +372,8 @@ next_row: ora SHFLAG sta SHFLAG - // Chick for shift + Vendor - cmp #$03 - bne no_case_toggle - lda LSTSHF - cmp #$03 - beq no_case_toggle - - lda MODE - bne no_case_toggle - - lda VIC_YMCSB - eor #$02 - sta VIC_YMCSB + // Handle SHIFT + VENDOR + jsr scnkey_toggle_if_needed no_case_toggle: From 31d181aac38cdafcf1a5c7bed4d4030c61dfd715 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 11 Oct 2019 23:10:13 +0200 Subject: [PATCH 35/85] MEMTOP/MEMBOT optimization --- c64/kernal/membot.s | 7 ++++--- c64/kernal/memtop.s | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/c64/kernal/membot.s b/c64/kernal/membot.s index 086545c0..84e6ce44 100644 --- a/c64/kernal/membot.s +++ b/c64/kernal/membot.s @@ -12,13 +12,14 @@ MEMBOT: bcc membot_set - ldx MEMSTR+0 ldy MEMSTR+1 - rts + ldx MEMSTR+0 + + // FALLTROUGH membot_set: + sty MEMSTR+1 stx MEMSTR+0 - stx MEMSTR+1 rts diff --git a/c64/kernal/memtop.s b/c64/kernal/memtop.s index dd50497a..485112a0 100644 --- a/c64/kernal/memtop.s +++ b/c64/kernal/memtop.s @@ -14,7 +14,8 @@ MEMTOP: ldy MEMSIZK+1 ldx MEMSIZK+0 - rts + + // FALLTROUGH memtop_set: From 5b69467dc1328749b420c22f5257e0c4085c78d9 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 12 Oct 2019 14:10:57 +0200 Subject: [PATCH 36/85] work on new keyboard scanning routine --- c64/aliases/,aliases_petscii_codes.s | 150 ++++++++++++++++++ c64/kernal/cint_real.s | 4 + .../kb_matrix.s} | 38 +---- c64/kernal/keyboard/kb_matrix_bucky.s | 36 +++++ c64/kernal/keyboard/kb_matrix_bucky_filter.s | 27 ++++ c64/kernal/keyboard/kb_matrix_lookup.s | 21 +++ c64/kernal/keyboard/kb_matrix_row_keys.s | 27 ++++ c64/kernal/keyboard/scnkey.s | 63 +++++--- c64/kernal/keyboard/scnkey_set_keytab.s | 6 +- c64/kernal/keyboard/scnkey_tww_ctr.s | 6 +- 10 files changed, 319 insertions(+), 59 deletions(-) create mode 100644 c64/aliases/,aliases_petscii_codes.s rename c64/kernal/{assets/keyboard_matrix.s => keyboard/kb_matrix.s} (68%) create mode 100644 c64/kernal/keyboard/kb_matrix_bucky.s create mode 100644 c64/kernal/keyboard/kb_matrix_bucky_filter.s create mode 100644 c64/kernal/keyboard/kb_matrix_lookup.s create mode 100644 c64/kernal/keyboard/kb_matrix_row_keys.s diff --git a/c64/aliases/,aliases_petscii_codes.s b/c64/aliases/,aliases_petscii_codes.s new file mode 100644 index 00000000..0c1ac078 --- /dev/null +++ b/c64/aliases/,aliases_petscii_codes.s @@ -0,0 +1,150 @@ + +// +// PETSCII codes for all the supported keys, for all the keyboards +// +// - [CM64] Compute's Mapping the Commodore 64 +// - [CM128] Compute's Mapping the Commodore 128 +// - https://en.wikipedia.org/wiki/PETSCII +// + + + +// Not really PETSCII codes, but bitmask values for SHFLAG variable +// [CM64] page 68, [CM128] page 212 + +.const KEY_FLAG_SHIFT = %00000001 +.const KEY_FLAG_VENDOR = %00000010 +.const KEY_FLAG_CTRL = %00000100 +.const KEY_FLAG_ALT = %00001000 // C65 / C128 +.const KEY_FLAG_NO_SCRL = %00100000 // C65 / C128, Open ROMs unofficial + + +// Note - the following PETSCII codes are currently unassigned, can be used for further extensions: +// +// $01, $04, $06, $0A, $0B, $0C, $0F, $82, $83, $84 + + +.const KEY_NA = $00 // to indicate that no key is presed + + +// PETSCII codes for our extended screen editor + +.const KEY_BOTTOM = $02 // CTRL+B - DolphinDOS compatible +.const KEY_TAB_FW = $8F // CTRL+>, TAB - Open ROMs unofficial +.const KEY_TAB_BW = $80 // CTRL+<, SHIFT+TAB - Open ROMs unofficial + + +// PETSCII codes for certain C128 and C65 functionalities + +.const KEY_BELL = $07 // C65 / C128, no key +.const KEY_ESC = $1B // C65 / C128 +.const KEY_HELP = $10 // C65 / C128, Open ROMs unofficial + + +// PETSCII codes for programmable keys + +.const KEY_RUN = $03 + +.const KEY_F1 = $85 +.const KEY_F2 = $86 +.const KEY_F3 = $87 +.const KEY_F4 = $88 +.const KEY_F5 = $89 +.const KEY_F6 = $8A +.const KEY_F7 = $8B +.const KEY_F8 = $8C + +.const KEY_F9 = $15 // C65, Open ROMs unofficial +.const KEY_F10 = $16 // C65, Open ROMs unofficial +.const KEY_F11 = $17 // C65, Open ROMs unofficial +.const KEY_F12 = $18 // C65, Open ROMs unofficial +.const KEY_F13 = $19 // C65, Open ROMs unofficial +.const KEY_F14 = $1A // C65, Open ROMs unofficial + + +// PETSCII codes for cursor keys + +.const KEY_CRSR_UP = $91 +.const KEY_CRSR_DOWN = $11 +.const KEY_CRSR_LEFT = $9D +.const KEY_CRSR_RIGHT = $1D + + +// PETSCII codes for colors + +.const KEY_RVS_ON = $12 // CTRL+9 +.const KEY_RVS_OFF = $92 // CTRL+0 + +.const KEY_BLACK = $90 // CTRL+1 +.const KEY_WHITE = $05 // CTRL+2 +.const KEY_RED = $1C // CTRL+3 +.const KEY_CYAN = $9F // CTRL+4 +.const KEY_PURPLE = $9C // CTRL+5 +.const KEY_GREEN = $1E // CTRL+6 +.const KEY_BLUE = $1F // CTRL+7 +.const KEY_YELLOW = $9E // CTRL+8 + +.const KEY_ORANGE = $81 // VENDOR+1 +.const KEY_BROWN = $95 // VENDOR+2 +.const KEY_LT_RED = $96 // VENDOR+3 +.const KEY_GREY_1 = $97 // VENDOR+4 +.const KEY_GREY_2 = $98 // VENDOR+5 +.const KEY_LT_GREEN = $99 // VENDOR+6 +.const KEY_LT_BLUE = $9A // VENDOR+7 +.const KEY_GREY_3 = $9B // VENDOR+8 + + +// PETSCII codes for case toggle + +.const KEY_SHIFT_ON = $09 // no key +.const KEY_SHIFT_OFF = $08 // no key +.const KEY_TXT = $0E // no key +.const KEY_GFX = $8E // no key + + +// PETSCII codes for other non-printable characters + +.const KEY_RETURN = $0D +.const KEY_CLR = $93 +.const KEY_HOME = $13 +.const KEY_INS = $94 +.const KEY_DEL = $14 + + +// PETSCII codes for printable characters + +.const KEY_SPACE = $20 +.const KEY_EXCLAMATION = $21 +.const KEY_QUOTE = $22 +.const KEY_HASH = $23 +.const KEY_DOLLAR = $24 +.const KEY_PERCENT = $25 +.const KEY_AMPERSAND = $26 +.const KEY_APOSTROPHE = $27 +.const KEY_R_BRACKET_L = $28 +.const KEY_R_BRACKET_R = $29 +.const KEY_ASTERISK = $2A +.const KEY_PLUS = $2B +.const KEY_COMA = $2C +.const KEY_MINUS = $2D +.const KEY_FULLSTOP = $2E +.const KEY_SLASH = $2F + +.const KEY_0 = $30 +.const KEY_1 = $31 +.const KEY_2 = $32 +.const KEY_3 = $33 +.const KEY_4 = $34 +.const KEY_5 = $35 +.const KEY_6 = $36 +.const KEY_7 = $37 +.const KEY_8 = $38 +.const KEY_9 = $39 +.const KEY_COLON = $3A +.const KEY_SEMICOLON = $3B +.const KEY_LT = $3C +.const KEY_EQ = $3D +.const KEY_GT = $3E +.const KEY_QUESTION = $3F + +// XXX finish this: $4x, $5x, $6x, $7x, $Ax, $Bx, $Cx, $Dx, $Ex, $Fx diff --git a/c64/kernal/cint_real.s b/c64/kernal/cint_real.s index dc6088e7..d680f2df 100644 --- a/c64/kernal/cint_real.s +++ b/c64/kernal/cint_real.s @@ -74,6 +74,8 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? // Set keyboard decode vector (Compute's Mapping the 64 p215) +#if CONFIG_SCNKEY_TWW_CTR + // Set initial variables for our improved keyboard scan routine lda #$FF ldx #6 @@ -82,6 +84,8 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? bpl !- sta BufferQuantity +#endif + // Set key repeat delay (Compute's Mapping the 64 p215) // Making some numbers up here: Repeat every ~1/10th sec // But require key to be held for ~1/3sec before diff --git a/c64/kernal/assets/keyboard_matrix.s b/c64/kernal/keyboard/kb_matrix.s similarity index 68% rename from c64/kernal/assets/keyboard_matrix.s rename to c64/kernal/keyboard/kb_matrix.s index b5f2af05..e0426358 100644 --- a/c64/kernal/assets/keyboard_matrix.s +++ b/c64/kernal/keyboard/kb_matrix.s @@ -14,9 +14,9 @@ -keyboard_matrix: +kb_matrix: - // Normal +__kb_matrix_normal: .byte $14,$0D,$1D,$88,$85,$86,$87,$11 .byte $33,$57,$41,$34,$5A,$53,$45,$00 .byte $35,$52,$44,$36,$43,$46,$54,$58 @@ -26,7 +26,7 @@ keyboard_matrix: .byte $5C,$2A,$3B,$13,$00,$3D,$5E,$2F .byte $31,$5F,$00,$32,$20,$00,$51,$03 - // With SHIFT +__kb_matrix_shift: .byte $94,$8D,$9D,$8C,$89,$8A,$8B,$91 .byte $23,$77,$61,$24,$7A,$73,$65,$00 .byte $25,$72,$64,$26,$63,$66,$74,$78 @@ -36,7 +36,7 @@ keyboard_matrix: .byte $A9,$C0,$5D,$93,$00,$3D,$DE,$3F .byte $21,$5F,$00,$22,$A0,$00,$71,$83 - // With VENDOR key +__kb_matrix_vendor: .byte $94,$8D,$9D,$8C,$89,$8A,$8B,$91 .byte $96,$B3,$B0,$97,$AD,$AE,$B1,$00 .byte $98,$B2,$AC,$99,$BC,$BB,$A3,$BD @@ -46,7 +46,7 @@ keyboard_matrix: .byte $A8,$DF,$5D,$93,$00,$3D,$DE,$3F .byte $81,$5F,$00,$95,$a0,$00,$AB,$83 - // With CTRL +__kb_matrix_ctrl: .byte $00,$00,$00,$00,$00,$00,$00,$00 .byte $1C,$17,$01,$9F,$1A,$13,$05,$00 .byte $9C,$12,$04,$1E,$03,$06,$14,$18 @@ -56,41 +56,19 @@ keyboard_matrix: .byte $1C,$00,$1D,$00,$00,$1F,$1E,$00 .byte $90,$06,$00,$05,$00,$00,$11,$00 -keyboard_matrix_lookup: - // Work out if normal, shifted, control or Vendor modified keyboard. - // Table contains the offsets into keyboard_matrixes that should be used - // for different values of the bottom 3 bits of key_bucky_state XXX - // Interaction is simple to work out when playing with a C64: - // CTRL trumps SHIFT or VENDOR - // VENDOR + SHIFT = DOES NOTHING - // All 3 does CONTROL - .byte $00 // Normal - .byte $40 // SHIFT - .byte $80 // CTRL - .byte $80 // CTRL + SHIFT - .byte $C0 // VENDOR - .byte $C0 // VENDOR + SHIFT - .byte $80 // VENDOR + CTRL - .byte $80 // VENDOR + CTRL + SHIFT -// keyboard_matrix_ext128: $D02F + +// kb_matrix_ext128: $D02F // .byte (HELP),$38,$35,(TAB),$32,$34,$37,$31 // $FE // .byte $1B, $2B, $2D,$0A,$0D,$36,$39,$33 // $FD // .byte $00,$30,$2E,$91,$11,$9D,$1D,(NO_SCRL) // $FB -// keyboard_matrix_ext65: +// kb_matrix_ext65: // Last column - normal // .byte (NO_SCRL),(TAB),$00,(HELP),(F9),(F11),(F13),$1B // Last column - shifted // .byte (NO_SCRL),(TAB),$00,(HELP),(F10),(F12),(F14),$1B - - - // XXX ESC : $1B (alias: CTRL [ ) - // XXX HELP : (to be determined, ?) - // XXX TAB : (to be determined, $18 ?) - // XXX NO_SCRL : (to be determined, ?) - // XXX ALT : bucky, 128: row 3, 1st, 65: 3rd \ No newline at end of file diff --git a/c64/kernal/keyboard/kb_matrix_bucky.s b/c64/kernal/keyboard/kb_matrix_bucky.s new file mode 100644 index 00000000..6ca59589 --- /dev/null +++ b/c64/kernal/keyboard/kb_matrix_bucky.s @@ -0,0 +1,36 @@ + +// +// Matrix for retrieving bucky key status on the C64 keyboard +// +// Values based on: +// - [CM64] Compute's Mapping the Commodore 64 - pags 58 (SHFLAG), 173 (matrix) +// + + +#if !CONFIG_SCNKEY_TWW_CTR + + +kb_matrix_bucky_confmask: // values to be written to CIA1_PRA + + .byte %11111101 // SHIFT (left) + .byte %10111111 // SHIFT (right) + .byte %01111111 // VENDOR + .byte %01111111 // CTRL + + +kb_matrix_bucky_testmask: // for AND with CIA1_PRB value + + .byte %10000000 // SHIFT (left) + .byte %00010000 // SHIFT (right) + .byte %00100000 // VENDOR + .byte %00000100 // CTRL + + +kb_matrix_bucky_shflag: // mask to be ORed to SHFLAG to mark key status + .byte KEY_FLAG_SHIFT + .byte KEY_FLAG_SHIFT + .byte KEY_FLAG_VENDOR + .byte KEY_FLAG_CTRL + + +#endif // no CONFIG_SCNKEY_TWW_CTR diff --git a/c64/kernal/keyboard/kb_matrix_bucky_filter.s b/c64/kernal/keyboard/kb_matrix_bucky_filter.s new file mode 100644 index 00000000..1443df5e --- /dev/null +++ b/c64/kernal/keyboard/kb_matrix_bucky_filter.s @@ -0,0 +1,27 @@ + +// +// Matrix for filtering out bucky keys while scanning the C64 keyboard +// +// Values based on: +// - [CM64] Compute's Mapping the Commodore 64 - pags 58 (SHFLAG), 173 (matrix) +// + + +#if !CONFIG_SCNKEY_TWW_CTR + + +kb_matrix_bucky_filter: + + // values for OR with CIA1_PRB content to filter out bucky keys + + .byte %00100100 // VENDOR + CONTROL + .byte %00010000 // SHIFT (right) + .byte %00000000 + .byte %00000000 + .byte %00000000 + .byte %00000000 + .byte %10000000 // SHIFT (left) + .byte %00000000 + + +#endif // no CONFIG_SCNKEY_TWW_CTR diff --git a/c64/kernal/keyboard/kb_matrix_lookup.s b/c64/kernal/keyboard/kb_matrix_lookup.s new file mode 100644 index 00000000..53f55497 --- /dev/null +++ b/c64/kernal/keyboard/kb_matrix_lookup.s @@ -0,0 +1,21 @@ + +// +// Work out if normal, shifted, control or Vendor modified keyboard. +// Table contains the offsets into keyboard_matrixes that should be used +// for different values of the bottom 3 bits of key_bucky_state XXX +// Interaction is simple to work out when playing with a C64: +// CTRL trumps SHIFT or VENDOR +// VENDOR + SHIFT = DOES NOTHING +// All 3 does CONTROL +// + +kb_matrix_lookup: + + .byte (__kb_matrix_normal - kb_matrix) // Normal + .byte (__kb_matrix_shift - kb_matrix) // SHIFT + .byte (__kb_matrix_ctrl - kb_matrix) // CTRL + .byte (__kb_matrix_ctrl - kb_matrix) // CTRL + SHIFT + .byte (__kb_matrix_vendor - kb_matrix) // VENDOR + .byte (__kb_matrix_vendor - kb_matrix) // VENDOR + SHIFT + .byte (__kb_matrix_ctrl - kb_matrix) // VENDOR + CTRL + .byte (__kb_matrix_ctrl - kb_matrix) // VENDOR + CTRL + SHIFT diff --git a/c64/kernal/keyboard/kb_matrix_row_keys.s b/c64/kernal/keyboard/kb_matrix_row_keys.s new file mode 100644 index 00000000..c6bda32e --- /dev/null +++ b/c64/kernal/keyboard/kb_matrix_row_keys.s @@ -0,0 +1,27 @@ + +// +// Single row key codes for scanning the C64 keyboard +// +// Values based on: +// - [CM64] Compute's Mapping the Commodore 64 - pags 58 (SHFLAG), 173 (matrix) +// + + +#if !CONFIG_SCNKEY_TWW_CTR + + +kb_matrix_row_keys: + + // values for CIA1_PRA to connect only the given row + + .byte %01111111 + .byte %10111111 + .byte %11011111 + .byte %11101111 + .byte %11110111 + .byte %11111011 + .byte %11111101 + .byte %11111110 + + +#endif // no CONFIG_SCNKEY_TWW_CTR diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 1ea166da..8ae819e5 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -30,43 +30,60 @@ SCNKEY: // Handle repeat timer - ldx KOUNT - beq sk_start + lda KOUNT + beq !+ dec KOUNT - - // Setup the CIA registers XXX check whether the C64 does it every time - - ldx #$FF - stx CIA1_DDRA // output - ldy #$00 - sty CIA1_DDRB // input - +!: // Prepare for SHFLAG update lda SHFLAG sta LSTSHF - ldy #$00 - sty SHFLAG + lda #$00 + sta SHFLAG // XXX retrieve ALT and NO_SCRL status for C128/C65 keyboards // Check for any activity - sty CIA1_PRA // connect all the lines - ldx #$FF - cpx CIA1_PRB + lda #$00 + sta CIA1_PRA // connect all the rows + lda #$FF + cmp CIA1_PRB beq scnkey_no_keys - // XXX retrieve SHIFT / CTRL / VENDOR status + // Retrieve SHIFT / VENDOR / CTRL status + ldy #$03 +scnkey_bucky_loop: + lda kb_matrix_bucky_confmask, y + sta CIA1_PRA + lda kb_matrix_bucky_testmask, y + and CIA1_PRB + bne !+ // not pressed + lda SHFLAG + ora kb_matrix_bucky_shflag, y + sta SHFLAG +!: + dey + bpl scnkey_bucky_loop - // Set pointer in KEYTAB - jsr scnkey_via_keytab + // Set KEYTAB vector + + jsr scnkey_via_keylog // XXX for some CPUs we have indirect jsr // XXX check for joystick activity // Scan the keyboard matrix + ldy #$07 +scnkey_matrix_loop: + lda kb_matrix_row_keys, y + sta CIA1_PRA + lda kb_matrix_bucky_filter, y + ora CIA1_PRB + // XXX + dey + bpl scnkey_matrix_loop @@ -76,12 +93,12 @@ SCNKEY: scnkey_no_keys: - // ldx #$FF - stx LSTX + lda #$FF + sta LSTX rts -scnkey_via_keytab: - jmp (KEYTAB) +scnkey_via_keylog: + jmp (KEYLOG) -#endif // No CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_SCNKEY_TWW_CTR diff --git a/c64/kernal/keyboard/scnkey_set_keytab.s b/c64/kernal/keyboard/scnkey_set_keytab.s index 52db9f7d..eb26ff5d 100644 --- a/c64/kernal/keyboard/scnkey_set_keytab.s +++ b/c64/kernal/keyboard/scnkey_set_keytab.s @@ -9,9 +9,9 @@ scnkey_set_keytab: // Set initial KEYTAB value - lda #keyboard_matrix + lda #>kb_matrix sta KEYTAB+1 // Calculate table index @@ -21,7 +21,7 @@ scnkey_set_keytab: tax // Retrieve table offset - lda keyboard_matrix_lookup, x + lda kb_matrix_lookup, x // Add offset to the vector sec diff --git a/c64/kernal/keyboard/scnkey_tww_ctr.s b/c64/kernal/keyboard/scnkey_tww_ctr.s index 954ec933..5df93157 100644 --- a/c64/kernal/keyboard/scnkey_tww_ctr.s +++ b/c64/kernal/keyboard/scnkey_tww_ctr.s @@ -57,7 +57,7 @@ .label KeyQuantity = $A8 // 1 byte .label BufferNew = $A9 // 3 bytes .label TempZP = $B6 // 1 byte - // These should be initialized in CINIT to $FF + // These should be initialized in CINT to $FF .label BufferQuantity = $B4 // 1 byte .label BufferOld = $293 // 3 bytes .label Buffer = $297 // 4 bytes @@ -116,9 +116,9 @@ accept_key: tax pla and #$3f - ora keyboard_matrix_lookup,x + ora kb_matrix_lookup,x tax - lda keyboard_matrix,x + lda kb_matrix,x // But don't insert $00 characters beq sk_nokey From 890558213abc9ccc8f71e03c695f547b6eeea054 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 12 Oct 2019 19:13:56 +0200 Subject: [PATCH 37/85] initial concept of ROM versioning, still needs quite some work --- c64/,,config_generic.s | 2 + c64/,,config_mega65.s | 2 + c64/,,config_ultimate64.s | 2 + c64/aliases/,aliases_cpu.s | 11 ++++ c64/basic/,imports.s | 3 + c64/basic/basic_cold_start.s | 14 +++++ c64/basic/bf52.interop | 2 + c64/basic/bf52.rom_revision_basic.s | 25 ++++++++ c64/basic/e422.initmsg.jmp.s | 11 ++++ c64/basic/{e422.initmsg.s => initmsg_real.s} | 20 ++++--- c64/kernal/assets/kernal_messages.s | 15 ++++- c64/kernal/{ => iec}/acptr.s | 0 c64/kernal/{ => iec}/listen.s | 0 c64/kernal/{ => iec}/second.s | 0 c64/kernal/{ => iec}/talk.s | 0 c64/kernal/{ => iec}/tksa.s | 0 c64/kernal/{ => iec}/unlsn.s | 0 c64/kernal/{ => iec}/untlk.s | 0 c64/kernal/panic.s | 61 ++++++++++++++++++++ c64/kernal/xxxx.rom_revision_kernal.s | 34 +++++++++++ 20 files changed, 191 insertions(+), 11 deletions(-) create mode 100644 c64/basic/bf52.interop create mode 100644 c64/basic/bf52.rom_revision_basic.s create mode 100644 c64/basic/e422.initmsg.jmp.s rename c64/basic/{e422.initmsg.s => initmsg_real.s} (67%) rename c64/kernal/{ => iec}/acptr.s (100%) rename c64/kernal/{ => iec}/listen.s (100%) rename c64/kernal/{ => iec}/second.s (100%) rename c64/kernal/{ => iec}/talk.s (100%) rename c64/kernal/{ => iec}/tksa.s (100%) rename c64/kernal/{ => iec}/unlsn.s (100%) rename c64/kernal/{ => iec}/untlk.s (100%) create mode 100644 c64/kernal/panic.s create mode 100644 c64/kernal/xxxx.rom_revision_kernal.s diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index f6ffe41c..a351b1ff 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -1,4 +1,6 @@ +.const CONFIG_ID = $00 // should be 1 byte, different for each config file! + // // Please read CONFIG.md before modifying this file! // diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index c187323b..10e621a7 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -1,4 +1,6 @@ +.const CONFIG_ID = $01 // should be 1 byte, different for each config file! + // // Please read CONFIG.md before modifying this file! // diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index 4efd86e3..0f371bbd 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -1,4 +1,6 @@ +.const CONFIG_ID = $02 // should be 1 byte, different for each config file! + // // Please read CONFIG.md before modifying this file! // diff --git a/c64/aliases/,aliases_cpu.s b/c64/aliases/,aliases_cpu.s index 7a61c8aa..1f6137bf 100644 --- a/c64/aliases/,aliases_cpu.s +++ b/c64/aliases/,aliases_cpu.s @@ -3,6 +3,17 @@ // +// +// This one is not for optimization - but to encourage proper usage of panic screen +// + +.pseudocommand panic code +{ + lda code + jmp (panic_vector) +} + + // // Stack manipulation - some CPUs will leave .A unchanged, some will use it as temporary storage, so consider .A trashed // diff --git a/c64/basic/,imports.s b/c64/basic/,imports.s index 2f230d67..38527744 100644 --- a/c64/basic/,imports.s +++ b/c64/basic/,imports.s @@ -4,6 +4,9 @@ #import "KERNAL_combined.sym" +.label panic_vector = KERNAL.panic_vector +.label rom_revision_kernal = KERNAL.rom_revision_kernal + #if CONFIG_DBG_PRINTF .label printf = KERNAL.printf #endif diff --git a/c64/basic/basic_cold_start.s b/c64/basic/basic_cold_start.s index 5f8d27e3..b58bc453 100644 --- a/c64/basic/basic_cold_start.s +++ b/c64/basic/basic_cold_start.s @@ -3,6 +3,16 @@ basic_cold_start: + // Before doing anything, check if we have a compatible Kernal + + ldy #(__rom_revision_basic_end - rom_revision_basic - 1) +!: + lda rom_revision_basic, y + cmp rom_revision_kernal, y + bne basic_cold_start_rom_mismatch + dey + bpl !- + // Setup vectors at $300 ldy #$0B !: @@ -32,3 +42,7 @@ basic_cold_start: // jump into warm start loop jmp basic_warm_start + +basic_cold_start_rom_mismatch: + + panic #$01 diff --git a/c64/basic/bf52.interop b/c64/basic/bf52.interop new file mode 100644 index 00000000..b2a62a7b --- /dev/null +++ b/c64/basic/bf52.interop @@ -0,0 +1,2 @@ + +Special case - we need a constant memory location where we can put an ID and a revision string. According to Compute's Mapping the Commodore 64 (page 117) this area is unused - so a perfect place. diff --git a/c64/basic/bf52.rom_revision_basic.s b/c64/basic/bf52.rom_revision_basic.s new file mode 100644 index 00000000..28940329 --- /dev/null +++ b/c64/basic/bf52.rom_revision_basic.s @@ -0,0 +1,25 @@ + +// +// !!! PROPOSAL ONLY !!! PROPOSAL ONLY !!! NOT FOR USING EXTERNALLY YET !!! +// +// +// Do not change! Locations of the following data should be constant - now and forever! +// +// If you want to integrate Open ROMs support in your emulator, FPGA ccomputer, etc. - this +// is the official way to recognize the ROM and it's revision. +// + + +rom_revision_basic: + + // $BF52 + + .text "OR" // Magic string, after "Open ROMs" + .byte CONFIG_ID // Config file ID, might change between revisions + +rom_revision_basic_string: + + .text "DEVEL SNAPSHOT" // Actual ROM revision string + .byte $00 + +__rom_revision_basic_end: diff --git a/c64/basic/e422.initmsg.jmp.s b/c64/basic/e422.initmsg.jmp.s new file mode 100644 index 00000000..5bb33656 --- /dev/null +++ b/c64/basic/e422.initmsg.jmp.s @@ -0,0 +1,11 @@ + +// +// Well-known BASIC routine, described in: +// +// - [CM64] Compute's Mapping the Commodore 64 - page 212 +// +// Prints the start-up messages +// + +INITMSG: + jmp initmsg_real diff --git a/c64/basic/e422.initmsg.s b/c64/basic/initmsg_real.s similarity index 67% rename from c64/basic/e422.initmsg.s rename to c64/basic/initmsg_real.s index 6c2cd302..f79e316f 100644 --- a/c64/basic/e422.initmsg.s +++ b/c64/basic/initmsg_real.s @@ -1,13 +1,8 @@ -// -// Well-known BASIC routine, described in: -// -// - [CM64] Compute's Mapping the Commodore 64 - page 212 -// -// Prints the start-up messages -// +// Routine is too long to fit in the original location -INITMSG: + +initmsg_real: // Print startup banner, up to 255 characters ldx #$00 @@ -19,6 +14,10 @@ INITMSG: bne !- !: + // Print ROM revision + lda #rom_revision_basic_string + jsr STROUT // Print PAL/NTSC, if configured @@ -26,6 +25,9 @@ INITMSG: jsr print_pal_ntsc #endif + jsr initmsg_double_return + jsr print_return + // Work out free bytes, display them jsr basic_do_new sec @@ -41,6 +43,6 @@ INITMSG: ldx #34 jsr print_packed_message - // XXX put them into packed message +initmsg_double_return: jsr print_return jmp print_return diff --git a/c64/kernal/assets/kernal_messages.s b/c64/kernal/assets/kernal_messages.s index 8827bf91..2e3c9a13 100644 --- a/c64/kernal/assets/kernal_messages.s +++ b/c64/kernal/assets/kernal_messages.s @@ -17,6 +17,9 @@ .label __MSG_KERNAL_NTSC = __kernal_message_ntsc - __kernal_messages_start #endif +.label __MSG_KERNAL_PANIC = __kernal_message_panic - __kernal_messages_start +.label __MSG_KERNAL_PANIC_VERSION = __kernal_message_panic_version - __kernal_messages_start + __kernal_messages_start: @@ -51,11 +54,19 @@ __kernal_message_to_hex: #if CONFIG_BANNER_PAL_NTSC __kernal_message_pal: - .text "PAL," + .text ", PAL" .byte $80 + $20 // end of string mark + space __kernal_message_ntsc: - .text "NTSC," + .text ", NTSC" .byte $80 + $20 // end of string mark + space #endif // CONFIG_BANNER_PAL_NTSC + +__kernal_message_panic: + .text "KERNAL PANI" + .byte $80 + $43 // end of string mark + 'C' + +__kernal_message_panic_version: + .text " - ROM MISMATC" + .byte $80 + $48 // end of string mark + 'H' diff --git a/c64/kernal/acptr.s b/c64/kernal/iec/acptr.s similarity index 100% rename from c64/kernal/acptr.s rename to c64/kernal/iec/acptr.s diff --git a/c64/kernal/listen.s b/c64/kernal/iec/listen.s similarity index 100% rename from c64/kernal/listen.s rename to c64/kernal/iec/listen.s diff --git a/c64/kernal/second.s b/c64/kernal/iec/second.s similarity index 100% rename from c64/kernal/second.s rename to c64/kernal/iec/second.s diff --git a/c64/kernal/talk.s b/c64/kernal/iec/talk.s similarity index 100% rename from c64/kernal/talk.s rename to c64/kernal/iec/talk.s diff --git a/c64/kernal/tksa.s b/c64/kernal/iec/tksa.s similarity index 100% rename from c64/kernal/tksa.s rename to c64/kernal/iec/tksa.s diff --git a/c64/kernal/unlsn.s b/c64/kernal/iec/unlsn.s similarity index 100% rename from c64/kernal/unlsn.s rename to c64/kernal/iec/unlsn.s diff --git a/c64/kernal/untlk.s b/c64/kernal/iec/untlk.s similarity index 100% rename from c64/kernal/untlk.s rename to c64/kernal/iec/untlk.s diff --git a/c64/kernal/panic.s b/c64/kernal/panic.s new file mode 100644 index 00000000..bb67d4b2 --- /dev/null +++ b/c64/kernal/panic.s @@ -0,0 +1,61 @@ + +// +// Something terrible happened - show the panic screen +// + +// .A = 0 - just panic, no extra message +// .A = 1 - ROM version mismatch + +panic: + + sei + pha + + jsr IOINIT + jsr setup_vicii + jsr clear_screen + + // XXX disable NMIs + + ldx #$14 + ldy #$0E + jsr plot_set + + ldx #__MSG_KERNAL_PANIC + jsr print_kernal_message + + pla + beq kernal_panic_infinite_loop + pha + + ldx #$02 + ldy #$02 + jsr plot_set + + pla + pha + jsr print_hex_byte + + pla + cmp #$01 + bne kernal_panic_infinite_loop + + ldx #__MSG_KERNAL_PANIC_VERSION + jsr print_kernal_message + +kernal_panic_infinite_loop: + ldx #$00 + stx VIC_EXTCOL + + ldx #$80 +!: + dex + bne !- + + ldx #$06 + stx VIC_EXTCOL +!: + dex + bne !- + + beq kernal_panic_infinite_loop // branch always diff --git a/c64/kernal/xxxx.rom_revision_kernal.s b/c64/kernal/xxxx.rom_revision_kernal.s new file mode 100644 index 00000000..cbd215a0 --- /dev/null +++ b/c64/kernal/xxxx.rom_revision_kernal.s @@ -0,0 +1,34 @@ + +// +// !!! PROPOSAL ONLY !!! PROPOSAL ONLY !!! NOT FOR USING EXTERNALLY YET !!! +// +// +// Do not change! Locations of the following data should be constant - now and forever! +// +// If you want to integrate Open ROMs support in your emulator, FPGA ccomputer, etc. - this +// is the official way to recognize the ROM and it's revision. +// + + +// XXX we need to find a safe address within $E4D3-$FFFF range, we need 20 bytes + + +panic_vector: + + // This vector is to be used by non-Kernal ROMs, if they want to complain + // about incompatible ROM releases - jump via this vector with .A set to 1 + + .byte panic + +rom_revision_kernal: + + .text "OR" // Magic string, after "Open ROMs" + .byte CONFIG_ID // Config file ID, might change between revisions + +rom_revision_kernal_string: + + .text "DEVEL SNAPSHOT" // Actual ROM revision string + .byte $00 + +__rom_revision_kernal_end: From 5a231c184785f0f9d84068e7650904dc790a72ed Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 13 Oct 2019 11:29:02 +0200 Subject: [PATCH 38/85] added panic screen, added versioning mechanism proposal --- CONFIG.md | 20 ++-- Makefile | 7 +- c64/,,config_generic.s | 11 ++- c64/,,config_mega65.s | 11 ++- c64/,,config_ultimate64.s | 11 ++- c64/aliases/,aliases_config.s | 29 ++++++ c64/aliases/,aliases_cpu.s | 7 +- c64/aliases/,aliases_error_codes.s | 6 ++ c64/basic/,imports.s | 10 +- c64/basic/{ => commands}/cmd_break.s | 0 c64/basic/{ => commands}/cmd_list.s | 0 c64/basic/{ => commands}/cmd_load.s | 0 c64/basic/{ => commands}/cmd_new.s | 0 c64/basic/{ => commands}/cmd_rem.s | 0 c64/basic/{ => commands}/cmd_run.s | 0 c64/basic/{ => commands}/cmd_sys.s | 0 c64/basic/{ => commands}/cmd_unimplemented.s | 0 c64/basic/{ => init}/a000.cold_start_vector.s | 0 c64/basic/{ => init}/a002.warm_start_vector.s | 0 .../basic_cold_start_internal.s} | 20 +--- c64/basic/init/e394.basic_cold_start.s | 22 +++++ c64/basic/init/e394.interop | 8 ++ c64/basic/{ => init}/e422.initmsg.jmp.s | 0 c64/basic/{ => init}/e422.interop | 0 c64/basic/init/initmsg_bytes_free.s | 21 ++++ c64/basic/init/initmsg_real.s | 95 +++++++++++++++++++ c64/basic/{ => init}/startup_banner.s | 44 ++++----- c64/basic/initmsg_real.s | 48 ---------- .../{ => rom_revision}/a004.identifier.s | 0 c64/basic/{ => rom_revision}/a483.interop | 0 c64/basic/{ => rom_revision}/bf52.interop | 0 .../bf52.rom_revision_basic.s | 8 +- c64/basic/rom_revision/e4b7.interop | 2 + .../rom_revision/e4b7.rom_revision_kernal.s | 39 ++++++++ c64/kernal/assets/kernal_messages.s | 58 ++++++----- c64/kernal/chkinout_real.s | 2 +- c64/kernal/panic.s | 26 ++++- c64/kernal/print/print_kernal_message.s | 2 +- c64/kernal/print/print_pal_ntsc.s | 4 +- c64/kernal/xxxx.rom_revision_kernal.s | 34 ------- 40 files changed, 363 insertions(+), 182 deletions(-) rename c64/basic/{ => commands}/cmd_break.s (100%) rename c64/basic/{ => commands}/cmd_list.s (100%) rename c64/basic/{ => commands}/cmd_load.s (100%) rename c64/basic/{ => commands}/cmd_new.s (100%) rename c64/basic/{ => commands}/cmd_rem.s (100%) rename c64/basic/{ => commands}/cmd_run.s (100%) rename c64/basic/{ => commands}/cmd_sys.s (100%) rename c64/basic/{ => commands}/cmd_unimplemented.s (100%) rename c64/basic/{ => init}/a000.cold_start_vector.s (100%) rename c64/basic/{ => init}/a002.warm_start_vector.s (100%) rename c64/basic/{basic_cold_start.s => init/basic_cold_start_internal.s} (55%) create mode 100644 c64/basic/init/e394.basic_cold_start.s create mode 100644 c64/basic/init/e394.interop rename c64/basic/{ => init}/e422.initmsg.jmp.s (100%) rename c64/basic/{ => init}/e422.interop (100%) create mode 100644 c64/basic/init/initmsg_bytes_free.s create mode 100644 c64/basic/init/initmsg_real.s rename c64/basic/{ => init}/startup_banner.s (81%) delete mode 100644 c64/basic/initmsg_real.s rename c64/basic/{ => rom_revision}/a004.identifier.s (100%) rename c64/basic/{ => rom_revision}/a483.interop (100%) rename c64/basic/{ => rom_revision}/bf52.interop (100%) rename c64/basic/{ => rom_revision}/bf52.rom_revision_basic.s (60%) create mode 100644 c64/basic/rom_revision/e4b7.interop create mode 100644 c64/basic/rom_revision/e4b7.rom_revision_kernal.s delete mode 100644 c64/kernal/xxxx.rom_revision_kernal.s diff --git a/CONFIG.md b/CONFIG.md index 48451cd6..0003def2 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -105,25 +105,33 @@ Cause the system to support SIDs in `$D4xx` and `$D5xx` ranges, respectively. Each of them needs a couple of bytes in KERNAL segment - but they can share some code, and `$D4xx` range support replaces the standard `$D400` address handling, so exact amount depends on the exact configuration. -## Software features +## Eye candy -### `CONFIG_BANNER_FANCY` +### `CONFIG_BANNER_SIMPLE`, `CONFIG_BANNER_FANCY`, `CONFIG_BANNER_VARIANT` -If enabled, prints more colorful startup banner. Eye candy only. +Select startup banner - either a simple one, or with some colorful elements. `CONFIG_BANNER_VARIANT` heavily depends on the selected hardware target, not all targets support it. -Needs some space in BASIC segment, varies between targets. +Richer banners need more BASIC segment, varies between hardware variants. ### `CONFIG_BANNER_PAL_NTSC` If enabled, prints video system on startup banner. Eye candy only. -Feature needs 3 bytes in BASIC and 23 bytes in KERNAL segment. +Feature needs some bytes in BASIC (depending on banner type) and about 25 bytes in KERNAL segment. + +## Software features + +### `CONFIG_PANIC_SCREEN` + +If enabled, certain fatal errors will produce a nice bluescreen instead of just resetting the machine. + +Feature needs over 100 bytes in KERNAL segment. If unsure - enable. ### `CONFIG_DOS_WEDGE` If enabled, a simple DOS wedge is available from the direct mode - supports `@`, `@`, `@$`, `@$` and `@` commands. -Feature needs about 330 bytes in BASIC segment. +Feature needs about 330 bytes in BASIC segment. If unsure - enable. ### `CONFIG_BCD_SAFE_INTERRUPTS` diff --git a/Makefile b/Makefile index e737cd4b..c66d105a 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,13 @@ # Source files SRCDIR_COMMON = c64/aliases + SRCDIR_BASIC = $(SRCDIR_COMMON) \ - c64/basic + c64/basic \ + c64/basic/commands \ + c64/basic/init \ + c64/basic/rom_revision + SRCDIR_KERNAL = $(SRCDIR_COMMON) \ c64/kernal \ c64/kernal/assets \ diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index a351b1ff..8ba406c2 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -41,10 +41,17 @@ // #define CONFIG_SID_D5XX +// Eye candy + +// #define CONFIG_BANNER_SIMPLE +#define CONFIG_BANNER_FANCY +// #define CONFIG_BANNER_VARIANT +#define CONFIG_SHOW_PAL_NTSC + + // Software features -#define CONFIG_BANNER_FANCY -#define CONFIG_BANNER_PAL_NTSC +#define CONFIG_PANIC_SCREEN #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS #define CONFIG_SCNKEY_TWW_CTR // for now has to be enabled diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 10e621a7..ccd98107 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -41,10 +41,17 @@ // #define CONFIG_SID_D5XX +// Eye candy + +// #define CONFIG_BANNER_SIMPLE +// #define CONFIG_BANNER_FANCY +#define CONFIG_BANNER_VARIANT +// #define CONFIG_SHOW_PAL_NTSC + + // Software features -#define CONFIG_BANNER_FANCY -#define CONFIG_BANNER_PAL_NTSC +#define CONFIG_PANIC_SCREEN #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS #define CONFIG_SCNKEY_TWW_CTR // for now has to be enabled diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index 0f371bbd..b6b93a95 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -41,10 +41,17 @@ #define CONFIG_SID_D5XX +// Eye candy + +// #define CONFIG_BANNER_SIMPLE +#define CONFIG_BANNER_FANCY +// #define CONFIG_BANNER_VARIANT +#define CONFIG_SHOW_PAL_NTSC + + // Software features -#define CONFIG_BANNER_FANCY -#define CONFIG_BANNER_PAL_NTSC +#define CONFIG_PANIC_SCREEN #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS #define CONFIG_SCNKEY_TWW_CTR // for now has to be enabled diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index afad90ec..29fadfed 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -86,6 +86,35 @@ +// Check that startup banner configuration is correct + +{ + .var selected = 0; + +#if CONFIG_BANNER_SIMPLE + .eval selected++ +#endif +#if CONFIG_BANNER_FANCY + .eval selected++ +#endif +#if CONFIG_BANNER_VARIANT + .eval selected++ +#endif + + .if (selected != 1) .error "Please select exactly one CONFIG_MEMORY_MODEL_* option" + +#if CONFIG_BANNER_VARIANT && !CONFIG_VARIANT_MEGA_65 + .error "CONFIG_BANNER_VARIANT is not supported for your CONFIG_VARIANT_*" +#endif + +#if CONFIG_BANNER_VARIANT && CONFIG_VARIANT_MEGA_65 && CONFIG_SHOW_PAL_NTSC + .error "MEGA65 variant banner does not support showing PAL/NTSC" +#endif + +} + + + // Handle processor configuration #if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816 diff --git a/c64/aliases/,aliases_cpu.s b/c64/aliases/,aliases_cpu.s index 1f6137bf..01b980b6 100644 --- a/c64/aliases/,aliases_cpu.s +++ b/c64/aliases/,aliases_cpu.s @@ -4,13 +4,16 @@ // -// This one is not for optimization - but to encourage proper usage of panic screen +// These are not exactly for optimization - but to encourage proper usage of panic screen // .pseudocommand panic code { + // If case no panic screen is used, we can skip providing error codes within Kernal +#if CONFIG_PANIC_SCREEN || !SEGMENT_KERNAL lda code - jmp (panic_vector) +#endif + jmp ($E4B7) } diff --git a/c64/aliases/,aliases_error_codes.s b/c64/aliases/,aliases_error_codes.s index 5af898a1..fc30b384 100644 --- a/c64/aliases/,aliases_error_codes.s +++ b/c64/aliases/,aliases_error_codes.s @@ -1,4 +1,10 @@ + // Error codes for 'panic' pseudocommand + + .const P_ERR_NONE = $00 + .const P_ERR_ROM_MISMATCH = $01 // this value has to be stable as long as possible + + // Kernal error codes - returned in the A register // Described in 'Commodore 64 Programmer's Reference Guide', page 306 diff --git a/c64/basic/,imports.s b/c64/basic/,imports.s index 38527744..bc90a4cd 100644 --- a/c64/basic/,imports.s +++ b/c64/basic/,imports.s @@ -4,17 +4,21 @@ #import "KERNAL_combined.sym" -.label panic_vector = KERNAL.panic_vector -.label rom_revision_kernal = KERNAL.rom_revision_kernal +#if CONFIG_PANIC_SCREEN +.label panic = KERNAL.panic +#endif + +.label hw_entry_reset = KERNAL.hw_entry_reset #if CONFIG_DBG_PRINTF .label printf = KERNAL.printf #endif +.label plot_set = KERNAL.plot_set .label print_hex_byte = KERNAL.print_hex_byte .label print_return = KERNAL.print_return .label print_space = KERNAL.print_space -#if CONFIG_BANNER_PAL_NTSC +#if CONFIG_SHOW_PAL_NTSC .label print_pal_ntsc = KERNAL.print_pal_ntsc #endif diff --git a/c64/basic/cmd_break.s b/c64/basic/commands/cmd_break.s similarity index 100% rename from c64/basic/cmd_break.s rename to c64/basic/commands/cmd_break.s diff --git a/c64/basic/cmd_list.s b/c64/basic/commands/cmd_list.s similarity index 100% rename from c64/basic/cmd_list.s rename to c64/basic/commands/cmd_list.s diff --git a/c64/basic/cmd_load.s b/c64/basic/commands/cmd_load.s similarity index 100% rename from c64/basic/cmd_load.s rename to c64/basic/commands/cmd_load.s diff --git a/c64/basic/cmd_new.s b/c64/basic/commands/cmd_new.s similarity index 100% rename from c64/basic/cmd_new.s rename to c64/basic/commands/cmd_new.s diff --git a/c64/basic/cmd_rem.s b/c64/basic/commands/cmd_rem.s similarity index 100% rename from c64/basic/cmd_rem.s rename to c64/basic/commands/cmd_rem.s diff --git a/c64/basic/cmd_run.s b/c64/basic/commands/cmd_run.s similarity index 100% rename from c64/basic/cmd_run.s rename to c64/basic/commands/cmd_run.s diff --git a/c64/basic/cmd_sys.s b/c64/basic/commands/cmd_sys.s similarity index 100% rename from c64/basic/cmd_sys.s rename to c64/basic/commands/cmd_sys.s diff --git a/c64/basic/cmd_unimplemented.s b/c64/basic/commands/cmd_unimplemented.s similarity index 100% rename from c64/basic/cmd_unimplemented.s rename to c64/basic/commands/cmd_unimplemented.s diff --git a/c64/basic/a000.cold_start_vector.s b/c64/basic/init/a000.cold_start_vector.s similarity index 100% rename from c64/basic/a000.cold_start_vector.s rename to c64/basic/init/a000.cold_start_vector.s diff --git a/c64/basic/a002.warm_start_vector.s b/c64/basic/init/a002.warm_start_vector.s similarity index 100% rename from c64/basic/a002.warm_start_vector.s rename to c64/basic/init/a002.warm_start_vector.s diff --git a/c64/basic/basic_cold_start.s b/c64/basic/init/basic_cold_start_internal.s similarity index 55% rename from c64/basic/basic_cold_start.s rename to c64/basic/init/basic_cold_start_internal.s index b58bc453..a7326089 100644 --- a/c64/basic/basic_cold_start.s +++ b/c64/basic/init/basic_cold_start_internal.s @@ -1,17 +1,9 @@ -// BASIC Cold start entry point -// Compute's Mapping the 64 p211 -basic_cold_start: +// +// Continuation of the BASIC cold start routine +// - // Before doing anything, check if we have a compatible Kernal - - ldy #(__rom_revision_basic_end - rom_revision_basic - 1) -!: - lda rom_revision_basic, y - cmp rom_revision_kernal, y - bne basic_cold_start_rom_mismatch - dey - bpl !- +basic_cold_start_internal: // Setup vectors at $300 ldy #$0B @@ -42,7 +34,3 @@ basic_cold_start: // jump into warm start loop jmp basic_warm_start - -basic_cold_start_rom_mismatch: - - panic #$01 diff --git a/c64/basic/init/e394.basic_cold_start.s b/c64/basic/init/e394.basic_cold_start.s new file mode 100644 index 00000000..fe181381 --- /dev/null +++ b/c64/basic/init/e394.basic_cold_start.s @@ -0,0 +1,22 @@ +// BASIC Cold start entry point +// Compute's Mapping the 64 p211 + +basic_cold_start: + + // Before doing anything, check if we have a compatible BASIC/KERNAL pair + + ldy #(__rom_revision_basic_end - rom_revision_basic - 1) +!: + lda rom_revision_basic, y + cmp rom_revision_kernal, y + beq !+ + + panic #P_ERR_ROM_MISMATCH + +!: + dey + bpl !-- + + // Remaining part wouldn't fit here + + jmp basic_cold_start_internal diff --git a/c64/basic/init/e394.interop b/c64/basic/init/e394.interop new file mode 100644 index 00000000..ed2b4a81 --- /dev/null +++ b/c64/basic/init/e394.interop @@ -0,0 +1,8 @@ + +The address of the BASIC cold start routine (see Compute's Mapping the Commodore 64, page 211) is well known, see for example here: + +- https://www.lemon64.com/forum/viewtopic.php?t=70680&sid=3ff66caf7f5fdf2a3c2ff2ee31fc3fd8 + +Fixing this routine also has a great advantage for us - since it's address lies in the uppeer ROM region, it's easier to bailout +when someone tries to use our 'kernal.rom' with the original 'basic.rom'. + diff --git a/c64/basic/e422.initmsg.jmp.s b/c64/basic/init/e422.initmsg.jmp.s similarity index 100% rename from c64/basic/e422.initmsg.jmp.s rename to c64/basic/init/e422.initmsg.jmp.s diff --git a/c64/basic/e422.interop b/c64/basic/init/e422.interop similarity index 100% rename from c64/basic/e422.interop rename to c64/basic/init/e422.interop diff --git a/c64/basic/init/initmsg_bytes_free.s b/c64/basic/init/initmsg_bytes_free.s new file mode 100644 index 00000000..d4df557c --- /dev/null +++ b/c64/basic/init/initmsg_bytes_free.s @@ -0,0 +1,21 @@ + +// +// Print out the amount of free bytes - for the startup banner +// + + +initmsg_bytes_free: + + jsr basic_do_new + sec + lda MEMSIZ+0 + sbc TXTTAB+0 + tax + lda MEMSIZ+1 + sbc TXTTAB+1 + + jsr print_integer + + // Print rest of the start up message + ldx #34 + jmp print_packed_message diff --git a/c64/basic/init/initmsg_real.s b/c64/basic/init/initmsg_real.s new file mode 100644 index 00000000..a2dbc0a7 --- /dev/null +++ b/c64/basic/init/initmsg_real.s @@ -0,0 +1,95 @@ + +// Routine is too long to fit in the original location + + +initmsg_real: + +#if CONFIG_BANNER_SIMPLE + + lda #startup_banner + jsr STROUT + + ldx #$02 + ldy #$02 + jsr plot_set + + lda #rom_revision_basic_string + jsr STROUT + + ldx #$04 + ldy #$02 + jsr plot_set + +#if CONFIG_SHOW_PAL_NTSC + jsr print_pal_ntsc +#endif + + jsr initmsg_bytes_free + + ldx #$07 + ldy #$00 + jmp plot_set + +#elif CONFIG_BANNER_FANCY + + lda #rainbow_logo + jsr STROUT + + ldx #$01 + ldy #$0A + jsr plot_set + + lda #startup_banner + jsr STROUT + + ldx #$03 + ldy #$0A + jsr plot_set + + lda #pre_revision_string + jsr STROUT + + lda #rom_revision_basic_string + jsr STROUT + + ldx #$05 + ldy #$00 + jsr plot_set + +#if CONFIG_SHOW_PAL_NTSC + jsr print_pal_ntsc +#endif + + jsr initmsg_bytes_free + + ldx #$07 + ldy #$00 + jmp plot_set + +#elif CONFIG_BANNER_VARIANT && CONFIG_VARIANT_MEGA_65 + + lda #startup_banner + jsr STROUT + + lda #rom_revision_basic_string + jsr STROUT + + ldx #$03 + ldy #$12 + jsr plot_set + + jsr initmsg_bytes_free + + ldx #$05 + ldy #$00 + jmp plot_set + +#endif diff --git a/c64/basic/startup_banner.s b/c64/basic/init/startup_banner.s similarity index 81% rename from c64/basic/startup_banner.s rename to c64/basic/init/startup_banner.s index 3e099df4..9f8f4e6c 100644 --- a/c64/basic/startup_banner.s +++ b/c64/basic/init/startup_banner.s @@ -16,39 +16,33 @@ } - startup_banner: - -#if !CONFIG_BANNER_FANCY - - // Simple banner +#if CONFIG_BANNER_SIMPLE .text " " BANNER_TEXT() - .byte $0D, $0D - .text " " + .byte $00 -#endif +#elif CONFIG_BANNER_FANCY + BANNER_TEXT() + .byte $00 -#if CONFIG_BANNER_FANCY && !CONFIG_VARIANT_MEGA_65 +rainbow_logo: - // Fancy banner + .byte $1C, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $0D + .byte $9E, $12, $A4, $A4, $A4, $A4, $A4, $A4, $0D + .byte $1E, $12, $A4, $A4, $A4, $A4, $A4, $0D + .byte $9F, $12, $A4, $A4, $A4, $A4, $92 + .byte $05, $00 - .byte $1C, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $92, $0D - .byte $9E, $12, $A4, $A4, $A4, $A4, $A4, $A4, $92, $05, $20 - .text " " - BANNER_TEXT() - .byte $0D - .byte $1E, $12, $A4, $A4, $A4, $A4, $A4, $92, $0D - .byte $9F, $12, $A4, $A4, $A4, $A4, $92, $20, $05, $20, $20 - .text " " +pre_revision_string: -#endif + .text "RELEASE " + .byte $00 - -#if CONFIG_BANNER_FANCY && CONFIG_VARIANT_MEGA_65 +#elif CONFIG_BANNER_VARIANT && CONFIG_VARIANT_MEGA_65 // Fancy Mega65 banner - from Retrofan .byte $9a, $12, $20, $20, $7f, $a9, $20, $20, $1f, $20, $9a, $20, $20, $20 @@ -65,7 +59,7 @@ startup_banner: .byte $12, $20, $20, $1f, $20, $20, $9a, $20, $20, $1f, $20, $9a, $20, $20, $20, $20 .byte $1f, $20, $9a, $20, $20, $20, $20, $20, $1f, $20, $9a, $20, $20, $1f, $20, $9a .byte $20, $20, $1f, $20, $20, $96, $a3, $a3, $a3, $a3, $1f - .byte $92, $0D, $0D, $05 + .byte $92, $0D, $0D, $05, $00 // Original Mega65 banner - supplied by Deft // .byte $9A,$12,$A3,$A3,$A3,$A3,$A3,$A3,$DF,$9B,$92,$20,$05,$12,$A0,$A0 @@ -82,10 +76,6 @@ startup_banner: // .byte $A3,$A3,$A3,$A3,$DF,$9A,$92,$7F,$12,$DF,$92,$7F,$9B,$20,$9A,$7F // .byte $12,$A0,$A0,$9B,$92,$20,$9A,$7F,$12,$A0,$A0,$9B,$92,$20,$9A,$7F // .byte $12,$DF,$92,$7F,$9B,$20,$9A,$20,$9B,"0.2.0.0",$0D - // .byte $0D,$05,$92 + // .byte $0D,$05,$92,$00 #endif - - - - .byte $00 // end of banner diff --git a/c64/basic/initmsg_real.s b/c64/basic/initmsg_real.s deleted file mode 100644 index f79e316f..00000000 --- a/c64/basic/initmsg_real.s +++ /dev/null @@ -1,48 +0,0 @@ - -// Routine is too long to fit in the original location - - -initmsg_real: - - // Print startup banner, up to 255 characters - ldx #$00 -!: - lda startup_banner, x - beq !+ // 0 means end of banner - jsr JCHROUT - inx - bne !- - -!: - // Print ROM revision - lda #rom_revision_basic_string - jsr STROUT - - // Print PAL/NTSC, if configured - -#if CONFIG_BANNER_PAL_NTSC - jsr print_pal_ntsc -#endif - - jsr initmsg_double_return - jsr print_return - - // Work out free bytes, display them - jsr basic_do_new - sec - lda MEMSIZ+0 - sbc TXTTAB+0 - tax - lda MEMSIZ+1 - sbc TXTTAB+1 - - jsr print_integer - - // Print rest of the start up message - ldx #34 - jsr print_packed_message - -initmsg_double_return: - jsr print_return - jmp print_return diff --git a/c64/basic/a004.identifier.s b/c64/basic/rom_revision/a004.identifier.s similarity index 100% rename from c64/basic/a004.identifier.s rename to c64/basic/rom_revision/a004.identifier.s diff --git a/c64/basic/a483.interop b/c64/basic/rom_revision/a483.interop similarity index 100% rename from c64/basic/a483.interop rename to c64/basic/rom_revision/a483.interop diff --git a/c64/basic/bf52.interop b/c64/basic/rom_revision/bf52.interop similarity index 100% rename from c64/basic/bf52.interop rename to c64/basic/rom_revision/bf52.interop diff --git a/c64/basic/bf52.rom_revision_basic.s b/c64/basic/rom_revision/bf52.rom_revision_basic.s similarity index 60% rename from c64/basic/bf52.rom_revision_basic.s rename to c64/basic/rom_revision/bf52.rom_revision_basic.s index 28940329..9281af14 100644 --- a/c64/basic/bf52.rom_revision_basic.s +++ b/c64/basic/rom_revision/bf52.rom_revision_basic.s @@ -14,12 +14,12 @@ rom_revision_basic: // $BF52 - .text "OR" // Magic string, after "Open ROMs" - .byte CONFIG_ID // Config file ID, might change between revisions + .text "OR" // project signature, after "Open ROMs" + .byte CONFIG_ID // config file ID, might change between revisions rom_revision_basic_string: - .text "DEVEL SNAPSHOT" // Actual ROM revision string - .byte $00 + .text "(DEVEL SNAPSHOT)" // actual ROM revision string; up to 16 characters + .byte $00 // marks the end of string __rom_revision_basic_end: diff --git a/c64/basic/rom_revision/e4b7.interop b/c64/basic/rom_revision/e4b7.interop new file mode 100644 index 00000000..ed2951af --- /dev/null +++ b/c64/basic/rom_revision/e4b7.interop @@ -0,0 +1,2 @@ + +Special case - we need a constant memory location where we can put an ID and a revision string. According to Compute's Mapping the Commodore 64 (page 213) this area is unused - so a perfect place. diff --git a/c64/basic/rom_revision/e4b7.rom_revision_kernal.s b/c64/basic/rom_revision/e4b7.rom_revision_kernal.s new file mode 100644 index 00000000..f3c7f34d --- /dev/null +++ b/c64/basic/rom_revision/e4b7.rom_revision_kernal.s @@ -0,0 +1,39 @@ + +// +// !!! PROPOSAL ONLY !!! PROPOSAL ONLY !!! NOT FOR USING EXTERNALLY YET !!! +// +// +// Do not change! Locations of the following data should be constant - now and forever! +// +// If you want to integrate Open ROMs support in your emulator, FPGA ccomputer, etc. - this +// is the official way to recognize the ROM and it's revision. +// + + + // $E4B7 + + // This vector is to be used by non-Kernal ROMs, if they want to + // complain about incompatible ROM releases - don't use it directly, + // use a 'panic' pseudocommand with error code (will be passed using .A) + // #P_ERR_ROM_MISMATCH - it should remain stable even between releases + +#if CONFIG_PANIC_SCREEN + .word panic +#else + .word hw_entry_reset +#endif + + +rom_revision_kernal: + + // $E4B9 + + .text "OR" // project signature, after "Open ROMs" + .byte CONFIG_ID // config file ID, might change between revisions + +rom_revision_kernal_string: + + .text "(DEVEL SNAPSHOT)" // actual ROM revision string; up to 16 characters + .byte $00 // marks the end of string + +__rom_revision_kernal_end: diff --git a/c64/kernal/assets/kernal_messages.s b/c64/kernal/assets/kernal_messages.s index 2e3c9a13..0e8b6abe 100644 --- a/c64/kernal/assets/kernal_messages.s +++ b/c64/kernal/assets/kernal_messages.s @@ -5,68 +5,74 @@ // Double underscore prevents labels from being passed to VICE (would confuse monitor) -.label __MSG_KERNAL_SEARCHING_FOR = __kernal_message_searching_for - __kernal_messages_start -.label __MSG_KERNAL_LOADING = __kernal_message_loading - __kernal_messages_start -.label __MSG_KERNAL_VERIFYING = __kernal_message_verifying - __kernal_messages_start -.label __MSG_KERNAL_SAVING = __kernal_message_saving - __kernal_messages_start -.label __MSG_KERNAL_FROM_HEX = __kernal_message_from_hex - __kernal_messages_start -.label __MSG_KERNAL_TO_HEX = __kernal_message_to_hex - __kernal_messages_start +.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 -#if CONFIG_BANNER_PAL_NTSC -.label __MSG_KERNAL_PAL = __kernal_message_pal - __kernal_messages_start -.label __MSG_KERNAL_NTSC = __kernal_message_ntsc - __kernal_messages_start +#if CONFIG_SHOW_PAL_NTSC +.label __MSG_KERNAL_PAL = __msg_kernalpal - __msg_kernal_first +.label __MSG_KERNAL_NTSC = __msg_kernalntsc - __msg_kernal_first #endif -.label __MSG_KERNAL_PANIC = __kernal_message_panic - __kernal_messages_start -.label __MSG_KERNAL_PANIC_VERSION = __kernal_message_panic_version - __kernal_messages_start +#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 -__kernal_messages_start: +__msg_kernal_first: -__kernal_message_searching_for: +__msg_kernalsearching_for: .byte $0D .text "SEARCHING FOR" .byte $80 + $20 // end of string mark + space -__kernal_message_loading: +__msg_kernalloading: .byte $0D .text "LOADIN" .byte $80 + $47 // end of string mark + 'G' -__kernal_message_verifying: +__msg_kernalverifying: .byte $0D .text "VERIFYIN" .byte $80 + $47 // end of string mark + 'G' -__kernal_message_saving: +__msg_kernalsaving: .byte $0D .text "SAVIN" .byte $80 + $47 // end of string mark + 'G' -__kernal_message_from_hex: +__msg_kernalfrom_hex: .text " FROM " .byte $80 + $24 // end of string mark + '$' -__kernal_message_to_hex: +__msg_kernalto_hex: .text " TO " .byte $80 + $24 // end of string mark + '$' -#if CONFIG_BANNER_PAL_NTSC +#if CONFIG_SHOW_PAL_NTSC -__kernal_message_pal: - .text ", PAL" +__msg_kernalpal: + .text "PAL," .byte $80 + $20 // end of string mark + space -__kernal_message_ntsc: - .text ", NTSC" +__msg_kernalntsc: + .text "NTSC," .byte $80 + $20 // end of string mark + space -#endif // CONFIG_BANNER_PAL_NTSC +#endif // CONFIG_SHOW_PAL_NTSC -__kernal_message_panic: +#if CONFIG_PANIC_SCREEN + +__msg_kernalpanic: .text "KERNAL PANI" .byte $80 + $43 // end of string mark + 'C' -__kernal_message_panic_version: +__msg_kernalpanic_rom_mismatch: .text " - ROM MISMATC" .byte $80 + $48 // end of string mark + 'H' + +#endif // CONFIG_PANIC_SCREEN diff --git a/c64/kernal/chkinout_real.s b/c64/kernal/chkinout_real.s index 64a3b363..18bc6bc7 100644 --- a/c64/kernal/chkinout_real.s +++ b/c64/kernal/chkinout_real.s @@ -5,7 +5,7 @@ // - [RG64] C64 Programmer's Reference Guide - page 275 (CHKIN) / 276 (CKOUT) // - [CM64] Compute's Mapping the Commodore 64 - page 229 // -// CPU registers that has to be preserved (see [RG64]): .Y +// CPU registers that has to be preserved (see [RG64]): .Y, possibly .A (XXX - see [CM64], page 213) // diff --git a/c64/kernal/panic.s b/c64/kernal/panic.s index bb67d4b2..853e3032 100644 --- a/c64/kernal/panic.s +++ b/c64/kernal/panic.s @@ -3,19 +3,29 @@ // Something terrible happened - show the panic screen // -// .A = 0 - just panic, no extra message -// .A = 1 - ROM version mismatch + +#if CONFIG_PANIC_SCREEN panic: + // Disable interrupts, store error code on stack + sei pha + // Reinitialize the hardware + jsr IOINIT jsr setup_vicii jsr clear_screen - // XXX disable NMIs + // Disable NMIs - our routine checks for NULL vector + + lda #$00 + sta NMINV+0 + sta NMINV+1 + + // Display KERNAL PANIC message ldx #$14 ldy #$0E @@ -24,6 +34,8 @@ panic: ldx #__MSG_KERNAL_PANIC jsr print_kernal_message + // Display error code and message (if known) + pla beq kernal_panic_infinite_loop pha @@ -37,12 +49,14 @@ panic: jsr print_hex_byte pla - cmp #$01 + cmp #P_ERR_ROM_MISMATCH bne kernal_panic_infinite_loop - ldx #__MSG_KERNAL_PANIC_VERSION + ldx #__MSG_KERNAL_PANIC_ROM_MISMATCH jsr print_kernal_message + // Display some raster effect in the infinitew loop + kernal_panic_infinite_loop: ldx #$00 stx VIC_EXTCOL @@ -59,3 +73,5 @@ kernal_panic_infinite_loop: bne !- beq kernal_panic_infinite_loop // branch always + +#endif // CONFIG_PANIC_SCREEN diff --git a/c64/kernal/print/print_kernal_message.s b/c64/kernal/print/print_kernal_message.s index 6ae7a23d..6e75e634 100644 --- a/c64/kernal/print/print_kernal_message.s +++ b/c64/kernal/print/print_kernal_message.s @@ -9,7 +9,7 @@ print_kernal_message: - lda __kernal_messages_start, x + lda __msg_kernal_first, x bpl !- // 0 marks end of string and #$7F jmp JCHROUT diff --git a/c64/kernal/print/print_pal_ntsc.s b/c64/kernal/print/print_pal_ntsc.s index 3cccd080..ec4ae805 100644 --- a/c64/kernal/print/print_pal_ntsc.s +++ b/c64/kernal/print/print_pal_ntsc.s @@ -3,7 +3,7 @@ // Print video system on startup banner // -#if CONFIG_BANNER_PAL_NTSC +#if CONFIG_SHOW_PAL_NTSC print_pal_ntsc: @@ -14,4 +14,4 @@ print_pal_ntsc: !: jmp print_kernal_message -#endif // CONFIG_BANNER_PAL_NTSC \ No newline at end of file +#endif // CONFIG_SHOW_PAL_NTSC \ No newline at end of file diff --git a/c64/kernal/xxxx.rom_revision_kernal.s b/c64/kernal/xxxx.rom_revision_kernal.s deleted file mode 100644 index cbd215a0..00000000 --- a/c64/kernal/xxxx.rom_revision_kernal.s +++ /dev/null @@ -1,34 +0,0 @@ - -// -// !!! PROPOSAL ONLY !!! PROPOSAL ONLY !!! NOT FOR USING EXTERNALLY YET !!! -// -// -// Do not change! Locations of the following data should be constant - now and forever! -// -// If you want to integrate Open ROMs support in your emulator, FPGA ccomputer, etc. - this -// is the official way to recognize the ROM and it's revision. -// - - -// XXX we need to find a safe address within $E4D3-$FFFF range, we need 20 bytes - - -panic_vector: - - // This vector is to be used by non-Kernal ROMs, if they want to complain - // about incompatible ROM releases - jump via this vector with .A set to 1 - - .byte panic - -rom_revision_kernal: - - .text "OR" // Magic string, after "Open ROMs" - .byte CONFIG_ID // Config file ID, might change between revisions - -rom_revision_kernal_string: - - .text "DEVEL SNAPSHOT" // Actual ROM revision string - .byte $00 - -__rom_revision_kernal_end: From 5c02adae3eb7f347dd5f5d0d3965db76c4f4a645 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 13 Oct 2019 15:09:43 +0200 Subject: [PATCH 39/85] small optimization of panic routine --- c64/kernal/panic.s | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/c64/kernal/panic.s b/c64/kernal/panic.s index 853e3032..ef34736a 100644 --- a/c64/kernal/panic.s +++ b/c64/kernal/panic.s @@ -60,18 +60,15 @@ panic: kernal_panic_infinite_loop: ldx #$00 stx VIC_EXTCOL - - ldx #$80 !: - dex - bne !- + inx + bpl !- ldx #$06 stx VIC_EXTCOL -!: - dex - bne !- - beq kernal_panic_infinite_loop // branch always + nop + + bne kernal_panic_infinite_loop // branch always #endif // CONFIG_PANIC_SCREEN From 7e2a2f8e5d3c782843bc4fd32129673f2aed6d79 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 13 Oct 2019 16:41:13 +0200 Subject: [PATCH 40/85] further work on new keyboard scanning routine --- c64/,,config_generic.s | 4 ++ c64/,,config_mega65.s | 6 ++ c64/,,config_ultimate64.s | 4 ++ c64/kernal/keyboard/kb_matrix.s | 3 + c64/kernal/keyboard/kb_matrix_row_keys.s | 3 +- c64/kernal/keyboard/kb_matrix_row_offsets.s | 23 +++++++ c64/kernal/keyboard/scnkey.s | 69 ++++++++++++++++----- 7 files changed, 94 insertions(+), 18 deletions(-) create mode 100644 c64/kernal/keyboard/kb_matrix_row_offsets.s diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 8ba406c2..de70aaac 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -5,6 +5,10 @@ // Please read CONFIG.md before modifying this file! // +// Idea: +// - sane defaults for the original Commodore 64 machine +// - do not enable features which are a significant compatibility risk + // Hardware platform and variant diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index ccd98107..8cd04b0e 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -5,6 +5,12 @@ // Please read CONFIG.md before modifying this file! // +// Idea: +// - sane defaults for the Mega 65 FPGA computer +// - enable compatibility-risky features too +// - unless VICE gains Commodore 65 (or at least Flash8 cartridge) emulation support, +// do not enable CPU-specific optimizations; ROMs would be hard to test + // Hardware platform and variant diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index b6b93a95..7578d183 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -5,6 +5,10 @@ // Please read CONFIG.md before modifying this file! // +// Idea: +// - sane defaults for the Ultimate 64 FPGA computer +// - do not enable features which are a significant compatibility risk + // Hardware platform and variant diff --git a/c64/kernal/keyboard/kb_matrix.s b/c64/kernal/keyboard/kb_matrix.s index e0426358..c1eeff70 100644 --- a/c64/kernal/keyboard/kb_matrix.s +++ b/c64/kernal/keyboard/kb_matrix.s @@ -13,6 +13,9 @@ // and converting the values +// XXX to be extra compatible (someone could change the KEYLOG), we should make sure +// we are using the same matrix format as the original ROM does + kb_matrix: diff --git a/c64/kernal/keyboard/kb_matrix_row_keys.s b/c64/kernal/keyboard/kb_matrix_row_keys.s index c6bda32e..df3a64f8 100644 --- a/c64/kernal/keyboard/kb_matrix_row_keys.s +++ b/c64/kernal/keyboard/kb_matrix_row_keys.s @@ -12,7 +12,8 @@ kb_matrix_row_keys: - // values for CIA1_PRA to connect only the given row + // - values for CIA1_PRA to connect only the given row + // - also used to scan a single row .byte %01111111 .byte %10111111 diff --git a/c64/kernal/keyboard/kb_matrix_row_offsets.s b/c64/kernal/keyboard/kb_matrix_row_offsets.s new file mode 100644 index 00000000..8710ab09 --- /dev/null +++ b/c64/kernal/keyboard/kb_matrix_row_offsets.s @@ -0,0 +1,23 @@ + +// +// Helper values to quickly determine row offset from the start of keyboard matrix +// + + +#if !CONFIG_SCNKEY_TWW_CTR + + +kb_matrix_row_offsets: + + // - offsets (in bytes) to the first bytes of keyboard matrix rows + + .byte 0*8 + .byte 1*8 + .byte 2*8 + .byte 3*8 + .byte 4*8 + .byte 5*8 + .byte 6*8 + .byte 7*8 + +#endif // no CONFIG_SCNKEY_TWW_CTR diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 8ae819e5..099ca857 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -20,20 +20,19 @@ // - MODE - flag, whether charset toggle (SHIFT+VENDOR) is allowed +// XXX add Commodore 128 keyboard support +// XXX add Commodore 65 keybopard support +// XXX add support for using joystick to move sursor keys +// XXX prevent joystick port 1 interference + #if !CONFIG_SCNKEY_TWW_CTR -// Routine is heavily inspired by TWW/CTR proposal, see here: +// Routine takes some ideas from TWW/CTR proposal, see here: // - http://codebase64.org/doku.php?id=base:scanning_the_keyboard_the_correct_and_non_kernal_way SCNKEY: - // Handle repeat timer - - lda KOUNT - beq !+ - dec KOUNT -!: // Prepare for SHFLAG update lda SHFLAG @@ -47,11 +46,12 @@ SCNKEY: lda #$00 sta CIA1_PRA // connect all the rows - lda #$FF - cmp CIA1_PRB + ldx #$FF + cpx CIA1_PRB beq scnkey_no_keys // Retrieve SHIFT / VENDOR / CTRL status + // Use .X to detect 2 or more keys pressed (should be $FF now) ldy #$03 scnkey_bucky_loop: lda kb_matrix_bucky_confmask, y @@ -70,34 +70,69 @@ scnkey_bucky_loop: jsr scnkey_via_keylog // XXX for some CPUs we have indirect jsr + // XXX check if there is space in keyboard buffer // XXX check for joystick activity // Scan the keyboard matrix - ldy #$07 + ldy #$07 // XXX adapt for C128 and C65 keyboards + ldx #$FF // offset in key matrix table, $FF for not found yet scnkey_matrix_loop: lda kb_matrix_row_keys, y sta CIA1_PRA - lda kb_matrix_bucky_filter, y + lda kb_matrix_bucky_filter, y // filter out bucky keys ora CIA1_PRB - - // XXX + cmp #$FF + beq scnkey_matrix_loop_next // skip if no key pressed from this row + cpx #$FF + bne scnkey_no_keys // clash, more than one key pressed + // We have at least one key pressed in this row, we need to find which one exactly + ldx #$07 +scnkey_matrix_loop_inner: + cmp kb_matrix_row_keys, x + bne !+ // not this particular key + txa // now .A contains key offset within a row + sec + adc kb_matrix_row_offsets, y // now .A contains key offset from the matrix start + tax + jmp scnkey_matrix_loop_next +!: + dex + bpl scnkey_matrix_loop_inner + bmi scnkey_no_keys // branch always, multiple keys must have been pressed +scnkey_matrix_loop_next: dey bpl scnkey_matrix_loop + // Scanning complete + cpx #$FF + bne scnkey_got_key - - - // XXX + // FALLTROUGH scnkey_no_keys: - lda #$FF + // XXX + + lda #$40 // XXX adapt value for C128 and C65 keyboards sta LSTX rts +scnkey_got_key: // .X should now contain the key offset in matrix pointed by KEYTAB + + // Handle repeat timer + + .break + lda KOUNT + beq !+ + dec KOUNT +!: + + // XXX + rts + scnkey_via_keylog: jmp (KEYLOG) From bb2b4981b877bd152143159c8465ef41c946ad5d Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 13 Oct 2019 20:39:05 +0200 Subject: [PATCH 41/85] new SCNKEY is functionning, but probably needs different matrix format --- STATUS.md | 6 ++--- c64/kernal/e50a.plot.s | 4 +-- c64/kernal/keyboard/scnkey.s | 49 +++++++++++++++++++++++++++++++----- 3 files changed, 48 insertions(+), 11 deletions(-) diff --git a/STATUS.md b/STATUS.md index 6c5ebc5b..4195a6ba 100644 --- a/STATUS.md +++ b/STATUS.md @@ -62,7 +62,7 @@ Note: vectors at `$0300` are not supported yet - for now only the locations belo | `(00306)` | `$A71A` | `QPLOP` | NOT DONE | some implementation exists, but not connected here | | `(00308)` | `$A7E4` | `GONE` | NOT DONE | some implementation exists, but not connected here | | `(0030A)` | `$AE86` | `EVAL` | NOT DONE | some implementation exists, but not connected here | -| `($A000)` | | cold start | PARTIAL | | +| `($A000)` | `$E394` | cold start | PARTIAL | | | `($A002)` | | warm start | PARTIAL | |
@@ -109,7 +109,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FF96` | | `TKSA` | DONE | | | `$FF99` | | `MEMTOP` | DONE | | | `$FF9C` | | `MEMBOT` | DONE | | -| `$FF9F` | | `SCNKEY` | DONE | could be better integrated with ROM (aliases) | +| `$FF9F` | | `SCNKEY` | PARTIAL | future complete version has compatibility problems | | `$FFA2` | | `SETTMO` | DONE | | | `$FFA5` | | `ACPTR` | DONE | | | `$FFA8` | | `CIOUT` | DONE | | @@ -138,7 +138,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FFE7` | `$F32F` | `CLALL` | DONE | | | `$FFEA` | | `UDTIM` | DONE | | | `$FFED` | | `SCREEN` | DONE | | -| `$FFF0` | `$E50A` | `PLOT` | PARTIAL | | +| `$FFF0` | `$E50A` | `PLOT` | DONE | | | `$FFF3` | | `IOBASE` | DONE | | | `($FFFA)` | | NMI vec | PARTIAL | | | `($FFFC)` | | RESET vec | PARTIAL | | diff --git a/c64/kernal/e50a.plot.s b/c64/kernal/e50a.plot.s index ae9d32ff..a36dfc08 100644 --- a/c64/kernal/e50a.plot.s +++ b/c64/kernal/e50a.plot.s @@ -17,16 +17,16 @@ PLOT: // - 'Duotris' game calls $E50C during startup screen initialization plot_set: + sty PNTR stx TBLX jsr screen_calculate_line_pointer - // XXX cursor blink might need to be handled too - // FALLTROUGH to save one byte on RTS plot_get: + ldy PNTR ldx TBLX rts diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 099ca857..a2316b34 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -20,6 +20,7 @@ // - MODE - flag, whether charset toggle (SHIFT+VENDOR) is allowed +// XXX add RPTFLG support // XXX add Commodore 128 keyboard support // XXX add Commodore 65 keybopard support // XXX add support for using joystick to move sursor keys @@ -58,7 +59,7 @@ scnkey_bucky_loop: sta CIA1_PRA lda kb_matrix_bucky_testmask, y and CIA1_PRB - bne !+ // not pressed + bne !+ // not pressed lda SHFLAG ora kb_matrix_bucky_shflag, y sta SHFLAG @@ -68,9 +69,14 @@ scnkey_bucky_loop: // Set KEYTAB vector - jsr scnkey_via_keylog // XXX for some CPUs we have indirect jsr + jsr via_keylog // XXX for some CPUs we have indirect jsr + + // Check if we have free space in the keyboard buffer + + lda NDX + cmp XMAX + bcs scnkey_no_keys // no space in keyboard buffer - do not waste time - // XXX check if there is space in keyboard buffer // XXX check for joystick activity // Scan the keyboard matrix @@ -113,7 +119,7 @@ scnkey_matrix_loop_next: scnkey_no_keys: - // XXX + // Mark no key press lda #$40 // XXX adapt value for C128 and C65 keyboards sta LSTX @@ -122,18 +128,49 @@ scnkey_no_keys: scnkey_got_key: // .X should now contain the key offset in matrix pointed by KEYTAB + cpx LSTX + beq scnkey_handle_repeat // branch if the same key as previously + stx LSTX + + // Reset key repeat counters - see [CM64] page 58 + + lda #$04 + sta KOUNT + lda #$10 + sta DELAY + + // FALLTROUGH + +scnkey_output_key: + + // Output PETSCII code to the keyboard buffer + + txa // XXX switch registers!!! + tay + + lda (KEYTAB), y + beq scnkey_no_keys // branch if we have no PETSCII code for this key + ldy NDX + sta KEYD, y + inc NDX + + rts + +scnkey_handle_repeat: + // Handle repeat timer - .break lda KOUNT beq !+ dec KOUNT !: // XXX + rts -scnkey_via_keylog: +via_keylog: jmp (KEYLOG) + #endif // no CONFIG_SCNKEY_TWW_CTR From 5c8a29095b295718d955e27f0f324b69754312c4 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 13 Oct 2019 21:19:47 +0200 Subject: [PATCH 42/85] new SCNKEY now supports key repeating --- c64/aliases/,aliases_ram_lowmem.s | 2 +- c64/kernal/keyboard/scnkey.s | 47 +++++++++++++++++++++---------- 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index e597a011..bc83aa76 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -186,7 +186,7 @@ .label GDCOL = $287 // color of character under cursor .label HIBASE = $288 // high byte of start of screen .label XMAX = $289 // max keyboard buffer size - .label RPTFLG = $28A // -- NOT IMPLEMENTED -- + .label RPTFLG = $28A // whether to repeat keys (highest bit set = repeat) .label KOUNT = $28B // key repeat counter .label DELAY = $28C // -- NOT IMPLEMENTED -- .label SHFLAG = $28D // bucky keys (SHIFT/CTRL/C=) flags diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index a2316b34..1cdd63ea 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -18,9 +18,9 @@ // - LSTX - matrix coordinate of last pressed key // - LSTSHF - previous status of SHFLAG // - MODE - flag, whether charset toggle (SHIFT+VENDOR) is allowed +// - RPTFLG - whether key repeat is allowed -// XXX add RPTFLG support // XXX add Commodore 128 keyboard support // XXX add Commodore 65 keybopard support // XXX add support for using joystick to move sursor keys @@ -110,9 +110,12 @@ scnkey_matrix_loop_next: dey bpl scnkey_matrix_loop + txa // XXX switch registers upwards!!! + tay + // Scanning complete - cpx #$FF + cpy #$FF bne scnkey_got_key // FALLTROUGH @@ -126,16 +129,14 @@ scnkey_no_keys: rts -scnkey_got_key: // .X should now contain the key offset in matrix pointed by KEYTAB +scnkey_got_key: // .Y should now contain the key offset in matrix pointed by KEYTAB - cpx LSTX + cpy LSTX beq scnkey_handle_repeat // branch if the same key as previously - stx LSTX + sty LSTX // Reset key repeat counters - see [CM64] page 58 - lda #$04 - sta KOUNT lda #$10 sta DELAY @@ -143,10 +144,12 @@ scnkey_got_key: // .X should now contain the key offset in matrix pointed by KEY scnkey_output_key: - // Output PETSCII code to the keyboard buffer + // Reinitialize secondary couter - txa // XXX switch registers!!! - tay + lda #$06 + sta KOUNT + + // Output PETSCII code to the keyboard buffer lda (KEYTAB), y beq scnkey_no_keys // branch if we have no PETSCII code for this key @@ -154,18 +157,32 @@ scnkey_output_key: sta KEYD, y inc NDX + // FALLTROUGH + +scnkey_done: + rts scnkey_handle_repeat: - // Handle repeat timer + // Check whether we should repeat keys + + lda RPTFLG + bpl scnkey_done // branch if we should do no repeat + + // First countdown (for the first repeat) + + lda DELAY + beq !+ + dec DELAY + + rts +!: + // Second countdown (for both first and subsequential repeats) lda KOUNT - beq !+ + beq scnkey_output_key // if second counter is also 0, we can repeat the key dec KOUNT -!: - - // XXX rts From ea60cb912fdf1e7980fbe0dd2d23f982e5c423f2 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 13 Oct 2019 21:25:24 +0200 Subject: [PATCH 43/85] small code optimization --- c64/kernal/keyboard/scnkey.s | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 1cdd63ea..89e7dea9 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -81,38 +81,35 @@ scnkey_bucky_loop: // Scan the keyboard matrix - ldy #$07 // XXX adapt for C128 and C65 keyboards - ldx #$FF // offset in key matrix table, $FF for not found yet + ldx #$07 // XXX adapt for C128 and C65 keyboards + ldy #$FF // offset in key matrix table, $FF for not found yet scnkey_matrix_loop: - lda kb_matrix_row_keys, y + lda kb_matrix_row_keys, x sta CIA1_PRA - lda kb_matrix_bucky_filter, y // filter out bucky keys + lda kb_matrix_bucky_filter, x // filter out bucky keys ora CIA1_PRB cmp #$FF beq scnkey_matrix_loop_next // skip if no key pressed from this row - cpx #$FF + cpy #$FF bne scnkey_no_keys // clash, more than one key pressed // We have at least one key pressed in this row, we need to find which one exactly - ldx #$07 + ldy #$07 scnkey_matrix_loop_inner: - cmp kb_matrix_row_keys, x + cmp kb_matrix_row_keys, y bne !+ // not this particular key - txa // now .A contains key offset within a row + tya // now .A contains key offset within a row sec - adc kb_matrix_row_offsets, y // now .A contains key offset from the matrix start - tax + adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start + tay jmp scnkey_matrix_loop_next !: - dex + dey bpl scnkey_matrix_loop_inner bmi scnkey_no_keys // branch always, multiple keys must have been pressed scnkey_matrix_loop_next: - dey + dex bpl scnkey_matrix_loop - txa // XXX switch registers upwards!!! - tay - // Scanning complete cpy #$FF From 183ac3ab870bc365ebd58131815f843c75c0ba37 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 13 Oct 2019 22:50:25 +0200 Subject: [PATCH 44/85] new SCNKEY is useable (but is still buggy and incomplete) --- c64/kernal/cint_real.s | 6 ++++++ c64/kernal/keyboard/kb_matrix.s | 5 +---- c64/kernal/keyboard/kb_matrix_bucky_filter.s | 10 ++++----- c64/kernal/keyboard/kb_matrix_row_keys.s | 14 ++++++------- c64/kernal/keyboard/scnkey.s | 22 +++++++++++++------- c64/kernal/keyboard/scnkey_set_keytab.s | 2 +- 6 files changed, 35 insertions(+), 24 deletions(-) diff --git a/c64/kernal/cint_real.s b/c64/kernal/cint_real.s index d680f2df..8a214d1f 100644 --- a/c64/kernal/cint_real.s +++ b/c64/kernal/cint_real.s @@ -68,10 +68,16 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? jsr setup_vicii // Initialise cursor blink flags (Compute's Mapping the 64 p215) + lda #$01 sta BLNCT sta BLNSW + // Enable cursor repeat - XXX make it configurable + + lda #$80 + sta RPTFLG + // Set keyboard decode vector (Compute's Mapping the 64 p215) #if CONFIG_SCNKEY_TWW_CTR diff --git a/c64/kernal/keyboard/kb_matrix.s b/c64/kernal/keyboard/kb_matrix.s index c1eeff70..e0e84114 100644 --- a/c64/kernal/keyboard/kb_matrix.s +++ b/c64/kernal/keyboard/kb_matrix.s @@ -13,10 +13,6 @@ // and converting the values -// XXX to be extra compatible (someone could change the KEYLOG), we should make sure -// we are using the same matrix format as the original ROM does - - kb_matrix: __kb_matrix_normal: @@ -61,6 +57,7 @@ __kb_matrix_ctrl: +// XXX extended matrices for C128/C65 // kb_matrix_ext128: $D02F diff --git a/c64/kernal/keyboard/kb_matrix_bucky_filter.s b/c64/kernal/keyboard/kb_matrix_bucky_filter.s index 1443df5e..21ebe02f 100644 --- a/c64/kernal/keyboard/kb_matrix_bucky_filter.s +++ b/c64/kernal/keyboard/kb_matrix_bucky_filter.s @@ -14,14 +14,14 @@ kb_matrix_bucky_filter: // values for OR with CIA1_PRB content to filter out bucky keys - .byte %00100100 // VENDOR + CONTROL - .byte %00010000 // SHIFT (right) - .byte %00000000 - .byte %00000000 - .byte %00000000 .byte %00000000 .byte %10000000 // SHIFT (left) .byte %00000000 + .byte %00000000 + .byte %00000000 + .byte %00000000 + .byte %00010000 // SHIFT (right) + .byte %00100100 // VENDOR + CONTROL #endif // no CONFIG_SCNKEY_TWW_CTR diff --git a/c64/kernal/keyboard/kb_matrix_row_keys.s b/c64/kernal/keyboard/kb_matrix_row_keys.s index df3a64f8..f4284108 100644 --- a/c64/kernal/keyboard/kb_matrix_row_keys.s +++ b/c64/kernal/keyboard/kb_matrix_row_keys.s @@ -15,14 +15,14 @@ kb_matrix_row_keys: // - values for CIA1_PRA to connect only the given row // - also used to scan a single row - .byte %01111111 - .byte %10111111 - .byte %11011111 - .byte %11101111 - .byte %11110111 - .byte %11111011 - .byte %11111101 .byte %11111110 + .byte %11111101 + .byte %11111011 + .byte %11110111 + .byte %11101111 + .byte %11011111 + .byte %10111111 + .byte %01111111 #endif // no CONFIG_SCNKEY_TWW_CTR diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 89e7dea9..4c8689a5 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -24,7 +24,7 @@ // XXX add Commodore 128 keyboard support // XXX add Commodore 65 keybopard support // XXX add support for using joystick to move sursor keys -// XXX prevent joystick port 1 interference +// XXX explicitly prevent joystick port 1 interference #if !CONFIG_SCNKEY_TWW_CTR @@ -98,7 +98,7 @@ scnkey_matrix_loop_inner: cmp kb_matrix_row_keys, y bne !+ // not this particular key tya // now .A contains key offset within a row - sec + clc adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start tay jmp scnkey_matrix_loop_next @@ -111,7 +111,6 @@ scnkey_matrix_loop_next: bpl scnkey_matrix_loop // Scanning complete - cpy #$FF bne scnkey_got_key @@ -134,20 +133,27 @@ scnkey_got_key: // .Y should now contain the key offset in matrix pointed by KEY // Reset key repeat counters - see [CM64] page 58 - lda #$10 + // Note: according to [CM64] it should be $10 for initializing DELAY, $06 for + // initializing KOUNT for the first time and $04 for subsequent ones - but replicating + // this would make our implementation longer, probably without improving the compatibility. + // + // Besides - since I am the one who writes the code, I will make the values exactly how I like them :D + + // XXX consider making it configurable, also make configurable RPTFLG + + lda #$16 sta DELAY // FALLTROUGH scnkey_output_key: - // Reinitialize secondary couter + // Reinitialize secondary counter - lda #$06 + lda #$03 sta KOUNT // Output PETSCII code to the keyboard buffer - lda (KEYTAB), y beq scnkey_no_keys // branch if we have no PETSCII code for this key ldy NDX @@ -164,6 +170,8 @@ scnkey_handle_repeat: // Check whether we should repeat keys + // XXX some keys should be repeat always! + lda RPTFLG bpl scnkey_done // branch if we should do no repeat diff --git a/c64/kernal/keyboard/scnkey_set_keytab.s b/c64/kernal/keyboard/scnkey_set_keytab.s index eb26ff5d..27fcfef1 100644 --- a/c64/kernal/keyboard/scnkey_set_keytab.s +++ b/c64/kernal/keyboard/scnkey_set_keytab.s @@ -24,7 +24,7 @@ scnkey_set_keytab: lda kb_matrix_lookup, x // Add offset to the vector - sec + clc adc KEYTAB+0 sta KEYTAB+0 lda #$00 From 677e5452a6cf04e8eeeaf7b87f32a2830b4fe6f2 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 14 Oct 2019 18:37:46 +0200 Subject: [PATCH 45/85] further work on new SCNKEY --- STATUS.md | 94 +++++++++--------- c64/,,config_generic.s | 4 +- c64/,,config_mega65.s | 4 +- c64/,,config_ultimate64.s | 4 +- c64/kernal/interrupts/udtim.s | 11 +-- c64/kernal/keyboard/kb_matrix_lookup.s | 32 +++--- .../keyboard/kb_matrix_lookup_tww_ctr.s | 28 ++++++ c64/kernal/keyboard/keyboard_disconnect.s | 12 +++ c64/kernal/keyboard/scnkey.s | 98 ++++++++++++++++--- c64/kernal/keyboard/scnkey_set_keytab.s | 26 +++++ c64/kernal/keyboard/scnkey_tww_ctr.s | 2 +- 11 files changed, 228 insertions(+), 87 deletions(-) create mode 100644 c64/kernal/keyboard/kb_matrix_lookup_tww_ctr.s create mode 100644 c64/kernal/keyboard/keyboard_disconnect.s diff --git a/STATUS.md b/STATUS.md index 4195a6ba..7b320fe7 100644 --- a/STATUS.md +++ b/STATUS.md @@ -96,53 +96,53 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on
-| Address | Unofficial | Name | Status | Remarks | -| :-------: | :--------: | :---------- | :------: | :------------------------------------------------: | -| `($028F)` | | `KEYLOG` | DONE | | -| `$FF81` | `$FF5B` | `CINT` | DONE | | -| `$FF84` | `$FDA3` | `IOINIT` | PARTIAL | CIA initialization incomplete | -| `$FF87` | `$FD50` | `RAMTAS` | DONE | | -| `$FF8A` | `$FD15` | `RESTOR` | DONE | | -| `$FF8D` | `$FD1A` | `VECTOR` | DONE | | -| `$FF90` | | `SETMSG` | DONE | | -| `$FF93` | | `SECOND` | DONE | | -| `$FF96` | | `TKSA` | DONE | | -| `$FF99` | | `MEMTOP` | DONE | | -| `$FF9C` | | `MEMBOT` | DONE | | -| `$FF9F` | | `SCNKEY` | PARTIAL | future complete version has compatibility problems | -| `$FFA2` | | `SETTMO` | DONE | | -| `$FFA5` | | `ACPTR` | DONE | | -| `$FFA8` | | `CIOUT` | DONE | | -| `$FFAB` | | `UNTLK` | DONE | | -| `$FFAE` | | `UNLSN` | DONE | | -| `$FFB1` | | `LISTEN` | DONE | | -| `$FFB4` | | `TALK` | DONE | | -| `$FFB7` | | `READST` | DONE | | -| `$FFBA` | | `SETFLS` | DONE | | -| `$FFBD` | | `SETNAM` | DONE | | -| `$FFC0` | `$F34A` | `OPEN` | DONE | | -| `$FFC3` | `$F291` | `CLOSE` | DONE | | -| `$FFC6` | `$F20E` | `CHKIN` | DONE | | -| `$FFC9` | `$F250` | `CKOUT` | PARTIAL | | -| `$FFCC` | `$F333` | `CLRCHN` | DONE | | -| `$FFCF` | `$F157` | `CHRIN` | PARTIAL | | -| `$FFD2` | `$F1CA` | `CHROUT` | PARTIAL | | -| `$FFD5` | `$F49E` | `LOAD` | PARTIAL | not yet clear what's this entry doing | -| `($0330)` | `$F4A5` | `LOAD` | PARTIAL | no VERIFY support, no STOP key, check $F49E addr | -| `$FFD8` | `$F5DD` | `SAVE` | NOT DONE | | -| `($0332)` | `$F5ED` | `SAVE` | NOT DONE | | -| `$FFDB` | | `SETTIM` | DONE | | -| `$FFDE` | | `RDTIM` | DONE | | -| `$FFE1` | `$F6ED` | `STOP` | DONE | | -| `$FFE4` | `$F13E` | `GETIN` | PARTIAL | only some devices supported | -| `$FFE7` | `$F32F` | `CLALL` | DONE | | -| `$FFEA` | | `UDTIM` | DONE | | -| `$FFED` | | `SCREEN` | DONE | | -| `$FFF0` | `$E50A` | `PLOT` | DONE | | -| `$FFF3` | | `IOBASE` | DONE | | -| `($FFFA)` | | NMI vec | PARTIAL | | -| `($FFFC)` | | RESET vec | PARTIAL | | -| `($FFFE)` | | IRQ/BRK vec | PARTIAL | | +| Address | Unofficial | Name | Status | Remarks | +| :-------: | :--------: | :---------- | :------: | :--------------------------------------------------: | +| `($028F)` | | `KEYLOG` | DONE | works differently on purpose, to improve kb scanning | +| `$FF81` | `$FF5B` | `CINT` | DONE | | +| `$FF84` | `$FDA3` | `IOINIT` | PARTIAL | CIA initialization incomplete | +| `$FF87` | `$FD50` | `RAMTAS` | DONE | | +| `$FF8A` | `$FD15` | `RESTOR` | DONE | | +| `$FF8D` | `$FD1A` | `VECTOR` | DONE | | +| `$FF90` | | `SETMSG` | DONE | | +| `$FF93` | | `SECOND` | DONE | | +| `$FF96` | | `TKSA` | DONE | | +| `$FF99` | | `MEMTOP` | DONE | | +| `$FF9C` | | `MEMBOT` | DONE | | +| `$FF9F` | | `SCNKEY` | PARTIAL | future complete version has compatibility problems | +| `$FFA2` | | `SETTMO` | DONE | | +| `$FFA5` | | `ACPTR` | DONE | | +| `$FFA8` | | `CIOUT` | DONE | | +| `$FFAB` | | `UNTLK` | DONE | | +| `$FFAE` | | `UNLSN` | DONE | | +| `$FFB1` | | `LISTEN` | DONE | | +| `$FFB4` | | `TALK` | DONE | | +| `$FFB7` | | `READST` | DONE | | +| `$FFBA` | | `SETFLS` | DONE | | +| `$FFBD` | | `SETNAM` | DONE | | +| `$FFC0` | `$F34A` | `OPEN` | DONE | | +| `$FFC3` | `$F291` | `CLOSE` | DONE | | +| `$FFC6` | `$F20E` | `CHKIN` | DONE | | +| `$FFC9` | `$F250` | `CKOUT` | PARTIAL | | +| `$FFCC` | `$F333` | `CLRCHN` | DONE | | +| `$FFCF` | `$F157` | `CHRIN` | PARTIAL | | +| `$FFD2` | `$F1CA` | `CHROUT` | PARTIAL | | +| `$FFD5` | `$F49E` | `LOAD` | PARTIAL | not yet clear what's this entry doing | +| `($0330)` | `$F4A5` | `LOAD` | PARTIAL | no VERIFY support, no STOP key, check $F49E addr | +| `$FFD8` | `$F5DD` | `SAVE` | NOT DONE | | +| `($0332)` | `$F5ED` | `SAVE` | NOT DONE | | +| `$FFDB` | | `SETTIM` | DONE | | +| `$FFDE` | | `RDTIM` | DONE | | +| `$FFE1` | `$F6ED` | `STOP` | DONE | | +| `$FFE4` | `$F13E` | `GETIN` | PARTIAL | only some devices supported | +| `$FFE7` | `$F32F` | `CLALL` | DONE | | +| `$FFEA` | | `UDTIM` | DONE | | +| `$FFED` | | `SCREEN` | DONE | | +| `$FFF0` | `$E50A` | `PLOT` | DONE | | +| `$FFF3` | | `IOBASE` | DONE | | +| `($FFFA)` | | NMI vec | PARTIAL | | +| `($FFFC)` | | RESET vec | PARTIAL | | +| `($FFFE)` | | IRQ/BRK vec | PARTIAL | |
diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index de70aaac..60c34491 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -58,7 +58,9 @@ #define CONFIG_PANIC_SCREEN #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS -#define CONFIG_SCNKEY_TWW_CTR // for now has to be enabled +// #define CONFIG_SCNKEY_TWW_CTR // XXX document this +#define CONFIG_JOY1_CURSOR // XXX document this +#define CONFIG_JOY2_CURSOR // XXX document this // Debug options diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 8cd04b0e..8f94243e 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -60,7 +60,9 @@ #define CONFIG_PANIC_SCREEN #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS -#define CONFIG_SCNKEY_TWW_CTR // for now has to be enabled +#define CONFIG_SCNKEY_TWW_CTR // XXX document this +#define CONFIG_JOY1_CURSOR // XXX document this +#define CONFIG_JOY2_CURSOR // XXX document this // Debug options diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index 7578d183..6a1a0e5b 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -58,7 +58,9 @@ #define CONFIG_PANIC_SCREEN #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS -#define CONFIG_SCNKEY_TWW_CTR // for now has to be enabled +// #define CONFIG_SCNKEY_TWW_CTR // XXX document this +#define CONFIG_JOY1_CURSOR // XXX document this +#define CONFIG_JOY2_CURSOR // XXX document this // Debug options diff --git a/c64/kernal/interrupts/udtim.s b/c64/kernal/interrupts/udtim.s index 2d8aac00..34528613 100644 --- a/c64/kernal/interrupts/udtim.s +++ b/c64/kernal/interrupts/udtim.s @@ -25,18 +25,17 @@ udtim_update_stkey: // entry to be used when interrupts are disabled // Another action we have to perform is to copy the last row of keyboard to RAM, // so that various routines can detect the STOP key press - // XXX scnkey contains similar sequence - deduplicate this! - lda #$FF - sta CIA1_DDRA // output - lda #$00 - sta CIA1_DDRB // input lda #$7F sta CIA1_PRA // select the last row (bit to 0) lda CIA1_PRB // read the row sta STKEY - rts + + // Finish by disconnecting the keyboard, this will prevent + // interference when scanning joystick in port 1 + + jmp keyboard_disconnect udtim_clock_rollover: diff --git a/c64/kernal/keyboard/kb_matrix_lookup.s b/c64/kernal/keyboard/kb_matrix_lookup.s index 53f55497..93477737 100644 --- a/c64/kernal/keyboard/kb_matrix_lookup.s +++ b/c64/kernal/keyboard/kb_matrix_lookup.s @@ -1,21 +1,23 @@ // -// Work out if normal, shifted, control or Vendor modified keyboard. -// Table contains the offsets into keyboard_matrixes that should be used -// for different values of the bottom 3 bits of key_bucky_state XXX -// Interaction is simple to work out when playing with a C64: -// CTRL trumps SHIFT or VENDOR -// VENDOR + SHIFT = DOES NOTHING -// All 3 does CONTROL +// Helper table for determining keyboard matrix decoding table on the C64 keyboard // +// When more than one bucky keey is pressed, decoding keys is asking for trouble, +// so never allow this. +// + + +#if !CONFIG_SCNKEY_TWW_CTR kb_matrix_lookup: - .byte (__kb_matrix_normal - kb_matrix) // Normal - .byte (__kb_matrix_shift - kb_matrix) // SHIFT - .byte (__kb_matrix_ctrl - kb_matrix) // CTRL - .byte (__kb_matrix_ctrl - kb_matrix) // CTRL + SHIFT - .byte (__kb_matrix_vendor - kb_matrix) // VENDOR - .byte (__kb_matrix_vendor - kb_matrix) // VENDOR + SHIFT - .byte (__kb_matrix_ctrl - kb_matrix) // VENDOR + CTRL - .byte (__kb_matrix_ctrl - kb_matrix) // VENDOR + CTRL + SHIFT + .byte (__kb_matrix_normal - kb_matrix) // %000 Normal + .byte (__kb_matrix_shift - kb_matrix) // %001 SHIFT + .byte (__kb_matrix_vendor - kb_matrix) // %010 VENDOR + .byte $FF // %011 SHIFT+VENDOR + .byte (__kb_matrix_ctrl - kb_matrix) // %100 CTRL + .byte $FF // %101 SHIFT+CTRL + .byte $FF // %110 VENDOR+CTRL + .byte $FF // %111 SHIFT+VENDOR+CTRL + +#endif diff --git a/c64/kernal/keyboard/kb_matrix_lookup_tww_ctr.s b/c64/kernal/keyboard/kb_matrix_lookup_tww_ctr.s new file mode 100644 index 00000000..cc7d6e09 --- /dev/null +++ b/c64/kernal/keyboard/kb_matrix_lookup_tww_ctr.s @@ -0,0 +1,28 @@ + +// +// Work out if normal, shifted, control or Vendor modified keyboard. +// Table contains the offsets into keyboard_matrixes that should be used +// for different values of the bottom 3 bits of key_bucky_state XXX +// Interaction is simple to work out when playing with a C64: +// CTRL trumps SHIFT or VENDOR +// VENDOR + SHIFT = DOES NOTHING +// All 3 does CONTROL +// + +// This lookup table is used by TWW/CTR keyboard routine only! + + +#if CONFIG_SCNKEY_TWW_CTR + +kb_matrix_lookup_tww_ctr: + + .byte $00 // Normal + .byte $40 // Shifted + .byte $80 // Control + .byte $80 // Control + SHIFT + .byte $C0 // Vendor + .byte $C0 // Vendor + SHIFT + .byte $80 // Vendor + CTRL + .byte $80 // Vendor + CTRL + SHIFT + +#endif // CONFIG_SCNKEY_TWW_CTR diff --git a/c64/kernal/keyboard/keyboard_disconnect.s b/c64/kernal/keyboard/keyboard_disconnect.s new file mode 100644 index 00000000..12708fb6 --- /dev/null +++ b/c64/kernal/keyboard/keyboard_disconnect.s @@ -0,0 +1,12 @@ + +// +// Helper routine - disconnects the keyboard from CIA1_PRB, +// leaves $FF in .X (behavior needed in some places) + + +keyboard_disconnect: + + ldx #$FF + stx CIA1_PRA // disconnect all the rows + + rts diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 4c8689a5..d79f183f 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -23,8 +23,9 @@ // XXX add Commodore 128 keyboard support // XXX add Commodore 65 keybopard support -// XXX add support for using joystick to move sursor keys -// XXX explicitly prevent joystick port 1 interference +// XXX add support for using joysticks to move cursor keys +// XXX add support for keys which are repeated always + #if !CONFIG_SCNKEY_TWW_CTR @@ -46,7 +47,7 @@ SCNKEY: // Check for any activity lda #$00 - sta CIA1_PRA // connect all the rows + sta CIA1_PRA // connect all the rows ldx #$FF cpx CIA1_PRB beq scnkey_no_keys @@ -71,18 +72,44 @@ scnkey_bucky_loop: jsr via_keylog // XXX for some CPUs we have indirect jsr - // Check if we have free space in the keyboard buffer + // Check if KEYTAB is not 0 (happens if more than one bucky key is pressed) + // High byte equal to 0 = table considered invalid + lda KEYTAB+1 + beq scnkey_no_keys - lda NDX - cmp XMAX - bcs scnkey_no_keys // no space in keyboard buffer - do not waste time +#if CONFIG_JOY2_CURSOR - // XXX check for joystick activity + // XXX why this does not work??? + + // Check for control port 2 activity + + // ldx #$00 + // stx CIA1_DDRA // set port to input to read joystick + + // lda CIA1_PRA // read the joystick 2 status + + // dex + // stx CIA1_DDRA // set port back to output + + // and #%00001111 // filter out anything but joystick movement + // bne scnkey_joystick_a_filtered + +#endif + + // Check for control port 1 activity (can interfere with keyboard) + + jsr keyboard_disconnect // disconnect all the rows, .X will be $FF + cpx CIA1_PRB // only control port activity will be reported +#if CONFIG_JOY1_CURSOR + bne scnkey_joystick_x // use joystick for cursor keys +#else + bne scnkey_no_keys // if activity detected do not scan the keyboard +#endif // Scan the keyboard matrix + ldy #$FF // offset in key matrix table, $FF for not found yet ldx #$07 // XXX adapt for C128 and C65 keyboards - ldy #$FF // offset in key matrix table, $FF for not found yet scnkey_matrix_loop: lda kb_matrix_row_keys, x sta CIA1_PRA @@ -110,9 +137,16 @@ scnkey_matrix_loop_next: dex bpl scnkey_matrix_loop - // Scanning complete + // Scanning complete - check if we got a key + cpy #$FF - bne scnkey_got_key + beq scnkey_no_keys + + // To be extra sure, check for possible control port 1 interference once again + + jsr keyboard_disconnect // disconnect all the rows, .X will be $FF + cpx CIA1_PRB // only control port activity will be reported + beq scnkey_got_key // branch if joystick activity NOT detected // FALLTROUGH @@ -125,6 +159,25 @@ scnkey_no_keys: rts +#if CONFIG_JOY1_CURSOR || CONFIG_JOY2_CURSOR + +scnkey_joystick_x: + + // Handle joystick activity (in .X) as cursor keys + + txa + and #%00001111 // filter out anything but movement + + // FALLTROUGH + +scnkey_joystick_a_filtered: + + // XXX finish the implementation + + rts + +#endif + scnkey_got_key: // .Y should now contain the key offset in matrix pointed by KEYTAB cpy LSTX @@ -148,6 +201,12 @@ scnkey_got_key: // .Y should now contain the key offset in matrix pointed by KEY scnkey_output_key: + // Check if we have free space in the keyboard buffer + + lda NDX + cmp XMAX + bcs scnkey_early_repeat // no space in buffer XXX set timer to trigger repeat the next time + // Reinitialize secondary counter lda #$03 @@ -170,12 +229,10 @@ scnkey_handle_repeat: // Check whether we should repeat keys - // XXX some keys should be repeat always! - lda RPTFLG bpl scnkey_done // branch if we should do no repeat - // First countdown (for the first repeat) + // Countdown before first repeat lda DELAY beq !+ @@ -183,7 +240,7 @@ scnkey_handle_repeat: rts !: - // Second countdown (for both first and subsequential repeats) + // Countdown before subsequent repeats lda KOUNT beq scnkey_output_key // if second counter is also 0, we can repeat the key @@ -191,6 +248,17 @@ scnkey_handle_repeat: rts +scnkey_early_repeat: + + // Keyboard buffer was full - at least make sure the key + // will be repeated as soon as possible + + lda #$00 + sta DELAY + sta KOUNT + + rts + via_keylog: jmp (KEYLOG) diff --git a/c64/kernal/keyboard/scnkey_set_keytab.s b/c64/kernal/keyboard/scnkey_set_keytab.s index 27fcfef1..4f9781aa 100644 --- a/c64/kernal/keyboard/scnkey_set_keytab.s +++ b/c64/kernal/keyboard/scnkey_set_keytab.s @@ -5,8 +5,17 @@ // - [CM64] Compute's Mapping the Commodore 64 - pages 220, 221 // + scnkey_set_keytab: + +#if CONFIG_SCNKEY_TWW_CTR // routine not compatible with legacy SCNKEY + + rts + +#else + + // Set initial KEYTAB value lda # Date: Mon, 14 Oct 2019 19:58:59 +0200 Subject: [PATCH 46/85] new SCNKEY can now use joystick port 1 --- c64/,,config_generic.s | 12 ++++-- c64/,,config_mega65.s | 12 ++++-- c64/,,config_ultimate64.s | 12 ++++-- c64/kernal/cint_real.s | 4 ++ c64/kernal/keyboard/kb_matrix_joy.s | 38 +++++++++++++++++++ c64/kernal/keyboard/scnkey.s | 57 +++++++++++++++++++++-------- 6 files changed, 111 insertions(+), 24 deletions(-) create mode 100644 c64/kernal/keyboard/kb_matrix_joy.s diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 60c34491..049ac84b 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -45,6 +45,15 @@ // #define CONFIG_SID_D5XX +// Keyboard settings + + +// #define CONFIG_SCNKEY_TWW_CTR // XXX document this +// #define CONFIG_KEY_REPEAT // XXX document this +#define CONFIG_JOY1_CURSOR // XXX document this +#define CONFIG_JOY2_CURSOR // XXX document this + + // Eye candy // #define CONFIG_BANNER_SIMPLE @@ -58,9 +67,6 @@ #define CONFIG_PANIC_SCREEN #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS -// #define CONFIG_SCNKEY_TWW_CTR // XXX document this -#define CONFIG_JOY1_CURSOR // XXX document this -#define CONFIG_JOY2_CURSOR // XXX document this // Debug options diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 8f94243e..0bc2c86c 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -47,6 +47,15 @@ // #define CONFIG_SID_D5XX +// Keyboard settings + + +#define CONFIG_SCNKEY_TWW_CTR // XXX document this +// #define CONFIG_KEY_REPEAT // XXX document this +#define CONFIG_JOY1_CURSOR // XXX document this +#define CONFIG_JOY2_CURSOR // XXX document this + + // Eye candy // #define CONFIG_BANNER_SIMPLE @@ -60,9 +69,6 @@ #define CONFIG_PANIC_SCREEN #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS -#define CONFIG_SCNKEY_TWW_CTR // XXX document this -#define CONFIG_JOY1_CURSOR // XXX document this -#define CONFIG_JOY2_CURSOR // XXX document this // Debug options diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index 6a1a0e5b..aa0ce73d 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -45,6 +45,15 @@ #define CONFIG_SID_D5XX +// Keyboard settings + + +// #define CONFIG_SCNKEY_TWW_CTR // XXX document this +#define CONFIG_KEY_REPEAT // XXX document this +#define CONFIG_JOY1_CURSOR // XXX document this +#define CONFIG_JOY2_CURSOR // XXX document this + + // Eye candy // #define CONFIG_BANNER_SIMPLE @@ -58,9 +67,6 @@ #define CONFIG_PANIC_SCREEN #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS -// #define CONFIG_SCNKEY_TWW_CTR // XXX document this -#define CONFIG_JOY1_CURSOR // XXX document this -#define CONFIG_JOY2_CURSOR // XXX document this // Debug options diff --git a/c64/kernal/cint_real.s b/c64/kernal/cint_real.s index 8a214d1f..3a096a63 100644 --- a/c64/kernal/cint_real.s +++ b/c64/kernal/cint_real.s @@ -75,9 +75,13 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? // Enable cursor repeat - XXX make it configurable +#if CONFIG_KEY_REPEAT + lda #$80 sta RPTFLG +#endif + // Set keyboard decode vector (Compute's Mapping the 64 p215) #if CONFIG_SCNKEY_TWW_CTR diff --git a/c64/kernal/keyboard/kb_matrix_joy.s b/c64/kernal/keyboard/kb_matrix_joy.s new file mode 100644 index 00000000..50c9d501 --- /dev/null +++ b/c64/kernal/keyboard/kb_matrix_joy.s @@ -0,0 +1,38 @@ + +// +// Matrix for retrieving C64 joystick status and inject is as keyboard event +// + + +#if !CONFIG_SCNKEY_TWW_CTR && (CONFIG_JOY1_CURSOR || CONFIG_JOY2_CURSOR) + + +kb_matrix_joy_status: + + .byte %00001110 // up + .byte %00001101 // down + .byte %00001011 // left + .byte %00000111 // right + +kb_matrix_joy_keytab_idx: + + .byte $07 // up + .byte $07 // down + .byte $02 // left + .byte $02 // right + +kb_matrix_joy_keytab_lo: + + .byte <__kb_matrix_shift // up + .byte <__kb_matrix_normal // down + .byte <__kb_matrix_shift // left + .byte <__kb_matrix_normal // right + +kb_matrix_joy_keytab_hi: + + .byte >__kb_matrix_shift // up + .byte >__kb_matrix_normal // down + .byte >__kb_matrix_shift // left + .byte >__kb_matrix_normal // right + +#endif diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index d79f183f..05ef1b54 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -23,7 +23,7 @@ // XXX add Commodore 128 keyboard support // XXX add Commodore 65 keybopard support -// XXX add support for using joysticks to move cursor keys +// XXX fix support for joystick port 2 to move cursor keys // XXX add support for keys which are repeated always @@ -72,14 +72,9 @@ scnkey_bucky_loop: jsr via_keylog // XXX for some CPUs we have indirect jsr - // Check if KEYTAB is not 0 (happens if more than one bucky key is pressed) - // High byte equal to 0 = table considered invalid - lda KEYTAB+1 - beq scnkey_no_keys - #if CONFIG_JOY2_CURSOR - // XXX why this does not work??? + // XXX why this does not work // Check for control port 2 activity @@ -92,7 +87,8 @@ scnkey_bucky_loop: // stx CIA1_DDRA // set port back to output // and #%00001111 // filter out anything but joystick movement - // bne scnkey_joystick_a_filtered + // cmp #%00001111 + // bne scnkey_joystick_filtered #endif @@ -101,11 +97,17 @@ scnkey_bucky_loop: jsr keyboard_disconnect // disconnect all the rows, .X will be $FF cpx CIA1_PRB // only control port activity will be reported #if CONFIG_JOY1_CURSOR - bne scnkey_joystick_x // use joystick for cursor keys + bne scnkey_joystick_1 // use joystick for cursor keys #else bne scnkey_no_keys // if activity detected do not scan the keyboard #endif + // Check if KEYTAB is not 0 (happens if more than one bucky key is pressed) + // High byte equal to 0 = table considered invalid + + lda KEYTAB+1 + beq scnkey_no_keys + // Scan the keyboard matrix ldy #$FF // offset in key matrix table, $FF for not found yet @@ -159,22 +161,46 @@ scnkey_no_keys: rts -#if CONFIG_JOY1_CURSOR || CONFIG_JOY2_CURSOR +#if CONFIG_JOY1_CURSOR -scnkey_joystick_x: +scnkey_joystick_1: - // Handle joystick activity (in .X) as cursor keys + // Prepare joystick 1 status - txa + lda CIA1_PRB and #%00001111 // filter out anything but movement // FALLTROUGH -scnkey_joystick_a_filtered: +#endif - // XXX finish the implementation +#if CONFIG_JOY1_CURSOR || CONFIG_JOY2_CURSOR + +scnkey_joystick_filtered: + + // Set appropriate keyboard matrix and key code for joystick event + + ldy #$03 +!: + cmp kb_matrix_joy_status, y + beq !+ + dey + bpl !- + + // Not found rts +!: + // Found + + lda kb_matrix_joy_keytab_lo, y + sta KEYTAB+0 + lda kb_matrix_joy_keytab_hi, y + sta KEYTAB+1 + lda kb_matrix_joy_keytab_idx, y + tay + + // FALLTROUGH #endif @@ -228,6 +254,7 @@ scnkey_done: scnkey_handle_repeat: // Check whether we should repeat keys + // XXX always repeat SPACE, cvursors, ins/del lda RPTFLG bpl scnkey_done // branch if we should do no repeat From 9377573f982fc37593df6204103daf3272345e94 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 14 Oct 2019 21:10:56 +0200 Subject: [PATCH 47/85] completed RPTFLG support --- c64/,,config_ultimate64.s | 2 +- c64/kernal/keyboard/kb_matrix_alwaysrepeat.s | 23 ++++++++++++ c64/kernal/keyboard/scnkey.s | 38 ++++++++++++-------- 3 files changed, 48 insertions(+), 15 deletions(-) create mode 100644 c64/kernal/keyboard/kb_matrix_alwaysrepeat.s diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index aa0ce73d..a993bd6e 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -49,7 +49,7 @@ // #define CONFIG_SCNKEY_TWW_CTR // XXX document this -#define CONFIG_KEY_REPEAT // XXX document this +// #define CONFIG_KEY_REPEAT // XXX document this #define CONFIG_JOY1_CURSOR // XXX document this #define CONFIG_JOY2_CURSOR // XXX document this diff --git a/c64/kernal/keyboard/kb_matrix_alwaysrepeat.s b/c64/kernal/keyboard/kb_matrix_alwaysrepeat.s new file mode 100644 index 00000000..3a6caa78 --- /dev/null +++ b/c64/kernal/keyboard/kb_matrix_alwaysrepeat.s @@ -0,0 +1,23 @@ + +// +// Matrix ids of keys which should be repeated regardless of RPTFLG +// +// Values based on: +// - [CM64] Compute's Mapping the Commodore 64 - page 58 +// + + +#if !CONFIG_SCNKEY_TWW_CTR + + +kb_matrix_alwaysrepeat: + + .byte $3C // SPACE + .byte $02 // CRSR LEFT/RIGHT + .byte $07 // CRSR UP/DOWN + .byte $00 // INS/DEL + +__kb_matrix_alwaysrepeat_end: + + +#endif // no CONFIG_SCNKEY_TWW_CTR diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 05ef1b54..cbe99753 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -24,7 +24,6 @@ // XXX add Commodore 128 keyboard support // XXX add Commodore 65 keybopard support // XXX fix support for joystick port 2 to move cursor keys -// XXX add support for keys which are repeated always #if !CONFIG_SCNKEY_TWW_CTR @@ -78,17 +77,18 @@ scnkey_bucky_loop: // Check for control port 2 activity - // ldx #$00 - // stx CIA1_DDRA // set port to input to read joystick + ldx #$00 + stx CIA1_DDRA // set port to input to read joystick - // lda CIA1_PRA // read the joystick 2 status + lda CIA1_PRA // read the joystick 2 status - // dex - // stx CIA1_DDRA // set port back to output + ldx #$FF + stx CIA1_DDRA // set port back to output - // and #%00001111 // filter out anything but joystick movement - // cmp #%00001111 - // bne scnkey_joystick_filtered + and #%00001111 // filter out anything but joystick movement + cmp #%00001111 + + bne scnkey_joystick_filtered #endif @@ -207,7 +207,7 @@ scnkey_joystick_filtered: scnkey_got_key: // .Y should now contain the key offset in matrix pointed by KEYTAB cpy LSTX - beq scnkey_handle_repeat // branch if the same key as previously + beq scnkey_try_repeat // branch if the same key as previously sty LSTX // Reset key repeat counters - see [CM64] page 58 @@ -251,13 +251,23 @@ scnkey_done: rts -scnkey_handle_repeat: +scnkey_try_repeat: - // Check whether we should repeat keys - // XXX always repeat SPACE, cvursors, ins/del + // Check whether we should repeat keys - first the flag, afterwards hardcoded list lda RPTFLG - bpl scnkey_done // branch if we should do no repeat + bmi scnkey_handle_repeat // branch if we should repeat always + + tya + ldx #(__kb_matrix_alwaysrepeat_end - kb_matrix_alwaysrepeat - 1) +!: + cmp kb_matrix_alwaysrepeat, x + beq scnkey_handle_repeat + dex + bpl !- + bmi scnkey_done + +scnkey_handle_repeat: // Countdown before first repeat From 83f038c7805a6ad14ed161dfb516876c291e61d5 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 14 Oct 2019 22:04:34 +0200 Subject: [PATCH 48/85] startup adjustements --- c64/kernal/fda3.ioinit.s | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/c64/kernal/fda3.ioinit.s b/c64/kernal/fda3.ioinit.s index 7bb0cc06..0203d315 100644 --- a/c64/kernal/fda3.ioinit.s +++ b/c64/kernal/fda3.ioinit.s @@ -106,11 +106,14 @@ IOINIT: ldx #$FF stx CIA1_DDRA // output - ldy #$00 - sty CIA1_DDRB // input + inx // $00 + stx CIA1_DDRB // input + + // Value checked on original ROM + stx CIA2_DDRA // Set DDR on CIA2 for IEC bus, VIC-II banking - lda #$3B + lda #$3F sta CIA2_DDRA // Set IEC bus to its initial idle state From 3b69cd398b585c86240b1055ec79ff41df7e616c Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 14 Oct 2019 22:28:46 +0200 Subject: [PATCH 49/85] SCNKEY can now use joystick port 2 too --- c64/kernal/keyboard/scnkey.s | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index cbe99753..5199427b 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -22,8 +22,7 @@ // XXX add Commodore 128 keyboard support -// XXX add Commodore 65 keybopard support -// XXX fix support for joystick port 2 to move cursor keys +// XXX add Commodore 65 keyboard support #if !CONFIG_SCNKEY_TWW_CTR @@ -45,12 +44,16 @@ SCNKEY: // Check for any activity - lda #$00 - sta CIA1_PRA // connect all the rows - ldx #$FF +#if !CONFIG_JOY2_CURSOR + + ldx #$00 + stx CIA1_PRA // connect all the rows + dex // puts $FF cpx CIA1_PRB beq scnkey_no_keys +#endif + // Retrieve SHIFT / VENDOR / CTRL status // Use .X to detect 2 or more keys pressed (should be $FF now) ldy #$03 @@ -73,7 +76,7 @@ scnkey_bucky_loop: #if CONFIG_JOY2_CURSOR - // XXX why this does not work + // XXX why this does not work ??? // Check for control port 2 activity @@ -82,7 +85,7 @@ scnkey_bucky_loop: lda CIA1_PRA // read the joystick 2 status - ldx #$FF + dex // puts $FF stx CIA1_DDRA // set port back to output and #%00001111 // filter out anything but joystick movement @@ -90,6 +93,12 @@ scnkey_bucky_loop: bne scnkey_joystick_filtered + inx // puts $00 + stx CIA1_PRA // connect all the rows + dex // puts $FF + cpx CIA1_PRB + beq scnkey_no_keys + #endif // Check for control port 1 activity (can interfere with keyboard) From 5c58af117af045891785f3e3ac2da50117fcc531 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 14 Oct 2019 22:58:43 +0200 Subject: [PATCH 50/85] new SCNKEY is now more configurable (size vs features) --- c64/,,config_generic.s | 6 ++++-- c64/,,config_mega65.s | 6 ++++-- c64/,,config_ultimate64.s | 6 ++++-- c64/aliases/,aliases_ram_lowmem.s | 10 +++++----- c64/kernal/cint_real.s | 4 ++-- c64/kernal/keyboard/kb_matrix_alwaysrepeat.s | 4 ++-- c64/kernal/keyboard/kb_matrix_bucky.s | 4 ++-- c64/kernal/keyboard/kb_matrix_bucky_filter.s | 4 ++-- c64/kernal/keyboard/kb_matrix_joy.s | 2 +- c64/kernal/keyboard/kb_matrix_lookup.s | 2 +- ...ookup_tww_ctr.s => kb_matrix_lookup_legacy.s} | 6 +++--- c64/kernal/keyboard/kb_matrix_row_keys.s | 4 ++-- c64/kernal/keyboard/kb_matrix_row_offsets.s | 4 ++-- c64/kernal/keyboard/scnkey.s | 16 ++++++++++++---- .../{scnkey_tww_ctr.s => scnkey_legacy.s} | 6 +++--- c64/kernal/keyboard/scnkey_set_keytab.s | 4 ++-- 16 files changed, 51 insertions(+), 37 deletions(-) rename c64/kernal/keyboard/{kb_matrix_lookup_tww_ctr.s => kb_matrix_lookup_legacy.s} (88%) rename c64/kernal/keyboard/{scnkey_tww_ctr.s => scnkey_legacy.s} (99%) diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 049ac84b..bfe8029d 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -48,8 +48,10 @@ // Keyboard settings -// #define CONFIG_SCNKEY_TWW_CTR // XXX document this -// #define CONFIG_KEY_REPEAT // XXX document this +// #define CONFIG_LEGACY_SCNKEY // XXX document this +// #define CONFIG_KEY_REPEAT_DEFAULT // XXX document this +// #define CONFIG_KEY_REPEAT_ALWAYS // XXX document this +#define CONFIG_KEY_FAST_SCAN // XXX document this #define CONFIG_JOY1_CURSOR // XXX document this #define CONFIG_JOY2_CURSOR // XXX document this diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 0bc2c86c..8f874fb1 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -50,8 +50,10 @@ // Keyboard settings -#define CONFIG_SCNKEY_TWW_CTR // XXX document this -// #define CONFIG_KEY_REPEAT // XXX document this +#define CONFIG_LEGACY_SCNKEY // XXX document this +// #define CONFIG_KEY_REPEAT_DEFAULT // XXX document this +// #define CONFIG_KEY_REPEAT_ALWAYS // XXX document this +#define CONFIG_KEY_FAST_SCAN // XXX document this #define CONFIG_JOY1_CURSOR // XXX document this #define CONFIG_JOY2_CURSOR // XXX document this diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index a993bd6e..9b37ebab 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -48,8 +48,10 @@ // Keyboard settings -// #define CONFIG_SCNKEY_TWW_CTR // XXX document this -// #define CONFIG_KEY_REPEAT // XXX document this +// #define CONFIG_LEGACY_SCNKEY // XXX document this +// #define CONFIG_KEY_REPEAT_DEFAULT // XXX document this +// #define CONFIG_KEY_REPEAT_ALWAYS // XXX document this +#define CONFIG_KEY_FAST_SCAN // XXX document this #define CONFIG_JOY1_CURSOR // XXX document this #define CONFIG_JOY2_CURSOR // XXX document this diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index bc83aa76..905446dc 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -104,7 +104,7 @@ .label CNTDN = $A5 // -- NOT IMPLEMENTED -- .label BUFPNT = $A6 // -- NOT IMPLEMENTED -- .label INBIT = $A7 // -- NOT IMPLEMENTED -- -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY .label BITCI = $A8 // -- NOT IMPLEMENTED -- .label RINONE = $A9 // -- NOT IMPLEMENTED -- .label RIDDATA = $AA // -- NOT IMPLEMENTED -- @@ -114,11 +114,11 @@ .label EAL = $AE // $AE-$AF -- NOT IMPLEMENTED -- [!] used also by screen editor, for temporary color storage when scrolling .label CMP0 = $B0 // $B0-$B1 temporary tape storage, [!] here used for BRK instruction address .label TAPE1 = $B2 // $B2-$B3 tape buffer pointer -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY .label BITTS = $B4 // -- NOT IMPLEMENTED -- #endif .label NXTBIT = $B5 // -- NOT IMPLEMENTED -- -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY .label RODATA = $B6 // -- NOT IMPLEMENTED -- #endif @@ -172,7 +172,7 @@ .label BUF = $200 // $200-$250, BASIC line editor input buffer (81 bytes) // $250-$258 is the 81st - 88th characters in BASIC input, a carry over from VIC-20 - // and not used on C64 - they are used if CONFIG_SCNKEY_TWW_CTR is enabled. + // and not used on C64 - they are used if CONFIG_LEGACY_SCNKEY is enabled. // [!] XXX document $251-$258 usage .label LAT = $259 // $259-$262, logical file numbers (table, 10 bytes) @@ -194,7 +194,7 @@ .label KEYLOG = $28F // $28F-$290 routine to setup keyboard decoding .label MODE = $291 // flag, is case switch allowed .label AUTODN = $292 // -- NOT IMPLEMENTED -- screen scroll disable -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY .label M51CRT = $293 // -- NOT IMPLEMENTED -- mock 6551 .label M51CDR = $294 // -- NOT IMPLEMENTED -- mock 6551 .label M51AJB = $295 // $295-$296 -- NOT IMPLEMENTED -- mock 6551 diff --git a/c64/kernal/cint_real.s b/c64/kernal/cint_real.s index 3a096a63..54b03723 100644 --- a/c64/kernal/cint_real.s +++ b/c64/kernal/cint_real.s @@ -75,7 +75,7 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? // Enable cursor repeat - XXX make it configurable -#if CONFIG_KEY_REPEAT +#if CONFIG_KEY_REPEAT_DEFAULT && !CONFIG_KEY_REPEAT_ALWAYS lda #$80 sta RPTFLG @@ -84,7 +84,7 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? // Set keyboard decode vector (Compute's Mapping the 64 p215) -#if CONFIG_SCNKEY_TWW_CTR +#if CONFIG_LEGACY_SCNKEY // Set initial variables for our improved keyboard scan routine lda #$FF diff --git a/c64/kernal/keyboard/kb_matrix_alwaysrepeat.s b/c64/kernal/keyboard/kb_matrix_alwaysrepeat.s index 3a6caa78..ffb80e02 100644 --- a/c64/kernal/keyboard/kb_matrix_alwaysrepeat.s +++ b/c64/kernal/keyboard/kb_matrix_alwaysrepeat.s @@ -7,7 +7,7 @@ // -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY && !CONFIG_KEY_REPEAT_ALWAYS kb_matrix_alwaysrepeat: @@ -20,4 +20,4 @@ kb_matrix_alwaysrepeat: __kb_matrix_alwaysrepeat_end: -#endif // no CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_LEGACY_SCNKEY and no CONFIG_KEY_REPEAT_ALWAYS diff --git a/c64/kernal/keyboard/kb_matrix_bucky.s b/c64/kernal/keyboard/kb_matrix_bucky.s index 6ca59589..32150a3a 100644 --- a/c64/kernal/keyboard/kb_matrix_bucky.s +++ b/c64/kernal/keyboard/kb_matrix_bucky.s @@ -7,7 +7,7 @@ // -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY kb_matrix_bucky_confmask: // values to be written to CIA1_PRA @@ -33,4 +33,4 @@ kb_matrix_bucky_shflag: // mask to be ORed to SHFLAG to mark key status .byte KEY_FLAG_CTRL -#endif // no CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/kb_matrix_bucky_filter.s b/c64/kernal/keyboard/kb_matrix_bucky_filter.s index 21ebe02f..0e2a9b36 100644 --- a/c64/kernal/keyboard/kb_matrix_bucky_filter.s +++ b/c64/kernal/keyboard/kb_matrix_bucky_filter.s @@ -7,7 +7,7 @@ // -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY kb_matrix_bucky_filter: @@ -24,4 +24,4 @@ kb_matrix_bucky_filter: .byte %00100100 // VENDOR + CONTROL -#endif // no CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/kb_matrix_joy.s b/c64/kernal/keyboard/kb_matrix_joy.s index 50c9d501..8f9deaab 100644 --- a/c64/kernal/keyboard/kb_matrix_joy.s +++ b/c64/kernal/keyboard/kb_matrix_joy.s @@ -4,7 +4,7 @@ // -#if !CONFIG_SCNKEY_TWW_CTR && (CONFIG_JOY1_CURSOR || CONFIG_JOY2_CURSOR) +#if !CONFIG_LEGACY_SCNKEY && (CONFIG_JOY1_CURSOR || CONFIG_JOY2_CURSOR) kb_matrix_joy_status: diff --git a/c64/kernal/keyboard/kb_matrix_lookup.s b/c64/kernal/keyboard/kb_matrix_lookup.s index 93477737..9e1b8f34 100644 --- a/c64/kernal/keyboard/kb_matrix_lookup.s +++ b/c64/kernal/keyboard/kb_matrix_lookup.s @@ -7,7 +7,7 @@ // -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY kb_matrix_lookup: diff --git a/c64/kernal/keyboard/kb_matrix_lookup_tww_ctr.s b/c64/kernal/keyboard/kb_matrix_lookup_legacy.s similarity index 88% rename from c64/kernal/keyboard/kb_matrix_lookup_tww_ctr.s rename to c64/kernal/keyboard/kb_matrix_lookup_legacy.s index cc7d6e09..62f2a932 100644 --- a/c64/kernal/keyboard/kb_matrix_lookup_tww_ctr.s +++ b/c64/kernal/keyboard/kb_matrix_lookup_legacy.s @@ -12,9 +12,9 @@ // This lookup table is used by TWW/CTR keyboard routine only! -#if CONFIG_SCNKEY_TWW_CTR +#if CONFIG_LEGACY_SCNKEY -kb_matrix_lookup_tww_ctr: +kb_matrix_lookup: .byte $00 // Normal .byte $40 // Shifted @@ -25,4 +25,4 @@ kb_matrix_lookup_tww_ctr: .byte $80 // Vendor + CTRL .byte $80 // Vendor + CTRL + SHIFT -#endif // CONFIG_SCNKEY_TWW_CTR +#endif // CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/kb_matrix_row_keys.s b/c64/kernal/keyboard/kb_matrix_row_keys.s index f4284108..cf09dfc7 100644 --- a/c64/kernal/keyboard/kb_matrix_row_keys.s +++ b/c64/kernal/keyboard/kb_matrix_row_keys.s @@ -7,7 +7,7 @@ // -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY kb_matrix_row_keys: @@ -25,4 +25,4 @@ kb_matrix_row_keys: .byte %01111111 -#endif // no CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/kb_matrix_row_offsets.s b/c64/kernal/keyboard/kb_matrix_row_offsets.s index 8710ab09..efc2ceaf 100644 --- a/c64/kernal/keyboard/kb_matrix_row_offsets.s +++ b/c64/kernal/keyboard/kb_matrix_row_offsets.s @@ -4,7 +4,7 @@ // -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY kb_matrix_row_offsets: @@ -20,4 +20,4 @@ kb_matrix_row_offsets: .byte 6*8 .byte 7*8 -#endif // no CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 5199427b..c4454dd2 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -25,7 +25,7 @@ // XXX add Commodore 65 keyboard support -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY // Routine takes some ideas from TWW/CTR proposal, see here: // - http://codebase64.org/doku.php?id=base:scanning_the_keyboard_the_correct_and_non_kernal_way @@ -44,7 +44,7 @@ SCNKEY: // Check for any activity -#if !CONFIG_JOY2_CURSOR +#if !CONFIG_JOY2_CURSOR && CONFIG_KEY_FAST_SCAN ldx #$00 stx CIA1_PRA // connect all the rows @@ -93,13 +93,17 @@ scnkey_bucky_loop: bne scnkey_joystick_filtered +#if CONFIG_KEY_FAST_SCAN + inx // puts $00 stx CIA1_PRA // connect all the rows dex // puts $FF cpx CIA1_PRB beq scnkey_no_keys -#endif +#endif // CONFIG_KEY_FAST_SCAN + +#endif // CONFIG_JOY2_CURSOR // Check for control port 1 activity (can interfere with keyboard) @@ -262,6 +266,8 @@ scnkey_done: scnkey_try_repeat: +#if !CONFIG_KEY_REPEAT_ALWAYS + // Check whether we should repeat keys - first the flag, afterwards hardcoded list lda RPTFLG @@ -278,6 +284,8 @@ scnkey_try_repeat: scnkey_handle_repeat: +#endif // no CONFIG_KEY_REPEAT_ALWAYS + // Countdown before first repeat lda DELAY @@ -309,4 +317,4 @@ via_keylog: jmp (KEYLOG) -#endif // no CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/scnkey_tww_ctr.s b/c64/kernal/keyboard/scnkey_legacy.s similarity index 99% rename from c64/kernal/keyboard/scnkey_tww_ctr.s rename to c64/kernal/keyboard/scnkey_legacy.s index bf2d55f6..6da6c43a 100644 --- a/c64/kernal/keyboard/scnkey_tww_ctr.s +++ b/c64/kernal/keyboard/scnkey_legacy.s @@ -9,7 +9,7 @@ // -#if CONFIG_SCNKEY_TWW_CTR +#if CONFIG_LEGACY_SCNKEY // Scan the keyboard.. @@ -116,7 +116,7 @@ accept_key: tax pla and #$3f - ora kb_matrix_lookup_tww_ctr,x + ora kb_matrix_lookup,x tax lda kb_matrix,x // But don't insert $00 characters @@ -521,4 +521,4 @@ KeyRepeatWait: jmp ConsiderNextKey -#endif // CONFIG_SCNKEY_TWW_CTR +#endif // CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/scnkey_set_keytab.s b/c64/kernal/keyboard/scnkey_set_keytab.s index 4f9781aa..6c9a03b1 100644 --- a/c64/kernal/keyboard/scnkey_set_keytab.s +++ b/c64/kernal/keyboard/scnkey_set_keytab.s @@ -9,7 +9,7 @@ scnkey_set_keytab: -#if CONFIG_SCNKEY_TWW_CTR // routine not compatible with legacy SCNKEY +#if CONFIG_LEGACY_SCNKEY // routine not compatible with legacy SCNKEY rts @@ -54,7 +54,7 @@ scnkey_valid_offset: // FALLTROUGH -#endif // no CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_LEGACY_SCNKEY scnkey_toggle_if_needed: // entry for SCNKEY (TWW/CTR version) From 076a839f1a0c72168b3dfdf8dd4f4cff8c232df7 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 15 Oct 2019 17:26:05 +0200 Subject: [PATCH 51/85] fixed the famous 'SYS 64738', some documentation fixes --- Makefile | 10 +++++----- STATUS.md | 4 ++-- c64/aliases/,aliases_petscii_codes.s | 11 ++++++----- .../{hw_entry_reset.s => fce2.hw_entry_reset.s} | 0 c64/kernal/interrupts/fce2.interop | 5 +++++ c64/kernal/keyboard/scnkey_legacy.s | 5 +++++ 6 files changed, 23 insertions(+), 12 deletions(-) rename c64/kernal/interrupts/{hw_entry_reset.s => fce2.hw_entry_reset.s} (100%) create mode 100644 c64/kernal/interrupts/fce2.interop diff --git a/Makefile b/Makefile index c66d105a..59ec4e96 100644 --- a/Makefile +++ b/Makefile @@ -76,19 +76,19 @@ updatebin: $(STD_TARGET_LIST) # Rules - tools -$(TOOL_PNGPREPARE): src/pngprepare.c Makefile +$(TOOL_PNGPREPARE): src/pngprepare.c @mkdir -p build/tools $(CC) -O2 -Wall -I/usr/local/include -L/usr/local/lib -o $@ $< -lpng -$(TOOL_COMPRESS_TEXT): src/compress_text.c Makefile +$(TOOL_COMPRESS_TEXT): src/compress_text.c @mkdir -p build/tools $(CC) -O2 -Wall -I/usr/local/include -L/usr/local/lib -o $@ $< -lm -build/tools/%: src/%.c Makefile +build/tools/%: src/%.c @mkdir -p build/tools $(CC) -O2 -Wall -o $@ $< -build/tools/%: src/%.cc Makefile +build/tools/%: src/%.cc @mkdir -p build/tools $(CXX) -O2 -Wall -o $@ $< @@ -189,7 +189,7 @@ build/symbols_hybrid.vs: build/target_generic/KERNAL_combined.vs # Rules - platform 'Mega 65' specific -build/newc65.rom: build/kernal_mega65.rom build/basic_mega65.rom build/chargen.rom Makefile +build/newc65.rom: build/kernal_mega65.rom build/basic_mega65.rom build/chargen.rom dd if=/dev/zero bs=4096 count=10 of=build/newc65.rom cat build/basic_mega65.rom build/chargen.rom build/chargen.rom build/kernal_mega65.rom >> build/newc65.rom dd if=/dev/zero bs=65536 count=1 of=build/padding diff --git a/STATUS.md b/STATUS.md index 7b320fe7..347d799b 100644 --- a/STATUS.md +++ b/STATUS.md @@ -109,7 +109,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FF96` | | `TKSA` | DONE | | | `$FF99` | | `MEMTOP` | DONE | | | `$FF9C` | | `MEMBOT` | DONE | | -| `$FF9F` | | `SCNKEY` | PARTIAL | future complete version has compatibility problems | +| `$FF9F` | | `SCNKEY` | DONE | | | `$FFA2` | | `SETTMO` | DONE | | | `$FFA5` | | `ACPTR` | DONE | | | `$FFA8` | | `CIOUT` | DONE | | @@ -141,7 +141,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FFF0` | `$E50A` | `PLOT` | DONE | | | `$FFF3` | | `IOBASE` | DONE | | | `($FFFA)` | | NMI vec | PARTIAL | | -| `($FFFC)` | | RESET vec | PARTIAL | | +| `($FFFC)` | `$FCE2` | RESET vec | PARTIAL | | | `($FFFE)` | | IRQ/BRK vec | PARTIAL | |
diff --git a/c64/aliases/,aliases_petscii_codes.s b/c64/aliases/,aliases_petscii_codes.s index 0c1ac078..077944b4 100644 --- a/c64/aliases/,aliases_petscii_codes.s +++ b/c64/aliases/,aliases_petscii_codes.s @@ -15,8 +15,8 @@ .const KEY_FLAG_SHIFT = %00000001 .const KEY_FLAG_VENDOR = %00000010 .const KEY_FLAG_CTRL = %00000100 -.const KEY_FLAG_ALT = %00001000 // C65 / C128 -.const KEY_FLAG_NO_SCRL = %00100000 // C65 / C128, Open ROMs unofficial +.const KEY_FLAG_ALT = %00001000 // C65 / C128 XXX implement this +.const KEY_FLAG_NO_SCRL = %00100000 // C65 / C128, Open ROMs unofficial XXX implement this // Note - the following PETSCII codes are currently unassigned, can be used for further extensions: @@ -27,18 +27,17 @@ .const KEY_NA = $00 // to indicate that no key is presed -// PETSCII codes for our extended screen editor +// PETSCII codes for our extended screen editor XXX implement these .const KEY_BOTTOM = $02 // CTRL+B - DolphinDOS compatible .const KEY_TAB_FW = $8F // CTRL+>, TAB - Open ROMs unofficial .const KEY_TAB_BW = $80 // CTRL+<, SHIFT+TAB - Open ROMs unofficial -// PETSCII codes for certain C128 and C65 functionalities +// PETSCII codes for certain C128 and C65 functionalities XXX implement these .const KEY_BELL = $07 // C65 / C128, no key .const KEY_ESC = $1B // C65 / C128 -.const KEY_HELP = $10 // C65 / C128, Open ROMs unofficial // PETSCII codes for programmable keys @@ -61,6 +60,8 @@ .const KEY_F13 = $19 // C65, Open ROMs unofficial .const KEY_F14 = $1A // C65, Open ROMs unofficial +.const KEY_HELP = $10 // C65 / C128, Open ROMs unofficial + // PETSCII codes for cursor keys diff --git a/c64/kernal/interrupts/hw_entry_reset.s b/c64/kernal/interrupts/fce2.hw_entry_reset.s similarity index 100% rename from c64/kernal/interrupts/hw_entry_reset.s rename to c64/kernal/interrupts/fce2.hw_entry_reset.s diff --git a/c64/kernal/interrupts/fce2.interop b/c64/kernal/interrupts/fce2.interop new file mode 100644 index 00000000..f9c9ce22 --- /dev/null +++ b/c64/kernal/interrupts/fce2.interop @@ -0,0 +1,5 @@ +System reset routine has to be placed under it's original location due to 'SYS 64738' being extremaly popular to reset the C64, +to the point it went into popular culture. + +https://twitter.com/hashtag/SYS64738?src=hash +https://www.computerhope.com/jargon/s/sys64738.htm diff --git a/c64/kernal/keyboard/scnkey_legacy.s b/c64/kernal/keyboard/scnkey_legacy.s index 6da6c43a..fe25392b 100644 --- a/c64/kernal/keyboard/scnkey_legacy.s +++ b/c64/kernal/keyboard/scnkey_legacy.s @@ -9,6 +9,11 @@ // +// NOTE: The code here is described as legacy, because the algorithm (although working very well) +// requires much more RAM than the original Kernal routine uses; without any form of extended +// RAM available to Open ROMs it will always be a serious compatibility risk. + + #if CONFIG_LEGACY_SCNKEY From 8829ec80902169c9d0f38ab58f37c34c6aa6fc81 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 15 Oct 2019 17:55:56 +0200 Subject: [PATCH 52/85] more Kernal reorganization --- Makefile | 2 ++ c64/kernal/{ => init}/cartridge_check.s | 0 c64/kernal/{ => init}/cint_real.s | 0 c64/kernal/{ => init}/e5a0.setup_vicii.s | 0 c64/kernal/{ => init}/fd50.interop | 0 c64/kernal/{ => init}/fd50.ramtas.jmp.s | 0 c64/kernal/{ => init}/fda3.ioinit.s | 0 c64/kernal/{ => init}/ff5b.cint.jmp.s | 0 c64/kernal/{ => init}/ff5b.interop | 0 c64/kernal/{ => iostack}/clall_real.s | 0 c64/kernal/{ => iostack}/f32f.clall.jmp.s | 0 c64/kernal/{ => iostack}/f32f.interop | 0 c64/kernal/{ => iostack}/lvs_helpers.s | 0 c64/kernal/{ => iostack}/readst.s | 0 c64/kernal/{ => iostack}/setfls.s | 0 c64/kernal/{ => iostack}/setmsg.s | 0 c64/kernal/{ => iostack}/setnam.s | 0 c64/kernal/{ => iostack}/settmo.s | 0 c64/kernal/{ => screen}/e50a.interop | 0 c64/kernal/{ => screen}/e50a.plot.s | 0 20 files changed, 2 insertions(+) rename c64/kernal/{ => init}/cartridge_check.s (100%) rename c64/kernal/{ => init}/cint_real.s (100%) rename c64/kernal/{ => init}/e5a0.setup_vicii.s (100%) rename c64/kernal/{ => init}/fd50.interop (100%) rename c64/kernal/{ => init}/fd50.ramtas.jmp.s (100%) rename c64/kernal/{ => init}/fda3.ioinit.s (100%) rename c64/kernal/{ => init}/ff5b.cint.jmp.s (100%) rename c64/kernal/{ => init}/ff5b.interop (100%) rename c64/kernal/{ => iostack}/clall_real.s (100%) rename c64/kernal/{ => iostack}/f32f.clall.jmp.s (100%) rename c64/kernal/{ => iostack}/f32f.interop (100%) rename c64/kernal/{ => iostack}/lvs_helpers.s (100%) rename c64/kernal/{ => iostack}/readst.s (100%) rename c64/kernal/{ => iostack}/setfls.s (100%) rename c64/kernal/{ => iostack}/setmsg.s (100%) rename c64/kernal/{ => iostack}/setnam.s (100%) rename c64/kernal/{ => iostack}/settmo.s (100%) rename c64/kernal/{ => screen}/e50a.interop (100%) rename c64/kernal/{ => screen}/e50a.plot.s (100%) diff --git a/Makefile b/Makefile index 59ec4e96..6e67c942 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,9 @@ SRCDIR_KERNAL = $(SRCDIR_COMMON) \ c64/kernal/assets \ c64/kernal/jumptable \ c64/kernal/iec \ + c64/kernal/init \ c64/kernal/interrupts \ + c64/kernal/iostack \ c64/kernal/keyboard \ c64/kernal/print \ c64/kernal/screen diff --git a/c64/kernal/cartridge_check.s b/c64/kernal/init/cartridge_check.s similarity index 100% rename from c64/kernal/cartridge_check.s rename to c64/kernal/init/cartridge_check.s diff --git a/c64/kernal/cint_real.s b/c64/kernal/init/cint_real.s similarity index 100% rename from c64/kernal/cint_real.s rename to c64/kernal/init/cint_real.s diff --git a/c64/kernal/e5a0.setup_vicii.s b/c64/kernal/init/e5a0.setup_vicii.s similarity index 100% rename from c64/kernal/e5a0.setup_vicii.s rename to c64/kernal/init/e5a0.setup_vicii.s diff --git a/c64/kernal/fd50.interop b/c64/kernal/init/fd50.interop similarity index 100% rename from c64/kernal/fd50.interop rename to c64/kernal/init/fd50.interop diff --git a/c64/kernal/fd50.ramtas.jmp.s b/c64/kernal/init/fd50.ramtas.jmp.s similarity index 100% rename from c64/kernal/fd50.ramtas.jmp.s rename to c64/kernal/init/fd50.ramtas.jmp.s diff --git a/c64/kernal/fda3.ioinit.s b/c64/kernal/init/fda3.ioinit.s similarity index 100% rename from c64/kernal/fda3.ioinit.s rename to c64/kernal/init/fda3.ioinit.s diff --git a/c64/kernal/ff5b.cint.jmp.s b/c64/kernal/init/ff5b.cint.jmp.s similarity index 100% rename from c64/kernal/ff5b.cint.jmp.s rename to c64/kernal/init/ff5b.cint.jmp.s diff --git a/c64/kernal/ff5b.interop b/c64/kernal/init/ff5b.interop similarity index 100% rename from c64/kernal/ff5b.interop rename to c64/kernal/init/ff5b.interop diff --git a/c64/kernal/clall_real.s b/c64/kernal/iostack/clall_real.s similarity index 100% rename from c64/kernal/clall_real.s rename to c64/kernal/iostack/clall_real.s diff --git a/c64/kernal/f32f.clall.jmp.s b/c64/kernal/iostack/f32f.clall.jmp.s similarity index 100% rename from c64/kernal/f32f.clall.jmp.s rename to c64/kernal/iostack/f32f.clall.jmp.s diff --git a/c64/kernal/f32f.interop b/c64/kernal/iostack/f32f.interop similarity index 100% rename from c64/kernal/f32f.interop rename to c64/kernal/iostack/f32f.interop diff --git a/c64/kernal/lvs_helpers.s b/c64/kernal/iostack/lvs_helpers.s similarity index 100% rename from c64/kernal/lvs_helpers.s rename to c64/kernal/iostack/lvs_helpers.s diff --git a/c64/kernal/readst.s b/c64/kernal/iostack/readst.s similarity index 100% rename from c64/kernal/readst.s rename to c64/kernal/iostack/readst.s diff --git a/c64/kernal/setfls.s b/c64/kernal/iostack/setfls.s similarity index 100% rename from c64/kernal/setfls.s rename to c64/kernal/iostack/setfls.s diff --git a/c64/kernal/setmsg.s b/c64/kernal/iostack/setmsg.s similarity index 100% rename from c64/kernal/setmsg.s rename to c64/kernal/iostack/setmsg.s diff --git a/c64/kernal/setnam.s b/c64/kernal/iostack/setnam.s similarity index 100% rename from c64/kernal/setnam.s rename to c64/kernal/iostack/setnam.s diff --git a/c64/kernal/settmo.s b/c64/kernal/iostack/settmo.s similarity index 100% rename from c64/kernal/settmo.s rename to c64/kernal/iostack/settmo.s diff --git a/c64/kernal/e50a.interop b/c64/kernal/screen/e50a.interop similarity index 100% rename from c64/kernal/e50a.interop rename to c64/kernal/screen/e50a.interop diff --git a/c64/kernal/e50a.plot.s b/c64/kernal/screen/e50a.plot.s similarity index 100% rename from c64/kernal/e50a.plot.s rename to c64/kernal/screen/e50a.plot.s From ed83a767258a4aba607bd9141fb20e603d7b1204 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 15 Oct 2019 19:33:55 +0200 Subject: [PATCH 53/85] started work on C128 keyboard support --- c64/,,config_generic.s | 3 ++- c64/,,config_mega65.s | 1 + c64/,,config_ultimate64.s | 1 + c64/kernal/keyboard/kb_matrix_bucky.s | 31 +++++++++++++++++++++++ c64/kernal/keyboard/keyboard_disconnect.s | 3 +++ c64/kernal/keyboard/scnkey.s | 31 +++++++++++++++-------- 6 files changed, 58 insertions(+), 12 deletions(-) diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index bfe8029d..2659f198 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -6,7 +6,7 @@ // // Idea: -// - sane defaults for the original Commodore 64 machine +// - sane defaults for the original Commodore 64/128 machines // - do not enable features which are a significant compatibility risk @@ -49,6 +49,7 @@ // #define CONFIG_LEGACY_SCNKEY // XXX document this +#define CONFIG_KEYBOARD_C128 // XXX document this // #define CONFIG_KEY_REPEAT_DEFAULT // XXX document this // #define CONFIG_KEY_REPEAT_ALWAYS // XXX document this #define CONFIG_KEY_FAST_SCAN // XXX document this diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 8f874fb1..3fce219e 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -51,6 +51,7 @@ #define CONFIG_LEGACY_SCNKEY // XXX document this +// #define CONFIG_KEYBOARD_C128 // XXX document this // #define CONFIG_KEY_REPEAT_DEFAULT // XXX document this // #define CONFIG_KEY_REPEAT_ALWAYS // XXX document this #define CONFIG_KEY_FAST_SCAN // XXX document this diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index 9b37ebab..f1f55f9d 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -49,6 +49,7 @@ // #define CONFIG_LEGACY_SCNKEY // XXX document this +// #define CONFIG_KEYBOARD_C128 // XXX document this // #define CONFIG_KEY_REPEAT_DEFAULT // XXX document this // #define CONFIG_KEY_REPEAT_ALWAYS // XXX document this #define CONFIG_KEY_FAST_SCAN // XXX document this diff --git a/c64/kernal/keyboard/kb_matrix_bucky.s b/c64/kernal/keyboard/kb_matrix_bucky.s index 32150a3a..8b658609 100644 --- a/c64/kernal/keyboard/kb_matrix_bucky.s +++ b/c64/kernal/keyboard/kb_matrix_bucky.s @@ -16,6 +16,28 @@ kb_matrix_bucky_confmask: // values to be written to CIA1_PRA .byte %10111111 // SHIFT (right) .byte %01111111 // VENDOR .byte %01111111 // CTRL +#if CONFIG_KEYBOARD_C128 + .byte %11111111 // C128 extra keys + .byte %11111111 +#endif + + +__kb_matrix_bucky_confmask_end: + + +#if CONFIG_KEYBOARD_C128 + +kb_matrix_bucky_confmask_c128: // values to be written to VIC_XSCAN + + .byte %11111111 + .byte %11111111 + .byte %11111111 + .byte %11111111 + + .byte %11111011 // ALT + .byte %11111011 // NO_SCRL + +#endif kb_matrix_bucky_testmask: // for AND with CIA1_PRB value @@ -24,13 +46,22 @@ kb_matrix_bucky_testmask: // for AND with CIA1_PRB value .byte %00010000 // SHIFT (right) .byte %00100000 // VENDOR .byte %00000100 // CTRL +#if CONFIG_KEYBOARD_C128 + .byte %10000000 // ALT + .byte %00000001 // NO_SCRL +#endif kb_matrix_bucky_shflag: // mask to be ORed to SHFLAG to mark key status + .byte KEY_FLAG_SHIFT .byte KEY_FLAG_SHIFT .byte KEY_FLAG_VENDOR .byte KEY_FLAG_CTRL +#if CONFIG_KEYBOARD_C128 + .byte KEY_FLAG_ALT + .byte KEY_FLAG_NO_SCRL +#endif #endif // no CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/keyboard_disconnect.s b/c64/kernal/keyboard/keyboard_disconnect.s index 12708fb6..37f4e973 100644 --- a/c64/kernal/keyboard/keyboard_disconnect.s +++ b/c64/kernal/keyboard/keyboard_disconnect.s @@ -8,5 +8,8 @@ keyboard_disconnect: ldx #$FF stx CIA1_PRA // disconnect all the rows +#if CONFIG_KEYBOARD_C128 + stx VIC_XSCAN +#endif rts diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index c4454dd2..60a72767 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -21,7 +21,7 @@ // - RPTFLG - whether key repeat is allowed -// XXX add Commodore 128 keyboard support +// XXX finish Commodore 128 keyboard support // XXX add Commodore 65 keyboard support @@ -40,14 +40,15 @@ SCNKEY: lda #$00 sta SHFLAG - // XXX retrieve ALT and NO_SCRL status for C128/C65 keyboards - // Check for any activity #if !CONFIG_JOY2_CURSOR && CONFIG_KEY_FAST_SCAN ldx #$00 stx CIA1_PRA // connect all the rows +#if CONFIG_KEYBOARD_C128 + stx VIC_XSCAN +#endif dex // puts $FF cpx CIA1_PRB beq scnkey_no_keys @@ -56,10 +57,15 @@ SCNKEY: // Retrieve SHIFT / VENDOR / CTRL status // Use .X to detect 2 or more keys pressed (should be $FF now) - ldy #$03 + + ldy #(__kb_matrix_bucky_confmask_end - kb_matrix_bucky_confmask - 1) scnkey_bucky_loop: lda kb_matrix_bucky_confmask, y sta CIA1_PRA +#if CONFIG_KEYBOARD_C128 + lda kb_matrix_bucky_confmask_c128, y + sta VIC_XSCAN +#endif lda kb_matrix_bucky_testmask, y and CIA1_PRB bne !+ // not pressed @@ -76,8 +82,6 @@ scnkey_bucky_loop: #if CONFIG_JOY2_CURSOR - // XXX why this does not work ??? - // Check for control port 2 activity ldx #$00 @@ -97,6 +101,9 @@ scnkey_bucky_loop: inx // puts $00 stx CIA1_PRA // connect all the rows +#if CONFIG_KEYBOARD_C128 + stx VIC_XSCAN +#endif dex // puts $FF cpx CIA1_PRB beq scnkey_no_keys @@ -169,9 +176,13 @@ scnkey_no_keys: // Mark no key press - lda #$40 // XXX adapt value for C128 and C65 keyboards - sta LSTX +#if CONFIG_KEYBOARD_C128 + lda #$FF // non-standard, but for C128 keyboard $40 is a valid position +#else + lda #$40 +#endif + sta LSTX rts #if CONFIG_JOY1_CURSOR @@ -231,8 +242,6 @@ scnkey_got_key: // .Y should now contain the key offset in matrix pointed by KEY // // Besides - since I am the one who writes the code, I will make the values exactly how I like them :D - // XXX consider making it configurable, also make configurable RPTFLG - lda #$16 sta DELAY @@ -244,7 +253,7 @@ scnkey_output_key: lda NDX cmp XMAX - bcs scnkey_early_repeat // no space in buffer XXX set timer to trigger repeat the next time + bcs scnkey_early_repeat // no space in buffer // Reinitialize secondary counter From 703e49949498fec1b5129c3de5cfeb589790fc75 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 16 Oct 2019 16:40:15 +0200 Subject: [PATCH 54/85] more work on C128 keyboard --- c64/kernal/keyboard/kb_matrix.s | 18 ------ c64/kernal/keyboard/kb_matrix_128.s | 30 +++++++++ c64/kernal/keyboard/kb_matrix_bucky.s | 4 +- c64/kernal/keyboard/kb_matrix_row_keys.s | 1 + c64/kernal/keyboard/scnkey.s | 15 +++-- c64/kernal/keyboard/scnkey_128.s | 77 ++++++++++++++++++++++++ 6 files changed, 120 insertions(+), 25 deletions(-) create mode 100644 c64/kernal/keyboard/kb_matrix_128.s create mode 100644 c64/kernal/keyboard/scnkey_128.s diff --git a/c64/kernal/keyboard/kb_matrix.s b/c64/kernal/keyboard/kb_matrix.s index e0e84114..e681f9f3 100644 --- a/c64/kernal/keyboard/kb_matrix.s +++ b/c64/kernal/keyboard/kb_matrix.s @@ -54,21 +54,3 @@ __kb_matrix_ctrl: .byte $00,$10,$0C,$00,$00,$1B,$00,$00 .byte $1C,$00,$1D,$00,$00,$1F,$1E,$00 .byte $90,$06,$00,$05,$00,$00,$11,$00 - - - -// XXX extended matrices for C128/C65 - -// kb_matrix_ext128: $D02F - - // .byte (HELP),$38,$35,(TAB),$32,$34,$37,$31 // $FE - // .byte $1B, $2B, $2D,$0A,$0D,$36,$39,$33 // $FD - // .byte $00,$30,$2E,$91,$11,$9D,$1D,(NO_SCRL) // $FB - -// kb_matrix_ext65: - - // Last column - normal - // .byte (NO_SCRL),(TAB),$00,(HELP),(F9),(F11),(F13),$1B - - // Last column - shifted - // .byte (NO_SCRL),(TAB),$00,(HELP),(F10),(F12),(F14),$1B diff --git a/c64/kernal/keyboard/kb_matrix_128.s b/c64/kernal/keyboard/kb_matrix_128.s new file mode 100644 index 00000000..8afbef1a --- /dev/null +++ b/c64/kernal/keyboard/kb_matrix_128.s @@ -0,0 +1,30 @@ + +// +// Extended keyboard matrix for Commodore 128 keyboards, based on +// +// - [CM128] Compute's Mapping the Commodore 128 - page 290 +// - http://commodore128.mirkosoft.sk/keyboard.html +// + + +#if CONFIG_KEYBOARD_C128 + + +kb_matrix_128: + + // XXX fill-in the matrix properly!!! + .byte $41,$42,$43,$44,$45,$46,$47,$48 + .byte $51,$52,$53,$54,$55,$56,$57,$58 + .byte $61,$62,$63,$64,$65,$66,$67,$68 + +kb_matrix_128_bucky_filter: + + // values for OR with CIA1_PRB content to filter out bucky keys + + .byte %00000000 + .byte %00000000 + .byte %00000000 // XXX ALT, NO_SCRL - probably here + + + +#endif // CONFIG_KEYBOARD_C128 diff --git a/c64/kernal/keyboard/kb_matrix_bucky.s b/c64/kernal/keyboard/kb_matrix_bucky.s index 8b658609..4b685e0d 100644 --- a/c64/kernal/keyboard/kb_matrix_bucky.s +++ b/c64/kernal/keyboard/kb_matrix_bucky.s @@ -3,10 +3,10 @@ // Matrix for retrieving bucky key status on the C64 keyboard // // Values based on: -// - [CM64] Compute's Mapping the Commodore 64 - pags 58 (SHFLAG), 173 (matrix) +// - [CM64] Compute's Mapping the Commodore 64 - pages 58 (SHFLAG), 173 (matrix) +// - [CM128] Compute's Mapping the Commodore 128 - pages 212 (SHFLAG), 290 (matrix) // - #if !CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/kb_matrix_row_keys.s b/c64/kernal/keyboard/kb_matrix_row_keys.s index cf09dfc7..bb4b9afb 100644 --- a/c64/kernal/keyboard/kb_matrix_row_keys.s +++ b/c64/kernal/keyboard/kb_matrix_row_keys.s @@ -13,6 +13,7 @@ kb_matrix_row_keys: // - values for CIA1_PRA to connect only the given row + // - first 3 values also meant for VIC_XSCAN for C128 keyboards // - also used to scan a single row .byte %11111110 diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 60a72767..91698ef5 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -21,9 +21,6 @@ // - RPTFLG - whether key repeat is allowed -// XXX finish Commodore 128 keyboard support -// XXX add Commodore 65 keyboard support - #if !CONFIG_LEGACY_SCNKEY @@ -130,8 +127,11 @@ scnkey_bucky_loop: // Scan the keyboard matrix - ldy #$FF // offset in key matrix table, $FF for not found yet - ldx #$07 // XXX adapt for C128 and C65 keyboards + ldy #$FF // offset in key matrix table, $FF for not found yet +#if CONFIG_KEYBOARD_C128 + jsr scnkey_128 +#endif + ldx #$07 scnkey_matrix_loop: lda kb_matrix_row_keys, x sta CIA1_PRA @@ -261,6 +261,11 @@ scnkey_output_key: sta KOUNT // Output PETSCII code to the keyboard buffer +#if CONFIG_KEYBOARD_C128 + + // XXX implement C128 key matrix support here + +#endif lda (KEYTAB), y beq scnkey_no_keys // branch if we have no PETSCII code for this key ldy NDX diff --git a/c64/kernal/keyboard/scnkey_128.s b/c64/kernal/keyboard/scnkey_128.s new file mode 100644 index 00000000..e8f5a000 --- /dev/null +++ b/c64/kernal/keyboard/scnkey_128.s @@ -0,0 +1,77 @@ + +// +// Keyboard scanning routine extension for C128 keyboards +// +// - [CM128] Compute's Mapping the Commodore 128 - pages 212 (SHFLAG), 290 (matrix) +// + + +#if CONFIG_KEYBOARD_C128 + + +// Inlining this within SCNKEY would both overcomplicate the implementation +// and disrupt a lot of branches (they would cross the 127 bytes distance limit) + +// .Y is now $FF - try to put there a key code from extended keyboard + + +scnkey_128: + + sty CIA1_PRA // disconnect all the classic keys first + + ldx #$02 +scnkey_matrix_128_loop: + lda kb_matrix_row_keys, x + sta VIC_XSCAN + lda kb_matrix_128_bucky_filter, x // filter out bucky keys + ora CIA1_PRB + cmp #$FF + beq scnkey_matrix_128_loop_next // skip if no key pressed from this row + cpy #$FF + bne scnkey_128_no_keys // clash, more than one key pressed + // We have at least one key pressed in this row, we need to find which one exactly + ldy #$07 +scnkey_matrix_128_loop_inner: // XXX try to deduplicate this with regular SCNKEY + cmp kb_matrix_row_keys, y + bne !+ // not this particular key + tya // now .A contains key offset within a row + clc + adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start + tay + jmp scnkey_matrix_128_loop_next +!: + dey + bpl scnkey_matrix_128_loop_inner + bmi scnkey_128_no_keys // branch always, multiple keys must have been pressed +scnkey_matrix_128_loop_next: + dex + bpl scnkey_matrix_128_loop + + // Scanning the C128 keyboard part complete - check if we got a key + + cpy #$FF + beq scnkey_128_done + + // Shift the matrix code +.break + clc + tya + adc #$40 + tay + + // Continue with C64 keyboard scanning + +scnkey_128_done: + + rts + + +scnkey_128_no_keys: + + pla // get rid of return address from the stack + pla + + jmp scnkey_no_keys // pass controll to original routine + + +#endif // CONFIG_KEYBOARD_C128 From 5dedf1314e270ed8a1dfd1b6fc1888cd344cf957 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 16 Oct 2019 17:47:26 +0200 Subject: [PATCH 55/85] most C128 keys work now --- c64/kernal/keyboard/kb_matrix_128.s | 10 ++++----- c64/kernal/keyboard/scnkey.s | 34 +++++++++++++++++++++++++---- c64/kernal/keyboard/scnkey_128.s | 14 ++++++------ 3 files changed, 42 insertions(+), 16 deletions(-) diff --git a/c64/kernal/keyboard/kb_matrix_128.s b/c64/kernal/keyboard/kb_matrix_128.s index 8afbef1a..40657284 100644 --- a/c64/kernal/keyboard/kb_matrix_128.s +++ b/c64/kernal/keyboard/kb_matrix_128.s @@ -12,10 +12,10 @@ kb_matrix_128: - // XXX fill-in the matrix properly!!! - .byte $41,$42,$43,$44,$45,$46,$47,$48 - .byte $51,$52,$53,$54,$55,$56,$57,$58 - .byte $61,$62,$63,$64,$65,$66,$67,$68 + .byte KEY_HELP,$38,$38,KEY_TAB_FW,$32,$34,$37,$31 + .byte KEY_ESC,$2B,$2D,$8D,$0D,$36,$39,$33 + .byte $00,$30,$2E,$91,$11,$9D,$1D,$00 + kb_matrix_128_bucky_filter: @@ -23,7 +23,7 @@ kb_matrix_128_bucky_filter: .byte %00000000 .byte %00000000 - .byte %00000000 // XXX ALT, NO_SCRL - probably here + .byte %10000001 // XXX ALT, NO_SCRL - probably here diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 91698ef5..3f43cc2a 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -260,13 +260,39 @@ scnkey_output_key: lda #$03 sta KOUNT - // Output PETSCII code to the keyboard buffer + // Retrieve the PETSCII code + #if CONFIG_KEYBOARD_C128 - - // XXX implement C128 key matrix support here + + cpy #$40 + bcs !+ + + lda (KEYTAB), y // retrieve key code from standard matrix + jmp scnkey_got_petscii + +!: + + lda kb_matrix_128 - $40, y // retrieve key code from C128 extended matrix + cmp KEY_TAB_FW // special handling for SHIFT+TAB + bne scnkey_got_petscii + lda SHFLAG // special handling for SHIFT+TAB + and #KEY_FLAG_SHIFT + bne !+ + lda KEY_TAB_FW + bne scnkey_got_petscii // branch alWAYS +!: + lda KEY_TAB_BW + +#else + + lda (KEYTAB), y #endif - lda (KEYTAB), y + + // Output PETSCII code to the keyboard buffer + +scnkey_got_petscii: + beq scnkey_no_keys // branch if we have no PETSCII code for this key ldy NDX sta KEYD, y diff --git a/c64/kernal/keyboard/scnkey_128.s b/c64/kernal/keyboard/scnkey_128.s index e8f5a000..6763a201 100644 --- a/c64/kernal/keyboard/scnkey_128.s +++ b/c64/kernal/keyboard/scnkey_128.s @@ -17,7 +17,7 @@ scnkey_128: - sty CIA1_PRA // disconnect all the classic keys first + sty CIA1_PRA // disconnect all the classic keys first ldx #$02 scnkey_matrix_128_loop: @@ -31,18 +31,18 @@ scnkey_matrix_128_loop: bne scnkey_128_no_keys // clash, more than one key pressed // We have at least one key pressed in this row, we need to find which one exactly ldy #$07 -scnkey_matrix_128_loop_inner: // XXX try to deduplicate this with regular SCNKEY +scnkey_matrix_128_loop_inner: cmp kb_matrix_row_keys, y - bne !+ // not this particular key - tya // now .A contains key offset within a row + bne !+ // not this particular key + tya // now .A contains key offset within a row clc - adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start + adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start tay jmp scnkey_matrix_128_loop_next !: dey bpl scnkey_matrix_128_loop_inner - bmi scnkey_128_no_keys // branch always, multiple keys must have been pressed + bmi scnkey_128_no_keys // branch always, multiple keys must have been pressed scnkey_matrix_128_loop_next: dex bpl scnkey_matrix_128_loop @@ -53,7 +53,7 @@ scnkey_matrix_128_loop_next: beq scnkey_128_done // Shift the matrix code -.break + clc tya adc #$40 From 470c4bded68185f2393822279e712f96e0c44209 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 16 Oct 2019 18:57:13 +0200 Subject: [PATCH 56/85] finished the new keyboard scanning routine --- CONFIG.md | 40 +++++++++++++++++++++++++++++ STATUS.md | 4 +-- c64/,,config_generic.s | 14 +++++----- c64/,,config_mega65.s | 14 +++++----- c64/,,config_ultimate64.s | 14 +++++----- c64/kernal/keyboard/kb_matrix_128.s | 4 +-- c64/kernal/keyboard/scnkey.s | 20 ++++++++------- c64/kernal/keyboard/scnkey_128.s | 4 +-- 8 files changed, 78 insertions(+), 36 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index 0003def2..49cbef82 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -105,6 +105,46 @@ Cause the system to support SIDs in `$D4xx` and `$D5xx` ranges, respectively. Each of them needs a couple of bytes in KERNAL segment - but they can share some code, and `$D4xx` range support replaces the standard `$D400` address handling, so exact amount depends on the exact configuration. +## Keyboard + +Original keyboard support routine is just horrible. It does nothing to prevent ghosting - press A+S+D at the same time - it prints F. Try to use joystick connected to control port 1 - it outputs phantom characters. The Open ROMs provides much more sophisticated routines to prevent such problems. + +### `CONFIG_LEGACY_SCNKEY` + +Uses old Open ROMs keyboard scanning routine, which is basically example routine by TWW/CTR, hacked to work within Kernal. It's greatest advantage is multi-key rollover, it's disadvantages - it's much less compatible (uses several bytes of memory which are normally free for user software - thus, it is considered legacy for now), does not support all the system variables (`RPTFLG` and `KEYLOG` are unsupported), and ignores the configuration options - this can be changed, but it requires some effort. + +Needs 70-250 more space in KERNAL segment (depending on the features enabled for current default routine). If unsure - disable. + +### `CONFIG_KEYBOARD_C128` + +Allows to use additional keys found on the C128 keyboard. + +Needs 128 bytes more space in KERNAL segment. If unsure - disable. + +### `CONFIG_KEY_REPEAT_DEFAULT` + +Enables key repetition by default during the startup (sets `RPTFLG`). + +Needs 5 bytes more space in KERNAL segment. + +### `CONFIG_KEY_REPEAT_ALWAYS` + +Enables the key repetition and ignores `RPTFLG`. + +Saves 22 bytes from KERNAL segment. + +### `CONFIG_KEY_FAST_SCAN` + +Performs somee speed optimizations in the keyboard scanning routine, at the eexpense of some more ROM space. + +Needs 13 bytes more space in KERNAL segment. Only disable if you are running out of ROM space. + +### `CONFIG_JOY1_CURSOR` and `CONFIG_JOY2_CURSOR` + +Joystick movement also moves the cursor. + +Needs about 65 bytes of ROM space to handle both joysticks. + ## Eye candy ### `CONFIG_BANNER_SIMPLE`, `CONFIG_BANNER_FANCY`, `CONFIG_BANNER_VARIANT` diff --git a/STATUS.md b/STATUS.md index 347d799b..40464b97 100644 --- a/STATUS.md +++ b/STATUS.md @@ -3,8 +3,8 @@ Here are the features of the Open ROMs not found in the original ROMs from the 80s (many of them are [configurable](CONFIG.md)): -* improved keyboard scanning, supports multi-key roll-over and rejection of spurious joystick input -* joystick (port 1) can be used to move text cursor +* improved keyboard scanning, supports anti-ghosting and is resistant to joystick interference (one variant even supports multi-keyy rollover) +* joystick can be used to move text cursor * uses RAM under ROM and I/O: 61438 bytes free * cold/warm start silences multiple SID chips - all $D4xx and $D5xx addresses * wark start due to BRK prints out the instruction address diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 2659f198..20fcf7d7 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -48,13 +48,13 @@ // Keyboard settings -// #define CONFIG_LEGACY_SCNKEY // XXX document this -#define CONFIG_KEYBOARD_C128 // XXX document this -// #define CONFIG_KEY_REPEAT_DEFAULT // XXX document this -// #define CONFIG_KEY_REPEAT_ALWAYS // XXX document this -#define CONFIG_KEY_FAST_SCAN // XXX document this -#define CONFIG_JOY1_CURSOR // XXX document this -#define CONFIG_JOY2_CURSOR // XXX document this +// #define CONFIG_LEGACY_SCNKEY +#define CONFIG_KEYBOARD_C128 +// #define CONFIG_KEY_REPEAT_DEFAULT +// #define CONFIG_KEY_REPEAT_ALWAYS +#define CONFIG_KEY_FAST_SCAN +#define CONFIG_JOY1_CURSOR +// #define CONFIG_JOY2_CURSOR // Eye candy diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 3fce219e..e293a8c4 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -50,13 +50,13 @@ // Keyboard settings -#define CONFIG_LEGACY_SCNKEY // XXX document this -// #define CONFIG_KEYBOARD_C128 // XXX document this -// #define CONFIG_KEY_REPEAT_DEFAULT // XXX document this -// #define CONFIG_KEY_REPEAT_ALWAYS // XXX document this -#define CONFIG_KEY_FAST_SCAN // XXX document this -#define CONFIG_JOY1_CURSOR // XXX document this -#define CONFIG_JOY2_CURSOR // XXX document this +#define CONFIG_LEGACY_SCNKEY +// #define CONFIG_KEYBOARD_C128 +// #define CONFIG_KEY_REPEAT_DEFAULT +// #define CONFIG_KEY_REPEAT_ALWAYS +#define CONFIG_KEY_FAST_SCAN +#define CONFIG_JOY1_CURSOR +#define CONFIG_JOY2_CURSOR // Eye candy diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index f1f55f9d..05f45f59 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -48,13 +48,13 @@ // Keyboard settings -// #define CONFIG_LEGACY_SCNKEY // XXX document this -// #define CONFIG_KEYBOARD_C128 // XXX document this -// #define CONFIG_KEY_REPEAT_DEFAULT // XXX document this -// #define CONFIG_KEY_REPEAT_ALWAYS // XXX document this -#define CONFIG_KEY_FAST_SCAN // XXX document this -#define CONFIG_JOY1_CURSOR // XXX document this -#define CONFIG_JOY2_CURSOR // XXX document this +// #define CONFIG_LEGACY_SCNKEY +// #define CONFIG_KEYBOARD_C128 +// #define CONFIG_KEY_REPEAT_DEFAULT +// #define CONFIG_KEY_REPEAT_ALWAYS +#define CONFIG_KEY_FAST_SCAN +#define CONFIG_JOY1_CURSOR +#define CONFIG_JOY2_CURSOR // Eye candy diff --git a/c64/kernal/keyboard/kb_matrix_128.s b/c64/kernal/keyboard/kb_matrix_128.s index 40657284..105693e0 100644 --- a/c64/kernal/keyboard/kb_matrix_128.s +++ b/c64/kernal/keyboard/kb_matrix_128.s @@ -7,7 +7,7 @@ // -#if CONFIG_KEYBOARD_C128 +#if CONFIG_KEYBOARD_C128 && !CONFIG_LEGACY_SCNKEY kb_matrix_128: @@ -27,4 +27,4 @@ kb_matrix_128_bucky_filter: -#endif // CONFIG_KEYBOARD_C128 +#endif // CONFIG_KEYBOARD_C128 and no CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 3f43cc2a..a3fb99c5 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -273,15 +273,17 @@ scnkey_output_key: !: lda kb_matrix_128 - $40, y // retrieve key code from C128 extended matrix - cmp KEY_TAB_FW // special handling for SHIFT+TAB - bne scnkey_got_petscii - lda SHFLAG // special handling for SHIFT+TAB - and #KEY_FLAG_SHIFT - bne !+ - lda KEY_TAB_FW - bne scnkey_got_petscii // branch alWAYS -!: - lda KEY_TAB_BW + + // XXX this will be needed for extended screen editor + // cmp KEY_TAB_FW // special handling for SHIFT+TAB + // bne scnkey_got_petscii + // lda SHFLAG // special handling for SHIFT+TAB + // and #KEY_FLAG_SHIFT + // bne !+ + // lda KEY_TAB_FW + // bne scnkey_got_petscii // branch alWAYS + // !: + // lda KEY_TAB_BW #else diff --git a/c64/kernal/keyboard/scnkey_128.s b/c64/kernal/keyboard/scnkey_128.s index 6763a201..a6d14acf 100644 --- a/c64/kernal/keyboard/scnkey_128.s +++ b/c64/kernal/keyboard/scnkey_128.s @@ -6,7 +6,7 @@ // -#if CONFIG_KEYBOARD_C128 +#if CONFIG_KEYBOARD_C128 && !CONFIG_LEGACY_SCNKEY // Inlining this within SCNKEY would both overcomplicate the implementation @@ -74,4 +74,4 @@ scnkey_128_no_keys: jmp scnkey_no_keys // pass controll to original routine -#endif // CONFIG_KEYBOARD_C128 +#endif // CONFIG_KEYBOARD_C128 and no CONFIG_LEGACY_SCNKEY From fb2e13f9a95df64daaa69ca38680352245204d87 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 16 Oct 2019 19:10:28 +0200 Subject: [PATCH 57/85] optimized pop_keyboard_buffer --- bin/basic_generic.rom | Bin 8192 -> 8192 bytes bin/basic_mega65.rom | Bin 8192 -> 8192 bytes bin/basic_ultimate64.rom | Bin 8192 -> 8192 bytes bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/,,config_generic.s | 4 ++-- c64/kernal/chrin_real.s | 18 ------------------ c64/kernal/keyboard/pop_keyboard_buffer.s | 20 ++++++++++++++++++++ 9 files changed, 22 insertions(+), 20 deletions(-) create mode 100644 c64/kernal/keyboard/pop_keyboard_buffer.s diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index 11b0d17c71c181a77417ca610bdc78d22188aec0..40b293f5d165bc4b9809cd782ebedb3a55b640f0 100644 GIT binary patch delta 2178 zcmcgte{37o9l!I%ImdQlJB=Y@#eIZPk|lJ3)@g|9Htp)+F0W~nz$%zD+>Hh^wHlSC zp{1kFCN2tyZZ6kNDW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~1&eVSBfCJD82cZiNK{tE{0?-48;k(caN8l(NgJ+-*j>8EE!bx}*P635} z7zo2@7=-8G3=F|pcpkn7=imi+5zfO)@bdrRskNMN-#j9IwE~`TrQ#IbNJV|bx1@IC z%BqZRFOu;?xXnta(%YCv^&k&Bf`IVQ^S2sA^2#mz$at)N=qctz`T`bReza{fe_npV z*HnWYXt;&)QP;0uS@b@VF3CULJ|PeK0zbMqukVhu;*>dY$^?3GUcJkF?|J!54KF## zdO~&S-iUx-DRN^zviZ{*o_&bibS;mgfYb4?mVfBwY1RCDwfr<^TYI;b$5m>R?qvwgnTmq diff --git a/bin/basic_mega65.rom b/bin/basic_mega65.rom index fe3ebcf3ef2fcefc2696624f5098bde1feb278a4..d74a3c0a02752a819872cd65de74c4a6ef2c3f41 100644 GIT binary patch delta 2289 zcma)8eQXow8GrB2=ey(#Hjpp_ZTg0?LQ06TuF#O-5W2Ft>J_rWN;ge#VWV>R64TaB z4XT_!a%qana&Gil^rwe3I{S`T_URql5o5=FwN3!xOdhMe8eI5URjLhJfiQIDh zSei70#f1WCQfI)|G+l10FIxhvP0N?`WK*Kq@+8`mn+=5j;EG{<(2Z=0t>RN||miVs?^dYs!aMf;kE(6i&Ogw}$EKtF$RCLd06USS!{vrROpzY%y z4uMGo&ycwA=HYV(%7K5w82)rFj)HFx8k&k~Te}`y`!pUw#A4Ny?ZNeqkSnY|ZA;p;2b=;CRzNr_Wi*x!)?5kqKj`KQ_ zeN`~he(Y_1{2C!Se#%)H#~96%Dg4&INDdkx9!Op~?sP#%Q-fEVCae`xgAP}+J~Di2 zlOd|j76*K3x4f;*a~U_YZR<9q;EnWjfHB}g+bBH6p1h#_Q25GyTPtL<8Y1m#k3v(W z-Dxnf^G`^XE+weF%m<@LAtCh`=~0iL2?vja)B(~nfYhU8OILM3JwZCEN7a+$#FMTn z!EB(bDgol?O^P^1C&$Qfm>jR2Oq{?UvJq9%5q^6j2h@E=P2GahLv3_K27s^`wnUCX zO9oVJ`2$`r7+66?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pw{JR6K<4z<8C1JUoK+&*i9rbB~) z{chW+nnB@zm#5BH!V}1BfelAY) z*v*U^SL*mx9oOi1n_j+|@rmvwdBq#zWL=zugvw=`bl95kpG~u1SxR-1z1~cJm5$b1_S Date: Wed, 16 Oct 2019 20:24:47 +0200 Subject: [PATCH 58/85] small C128 keyboard handling optimization --- CONFIG.md | 2 +- c64/kernal/keyboard/scnkey_128.s | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index 49cbef82..cdb8f859 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -119,7 +119,7 @@ Needs 70-250 more space in KERNAL segment (depending on the features enabled for Allows to use additional keys found on the C128 keyboard. -Needs 128 bytes more space in KERNAL segment. If unsure - disable. +Needs about 125 bytes more space in KERNAL segment. If unsure - disable. ### `CONFIG_KEY_REPEAT_DEFAULT` diff --git a/c64/kernal/keyboard/scnkey_128.s b/c64/kernal/keyboard/scnkey_128.s index a6d14acf..a3e78d75 100644 --- a/c64/kernal/keyboard/scnkey_128.s +++ b/c64/kernal/keyboard/scnkey_128.s @@ -37,6 +37,7 @@ scnkey_matrix_128_loop_inner: tya // now .A contains key offset within a row clc adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start + adc #$40 // now .A contains fully normalized offset tay jmp scnkey_matrix_128_loop_next !: @@ -52,13 +53,6 @@ scnkey_matrix_128_loop_next: cpy #$FF beq scnkey_128_done - // Shift the matrix code - - clc - tya - adc #$40 - tay - // Continue with C64 keyboard scanning scnkey_128_done: From f9e3b57a796a03cd8f53b09cb95a19f671583f6d Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Thu, 17 Oct 2019 17:41:50 +0200 Subject: [PATCH 59/85] small keyboard reading fixes --- STATUS.md | 2 +- bin/basic_generic.rom | Bin 8192 -> 8192 bytes bin/basic_mega65.rom | Bin 8192 -> 8192 bytes bin/basic_ultimate64.rom | Bin 8192 -> 8192 bytes bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/kernal/f13e.getin.s | 21 ++------------- c64/kernal/interrupts/udtim.s | 12 ++++++--- c64/kernal/keyboard/f142.interop | 4 +++ c64/kernal/keyboard/f142.read_kb_buf.s | 30 ++++++++++++++++++++++ c64/kernal/keyboard/keyboard_disconnect.s | 7 +++++ c64/kernal/keyboard/pop_keyboard_buffer.s | 4 ++- c64/kernal/keyboard/scnkey.s | 3 +-- 14 files changed, 57 insertions(+), 26 deletions(-) create mode 100644 c64/kernal/keyboard/f142.interop create mode 100644 c64/kernal/keyboard/f142.read_kb_buf.s diff --git a/STATUS.md b/STATUS.md index 40464b97..28523aaa 100644 --- a/STATUS.md +++ b/STATUS.md @@ -134,7 +134,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FFDB` | | `SETTIM` | DONE | | | `$FFDE` | | `RDTIM` | DONE | | | `$FFE1` | `$F6ED` | `STOP` | DONE | | -| `$FFE4` | `$F13E` | `GETIN` | PARTIAL | only some devices supported | +| `$FFE4` | `$F13E` | `GETIN` | PARTIAL | only keyaboard supported | | `$FFE7` | `$F32F` | `CLALL` | DONE | | | `$FFEA` | | `UDTIM` | DONE | | | `$FFED` | | `SCREEN` | DONE | | diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index 40b293f5d165bc4b9809cd782ebedb3a55b640f0..89242f1bdb61bb7ddb0cf07bdcbc760735d8dc70 100644 GIT binary patch delta 26 icmZp0XmHrDij7U{=h6)dTAMepr86?-ZkFJ9Ar1hGUkSPZ delta 26 icmZp0XmHrDij7VA=h6)d%9}T^r86?7ZIdTd}{tSV!V9Y_ZCMMba` zhI`Q`jCPgPQ<#I&^r6pa<_eibx5rtj^UqB8=3$5|ZB7@Se`>>^Mja9~FX>?f&WNnm>c-Xrk+e^^8j z(p((62;Opa1n-fAJfB!dTvzACK}r4G3_ygT5CZpczt9WrFHH(JfLLuYA)070O<|F|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-GEga@Y^=rlHn;Cp4f(GHqdD90msoev~5D;T2CZE@f77$ JR(?fRe*@gna6141 diff --git a/bin/kernal_ultimate64.rom b/bin/kernal_ultimate64.rom index 5caf1cfbdfb24c0039720f63414d9c1a5735d4b9..a69028efb8ddb5df81d702bc5663be9c9c757955 100644 GIT binary patch delta 932 zcmX9-ZD<@t7~a`!ZgbaZZf(>%6#$@Ku%{hDinRl4y zosZ{ZM*2qj@(YqrshD|C3U{PDLNTJ(^=@3Cpi;O=qnME&>fS=%lV^S75x&HMBd!sg z6@J;NG|XER9$5jK!Uhj9Cp$Mn@=jOlB|y#?F< zhTMWKhwhPGTVJXl zpp&AiL4=HNJsIT(EMf?WOO%eG%~0!>0S}0< z{A~}IBA$ zey;puG?>H@jWCp{5#@t<8@LCzutF|3JueSa2vE!lZc_;P^sA{Gqt}TNeh-z&Xm|%| zB{Si78uwQ;P#1wSlJMGJe!xe`6Y8U!`^#z)-5|HrNb`M`xCFab@RpUFpr7@;;M|9a ztM(t5U`DlOq0B9eVzI(~W=mE^abBiqPy=zpbj=>zYq@*wcsVaP0g|RApQXNVP=^1EdV_de}y_z~u zUWM4Qrlwt^2S>^Fw%CCTJH}Hr>4SIIc?HeOlOdbggL*dadseUb09Q}&8ZSA|uG~tBfhL{#%(_$jd6;70pRc9RXR2L?| z`b}{SAFs=n6Cd+pG)E4%?`rsv!JZYaj^Z5*3uK~wTi`^+yi@l-?YVZsKS_TFY~*o} zI5%^OhwSZ+9bHotPg5*2%qZ@Dh%t@!_5rGmT`pPL53$NrY;UraM=yCI|_3|6lvTf0@0i6aWAK delta 931 zcmX9-ZD?Cn7``XB$?eT_NxEBev#rfrR!25l)~$#iZCNR^1U;r=f7qeORr@1C#IM4J zf2^3>YD;VNOwfufz2uH%GmtLK87HDewxyt4WrN8gimZ(m9k;9PIc28t-1z6bhx5GW zKw$7GC~vrxD zOCj@;Rrg><(6Yx|QD~~fRZagQSs43LBTogAC`L+w&*j4`*H?JK#c%zj;Y0K@Ik@A= z`WT&YsTzdI8}Xt55Fv*0N;ng;8KseU2()!0Q+X=?5))3_as8m^QJ?plgRxxn!vvfRdFj_ATP zSbz8{hKJV`%Z^S&KZ?Rx5^Fx_8)5L!8rR7091NGqbn{N{+neT9_y5$-H52|v`opk| zr$OZ0%vqkXSHpYS2*oEU7WiW*ZvPX{{e!nQaF$^o!+k3_%6W-mr kkK#i#5fKyn#YCHkhc@xERqS0#l?*`>gy-1r|CVn42c}i2mjD0& diff --git a/c64/kernal/f13e.getin.s b/c64/kernal/f13e.getin.s index 5eefc0ac..be8e3faa 100644 --- a/c64/kernal/f13e.getin.s +++ b/c64/kernal/f13e.getin.s @@ -8,26 +8,9 @@ // CPU registers that has to be preserved (see [RG64]): .X, .Y // -// XXX currently does not preserve registers, to be fixed! GETIN: - // Wait for a key - lda NDX - bne !+ + // XXX this should be a dispatcher for several different devices! - // Nothing in keyboard buffer to read - sec - lda #$00 - rts - -!: - lda KEYD - pha - - jsr pop_keyboard_buffer - - pla - clc - - rts + jmp read_kb_buf diff --git a/c64/kernal/interrupts/udtim.s b/c64/kernal/interrupts/udtim.s index 34528613..f9d4fa99 100644 --- a/c64/kernal/interrupts/udtim.s +++ b/c64/kernal/interrupts/udtim.s @@ -26,16 +26,22 @@ udtim_update_stkey: // entry to be used when interrupts are disabled // Another action we have to perform is to copy the last row of keyboard to RAM, // so that various routines can detect the STOP key press +#if CONFIG_KEYBOARD_C128 + lda #$FF + sta VIC_XSCAN // disconnect the extra C128 keys +#endif + lda #$7F sta CIA1_PRA // select the last row (bit to 0) lda CIA1_PRB // read the row sta STKEY - // Finish by disconnecting the keyboard, this will prevent - // interference when scanning joystick in port 1 + // Leave the CIA configured this way. It would be far better to disconnect + // the keyboard at this point, but certain software (mainly intros) is + // unable to, for example, read the space bar status. - jmp keyboard_disconnect + rts udtim_clock_rollover: diff --git a/c64/kernal/keyboard/f142.interop b/c64/kernal/keyboard/f142.interop new file mode 100644 index 00000000..73019c17 --- /dev/null +++ b/c64/kernal/keyboard/f142.interop @@ -0,0 +1,4 @@ +$F142 is a well-known address of keyboard reading routine, described for example here: +- http://sta.c64.org/cbm64kbdfunc.html + +It is used for eexample by a music eeditor here: https://github.com/martinpiper/C64Public/blob/master/MusicEditor/GetKey.a diff --git a/c64/kernal/keyboard/f142.read_kb_buf.s b/c64/kernal/keyboard/f142.read_kb_buf.s new file mode 100644 index 00000000..8b72b9e2 --- /dev/null +++ b/c64/kernal/keyboard/f142.read_kb_buf.s @@ -0,0 +1,30 @@ + +// +// Well-known Kernal routine, described in: +// +// - http://sta.c64.org/cbm64kbdfunc.html +// + + +read_kb_buf: + + // Check for a key + lda NDX + bne !+ + + // Nothing in keyboard buffer to read + sec + rts + +!: + lda KEYD + pha + phy_trash_a + + jsr pop_keyboard_buffer + + ply_trash_a + pla + clc + + rts diff --git a/c64/kernal/keyboard/keyboard_disconnect.s b/c64/kernal/keyboard/keyboard_disconnect.s index 37f4e973..1fdae023 100644 --- a/c64/kernal/keyboard/keyboard_disconnect.s +++ b/c64/kernal/keyboard/keyboard_disconnect.s @@ -2,6 +2,10 @@ // // Helper routine - disconnects the keyboard from CIA1_PRB, // leaves $FF in .X (behavior needed in some places) +// + + +#if !CONFIG_LEGACY_SCNKEY keyboard_disconnect: @@ -13,3 +17,6 @@ keyboard_disconnect: #endif rts + + +#endif diff --git a/c64/kernal/keyboard/pop_keyboard_buffer.s b/c64/kernal/keyboard/pop_keyboard_buffer.s index e540a221..6f3b172b 100644 --- a/c64/kernal/keyboard/pop_keyboard_buffer.s +++ b/c64/kernal/keyboard/pop_keyboard_buffer.s @@ -2,7 +2,9 @@ // Pop key out of keyboard buffer // Disable interrupts while reading from keyboard buffer // so that no race conditions can occur - +// +// CPU registers that has to be preserved: .X +// pop_keyboard_buffer: diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index a3fb99c5..e35baaf2 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -53,7 +53,6 @@ SCNKEY: #endif // Retrieve SHIFT / VENDOR / CTRL status - // Use .X to detect 2 or more keys pressed (should be $FF now) ldy #(__kb_matrix_bucky_confmask_end - kb_matrix_bucky_confmask - 1) scnkey_bucky_loop: @@ -154,7 +153,7 @@ scnkey_matrix_loop_inner: !: dey bpl scnkey_matrix_loop_inner - bmi scnkey_no_keys // branch always, multiple keys must have been pressed + bmi scnkey_no_keys // branch always, multiple keys must have been pressed scnkey_matrix_loop_next: dex bpl scnkey_matrix_loop From 1db03b5921d2615a9225237d13726b31ad57f044 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Thu, 17 Oct 2019 21:55:27 +0200 Subject: [PATCH 60/85] started work on release tool --- Makefile | 5 +- STATUS.md | 1 + src/build_segment.cc | 51 +------------- src/common.h | 58 ++++++++++++++++ src/release.cc | 161 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 225 insertions(+), 51 deletions(-) create mode 100644 src/common.h create mode 100644 src/release.cc diff --git a/Makefile b/Makefile index 6e67c942..4e92e5e0 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,7 @@ TOOL_COLLECT_DATA = build/tools/collect_data TOOL_COMPRESS_TEXT = build/tools/compress_text TOOL_PNGPREPARE = build/tools/pngprepare TOOL_BUILD_SEGMENT = build/tools/build_segment +TOOL_RELEASE = build/tools/release TOOL_SIMILARITY = build/tools/similarity TOOL_ASSEMBLER = assembler/KickAss.jar @@ -67,7 +68,7 @@ all: $(STD_TARGET_LIST) $(EXT_TARGET_LIST) clean: @rm -rf build -updatebin: $(STD_TARGET_LIST) +updatebin: $(STD_TARGET_LIST) $(STD_TOOL_RELEASE) cp build/chargen.rom bin/chargen.rom cp build/basic_generic.rom bin/basic_generic.rom cp build/kernal_generic.rom bin/kernal_generic.rom @@ -90,7 +91,7 @@ build/tools/%: src/%.c @mkdir -p build/tools $(CC) -O2 -Wall -o $@ $< -build/tools/%: src/%.cc +build/tools/%: src/%.cc src/common.h @mkdir -p build/tools $(CXX) -O2 -Wall -o $@ $< diff --git a/STATUS.md b/STATUS.md index 28523aaa..a535689f 100644 --- a/STATUS.md +++ b/STATUS.md @@ -160,6 +160,7 @@ Not all of them - only these we want to have implemented. | `$EA31` | default IRQ | PARTIAL | | | `$EA7E` | ack CIA1 + below | DONE | | | `$EA81` | ret from IRQ/NMI | DONE | | +| `$F142` | get key from buffer | DONE | | | `$FD30` | default vectors | DONE | | | `$FE47` | default NMI | PARTIAL | | | `$FE66` | default BRK | DONE | | diff --git a/src/build_segment.cc b/src/build_segment.cc index 9c55842e..3d36888d 100644 --- a/src/build_segment.cc +++ b/src/build_segment.cc @@ -3,6 +3,8 @@ // source files, placing routines where they need to live // +#include "common.h" + #include #include #include @@ -13,19 +15,11 @@ #include #include #include -#include -#include #include #include #include #include -#if defined(WIN32) || defined(_WIN32) - #define DIR_SEPARATOR "\\" -#else - #define DIR_SEPARATOR "/" -#endif - const std::string ASM_CMD = "java -jar "; const std::string LAB_OUT_START = "__routine_START_"; @@ -33,8 +27,6 @@ const std::string LAB_OUT_END = "__routine_END_"; const std::string LAB_IN_START = ".label __routine_START_"; const std::string LAB_IN_END = ".label __routine_END_"; -const std::string BANNER_LINE = "//-------------------------------------------------------------------------------------------"; - // // Command line settings // @@ -53,17 +45,6 @@ std::list CMD_inList; // Common helper functions // -void ERROR() -{ - exit(-1); -} - -void ERROR(const std::string &message) -{ - std::cout << "\n" << "ERROR: " << message << "\n\n"; - exit(-1); -} - void printUsage() { std::cout << "\n" << @@ -73,16 +54,6 @@ void printUsage() " " << "\n\n"; } -void printBannerLineTop() -{ - std::cout << "\n\n\n" << BANNER_LINE << "\n"; -} - -void printBannerLineBottom() -{ - std::cout << BANNER_LINE << "\n\n"; -} - void printBannerCollectAnalyse() { printBannerLineTop(); @@ -101,24 +72,6 @@ void printBannerBinCompile() // Class definitions // -class DualStream -{ -public: - DualStream(std::ostream& str1, std::ostream& str2) : str1(str1), str2(str2) {} - - template DualStream &operator<<(const T& x) - { - str1 << x; - str2 << x; - - return *this; - } - -private: - std::ostream& str1; - std::ostream& str2; -}; - class SourceFile { public: diff --git a/src/common.h b/src/common.h new file mode 100644 index 00000000..861d6f0e --- /dev/null +++ b/src/common.h @@ -0,0 +1,58 @@ +// +// Common parts of utilities written in C++ +// for providing uniform user experience +// + +#include +#include + + +#if defined(WIN32) || defined(_WIN32) + #define DIR_SEPARATOR "\\" +#else + #define DIR_SEPARATOR "/" +#endif + + +const std::string BANNER_LINE = "//-------------------------------------------------------------------------------------------"; + + +void ERROR() +{ + exit(-1); +} + +void ERROR(const std::string &message) +{ + std::cout << "\n" << "ERROR: " << message << "\n\n"; + exit(-1); +} + +void printBannerLineTop() +{ + std::cout << "\n\n\n" << BANNER_LINE << "\n"; +} + +void printBannerLineBottom() +{ + std::cout << BANNER_LINE << "\n\n"; +} + + +class DualStream +{ +public: + DualStream(std::ostream& str1, std::ostream& str2) : str1(str1), str2(str2) {} + + template DualStream &operator<<(const T& x) + { + str1 << x; + str2 << x; + + return *this; + } + +private: + std::ostream& str1; + std::ostream& str2; +}; diff --git a/src/release.cc b/src/release.cc new file mode 100644 index 00000000..cd3c466e --- /dev/null +++ b/src/release.cc @@ -0,0 +1,161 @@ +// +// Utility to prepare a release with automatically +// assigned version numbers +// + +#include "common.h" + +#include +#include + +#include +#include + +// +// Command and enviroment line settings +// + +std::string CMD_inDir = "./build"; +std::string CMD_outDir = "./bin"; + +std::list CMD_fileList; + +std::string ENV_developerId; + +// +// Common helper functions +// + +void printUsage() +{ + std::cout << "\n" << + "usage: release [-i ] [-o ]" << "\n" << + " " << "\n\n"; +} + +// +// Top-level functions +// + +void parseCommandLine(int argc, char **argv) +{ + int opt; + + // Retrieve command line options + + while ((opt = getopt(argc, argv, "i:o:")) != -1) + { + switch(opt) + { + case 'i': CMD_inDir = optarg; break; + case 'o': CMD_outDir = optarg; break; + default: printUsage(); ERROR(); + } + } + + // Retrieve file/directory list + + for (int idx = optind; idx < argc; idx++) + { + CMD_fileList.push_back(argv[idx]); + } + + if (CMD_fileList.empty()) { printUsage(); ERROR("empty file list"); } +} + +void getEnvironmentSettings() +{ + const char* id = getenv("OPEN_ROMS_DEVELOPER_ID"); + + // Check whether the developer ID is suitable + + if (id == nullptr) + { + ERROR("environment variable OPEN_ROMS_DEVELOPER_ID not set"); + } + + ENV_developerId = id; + + if (ENV_developerId.length() < 2 || ENV_developerId.length() > 3) + { + ERROR("OPEN_ROMS_DEVELOPER_ID has to be 2 or 3 characters long"); + } + + for (const char &c : ENV_developerId) + { + if (!(c >= 'A' && c <= 'Z')) + { + ERROR("OPEN_ROMS_DEVELOPER_ID can only contain uppercase letters"); + } + } +} + +void printBanner() +{ + printBannerLineTop(); + std::cout << "// Preparing ROM set release by '" << ENV_developerId << "'\n"; + printBannerLineBottom(); +} + +void readFiles() +{ + // XXX +} + +void embedVersionString() +{ + // XXX +} + +void writeFiles() +{ + // XXX +} + +// +// Class definitions +// + +class ROMFile +{ +public: + + ROMFile(const std::string &baseFileName); + +private: + + std::string baseFileName; + + std::vector srcFile; + std::vector dstFile; +} + +// +// Main function +// + +int main(int argc, char **argv) +{ + parseCommandLine(argc, argv); + getEnvironmentSettings(); + + printBanner(); + + readFiles(); + embedVersionString(); + writeFiles(); + + ERROR("This tool is not finished yet"); + + return 0; +} + +// +// Class 'ROMFile' +// + +ROMFile::ROMFile(const std::string &baseFileName) +{ + // XXX + +} From e9565c9724293f53381f59fec43ecd2ab2596769 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 18 Oct 2019 18:20:36 +0200 Subject: [PATCH 61/85] some tweaks to C128 keyboard support --- CONFIG.md | 2 +- c64/kernal/keyboard/kb_matrix_128.s | 2 +- c64/kernal/keyboard/scnkey.s | 84 ++++++++++++++--------------- c64/kernal/keyboard/scnkey_128.s | 2 +- 4 files changed, 42 insertions(+), 48 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index cdb8f859..3f385728 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -117,7 +117,7 @@ Needs 70-250 more space in KERNAL segment (depending on the features enabled for ### `CONFIG_KEYBOARD_C128` -Allows to use additional keys found on the C128 keyboard. +Allows to use additional keys found on the C128 keyboard. NOTE: might be buggy, on VICE emulator I can't get all the keys working. Needs about 125 bytes more space in KERNAL segment. If unsure - disable. diff --git a/c64/kernal/keyboard/kb_matrix_128.s b/c64/kernal/keyboard/kb_matrix_128.s index 105693e0..2c0d4b9e 100644 --- a/c64/kernal/keyboard/kb_matrix_128.s +++ b/c64/kernal/keyboard/kb_matrix_128.s @@ -23,7 +23,7 @@ kb_matrix_128_bucky_filter: .byte %00000000 .byte %00000000 - .byte %10000001 // XXX ALT, NO_SCRL - probably here + .byte %10000001 // ALT, NO_SCRL diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index e35baaf2..48f59a4b 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -42,11 +42,11 @@ SCNKEY: #if !CONFIG_JOY2_CURSOR && CONFIG_KEY_FAST_SCAN ldx #$00 - stx CIA1_PRA // connect all the rows + stx CIA1_PRA // connect all the rows #if CONFIG_KEYBOARD_C128 stx VIC_XSCAN #endif - dex // puts $FF + dex // puts $FF cpx CIA1_PRB beq scnkey_no_keys @@ -64,7 +64,7 @@ scnkey_bucky_loop: #endif lda kb_matrix_bucky_testmask, y and CIA1_PRB - bne !+ // not pressed + bne !+ // not pressed lda SHFLAG ora kb_matrix_bucky_shflag, y sta SHFLAG @@ -81,26 +81,26 @@ scnkey_bucky_loop: // Check for control port 2 activity ldx #$00 - stx CIA1_DDRA // set port to input to read joystick + stx CIA1_DDRA // set port to input to read joystick - lda CIA1_PRA // read the joystick 2 status + lda CIA1_PRA // read the joystick 2 status - dex // puts $FF - stx CIA1_DDRA // set port back to output + dex // puts $FF + stx CIA1_DDRA // set port back to output - and #%00001111 // filter out anything but joystick movement + and #%00001111 // filter out anything but joystick movement cmp #%00001111 bne scnkey_joystick_filtered #if CONFIG_KEY_FAST_SCAN - inx // puts $00 - stx CIA1_PRA // connect all the rows + inx // puts $00 + stx CIA1_PRA // connect all the rows #if CONFIG_KEYBOARD_C128 stx VIC_XSCAN #endif - dex // puts $FF + dex // puts $FF cpx CIA1_PRB beq scnkey_no_keys @@ -110,12 +110,12 @@ scnkey_bucky_loop: // Check for control port 1 activity (can interfere with keyboard) - jsr keyboard_disconnect // disconnect all the rows, .X will be $FF - cpx CIA1_PRB // only control port activity will be reported + jsr keyboard_disconnect // disconnect all the rows, .X will be $FF + cpx CIA1_PRB // only control port activity will be reported #if CONFIG_JOY1_CURSOR - bne scnkey_joystick_1 // use joystick for cursor keys + bne scnkey_joystick_1 // use joystick for cursor keys #else - bne scnkey_no_keys // if activity detected do not scan the keyboard + bne scnkey_no_keys // if activity detected do not scan the keyboard #endif // Check if KEYTAB is not 0 (happens if more than one bucky key is pressed) @@ -126,7 +126,7 @@ scnkey_bucky_loop: // Scan the keyboard matrix - ldy #$FF // offset in key matrix table, $FF for not found yet + ldy #$FF // offset in key matrix table, $FF for not found yet #if CONFIG_KEYBOARD_C128 jsr scnkey_128 #endif @@ -134,26 +134,26 @@ scnkey_bucky_loop: scnkey_matrix_loop: lda kb_matrix_row_keys, x sta CIA1_PRA - lda kb_matrix_bucky_filter, x // filter out bucky keys + lda kb_matrix_bucky_filter, x // filter out bucky keys ora CIA1_PRB cmp #$FF - beq scnkey_matrix_loop_next // skip if no key pressed from this row + beq scnkey_matrix_loop_next // skip if no key pressed from this row cpy #$FF - bne scnkey_no_keys // clash, more than one key pressed + bne scnkey_no_keys // clash, more than one key pressed // We have at least one key pressed in this row, we need to find which one exactly ldy #$07 scnkey_matrix_loop_inner: cmp kb_matrix_row_keys, y - bne !+ // not this particular key - tya // now .A contains key offset within a row + bne !+ // not this particular key + tya // now .A contains key offset within a row clc - adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start + adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start tay jmp scnkey_matrix_loop_next !: dey bpl scnkey_matrix_loop_inner - bmi scnkey_no_keys // branch always, multiple keys must have been pressed + bmi scnkey_no_keys // branch always, multiple keys must have been pressed scnkey_matrix_loop_next: dex bpl scnkey_matrix_loop @@ -165,9 +165,9 @@ scnkey_matrix_loop_next: // To be extra sure, check for possible control port 1 interference once again - jsr keyboard_disconnect // disconnect all the rows, .X will be $FF - cpx CIA1_PRB // only control port activity will be reported - beq scnkey_got_key // branch if joystick activity NOT detected + jsr keyboard_disconnect // disconnect all the rows, .X will be $FF + cpx CIA1_PRB // only control port activity will be reported + beq scnkey_got_key // branch if joystick activity NOT detected // FALLTROUGH @@ -175,12 +175,7 @@ scnkey_no_keys: // Mark no key press -#if CONFIG_KEYBOARD_C128 - lda #$FF // non-standard, but for C128 keyboard $40 is a valid position -#else lda #$40 -#endif - sta LSTX rts @@ -191,7 +186,7 @@ scnkey_joystick_1: // Prepare joystick 1 status lda CIA1_PRB - and #%00001111 // filter out anything but movement + and #%00001111 // filter out anything but movement // FALLTROUGH @@ -230,7 +225,7 @@ scnkey_joystick_filtered: scnkey_got_key: // .Y should now contain the key offset in matrix pointed by KEYTAB cpy LSTX - beq scnkey_try_repeat // branch if the same key as previously + beq scnkey_try_repeat // branch if the same key as previously sty LSTX // Reset key repeat counters - see [CM64] page 58 @@ -252,7 +247,7 @@ scnkey_output_key: lda NDX cmp XMAX - bcs scnkey_early_repeat // no space in buffer + bcs scnkey_early_repeat // no space in buffer // Reinitialize secondary counter @@ -264,23 +259,22 @@ scnkey_output_key: #if CONFIG_KEYBOARD_C128 cpy #$40 - bcs !+ + bcc !+ - lda (KEYTAB), y // retrieve key code from standard matrix + lda kb_matrix_128 - $41, y // retrieve key code from C128 extended matrix jmp scnkey_got_petscii - !: - - lda kb_matrix_128 - $40, y // retrieve key code from C128 extended matrix + lda (KEYTAB), y // retrieve key code from standard matrix // XXX this will be needed for extended screen editor - // cmp KEY_TAB_FW // special handling for SHIFT+TAB + + // cmp KEY_TAB_FW // special handling for SHIFT+TAB // bne scnkey_got_petscii - // lda SHFLAG // special handling for SHIFT+TAB + // lda SHFLAG // special handling for SHIFT+TAB // and #KEY_FLAG_SHIFT // bne !+ // lda KEY_TAB_FW - // bne scnkey_got_petscii // branch alWAYS + // bne scnkey_got_petscii // branch alWAYS // !: // lda KEY_TAB_BW @@ -294,7 +288,7 @@ scnkey_output_key: scnkey_got_petscii: - beq scnkey_no_keys // branch if we have no PETSCII code for this key + beq scnkey_no_keys // branch if we have no PETSCII code for this key ldy NDX sta KEYD, y inc NDX @@ -312,7 +306,7 @@ scnkey_try_repeat: // Check whether we should repeat keys - first the flag, afterwards hardcoded list lda RPTFLG - bmi scnkey_handle_repeat // branch if we should repeat always + bmi scnkey_handle_repeat // branch if we should repeat always tya ldx #(__kb_matrix_alwaysrepeat_end - kb_matrix_alwaysrepeat - 1) @@ -338,7 +332,7 @@ scnkey_handle_repeat: // Countdown before subsequent repeats lda KOUNT - beq scnkey_output_key // if second counter is also 0, we can repeat the key + beq scnkey_output_key // if second counter is also 0, we can repeat the key dec KOUNT rts diff --git a/c64/kernal/keyboard/scnkey_128.s b/c64/kernal/keyboard/scnkey_128.s index a3e78d75..44f810d4 100644 --- a/c64/kernal/keyboard/scnkey_128.s +++ b/c64/kernal/keyboard/scnkey_128.s @@ -37,7 +37,7 @@ scnkey_matrix_128_loop_inner: tya // now .A contains key offset within a row clc adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start - adc #$40 // now .A contains fully normalized offset + adc #$41 // now .A contains offset after the standard matrix tay jmp scnkey_matrix_128_loop_next !: From 6e38c8a4b97f38c3aaca038cf463f8eadd5e2b0a Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 18 Oct 2019 19:11:30 +0200 Subject: [PATCH 62/85] added CAPS LOCK key support on C128 --- CONFIG.md | 10 ++++-- c64/,,config_generic.s | 1 + c64/,,config_mega65.s | 1 + c64/,,config_ultimate64.s | 1 + c64/aliases/,aliases_config.s | 13 +++++++ c64/aliases/,aliases_petscii_codes.s | 5 +-- c64/kernal/keyboard/scnkey.s | 52 ++++++++++++++++++++++++++-- 7 files changed, 76 insertions(+), 7 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index 3f385728..0817127b 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -113,13 +113,19 @@ Original keyboard support routine is just horrible. It does nothing to prevent g Uses old Open ROMs keyboard scanning routine, which is basically example routine by TWW/CTR, hacked to work within Kernal. It's greatest advantage is multi-key rollover, it's disadvantages - it's much less compatible (uses several bytes of memory which are normally free for user software - thus, it is considered legacy for now), does not support all the system variables (`RPTFLG` and `KEYLOG` are unsupported), and ignores the configuration options - this can be changed, but it requires some effort. -Needs 70-250 more space in KERNAL segment (depending on the features enabled for current default routine). If unsure - disable. +Needs 30-250 more space in KERNAL segment (depending on the features enabled for current default routine). If unsure - disable. ### `CONFIG_KEYBOARD_C128` Allows to use additional keys found on the C128 keyboard. NOTE: might be buggy, on VICE emulator I can't get all the keys working. -Needs about 125 bytes more space in KERNAL segment. If unsure - disable. +Needs about 130 bytes more space in KERNAL segment. If unsure - disable. + +### `CONFIG_KEYBOARD_C128_CAPS_LOCK` + +If C128 keyboard support is selected, allows to additionally support it's CAPS LOCK keys. Support is C64-safe (there is a protection against false-positive reading on the C64). + +Needs about 47 bytes more space in KERNAL segment. ### `CONFIG_KEY_REPEAT_DEFAULT` diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 9d1ac95e..5d062164 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -50,6 +50,7 @@ // #define CONFIG_LEGACY_SCNKEY #define CONFIG_KEYBOARD_C128 +// #define CONFIG_KEYBOARD_C128_CAPS_LOCK // #define CONFIG_KEY_REPEAT_DEFAULT #define CONFIG_KEY_REPEAT_ALWAYS #define CONFIG_KEY_FAST_SCAN diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index e293a8c4..086b2994 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -52,6 +52,7 @@ #define CONFIG_LEGACY_SCNKEY // #define CONFIG_KEYBOARD_C128 +// #define CONFIG_KEYBOARD_C128_CAPS_LOCK // #define CONFIG_KEY_REPEAT_DEFAULT // #define CONFIG_KEY_REPEAT_ALWAYS #define CONFIG_KEY_FAST_SCAN diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index 05f45f59..75b3f702 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -50,6 +50,7 @@ // #define CONFIG_LEGACY_SCNKEY // #define CONFIG_KEYBOARD_C128 +// #define CONFIG_KEYBOARD_C128_CAPS_LOCK // #define CONFIG_KEY_REPEAT_DEFAULT // #define CONFIG_KEY_REPEAT_ALWAYS #define CONFIG_KEY_FAST_SCAN diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index 29fadfed..0f8c30c0 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -115,6 +115,19 @@ +// Check if keyboard options are correct + +{ +#if CONFIG_LEGACY_SCNKEY && CONFIG_KEYBOARD_C128 + .error "CONFIG_LEGACY_SCNKEY and CONFIG_KEYBOARD_C128 are mutually exclusive" +#endif +#if CONFIG_KEYBOARD_C128_CAPS_LOCK && !CONFIG_KEYBOARD_C128 + .error "CONFIG_KEYBOARD_C128_CAPS_LOCK requires CONFIG_KEYBOARD_C128" +#endif +} + + + // Handle processor configuration #if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816 diff --git a/c64/aliases/,aliases_petscii_codes.s b/c64/aliases/,aliases_petscii_codes.s index 077944b4..c5152228 100644 --- a/c64/aliases/,aliases_petscii_codes.s +++ b/c64/aliases/,aliases_petscii_codes.s @@ -15,8 +15,9 @@ .const KEY_FLAG_SHIFT = %00000001 .const KEY_FLAG_VENDOR = %00000010 .const KEY_FLAG_CTRL = %00000100 -.const KEY_FLAG_ALT = %00001000 // C65 / C128 XXX implement this -.const KEY_FLAG_NO_SCRL = %00100000 // C65 / C128, Open ROMs unofficial XXX implement this +.const KEY_FLAG_ALT = %00001000 // C65 / C128 +.const KEY_CAPS_LOCK = %00010000 // C65 / C128 +.const KEY_FLAG_NO_SCRL = %00100000 // C65 / C128, Open ROMs unofficial // Note - the following PETSCII codes are currently unassigned, can be used for further extensions: diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 48f59a4b..4c0575ab 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -52,7 +52,26 @@ SCNKEY: #endif - // Retrieve SHIFT / VENDOR / CTRL status + // Retrieve SHIFT / VENDOR / CTRL / ALT / CAPS LOCK status + +#if CONFIG_KEYBOARD_C128_CAPS_LOCK + + // First check if this is really a C128 - to avoid false positive + lda #$00 + sta VIC_XSCAN + lda #$FF + cmp VIC_XSCAN + beq !+ // branch if C64, C128 will keep some bits cleared + + lda CPU_R6510 + and #$40 + bne !+ // branch if no CAPS LOCK + + lda #KEY_CAPS_LOCK + sta SHFLAG +!: + +#endif ldy #(__kb_matrix_bucky_confmask_end - kb_matrix_bucky_confmask - 1) scnkey_bucky_loop: @@ -269,14 +288,41 @@ scnkey_output_key: // XXX this will be needed for extended screen editor // cmp KEY_TAB_FW // special handling for SHIFT+TAB - // bne scnkey_got_petscii + // bne scnkey_got_petscii // XXX or to scnkey_handle_caps_lock // lda SHFLAG // special handling for SHIFT+TAB // and #KEY_FLAG_SHIFT // bne !+ // lda KEY_TAB_FW // bne scnkey_got_petscii // branch alWAYS // !: - // lda KEY_TAB_BW + // lda KEY_TAB_BW // bne scnkey_got_petscii if CAPS LOCK is handled + +#if CONFIG_KEYBOARD_C128_CAPS_LOCK + + // Check if we need special handling for a CAPS LOCK key + // This is shorter than a separate set of tables + +scnkey_handle_caps_lock: + + tax + lda SHFLAG + and #(%00000111 + KEY_CAPS_LOCK) + cmp #KEY_CAPS_LOCK + bne !+ // branch if no special CAPS LOCK handling needed + + cpx #$41 // 'A' + bcc !+ + cpx #$5B // 'Z' + 1 + bcs !+ + + txa + clc + adc #$20 // turn lowercase into uppercase + tax +!: + txa + +#endif // CONFIG_KEYBOARD_C128_CAPS_LOCK #else From 58daf2a553241d7da20898c071b2d46226b6c4fc Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 18 Oct 2019 19:22:21 +0200 Subject: [PATCH 63/85] more C128 keyboard support tweaks --- CONFIG.md | 4 ++-- c64/,,config_generic.s | 2 +- c64/aliases/,aliases_config.s | 3 --- c64/kernal/keyboard/scnkey.s | 16 ++++++++++++++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index 0817127b..d4c868e4 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -123,9 +123,9 @@ Needs about 130 bytes more space in KERNAL segment. If unsure - disable. ### `CONFIG_KEYBOARD_C128_CAPS_LOCK` -If C128 keyboard support is selected, allows to additionally support it's CAPS LOCK keys. Support is C64-safe (there is a protection against false-positive reading on the C64). +Allows to use CAPS LOCK key on the C128 keyboard, this is independent from `CONFIG_KEYBOARD_C128`. Support is C64-safe (there is a protection against false-positive reading on the C64). -Needs about 47 bytes more space in KERNAL segment. +Needs about 50 bytes more space in KERNAL segment. If unsure - disable. ### `CONFIG_KEY_REPEAT_DEFAULT` diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 5d062164..be1d0ccd 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -50,7 +50,7 @@ // #define CONFIG_LEGACY_SCNKEY #define CONFIG_KEYBOARD_C128 -// #define CONFIG_KEYBOARD_C128_CAPS_LOCK +#define CONFIG_KEYBOARD_C128_CAPS_LOCK // #define CONFIG_KEY_REPEAT_DEFAULT #define CONFIG_KEY_REPEAT_ALWAYS #define CONFIG_KEY_FAST_SCAN diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index 0f8c30c0..771b5df1 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -121,9 +121,6 @@ #if CONFIG_LEGACY_SCNKEY && CONFIG_KEYBOARD_C128 .error "CONFIG_LEGACY_SCNKEY and CONFIG_KEYBOARD_C128 are mutually exclusive" #endif -#if CONFIG_KEYBOARD_C128_CAPS_LOCK && !CONFIG_KEYBOARD_C128 - .error "CONFIG_KEYBOARD_C128_CAPS_LOCK requires CONFIG_KEYBOARD_C128" -#endif } diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 4c0575ab..e7c4d736 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -58,6 +58,9 @@ SCNKEY: // First check if this is really a C128 - to avoid false positive lda #$00 +#if !CONFIG_KEYBOARD_C128 + tax +#endif sta VIC_XSCAN lda #$FF cmp VIC_XSCAN @@ -71,6 +74,10 @@ SCNKEY: sta SHFLAG !: +#if !CONFIG_KEYBOARD_C128 + stx VIC_XSCAN // disconnect C128 keys if no C128 keyboard is supported +#endif + #endif ldy #(__kb_matrix_bucky_confmask_end - kb_matrix_bucky_confmask - 1) @@ -297,6 +304,8 @@ scnkey_output_key: // !: // lda KEY_TAB_BW // bne scnkey_got_petscii if CAPS LOCK is handled +#endif // CONFIG_KEYBOARD_C128_CAPS_LOCK + #if CONFIG_KEYBOARD_C128_CAPS_LOCK // Check if we need special handling for a CAPS LOCK key @@ -304,7 +313,10 @@ scnkey_output_key: scnkey_handle_caps_lock: - tax +#if !CONFIG_KEYBOARD_C128 + lda (KEYTAB), y +#endif + tax lda SHFLAG and #(%00000111 + KEY_CAPS_LOCK) cmp #KEY_CAPS_LOCK @@ -324,7 +336,7 @@ scnkey_handle_caps_lock: #endif // CONFIG_KEYBOARD_C128_CAPS_LOCK -#else +#if !CONFIG_KEYBOARD_C128 && !CONFIG_KEYBOARD_C128_CAPS_LOCK lda (KEYTAB), y From 5f7c21fdac53d288a0bda015c2b6802816508331 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 18 Oct 2019 19:29:26 +0200 Subject: [PATCH 64/85] one more C128 keyboard fix --- c64/kernal/keyboard/scnkey.s | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index e7c4d736..821abfa1 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -58,11 +58,11 @@ SCNKEY: // First check if this is really a C128 - to avoid false positive lda #$00 -#if !CONFIG_KEYBOARD_C128 - tax -#endif sta VIC_XSCAN lda #$FF +#if !CONFIG_KEYBOARD_C128 + tax // preserve the $FF, will be needed later +#endif cmp VIC_XSCAN beq !+ // branch if C64, C128 will keep some bits cleared From abc669d76130ce4588178fa78f31049ab62c644f Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 18 Oct 2019 21:24:08 +0200 Subject: [PATCH 65/85] improved VIC II initialization --- c64/kernal/init/e5a0.setup_vicii.s | 46 ++++++++++++++++----- c64/kernal/{ => screen}/e544.clear_screen.s | 0 c64/kernal/{ => screen}/screen.s | 0 3 files changed, 36 insertions(+), 10 deletions(-) rename c64/kernal/{ => screen}/e544.clear_screen.s (100%) rename c64/kernal/{ => screen}/screen.s (100%) diff --git a/c64/kernal/init/e5a0.setup_vicii.s b/c64/kernal/init/e5a0.setup_vicii.s index 7345dbc4..2f8c321a 100644 --- a/c64/kernal/init/e5a0.setup_vicii.s +++ b/c64/kernal/init/e5a0.setup_vicii.s @@ -1,22 +1,48 @@ setup_vicii: - // XXX there is more to setup within this routine + // XXX it should also set default devices - // Set up default IO values (Compute's Mapping the 64 p215) - lda #$1B // Enable text mode + // Clear everything - turn off sprites (observed hanging around after + // running programs and resetting), etc. + + lda #$00 + ldx #$2E + !: + sta __VIC_BASE, x + dex + bpl !- + + // Disable C128 extra keys - just to be sure they won't interfere with anything + + stx VIC_XSCAN + + // Disable the C128 2MHz mode, it prevents VIC-II display from working correctly + + stx VIC_CLKRATE + + // Set up default IO values - Compute's Mapping the 64 + // - page 129 - VIC_SCROLY + // - pages 140-144 - VIC_SCROLX + // - pages 145-146 - VIC_YMCSB + + lda #$9B sta VIC_SCROLY - lda #$C8 // 40 column etc - sta VIC_SCROLX + lda #$C8 + sta VIC_SCROLX // 40 column etc + lda #$14 + sta VIC_YMCSB + lda #$0F + sta VIC_IRQ // clear all interrupts + + + // XXX initialize $D012 (VIC_RASTER) - which values to use? + - // Compute's Mapping the 64, p156 // We use a different colour scheme of white text on all blue + lda #$06 sta VIC_EXTCOL sta VIC_BGCOL0 - // Turn off sprites (observed hanging around after running programs and resetting) - lda #$00 - sta VIC_SPENA - rts diff --git a/c64/kernal/e544.clear_screen.s b/c64/kernal/screen/e544.clear_screen.s similarity index 100% rename from c64/kernal/e544.clear_screen.s rename to c64/kernal/screen/e544.clear_screen.s diff --git a/c64/kernal/screen.s b/c64/kernal/screen/screen.s similarity index 100% rename from c64/kernal/screen.s rename to c64/kernal/screen/screen.s From d6f4f80e89fcbb5b39a79c866228818c71f34ee5 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 18 Oct 2019 21:33:11 +0200 Subject: [PATCH 66/85] configuration cleanup --- CONFIG.md | 12 ++++++------ c64/,,config_generic.s | 10 +++++----- c64/,,config_mega65.s | 8 ++++---- c64/,,config_ultimate64.s | 8 ++++---- c64/aliases/,aliases_config.s | 28 ++++++++++++++-------------- c64/basic/init/initmsg_real.s | 2 +- c64/basic/init/startup_banner.s | 8 ++++---- 7 files changed, 38 insertions(+), 38 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index d4c868e4..a4a983a5 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -11,7 +11,7 @@ Just edit them and recompile the project. To enable particular option - uncommen Note however, that features do not came for free - enabling them needs some additional ROM space (in BASIC segment, in KERNAL segment, or in both), which is VERY limited on the target machines. Some options might be unavailable for speecific targets - read the comments in the configuration files. Some options might also carry compatibility and/or performance hit - so choose wisely. -## Hardware platform and variant +## Hardware platform and brand ### `CONFIG_PLATFORM_COMMODORE_64` @@ -23,11 +23,11 @@ Since Open ROMs is highly modular, it should be possible to add other platforms * 8KB ROM area `$A000`-`$BFFF` * 8KB ROM area `$E000`-`$FFFF` -### `CONFIG_VARIANT_GENERIC` +### `CONFIG_BRAND_GENERIC` If you don't know which variant to choose - select this one. -### `CONFIG_VARIANT_MEGA_65`, `CONFIG_VARIANT_ULTIMATE_64` +### `CONFIG_BRAND_MEGA_65`, `CONFIG_BRAND_ULTIMATE_64` Select if you are using appropriate motherboard. @@ -153,11 +153,11 @@ Needs about 65 bytes of ROM space to handle both joysticks. ## Eye candy -### `CONFIG_BANNER_SIMPLE`, `CONFIG_BANNER_FANCY`, `CONFIG_BANNER_VARIANT` +### `CONFIG_BANNER_SIMPLE`, `CONFIG_BANNER_FANCY`, `CONFIG_BANNER_BRAND` -Select startup banner - either a simple one, or with some colorful elements. `CONFIG_BANNER_VARIANT` heavily depends on the selected hardware target, not all targets support it. +Select startup banner - either a simple one, or with some colorful elements. `CONFIG_BANNER_BRAND` heavily depends on the selected brand, not all the brands support it. -Richer banners need more BASIC segment, varies between hardware variants. +Richer banners need more BASIC segment, varies between brands. ### `CONFIG_BANNER_PAL_NTSC` diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index be1d0ccd..c0d78dc1 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -10,13 +10,13 @@ // - do not enable features which are a significant compatibility risk -// Hardware platform and variant +// Hardware platform and brand #define CONFIG_PLATFORM_COMMODORE_64 -#define CONFIG_VARIANT_GENERIC -// #define CONFIG_VARIANT_MEGA_65 -// #define CONFIG_VARIANT_ULTIMATE_64 +#define CONFIG_BRAND_GENERIC +// #define CONFIG_BRAND_MEGA_65 +// #define CONFIG_BRAND_ULTIMATE_64 // Processor instruction set @@ -62,7 +62,7 @@ // #define CONFIG_BANNER_SIMPLE #define CONFIG_BANNER_FANCY -// #define CONFIG_BANNER_VARIANT +// #define CONFIG_BANNER_BRAND #define CONFIG_SHOW_PAL_NTSC diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 086b2994..1d3886a3 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -12,13 +12,13 @@ // do not enable CPU-specific optimizations; ROMs would be hard to test -// Hardware platform and variant +// Hardware platform and brand #define CONFIG_PLATFORM_COMMODORE_64 -// #define CONFIG_VARIANT_GENERIC -#define CONFIG_VARIANT_MEGA_65 -// #define CONFIG_VARIANT_ULTIMATE_64 +// #define CONFIG_BRAND_GENERIC +#define CONFIG_BRAND_MEGA_65 +// #define CONFIG_BRAND_ULTIMATE_64 // Processor instruction set diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index 75b3f702..d375a0c6 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -10,13 +10,13 @@ // - do not enable features which are a significant compatibility risk -// Hardware platform and variant +// Hardware platform and brand #define CONFIG_PLATFORM_COMMODORE_64 -// #define CONFIG_VARIANT_GENERIC -// #define CONFIG_VARIANT_MEGA_65 -#define CONFIG_VARIANT_ULTIMATE_64 +// #define CONFIG_BRAND_GENERIC +// #define CONFIG_BRAND_MEGA_65 +#define CONFIG_BRAND_ULTIMATE_64 // Processor instruction set diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index 771b5df1..67fd5679 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -19,28 +19,28 @@ -// Check that platform variant configuration is correct +// Check that platform and brand configuration is correct { .var selected = 0; -#if CONFIG_VARIANT_GENERIC +#if CONFIG_BRAND_GENERIC .eval selected++ #endif -#if CONFIG_VARIANT_MEGA_65 +#if CONFIG_BRAND_MEGA_65 .eval selected++ #endif -#if CONFIG_VARIANT_ULTIMATE_64 +#if CONFIG_BRAND_ULTIMATE_64 .eval selected++ #endif - .if (selected != 1) .error "Please select exactly one CONFIG_VARIANT_* option" + .if (selected != 1) .error "Please select exactly one CONFIG_BRAND_* option" -#if !CONFIG_PLATFORM_COMMODORE_64 && CONFIG_VARIANT_MEGA_65 && - .error "CONFIG_VARIANT_MEGA_65 can only be used with CONFIG_PLATFORM_COMMODORE_64" +#if !CONFIG_PLATFORM_COMMODORE_64 && CONFIG_BRAND_MEGA_65 && + .error "CONFIG_BRAND_MEGA_65 can only be used with CONFIG_PLATFORM_COMMODORE_64" #endif -#if !CONFIG_PLATFORM_COMMODORE_64 && CONFIG_VARIANT_ULTIMATE_64 && - .error "CONFIG_VARIANT_ULTIMATE_64 can only be used with CONFIG_PLATFORM_COMMODORE_64" +#if !CONFIG_PLATFORM_COMMODORE_64 && CONFIG_BRAND_ULTIMATE_64 && + .error "CONFIG_BRAND_ULTIMATE_64 can only be used with CONFIG_PLATFORM_COMMODORE_64" #endif } @@ -97,18 +97,18 @@ #if CONFIG_BANNER_FANCY .eval selected++ #endif -#if CONFIG_BANNER_VARIANT +#if CONFIG_BANNER_BRAND .eval selected++ #endif .if (selected != 1) .error "Please select exactly one CONFIG_MEMORY_MODEL_* option" -#if CONFIG_BANNER_VARIANT && !CONFIG_VARIANT_MEGA_65 - .error "CONFIG_BANNER_VARIANT is not supported for your CONFIG_VARIANT_*" +#if CONFIG_BANNER_BRAND && !CONFIG_BRAND_MEGA_65 + .error "CONFIG_BANNER_BRAND is not supported for your CONFIG_BRAND_*" #endif -#if CONFIG_BANNER_VARIANT && CONFIG_VARIANT_MEGA_65 && CONFIG_SHOW_PAL_NTSC - .error "MEGA65 variant banner does not support showing PAL/NTSC" +#if CONFIG_BANNER_BRAND && CONFIG_BRAND_MEGA_65 && CONFIG_SHOW_PAL_NTSC + .error "MEGA65 brand banner does not support showing PAL/NTSC" #endif } diff --git a/c64/basic/init/initmsg_real.s b/c64/basic/init/initmsg_real.s index a2dbc0a7..169a8cd3 100644 --- a/c64/basic/init/initmsg_real.s +++ b/c64/basic/init/initmsg_real.s @@ -72,7 +72,7 @@ initmsg_real: ldy #$00 jmp plot_set -#elif CONFIG_BANNER_VARIANT && CONFIG_VARIANT_MEGA_65 +#elif CONFIG_BANNER_BRAND && CONFIG_BRAND_MEGA_65 lda #startup_banner diff --git a/c64/basic/init/startup_banner.s b/c64/basic/init/startup_banner.s index 9f8f4e6c..5443ef47 100644 --- a/c64/basic/init/startup_banner.s +++ b/c64/basic/init/startup_banner.s @@ -6,11 +6,11 @@ .macro BANNER_TEXT() { -#if CONFIG_VARIANT_GENERIC +#if CONFIG_BRAND_GENERIC .text "OPEN ROMS GENERIC BUILD" -#elif CONFIG_VARIANT_MEGA_65 +#elif CONFIG_BRAND_MEGA_65 .text "OPEN ROMS FOR MEGA65" -#elif CONFIG_VARIANT_ULTIMATE_64 +#elif CONFIG_BRAND_ULTIMATE_64 .text "OPEN ROMS FOR ULTIMATE 64" #endif @@ -42,7 +42,7 @@ pre_revision_string: .text "RELEASE " .byte $00 -#elif CONFIG_BANNER_VARIANT && CONFIG_VARIANT_MEGA_65 +#elif CONFIG_BANNER_BRAND && CONFIG_BRAND_MEGA_65 // Fancy Mega65 banner - from Retrofan .byte $9a, $12, $20, $20, $7f, $a9, $20, $20, $1f, $20, $9a, $20, $20, $20 From 41264c9300324e6e9217b4d99885f31f30665ce2 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 18 Oct 2019 22:06:40 +0200 Subject: [PATCH 67/85] compilation fix --- c64/,,config_mega65.s | 2 +- c64/,,config_ultimate64.s | 2 +- c64/aliases/,aliases_config.s | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 1d3886a3..6ffc2998 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -64,7 +64,7 @@ // #define CONFIG_BANNER_SIMPLE // #define CONFIG_BANNER_FANCY -#define CONFIG_BANNER_VARIANT +#define CONFIG_BANNER_BRAND // #define CONFIG_SHOW_PAL_NTSC diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index d375a0c6..dca7299a 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -62,7 +62,7 @@ // #define CONFIG_BANNER_SIMPLE #define CONFIG_BANNER_FANCY -// #define CONFIG_BANNER_VARIANT +// #define CONFIG_BANNER_BRAND #define CONFIG_SHOW_PAL_NTSC diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index 67fd5679..1e84c2a9 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -101,7 +101,7 @@ .eval selected++ #endif - .if (selected != 1) .error "Please select exactly one CONFIG_MEMORY_MODEL_* option" + .if (selected != 1) .error "Please select exactly one CONFIG_BANNER_* option" #if CONFIG_BANNER_BRAND && !CONFIG_BRAND_MEGA_65 .error "CONFIG_BANNER_BRAND is not supported for your CONFIG_BRAND_*" From ae4b6acc557b19eb4e15aaa8d51a5b53d0eea689 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 18 Oct 2019 22:35:46 +0200 Subject: [PATCH 68/85] further work on release tool --- .../rom_revision/bf52.rom_revision_basic.s | 2 + .../rom_revision/e4b7.rom_revision_kernal.s | 2 + src/release.cc | 182 +++++++++++++++--- 3 files changed, 161 insertions(+), 25 deletions(-) diff --git a/c64/basic/rom_revision/bf52.rom_revision_basic.s b/c64/basic/rom_revision/bf52.rom_revision_basic.s index 9281af14..30c9e65d 100644 --- a/c64/basic/rom_revision/bf52.rom_revision_basic.s +++ b/c64/basic/rom_revision/bf52.rom_revision_basic.s @@ -19,6 +19,8 @@ rom_revision_basic: rom_revision_basic_string: + // $BF55 + .text "(DEVEL SNAPSHOT)" // actual ROM revision string; up to 16 characters .byte $00 // marks the end of string diff --git a/c64/basic/rom_revision/e4b7.rom_revision_kernal.s b/c64/basic/rom_revision/e4b7.rom_revision_kernal.s index f3c7f34d..996baeec 100644 --- a/c64/basic/rom_revision/e4b7.rom_revision_kernal.s +++ b/c64/basic/rom_revision/e4b7.rom_revision_kernal.s @@ -33,6 +33,8 @@ rom_revision_kernal: rom_revision_kernal_string: + // $E4BC + .text "(DEVEL SNAPSHOT)" // actual ROM revision string; up to 16 characters .byte $00 // marks the end of string diff --git a/src/release.cc b/src/release.cc index cd3c466e..bb5e9c46 100644 --- a/src/release.cc +++ b/src/release.cc @@ -6,10 +6,21 @@ #include "common.h" #include +#include #include #include +#include +#include +#include #include +#include + +const std::vector STR_MEGABAS = { 0x4D, 0x45, 0x47, 0x41, 0x42, 0x41, 0x53, 0x32 }; +const std::vector STR_OR = { 0x4F, 0x52 }; +const std::vector STR_SNAPSHOT = { 0x28, 0x44, 0x45, 0x56, 0x45, 0x4C, 0x20, 0x53, + 0x4E, 0x41, 0x50, 0x53, 0x48, 0x4F, 0x54, 0x29, + 0x00 }; // // Command and enviroment line settings @@ -21,6 +32,7 @@ std::string CMD_outDir = "./bin"; std::list CMD_fileList; std::string ENV_developerId; +std::string ENV_timeString; // // Common helper functions @@ -33,6 +45,44 @@ void printUsage() " " << "\n\n"; } +// +// Class definitions +// + +enum class ROMType +{ + ROM_UNKNOWN, + ROM_BASIC, + ROM_KERNAL +}; + +class ROMFile +{ +public: + + ROMFile(const std::string &baseFileName); + +private: + + void readSrcFile(); + void readDstFile(); + + void recognizeFiles(); + + std::string baseFileName; + + std::vector srcFileContent; + std::vector dstFileContent; + + ROMType romType; +}; + +// +// Global variables +// + +std::list GLOBAL_ROMFiles; + // // Top-level functions // @@ -63,7 +113,7 @@ void parseCommandLine(int argc, char **argv) if (CMD_fileList.empty()) { printUsage(); ERROR("empty file list"); } } -void getEnvironmentSettings() +void getDeveloperId() { const char* id = getenv("OPEN_ROMS_DEVELOPER_ID"); @@ -90,16 +140,35 @@ void getEnvironmentSettings() } } +void getDate() +{ + time_t t = time(NULL); + struct tm tm = *localtime(&t); + + const std::string year = std::to_string(tm.tm_year % 100); + const std::string month = std::to_string(tm.tm_mon + 1); + const std::string day = std::to_string(tm.tm_mday); + + const std::string zero = "0"; + + + ENV_timeString = (year.size() == 2 ? year : zero + year) + + (month.size() == 2 ? month : zero + month) + + (day.size() == 2 ? day : zero + day); + + if (ENV_timeString.size() != 6) ERROR("could not retrieve date"); +} + void printBanner() { printBannerLineTop(); - std::cout << "// Preparing ROM set release by '" << ENV_developerId << "'\n"; + std::cout << "// Preparing ROM set release " << ENV_timeString << "-" << ENV_developerId << "\n"; printBannerLineBottom(); } void readFiles() { - // XXX + for (auto &fileName : CMD_fileList) GLOBAL_ROMFiles.push_back(ROMFile(fileName)); } void embedVersionString() @@ -112,24 +181,6 @@ void writeFiles() // XXX } -// -// Class definitions -// - -class ROMFile -{ -public: - - ROMFile(const std::string &baseFileName); - -private: - - std::string baseFileName; - - std::vector srcFile; - std::vector dstFile; -} - // // Main function // @@ -137,7 +188,8 @@ private: int main(int argc, char **argv) { parseCommandLine(argc, argv); - getEnvironmentSettings(); + getDeveloperId(); + getDate(); printBanner(); @@ -145,17 +197,97 @@ int main(int argc, char **argv) embedVersionString(); writeFiles(); - ERROR("This tool is not finished yet"); + std::cout << "\n\nXXX This tool is not finished yet\n\n"; - return 0; + return 1; } // // Class 'ROMFile' // -ROMFile::ROMFile(const std::string &baseFileName) +ROMFile::ROMFile(const std::string &baseFileName) : + baseFileName(baseFileName), + romType(ROMType::ROM_UNKNOWN) { + readSrcFile(); + readDstFile(); + + recognizeFiles(); +} + +void ROMFile::readSrcFile() +{ + // Read the source file + + const std::string srcFileNamePath = CMD_inDir + DIR_SEPARATOR + baseFileName; + + std::ifstream srcFile; + srcFile.open(srcFileNamePath, std::ios::in | std::ios::binary | std::ios::ate); + + if (!srcFile.good()) ERROR(std::string("unable to open ROM file '") + srcFileNamePath + "'"); + + auto srcSize = srcFile.tellg(); + if (srcSize != 8192) ERROR(std::string("incorrect size of ROM file '") + srcFileNamePath + "'"); + + srcFileContent.resize(8192); + srcFile.seekg (0, srcFile.beg); + srcFile.read((char *) srcFileContent.data(), srcFileContent.size()); + + if (!srcFile.good()) ERROR(std::string("unable to read ROM file '") + srcFileNamePath + "'"); + srcFile.close(); +} + +void ROMFile::readDstFile() +{ + // Read the destination file (if exists and it's size matches) + + const std::string dstFileNamePath = CMD_outDir + DIR_SEPARATOR + baseFileName; + + std::ifstream dstFile; + dstFile.open(dstFileNamePath, std::ios::in | std::ios::binary | std::ios::ate); + + bool continueReading = dstFile.good(); + + if (continueReading && dstFile.tellg() != 8192) continueReading = false; + + if (continueReading) + { + dstFileContent.resize(8192); + dstFile.seekg (0, dstFile.beg); + dstFile.read((char *) dstFileContent.data(), dstFileContent.size()); + } + + if (!dstFile.good()) dstFileContent.resize(0); + dstFile.close(); +} + +void ROMFile::recognizeFiles() +{ + // Recognize source file type + + std::cout << baseFileName << " "; + + if ((memcmp(&srcFileContent[0x0004], STR_MEGABAS.data(), STR_MEGABAS.size()) == 0) && + (memcmp(&srcFileContent[0x1F52], STR_OR.data(), STR_OR.size()) == 0) && + (memcmp(&srcFileContent[0x1F55], STR_SNAPSHOT.data(), STR_SNAPSHOT.size()) == 0)) + { + romType = ROMType::ROM_BASIC; + } + else if (srcFileContent[0x1F80] == 0xF0 && + (memcmp(&srcFileContent[0x04B9], STR_OR.data(), STR_OR.size()) == 0) && + (memcmp(&srcFileContent[0x04BC], STR_SNAPSHOT.data(), STR_SNAPSHOT.size()) == 0)) + { + romType = ROMType::ROM_KERNAL; + } + else + { + ERROR(std::string("'") + CMD_inDir + DIR_SEPARATOR + baseFileName + + "' is not a supported unversioned Open ROMs image"); + } + // XXX + std::cout << baseFileName << " "; + std::cout << "\n"; } From fd434c3f682196cc7874807952017b89a7faf810 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 19 Oct 2019 12:50:57 +0200 Subject: [PATCH 69/85] release tool finished --- Makefile | 9 +- src/release.cc | 340 ++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 294 insertions(+), 55 deletions(-) diff --git a/Makefile b/Makefile index 4e92e5e0..74544f9b 100644 --- a/Makefile +++ b/Makefile @@ -68,14 +68,9 @@ all: $(STD_TARGET_LIST) $(EXT_TARGET_LIST) clean: @rm -rf build -updatebin: $(STD_TARGET_LIST) $(STD_TOOL_RELEASE) +updatebin: $(STD_TARGET_LIST) $(TOOL_RELEASE) + $(TOOL_RELEASE) -i ./build -o ./bin basic_generic.rom kernal_generic.rom basic_mega65.rom kernal_mega65.rom basic_ultimate64.rom kernal_ultimate64.rom cp build/chargen.rom bin/chargen.rom - cp build/basic_generic.rom bin/basic_generic.rom - cp build/kernal_generic.rom bin/kernal_generic.rom - cp build/basic_mega65.rom bin/basic_mega65.rom - cp build/kernal_mega65.rom bin/kernal_mega65.rom - cp build/basic_ultimate64.rom bin/basic_ultimate64.rom - cp build/kernal_ultimate64.rom bin/kernal_ultimate64.rom # Rules - tools diff --git a/src/release.cc b/src/release.cc index bb5e9c46..b812aa5e 100644 --- a/src/release.cc +++ b/src/release.cc @@ -16,12 +16,45 @@ #include #include +typedef struct +{ + std::string romTypeName; + size_t fileSize; + size_t signatureOffset; // offset to 'OR' string + bool requireIdBASIC; + bool requireIdKERNAL; + +} ROMTypeDescriptionEntry; + +const std::vector ROM_DEFINITIONS = +{ + { + "BASIC", + 8192, // file size + 0x1F52, // signature offset + true, // whether to require BASIC ID + false // whether to require KERNAL ID + }, + + { + "KERNAL", + 8192, // file size + 0x04B9, // signature offset + false, // whether to require BASIC ID + false // whether to require KERNAL ID + }, +}; + +const uint16_t MAX_FILE_SIZE = 8192; + const std::vector STR_MEGABAS = { 0x4D, 0x45, 0x47, 0x41, 0x42, 0x41, 0x53, 0x32 }; const std::vector STR_OR = { 0x4F, 0x52 }; const std::vector STR_SNAPSHOT = { 0x28, 0x44, 0x45, 0x56, 0x45, 0x4C, 0x20, 0x53, 0x4E, 0x41, 0x50, 0x53, 0x48, 0x4F, 0x54, 0x29, 0x00 }; +const std::string STR_DEV = "DEV."; + // // Command and enviroment line settings // @@ -32,7 +65,7 @@ std::string CMD_outDir = "./bin"; std::list CMD_fileList; std::string ENV_developerId; -std::string ENV_timeString; +std::string ENV_dateString; // // Common helper functions @@ -49,38 +82,42 @@ void printUsage() // Class definitions // -enum class ROMType -{ - ROM_UNKNOWN, - ROM_BASIC, - ROM_KERNAL -}; - class ROMFile { public: ROMFile(const std::string &baseFileName); + void embedRevisionStr(const std::string &newRevisionStr); + void save(); + + const ROMTypeDescriptionEntry *descPtr; + + bool sameContent; + bool sameDeveloper; + bool sameDate; // only set if sameDeveloper + uint8_t oldDailyRelId; // only set if sameDeveloper and sameDate + private: void readSrcFile(); void readDstFile(); - void recognizeFiles(); + void recognizeSrcFile(); + void dropUnmatchingDst(); + void analyzeContent(); std::string baseFileName; std::vector srcFileContent; std::vector dstFileContent; - - ROMType romType; }; // // Global variables // +size_t GLOBAL_maxFileNameLen = 0; std::list GLOBAL_ROMFiles; // @@ -151,18 +188,17 @@ void getDate() const std::string zero = "0"; - - ENV_timeString = (year.size() == 2 ? year : zero + year) + + ENV_dateString = (year.size() == 2 ? year : zero + year) + (month.size() == 2 ? month : zero + month) + - (day.size() == 2 ? day : zero + day); + (day.size() == 2 ? day : zero + day); - if (ENV_timeString.size() != 6) ERROR("could not retrieve date"); + if (ENV_dateString.size() != 6) ERROR("could not retrieve date"); } void printBanner() { printBannerLineTop(); - std::cout << "// Preparing ROM set release " << ENV_timeString << "-" << ENV_developerId << "\n"; + std::cout << "// Preparing ROM set release" << "\n"; printBannerLineBottom(); } @@ -171,14 +207,69 @@ void readFiles() for (auto &fileName : CMD_fileList) GLOBAL_ROMFiles.push_back(ROMFile(fileName)); } -void embedVersionString() +void decideIfUpdate() { - // XXX + // Check if we have any file at all + + if (GLOBAL_ROMFiles.empty()) + { + ERROR("no files to update"); + } + + // Check if we have at least one file with changed content + + bool sameContent = true; + for (auto &file : GLOBAL_ROMFiles) + { + if (!file.sameContent) + { + sameContent = false; + break; + } + } + + if (sameContent) + { + ERROR("same content in all the files"); + } } -void writeFiles() +void saveFiles() { - // XXX + // Determine a daily revision sequence ID + + uint8_t relId = 0; + for (auto &file : GLOBAL_ROMFiles) + { + if (file.sameDeveloper && file.sameDate) + { + relId = std::max(file.oldDailyRelId, relId); + } + } + relId++; + + if (relId > 9) + { + ERROR("too many releases this day"); + } + + // Create a new revision string + + const std::string newRevStr = STR_DEV + ENV_dateString + "." + ENV_developerId + "." + std::to_string(relId); + + for (auto &file : GLOBAL_ROMFiles) + { + file.embedRevisionStr(newRevStr); + } + + std::cout << "Files for release '" << newRevStr << "':\n\n"; + + // Save the files + + for (auto &file : GLOBAL_ROMFiles) + { + file.save(); + } } // @@ -194,12 +285,12 @@ int main(int argc, char **argv) printBanner(); readFiles(); - embedVersionString(); - writeFiles(); + decideIfUpdate(); + saveFiles(); - std::cout << "\n\nXXX This tool is not finished yet\n\n"; + std::cout << "\n"; - return 1; + return 0; } // @@ -207,13 +298,21 @@ int main(int argc, char **argv) // ROMFile::ROMFile(const std::string &baseFileName) : - baseFileName(baseFileName), - romType(ROMType::ROM_UNKNOWN) + descPtr(nullptr), + sameContent(false), + sameDeveloper(false), + sameDate(false), + oldDailyRelId(0), + baseFileName(baseFileName) { + GLOBAL_maxFileNameLen = std::max(GLOBAL_maxFileNameLen, baseFileName.length()); + readSrcFile(); readDstFile(); - recognizeFiles(); + recognizeSrcFile(); + dropUnmatchingDst(); + analyzeContent(); } void ROMFile::readSrcFile() @@ -228,9 +327,9 @@ void ROMFile::readSrcFile() if (!srcFile.good()) ERROR(std::string("unable to open ROM file '") + srcFileNamePath + "'"); auto srcSize = srcFile.tellg(); - if (srcSize != 8192) ERROR(std::string("incorrect size of ROM file '") + srcFileNamePath + "'"); + if (srcSize > MAX_FILE_SIZE) ERROR(std::string("incorrect size of ROM file '") + srcFileNamePath + "'"); - srcFileContent.resize(8192); + srcFileContent.resize(srcSize); srcFile.seekg (0, srcFile.beg); srcFile.read((char *) srcFileContent.data(), srcFileContent.size()); @@ -249,45 +348,190 @@ void ROMFile::readDstFile() bool continueReading = dstFile.good(); - if (continueReading && dstFile.tellg() != 8192) continueReading = false; + if (continueReading && dstFile.tellg() != unsigned(srcFileContent.size())) continueReading = false; if (continueReading) { - dstFileContent.resize(8192); + dstFileContent.resize(srcFileContent.size()); dstFile.seekg (0, dstFile.beg); dstFile.read((char *) dstFileContent.data(), dstFileContent.size()); } - if (!dstFile.good()) dstFileContent.resize(0); + if (!dstFile.good()) dstFileContent.clear(); dstFile.close(); } -void ROMFile::recognizeFiles() +void ROMFile::recognizeSrcFile() { // Recognize source file type - std::cout << baseFileName << " "; + for (auto &SPEC : ROM_DEFINITIONS) + { + if (srcFileContent.size() != SPEC.fileSize) continue; - if ((memcmp(&srcFileContent[0x0004], STR_MEGABAS.data(), STR_MEGABAS.size()) == 0) && - (memcmp(&srcFileContent[0x1F52], STR_OR.data(), STR_OR.size()) == 0) && - (memcmp(&srcFileContent[0x1F55], STR_SNAPSHOT.data(), STR_SNAPSHOT.size()) == 0)) - { - romType = ROMType::ROM_BASIC; + if (SPEC.requireIdBASIC && memcmp(&srcFileContent[0x0004], STR_MEGABAS.data(), STR_MEGABAS.size()) != 0) + { + continue; + } + + if (SPEC.requireIdKERNAL && srcFileContent[0x1F80] != 0xF0) + { + continue; + } + + if (memcmp(&srcFileContent[SPEC.signatureOffset], STR_OR.data(), STR_OR.size()) != 0) + { + continue; + } + + auto snapshotStrOffset = SPEC.signatureOffset + STR_OR.size() + 1; + if (memcmp(&srcFileContent[snapshotStrOffset], STR_SNAPSHOT.data(), STR_SNAPSHOT.size()) != 0) + { + continue; + } + + auto zeroByteoffset = snapshotStrOffset + 0x10; + if (srcFileContent[zeroByteoffset] != 0) + { + continue; + } + + descPtr = &SPEC; + break; } - else if (srcFileContent[0x1F80] == 0xF0 && - (memcmp(&srcFileContent[0x04B9], STR_OR.data(), STR_OR.size()) == 0) && - (memcmp(&srcFileContent[0x04BC], STR_SNAPSHOT.data(), STR_SNAPSHOT.size()) == 0)) - { - romType = ROMType::ROM_KERNAL; - } - else + + if (descPtr == nullptr) { ERROR(std::string("'") + CMD_inDir + DIR_SEPARATOR + baseFileName + "' is not a supported unversioned Open ROMs image"); } +} - // XXX +void ROMFile::dropUnmatchingDst() +{ + // Drop unmatching destination file data - std::cout << baseFileName << " "; + if (!dstFileContent.empty() && descPtr->requireIdBASIC && + memcmp(&dstFileContent[0x0004], STR_MEGABAS.data(), STR_MEGABAS.size()) != 0) + { + dstFileContent.clear(); + } + + if (!dstFileContent.empty() && descPtr->requireIdKERNAL && dstFileContent[0x1F80] != 0xF0) + { + dstFileContent.clear(); + } + + if (!dstFileContent.empty() && + memcmp(&dstFileContent[descPtr->signatureOffset], STR_OR.data(), STR_OR.size()) != 0) + { + dstFileContent.clear(); + } +} + +void ROMFile::analyzeContent() +{ + auto revOffset = descPtr->signatureOffset + 3; + + if (dstFileContent.empty()) + { + return; + } + + // Check if meaningful file content is really different + + if ((memcmp(&srcFileContent[0x0000], &dstFileContent[0x0000], revOffset) == 0) && + (memcmp(&srcFileContent[revOffset + 0x10], &dstFileContent[revOffset + 0x10], 8192 - revOffset) == 0)) + { + sameContent = true; + } + + // Determine expected length of developer ID + + uint8_t devIdLen = ENV_developerId.length(); + + // Determine if old version is a devel version compatible with this tool + + if (memcmp(&dstFileContent[revOffset], STR_DEV.data(), STR_DEV.size()) != 0) + { + return; + } + + uint16_t idxDate = revOffset + STR_DEV.size(); + uint16_t idxLimit = idxDate + ENV_dateString.length(); + + uint16_t idx = idxDate; + for (; idx < idxLimit; idx++) + { + if (dstFileContent[idx] < '0' || dstFileContent[idx] > '9') + { + return; + } + } + + if (dstFileContent[idx] != '.' || + dstFileContent[idx + devIdLen + 1] != '.' || + dstFileContent[idx + devIdLen + 2] < '0' || + dstFileContent[idx + devIdLen + 2] > '9' || + dstFileContent[idx + devIdLen + 3] != 0) + { + return; + } + + // Retrieve release data + + if (memcmp(&dstFileContent[idx + 1], ENV_developerId.data(), ENV_developerId.size()) != 0) + { + return; // different developer + } + + sameDeveloper = true; + + if (memcmp(&dstFileContent[idxDate], ENV_dateString.data(), ENV_dateString.size()) != 0) + { + return; // different date + } + + sameDate = true; + oldDailyRelId = dstFileContent[idx + devIdLen + 2] - '0'; +} + +void ROMFile::embedRevisionStr(const std::string &newRevisionStr) +{ + std::string revStr = newRevisionStr; + + while (revStr.length() < 16) revStr = revStr + '\0'; + + memcpy(&srcFileContent[descPtr->signatureOffset + 3], + revStr.data(), revStr.size()); +} + +void ROMFile::save() +{ + const std::string outFileNamePath = CMD_outDir + DIR_SEPARATOR + baseFileName; + + // Print out file name and metadata + + std::string spacing; + spacing.resize(GLOBAL_maxFileNameLen + 4 - baseFileName.length(), ' '); + + std::cout << " " << outFileNamePath << spacing << descPtr->romTypeName; + + if (sameContent) + { + spacing.resize(10 - descPtr->romTypeName.length()); + std::cout << spacing << "(unchanged)"; + } + std::cout << "\n"; + + std::ofstream outFile; + outFile.open(outFileNamePath, std::ios::out | std::ios::binary | std::ios::trunc); + + if (!outFile.good()) ERROR(std::string("unable to open output file '") + outFileNamePath + "'"); + + outFile.write((char *) srcFileContent.data(), srcFileContent.size()); + + if (!outFile.good()) ERROR(std::string("unable to write file '") + outFileNamePath + "'"); + outFile.close(); } From bb9450b221454207fdea2d2ba2662bff86dc4b24 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 19 Oct 2019 12:58:18 +0200 Subject: [PATCH 70/85] release tool same content detection bugfix --- src/release.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/release.cc b/src/release.cc index b812aa5e..af3144e9 100644 --- a/src/release.cc +++ b/src/release.cc @@ -441,10 +441,11 @@ void ROMFile::analyzeContent() // Check if meaningful file content is really different if ((memcmp(&srcFileContent[0x0000], &dstFileContent[0x0000], revOffset) == 0) && - (memcmp(&srcFileContent[revOffset + 0x10], &dstFileContent[revOffset + 0x10], 8192 - revOffset) == 0)) + (memcmp(&srcFileContent[revOffset + 0x10], &dstFileContent[revOffset + 0x10], + descPtr->fileSize - revOffset - 0x10) == 0)) { sameContent = true; - } + } // Determine expected length of developer ID From 455ca2ee56b796a3ffdb1f3460920598282d5be8 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 19 Oct 2019 13:00:28 +0200 Subject: [PATCH 71/85] more startup initialization fixes --- STATUS.md | 8 +++---- bin/basic_generic.rom | Bin 8192 -> 8192 bytes bin/basic_mega65.rom | Bin 8192 -> 8192 bytes bin/basic_ultimate64.rom | Bin 8192 -> 8192 bytes bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/aliases/,aliases_config.s | 1 - c64/kernal/clrchn_real.s | 2 +- c64/kernal/init/cint_real.s | 3 --- c64/kernal/init/e5a0.setup_vicii.s | 25 ++++++++++++-------- c64/kernal/interrupts/fce2.hw_entry_reset.s | 5 ++-- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/STATUS.md b/STATUS.md index a535689f..7579756b 100644 --- a/STATUS.md +++ b/STATUS.md @@ -98,10 +98,10 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | Address | Unofficial | Name | Status | Remarks | | :-------: | :--------: | :---------- | :------: | :--------------------------------------------------: | -| `($028F)` | | `KEYLOG` | DONE | works differently on purpose, to improve kb scanning | -| `$FF81` | `$FF5B` | `CINT` | DONE | | +| `($028F)` | | `KEYLOG` | DONE | | +| `$FF81` | `$FF5B` | `CINT` | PARTIAL | probably incomplete, to be checked | | `$FF84` | `$FDA3` | `IOINIT` | PARTIAL | CIA initialization incomplete | -| `$FF87` | `$FD50` | `RAMTAS` | DONE | | +| `$FF87` | `$FD50` | `RAMTAS` | PARTIAL | probably shouldn't touch VIC and CIA's | | `$FF8A` | `$FD15` | `RESTOR` | DONE | | | `$FF8D` | `$FD1A` | `VECTOR` | DONE | | | `$FF90` | | `SETMSG` | DONE | | @@ -156,7 +156,7 @@ Not all of them - only these we want to have implemented. | :-------: | :------------------ | :------: | :------------------------------------------------: | | `$E544` | clear screen | DONE | | | `$E50C` | set cursor position | PARTIAL | | -| `$E5A0` | setup VIC II & IO | PARTIAL | | +| `$E5A0` | setup VIC II & IO | DONE | | | `$EA31` | default IRQ | PARTIAL | | | `$EA7E` | ack CIA1 + below | DONE | | | `$EA81` | ret from IRQ/NMI | DONE | | diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index 89242f1bdb61bb7ddb0cf07bdcbc760735d8dc70..62534b2457d423f89bc7d5aa521cb8f44c5c3fb5 100644 GIT binary patch delta 47 zcmZp0XmHrDij7U<=h6)d8k;w;r86>CZIYDnAP3<&n{57C^QDnAWGxCsXU delta 35 qcmZp0XmHrT%g)%enUCFFLO{dCHO$pVA=u9`AlSn{M00Yg{A>WPf(ilv diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom index 15295fdd254e3033fb43e329a0f710b8c408c001..ae78c8eab543dd76f8c2401fb2ab7e957aa00bc8 100644 GIT binary patch delta 1533 zcmY*ZeN0nV6z{vGeSBE^7%e;m^ILpM`da}-oasm}P)OOey>eItd zUy&6aP+)w?P4k|ec8^aFCl&OG1jiMqQxYMaGQs@blqA8VPKc^SOGpq738Z$IrNClx zv@zt)OtLf*mau4%fDlXq;-&?S6=vaCeTivOvDrPgVVjrtuuU94C}+ZE4C%6hfGUYB z2e;1izSVSRf$;M!%*{Q|kqdvr-h| zcPm9XgQv=BMV-Jnoxr8@GZCj|%AXw}aesbf9W^DUjW|K>D!e;w&GD_upJc+f3 z=|t>@5@JUxj+tB24$lZD2A^o)5qv1S*X)#B>0L~WGsLyzzSd(#Qje{5!)P+n#r$PSonRgk zMQS*k4ShRz@v*E$yYXD^JI1IzEX>%K63U{z*NgGnE2{BRUHxc(`dfg0?2eyphh99F z53@)MlTN-$28^n*u9(|`_Tl`34Y*bRCb?X{ezg|u2;vI`b%a!~z(#rTyDQ;`Cu2GXv`Bm=F(XL#vuLN}Al;lHXzY{r$M&Dl&iQ~z)S}-a{G=|)Q*i|P z#dQAB#<^1aBb4$YkSQAYM{Fzc$m8E%d9=JiLG+6NCVJfwOjrYA1Z9U%V@!bPVVoaK zs9FmPRs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6d&|3nw>q3uod2}KTyylbeDqCtu#2qHQBbxlou8$o+Wz#|5l b#XyUQp3S18c~qJVB~(u4I6uAnZ(`*?v_t`6 diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index 1e84c2a9..77ebc752 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -130,7 +130,6 @@ #if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816 #define HAS_BCD_SAFE_INTERRUPTS -#define HAS_BCD_SAFE_RESET .pseudocommand phx { .byte $DA } .pseudocommand phy { .byte $5A } diff --git a/c64/kernal/clrchn_real.s b/c64/kernal/clrchn_real.s index b12177af..6c97cc4d 100644 --- a/c64/kernal/clrchn_real.s +++ b/c64/kernal/clrchn_real.s @@ -25,7 +25,7 @@ clrchn_real: // Handle IEC output device jsr UNLSN !: -clrchn_reset: // entry needed by CHRIN +clrchn_reset: // entry needed by setup_vicii // Set input device number to keyboard lda #$00 sta DFLTN diff --git a/c64/kernal/init/cint_real.s b/c64/kernal/init/cint_real.s index 54b03723..82cbc77f 100644 --- a/c64/kernal/init/cint_real.s +++ b/c64/kernal/init/cint_real.s @@ -114,9 +114,6 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? // Put non-zero value in MODE to enable case switch ldx #$00 stx MODE - - // Set default I/O devices (see SCINIT description at http://sta.c64.org/cbm64krnfunc.html) - jsr clrchn_reset // Fallthrough/jump to screen clear routine (Compute's Mapping the 64 p215) jmp clear_screen diff --git a/c64/kernal/init/e5a0.setup_vicii.s b/c64/kernal/init/e5a0.setup_vicii.s index 2f8c321a..3cc68a93 100644 --- a/c64/kernal/init/e5a0.setup_vicii.s +++ b/c64/kernal/init/e5a0.setup_vicii.s @@ -1,4 +1,11 @@ +// +// Well-known Kernal routine, described in: +// +// - [CM64] Compute's Mapping the Commodore 64 - page 215 +// + + setup_vicii: // XXX it should also set default devices @@ -21,12 +28,12 @@ setup_vicii: stx VIC_CLKRATE - // Set up default IO values - Compute's Mapping the 64 - // - page 129 - VIC_SCROLY - // - pages 140-144 - VIC_SCROLX - // - 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 #$9B + 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 @@ -35,14 +42,12 @@ setup_vicii: lda #$0F sta VIC_IRQ // clear all interrupts - - // XXX initialize $D012 (VIC_RASTER) - which values to use? - - // We use a different colour scheme of white text on all blue lda #$06 sta VIC_EXTCOL sta VIC_BGCOL0 - rts + // Setup default I/O devices + + jmp clrchn_reset diff --git a/c64/kernal/interrupts/fce2.hw_entry_reset.s b/c64/kernal/interrupts/fce2.hw_entry_reset.s index ed498dfc..f04dd653 100644 --- a/c64/kernal/interrupts/fce2.hw_entry_reset.s +++ b/c64/kernal/interrupts/fce2.hw_entry_reset.s @@ -6,9 +6,8 @@ hw_entry_reset: // The GPL program at https://github.com/Klaus2m5/6502_65C02_functional_tests/blob/master/6502_functional_test.a65 // uses the following initial reset sequence, affirmed by c64 PRG p269 -#if !HAS_BCD_SAFE_RESET - cld // for CPUs having undefined D flag after reset -#endif + + cld // for CPUs might clear D flag - but it is possible this is called manually ldx #$FF txs sei From dc63912edddca123ebb67ed67933cb59fa71c1fb Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 20 Oct 2019 09:03:23 +0200 Subject: [PATCH 72/85] even more startup tweaks --- c64/kernal/init/cint_real.s | 21 ++++++++++++------- c64/kernal/init/e5a0.setup_vicii.s | 2 -- .../fce2.hw_entry_reset.s | 14 +++++++++---- c64/kernal/{interrupts => init}/fce2.interop | 0 c64/kernal/init/fda3.ioinit.s | 2 +- c64/kernal/{ => init}/ramtas_real.s | 0 .../interrupts/fe66.default_brk_handler.s | 5 +++++ c64/kernal/{ => iostack}/findfls.s | 2 +- 8 files changed, 30 insertions(+), 16 deletions(-) rename c64/kernal/{interrupts => init}/fce2.hw_entry_reset.s (73%) rename c64/kernal/{interrupts => init}/fce2.interop (100%) rename c64/kernal/{ => init}/ramtas_real.s (100%) rename c64/kernal/{ => iostack}/findfls.s (92%) diff --git a/c64/kernal/init/cint_real.s b/c64/kernal/init/cint_real.s index 82cbc77f..2c4722a4 100644 --- a/c64/kernal/init/cint_real.s +++ b/c64/kernal/init/cint_real.s @@ -56,18 +56,16 @@ cint_pal: !: sta TVSFLG - // Setup KEYLOG vector - XXX is it proper place? +cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? + + // Setup KEYLOG vector lda #scnkey_set_keytab sta KEYLOG+1 -cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? - - jsr setup_vicii - - // Initialise cursor blink flags (Compute's Mapping the 64 p215) + // Initialise cursor blink flags (Compute's Mapping the 64 p215) lda #$01 sta BLNCT @@ -93,15 +91,18 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? dex bpl !- sta BufferQuantity - -#endif // Set key repeat delay (Compute's Mapping the 64 p215) // Making some numbers up here: Repeat every ~1/10th sec // But require key to be held for ~1/3sec before // repeating (Compute's Mapping the 64 p58) + + // Not needed for default keyboard scanning code + ldx #22-2 // Fudge factor to match speed stx DELAY + +#endif // Set current colour for text (Compute's Mapping the 64 p215) ldx #$01 // default is light blue ($0E), but we use a different one @@ -115,5 +116,9 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? ldx #$00 stx MODE + // Setup video and I/O + jsr setup_vicii + // Fallthrough/jump to screen clear routine (Compute's Mapping the 64 p215) + jmp clear_screen diff --git a/c64/kernal/init/e5a0.setup_vicii.s b/c64/kernal/init/e5a0.setup_vicii.s index 3cc68a93..bd3d7d52 100644 --- a/c64/kernal/init/e5a0.setup_vicii.s +++ b/c64/kernal/init/e5a0.setup_vicii.s @@ -8,8 +8,6 @@ setup_vicii: - // XXX it should also set default devices - // Clear everything - turn off sprites (observed hanging around after // running programs and resetting), etc. diff --git a/c64/kernal/interrupts/fce2.hw_entry_reset.s b/c64/kernal/init/fce2.hw_entry_reset.s similarity index 73% rename from c64/kernal/interrupts/fce2.hw_entry_reset.s rename to c64/kernal/init/fce2.hw_entry_reset.s index f04dd653..e0a3793e 100644 --- a/c64/kernal/interrupts/fce2.hw_entry_reset.s +++ b/c64/kernal/init/fce2.hw_entry_reset.s @@ -5,12 +5,18 @@ hw_entry_reset: // The GPL program at https://github.com/Klaus2m5/6502_65C02_functional_tests/blob/master/6502_functional_test.a65 - // uses the following initial reset sequence, affirmed by c64 PRG p269 + // uses the similar initial reset sequence, affirmed by c64 PRG p269 - cld // for CPUs might clear D flag - but it is possible this is called manually - ldx #$FF + sei // disable the interrupts, as fast as possible - they are disabled in case of HW reset, + // but this routine can be also called manually + + ldx #$00 + sta VIC_SCROLX // turn the display off - we want as little screen artifacts as possible + + cld // required for all CPUs - due to possibility of manual call + + dex // $FF - to initialize stack pointer txs - sei // The following routine is based on reading the public KERNAL jumptable routine // list, and making unimaginative assumptions about what should be done on reset. diff --git a/c64/kernal/interrupts/fce2.interop b/c64/kernal/init/fce2.interop similarity index 100% rename from c64/kernal/interrupts/fce2.interop rename to c64/kernal/init/fce2.interop diff --git a/c64/kernal/init/fda3.ioinit.s b/c64/kernal/init/fda3.ioinit.s index 0203d315..28437fe5 100644 --- a/c64/kernal/init/fda3.ioinit.s +++ b/c64/kernal/init/fda3.ioinit.s @@ -13,7 +13,7 @@ IOINIT: // Set $00/$01 port mode and value // We want BASIC and KERNAL ROMs mapped, and datasette motor off // (https://www.c64-wiki.com/wiki/Zeropage) - // XXX - Work around VICE bug: Writing $00 before $01 results in rubbish in $01 + // Work around for VICE bug: Writing $00 before $01 results in rubbish in $01 // after. https://sourceforge.net/p/vice-emu/bugs/1057/ lda #$27 ldx #$2F diff --git a/c64/kernal/ramtas_real.s b/c64/kernal/init/ramtas_real.s similarity index 100% rename from c64/kernal/ramtas_real.s rename to c64/kernal/init/ramtas_real.s diff --git a/c64/kernal/interrupts/fe66.default_brk_handler.s b/c64/kernal/interrupts/fe66.default_brk_handler.s index 75d1b4f4..53d70783 100644 --- a/c64/kernal/interrupts/fe66.default_brk_handler.s +++ b/c64/kernal/interrupts/fe66.default_brk_handler.s @@ -5,6 +5,11 @@ default_brk_handler: sei // disable IRQs, to be sure they won't interfere + ldx #$00 + sta VIC_SCROLX // turn the display off - we want as little screen artifacts as possible + + cld // make sure this dangerous flag is disabled + jsr JRESTOR jsr JIOINIT jsr cint_brk diff --git a/c64/kernal/findfls.s b/c64/kernal/iostack/findfls.s similarity index 92% rename from c64/kernal/findfls.s rename to c64/kernal/iostack/findfls.s index f9cefadd..874fad51 100644 --- a/c64/kernal/findfls.s +++ b/c64/kernal/iostack/findfls.s @@ -1,5 +1,5 @@ -// Just a helper routines +// Just a helper routine // Find the LAT / SAT / FAT entry index where LAT corresponds to A, returns index in Y // Carry flag set means not found From 34f984b8f0aa8c086ef478fb7a62ae7d7e261828 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 20 Oct 2019 09:29:57 +0200 Subject: [PATCH 73/85] added configuration for testing/experimental builds --- CONFIG.md | 4 ++ Makefile | 23 +++++++++- c64/,,config_generic.s | 1 + c64/,,config_mega65.s | 10 ++-- c64/,,config_testing.s | 81 +++++++++++++++++++++++++++++++++ c64/,,config_ultimate64.s | 1 + c64/aliases/,aliases_config.s | 3 ++ c64/basic/init/startup_banner.s | 2 + 8 files changed, 118 insertions(+), 7 deletions(-) create mode 100644 c64/,,config_testing.s diff --git a/CONFIG.md b/CONFIG.md index a4a983a5..6d492764 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -27,6 +27,10 @@ Since Open ROMs is highly modular, it should be possible to add other platforms If you don't know which variant to choose - select this one. +### `CONFIG_BRAND_TESTING` + +Use this one for any kind of testing/experimental build. + ### `CONFIG_BRAND_MEGA_65`, `CONFIG_BRAND_ULTIMATE_64` Select if you are using appropriate motherboard. diff --git a/Makefile b/Makefile index 74544f9b..b8f93f63 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ TOOLS_LIST = $(pathsubst src/tools/%,build/tools/%,$(basename $(SRC_TOOLS))) # List of targets STD_TARGET_LIST = build/kernal_generic.rom build/basic_generic.rom \ + build/kernal_testing.rom build/basic_testing.rom \ build/kernal_mega65.rom build/basic_mega65.rom \ build/kernal_ultimate64.rom build/basic_ultimate64.rom \ build/chargen.rom @@ -69,7 +70,7 @@ clean: @rm -rf build updatebin: $(STD_TARGET_LIST) $(TOOL_RELEASE) - $(TOOL_RELEASE) -i ./build -o ./bin basic_generic.rom kernal_generic.rom basic_mega65.rom kernal_mega65.rom basic_ultimate64.rom kernal_ultimate64.rom + $(TOOL_RELEASE) -i ./build -o ./bin basic_generic.rom kernal_generic.rom basic_testing.rom kernal_testing.rom basic_mega65.rom kernal_mega65.rom basic_ultimate64.rom kernal_ultimate64.rom cp build/chargen.rom bin/chargen.rom # Rules - tools @@ -101,6 +102,10 @@ build/target_generic/OUTB.BIN build/target_generic/BASIC_combined.vs: \ $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC) \ c64/,,config_generic.s build/target_generic/KERNAL_combined.sym \ $(foreach dir,$(SRCDIR_BASIC),$(wildcard $(dir)/*.s)) +build/target_testing/OUTB.BIN build/target_generic/BASIC_combined.vs: \ + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC) \ + c64/,,config_testing.s build/target_testing/KERNAL_combined.sym \ + $(foreach dir,$(SRCDIR_BASIC),$(wildcard $(dir)/*.s)) build/target_mega65/OUTB.BIN build/target_mega65/BASIC_combined.vs: \ $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC) \ c64/,,config_mega65.s build/target_mega65/KERNAL_combined.sym \ @@ -114,6 +119,10 @@ build/target_generic/OUTK.BIN build/target_generic/KERNAL_combined.vs bu $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL) \ c64/,,config_generic.s \ $(foreach dir,$(SRCDIR_KERNAL),$(wildcard $(dir)/*.s)) +build/target_testing/OUTK.BIN build/target_testing/KERNAL_combined.vs build/target_testing/KERNAL_combined.sym: \ + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL) \ + c64/,,config_testing.s \ + $(foreach dir,$(SRCDIR_KERNAL),$(wildcard $(dir)/*.s)) build/target_mega65/OUTK.BIN build/target_mega65/KERNAL_combined.vs build/target_mega65/KERNAL_combined.sym: \ $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL) \ c64/,,config_mega65.s \ @@ -124,18 +133,22 @@ build/target_ultimate64/OUTK.BIN build/target_ultimate64/KERNAL_combined.vs bu $(foreach dir,$(SRCDIR_KERNAL),$(wildcard $(dir)/*.s)) build/target_generic/newrom: build/target_generic/OUTB.BIN build/target_generic/OUTK.BIN +build/target_testing/newrom: build/target_testing/OUTB.BIN build/target_testing/OUTK.BIN build/target_mega65/newrom: build/target_mega65/OUTB.BIN build/target_mega65/OUTK.BIN build/target_ultimate64/newrom: build/target_ultimate64/OUTB.BIN build/target_ultimate64/OUTK.BIN build/kernal_generic.rom: build/target_generic/newrom +build/kernal_testing.rom: build/target_testing/newrom build/kernal_mega65.rom: build/target_mega65/newrom build/kernal_ultimate64.rom: build/target_ultimate64/newrom build/basic_generic.rom: build/target_generic/newrom +build/basic_testing.rom: build/target_testing/newrom build/basic_mega65.rom: build/target_mega65/newrom build/basic_ultimate64.rom: build/target_ultimate64/newrom build/symbols_generic.vs: build/target_generic/BASIC_combined.vs build/target_generic/KERNAL_combined.vs +build/symbols_testing.vs: build/target_testing/BASIC_combined.vs build/target_testing/KERNAL_combined.vs build/symbols_mega65.vs: build/target_mega65/BASIC_combined.vs build/target_mega65/KERNAL_combined.vs build/symbols_ultimate64.vs: build/target_ultimate64/BASIC_combined.vs build/target_ultimate64/KERNAL_combined.vs @@ -196,7 +209,10 @@ build/newc65.rom: build/kernal_mega65.rom build/basic_mega65.rom build/chargen.r # Rules - tests -.PHONY: test test_generic test_generic_x128 test_mega65 test_mega65_xemu test_ultimate64 test_hybrid test_m65 testremote testsimilarity +.PHONY: test test_generic test_generic_x128 test_hybrid test_testing \ + test_mega65 test_mega65_xemu test_m65 \ + test_ultimate64 \ + testremote testsimilarity test: test_generic @@ -206,6 +222,9 @@ test_generic: build/kernal_generic.rom build/basic_generic.rom build/symbols_gen test_generic_x128: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs x128 -go64 -kernal64 build/kernal_generic.rom -basic64 build/basic_generic.rom -moncommands build/symbols_generic.vs -8 empty.d64 +test_testing: build/kernal_testing.rom build/basic_testing.rom build/symbols_testing.vs + x64 -kernal build/kernal_testing.rom -basic build/basic_testing.rom -moncommands build/symbols_testing.vs -8 empty.d64 + test_mega65: build/kernal_mega65.rom build/basic_mega65.rom build/symbols_mega65.vs x64 -kernal build/kernal_mega65.rom -basic build/basic_mega65.rom -moncommands build/symbols_mega65.vs -8 empty.d64 diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index c0d78dc1..32283b0e 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -15,6 +15,7 @@ #define CONFIG_PLATFORM_COMMODORE_64 #define CONFIG_BRAND_GENERIC +// #define CONFIG_BRAND_TESTING // #define CONFIG_BRAND_MEGA_65 // #define CONFIG_BRAND_ULTIMATE_64 diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 6ffc2998..ea34f998 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -7,7 +7,6 @@ // Idea: // - sane defaults for the Mega 65 FPGA computer -// - enable compatibility-risky features too // - unless VICE gains Commodore 65 (or at least Flash8 cartridge) emulation support, // do not enable CPU-specific optimizations; ROMs would be hard to test @@ -17,6 +16,7 @@ #define CONFIG_PLATFORM_COMMODORE_64 // #define CONFIG_BRAND_GENERIC +// #define CONFIG_BRAND_TESTING #define CONFIG_BRAND_MEGA_65 // #define CONFIG_BRAND_ULTIMATE_64 @@ -31,8 +31,8 @@ // Memory model configuration -// #define CONFIG_MEMORY_MODEL_38K -#define CONFIG_MEMORY_MODEL_60K +#define CONFIG_MEMORY_MODEL_38K +// #define CONFIG_MEMORY_MODEL_60K // Multiple SID support @@ -50,11 +50,11 @@ // Keyboard settings -#define CONFIG_LEGACY_SCNKEY +// #define CONFIG_LEGACY_SCNKEY // #define CONFIG_KEYBOARD_C128 // #define CONFIG_KEYBOARD_C128_CAPS_LOCK // #define CONFIG_KEY_REPEAT_DEFAULT -// #define CONFIG_KEY_REPEAT_ALWAYS +#define CONFIG_KEY_REPEAT_ALWAYS #define CONFIG_KEY_FAST_SCAN #define CONFIG_JOY1_CURSOR #define CONFIG_JOY2_CURSOR diff --git a/c64/,,config_testing.s b/c64/,,config_testing.s new file mode 100644 index 00000000..c44dcef9 --- /dev/null +++ b/c64/,,config_testing.s @@ -0,0 +1,81 @@ + +.const CONFIG_ID = $F0 // should be 1 byte, different for each config file! + +// +// Please read CONFIG.md before modifying this file! +// + +// Idea: +// - enable compatibility-risky features +// - enable code not normally used yto make sure it still compiles + + + +// Hardware platform and brand + +#define CONFIG_PLATFORM_COMMODORE_64 + +// #define CONFIG_BRAND_GENERIC +#define CONFIG_BRAND_TESTING +// #define CONFIG_BRAND_MEGA_65 +// #define CONFIG_BRAND_ULTIMATE_64 + + +// Processor instruction set + +#define CONFIG_CPU_MOS_6502 +// #define CONFIG_CPU_WDC_65C02 +// #define CONFIG_CPU_CSG_65CE02 +// #define CONFIG_CPU_WDC_65816 + + +// Memory model configuration + +// #define CONFIG_MEMORY_MODEL_38K +#define CONFIG_MEMORY_MODEL_60K + + +// Multiple SID support + +#define CONFIG_SID_2ND +.const CONFIG_SID_2ND_ADDRESS = $D420 + +// #define CONFIG_SID_3RD +.const CONFIG_SID_3RD_ADDRESS = $D440 + +// #define CONFIG_SID_D4XX +// #define CONFIG_SID_D5XX + + +// Keyboard settings + + +#define CONFIG_LEGACY_SCNKEY +// #define CONFIG_KEYBOARD_C128 +// #define CONFIG_KEYBOARD_C128_CAPS_LOCK +// #define CONFIG_KEY_REPEAT_DEFAULT +// #define CONFIG_KEY_REPEAT_ALWAYS +#define CONFIG_KEY_FAST_SCAN +#define CONFIG_JOY1_CURSOR +#define CONFIG_JOY2_CURSOR + + +// Eye candy + +// #define CONFIG_BANNER_SIMPLE +#define CONFIG_BANNER_FANCY +// #define CONFIG_BANNER_BRAND +// #define CONFIG_SHOW_PAL_NTSC + + +// Software features + +#define CONFIG_PANIC_SCREEN +#define CONFIG_DOS_WEDGE +#define CONFIG_BCD_SAFE_INTERRUPTS + + +// Debug options + +// #define CONFIG_DBG_STUBS_BRK +#define CONFIG_DBG_PRINTF diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index dca7299a..fe635527 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -15,6 +15,7 @@ #define CONFIG_PLATFORM_COMMODORE_64 // #define CONFIG_BRAND_GENERIC +// #define CONFIG_BRAND_TESTING // #define CONFIG_BRAND_MEGA_65 #define CONFIG_BRAND_ULTIMATE_64 diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index 77ebc752..353ec3d0 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -27,6 +27,9 @@ #if CONFIG_BRAND_GENERIC .eval selected++ #endif +#if CONFIG_BRAND_TESTING + .eval selected++ +#endif #if CONFIG_BRAND_MEGA_65 .eval selected++ #endif diff --git a/c64/basic/init/startup_banner.s b/c64/basic/init/startup_banner.s index 5443ef47..bb0901ed 100644 --- a/c64/basic/init/startup_banner.s +++ b/c64/basic/init/startup_banner.s @@ -8,6 +8,8 @@ #if CONFIG_BRAND_GENERIC .text "OPEN ROMS GENERIC BUILD" +#elif CONFIG_BRAND_TESTING + .text "OPEN ROMS TESTING BUILD" #elif CONFIG_BRAND_MEGA_65 .text "OPEN ROMS FOR MEGA65" #elif CONFIG_BRAND_ULTIMATE_64 From aec7fe972158a05fa264a314e37e38120d9f1081 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 20 Oct 2019 09:55:35 +0200 Subject: [PATCH 74/85] motherboard extras can now be configured --- CONFIG.md | 4 +++ c64/,,config_generic.s | 3 +++ c64/,,config_mega65.s | 4 +++ c64/,,config_testing.s | 5 +++- c64/,,config_ultimate64.s | 3 +++ c64/aliases/,aliases_config.s | 42 +++++++++++++++++++++++++----- c64/kernal/init/e5a0.setup_vicii.s | 4 +++ 7 files changed, 57 insertions(+), 8 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index 6d492764..c5e80528 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -23,6 +23,10 @@ Since Open ROMs is highly modular, it should be possible to add other platforms * 8KB ROM area `$A000`-`$BFFF` * 8KB ROM area `$E000`-`$FFFF` +### `CONFIG_MB_MEGA_65`, `CONFIG_MB_ULTIMATE_64` + +Select if the ROM is going to be used exclusively on the specific motherboard. It prevents from enabling options not having sense, skips initialization of C128-only registers, etc. + ### `CONFIG_BRAND_GENERIC` If you don't know which variant to choose - select this one. diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 32283b0e..2978ce82 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -14,6 +14,9 @@ #define CONFIG_PLATFORM_COMMODORE_64 +// #define CONFIG_MB_MEGA_65 +// #define CONFIG_MB_ULTIMATE_64 + #define CONFIG_BRAND_GENERIC // #define CONFIG_BRAND_TESTING // #define CONFIG_BRAND_MEGA_65 diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index ea34f998..d54e3185 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -7,6 +7,7 @@ // Idea: // - sane defaults for the Mega 65 FPGA computer +// - do not enable features which are a significant compatibility risk // - unless VICE gains Commodore 65 (or at least Flash8 cartridge) emulation support, // do not enable CPU-specific optimizations; ROMs would be hard to test @@ -15,6 +16,9 @@ #define CONFIG_PLATFORM_COMMODORE_64 +#define CONFIG_MB_MEGA_65 +// #define CONFIG_MB_ULTIMATE_64 + // #define CONFIG_BRAND_GENERIC // #define CONFIG_BRAND_TESTING #define CONFIG_BRAND_MEGA_65 diff --git a/c64/,,config_testing.s b/c64/,,config_testing.s index c44dcef9..438a494d 100644 --- a/c64/,,config_testing.s +++ b/c64/,,config_testing.s @@ -7,7 +7,7 @@ // Idea: // - enable compatibility-risky features -// - enable code not normally used yto make sure it still compiles +// - enable code not normally used - to make sure they still compile @@ -15,6 +15,9 @@ #define CONFIG_PLATFORM_COMMODORE_64 +// #define CONFIG_MB_MEGA_65 +// #define CONFIG_MB_ULTIMATE_64 + // #define CONFIG_BRAND_GENERIC #define CONFIG_BRAND_TESTING // #define CONFIG_BRAND_MEGA_65 diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index fe635527..7d8a8ff5 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -14,6 +14,9 @@ #define CONFIG_PLATFORM_COMMODORE_64 +// #define CONFIG_MB_MEGA_65 +#define CONFIG_MB_ULTIMATE_64 + // #define CONFIG_BRAND_GENERIC // #define CONFIG_BRAND_TESTING // #define CONFIG_BRAND_MEGA_65 diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index 353ec3d0..ac668e61 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -19,7 +19,31 @@ -// Check that platform and brand configuration is correct +// Check that motherboard extras configuration is correct + +{ + .var selected = 0; + +#if CONFIG_MB_MEGA_65 + .eval selected++ +#endif +#if CONFIG_MB_ULTIMATE_64 + .eval selected++ +#endif + + .if (selected > 1) .error "Please select at most one CONFIG_MB_* option" + +#if !CONFIG_PLATFORM_COMMODORE_64 && CONFIG_BRAND_MEGA_65 && + .error "CONFIG_BRAND_MEGA_65 can only be used with CONFIG_PLATFORM_COMMODORE_64" +#endif +#if !CONFIG_PLATFORM_COMMODORE_64 && CONFIG_BRAND_ULTIMATE_64 && + .error "CONFIG_BRAND_ULTIMATE_64 can only be used with CONFIG_PLATFORM_COMMODORE_64" +#endif +} + + + +// Check that brand configuration is correct { .var selected = 0; @@ -39,11 +63,11 @@ .if (selected != 1) .error "Please select exactly one CONFIG_BRAND_* option" -#if !CONFIG_PLATFORM_COMMODORE_64 && CONFIG_BRAND_MEGA_65 && - .error "CONFIG_BRAND_MEGA_65 can only be used with CONFIG_PLATFORM_COMMODORE_64" +#if CONFIG_MB_MEGA_65 && !(CONFIG_BRAND_MEGA_65 || CONFIG_BRAND_TESTING) + .error "Please select brand either matching the CONFIG_MB_*, or a testing one" #endif -#if !CONFIG_PLATFORM_COMMODORE_64 && CONFIG_BRAND_ULTIMATE_64 && - .error "CONFIG_BRAND_ULTIMATE_64 can only be used with CONFIG_PLATFORM_COMMODORE_64" +#if CONFIG_MB_ULTIMATE_64 && !(CONFIG_BRAND_ULTIMATE_64 || CONFIG_BRAND_TESTING) + .error "Please select brand either matching the CONFIG_MB_*, or a testing one" #endif } @@ -121,8 +145,12 @@ // Check if keyboard options are correct { -#if CONFIG_LEGACY_SCNKEY && CONFIG_KEYBOARD_C128 - .error "CONFIG_LEGACY_SCNKEY and CONFIG_KEYBOARD_C128 are mutually exclusive" +#if CONFIG_LEGACY_SCNKEY && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C128_CAPS_LOCK) + .error "CONFIG_LEGACY_SCNKEY and CONFIG_KEYBOARD_C128* are mutually exclusive" +#endif + +#if (CONFIG_MB_MEGA_65 || CONFIG_MB_ULTIMATE_64) && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C128_CAPS_LOCK) + .error "Selected CONFIG_MB_* is not compatible with CONFIG_KEYBOARD_C128*" #endif } diff --git a/c64/kernal/init/e5a0.setup_vicii.s b/c64/kernal/init/e5a0.setup_vicii.s index bd3d7d52..c359bdf1 100644 --- a/c64/kernal/init/e5a0.setup_vicii.s +++ b/c64/kernal/init/e5a0.setup_vicii.s @@ -18,6 +18,8 @@ setup_vicii: dex bpl !- +#if !CONFIG_MB_MEGA_65 && !CONFIG_MB_ULTIMATE_64 + // Disable C128 extra keys - just to be sure they won't interfere with anything stx VIC_XSCAN @@ -26,6 +28,8 @@ setup_vicii: stx VIC_CLKRATE +#endif + // Set up default IO values // - [CM64] page 129 - VIC_SCROLY // - [CM64] pages 140-144 - VIC_SCROLX From b73e9fbb7d263d9a198be1878707bf33637082e3 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 20 Oct 2019 10:26:17 +0200 Subject: [PATCH 75/85] first steps towards brand-specific color schemes --- CONFIG.md | 4 ++++ c64/,,config_generic.s | 2 +- c64/,,config_mega65.s | 2 +- c64/,,config_testing.s | 2 +- c64/,,config_ultimate64.s | 2 +- c64/kernal/init/e5a0.setup_vicii.s | 13 ++++++++++++- 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index c5e80528..463a7307 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -161,6 +161,10 @@ Needs about 65 bytes of ROM space to handle both joysticks. ## Eye candy +### `CONFIG_COLORS_BRAND` + +Tries to adjust the color scheme to the selected brand. Some brands might not support this. + ### `CONFIG_BANNER_SIMPLE`, `CONFIG_BANNER_FANCY`, `CONFIG_BANNER_BRAND` Select startup banner - either a simple one, or with some colorful elements. `CONFIG_BANNER_BRAND` heavily depends on the selected brand, not all the brands support it. diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 2978ce82..74605b8a 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -51,7 +51,6 @@ // Keyboard settings - // #define CONFIG_LEGACY_SCNKEY #define CONFIG_KEYBOARD_C128 #define CONFIG_KEYBOARD_C128_CAPS_LOCK @@ -64,6 +63,7 @@ // Eye candy +#define CONFIG_COLORS_BRAND // #define CONFIG_BANNER_SIMPLE #define CONFIG_BANNER_FANCY // #define CONFIG_BANNER_BRAND diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index d54e3185..b4d2fa59 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -53,7 +53,6 @@ // Keyboard settings - // #define CONFIG_LEGACY_SCNKEY // #define CONFIG_KEYBOARD_C128 // #define CONFIG_KEYBOARD_C128_CAPS_LOCK @@ -66,6 +65,7 @@ // Eye candy +#define CONFIG_COLORS_BRAND // #define CONFIG_BANNER_SIMPLE // #define CONFIG_BANNER_FANCY #define CONFIG_BANNER_BRAND diff --git a/c64/,,config_testing.s b/c64/,,config_testing.s index 438a494d..b6c84487 100644 --- a/c64/,,config_testing.s +++ b/c64/,,config_testing.s @@ -52,7 +52,6 @@ // Keyboard settings - #define CONFIG_LEGACY_SCNKEY // #define CONFIG_KEYBOARD_C128 // #define CONFIG_KEYBOARD_C128_CAPS_LOCK @@ -65,6 +64,7 @@ // Eye candy +// #define CONFIG_COLORS_BRAND // #define CONFIG_BANNER_SIMPLE #define CONFIG_BANNER_FANCY // #define CONFIG_BANNER_BRAND diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index 7d8a8ff5..4b99e84e 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -51,7 +51,6 @@ // Keyboard settings - // #define CONFIG_LEGACY_SCNKEY // #define CONFIG_KEYBOARD_C128 // #define CONFIG_KEYBOARD_C128_CAPS_LOCK @@ -64,6 +63,7 @@ // Eye candy +#define CONFIG_COLORS_BRAND // #define CONFIG_BANNER_SIMPLE #define CONFIG_BANNER_FANCY // #define CONFIG_BANNER_BRAND diff --git a/c64/kernal/init/e5a0.setup_vicii.s b/c64/kernal/init/e5a0.setup_vicii.s index c359bdf1..78ab30a9 100644 --- a/c64/kernal/init/e5a0.setup_vicii.s +++ b/c64/kernal/init/e5a0.setup_vicii.s @@ -44,12 +44,23 @@ setup_vicii: lda #$0F sta VIC_IRQ // clear all interrupts - // We use a different colour scheme of white text on all blue + // We use a different colour scheme of white text on all blue by default, + // but brand-specific color scheme can also be enabled + +#if CONFIG_COLORS_BRAND && CONFIG_BRAND_ULTIMATE_64 + + lda #$00 + sta VIC_EXTCOL + sta VIC_BGCOL0 + +#else lda #$06 sta VIC_EXTCOL sta VIC_BGCOL0 +#endif + // Setup default I/O devices jmp clrchn_reset From a8e80ee2b1c73bf7ff486018399647d33e77f7c2 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 20 Oct 2019 11:44:06 +0200 Subject: [PATCH 76/85] adjusted some addresses, added more stubs --- Makefile | 3 ++- STATUS.md | 14 ++++++++++++-- c64/basic/a453.interop | 3 +++ c64/basic/a453.unknown.s | 4 ++++ c64/basic/a644.interop | 3 +++ c64/basic/a644.new.s | 5 +++++ .../basic_warm_start_internal.s} | 8 ++++++-- c64/basic/init/e3b7.basic_warm_start.jmp.s | 5 +++++ c64/basic/init/e3b7.interop | 5 +++++ c64/kernal/fe25.interop | 3 +++ c64/kernal/{memtop.s => fe25.memtop.s} | 0 .../{e544.clear_screen.s => clear_screen_real.s} | 2 +- c64/kernal/screen/e544.clear_screen.jmp.s | 6 ++++++ c64/kernal/stubs/e566.home_cursor.s | 4 ++++ c64/kernal/stubs/e566.interop | 5 +++++ c64/kernal/stubs/e6b6.advance_cursor.s | 4 ++++ c64/kernal/stubs/e6b6.interop | 5 +++++ c64/kernal/stubs/e701.interop | 5 +++++ c64/kernal/stubs/e701.previous_line.s | 4 ++++ c64/kernal/stubs/e8ea.interop | 5 +++++ c64/kernal/stubs/e8ea.scroll_line.s | 4 ++++ c64/kernal/stubs/e9ff.clear_line.s | 4 ++++ c64/kernal/stubs/e9ff.interop | 5 +++++ c64/kernal/stubs/fd90.interop | 4 ++++ c64/kernal/stubs/fd90.unknown.s | 4 ++++ 25 files changed, 108 insertions(+), 6 deletions(-) create mode 100644 c64/basic/a453.interop create mode 100644 c64/basic/a453.unknown.s create mode 100644 c64/basic/a644.interop create mode 100644 c64/basic/a644.new.s rename c64/basic/{basic_warm_start.s => init/basic_warm_start_internal.s} (73%) create mode 100644 c64/basic/init/e3b7.basic_warm_start.jmp.s create mode 100644 c64/basic/init/e3b7.interop create mode 100644 c64/kernal/fe25.interop rename c64/kernal/{memtop.s => fe25.memtop.s} (100%) rename c64/kernal/screen/{e544.clear_screen.s => clear_screen_real.s} (98%) create mode 100644 c64/kernal/screen/e544.clear_screen.jmp.s create mode 100644 c64/kernal/stubs/e566.home_cursor.s create mode 100644 c64/kernal/stubs/e566.interop create mode 100644 c64/kernal/stubs/e6b6.advance_cursor.s create mode 100644 c64/kernal/stubs/e6b6.interop create mode 100644 c64/kernal/stubs/e701.interop create mode 100644 c64/kernal/stubs/e701.previous_line.s create mode 100644 c64/kernal/stubs/e8ea.interop create mode 100644 c64/kernal/stubs/e8ea.scroll_line.s create mode 100644 c64/kernal/stubs/e9ff.clear_line.s create mode 100644 c64/kernal/stubs/e9ff.interop create mode 100644 c64/kernal/stubs/fd90.interop create mode 100644 c64/kernal/stubs/fd90.unknown.s diff --git a/Makefile b/Makefile index b8f93f63..931d9c24 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,8 @@ SRCDIR_KERNAL = $(SRCDIR_COMMON) \ c64/kernal/iostack \ c64/kernal/keyboard \ c64/kernal/print \ - c64/kernal/screen + c64/kernal/screen \ + c64/kernal/stubs SRC_TOOLS = $(wildcard src/tools/*.c,src/tools/*.cc) diff --git a/STATUS.md b/STATUS.md index 7579756b..036ebf26 100644 --- a/STATUS.md +++ b/STATUS.md @@ -63,7 +63,7 @@ Note: vectors at `$0300` are not supported yet - for now only the locations belo | `(00308)` | `$A7E4` | `GONE` | NOT DONE | some implementation exists, but not connected here | | `(0030A)` | `$AE86` | `EVAL` | NOT DONE | some implementation exists, but not connected here | | `($A000)` | `$E394` | cold start | PARTIAL | | -| `($A002)` | | warm start | PARTIAL | | +| `($A002)` | `$E3B7` | warm start | PARTIAL | |
@@ -76,7 +76,9 @@ Not all of them - only these we want to have implemented. | Address | Name | Status | Remarks | | :-------: | :----------- | :------: | :------------------------------------------------: | | `$A004` | revision str | DONE | | +| `$A453` | (unknown) | NOT DONE | | | `$A533` | LINKPRG | DONE | | +| `$A644` | new | NOT DONE | | | `$A659` | set txt ptr | NOT DONE | | | `$A68E` | RUNC | DONE | | | `$A7AE` | NEWSTT | PARTIAL | redirected to RUN command | @@ -107,7 +109,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FF90` | | `SETMSG` | DONE | | | `$FF93` | | `SECOND` | DONE | | | `$FF96` | | `TKSA` | DONE | | -| `$FF99` | | `MEMTOP` | DONE | | +| `$FF99` | `$FE25` | `MEMTOP` | DONE | | | `$FF9C` | | `MEMBOT` | DONE | | | `$FF9F` | | `SCNKEY` | DONE | | | `$FFA2` | | `SETTMO` | DONE | | @@ -156,12 +158,20 @@ Not all of them - only these we want to have implemented. | :-------: | :------------------ | :------: | :------------------------------------------------: | | `$E544` | clear screen | DONE | | | `$E50C` | set cursor position | PARTIAL | | +| `$E566` | home cursor | NOT DONE | | | `$E5A0` | setup VIC II & IO | DONE | | +| `$E6B6` | advance cursor | NOT DONE | | +| `$E701` | previous line | NOT DONE | | +| `$E8EA` | scroll line | NOT DONE | | +| `$E9FF` | clear line | NOT DONE | | | `$EA31` | default IRQ | PARTIAL | | | `$EA7E` | ack CIA1 + below | DONE | | | `$EA81` | ret from IRQ/NMI | DONE | | | `$F142` | get key from buffer | DONE | | | `$FD30` | default vectors | DONE | | +| `$FD90` | (unknown) | NOT DONE | | +| `$FD90` | (unknown) | NOT DONE | | +| `$FE2D` | memtop set part | DONE | | | `$FE47` | default NMI | PARTIAL | | | `$FE66` | default BRK | DONE | | | `$FF80` | revision byte | DONE | | diff --git a/c64/basic/a453.interop b/c64/basic/a453.interop new file mode 100644 index 00000000..f5dc0a42 --- /dev/null +++ b/c64/basic/a453.interop @@ -0,0 +1,3 @@ + +This routine is probably used by many cartridges and other software to initialize parts of the system. At least the UCart uses it - see here: +- https://www.elektroda.pl/rtvforum/topic3293027.html diff --git a/c64/basic/a453.unknown.s b/c64/basic/a453.unknown.s new file mode 100644 index 00000000..ecb53d23 --- /dev/null +++ b/c64/basic/a453.unknown.s @@ -0,0 +1,4 @@ + +// XXX provide documentation and implementation + + STUB_IMPLEMENTATION() \ No newline at end of file diff --git a/c64/basic/a644.interop b/c64/basic/a644.interop new file mode 100644 index 00000000..f5dc0a42 --- /dev/null +++ b/c64/basic/a644.interop @@ -0,0 +1,3 @@ + +This routine is probably used by many cartridges and other software to initialize parts of the system. At least the UCart uses it - see here: +- https://www.elektroda.pl/rtvforum/topic3293027.html diff --git a/c64/basic/a644.new.s b/c64/basic/a644.new.s new file mode 100644 index 00000000..e4e54f59 --- /dev/null +++ b/c64/basic/a644.new.s @@ -0,0 +1,5 @@ + +// XXX provide documentation and real implementation + +new: + STUB_IMPLEMENTATION() diff --git a/c64/basic/basic_warm_start.s b/c64/basic/init/basic_warm_start_internal.s similarity index 73% rename from c64/basic/basic_warm_start.s rename to c64/basic/init/basic_warm_start_internal.s index 1416ec4e..b271b928 100644 --- a/c64/basic/basic_warm_start.s +++ b/c64/basic/init/basic_warm_start_internal.s @@ -1,6 +1,9 @@ -// Clear screen etc, show READY prompt. -basic_warm_start: +// +// Continuation of the BASIC cold start routine +// + +basic_warm_start_real: #if CONFIG_MEMORY_MODEL_60K // We need our helpers to get to filenames under ROMs or IO area @@ -8,6 +11,7 @@ basic_warm_start: #endif // If warm start caused by BRK, print it address + // XXX sys 58235 also triggers this - to be fixed lda CMP0 ora CMP0+1 beq !+ diff --git a/c64/basic/init/e3b7.basic_warm_start.jmp.s b/c64/basic/init/e3b7.basic_warm_start.jmp.s new file mode 100644 index 00000000..8ebcfbde --- /dev/null +++ b/c64/basic/init/e3b7.basic_warm_start.jmp.s @@ -0,0 +1,5 @@ +// Clear screen etc, show READY prompt. + +basic_warm_start: + + jmp basic_warm_start_real diff --git a/c64/basic/init/e3b7.interop b/c64/basic/init/e3b7.interop new file mode 100644 index 00000000..1af6a185 --- /dev/null +++ b/c64/basic/init/e3b7.interop @@ -0,0 +1,5 @@ + +This is a well-known address, needed even for some BASIC programming - it's a common target for a SYS command. See for example here: + +- http://ready64.org/articoli/_files/043_pokesc64.txt + sys 58235 - Warm Start diff --git a/c64/kernal/fe25.interop b/c64/kernal/fe25.interop new file mode 100644 index 00000000..828e597b --- /dev/null +++ b/c64/kernal/fe25.interop @@ -0,0 +1,3 @@ + +Address adjusted to support $FE2D - routine which is probably used by many cartridges and other software to initialize parts of the system. At least the UCart uses it - see here: +- https://www.elektroda.pl/rtvforum/topic3293027.html \ No newline at end of file diff --git a/c64/kernal/memtop.s b/c64/kernal/fe25.memtop.s similarity index 100% rename from c64/kernal/memtop.s rename to c64/kernal/fe25.memtop.s diff --git a/c64/kernal/screen/e544.clear_screen.s b/c64/kernal/screen/clear_screen_real.s similarity index 98% rename from c64/kernal/screen/e544.clear_screen.s rename to c64/kernal/screen/clear_screen_real.s index 9c790007..df0b835a 100644 --- a/c64/kernal/screen/e544.clear_screen.s +++ b/c64/kernal/screen/clear_screen_real.s @@ -1,7 +1,7 @@ // Clear screen and initialise line link table // (Compute's Mapping the 64 p215-216) -clear_screen: +clear_screen_real: // XXX it is probably a good idea to hide cursor first diff --git a/c64/kernal/screen/e544.clear_screen.jmp.s b/c64/kernal/screen/e544.clear_screen.jmp.s new file mode 100644 index 00000000..50d16f38 --- /dev/null +++ b/c64/kernal/screen/e544.clear_screen.jmp.s @@ -0,0 +1,6 @@ +// Clear screen and initialise line link table +// (Compute's Mapping the 64 p215-216) + +clear_screen: + + jmp clear_screen_real diff --git a/c64/kernal/stubs/e566.home_cursor.s b/c64/kernal/stubs/e566.home_cursor.s new file mode 100644 index 00000000..4e5b7d5f --- /dev/null +++ b/c64/kernal/stubs/e566.home_cursor.s @@ -0,0 +1,4 @@ + +// XXX provide documentation and implementation + + STUB_IMPLEMENTATION() diff --git a/c64/kernal/stubs/e566.interop b/c64/kernal/stubs/e566.interop new file mode 100644 index 00000000..0d7630ac --- /dev/null +++ b/c64/kernal/stubs/e566.interop @@ -0,0 +1,5 @@ + +This is a well-known address, needed even for some BASIC programming - it's a common target for a SYS command. See for example here: + +- http://ready64.org/articoli/_files/043_pokesc64.txt + sys 58726 - CLR/HOME diff --git a/c64/kernal/stubs/e6b6.advance_cursor.s b/c64/kernal/stubs/e6b6.advance_cursor.s new file mode 100644 index 00000000..4e5b7d5f --- /dev/null +++ b/c64/kernal/stubs/e6b6.advance_cursor.s @@ -0,0 +1,4 @@ + +// XXX provide documentation and implementation + + STUB_IMPLEMENTATION() diff --git a/c64/kernal/stubs/e6b6.interop b/c64/kernal/stubs/e6b6.interop new file mode 100644 index 00000000..3c127ba7 --- /dev/null +++ b/c64/kernal/stubs/e6b6.interop @@ -0,0 +1,5 @@ + +This is a well-known address, needed even for some BASIC programming - it's a common target for a SYS command. See for example here: + +- http://ready64.org/articoli/_files/043_pokesc64.txt + sys 59062 - Advance Cursor diff --git a/c64/kernal/stubs/e701.interop b/c64/kernal/stubs/e701.interop new file mode 100644 index 00000000..89b3c8a9 --- /dev/null +++ b/c64/kernal/stubs/e701.interop @@ -0,0 +1,5 @@ + +This is a well-known address, needed even for some BASIC programming - it's a common target for a SYS command. See for example here: + +- http://ready64.org/articoli/_files/043_pokesc64.txt + sys 59137 - Previous Line diff --git a/c64/kernal/stubs/e701.previous_line.s b/c64/kernal/stubs/e701.previous_line.s new file mode 100644 index 00000000..4e5b7d5f --- /dev/null +++ b/c64/kernal/stubs/e701.previous_line.s @@ -0,0 +1,4 @@ + +// XXX provide documentation and implementation + + STUB_IMPLEMENTATION() diff --git a/c64/kernal/stubs/e8ea.interop b/c64/kernal/stubs/e8ea.interop new file mode 100644 index 00000000..fa5c0c1b --- /dev/null +++ b/c64/kernal/stubs/e8ea.interop @@ -0,0 +1,5 @@ + +This is a well-known address, needed even for some BASIC programming - it's a common target for a SYS command. See for example here: + +- http://ready64.org/articoli/_files/043_pokesc64.txt + sys 59626 - Scrolls a Line diff --git a/c64/kernal/stubs/e8ea.scroll_line.s b/c64/kernal/stubs/e8ea.scroll_line.s new file mode 100644 index 00000000..4e5b7d5f --- /dev/null +++ b/c64/kernal/stubs/e8ea.scroll_line.s @@ -0,0 +1,4 @@ + +// XXX provide documentation and implementation + + STUB_IMPLEMENTATION() diff --git a/c64/kernal/stubs/e9ff.clear_line.s b/c64/kernal/stubs/e9ff.clear_line.s new file mode 100644 index 00000000..4e5b7d5f --- /dev/null +++ b/c64/kernal/stubs/e9ff.clear_line.s @@ -0,0 +1,4 @@ + +// XXX provide documentation and implementation + + STUB_IMPLEMENTATION() diff --git a/c64/kernal/stubs/e9ff.interop b/c64/kernal/stubs/e9ff.interop new file mode 100644 index 00000000..107072db --- /dev/null +++ b/c64/kernal/stubs/e9ff.interop @@ -0,0 +1,5 @@ + +This is a well-known address, needed even for some BASIC programming - it's a common target for a SYS command. See for example here: + +- http://ready64.org/articoli/_files/043_pokesc64.txt + sys 59903 - Clears Line of Text diff --git a/c64/kernal/stubs/fd90.interop b/c64/kernal/stubs/fd90.interop new file mode 100644 index 00000000..28ecfca7 --- /dev/null +++ b/c64/kernal/stubs/fd90.interop @@ -0,0 +1,4 @@ + +This routine is probably used by many cartridges and other software to initialize parts of the system. At least the UCart uses it - see here: + +- https://www.elektroda.pl/rtvforum/topic3293027.html diff --git a/c64/kernal/stubs/fd90.unknown.s b/c64/kernal/stubs/fd90.unknown.s new file mode 100644 index 00000000..4e5b7d5f --- /dev/null +++ b/c64/kernal/stubs/fd90.unknown.s @@ -0,0 +1,4 @@ + +// XXX provide documentation and implementation + + STUB_IMPLEMENTATION() From 20097020116d32753504ce2ab0c6022c2c54fd0c Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 20 Oct 2019 11:53:50 +0200 Subject: [PATCH 77/85] added one more stub, Simon's BASIC does not crash anymore --- STATUS.md | 1 + c64/basic/a408.interop | 2 ++ c64/basic/a408.reason.s | 5 +++++ c64/kernal/fe25.memtop.s | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 c64/basic/a408.interop create mode 100644 c64/basic/a408.reason.s diff --git a/STATUS.md b/STATUS.md index 036ebf26..fb33b47a 100644 --- a/STATUS.md +++ b/STATUS.md @@ -76,6 +76,7 @@ Not all of them - only these we want to have implemented. | Address | Name | Status | Remarks | | :-------: | :----------- | :------: | :------------------------------------------------: | | `$A004` | revision str | DONE | | +| `$A408` | REASON | NOT DONE | | | `$A453` | (unknown) | NOT DONE | | | `$A533` | LINKPRG | DONE | | | `$A644` | new | NOT DONE | | diff --git a/c64/basic/a408.interop b/c64/basic/a408.interop new file mode 100644 index 00000000..fe2f5c41 --- /dev/null +++ b/c64/basic/a408.interop @@ -0,0 +1,2 @@ + +This address is called at least by the Simon's BASIC cartridge. diff --git a/c64/basic/a408.reason.s b/c64/basic/a408.reason.s new file mode 100644 index 00000000..f7613215 --- /dev/null +++ b/c64/basic/a408.reason.s @@ -0,0 +1,5 @@ + +// XXX provide documentation and implementation + +REASON: + STUB_IMPLEMENTATION() diff --git a/c64/kernal/fe25.memtop.s b/c64/kernal/fe25.memtop.s index 485112a0..960152b0 100644 --- a/c64/kernal/fe25.memtop.s +++ b/c64/kernal/fe25.memtop.s @@ -17,7 +17,7 @@ MEMTOP: // FALLTROUGH -memtop_set: +memtop_set: // for compatibility reasons this has to start at $FE2D sty MEMSIZK+1 stx MEMSIZK+0 From 0f80941eac262f958a82d2e301599eaf02ba92b1 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 20 Oct 2019 12:29:29 +0200 Subject: [PATCH 78/85] CINT adjustments for 'Operacja Proboszcz' game --- STATUS.md | 45 ++++++++++--------- ...int_real.s => cint_screen_keyboard_real.s} | 13 +++--- c64/kernal/init/e51b.cint_screen_keyboard.s | 6 +++ c64/kernal/init/e51b.interop | 2 + c64/kernal/init/ff5b.cint.jmp.s | 6 --- c64/kernal/init/ff5b.cint.s | 16 +++++++ .../interrupts/fe66.default_brk_handler.s | 1 + 7 files changed, 53 insertions(+), 36 deletions(-) rename c64/kernal/init/{cint_real.s => cint_screen_keyboard_real.s} (90%) create mode 100644 c64/kernal/init/e51b.cint_screen_keyboard.s create mode 100644 c64/kernal/init/e51b.interop delete mode 100644 c64/kernal/init/ff5b.cint.jmp.s create mode 100644 c64/kernal/init/ff5b.cint.s diff --git a/STATUS.md b/STATUS.md index fb33b47a..42c2197d 100644 --- a/STATUS.md +++ b/STATUS.md @@ -137,7 +137,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FFDB` | | `SETTIM` | DONE | | | `$FFDE` | | `RDTIM` | DONE | | | `$FFE1` | `$F6ED` | `STOP` | DONE | | -| `$FFE4` | `$F13E` | `GETIN` | PARTIAL | only keyaboard supported | +| `$FFE4` | `$F13E` | `GETIN` | PARTIAL | only keyboard supported | | `$FFE7` | `$F32F` | `CLALL` | DONE | | | `$FFEA` | | `UDTIM` | DONE | | | `$FFED` | | `SCREEN` | DONE | | @@ -155,26 +155,27 @@ Not all of them - only these we want to have implemented.
-| Address | Name | Status | Remarks | -| :-------: | :------------------ | :------: | :------------------------------------------------: | -| `$E544` | clear screen | DONE | | -| `$E50C` | set cursor position | PARTIAL | | -| `$E566` | home cursor | NOT DONE | | -| `$E5A0` | setup VIC II & IO | DONE | | -| `$E6B6` | advance cursor | NOT DONE | | -| `$E701` | previous line | NOT DONE | | -| `$E8EA` | scroll line | NOT DONE | | -| `$E9FF` | clear line | NOT DONE | | -| `$EA31` | default IRQ | PARTIAL | | -| `$EA7E` | ack CIA1 + below | DONE | | -| `$EA81` | ret from IRQ/NMI | DONE | | -| `$F142` | get key from buffer | DONE | | -| `$FD30` | default vectors | DONE | | -| `$FD90` | (unknown) | NOT DONE | | -| `$FD90` | (unknown) | NOT DONE | | -| `$FE2D` | memtop set part | DONE | | -| `$FE47` | default NMI | PARTIAL | | -| `$FE66` | default BRK | DONE | | -| `$FF80` | revision byte | DONE | | +| Address | Name | Status | Remarks | +| :-------: | :--------------------------- | :------: | :------------------------------------------------: | +| `$E51B` | init screen keyboard, no VIC | PARTIAL | not sure if correct | +| `$E544` | clear screen | DONE | | +| `$E50C` | set cursor position | PARTIAL | | +| `$E566` | home cursor | NOT DONE | | +| `$E5A0` | setup VIC II & IO | DONE | | +| `$E6B6` | advance cursor | NOT DONE | | +| `$E701` | previous line | NOT DONE | | +| `$E8EA` | scroll line | NOT DONE | | +| `$E9FF` | clear line | NOT DONE | | +| `$EA31` | default IRQ | PARTIAL | | +| `$EA7E` | ack CIA1 + below | DONE | | +| `$EA81` | ret from IRQ/NMI | DONE | | +| `$F142` | get key from buffer | DONE | | +| `$FD30` | default vectors | DONE | | +| `$FD90` | (unknown) | NOT DONE | | +| `$FD90` | (unknown) | NOT DONE | | +| `$FE2D` | memtop set part | DONE | | +| `$FE47` | default NMI | PARTIAL | | +| `$FE66` | default BRK | DONE | | +| `$FF80` | revision byte | DONE | |
diff --git a/c64/kernal/init/cint_real.s b/c64/kernal/init/cint_screen_keyboard_real.s similarity index 90% rename from c64/kernal/init/cint_real.s rename to c64/kernal/init/cint_screen_keyboard_real.s index 2c4722a4..453320f4 100644 --- a/c64/kernal/init/cint_real.s +++ b/c64/kernal/init/cint_screen_keyboard_real.s @@ -1,15 +1,15 @@ // -// Official Kernal routine, described in: +// It seems this is a part CINT which initializes screen and keyboard, but does not +// reset VIC-II. See here: https://csdb.dk/forums/index.php?roomid=11&topicid=17048&firstpost=22 // +// For more details see: // - [RG64] C64 Programmer's Reference Guide - page 280 // - [CM64] Compute's Mapping the Commodore 64 - page 242 -// -// CPU registers that has to be preserved (see [RG64]): none -// +cint_screen_keyboard_real: -cint_real: + // XXX check what really is performed here // According to [CM64], this routine checks for PAL/NTSC. It's definitely not done // within the 'BRK' part, this can be easily checked - POKE something @@ -116,9 +116,6 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? ldx #$00 stx MODE - // Setup video and I/O - jsr setup_vicii - // Fallthrough/jump to screen clear routine (Compute's Mapping the 64 p215) jmp clear_screen diff --git a/c64/kernal/init/e51b.cint_screen_keyboard.s b/c64/kernal/init/e51b.cint_screen_keyboard.s new file mode 100644 index 00000000..5ed66544 --- /dev/null +++ b/c64/kernal/init/e51b.cint_screen_keyboard.s @@ -0,0 +1,6 @@ + +// Routine too long to fit here + +cint_screen_keyboard: + + jmp cint_screen_keyboard_real diff --git a/c64/kernal/init/e51b.interop b/c64/kernal/init/e51b.interop new file mode 100644 index 00000000..5b2be0e9 --- /dev/null +++ b/c64/kernal/init/e51b.interop @@ -0,0 +1,2 @@ + +Game 'Operacja Proboszcz' explicitly calls this location. diff --git a/c64/kernal/init/ff5b.cint.jmp.s b/c64/kernal/init/ff5b.cint.jmp.s deleted file mode 100644 index d692928f..00000000 --- a/c64/kernal/init/ff5b.cint.jmp.s +++ /dev/null @@ -1,6 +0,0 @@ - -// Our implementation is longer than the original one, -// placing it here would cause a collision with OPEN - -CINT: - jmp cint_real diff --git a/c64/kernal/init/ff5b.cint.s b/c64/kernal/init/ff5b.cint.s new file mode 100644 index 00000000..bb3b91b0 --- /dev/null +++ b/c64/kernal/init/ff5b.cint.s @@ -0,0 +1,16 @@ + +// +// Official Kernal routine, described in: +// +// - [RG64] C64 Programmer's Reference Guide - page 280 +// - [CM64] Compute's Mapping the Commodore 64 - page 242 +// +// CPU registers that has to be preserved (see [RG64]): none +// + +CINT: + + // Setup video and I/O + jsr setup_vicii + + jmp cint_screen_keyboard diff --git a/c64/kernal/interrupts/fe66.default_brk_handler.s b/c64/kernal/interrupts/fe66.default_brk_handler.s index 53d70783..c788385e 100644 --- a/c64/kernal/interrupts/fe66.default_brk_handler.s +++ b/c64/kernal/interrupts/fe66.default_brk_handler.s @@ -12,6 +12,7 @@ default_brk_handler: jsr JRESTOR jsr JIOINIT + jsr setup_vicii // XXX should probably be a part of cint_brk jsr cint_brk cli From a9d167810bccca311ce470bf8064abbbb39fbf6e Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 20 Oct 2019 12:54:08 +0200 Subject: [PATCH 79/85] documentation updates, brand-specific colors adjustments --- STATUS.md | 2 +- c64/basic/init/startup_banner.s | 30 +++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/STATUS.md b/STATUS.md index 42c2197d..f3c680be 100644 --- a/STATUS.md +++ b/STATUS.md @@ -102,7 +102,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | Address | Unofficial | Name | Status | Remarks | | :-------: | :--------: | :---------- | :------: | :--------------------------------------------------: | | `($028F)` | | `KEYLOG` | DONE | | -| `$FF81` | `$FF5B` | `CINT` | PARTIAL | probably incomplete, to be checked | +| `$FF81` | `$FF5B` | `CINT` | PARTIAL | probably incomplete, needs adjustments for compat. | | `$FF84` | `$FDA3` | `IOINIT` | PARTIAL | CIA initialization incomplete | | `$FF87` | `$FD50` | `RAMTAS` | PARTIAL | probably shouldn't touch VIC and CIA's | | `$FF8A` | `$FD15` | `RESTOR` | DONE | | diff --git a/c64/basic/init/startup_banner.s b/c64/basic/init/startup_banner.s index bb0901ed..0fbc4049 100644 --- a/c64/basic/init/startup_banner.s +++ b/c64/basic/init/startup_banner.s @@ -33,11 +33,31 @@ startup_banner: rainbow_logo: - .byte $1C, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $0D - .byte $9E, $12, $A4, $A4, $A4, $A4, $A4, $A4, $0D - .byte $1E, $12, $A4, $A4, $A4, $A4, $A4, $0D - .byte $9F, $12, $A4, $A4, $A4, $A4, $92 - .byte $05, $00 +{ +#if CONFIG_COLORS_BRAND && CONFIG_BRAND_MEGA_65 + + .var SET_COLOR_0 = $05 + .var SET_COLOR_1 = $9A + .var SET_COLOR_2 = $1E + .var SET_COLOR_3 = $9E + .var SET_COLOR_4 = $96 + +#else + + .var SET_COLOR_0 = $05 + .var SET_COLOR_1 = $1C + .var SET_COLOR_2 = $9E + .var SET_COLOR_3 = $1E + .var SET_COLOR_4 = $9F + +#endif + + .byte SET_COLOR_1, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $0D + .byte SET_COLOR_2, $12, $A4, $A4, $A4, $A4, $A4, $A4, $0D + .byte SET_COLOR_3, $12, $A4, $A4, $A4, $A4, $A4, $0D + .byte SET_COLOR_4, $12, $A4, $A4, $A4, $A4, $92 + .byte SET_COLOR_0, $00 +} pre_revision_string: From 98860e983122f0371ccd4cf4d35ed38034b83381 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 20 Oct 2019 13:37:25 +0200 Subject: [PATCH 80/85] CINT should be complete now --- STATUS.md | 7 +-- ...keyboard_real.s => cint_screen_keyboard.s} | 54 +------------------ c64/kernal/init/e518.cint_legacy.s | 22 ++++++++ c64/kernal/init/e518.interop | 3 ++ c64/kernal/init/e51b.cint_screen_keyboard.s | 6 --- c64/kernal/init/e51b.interop | 2 - c64/kernal/init/fda3.ioinit.s | 17 +++--- c64/kernal/init/ff5b.cint.s | 46 ++++++++++++++-- .../interrupts/fe66.default_brk_handler.s | 8 ++- 9 files changed, 88 insertions(+), 77 deletions(-) rename c64/kernal/init/{cint_screen_keyboard_real.s => cint_screen_keyboard.s} (51%) create mode 100644 c64/kernal/init/e518.cint_legacy.s create mode 100644 c64/kernal/init/e518.interop delete mode 100644 c64/kernal/init/e51b.cint_screen_keyboard.s delete mode 100644 c64/kernal/init/e51b.interop diff --git a/STATUS.md b/STATUS.md index f3c680be..b23dba37 100644 --- a/STATUS.md +++ b/STATUS.md @@ -102,8 +102,8 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | Address | Unofficial | Name | Status | Remarks | | :-------: | :--------: | :---------- | :------: | :--------------------------------------------------: | | `($028F)` | | `KEYLOG` | DONE | | -| `$FF81` | `$FF5B` | `CINT` | PARTIAL | probably incomplete, needs adjustments for compat. | -| `$FF84` | `$FDA3` | `IOINIT` | PARTIAL | CIA initialization incomplete | +| `$FF81` | `$FF5B` | `CINT` | DONE | | +| `$FF84` | `$FDA3` | `IOINIT` | PARTIAL | CIA initialization might be incomplete | | `$FF87` | `$FD50` | `RAMTAS` | PARTIAL | probably shouldn't touch VIC and CIA's | | `$FF8A` | `$FD15` | `RESTOR` | DONE | | | `$FF8D` | `$FD1A` | `VECTOR` | DONE | | @@ -157,7 +157,8 @@ Not all of them - only these we want to have implemented. | Address | Name | Status | Remarks | | :-------: | :--------------------------- | :------: | :------------------------------------------------: | -| `$E51B` | init screen keyboard, no VIC | PARTIAL | not sure if correct | +| `$E518` | legacy part of CINT | DONE | | +| `$E51B` | init screen keyboard, no VIC | DONE | | | `$E544` | clear screen | DONE | | | `$E50C` | set cursor position | PARTIAL | | | `$E566` | home cursor | NOT DONE | | diff --git a/c64/kernal/init/cint_screen_keyboard_real.s b/c64/kernal/init/cint_screen_keyboard.s similarity index 51% rename from c64/kernal/init/cint_screen_keyboard_real.s rename to c64/kernal/init/cint_screen_keyboard.s index 453320f4..0470d710 100644 --- a/c64/kernal/init/cint_screen_keyboard_real.s +++ b/c64/kernal/init/cint_screen_keyboard.s @@ -1,62 +1,12 @@ // -// It seems this is a part CINT which initializes screen and keyboard, but does not -// reset VIC-II. See here: https://csdb.dk/forums/index.php?roomid=11&topicid=17048&firstpost=22 +// This is a part CINT which initializes screen and keyboard // // For more details see: // - [RG64] C64 Programmer's Reference Guide - page 280 // - [CM64] Compute's Mapping the Commodore 64 - page 242 -cint_screen_keyboard_real: - - // XXX check what really is performed here - - // According to [CM64], this routine checks for PAL/NTSC. It's definitely not done - // within the 'BRK' part, this can be easily checked - POKE something - // to address 678 on a real C64, press STOP+RESTORE, the value won't change - - // Detect video system (PAL/NTSC), use Graham's method, as it's short and reliable - // see here: https://codebase64.org/doku.php?id=base:detect_pal_ntsc - - lda #$C8 // preparation, as the VIC might be uninitialized - sta VIC_SCROLX - -cint_w0: - lda VIC_RASTER -cint_w1: - cmp VIC_RASTER - beq cint_w1 - bmi cint_w0 - - // Result in A, if no interrupt happened during the test: - // #$37 -> 312 rasterlines, PAL, VIC 6569 - // #$06 -> 263 rasterlines, NTSC, VIC 6567R8 - // #$05 -> 262 rasterlines, NTSC, VIC 6567R56A - - cmp #$07 - bcs cint_pal - -cint_ntsc: - - // NTSC C64 (https://codebase64.org/doku.php?id=base:cpu_clocking), - // is clocked at 1.022727 MHz, so that 1/60s is 17045 CPU cycles - - ldy #<17045 - ldx #>17045 - - sty CIA1_TIMALO - stx CIA1_TIMAHI - - lda #$00 - beq !+ - -cint_pal: - - lda #$01 -!: - sta TVSFLG - -cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? +cint_screen_keyboard: // Setup KEYLOG vector diff --git a/c64/kernal/init/e518.cint_legacy.s b/c64/kernal/init/e518.cint_legacy.s new file mode 100644 index 00000000..93effe63 --- /dev/null +++ b/c64/kernal/init/e518.cint_legacy.s @@ -0,0 +1,22 @@ + +// +// Part of the official Kernal routine, described in: +// +// - [RG64] C64 Programmer's Reference Guide - page 280 +// - [CM64] Compute's Mapping the Commodore 64 - page 242 +// +// CPU registers that has to be preserved (see [RG64]): none +// + + +cint_legacy: // $E518 + + // Setup video and I/O + // See here: https://csdb.dk/forums/index.php?roomid=11&topicid=17048&firstpost=22 + jsr setup_vicii + + // Code below must be placed under $E51B, or some code will break - see here: + // - https://csdb.dk/forums/index.php?roomid=11&topicid=17048&firstpost=2 + // Game 'Operacja Proboszcz' is one example. + + jmp cint_screen_keyboard // XXX try to fit the code here diff --git a/c64/kernal/init/e518.interop b/c64/kernal/init/e518.interop new file mode 100644 index 00000000..9d542a55 --- /dev/null +++ b/c64/kernal/init/e518.interop @@ -0,0 +1,3 @@ + +Game 'Operacja Proboszcz' explicitly calls $E51B - thus, it is sane +to place old CINT routine in it's original place diff --git a/c64/kernal/init/e51b.cint_screen_keyboard.s b/c64/kernal/init/e51b.cint_screen_keyboard.s deleted file mode 100644 index 5ed66544..00000000 --- a/c64/kernal/init/e51b.cint_screen_keyboard.s +++ /dev/null @@ -1,6 +0,0 @@ - -// Routine too long to fit here - -cint_screen_keyboard: - - jmp cint_screen_keyboard_real diff --git a/c64/kernal/init/e51b.interop b/c64/kernal/init/e51b.interop deleted file mode 100644 index 5b2be0e9..00000000 --- a/c64/kernal/init/e51b.interop +++ /dev/null @@ -1,2 +0,0 @@ - -Game 'Operacja Proboszcz' explicitly calls this location. diff --git a/c64/kernal/init/fda3.ioinit.s b/c64/kernal/init/fda3.ioinit.s index 28437fe5..21db2594 100644 --- a/c64/kernal/init/fda3.ioinit.s +++ b/c64/kernal/init/fda3.ioinit.s @@ -77,17 +77,16 @@ IOINIT: // Set timer interval to ~1/60th of a second - // (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 + // Probably NTSC is the default one, as PAL support was introduced later, + // in a patch - see [CM64] page 242 and page: + // - http://commodore64.se/wiki/index.php/Commodore_64_KERNAL_ROM_versions + // "The KERNAL ROM R1 was obviously used only in early NTSC systems. It lacks the PAL/NTSC detection" - // PAL C64 (https://codebase64.org/doku.php?id=base:cpu_clocking), - // is clocked at 0.985248 MHz, so that 1/60s is 16421 CPU cycles + // NTSC C64 (https://codebase64.org/doku.php?id=base:cpu_clocking), + // is clocked at 1.022727 MHz, so that 1/60s is 17045 CPU cycles - ldy #<16421 - ldx #>16421 + ldy #<17045 + ldx #>17045 sty CIA1_TIMALO stx CIA1_TIMAHI diff --git a/c64/kernal/init/ff5b.cint.s b/c64/kernal/init/ff5b.cint.s index bb3b91b0..3be82f54 100644 --- a/c64/kernal/init/ff5b.cint.s +++ b/c64/kernal/init/ff5b.cint.s @@ -10,7 +10,47 @@ CINT: - // Setup video and I/O - jsr setup_vicii + jsr cint_legacy - jmp cint_screen_keyboard +cint_check_pal_ntsc: + + // Detect video system (PAL/NTSC), use Graham's method, as it's short and reliable + // see here: https://codebase64.org/doku.php?id=base:detect_pal_ntsc + + lda VIC_RASTER +!: + cmp VIC_RASTER + beq !- + bmi cint_check_pal_ntsc + + // Result in A, if no interrupt happened during the test: + // #$37 -> 312 rasterlines, PAL, VIC 6569 + // #$06 -> 263 rasterlines, NTSC, VIC 6567R8 + // #$05 -> 262 rasterlines, NTSC, VIC 6567R56A + + cmp #$07 + bcc cont_done + +cint_pal: + + // (This value was calculated by running a custom IRQ handler on a C64 + // with original KERNAL, and writing the values of $DC04/5 to the screen + // in the IRQ handler to see roughly what value the timers must be set to) + // ldy #<16380 + // ldx #>16380 + + // PAL C64 (https://codebase64.org/doku.php?id=base:cpu_clocking), + // is clocked at 0.985248 MHz, so that 1/60s is 16421 CPU cycles + + ldy #<16421 + ldx #>16421 + + sty CIA1_TIMALO + stx CIA1_TIMAHI + + lda #$01 +!: + sta TVSFLG + +cont_done: + rts diff --git a/c64/kernal/interrupts/fe66.default_brk_handler.s b/c64/kernal/interrupts/fe66.default_brk_handler.s index c788385e..78a63c72 100644 --- a/c64/kernal/interrupts/fe66.default_brk_handler.s +++ b/c64/kernal/interrupts/fe66.default_brk_handler.s @@ -12,8 +12,12 @@ default_brk_handler: jsr JRESTOR jsr JIOINIT - jsr setup_vicii // XXX should probably be a part of cint_brk - jsr cint_brk + + // Original routine calls just a part of CINT - but I'm not sure which one. Most likely it + // skips the PAL/NTSC check by calling $E518. I suspect bug in the original ROM, let's + // call the whole CINT, just to be sure everything is initialized. + + jsr CINT cli From c41da81e06bc42a4248772cce93da4414dfd8ac1 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 20 Oct 2019 15:52:28 +0200 Subject: [PATCH 81/85] added even more stubs --- STATUS.md | 3 +++ c64/kernal/stubs/e716.chrout_screen.s | 4 ++++ c64/kernal/stubs/e716.interop | 3 +++ c64/kernal/stubs/e96c.insert_line_at_top.s | 4 ++++ c64/kernal/stubs/e96c.interop | 3 +++ c64/kernal/stubs/f646.iec_close.s | 5 +++++ c64/kernal/stubs/f646.interop | 3 +++ 7 files changed, 25 insertions(+) create mode 100644 c64/kernal/stubs/e716.chrout_screen.s create mode 100644 c64/kernal/stubs/e716.interop create mode 100644 c64/kernal/stubs/e96c.insert_line_at_top.s create mode 100644 c64/kernal/stubs/e96c.interop create mode 100644 c64/kernal/stubs/f646.iec_close.s create mode 100644 c64/kernal/stubs/f646.interop diff --git a/STATUS.md b/STATUS.md index b23dba37..a036e81e 100644 --- a/STATUS.md +++ b/STATUS.md @@ -165,12 +165,15 @@ Not all of them - only these we want to have implemented. | `$E5A0` | setup VIC II & IO | DONE | | | `$E6B6` | advance cursor | NOT DONE | | | `$E701` | previous line | NOT DONE | | +| `$E716` | screen CHROUT | NOT DONE | | | `$E8EA` | scroll line | NOT DONE | | +| `$E96C` | insert line on top | NOT DONE | | | `$E9FF` | clear line | NOT DONE | | | `$EA31` | default IRQ | PARTIAL | | | `$EA7E` | ack CIA1 + below | DONE | | | `$EA81` | ret from IRQ/NMI | DONE | | | `$F142` | get key from buffer | DONE | | +| `$F646` | IEC close | NOT DONE | | | `$FD30` | default vectors | DONE | | | `$FD90` | (unknown) | NOT DONE | | | `$FD90` | (unknown) | NOT DONE | | diff --git a/c64/kernal/stubs/e716.chrout_screen.s b/c64/kernal/stubs/e716.chrout_screen.s new file mode 100644 index 00000000..423ed67b --- /dev/null +++ b/c64/kernal/stubs/e716.chrout_screen.s @@ -0,0 +1,4 @@ + +// Screen CHROUT + + STUB_IMPLEMENTATION() diff --git a/c64/kernal/stubs/e716.interop b/c64/kernal/stubs/e716.interop new file mode 100644 index 00000000..b47324fd --- /dev/null +++ b/c64/kernal/stubs/e716.interop @@ -0,0 +1,3 @@ + +This routine is called at least by the Final Cartridge III. See: +- https://github.com/mist64/final_cartridge/blob/master/core/kernal_c64.i diff --git a/c64/kernal/stubs/e96c.insert_line_at_top.s b/c64/kernal/stubs/e96c.insert_line_at_top.s new file mode 100644 index 00000000..f28c13c4 --- /dev/null +++ b/c64/kernal/stubs/e96c.insert_line_at_top.s @@ -0,0 +1,4 @@ + +// Insert line at top of screen + + STUB_IMPLEMENTATION() diff --git a/c64/kernal/stubs/e96c.interop b/c64/kernal/stubs/e96c.interop new file mode 100644 index 00000000..b47324fd --- /dev/null +++ b/c64/kernal/stubs/e96c.interop @@ -0,0 +1,3 @@ + +This routine is called at least by the Final Cartridge III. See: +- https://github.com/mist64/final_cartridge/blob/master/core/kernal_c64.i diff --git a/c64/kernal/stubs/f646.iec_close.s b/c64/kernal/stubs/f646.iec_close.s new file mode 100644 index 00000000..d4d05036 --- /dev/null +++ b/c64/kernal/stubs/f646.iec_close.s @@ -0,0 +1,5 @@ + + +// IEC close + + STUB_IMPLEMENTATION() diff --git a/c64/kernal/stubs/f646.interop b/c64/kernal/stubs/f646.interop new file mode 100644 index 00000000..b47324fd --- /dev/null +++ b/c64/kernal/stubs/f646.interop @@ -0,0 +1,3 @@ + +This routine is called at least by the Final Cartridge III. See: +- https://github.com/mist64/final_cartridge/blob/master/core/kernal_c64.i From 2afe11c3b313999f86ba7f26bd3e6e2e5270256d Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 20 Oct 2019 16:14:54 +0200 Subject: [PATCH 82/85] moved PAL/NTSC support to a separate routine --- c64/kernal/init/fda3.ioinit.s | 18 +-------- c64/kernal/init/ff5b.cint.s | 44 +-------------------- c64/kernal/init/setup_pal_ntsc.s | 65 ++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 60 deletions(-) create mode 100644 c64/kernal/init/setup_pal_ntsc.s diff --git a/c64/kernal/init/fda3.ioinit.s b/c64/kernal/init/fda3.ioinit.s index 21db2594..0337ec11 100644 --- a/c64/kernal/init/fda3.ioinit.s +++ b/c64/kernal/init/fda3.ioinit.s @@ -8,6 +8,7 @@ // CPU registers that has to be preserved (see [RG64]): none // + IOINIT: // Set $00/$01 port mode and value @@ -75,22 +76,6 @@ IOINIT: sta CIA2_ICR sta CIA1_ICR - // Set timer interval to ~1/60th of a second - - // Probably NTSC is the default one, as PAL support was introduced later, - // in a patch - see [CM64] page 242 and page: - // - http://commodore64.se/wiki/index.php/Commodore_64_KERNAL_ROM_versions - // "The KERNAL ROM R1 was obviously used only in early NTSC systems. It lacks the PAL/NTSC detection" - - // NTSC C64 (https://codebase64.org/doku.php?id=base:cpu_clocking), - // is clocked at 1.022727 MHz, so that 1/60s is 17045 CPU cycles - - ldy #<17045 - ldx #>17045 - - sty CIA1_TIMALO - stx CIA1_TIMAHI - // Enable timer interrupt lda #$81 sta CIA1_ICR @@ -117,4 +102,3 @@ IOINIT: // Set IEC bus to its initial idle state jmp iec_set_idle - diff --git a/c64/kernal/init/ff5b.cint.s b/c64/kernal/init/ff5b.cint.s index 3be82f54..6f8fe591 100644 --- a/c64/kernal/init/ff5b.cint.s +++ b/c64/kernal/init/ff5b.cint.s @@ -11,46 +11,4 @@ CINT: jsr cint_legacy - -cint_check_pal_ntsc: - - // Detect video system (PAL/NTSC), use Graham's method, as it's short and reliable - // see here: https://codebase64.org/doku.php?id=base:detect_pal_ntsc - - lda VIC_RASTER -!: - cmp VIC_RASTER - beq !- - bmi cint_check_pal_ntsc - - // Result in A, if no interrupt happened during the test: - // #$37 -> 312 rasterlines, PAL, VIC 6569 - // #$06 -> 263 rasterlines, NTSC, VIC 6567R8 - // #$05 -> 262 rasterlines, NTSC, VIC 6567R56A - - cmp #$07 - bcc cont_done - -cint_pal: - - // (This value was calculated by running a custom IRQ handler on a C64 - // with original KERNAL, and writing the values of $DC04/5 to the screen - // in the IRQ handler to see roughly what value the timers must be set to) - // ldy #<16380 - // ldx #>16380 - - // PAL C64 (https://codebase64.org/doku.php?id=base:cpu_clocking), - // is clocked at 0.985248 MHz, so that 1/60s is 16421 CPU cycles - - ldy #<16421 - ldx #>16421 - - sty CIA1_TIMALO - stx CIA1_TIMAHI - - lda #$01 -!: - sta TVSFLG - -cont_done: - rts + jmp setup_pal_ntsc diff --git a/c64/kernal/init/setup_pal_ntsc.s b/c64/kernal/init/setup_pal_ntsc.s new file mode 100644 index 00000000..0b5ae619 --- /dev/null +++ b/c64/kernal/init/setup_pal_ntsc.s @@ -0,0 +1,65 @@ + +// Detect video system (PAL/NTSC), use Graham's method, as it's short and reliable +// see here: https://codebase64.org/doku.php?id=base:detect_pal_ntsc + + +setup_pal_ntsc: + + lda VIC_RASTER +!: + cmp VIC_RASTER + beq !- + bmi setup_pal_ntsc + + // Result in A, if no interrupt happened during the test: + // #$37 -> 312 rasterlines, PAL, VIC 6569 + // #$06 -> 263 rasterlines, NTSC, VIC 6567R8 + // #$05 -> 262 rasterlines, NTSC, VIC 6567R56A + + cmp #$07 + bcc setup_ntsc + + // FALLTROUGH + +setup_pal: + + // Set timer interval to ~1/60th of a second + + // (This value was calculated by running a custom IRQ handler on a C64 + // with original KERNAL, and writing the values of $DC04/5 to the screen + // in the IRQ handler to see roughly what value the timers must be set to) + // ldy #<16380 + // ldx #>16380 + + // PAL C64 (https://codebase64.org/doku.php?id=base:cpu_clocking), + // is clocked at 0.985248 MHz, so that 1/60s is 16421 CPU cycles + + ldy #<16421 + ldx #>16421 + + lda #$01 + + // FALLTROUGH + +setup_pal_ntsc_end: + + sty CIA1_TIMALO + stx CIA1_TIMAHI + + sta TVSFLG + + rts + +setup_ntsc: + + // Set timer interval to ~1/60th of a second + + // NTSC C64 (https://codebase64.org/doku.php?id=base:cpu_clocking), + // is clocked at 1.022727 MHz, so that 1/60s is 17045 CPU cycles + + ldy #<17045 + ldx #>17045 + + lda #$00 + + beq setup_pal_ntsc_end // branch always From 877159c2a26b887f30a8ddd7dc5c59ec4f2b9f7e Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 22 Oct 2019 16:38:10 +0200 Subject: [PATCH 83/85] ghost RUN/STOP won't cause war restart together with RESTORE anymore --- c64/,,config_generic.s | 4 ++-- c64/,,config_mega65.s | 4 ++-- c64/,,config_testing.s | 2 +- c64/,,config_ultimate64.s | 2 +- c64/kernal/interrupts/udtim.s | 25 ++++++++++++++++++++----- c64/kernal/keyboard/scnkey.s | 20 +++++++++----------- c64/kernal/keyboard/scnkey_128.s | 2 +- 7 files changed, 36 insertions(+), 23 deletions(-) diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 74605b8a..8965f1dd 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -52,10 +52,10 @@ // Keyboard settings // #define CONFIG_LEGACY_SCNKEY -#define CONFIG_KEYBOARD_C128 +#define CONFIG_KEYBOARD_C128 // incomplete #define CONFIG_KEYBOARD_C128_CAPS_LOCK // #define CONFIG_KEY_REPEAT_DEFAULT -#define CONFIG_KEY_REPEAT_ALWAYS +// #define CONFIG_KEY_REPEAT_ALWAYS #define CONFIG_KEY_FAST_SCAN #define CONFIG_JOY1_CURSOR #define CONFIG_JOY2_CURSOR diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index b4d2fa59..65169f8d 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -54,10 +54,10 @@ // Keyboard settings // #define CONFIG_LEGACY_SCNKEY -// #define CONFIG_KEYBOARD_C128 +// #define CONFIG_KEYBOARD_C128 // incomplete // #define CONFIG_KEYBOARD_C128_CAPS_LOCK // #define CONFIG_KEY_REPEAT_DEFAULT -#define CONFIG_KEY_REPEAT_ALWAYS +// #define CONFIG_KEY_REPEAT_ALWAYS #define CONFIG_KEY_FAST_SCAN #define CONFIG_JOY1_CURSOR #define CONFIG_JOY2_CURSOR diff --git a/c64/,,config_testing.s b/c64/,,config_testing.s index b6c84487..877a5005 100644 --- a/c64/,,config_testing.s +++ b/c64/,,config_testing.s @@ -53,7 +53,7 @@ // Keyboard settings #define CONFIG_LEGACY_SCNKEY -// #define CONFIG_KEYBOARD_C128 +// #define CONFIG_KEYBOARD_C128 // incomplete // #define CONFIG_KEYBOARD_C128_CAPS_LOCK // #define CONFIG_KEY_REPEAT_DEFAULT // #define CONFIG_KEY_REPEAT_ALWAYS diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index 4b99e84e..1eda8501 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -52,7 +52,7 @@ // Keyboard settings // #define CONFIG_LEGACY_SCNKEY -// #define CONFIG_KEYBOARD_C128 +// #define CONFIG_KEYBOARD_C128 // incomplete // #define CONFIG_KEYBOARD_C128_CAPS_LOCK // #define CONFIG_KEY_REPEAT_DEFAULT // #define CONFIG_KEY_REPEAT_ALWAYS diff --git a/c64/kernal/interrupts/udtim.s b/c64/kernal/interrupts/udtim.s index f9d4fa99..769ab0e4 100644 --- a/c64/kernal/interrupts/udtim.s +++ b/c64/kernal/interrupts/udtim.s @@ -3,7 +3,7 @@ // Official Kernal routine, described in: // // - [RG64] C64 Programmer's Reference Guide - page 303 -// - [CM64] Compute's Mapping the Commodore 64 - page 232 +// - [CM64] Compute's Mapping the Commodore 64 - pages 27, 232 // // CPU registers that has to be preserved (see [RG64]): .Y // @@ -23,18 +23,33 @@ UDTIM: udtim_update_stkey: // entry to be used when interrupts are disabled - // Another action we have to perform is to copy the last row of keyboard to RAM, - // so that various routines can detect the STOP key press + // According to [CM64], page 27, another action we have to perform is to copy + // the last row of keyboard to RAM, so that various routines can detect the STOP + // key press. But something as simple as this would have created warm restart + // with M+N+SPACE+RESTORE due to ghosting - so the original ROM has to provide + // some protection here. I do not know what the mechanism there exactly does, + // but I hope the mechanism below will be compatible enough. + lda #$80 + sta CIA1_PRA // select all the rows except the last one #if CONFIG_KEYBOARD_C128 - lda #$FF - sta VIC_XSCAN // disconnect the extra C128 keys + ldx #$00 + stx VIC_XSCAN // connect all the extra C128 keys #endif + lda CIA1_PRB // read the keys + eor #$FF + sta STKEY // store reversed state - to filter out anything vulnerable to ghosting + +#if CONFIG_KEYBOARD_C128 + dex // puts $FF + stx VIC_XSCAN // disconnect the extra C128 keys +#endif lda #$7F sta CIA1_PRA // select the last row (bit to 0) lda CIA1_PRB // read the row + ora STKEY // filter out what might be the reason of ghosting sta STKEY // Leave the CIA configured this way. It would be far better to disconnect diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 821abfa1..b1ed3a5f 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -37,10 +37,11 @@ SCNKEY: lda #$00 sta SHFLAG - // Check for any activity - #if !CONFIG_JOY2_CURSOR && CONFIG_KEY_FAST_SCAN + // Check for any activity - speed optimization, but cannot be done + // that early if we are to scan the joystick #2 + ldx #$00 stx CIA1_PRA // connect all the rows #if CONFIG_KEYBOARD_C128 @@ -57,13 +58,10 @@ SCNKEY: #if CONFIG_KEYBOARD_C128_CAPS_LOCK // First check if this is really a C128 - to avoid false positive - lda #$00 - sta VIC_XSCAN - lda #$FF -#if !CONFIG_KEYBOARD_C128 - tax // preserve the $FF, will be needed later -#endif - cmp VIC_XSCAN + ldx #$00 + stx VIC_XSCAN + dex // puts $FF + cpx VIC_XSCAN beq !+ // branch if C64, C128 will keep some bits cleared lda CPU_R6510 @@ -90,7 +88,7 @@ scnkey_bucky_loop: #endif lda kb_matrix_bucky_testmask, y and CIA1_PRB - bne !+ // not pressed + bne !+ // branch if not pressed lda SHFLAG ora kb_matrix_bucky_shflag, y sta SHFLAG @@ -165,7 +163,7 @@ scnkey_matrix_loop: cmp #$FF beq scnkey_matrix_loop_next // skip if no key pressed from this row cpy #$FF - bne scnkey_no_keys // clash, more than one key pressed + bne scnkey_no_keys // jam, more than one key pressed // We have at least one key pressed in this row, we need to find which one exactly ldy #$07 scnkey_matrix_loop_inner: diff --git a/c64/kernal/keyboard/scnkey_128.s b/c64/kernal/keyboard/scnkey_128.s index 44f810d4..7fc8ddf5 100644 --- a/c64/kernal/keyboard/scnkey_128.s +++ b/c64/kernal/keyboard/scnkey_128.s @@ -28,7 +28,7 @@ scnkey_matrix_128_loop: cmp #$FF beq scnkey_matrix_128_loop_next // skip if no key pressed from this row cpy #$FF - bne scnkey_128_no_keys // clash, more than one key pressed + bne scnkey_128_no_keys // jam, more than one key pressed // We have at least one key pressed in this row, we need to find which one exactly ldy #$07 scnkey_matrix_128_loop_inner: From a052b3e25ca04de260b63c2a23e8e90cc2b76a21 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 25 Oct 2019 18:22:18 +0200 Subject: [PATCH 84/85] build tool logging fix, corrected C65 keyboard definitions --- c64/aliases/,aliases_hardware.s | 14 +++++++++++++- c64/aliases/,aliases_petscii_codes.s | 28 +++++++++++++++------------- src/build_segment.cc | 2 +- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/c64/aliases/,aliases_hardware.s b/c64/aliases/,aliases_hardware.s index 91a117f1..63790da6 100644 --- a/c64/aliases/,aliases_hardware.s +++ b/c64/aliases/,aliases_hardware.s @@ -65,9 +65,13 @@ .label VIC_SP6COL = $D02D .label VIC_SP7COL = $D02E +#if !CONFIG_MB_MEGA_65 && !CONFIG_MB_ULTIMATE_64 + .label VIC_XSCAN = $D02F // C128 only .label VIC_CLKRATE = $D030 // C128 only - + +#endif + // SID registers .label __SID_BASE = $D400 // base address of the chip @@ -161,4 +165,12 @@ .const BIT_CIA2_PRA_CLK_IN = $40 // 0 - low (pulled), 1 - high (released) .const BIT_CIA2_PRA_DAT_IN = $80 // 0 - low (pulled), 1 - high (released) +#if CONFIG_MB_MEGA_65 + + .const C65_EXTKEYS_PR = $D607 + .const C65_EXTKEYS_DDR = $D608 + +#endif + + #endif diff --git a/c64/aliases/,aliases_petscii_codes.s b/c64/aliases/,aliases_petscii_codes.s index c5152228..48e3abda 100644 --- a/c64/aliases/,aliases_petscii_codes.s +++ b/c64/aliases/,aliases_petscii_codes.s @@ -3,7 +3,8 @@ // PETSCII codes for all the supported keys, for all the keyboards // // - [CM64] Compute's Mapping the Commodore 64 -// - [CM128] Compute's Mapping the Commodore 128 +// - [CM128] Compute's Mapping the Commodore 128 +// - https://github.com/MEGA65/c65-specifications/blob/master/c65manualupdated.txt // - https://en.wikipedia.org/wiki/PETSCII // @@ -22,7 +23,7 @@ // Note - the following PETSCII codes are currently unassigned, can be used for further extensions: // -// $01, $04, $06, $0A, $0B, $0C, $0F, $82, $83, $84 +// $01, $04, $06, $0A, $0B, $0C, $0F, $18, $82 .const KEY_NA = $00 // to indicate that no key is presed @@ -31,11 +32,11 @@ // PETSCII codes for our extended screen editor XXX implement these .const KEY_BOTTOM = $02 // CTRL+B - DolphinDOS compatible -.const KEY_TAB_FW = $8F // CTRL+>, TAB - Open ROMs unofficial -.const KEY_TAB_BW = $80 // CTRL+<, SHIFT+TAB - Open ROMs unofficial +.const KEY_TAB_FW = $8F // CTRL+>, TAB - Open ROMs unofficial, original TAB conflicts with C64 PETSCII +.const KEY_TAB_BW = $80 // CTRL+<, SHIFT+TAB - Open ROMs unofficial, original TAB conflicts with C64 PETSCII -// PETSCII codes for certain C128 and C65 functionalities XXX implement these +// PETSCII codes for certain C128 and C65 functionalities XXX implement these .const KEY_BELL = $07 // C65 / C128, no key .const KEY_ESC = $1B // C65 / C128 @@ -43,7 +44,8 @@ // PETSCII codes for programmable keys -.const KEY_RUN = $03 +.const KEY_STOP = $03 +.const KEY_RUN = $83 .const KEY_F1 = $85 .const KEY_F2 = $86 @@ -54,14 +56,14 @@ .const KEY_F7 = $8B .const KEY_F8 = $8C -.const KEY_F9 = $15 // C65, Open ROMs unofficial -.const KEY_F10 = $16 // C65, Open ROMs unofficial -.const KEY_F11 = $17 // C65, Open ROMs unofficial -.const KEY_F12 = $18 // C65, Open ROMs unofficial -.const KEY_F13 = $19 // C65, Open ROMs unofficial -.const KEY_F14 = $1A // C65, Open ROMs unofficial +.const KEY_F9 = $10 // C65 +.const KEY_F10 = $15 // C65 +.const KEY_F11 = $16 // C65 +.const KEY_F12 = $17 // C65 +.const KEY_F13 = $19 // C65 +.const KEY_F14 = $1A // C65 -.const KEY_HELP = $10 // C65 / C128, Open ROMs unofficial +.const KEY_HELP = $84 // C65, also used for our C128 support // PETSCII codes for cursor keys diff --git a/src/build_segment.cc b/src/build_segment.cc index 3d36888d..97614123 100644 --- a/src/build_segment.cc +++ b/src/build_segment.cc @@ -717,7 +717,7 @@ void BinningProblem::fillGap(DualStream &logOutput, int gapAddress, const std::l } else if (!isSolved()) { - logOutput << "filled in - dropped bytes: " << gaps[gapAddress] << "\n"; + logOutput << "filled in - dropped bytes: " << gaps[gapAddress] - offset << "\n"; } else { From 28d0fa5ecf85131beeb4d3b95b5c4f142ab90cf4 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 25 Oct 2019 18:25:59 +0200 Subject: [PATCH 85/85] handled all similarities >3, updated binaries --- bin/basic_generic.rom | Bin 8192 -> 8192 bytes bin/basic_mega65.rom | Bin 8192 -> 8192 bytes bin/basic_testing.rom | Bin 0 -> 8192 bytes bin/basic_ultimate64.rom | Bin 8192 -> 8192 bytes bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_testing.rom | Bin 0 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/aliases/,aliases_petscii_codes.s | 2 +- strings/008D9102 | 3 +++ strings/009D0002 | 3 +++ strings/028C8202 | 3 +++ strings/028C8402 | 3 +++ strings/028D18D04C | 3 +++ strings/028E8102 | 3 +++ strings/0BA90085 | 3 +++ strings/13D00620 | 3 +++ strings/20000000 | 1 + strings/204D49534D415443C8 | 3 +++ strings/205BFF586C | 3 +++ strings/20A0E54C | 3 +++ strings/29EF8D00DD | 5 +++++ strings/49432042 | 3 +++ strings/4C25FE4C | 3 +++ strings/6020A0E5 | 3 +++ strings/7BA9FF85 | 3 +++ strings/80000000 | 1 + strings/8000000000 | 1 + strings/81028C8202 | 3 +++ strings/857AA52C | 3 +++ strings/85F46020 | 3 +++ strings/8D8D02A0 | 3 +++ strings/8D9002A9 | 3 +++ strings/8D91024C | 3 +++ strings/8E03DC8E | 3 +++ strings/A59AC903D0 | 3 +++ strings/A68BE383A47CA51AA7E4A786AE | 6 ++++++ strings/A6D8F0034C | 3 +++ strings/A9802090FF | 3 +++ strings/ABA000B1 | 3 +++ strings/C903F008 | 3 +++ strings/C90ED007AD18D00902D0 | 3 +++ strings/C912D004A9 | 3 +++ strings/C913D00620 | 3 +++ strings/C98ED00BAD18D029 | 3 +++ strings/CA8E02DC | 3 +++ strings/D0036C0080 | 3 +++ strings/D0E4A90085 | 3 +++ strings/D185F3A5 | 3 +++ strings/D8F0034C | 3 +++ strings/DD29EF8D00DD60AD00DD | 5 +++++ strings/DD29EF8D00DD60AD00DD09108D00DD | 5 +++++ strings/DDA93F8D02DD | 3 +++ strings/DF8D00DD60 | 5 +++++ strings/E4A90085 | 3 +++ strings/E9A027B1 | 3 +++ strings/EAAD00DD | 3 +++ strings/EAAD00DD29DF | 5 +++++ strings/EF8D00DD60AD00DD09108D00DD | 5 +++++ strings/F88D00DC | 3 +++ strings/FF000000000000000000000000 | 1 + 61 files changed, 164 insertions(+), 1 deletion(-) create mode 100644 bin/basic_testing.rom create mode 100644 bin/kernal_testing.rom create mode 100644 strings/008D9102 create mode 100644 strings/009D0002 create mode 100644 strings/028C8202 create mode 100644 strings/028C8402 create mode 100644 strings/028D18D04C create mode 100644 strings/028E8102 create mode 100644 strings/0BA90085 create mode 100644 strings/13D00620 create mode 100644 strings/20000000 create mode 100644 strings/204D49534D415443C8 create mode 100644 strings/205BFF586C create mode 100644 strings/20A0E54C create mode 100644 strings/29EF8D00DD create mode 100644 strings/49432042 create mode 100644 strings/4C25FE4C create mode 100644 strings/6020A0E5 create mode 100644 strings/7BA9FF85 create mode 100644 strings/80000000 create mode 100644 strings/8000000000 create mode 100644 strings/81028C8202 create mode 100644 strings/857AA52C create mode 100644 strings/85F46020 create mode 100644 strings/8D8D02A0 create mode 100644 strings/8D9002A9 create mode 100644 strings/8D91024C create mode 100644 strings/8E03DC8E create mode 100644 strings/A59AC903D0 create mode 100644 strings/A68BE383A47CA51AA7E4A786AE create mode 100644 strings/A6D8F0034C create mode 100644 strings/A9802090FF create mode 100644 strings/ABA000B1 create mode 100644 strings/C903F008 create mode 100644 strings/C90ED007AD18D00902D0 create mode 100644 strings/C912D004A9 create mode 100644 strings/C913D00620 create mode 100644 strings/C98ED00BAD18D029 create mode 100644 strings/CA8E02DC create mode 100644 strings/D0036C0080 create mode 100644 strings/D0E4A90085 create mode 100644 strings/D185F3A5 create mode 100644 strings/D8F0034C create mode 100644 strings/DD29EF8D00DD60AD00DD create mode 100644 strings/DD29EF8D00DD60AD00DD09108D00DD create mode 100644 strings/DDA93F8D02DD create mode 100644 strings/DF8D00DD60 create mode 100644 strings/E4A90085 create mode 100644 strings/E9A027B1 create mode 100644 strings/EAAD00DD create mode 100644 strings/EAAD00DD29DF create mode 100644 strings/EF8D00DD60AD00DD09108D00DD create mode 100644 strings/F88D00DC create mode 100644 strings/FF000000000000000000000000 diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index 62534b2457d423f89bc7d5aa521cb8f44c5c3fb5..a1e9f2ef200d36b7de03b125b40723d57fa07889 100644 GIT binary patch delta 1687 zcmcgseQXnD7{B&*yLPQ>H60X@?d^gAvk%#HqZ@RLk3q!)CL4|qhc{qw1w=$e7>;4$ zVY6hh;}xFsIB8YE-WF#<|jV(>!rA7cV$?SRDS>C^>DtnYOg{e!=~doSq#|*@pP3VY-V)=`nd1)6TSMG>1X9B{S-@ zyhC)zJH-MgFIh&OPW4l?-##tnj8vrhX^Myn*JGy@-19iCK+h92Do%036BI9(h#t9A ztmDI@w@pLFpotF_A~7P@CNr8fSdJxIExd)Sjs8hQavTJ+7~g(n5+n;-0J@zS~P+QkJ2c8DWq>hxVj{E`6__A}jdU#{@x&qT~|yJ%iXGm)@hq zWB4MoWK}4v%$Foo2tk9ChpcJEI-}7unm4N{o1}5wgpnv>f_&3xj~rwrinFGPQwkp_ zI%S}6jCJEq##PY?vW1j;RTe~xT;@(&^pZ)yawkua7tr=dkiD?ubjx-7eIk>EExAwS z9g0l0$!+#uxKp?ycOh=Ex|m_T4BTn0F^Vgoe7ORy1|pcyv7%g_Rw zVGC@9ZSV@T!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; zr(}VW1xgkuS)gQrk_Ac@C|RInfszGE7ARSuWPy?eKAZ*QDlOk^_$j2LSo#BUH-5Q& z8uC$hO+((#&+>lxlp#X>QOIn#&6eoPkowEhPP>w^L5lo)6nNlGJB^Kur1e}&aBmms zigBv&Tvr6K`v&7;RKTYwOOIThf_Y-nQ=M~x%j7Yr4+XfP8jj3UacDi432-m3=M4W? z4d>=0``Il^-X-- zI*x>az>4ab*kT diff --git a/bin/basic_testing.rom b/bin/basic_testing.rom new file mode 100644 index 0000000000000000000000000000000000000000..efbebfcd46f8d65523fecc88de0db137c5d62131 GIT binary patch literal 8192 zcmeHMeNa@_6+iF2U3PI%76h|3iCn(|3M_~Mt6>o##yWnYyb%uBDqj*Ep=yVplE7 zVWrxXt1*cxef;KQ^S-}hFz z*;VC`tHX9&YXs-Wz*%chwEC`S4T{og*-LBWVp87M6_z0O#1M!f@b3|jNNPab6(FSn z@fB6&)MTKZgWXwVOJ5g$#xZF8-D9lUfw}!gS1Yz1#LJGjwoE!Ztk|>zR6E%mp~E} zYCCI>3PfV!>w$YZ`0JI6aleZY9im=VI5Sd4K;tCEaIG z(`J98vfFt_e#tm-iJVj;S<(0iiQXXHsz-8R>%9ek#|p>=N;g`otd)3;TnU-8-=Z7j z6#BfJYN!CvOyi=cqgmHL-XSTDpLg_7FDsyDX3SPk_0u>lq`@L zed4jpWWCxfh=UfOG!dnxC z&IBQYI0Zag{cu5kfw2OXiYZ5QbYP>Z4rco$7 zO}Tq*rJ|t>*iGXcu!YS=!yvUU&e;(nF~1M})I$sVGdrlKKMQ@RZHBn?66t5O%X%c5 z+(r!VIzs$9?ZVex2WxvKbceOJ^WBJEd()V%@=dxfU1xlWeec^m`ItWfB+O?>_Py^J zwU+UkPc4)=zx1k4wHUv4L$11IbE9_qT+O-Kb6d5c3^B~#YYuC-2WkesX;z`h$u%W& zau2mNP3AhC+=r7nE%B{nP6hPo-G)2%NUE(ViF?aw_;h537EgPY>vE6yL3?Cwb2j>~ z4J}o`D(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ZIg`ZOkq^E7{u^ z<1RD&WfU?(i-td|^bpiw^27*zEC{C$YgHC9&Il7q7y&avCh7uY#RynpVCZK7@}}QN z*-2+X^z1DfHKv?A8Q`@ySYU|mk^Nb~lchQ1VQ?uAEA+R17KWTCiB;f9jcoHZg`pY# z=3d#*)Tb=&>VwiO{FUp44xvpQe=yFR4YgV;%w4@un!!$U*G0ohuysDnUe4E|^KE?2 znM>mhE!un_wm5>Sh#jiR-aC%XF*Tfh@oj zB2HL;ZE?*EfeBS1K5MA|m9RaA8*s$RHEFoeWK1hzwW;o#)@)X0s54kC4Yb8d9kr2= z6@wGb*|E>Xue%GrB0BNn|+j$SdxsWzl4o22Skxi4Z5|d^gA1ySk zcwq0F#z{E-)8 zETMpI8gUlQHQF@8!2>xHC1u#feO1w3d72Gaw0TU5+m)yNu>t=Z0O%Ujm};1$;~_Dw za@V-O&~xEw9F2KlsZRn92lM)IU75SvW6ze(SXKc`97a`^Q>Qvf+&Oi z9>cH{E62dd3!w&VF#y}A;OQ`s#Q3#cCqQdF8gy75r>Vmj`K0E5{NS`yW_cop7FUw-e7BFQC8G6G*lZI)W$JNgx7NL~D-+t)7 F{r?-0U8Vp4 diff --git a/bin/kernal_testing.rom b/bin/kernal_testing.rom new file mode 100644 index 0000000000000000000000000000000000000000..6731edb1ecea8081446de218eee3a534c7f6fbda GIT binary patch literal 8192 zcmeG>e|S{IwX<`x*-gSG8w|35z*t2SiWpQh^@#)o+~^1qP(a&y#X>hWzSsBqTB+@8 zgXYGFY`PJs35qV)y&*SdVPmlv+GylQx_3X33BedNwBbh>~if-z&(-@$UMcui3HwVx>K% zxHkMyaw#r`9U^(SC;X)Hq(SG->k*6=6$`@! zqKYJ|l+l7Px#^6C*uzQ&n{rXHXeM1y6LZwD5INMtdk^){31@uPW@Jjsszs)-6$To^ zpd-+e9FYL2j-|FF$0_`@7F3_L$C>gpCwgTaxii{PAUUUjIGJ9)gKnT`|tV=g-tQHq4jiD|eP4V+0@}eYrNKKd2@2 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%%U?;pqcX29t${_D1$s7+p;UX5gFLifV?`FCriT&pTztCp};MJ)OC6xm=9_h@KPWH^S|q<{JC H;K+Xg6ixbr diff --git a/c64/aliases/,aliases_petscii_codes.s b/c64/aliases/,aliases_petscii_codes.s index 48e3abda..d62bf4ec 100644 --- a/c64/aliases/,aliases_petscii_codes.s +++ b/c64/aliases/,aliases_petscii_codes.s @@ -31,7 +31,7 @@ // PETSCII codes for our extended screen editor XXX implement these -.const KEY_BOTTOM = $02 // CTRL+B - DolphinDOS compatible +.const KEY_BOTTOM = $02 // CTRL+B - Open ROMs unofficial, DolphinDOS compatible .const KEY_TAB_FW = $8F // CTRL+>, TAB - Open ROMs unofficial, original TAB conflicts with C64 PETSCII .const KEY_TAB_BW = $80 // CTRL+<, SHIFT+TAB - Open ROMs unofficial, original TAB conflicts with C64 PETSCII diff --git a/strings/008D9102 b/strings/008D9102 new file mode 100644 index 00000000..7ed9bd93 --- /dev/null +++ b/strings/008D9102 @@ -0,0 +1,3 @@ +$00 + STA $0291 + +Instruction (storing data in a documented location) and a part. Not copyrightable. diff --git a/strings/009D0002 b/strings/009D0002 new file mode 100644 index 00000000..ddb5420f --- /dev/null +++ b/strings/009D0002 @@ -0,0 +1,3 @@ +$00 + STA $0200,X + +Instruction (storing data in a documented location) and a part. Not copyrightable. diff --git a/strings/028C8202 b/strings/028C8202 new file mode 100644 index 00000000..9a916a11 --- /dev/null +++ b/strings/028C8202 @@ -0,0 +1,3 @@ +$02 + STY $0282 + +Instruction (storing data in a well-known location) + some part. Trivial, not copyrightable. diff --git a/strings/028C8402 b/strings/028C8402 new file mode 100644 index 00000000..24ced153 --- /dev/null +++ b/strings/028C8402 @@ -0,0 +1,3 @@ +$02 + STY $0284 + +Instruction (storing data in a documented location) and a part. Not copyrightable. diff --git a/strings/028D18D04C b/strings/028D18D04C new file mode 100644 index 00000000..7afc5a69 --- /dev/null +++ b/strings/028D18D04C @@ -0,0 +1,3 @@ +$02 + STA $D018 + JMP (addres does not match) + +One instruction (storing data in a docummented I/O register) + some parts. Not copyrightable. diff --git a/strings/028E8102 b/strings/028E8102 new file mode 100644 index 00000000..bfb09227 --- /dev/null +++ b/strings/028E8102 @@ -0,0 +1,3 @@ +$02 + STX $0281 + +Instruction (storing data in a documented location) and a part. Not copyrightable. diff --git a/strings/0BA90085 b/strings/0BA90085 new file mode 100644 index 00000000..bd9b77af --- /dev/null +++ b/strings/0BA90085 @@ -0,0 +1,3 @@ +$0B + LDA #$00 + STA (zeropage addreess does not match) + +One instruction + some parts. Not copyrightable. diff --git a/strings/13D00620 b/strings/13D00620 new file mode 100644 index 00000000..abb8e442 --- /dev/null +++ b/strings/13D00620 @@ -0,0 +1,3 @@ +$13 + BNE (offset match) + JSR (address does not match) + +Instruction + some parts. Not copyrightable. diff --git a/strings/20000000 b/strings/20000000 new file mode 100644 index 00000000..39095a19 --- /dev/null +++ b/strings/20000000 @@ -0,0 +1 @@ +A byte followed by some 0's - accidental result of ROMs not being full to the last byte. Nothing creative - not copyrightable. diff --git a/strings/204D49534D415443C8 b/strings/204D49534D415443C8 new file mode 100644 index 00000000..24490224 --- /dev/null +++ b/strings/204D49534D415443C8 @@ -0,0 +1,3 @@ +PETSCII: (space) MISMATCH + +Single word with a space character is not copyrightable. What's more, the MISMATCH word in our BASIC is stored in compressed form - this one must come from Kernal, from out 'panic screen' implementation, something not even present in the original ROM. diff --git a/strings/205BFF586C b/strings/205BFF586C new file mode 100644 index 00000000..4b9adedc --- /dev/null +++ b/strings/205BFF586C @@ -0,0 +1,3 @@ +JSR $FF5B (CINT) + CLI + JMP (vector does not match) + +Small part of the initialization routine, basically a sequence of 2 calls. Not creative - not copyrightable. diff --git a/strings/20A0E54C b/strings/20A0E54C new file mode 100644 index 00000000..edc5f21f --- /dev/null +++ b/strings/20A0E54C @@ -0,0 +1,3 @@ +JSR $E5A0 + JMP (address does not match) + +Instruction (call to unofficial, but a well-known routine) + some part. Trivial, not copyrightable. diff --git a/strings/29EF8D00DD b/strings/29EF8D00DD new file mode 100644 index 00000000..23471546 --- /dev/null +++ b/strings/29EF8D00DD @@ -0,0 +1,5 @@ +AND #$EF + STA $DD00 + +$DD00 is a hardware register, where one typically set/unset/read individual bits. +Having a set of trivial helper subroutines to set/clear individual bits (or groups of bits) is an obvious solution (thus not copyrightable), some similarities are unevitable. +Besides, in this case (since the similarity does not even cover a single subroutine from start to end) it is clear that the similar code actually performs slightly different actions. diff --git a/strings/49432042 b/strings/49432042 new file mode 100644 index 00000000..b61392d7 --- /dev/null +++ b/strings/49432042 @@ -0,0 +1,3 @@ +PETSCII: IC (space) B + +Short text fragment, not even a full syllable. Not copyrightable. diff --git a/strings/4C25FE4C b/strings/4C25FE4C new file mode 100644 index 00000000..fa745bee --- /dev/null +++ b/strings/4C25FE4C @@ -0,0 +1,3 @@ +JMP $FE25 (MEMTOP) + JMP (address doees not match) + +Very small part of Kernal jumptable - part of Kernal API, list of facts without any logic (see also fe25.interop). Not copyrightable. diff --git a/strings/6020A0E5 b/strings/6020A0E5 new file mode 100644 index 00000000..a44b9d86 --- /dev/null +++ b/strings/6020A0E5 @@ -0,0 +1,3 @@ +RTS (end of routine) + JSR $E5A0 (setup VIC and I/O) + +Similarity only because a routine starts with video chipset initialization - trivial, not copyrightable. diff --git a/strings/7BA9FF85 b/strings/7BA9FF85 new file mode 100644 index 00000000..acd243cc --- /dev/null +++ b/strings/7BA9FF85 @@ -0,0 +1,3 @@ +$7B + LDA #$FF + STA (zeropage address does not match) + +One instruction + some parts. Not copyrightable. diff --git a/strings/80000000 b/strings/80000000 new file mode 100644 index 00000000..39095a19 --- /dev/null +++ b/strings/80000000 @@ -0,0 +1 @@ +A byte followed by some 0's - accidental result of ROMs not being full to the last byte. Nothing creative - not copyrightable. diff --git a/strings/8000000000 b/strings/8000000000 new file mode 100644 index 00000000..39095a19 --- /dev/null +++ b/strings/8000000000 @@ -0,0 +1 @@ +A byte followed by some 0's - accidental result of ROMs not being full to the last byte. Nothing creative - not copyrightable. diff --git a/strings/81028C8202 b/strings/81028C8202 new file mode 100644 index 00000000..6b2ce942 --- /dev/null +++ b/strings/81028C8202 @@ -0,0 +1,3 @@ +$0281 + STY $0282 + +Instruction (storing data in a documented location) and a part. Not copyrightable. diff --git a/strings/857AA52C b/strings/857AA52C new file mode 100644 index 00000000..972422ee --- /dev/null +++ b/strings/857AA52C @@ -0,0 +1,3 @@ +STA $7A (TXTPTR low byte) + LDA $2C (TXTAB high byte) + +$7A and $2C are documented zeropage locations, they are related so it's normal that they are read/written one after another. Here the similarity is limited to just 2 instructions (does not even cover full access of the variables) - this is trivial and thus not copyrightable. diff --git a/strings/85F46020 b/strings/85F46020 new file mode 100644 index 00000000..3745a819 --- /dev/null +++ b/strings/85F46020 @@ -0,0 +1,3 @@ +STA $F4 + RTS (end of subroutine) + JSR (address does not match) + +Storing value in a documented memory location, followed by next subroutine started by JSR - not creative, not copyrightable. diff --git a/strings/8D8D02A0 b/strings/8D8D02A0 new file mode 100644 index 00000000..86535945 --- /dev/null +++ b/strings/8D8D02A0 @@ -0,0 +1,3 @@ +STA $028D + LDY #(value does not match) + +Instruction (storing data in a docummented location) + some part. Trivial, not copyrgihtable. diff --git a/strings/8D9002A9 b/strings/8D9002A9 new file mode 100644 index 00000000..0c47ce26 --- /dev/null +++ b/strings/8D9002A9 @@ -0,0 +1,3 @@ +STA $0290 + LDA (value does not match) + +Instruction (storing data in a documented location) and a part. Not copyrightable. diff --git a/strings/8D91024C b/strings/8D91024C new file mode 100644 index 00000000..54ac819b --- /dev/null +++ b/strings/8D91024C @@ -0,0 +1,3 @@ +STA $0291 + JMP (address does not match) + +Instruction (storing data in a well-known location) + some part. Trivial, not copyrightable. diff --git a/strings/8E03DC8E b/strings/8E03DC8E new file mode 100644 index 00000000..efbed2ba --- /dev/null +++ b/strings/8E03DC8E @@ -0,0 +1,3 @@ +STX $DC03 + STX (address does not match) + +Instruction (storing data in a documented location) and a part. Not copyrightable. diff --git a/strings/A59AC903D0 b/strings/A59AC903D0 new file mode 100644 index 00000000..7f7a8188 --- /dev/null +++ b/strings/A59AC903D0 @@ -0,0 +1,3 @@ +LDA $9A + CMP #$03 + BNE (offset does not match) + +Just a check whether the default output device is screen - trivial, not copyrightable. diff --git a/strings/A68BE383A47CA51AA7E4A786AE b/strings/A68BE383A47CA51AA7E4A786AE new file mode 100644 index 00000000..72f8a1d7 --- /dev/null +++ b/strings/A68BE383A47CA51AA7E4A786AE @@ -0,0 +1,6 @@ +$A6 (part of other compilation unit) + a list of vectors to be copied starting from $0300 + +Values of the vectors are already present in many autostart software - as it often overrides them, +sometimes changing one to trigger autostart (one of the possible techniques). We have to use the same +vector values to be compatible (in fact, it even complicates our implementation) - see *.interop files +for more details. diff --git a/strings/A6D8F0034C b/strings/A6D8F0034C new file mode 100644 index 00000000..d9e0b07c --- /dev/null +++ b/strings/A6D8F0034C @@ -0,0 +1,3 @@ +LDX $D8 + BEQ (skip next instruction) + JMP (address does not match) + +Just a check whether insert mode is active - trivial, not copyrightable. diff --git a/strings/A9802090FF b/strings/A9802090FF new file mode 100644 index 00000000..8757cd5a --- /dev/null +++ b/strings/A9802090FF @@ -0,0 +1,3 @@ +LDA #$80 + JSR $FF90 (SETMSG) + +There are just two standard parameters of SETMSG - $00 and $80 (to tell Kernal wheether to print out messages or not). This is typical call of Kernal API, not copyrightable. diff --git a/strings/ABA000B1 b/strings/ABA000B1 new file mode 100644 index 00000000..57f6b686 --- /dev/null +++ b/strings/ABA000B1 @@ -0,0 +1,3 @@ +$AB + LDY #$00 + LDA (zeropage addres does not match), Y + +Instruction + some parts. Not copyrightable. diff --git a/strings/C903F008 b/strings/C903F008 new file mode 100644 index 00000000..bfaddbf3 --- /dev/null +++ b/strings/C903F008 @@ -0,0 +1,3 @@ +CMP #$03 + BEQ (skip 8 bytes) + +Skip few bytes if accumulator value is 3 - not creative, not copyrightable. diff --git a/strings/C90ED007AD18D00902D0 b/strings/C90ED007AD18D00902D0 new file mode 100644 index 00000000..dff00ea1 --- /dev/null +++ b/strings/C90ED007AD18D00902D0 @@ -0,0 +1,3 @@ +CMP #$0E + BNE (7 bytes forward) + LDA $D018 + ORA #$02 + BNE (offset does not match) + +A piece of code that (depending on the PETSCII character) sets/unsets lowercase mode. Not many sane ways exists to do this, some similarities are unevitable. Overall, this code is trivial (and not even fully the same) - not copyrightable. diff --git a/strings/C912D004A9 b/strings/C912D004A9 new file mode 100644 index 00000000..d15f0f7d --- /dev/null +++ b/strings/C912D004A9 @@ -0,0 +1,3 @@ +CMP #$12 + BNE (skip 4 bytes) + LDA #(value does not match) + +Small part of the PETSCII control codes handling routine - do something if handling character $12 (not even the same thing is done). Not creative - not copyrightable. diff --git a/strings/C913D00620 b/strings/C913D00620 new file mode 100644 index 00000000..df6b9e6c --- /dev/null +++ b/strings/C913D00620 @@ -0,0 +1,3 @@ +CMP #$13 + BNE (skip 6 bytes) + JSR (address does not match) + +Small part of the PETSCII control codes handling routine - do something if handling character $13. Not creative - not copyrightable. diff --git a/strings/C98ED00BAD18D029 b/strings/C98ED00BAD18D029 new file mode 100644 index 00000000..fba842ca --- /dev/null +++ b/strings/C98ED00BAD18D029 @@ -0,0 +1,3 @@ +CMP #$8E + BNE (skip 11 bytes) + LDA $D018 + AND#(value does not match) + +A piece of code that (depending on the PETSCII character) sets/unsets lowercase mode. Not many sane ways exists to do this, some similarities are unevitable. Overall, this code is trivial (and not even fully the same) - not copyrightable. diff --git a/strings/CA8E02DC b/strings/CA8E02DC new file mode 100644 index 00000000..e0240c1e --- /dev/null +++ b/strings/CA8E02DC @@ -0,0 +1,3 @@ +DEX + STX $DC02 + +Optimization to store $FF in I/O register, when X is known to be $00 - trivial, not copyrightable. diff --git a/strings/D0036C0080 b/strings/D0036C0080 new file mode 100644 index 00000000..2ea7d000 --- /dev/null +++ b/strings/D0036C0080 @@ -0,0 +1,3 @@ +BNE (skip 3 bytes) + JMP ($8000) + +Jump through official (documented) vector depending on the flag state, could be 1 instruction in other architectures. Trivial, not copyrightable. diff --git a/strings/D0E4A90085 b/strings/D0E4A90085 new file mode 100644 index 00000000..2821832d --- /dev/null +++ b/strings/D0E4A90085 @@ -0,0 +1,3 @@ +BNE (offset match) + LDA #$00 + STA (zeropage address does not match) + +If value is 0, clear some zeropage addres (not even the same in original ROMs and our implementation). Nothing creative - not copyrightable. diff --git a/strings/D185F3A5 b/strings/D185F3A5 new file mode 100644 index 00000000..40a03bfd --- /dev/null +++ b/strings/D185F3A5 @@ -0,0 +1,3 @@ +$D1 + STA $F3 + LDA (zeropage address does not match) + +Instruction (storing data in a doccumented memory location) + some parts. Not copyrightable. diff --git a/strings/D8F0034C b/strings/D8F0034C new file mode 100644 index 00000000..7689027b --- /dev/null +++ b/strings/D8F0034C @@ -0,0 +1,3 @@ +$D8 + BEQ (skip next instruction) + JMP (address does not match) + +One instruction + some parts. Not copyrightable. diff --git a/strings/DD29EF8D00DD60AD00DD b/strings/DD29EF8D00DD60AD00DD new file mode 100644 index 00000000..44850259 --- /dev/null +++ b/strings/DD29EF8D00DD60AD00DD @@ -0,0 +1,5 @@ +$DD + AND #$EF + STA $DD00 + RTS (end of routine) + LDA $DD00 + +$DD00 is a hardware register, where one typically set/unset/read individual bits. +Having a set of trivial helper subroutines to set/clear individual bits (or groups of bits) is an obvious solution (thus not copyrightable), some similarities are unevitable. +Besides, in this case (since the similarity does not even cover a single subroutine from start to end) it is clear that the similar code actually performs slightly different actions. diff --git a/strings/DD29EF8D00DD60AD00DD09108D00DD b/strings/DD29EF8D00DD60AD00DD09108D00DD new file mode 100644 index 00000000..bd196812 --- /dev/null +++ b/strings/DD29EF8D00DD60AD00DD09108D00DD @@ -0,0 +1,5 @@ +$DD + AND #$EF + STA $DD00 + RTS (end of routine) + LDA $DD00 + ORA #$10 + STA $DD00 + +$DD00 is a hardware register, where one typically set/unset/read individual bits. +Having a set of trivial helper subroutines to set/clear individual bits (or groups of bits) is an obvious solution (thus not copyrightable), some similarities are unevitable. +Besides, in this case (since the similarity does not even cover a single subroutine from start to end) it is clear that the similar code actually performs slightly different actions. diff --git a/strings/DDA93F8D02DD b/strings/DDA93F8D02DD new file mode 100644 index 00000000..42fb9c20 --- /dev/null +++ b/strings/DDA93F8D02DD @@ -0,0 +1,3 @@ +$DD + LDA #$3F + STA $DD02 + +Some part + storing a default value in a documented I/O register - trivial, not copyrightablee. diff --git a/strings/DF8D00DD60 b/strings/DF8D00DD60 new file mode 100644 index 00000000..cfb40212 --- /dev/null +++ b/strings/DF8D00DD60 @@ -0,0 +1,5 @@ +$DF + STA $DD00 + RTS + +$DD00 is a hardware register, where one typically set/unset/read individual bits. +Having a set of trivial helper subroutines to set/clear individual bits (or groups of bits) is an obvious solution (thus not copyrightable), some similarities are unevitable. +Besides, in this case (since the similarity does not even cover a single subroutine from start to end) it is clear that the similar code actually performs slightly different actions. diff --git a/strings/E4A90085 b/strings/E4A90085 new file mode 100644 index 00000000..9c6a0d4f --- /dev/null +++ b/strings/E4A90085 @@ -0,0 +1,3 @@ +$E4 + LDA #$00 + STA (zeropage address does not match) + +Instruction + some parts. Not copyrightable. diff --git a/strings/E9A027B1 b/strings/E9A027B1 new file mode 100644 index 00000000..a541b31c --- /dev/null +++ b/strings/E9A027B1 @@ -0,0 +1,3 @@ +$E9 + LDY #$27 + LDA (zeropage address does not match),Y + +Instruction + some parts. Not copyrightable. diff --git a/strings/EAAD00DD b/strings/EAAD00DD new file mode 100644 index 00000000..444e31fa --- /dev/null +++ b/strings/EAAD00DD @@ -0,0 +1,3 @@ +$EA + LDA $DD00 + +Instruction and some part - trivial, not copyrightable. diff --git a/strings/EAAD00DD29DF b/strings/EAAD00DD29DF new file mode 100644 index 00000000..323da94a --- /dev/null +++ b/strings/EAAD00DD29DF @@ -0,0 +1,5 @@ +$EA + LDA $DD00 + AND #$DF + +$DD00 is a hardware register, where one typically set/unset/read individual bits. +Having a set of trivial helper subroutines to set/clear individual bits (or groups of bits) is an obvious solution (thus not copyrightable), some similarities are unevitable. +Besides, in this case (since the similarity does not even cover a single subroutine from start to end) it is clear that the similar code actually performs slightly different actions. diff --git a/strings/EF8D00DD60AD00DD09108D00DD b/strings/EF8D00DD60AD00DD09108D00DD new file mode 100644 index 00000000..930e2b7f --- /dev/null +++ b/strings/EF8D00DD60AD00DD09108D00DD @@ -0,0 +1,5 @@ +$EF + STA $DD00 + RTS (end of a routine) + LDA $DD00 + ORA #$10 + STA $DD00 + +$DD00 is a hardware register, where one typically set/unset/read individual bits. +Having a set of trivial helper subroutines to set/clear individual bits (or groups of bits) is an obvious solution (thus not copyrightable), some similarities are unevitable. +Besides, in this case (since the similarity does not even cover a single subroutine from start to end) it is clear that the similar code actually performs slightly different actions. diff --git a/strings/F88D00DC b/strings/F88D00DC new file mode 100644 index 00000000..5a861c89 --- /dev/null +++ b/strings/F88D00DC @@ -0,0 +1,3 @@ +$F8 + STA $DC00 + +Instruction (storing data in a documented location) and a part. Not copyrightable. diff --git a/strings/FF000000000000000000000000 b/strings/FF000000000000000000000000 new file mode 100644 index 00000000..39095a19 --- /dev/null +++ b/strings/FF000000000000000000000000 @@ -0,0 +1 @@ +A byte followed by some 0's - accidental result of ROMs not being full to the last byte. Nothing creative - not copyrightable.