migrated to ACME assembler

commit 145d64aa6e78838ed07cefed372f0ad6a4687e97
Author: FeralChild64 <you@example.com>
Date:   Sun Sep 20 20:16:57 2020 +0200

    ACME adaptation

commit 885209d7822286744ea53232ae7461472a01d5d6
Author: FeralChild64 <you@example.com>
Date:   Sun Sep 20 19:57:25 2020 +0200

    ACME adaptation

commit 334d84486bc603551887e7cbeb59d329f2224cc7
Author: FeralChild64 <you@example.com>
Date:   Sun Sep 20 18:29:15 2020 +0200

    ACME adaptation

commit b5966f49bcd8f0ca79cbec93819a31238924707e
Author: FeralChild64 <you@example.com>
Date:   Sun Sep 20 18:09:31 2020 +0200

    ACME adaptation

commit 786536a93a5eab5e676fca99625b4eb094a554e7
Author: FeralChild64 <you@example.com>
Date:   Sun Sep 20 17:24:48 2020 +0200

    ACME adaptation

commit 704c70dfb1f5d68775d6f3da220803b8a3990f56
Author: FeralChild64 <you@example.com>
Date:   Sun Sep 20 15:07:12 2020 +0200

    ACME adaptation

commit 136874964c9083b375f151475310f9636871fc72
Author: FeralChild64 <you@example.com>
Date:   Sun Sep 20 14:45:14 2020 +0200

    ACME adaptation

commit 8eca0d5700b72d04336e72c5cd3a68e18b85f96d
Author: FeralChild64 <you@example.com>
Date:   Sun Sep 20 14:06:52 2020 +0200

    ACME adaptation

commit 11d29eb7ee318239d782f85498b6d0524624d5c4
Author: FeralChild64 <you@example.com>
Date:   Sun Sep 20 13:56:45 2020 +0200

    ACME apaptation

commit c9b5e5e04cceb92c66bc027e6440bc0f7c5a499f
Author: FeralChild64 <you@example.com>
Date:   Sun Sep 20 13:49:04 2020 +0200

    ACME adaptation

commit f5cc254cbc921f07863807468cb3fe26b410b409
Author: FeralChild64 <you@example.com>
Date:   Sun Sep 20 13:01:18 2020 +0200

    ACME adaptation

commit e135a27bf9c30cc0965379c954564e06406303b1
Author: FeralChild64 <you@example.com>
Date:   Sat Sep 19 21:55:01 2020 +0200

    ACME adaptation

commit e9dfddf90d9e2795e88b7da40ae050d733faeb56
Author: FeralChild64 <you@example.com>
Date:   Sat Sep 19 21:48:47 2020 +0200

    Makefile fix

commit 07030104c65cf5e5beeacf6d629ccb9245e58657
Author: FeralChild64 <you@example.com>
Date:   Sat Sep 19 21:42:00 2020 +0200

    ACME adaptation

commit f824362ee5bcfbffca86c430b57773b2ffd65655
Author: FeralChild64 <you@example.com>
Date:   Sat Sep 19 20:14:56 2020 +0200

    ACME adaptation

commit 3a3c59007dcd4940d89b8669f34ca56b61c25fdf
Author: FeralChild64 <you@example.com>
Date:   Fri Sep 18 21:51:45 2020 +0200

    ACME adaptation

commit 6790ef7bc88a41de2881c69b7524dd4ab8c74b5d
Author: FeralChild64 <you@example.com>
Date:   Fri Sep 18 20:35:23 2020 +0200

    ACME adaptation

commit 38ad18b90e9ec713aa7ca49576b3388ce1733357
Author: FeralChild64 <you@example.com>
Date:   Fri Sep 18 18:46:20 2020 +0200

    ACME adaptation

commit 541340371122a9702f7b2d9771c298223cffd0e9
Author: FeralChild64 <you@example.com>
Date:   Fri Sep 18 16:49:46 2020 +0200

    ACME adaptation

commit 25cfd5e186459be1a260d3eb8cfff767838de370
Author: FeralChild64 <you@example.com>
Date:   Thu Sep 17 20:13:33 2020 +0200

    ACME adaptation

commit f61599444d5b1d03d8fd8e4a6a7c3b85069bedb3
Author: FeralChild64 <you@example.com>
Date:   Thu Sep 17 19:29:23 2020 +0200

    ACME adaptation

commit b290be31ec7bb2e5723607697da1bbc621c84429
Author: FeralChild64 <you@example.com>
Date:   Thu Sep 17 17:20:14 2020 +0200

    ACME adaptation

commit 877be9e856880d98fd4bcb25b42aaaacda9dc463
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 16 21:47:38 2020 +0200

    ACME adaptation

commit bb20edaf85d386e41d5c2f715b745b68fbd3362e
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 16 21:31:30 2020 +0200

    ACME adaptation

commit c5d31bd8685abce37c8e254d15aac20bd1570d9f
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 16 18:40:49 2020 +0200

    ACME adaptation

commit 29349826b38f8a89649171559dc8cf24c560aff1
Author: FeralChild64 <you@example.com>
Date:   Mon Sep 14 23:35:47 2020 +0200

    ACME adaptation

commit 8bcd6a621c4b11766d0cf34f79858ba90a67248e
Author: FeralChild64 <you@example.com>
Date:   Mon Sep 14 22:52:25 2020 +0200

    ACME adaptation

commit e87a69edc2ce4bfcc460c31e08dcc352a985f88d
Author: FeralChild64 <you@example.com>
Date:   Mon Sep 14 22:43:27 2020 +0200

    ACME adaptation

commit f49a097bd52e96d00b866c02bda7121e4543233c
Author: FeralChild64 <you@example.com>
Date:   Mon Sep 14 19:02:07 2020 +0200

    ACME adaptation

commit fa0e9214a633b8e8f867cc70925b390940dcd426
Author: FeralChild64 <you@example.com>
Date:   Mon Sep 14 17:47:19 2020 +0200

    ACME adaptation

commit 1b763b91e7a03e426227129c7f22f0ce57a4c197
Author: FeralChild64 <you@example.com>
Date:   Mon Sep 14 17:17:10 2020 +0200

    ACME adaptation

commit e92a4b57b232cd85eb1e71090b8a89c7c8461ebc
Author: FeralChild64 <you@example.com>
Date:   Mon Sep 14 17:15:37 2020 +0200

    ACME adaptation

commit de3c693e8a7e73ea5289198946058e3240894e6a
Author: FeralChild64 <you@example.com>
Date:   Mon Sep 14 17:10:05 2020 +0200

    ACME adaptation

commit f9bd7ae0f04e932d613be9ed5cb19af9be5d338e
Author: FeralChild64 <you@example.com>
Date:   Sun Sep 13 14:34:44 2020 +0200

    ACME adaptation

commit 694dee52555dbfc2b1f7f452a9671ff51106c057
Author: FeralChild64 <you@example.com>
Date:   Sun Sep 13 14:16:14 2020 +0200

    ACME adaptation

commit 0af2c55edfcd22942d9f25417eb0d35f55b71604
Author: FeralChild64 <you@example.com>
Date:   Fri Sep 11 17:38:09 2020 +0200

    ACME adaptation

commit 2015e17334bd56a1e8a13a5abc098d9c2e7ea44f
Author: FeralChild64 <you@example.com>
Date:   Fri Sep 11 16:46:05 2020 +0200

    ACME adaptation

commit b1e972162798d60f4483cd6cc261e856c20c2c8c
Author: FeralChild64 <you@example.com>
Date:   Fri Sep 11 16:24:31 2020 +0200

    ACME adaptation

commit 9d027e868466901ba53bf074a79ec8cf16273021
Author: FeralChild64 <you@example.com>
Date:   Fri Sep 11 15:04:31 2020 +0200

    ACME adaptation

commit 957186deddd1aa4f3b4f1aa1f421e4239a584e57
Author: FeralChild64 <you@example.com>
Date:   Thu Sep 10 22:49:07 2020 +0200

    ACME adaptation

commit b8060f67a455cfac109f08d96b62c360d693b931
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 23:07:28 2020 +0200

    ACME adaptation

commit e54d004568f44bbfe5c070ef1d7cf3544112e497
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 22:58:20 2020 +0200

    ACME adaptation

commit f90b77f073c5a605cb31c6ee451f65c8a8aff7d8
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 22:12:09 2020 +0200

    ACME adaptation

commit b211bb4afcd9c58fe1f5c92f3007717d611cd531
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 22:01:40 2020 +0200

    ACME adaptation

commit 8d7ea343b07e9e08e5f77f3c414758a6cffd0440
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 21:38:34 2020 +0200

    ACME adaptation

commit 46413eb0d92d6400aba0ff8dfe556e61e8a44d78
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 21:07:47 2020 +0200

    ACME adaptation

commit 9f98f69ecc21f7b74a5eb89e247f5a2c6fcb655d
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 20:05:03 2020 +0200

    ACME adaptation

commit 7bb9f1cadc682c7e0a4a6796739d860d473ca110
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 19:55:12 2020 +0200

    ACME adaptation

commit 5fc115392b5bdca6b56f67ad866b1884d2d2bdf8
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 19:31:10 2020 +0200

    ACME adaptation

commit b7940fc60e568d859df9e3156f6bacc6d685b2cc
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 19:16:09 2020 +0200

    ACME adaptation

commit 56288cb97197561afa0816b29c134ec1190e8eab
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 18:48:23 2020 +0200

    ACME adaptation

commit 10401a60fc7922a53d782120ef6795d889140218
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 16:34:16 2020 +0200

    ACME adaptation

commit 8ce76e4d2b56837a691ae84b1a412a2ae32a157b
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 16:20:44 2020 +0200

    ACME adaptation

commit 33fade899fa6172ea6b5b5f6683bb61f544429fd
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 15:28:46 2020 +0200

    ACME adaptation

commit a416f04734402fcfbc57a933731376df2e0180a1
Author: FeralChild64 <you@example.com>
Date:   Wed Sep 9 12:40:03 2020 +0200

    ACME adaptation

commit f8daee005b1d29f6912723be2ac94bc5fbeb0508
Author: FeralChild64 <you@example.com>
Date:   Mon Sep 7 23:29:54 2020 +0200

    ACME adaptation

commit 83fe6bdd0b08a44fdbfc6eefe323a4b194ccaf5b
Author: FeralChild64 <you@example.com>
Date:   Mon Sep 7 22:23:16 2020 +0200

    ACME adaptation

commit cb1f75620b9c83000a15c9c7f7acefdfee79a979
Author: FeralChild64 <you@example.com>
Date:   Mon Sep 7 19:23:12 2020 +0200

    ACME adaptation

commit e524d517c933ae1f0aeb49764d307fadb4845025
Author: FeralChild64 <you@example.com>
Date:   Sun Sep 6 08:24:25 2020 +0200

    ACME adaptation - replaced comments

commit 2ab572c3a21f4a78a7312d0e684bc11d91d1717a
Author: FeralChild64 <you@example.com>
Date:   Sat Sep 5 17:59:10 2020 +0200

    ACME adaptation - replaced the assembler
This commit is contained in:
FeralChild64 committed 2020-09-20 20:22:36 +02:00
1 parent bfc8291e41
commit c8d255130c
685 files changed
+15835 -16296

No files matched your search

+44 -46
View File
@@ -1,54 +1,53 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Keyboard part of the CHRIN routine
//
;
; Keyboard part of the CHRIN routine
;
chrin_keyboard:
#if ROM_LAYOUT_M65
!ifdef CONFIG_MB_M65 {
jsr M65_MODEGET
bcc_16 m65_chrin_keyboard
+bcc m65_chrin_keyboard
}
#endif
// Preserve .X and .Y registers
; Preserve .X and .Y registers
stx XSAV
phy_trash_a
+phy_trash_a
// FALLTROUGH
; FALLTROUGH
chrin_keyboard_repeat:
// Do we have a line of input we are currently returning?
// If so, return the next byte, and clear the flag when we reach the end.
; Do we have a line of input we are currently returning?
; If so, return the next byte, and clear the flag when we reach the end.
lda CRSW
beq chrin_keyboard_read
// We have input waiting at (LSXP)+CRSW
// When CRSW = INDX, then we return a carriage return and clear the flag
; We have input waiting at (LSXP)+CRSW
; When CRSW = INDX, then we return a carriage return and clear the flag
cmp INDX
bne chrin_keyboard_not_end_of_input
// Clear pending input and quote flags
; Clear pending input and quote flags
lda #$00
sta CRSW
sta QTSW
// FALLTROUGH
; FALLTROUGH
chrin_keyboard_empty_line:
// For an empty line, just return the carriage return
; For an empty line, just return the carriage return
ply_trash_a
+ply_trash_a
ldx XSAV
clc
lda #$0D
@@ -56,19 +55,19 @@ chrin_keyboard_empty_line:
chrin_keyboard_not_end_of_input:
// Advance index, return the next byte
; Advance index, return the next byte
inc CRSW
tay
// FALLTROUGH
; FALLTROUGH
chrin_keyboard_return_byte:
lda (LSXP),y
jsr screen_check_toggle_quote
tax
ply_trash_a
+ply_trash_a
txa
ldx XSAV
jsr screen_code_to_petscii
@@ -79,7 +78,7 @@ chrin_keyboard_read:
jsr cursor_enable
// Wait for a key
; Wait for a key
lda NDX
beq chrin_keyboard_repeat
@@ -87,7 +86,7 @@ chrin_keyboard_read:
cmp #$0D
bne chrkn_keyboard_not_enter
// FALLTROUGH
; FALLTROUGH
chrin_keyboard_enter:
@@ -95,38 +94,38 @@ chrin_keyboard_enter:
jsr pop_keyboard_buffer
jsr cursor_hide_if_visible
// It was enter. Note that we have a line of input to return, and return the first byte
// after computing and storing its length (Computes Mapping the 64, p96)
; It was enter. Note that we have a line of input to return, and return the first byte
; after computing and storing its length (Computes Mapping the 64, p96)
// Set pointer to line of input
; Set pointer to line of input
lda PNT+0
sta LSXP+0
lda PNT+1
sta LSXP+1
// If the current line is a continuation of the previous one, decrease LSXP by 40
; If the current line is a continuation of the previous one, decrease LSXP by 40
ldy TBLX
lda LDTB1, y
bmi chrin_enter_calc_length // branch if not continuation
bmi chrin_enter_calc_length ; branch if not continuation
lda LSXP+0
sec
sbc #40
sta LSXP+0
bcs !+
bcs @1
dec LSXP+1
!:
@1:
ldy #80
bne chrin_enter_loop // branch always
bne chrin_enter_loop ; branch always
chrin_enter_calc_length:
// Get the logical line length
; Get the logical line length
jsr screen_get_logical_line_end_ptr
iny
chrin_enter_loop:
// Skip spaces at the end of line
; Skip spaces at the end of line
dey
bmi chrin_keyboard_empty_line
lda (LSXP),y
@@ -135,29 +134,28 @@ chrin_enter_loop:
iny
sty INDX
// Set mark informing that we are returning a line
; Set mark informing that we are returning a line
ldy #$01
sty CRSW
// Clear quote mode mark
dey // set .Y to 0
; Clear quote mode mark
dey ; set .Y to 0
sty QTSW
// Return first char of line
beq chrin_keyboard_return_byte // branch always
; Return first char of line
beq chrin_keyboard_return_byte ; branch always
chrkn_keyboard_not_enter:
lda KEYD
#if CONFIG_PROGRAMMABLE_KEYS
!ifdef CONFIG_PROGRAMMABLE_KEYS {
jsr chrin_programmable_keys
bcc chrin_keyboard_enter
}
#endif // CONFIG_PROGRAMMABLE_KEYS
// Print character, keep looking for input from keyboard until carriage return
; Print character, keep looking for input from keyboard until carriage return
jsr CHROUT
jsr pop_keyboard_buffer
jmp chrin_keyboard_repeat
+23 -23
View File
@@ -1,46 +1,46 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Keyboard part of the CHRIN routine - programmable keys support
// Output: if Carry clear, programmable key was handled
//
;
; Keyboard part of the CHRIN routine - programmable keys support
; Output: if Carry clear, programmable key was handled
;
#if CONFIG_PROGRAMMABLE_KEYS
!ifdef CONFIG_PROGRAMMABLE_KEYS {
chrin_programmable_keys:
// Check if the key is programmable
; Check if the key is programmable
ldx #(__programmable_keys_codes_end - programmable_keys_codes - 1)
!:
@1:
cmp programmable_keys_codes, x
beq !+
beq @2
dex
bpl !-
bpl @1
// This is not a programmable key
; This is not a programmable key
sec
rts
!:
// .X contains index of the key code, we need offset to key string instead
@2:
; .X contains index of the key code, we need offset to key string instead
lda programmable_keys_offsets, x
tax
// Print all the characters assigned to key
!:
; Print all the characters assigned to key
@3:
lda programmable_keys_strings, x
beq !+
jsr CHROUT // our implementation preserves .X too
beq @4
jsr CHROUT ; our implementation preserves .X too
inx
bne !- // jumps always
!:
bne @3 ; jumps always
@4:
clc
rts
#endif // CONFIG_PROGRAMMABLE_KEYS
} ; CONFIG_PROGRAMMABLE_KEYS
+33 -34
View File
@@ -1,92 +1,91 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// CHROUT routine - screen support (character output)
//
;
; CHROUT routine - screen support (character output)
;
chrout_screen:
#if ROM_LAYOUT_M65
!ifdef CONFIG_MB_M65 {
jsr M65_MODEGET
bcc_16 m65_chrout_screen
#endif
+bcc m65_chrout_screen
}
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
; All the PETSCII control codes are within $0x, $1x, $8x, $9x, remaining
; ones are always printable characters; separate away control codes
and #$60
beq_16 chrout_screen_control
+beq chrout_screen_control
txa
// Literals - first convert PETSCII to screen code
; Literals - first convert PETSCII to screen code
jsr chrout_to_screen_code
// FALLTROUGH
; FALLTROUGH
chrout_screen_literal: // entry point for chrout_screen_quote
chrout_screen_literal: ; entry point for chrout_screen_quote
// Write normal character on the screen
; Write normal character on the screen
tax // store screen code, we need .A for calculations
tax ; store screen code, we need .A for calculations
// First we need offset from PNT in .Y, we can take it from PNTR
; First we need offset from PNT in .Y, we can take it from PNTR
jsr screen_get_clipped_PNTR
// Put the character on the screen
; Put the character on the screen
txa
ora RVS // Computes Mapping the 64, page 38
ora RVS ; Computes Mapping the 64, page 38
sta (PNT),y
// Decrement number of chars waiting to be inserted
; Decrement number of chars waiting to be inserted
lda INSRT
beq !+
beq @1
dec INSRT
!:
// Toggle quote flag if required
@1:
; Toggle quote flag if required
txa
jsr screen_check_toggle_quote
// Set colour of the newly printed character
; Set colour of the newly printed character
lda COLOR
sta (USER),y
// Advance the column
; Advance the column
ldy PNTR
iny
sty PNTR
// Scroll down (extend logical line) if needed
; Scroll down (extend logical line) if needed
cpy #40
bne !+
bne @2
jsr screen_grow_logical_line
inc TBLX
ldy PNTR
!:
// If not the 80th character of the logical row, we are done
@2:
; If not the 80th character of the logical row, we are done
cpy #80
bcc chrout_screen_calc_lptr_done
// Advance to the next line
; Advance to the next line
jmp screen_advance_to_next_line
@@ -94,7 +93,7 @@ chrout_screen_calc_lptr_done:
jsr screen_calculate_pointers
// FALLTROUGH
; FALLTROUGH
chrout_screen_done:
+7 -7
View File
@@ -1,11 +1,11 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// CLR key handling within CHROUT
//
;
; CLR key handling within CHROUT
;
chrout_screen_CLR:
+20 -20
View File
@@ -1,11 +1,11 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// CHROUT routine - screen support, control codes
//
;
; CHROUT routine - screen support, control codes
;
chrout_screen_control:
@@ -20,37 +20,37 @@ chrout_try_jumptable_loop:
cpx #(__chrout_screen_jumptable_quote_guard - chrout_screen_jumptable_codes - 1)
bne chrout_try_jumptable_loop_noquote
// Is this insert/quote mode?
; Is this insert/quote mode?
tay
lda QTSW
ora INSRT
beq !+
beq @1
tya
jmp chrout_screen_quote
!:
@1:
tya
// FALLTROUGH
; FALLTROUGH
chrout_try_jumptable_loop_noquote:
cmp chrout_screen_jumptable_codes, x
bne !+
bne @2
// Found, perform a jump to subroutine
#if !HAS_OPCODES_65C02
; Found, perform a jump to subroutine
!ifndef HAS_OPCODES_65C02 {
lda chrout_screen_jumptable_hi, x
pha
lda chrout_screen_jumptable_lo, x
pha
rts
#else
} else {
txa
asl
tax
jmp (chrout_screen_jumptable, x)
#endif
!:
}
@2:
dex
bpl chrout_try_jumptable_loop
@@ -61,12 +61,12 @@ chrout_try_COLOR:
chrout_try_color_loop:
cmp colour_codes,x
bne !+
bne @3
stx COLOR
jmp chrout_screen_done
!:
@3:
dex
bpl chrout_try_color_loop
// Unknown code, or key not requiring any handling
; Unknown code, or key not requiring any handling
jmp chrout_screen_done
+19 -15
View File
@@ -1,11 +1,11 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Cursor keys handling within CHROUT
//
;
; Cursor keys handling within CHROUT
;
chrout_screen_CRSR_UP:
@@ -14,7 +14,7 @@ chrout_screen_CRSR_UP:
beq chrout_screen_CRSR_done
dec TBLX
// FALLTROUGH
; FALLTROUGH
chrout_screen_CRSR_done:
@@ -25,9 +25,9 @@ chrout_screen_CRSR_DOWN:
lda TBLX
cmp #24
bne !+
bne @1
jsr screen_scroll_up
!:
@1:
inc TBLX
jmp chrout_screen_calc_lptr_done
@@ -36,19 +36,23 @@ chrout_screen_CRSR_RIGHT:
jsr screen_get_clipped_PNTR
cpy #39
beq_16 screen_advance_to_next_line
+beq screen_advance_to_next_line
iny
!:
; FALLTROUGH
chrout_screen_CRSR_LR_end:
sty PNTR
bpl chrout_screen_CRSR_done // branch always
bpl chrout_screen_CRSR_done ; branch always
chrout_screen_CRSR_LEFT:
jsr screen_get_clipped_PNTR
dey
bpl !-
bpl chrout_screen_CRSR_LR_end
lda TBLX
beq chrout_screen_CRSR_done
@@ -56,4 +60,4 @@ chrout_screen_CRSR_LEFT:
dec TBLX
lda #39
sta PNTR
bne chrout_screen_CRSR_done // branch always
bne chrout_screen_CRSR_done ; branch always
+31 -31
View File
@@ -1,79 +1,79 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// CHROUT routine - screen support, DEL key handling
//
;
; CHROUT routine - screen support, DEL key handling
;
chrout_screen_DEL:
// In insert mode it embeds control character
; In insert mode it embeds control character
ldx INSRT
beq !+
beq @1
lda #KEY_DEL
jmp chrout_screen_quote
!:
@1:
ldy PNTR
beq chrout_screen_del_column_0
cpy #40
bne chrout_screen_del_column_normal
// FALLTROUGH
; FALLTROUGH
chrout_screen_del_column_40:
// First column of the extended line - decrement USER/PNT for copying
; First column of the extended line - decrement USER/PNT for copying
#if HAS_OPCODES_65CE02
!ifdef HAS_OPCODES_65CE02 {
dew USER
dew PNT
#else
} else {
lda USER+0
bne !+
bne @2
dec USER+1
dec PNT+1
!:
@2:
dec USER+0
dec PNT+0
#endif
}
// Copy characters
; Copy characters
ldx #39
ldy #0
jsr chrout_screen_del_copy_loop
// Finish by moving the cursor left
; Finish by moving the cursor left
jmp chrout_screen_CRSR_LEFT
chrout_screen_del_column_normal:
// We need to scroll back the rest of the logical line
; We need to scroll back the rest of the logical line
// First reduce PNTR to 0-39 range
; First reduce PNTR to 0-39 range
jsr screen_get_clipped_PNTR
sty PNTR
// Now get the offset to the last logical line character
; Now get the offset to the last logical line character
jsr screen_get_logical_line_end_ptr
tya
// Substract the PNTR value, this will tell us how many characters we need to move
; Substract the PNTR value, this will tell us how many characters we need to move
sec
sbc PNTR
tax
// Perform the character copy (scroll back) in a loop
; Perform the character copy (scroll back) in a loop
ldy PNTR
dey
jsr chrout_screen_del_copy_loop
dec PNTR
// FALLTROUGH
; FALLTROUGH
chrout_screen_del_done:
@@ -94,7 +94,7 @@ chrout_screen_del_copy_loop:
dex
bpl chrout_screen_del_copy_loop
// Clear char at end of line (just the character - not color!)
; Clear char at end of line (just the character - not color!)
lda #$20
sta (PNT),y
@@ -103,20 +103,20 @@ chrout_screen_del_copy_loop:
chrout_screen_del_column_0:
ldy TBLX
beq chrout_screen_del_done // delete from row 0, col 0 does nothing
beq chrout_screen_del_done ; delete from row 0, col 0 does nothing
// Move cursor to end of previous line
; Move cursor to end of previous line
dec TBLX
lda #39
sta PNTR
// Update PNT and USER pointers
; Update PNT and USER pointers
jsr screen_calculate_PNT_USER
// Put space character at the current cursor position (do not clear the color!)
; Put space character at the current cursor position (do not clear the color!)
ldy #39
lda #$20
sta (PNT),y
// Finish with recalculating all the variables
; Finish with recalculating all the variables
bne chrout_screen_del_done
+15 -11
View File
@@ -1,23 +1,27 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// GFX/TXT mode switch handling within CHROUT
//
;
; GFX/TXT mode switch handling within CHROUT
;
chrout_screen_GFX:
lda VIC_YMCSB
and #$02 // to upper case
!:
and #$02 ; to upper case
; FALLTROUGH
chrout_screen_GFX_TXT_end:
sta VIC_YMCSB
jmp chrout_screen_done
chrout_screen_TXT:
lda VIC_YMCSB
ora #$02 // to lower case
bne !- // branch always
ora #$02 ; to lower case
bne chrout_screen_GFX_TXT_end ; branch always
+7 -7
View File
@@ -1,11 +1,11 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// HOME key handling within CHROUT
//
;
; HOME key handling within CHROUT
;
chrout_screen_HOME:
+32 -32
View File
@@ -1,82 +1,82 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// CHROUT routine - screen support, INS key handling
//
;
; CHROUT routine - screen support, INS key handling
;
chrout_screen_INS:
// First check if last character of the logical line is space
; First check if last character of the logical line is space
jsr screen_check_space_ends_line
beq chrout_screen_ins_possible
// Not space, we cannot insert anything
; Not space, we cannot insert anything
bne_16 chrout_screen_done
+bne chrout_screen_done
chrout_screen_ins_possible:
// Move chars towards end of the line
; Move chars towards end of the line
jsr screen_get_logical_line_end_ptr
// Special handling for cursor in second line
; Special handling for cursor in second line
ldx TBLX
lda LDTB1+0, x
bpl chrout_screen_ins_second_line
// Perform character copy
; Perform character copy
jsr chrout_screen_ins_copy_loop
// Put space in the inserted gap
; Put space in the inserted gap
lda #$20
sta (PNT), y
// If line does not end with space now, try to grow the logical line
; If line does not end with space now, try to grow the logical line
jsr screen_check_space_ends_line
beq chrout_screen_ins_done
jsr screen_grow_logical_line
// FALLTROUGH
; FALLTROUGH
chrout_screen_ins_done:
// End of processing
; End of processing
jmp chrout_screen_calc_lptr_done
chrout_screen_ins_second_line:
// Adapt PNTR for copying
; Adapt PNTR for copying
lda PNTR
sec
sbc #40
sta PNTR
// Perform character copy
; Perform character copy
jsr chrout_screen_ins_copy_loop
// Put space in the inserted gap
; Put space in the inserted gap
lda #$20
sta (PNT), y
// End of processing
bne chrout_screen_ins_done // branch always
; End of processing
bne chrout_screen_ins_done ; branch always
chrout_screen_ins_copy_loop:
// 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 do not believe that the routine can be copyrighted
// due to the lack of creativity.
; 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 do not believe that the routine can be copyrighted
; due to the lack of creativity.
dey
lda (USER),y
iny
@@ -90,8 +90,8 @@ chrout_screen_ins_copy_loop:
cpy PNTR
bne chrout_screen_ins_copy_loop
// Increase insert mode count (which causes quote-mode like behaviour)
; Increase insert mode count (which causes quote-mode like behaviour)
inc INSRT
// Return from loop
; Return from loop
rts
+100 -67
View File
@@ -1,91 +1,124 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Jumptable for screen control codes support. To improve performance, should be sorted
// starting from the least probable routine.
//
;
; Jumptable for screen control codes support. To improve performance, should be sorted
; starting from the least probable routine.
;
chrout_screen_jumptable_codes:
.byte KEY_CLR
.byte KEY_HOME
.byte KEY_C64_SHIFT_OFF
.byte KEY_C64_SHIFT_ON
.byte KEY_TXT
.byte KEY_GFX
.byte KEY_RVS_OFF
.byte KEY_RVS_ON
.byte KEY_CRSR_RIGHT
.byte KEY_CRSR_LEFT
.byte KEY_CRSR_DOWN
.byte KEY_CRSR_UP
.byte KEY_INS
!byte KEY_CLR
!byte KEY_HOME
!byte KEY_C64_SHIFT_OFF
!byte KEY_C64_SHIFT_ON
!byte KEY_TXT
!byte KEY_GFX
!byte KEY_RVS_OFF
!byte KEY_RVS_ON
!byte KEY_CRSR_RIGHT
!byte KEY_CRSR_LEFT
!byte KEY_CRSR_DOWN
!byte KEY_CRSR_UP
!byte KEY_INS
__chrout_screen_jumptable_quote_guard:
#if CONFIG_EDIT_STOPQUOTE
.byte KEY_STOP
#endif
#if CONFIG_EDIT_TABULATORS
.byte KEY_C64_TAB_BW
.byte KEY_C64_TAB_FW
#endif
.byte KEY_DEL
.byte KEY_RETURN
!ifdef CONFIG_EDIT_STOPQUOTE {
!byte KEY_STOP
}
!ifdef CONFIG_EDIT_TABULATORS {
!byte KEY_C64_TAB_BW
!byte KEY_C64_TAB_FW
}
!byte KEY_DEL
!byte KEY_RETURN
__chrout_screen_jumptable_codes_end:
.const chrout_list = List().add(
chrout_screen_CLR,
chrout_screen_HOME,
chrout_screen_SHIFT_OFF,
chrout_screen_SHIFT_ON,
chrout_screen_TXT,
chrout_screen_GFX,
chrout_screen_RVS_OFF,
chrout_screen_RVS_ON,
chrout_screen_CRSR_RIGHT,
chrout_screen_CRSR_LEFT,
chrout_screen_CRSR_DOWN,
chrout_screen_CRSR_UP,
chrout_screen_INS,
#if CONFIG_EDIT_STOPQUOTE
chrout_screen_STOP,
#endif
#if CONFIG_EDIT_TABULATORS
chrout_screen_TAB_BW,
chrout_screen_TAB_FW,
#endif
chrout_screen_DEL,
chrout_screen_RETURN
)
#if !HAS_OPCODES_65C02
!ifndef HAS_OPCODES_65C02 {
chrout_screen_jumptable_lo:
put_jumptable_lo(chrout_list)
!byte <(chrout_screen_CLR-1)
!byte <(chrout_screen_HOME-1)
!byte <(chrout_screen_SHIFT_OFF-1)
!byte <(chrout_screen_SHIFT_ON-1)
!byte <(chrout_screen_TXT-1)
!byte <(chrout_screen_GFX-1)
!byte <(chrout_screen_RVS_OFF-1)
!byte <(chrout_screen_RVS_ON-1)
!byte <(chrout_screen_CRSR_RIGHT-1)
!byte <(chrout_screen_CRSR_LEFT-1)
!byte <(chrout_screen_CRSR_DOWN-1)
!byte <(chrout_screen_CRSR_UP-1)
!byte <(chrout_screen_INS-1)
!ifdef CONFIG_EDIT_STOPQUOTE {
!byte <(chrout_screen_STOP-1)
}
!ifdef CONFIG_EDIT_TABULATORS {
!byte <(chrout_screen_TAB_BW-1)
!byte <(chrout_screen_TAB_FW-1)
}
!byte <(chrout_screen_DEL-1)
!byte <(chrout_screen_RETURN-1)
chrout_screen_jumptable_hi:
put_jumptable_hi(chrout_list)
!byte >(chrout_screen_CLR-1)
!byte >(chrout_screen_HOME-1)
!byte >(chrout_screen_SHIFT_OFF-1)
!byte >(chrout_screen_SHIFT_ON-1)
!byte >(chrout_screen_TXT-1)
!byte >(chrout_screen_GFX-1)
!byte >(chrout_screen_RVS_OFF-1)
!byte >(chrout_screen_RVS_ON-1)
!byte >(chrout_screen_CRSR_RIGHT-1)
!byte >(chrout_screen_CRSR_LEFT-1)
!byte >(chrout_screen_CRSR_DOWN-1)
!byte >(chrout_screen_CRSR_UP-1)
!byte >(chrout_screen_INS-1)
!ifdef CONFIG_EDIT_STOPQUOTE {
!byte >(chrout_screen_STOP-1)
}
!ifdef CONFIG_EDIT_TABULATORS {
!byte >(chrout_screen_TAB_BW-1)
!byte >(chrout_screen_TAB_FW-1)
}
!byte >(chrout_screen_DEL-1)
!byte >(chrout_screen_RETURN-1)
#else // HAS_OPCODES_65C02
} else { ; HAS_OPCODES_65C02
chrout_screen_jumptable:
// Note: 65C02 has the page boundary vector bug fixed!
put_jumptable(chrout_list)
; Note: 65C02 has the page boundary vector bug fixed!
#endif
!word chrout_screen_CLR
!word chrout_screen_HOME
!word chrout_screen_SHIFT_OFF
!word chrout_screen_SHIFT_ON
!word chrout_screen_TXT
!word chrout_screen_GFX
!word chrout_screen_RVS_OFF
!word chrout_screen_RVS_ON
!word chrout_screen_CRSR_RIGHT
!word chrout_screen_CRSR_LEFT
!word chrout_screen_CRSR_DOWN
!word chrout_screen_CRSR_UP
!word chrout_screen_INS
!ifdef CONFIG_EDIT_STOPQUOTE {
!word chrout_screen_STOP
}
!ifdef CONFIG_EDIT_TABULATORS {
!word chrout_screen_TAB_BW
!word chrout_screen_TAB_FW
}
!word chrout_screen_DEL
!word chrout_screen_RETURN
}
+15 -15
View File
@@ -1,24 +1,24 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// CHROUT routine - screen support, control codes in quote mode
//
;
; CHROUT routine - screen support, control codes in quote mode
;
chrout_screen_quote:
// Low control codes are just +$80
; 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
!:
; 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 @1
adc #$BF ; C=1, so adding $BF + C = add $C0
@1:
jmp chrout_screen_literal
+13 -13
View File
@@ -1,33 +1,33 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// RETURN key handling within CHROUT
//
;
; RETURN key handling within CHROUT
;
chrout_screen_RETURN:
// RETURN clears quote and insert modes, it also clears reverse flag
; RETURN clears quote and insert modes, it also clears reverse flag
lda #$00
sta QTSW
sta INSRT
sta RVS
// RETURN key moves cursor two lines down in case
// of first line of the extended logical line
; RETURN key moves cursor two lines down in case
; of first line of the extended logical line
ldy TBLX
cpy #24
beq !+ // last line on screen - no need for a double line skip
beq @1 ; last line on screen - no need for a double line skip
lda LDTB1+1, y
bmi !+ // current line is not continued
bmi @1 ; current line is not continued
inc TBLX
jsr screen_calculate_PNT_USER
!:
@1:
jmp screen_advance_to_next_line
+9 -9
View File
@@ -1,19 +1,19 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// RVS ON/OFF handling within CHROUT
//
;
; RVS ON/OFF handling within CHROUT
;
chrout_screen_RVS_ON:
lda #$80
skip_2_bytes_trash_nvz
+skip_2_bytes_trash_nvz
// FALLTROUGH
; FALLTROUGH
chrout_screen_RVS_OFF:
+11 -11
View File
@@ -1,23 +1,23 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// SHIFT ON/OFF handling within CHROUT
//
;
; SHIFT ON/OFF handling within CHROUT
;
chrout_screen_SHIFT_ON:
lda #$00 // enable SHIFT+VENDOR combination
skip_2_bytes_trash_nvz
lda #$00 ; enable SHIFT+VENDOR combination
+skip_2_bytes_trash_nvz
// FALLTROUGH
; FALLTROUGH
chrout_screen_SHIFT_OFF:
lda #$80 // disable SHIFT+VENDOR combination
lda #$80 ; disable SHIFT+VENDOR combination
sta MODE
jmp chrout_screen_done
+9 -11
View File
@@ -1,14 +1,14 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// STOP key handling within CHROUT
//
;
; STOP key handling within CHROUT
;
#if CONFIG_EDIT_STOPQUOTE
!ifdef CONFIG_EDIT_STOPQUOTE {
chrout_screen_STOP:
@@ -17,6 +17,4 @@ chrout_screen_STOP:
sta QTSW
sta INSRT
jmp chrout_screen_done
#endif
}
+13 -14
View File
@@ -1,14 +1,14 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Tabulation keys handling within CHROUT
//
;
; Tabulation keys handling within CHROUT
;
#if CONFIG_EDIT_TABULATORS
!ifdef CONFIG_EDIT_TABULATORS {
chrout_screen_TAB_FW:
@@ -19,9 +19,9 @@ chrout_screen_TAB_FW:
tay
iny
cpy #40
bcc !+
bcc @1
ldy #39
!:
@1:
sty PNTR
jmp chrout_screen_calc_lptr_done
@@ -30,14 +30,13 @@ chrout_screen_TAB_FW:
chrout_screen_TAB_BW:
jsr screen_get_clipped_PNTR
beq !+ // column 0, recalculating pointers is not necessary, but this is a rare case nevertheless
beq @2 ; column 0, recalculating pointers is not necessary, but this is a rare case nevertheless
dey
tya
and #%11111000
sta PNTR
!:
@2:
jmp chrout_screen_calc_lptr_done
#endif // CONFIG_EDIT_TABULATORS
} ; CONFIG_EDIT_TABULATORS
+28 -24
View File
@@ -1,44 +1,48 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// CHROUT routine - convert PETSCII to screen code
//
;
; CHROUT routine - convert PETSCII to screen code
;
chrout_to_screen_code:
// Codes $C0-$DF become $40-$5F
; Codes $C0-$DF become $40-$5F
cmp #$E0
bcs !+
bcs @1
cmp #$C0
bcc !+
bcc @1
and #$7F
rts // not high char
!:
// Range $20-$3F is unchanged
rts ; not high char
@1:
; Range $20-$3F is unchanged
cmp #$40
bcc !+ // not high char
bcc @done ; not high char
// Unshifted letters and symbols from $40-$5F
// all end up being -$40
// (C64 PRG p376)
; 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
; 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
; Fix shifted chars by adding $20 again
cmp #$20
bcc !+ // not high char
bcc @done ; not high char
cmp #$40
bcs !+ // not high char
bcs @done ; not high char
clc
adc #$20
!:
; FALLTROUGH
@done:
rts
+32 -32
View File
@@ -1,36 +1,36 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// 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)
//
;
; 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?
; Is the cursor enabled?
lda BLNSW
bne cursor_blink_end
// Do we need to redraw things?
; Do we need to redraw things?
dec BLNCT
bpl cursor_blink_end
// Check if cursor was visible or not, and toggle
; Check if cursor was visible or not, and toggle
lda BLNON
bne cursor_undraw
// FALLTROUGH
; FALLTROUGH
cursor_draw:
@@ -39,7 +39,7 @@ cursor_draw:
sta GDBLN
eor #$80
sta (PNT),y
// Also set cursor colour
; Also set cursor colour
lda (USER),y
sta GDCOL
lda COLOR
@@ -48,29 +48,29 @@ cursor_draw:
lda #1
sta BLNON
bne cursor_timer_reset // branches always
bne cursor_timer_reset ; branches always
// XXX code below is probably not 100% safe
; XXX code below is probably not 100% safe
cursor_disable:
lda #$80
sta BLNSW
// FALLTHROUGH
; FALLTHROUGH
cursor_hide_if_visible:
// Set countdown to high value, to prevent IRQ interference
; Set countdown to high value, to prevent IRQ interference
lda #$FF
sta BLNCT
// If cursor is not visible, not much to do
; If cursor is not visible, not much to do
lda BLNON
beq cursor_timer_reset
// FALLTROUGH
; FALLTROUGH
cursor_undraw:
@@ -80,23 +80,23 @@ cursor_undraw:
lda GDCOL
sta (USER),y
// FALLTROUGH
; FALLTROUGH
cursor_undraw_cont: // entry point used by MEGA65 screen editor
cursor_undraw_cont: ; entry point used by MEGA65 screen editor
// Mark cursor as not drawn
; Mark cursor as not drawn
lda #0
sta BLNON
// FALLTROUGH
; FALLTROUGH
cursor_timer_reset:
// Rest blink counter (Mapping the 64, p39-40)
; Rest blink counter (Mapping the 64, p39-40)
lda #20
sta BLNCT
// FALLTROUGH
; FALLTROUGH
cursor_blink_end:
+8 -8
View File
@@ -1,12 +1,12 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Variables used:
// - BLNSW (cursor blink switch)
//
;
; Variables used:
; - BLNSW (cursor blink switch)
;
cursor_enable:
+18 -15
View File
@@ -1,28 +1,28 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Variables used:
// - BLNSW (cursor blink switch)
// - BLNON (if cursor is visible)
// - BLNCT (cursor blink countdown)
//
;
; Variables used:
; - BLNSW (cursor blink switch)
; - BLNON (if cursor is visible)
; - BLNCT (cursor blink countdown)
;
cursor_show_if_enabled:
lda BLNSW
bne !+
bne cursor_show_done
lda BLNON
bne !+
bne cursor_show_done
// FALLTROUGH
; FALLTROUGH
cursor_show:
// Set the cursor so that it is going to be repainted by the next IRQ
; Set the cursor so that it is going to be repainted by the next IRQ
lda #$01
sta BLNCT
@@ -30,5 +30,8 @@ cursor_show:
lda #$00
sta BLNON
!:
; FALLTROUGH
cursor_show_done:
rts
+21 -22
View File
@@ -1,42 +1,41 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Clear screen and initialise line link table, described in:
//
// - [CM64] Computes Mapping the Commodore 64 - pages 215-216
//
;
; Clear screen and initialise line link table, described in:
;
; - [CM64] Computes Mapping the Commodore 64 - pages 215-216
;
clear_screen:
#if ROM_LAYOUT_M65
!ifdef CONFIG_MB_M65 {
jsr M65_MODEGET
bcc_16 M65_CLRSCR
+bcc M65_CLRSCR
}
#endif
// Clear the line link table - cheecked on original ROMs,
// the highest bit set means that the line is NOT a logical
// continuation of the previous one
; Clear the line link table - cheecked on original ROMs,
; the highest bit set means that the line is NOT a logical
; continuation of the previous one
lda #$80
ldy #24
!:
@1:
sta LDTB1,y
dey
bpl !-
bpl @1
// Clear all the rows
; Clear all the rows
ldx #24
!:
@2:
jsr screen_clear_line
dex
bpl !-
bpl @2
// Fall to cursor home routine
; Fall to cursor home routine
jmp cursor_home
+12 -12
View File
@@ -1,19 +1,19 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Home the cursor, described in:
//
// - [CM64] Computes Mapping the Commodore 64 - page 216
//
;
; Home the cursor, described in:
;
; - [CM64] Computes Mapping the Commodore 64 - page 216
;
cursor_home:
lda #$00
sta PNTR // current column (logical)
sta TBLX // current row
sta PNTR ; current column (logical)
sta TBLX ; current row
// FALLTROUGH to the next routine
; FALLTROUGH to the next routine
@@ -1,26 +1,25 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Set pointer (PNT) to current screen line , described in:
//
// - [CM64] Computes Mapping the Commodore 64 - page 216
// - http://sta.c64.org/cbm64scrfunc.html
//
;
; Set pointer (PNT) to current screen line , described in:
;
; - [CM64] Computes Mapping the Commodore 64 - page 216
; - http://sta.c64.org/cbm64scrfunc.html
;
// XXX find out what the original ROM really recalculate
; XXX find out what the original ROM really recalculate
screen_calculate_pointers:
#if ROM_LAYOUT_M65
!ifdef CONFIG_MB_M65 {
jsr M65_MODEGET
bcc_16 m65_screen_upd_txtrow_off
#endif
+bcc m65_screen_upd_txtrow_off
}
jsr screen_calculate_PNT_USER
jmp screen_calculate_PNTR_LNMX
+37 -39
View File
@@ -1,66 +1,64 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Scroll the whole screen up by 1 logical line, described in:
//
// - [CM64] Computes Mapping the Commodore 64 - page 218
//
;
; Scroll the whole screen up by 1 logical line, described in:
;
; - [CM64] Computes Mapping the Commodore 64 - page 218
;
screen_scroll_up:
// First handle CTRL and NO_SCRL keys
; First handle CTRL and NO_SCRL keys
#if CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65
!ifdef CONFIG_KEYBOARD_C128_OR_C65 {
// Do not scroll if NO_SCRL is pressed and interrupts are enabled
!:
; Do not scroll if NO_SCRL is pressed and interrupts are enabled
@1:
php
pla
and #%00000010
bne !+ // branch if IRQs disabled, we cannot detect NO_SCRL status
bne @2 ; branch if IRQs disabled, we cannot detect NO_SCRL status
lda SHFLAG
and #KEY_FLAG_NO_SCRL
bne !-
!:
#endif
// Check if CTRL key pressed - if so, perform a delay
bne @1
@2:
}
; Check if CTRL key pressed - if so, perform a delay
lda SHFLAG
and #KEY_FLAG_CTRL
beq screen_scroll_up_delay_done
ldy #$09
!:
@3:
ldx #$FF
jsr wait_x_bars
dey
bne !-
bne @3
// FALLTROUGH
; FALLTROUGH
screen_scroll_up_delay_done: // entry point for cursor move control codes
screen_scroll_up_delay_done: ; entry point for cursor move control codes
// Scroll the LDTB1 (line link table)
; Scroll the LDTB1 (line link table)
ldy #$00
!:
@4:
lda LDTB1+1, y
sta LDTB1+0, y
iny
cpy #24
bne !-
bne @4
lda #$80
sta LDTB1+24
// Preserve SAL and EAL, prepare initial SAL/EAL/PNT/USER values
; Preserve SAL and EAL, prepare initial SAL/EAL/PNT/USER values
jsr screen_preserve_sal_eal
@@ -79,7 +77,7 @@ screen_scroll_up_delay_done: // entry point for cursor move control codes
sta SAL+0
sta PNT+0
// Now copy, SAL->EAL, PNT->USER, in a loop
; Now copy, SAL->EAL, PNT->USER, in a loop
ldy #$00
@@ -90,15 +88,15 @@ screen_scroll_up_loop:
lda (PNT), y
sta (USER), y
// Check if this was the last byte (last destination byte for color copy is #DBBF)
; Check if this was the last byte (last destination byte for color copy is #DBBF)
cpy #$BF
bne !+ // definitely not the last byte
bne @5 ; definitely not the last byte
lda USER+1
cmp #$DB
beq screen_scroll_up_loop_done
!:
// Increment .Y, possibly advance pointers
@5:
; Increment .Y, possibly advance pointers
iny
bne screen_scroll_up_loop
@@ -107,28 +105,28 @@ screen_scroll_up_loop:
inc EAL+1
inc USER+1
inc PNT+1
bne screen_scroll_up_loop // branch alwayys
bne screen_scroll_up_loop ; branch alwayys
screen_scroll_up_loop_done:
// Restore SAL and EAL
; Restore SAL and EAL
jsr screen_restore_sal_eal
// Clear the newly introduced line
; Clear the newly introduced line
ldx #24
jsr screen_clear_line
// Decrement the current physical line number
; Decrement the current physical line number
dec TBLX
// If the first line is linked, scroll once more
; If the first line is linked, scroll once more
bit LDTB1+0
bpl screen_scroll_up
// Recalculate PNT and USER
; Recalculate PNT and USER
jmp screen_calculate_PNT_USER
+23 -23
View File
@@ -1,38 +1,38 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Well-known routine, described in:
//
// - [CM64] Computes Mapping the Commodore 64 - page 219
// - http://sta.c64.org/cbm64scrfunc.html
//
// input: .X - screen line to clear
//
// Checked that original routine preserves X (convenient for loops),
// and leaves space screen code in .A, so duplicate this behaviour
//
;
; Well-known routine, described in:
;
; - [CM64] Computes Mapping the Commodore 64 - page 219
; - http://sta.c64.org/cbm64scrfunc.html
;
; input: .X - screen line to clear
;
; Checked that original routine preserves X (convenient for loops),
; and leaves space screen code in .A, so duplicate this behaviour
;
screen_clear_line:
// First, calculate PNT and USER
phx_trash_a
; First, calculate PNT and USER
+phx_trash_a
jsr screen_calculate_PNT_USER_from_X
plx_trash_a
+plx_trash_a
// Now clear the line
; Now clear the line
ldy #39
!:
@1:
lda COLOR
sta (USER), y
lda #$20 // space character screen code
lda #$20 ; space character screen code
sta (PNT), y
dey
bpl !-
bpl @1
// Done
; Done
rts
+24 -25
View File
@@ -1,44 +1,44 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 295
// - [CM64] Compute's Mapping the Commodore 64 - page 215
//
// CPU registers that has to be preserved (see [RG64]): .A
//
;
; Official Kernal routine, described in:
;
; - [RG64] C64 Programmer's Reference Guide - page 295
; - [CM64] Compute's Mapping the Commodore 64 - page 215
;
; CPU registers that has to be preserved (see [RG64]): .A
;
SCREEN:
#if !ROM_LAYOUT_M65
!ifndef CONFIG_MB_M65 {
// There are only 2 sane ways to implement this routine,
// I hope this one is different than what Commodore picked :)
; There are only 2 sane ways to implement this routine,
; I hope this one is different than what Commodore picked :)
ldy #25 // 25 columns
ldx #40 // 40 rows
ldy #25 ; 25 columns
ldx #40 ; 40 rows
rts
#else
} else {
php
jsr M65_MODEGET
bcc !+
bcc @1
plp
ldy #25 // 25 columns
ldx #40 // 40 rows
ldy #25 ; 25 columns
ldx #40 ; 40 rows
rts
!:
// Screen dimensions depends on text mode
@1:
; Screen dimensions depends on text mode
plp
pha
@@ -50,5 +50,4 @@ SCREEN:
pla
rts
#endif
}
@@ -1,22 +1,22 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
screen_advance_to_next_line:
// Check if we are at the bottom of the screen
; Check if we are at the bottom of the screen
ldy TBLX
cpy #24
bne !+
bne @1
// We need to scroll the screen up
; We need to scroll the screen up
jsr screen_scroll_up
!:
@1:
inc TBLX
// Set PNTR to 0 (for continued line will be fixed later)
; Set PNTR to 0 (for continued line will be fixed later)
lda #$00
sta PNTR
+17 -17
View File
@@ -1,48 +1,48 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Set pointers PNT and USER to current screen line
//
;
; Set pointers PNT and USER to current screen line
;
screen_calculate_PNT_USER:
ldx TBLX
// FALLTROUGH
; FALLTROUGH
screen_calculate_PNT_USER_from_X: // entry point for screen_clear_line
screen_calculate_PNT_USER_from_X: ; entry point for screen_clear_line
// Reset pointer to start of screen
; Reset pointer to start of screen
lda HIBASE
sta PNT+1
lda #$00
sta PNT+0
// Add 40 to PNT for every line
; Add 40 to PNT for every line
cpx #$00
beq screen_calculate_USER
!:
@1:
lda #40
clc
adc PNT+0
sta PNT+0
bcc !+
bcc @2
inc PNT+1
!:
@2:
dex
bne !--
bne @1
// FALLTROUGH
; FALLTROUGH
screen_calculate_USER:
// Calculate USER (pointer to the current line in color RAM)
; Calculate USER (pointer to the current line in color RAM)
lda PNT+0
sta USER+0
+17 -17
View File
@@ -1,12 +1,12 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Sets PNTR in a proper range (0-39 or 40-79)
// Sets LNMX to 39 or 79
//
;
; Sets PNTR in a proper range (0-39 or 40-79)
; Sets LNMX to 39 or 79
;
screen_calculate_PNTR_LNMX:
@@ -18,7 +18,7 @@ screen_calculate_PNTR_LNMX:
plp
bmi screen_calculate_PNTR_0_39
// FALLTROUGH
; FALLTROUGH
screen_calculate_PNTR_40_79:
@@ -27,35 +27,35 @@ screen_calculate_PNTR_40_79:
adc #40
tay
// FALLTROUGH
; FALLTROUGH
screen_calculate_PNTR_0_39:
sty PNTR
// FALLTROUGH
; FALLTROUGH
screen_calculate_LNMX:
ldy TBLX
lda LDTB1, y
bpl screen_calculate_lnmx_79 // this line is a continuation
bpl screen_calculate_lnmx_79 ; this line is a continuation
cpy #24
beq screen_calculate_lnmx_39 // this is the last line, which is not a continuation
beq screen_calculate_lnmx_39 ; this is the last line, which is not a continuation
iny
lda LDTB1, y
bpl screen_calculate_lnmx_79 // line is continued
bpl screen_calculate_lnmx_79 ; line is continued
// FALLTROUGH
; FALLTROUGH
screen_calculate_lnmx_39:
lda #39
skip_2_bytes_trash_nvz
+skip_2_bytes_trash_nvz
// FALLTROUGH
; FALLTROUGH
screen_calculate_lnmx_79:
@@ -1,7 +1,7 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
screen_check_space_ends_line:
+10 -10
View File
@@ -1,21 +1,21 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Helper routine - check character in .A, toggles quote flag if needed
//
;
; Helper routine - check character in .A, toggles quote flag if needed
;
screen_check_toggle_quote:
cmp #$22
bne !+
bne @1
lda QTSW
eor #$80
sta QTSW
lda #$22 // restore previous .A valuee
!:
lda #$22 ; restore previous .A valuee
@1:
rts
+25 -25
View File
@@ -1,52 +1,52 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Screen code to PETSCII conversion - see:
//
// - https://www.lemon64.com/forum/viewtopic.php?t=66362
// - https://sta.c64.org/cbm64scrtopetext.html
//
;
; Screen code to PETSCII conversion - see:
;
; - https://www.lemon64.com/forum/viewtopic.php?t=66362
; - https://sta.c64.org/cbm64scrtopetext.html
;
screen_code_to_petscii:
cmp #$20
bcc s2p_adc_40 // $00-$1F -> $40-$5F
bcc s2p_adc_40 ; $00-$1F -> $40-$5F
cmp #$40
bcc s2p_end // $20-$3F -> $20-$3F
bcc s2p_end ; $20-$3F -> $20-$3F
cmp #$60
bcc s2p_adc_80 // $40-$5F -> $C0-$DF
bcc s2p_adc_80 ; $40-$5F -> $C0-$DF
cmp #$80
bcc s2p_adc_40 // $60-$7F -> $A0-$BF
bcc s2p_adc_40 ; $60-$7F -> $A0-$BF
// Here we have to check for quote mode
; Here we have to check for quote mode
bit QTSW
bmi screen_code_to_petscii_quote
// Not quote mode - continue
; Not quote mode - continue
cmp #$A0
bcc s2p_adc_C0 // $80-$9F -> $40-$5F
bcc s2p_adc_C0 ; $80-$9F -> $40-$5F
cmp #$C0
bcc s2p_adc_80 // $A0-$BF -> $20-$3F
bcc s2p_adc_80 ; $A0-$BF -> $20-$3F
cmp #$E0
bcc s2p_end // $C0-$DF -> $C0-$DF
bcc s2p_end ; $C0-$DF -> $C0-$DF
clc
bcc s2p_adc_C0 // $E0-$FF -> $A0-$BF
bcc s2p_adc_C0 ; $E0-$FF -> $A0-$BF
s2p_adc_40:
adc #$40 // Carry already clear
adc #$40 ; Carry already clear
s2p_end:
@@ -54,19 +54,19 @@ s2p_end:
s2p_adc_80:
adc #$80 // Carry already clear
adc #$80 ; Carry already clear
rts
screen_code_to_petscii_quote:
cmp #$C0
bcc s2p_adc_80 // $80-$BF -> $00-$3F
bcc s2p_adc_80 ; $80-$BF -> $00-$3F
clc
// FALLTROUGH $C0-$FF -> $80-$BF
; FALLTROUGH $C0-$FF -> $80-$BF
s2p_adc_C0:
adc #$C0 // Carry already clear
adc #$C0 ; Carry already clear
rts
+9 -9
View File
@@ -1,20 +1,20 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Get PNTR value clipped to 0-39 range in .Y, sets flags to compare with 0, can trash .A
//
;
; Get PNTR value clipped to 0-39 range in .Y, sets flags to compare with 0, can trash .A
;
screen_get_clipped_PNTR:
ldy PNTR
cpy #40
bcc !+
bcc @1
tya
sbc #40
tay
!:
@1:
cpy #$00
rts
@@ -1,22 +1,22 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
screen_get_logical_line_end_ptr:
ldy TBLX
cpy #24
bcs screen_get_logical_line_end_39 // last line of the screen
bcs screen_get_logical_line_end_39 ; last line of the screen
lda LDTB1+0, y
bpl screen_get_logical_line_end_39 // current line continues previous one
bpl screen_get_logical_line_end_39 ; current line continues previous one
lda LDTB1+1, y
bmi screen_get_logical_line_end_39 // current line is not continued
bmi screen_get_logical_line_end_39 ; current line is not continued
// FALLTROUGH
; FALLTROUGH
screen_get_logical_line_end_79:
+38 -38
View File
@@ -1,14 +1,14 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
screen_grow_logical_line_done_scroll:
inc TBLX
// FALLTROUGH
; FALLTROUGH
screen_grow_logical_line_done:
@@ -19,59 +19,59 @@ screen_grow_logical_line_screen_up:
jsr screen_scroll_up
// FALLTROUGH
; FALLTROUGH
screen_grow_logical_line:
// Do not grow line if previus one is grown
; Do not grow line if previus one is grown
ldy TBLX
lda LDTB1+0, y
bpl screen_grow_logical_line_done_scroll
// If last line, scroll the screen up
; If last line, scroll the screen up
cpy #24
beq screen_grow_logical_line_screen_up
// Do not grow line if already grown
; Do not grow line if already grown
lda LDTB1+1, y
bpl screen_grow_logical_line_done
// Preserve SAL and EAL
; Preserve SAL and EAL
jsr screen_preserve_sal_eal
// Scroll LDTB1 down (start from the end)
; Scroll LDTB1 down (start from the end)
ldy #23
!:
@1:
cpy TBLX
beq !+
bcc !+
beq @2
bcc @2
lda LDTB1+0, y
sta LDTB1+1, y
dey
bne !-
!:
// Mark current line as grown
bne @1
@2:
; Mark current line as grown
ldy TBLX
lda #$00
sta LDTB1+1, y
// Now we have to scroll lines downwards to make space. We start from the end,
// and work backwards. We cannot be as simple and efficient here as we are
// for scrolling up, because we do not know how much must be scrolled.
; Now we have to scroll lines downwards to make space. We start from the end,
; and work backwards. We cannot be as simple and efficient here as we are
; for scrolling up, because we do not know how much must be scrolled.
// Work out how many physical lines to scroll down
; Work out how many physical lines to scroll down
lda #23
sec
sbc TBLX
beq screen_grow_logical_line_copy_done // branch if no need to copyy
beq screen_grow_logical_line_copy_done ; branch if no need to copyy
tax
// Prepare initial SAL/EAL/PNT/USER values
; Prepare initial SAL/EAL/PNT/USER values
lda HIBASE
clc
@@ -79,64 +79,64 @@ screen_grow_logical_line:
sta SAL+1
sta EAL+1
lda #>$DB00 // 3rd page of the color memory
lda #>$DB00 ; 3rd page of the color memory
sta PNT+1
sta USER+1
lda #<$03C0 // start of destination row
lda #<$03C0 ; start of destination row
sta EAL+0
sta USER+0
lda #<$0398 // start of source row
lda #<$0398 ; start of source row
sta SAL+0
sta PNT+0
screen_grow_logical_line_loop:
// Scroll down one line each loop iteration
; Scroll down one line each loop iteration
ldy #39
!:
@3:
lda (SAL), y
sta (EAL), y
lda (PNT), y
sta (USER), y
dey
bpl !-
bpl @3
// Decrement SAL/PNT pointers by 40 (optimized due to fact they share LSB)
; Decrement SAL/PNT pointers by 40 (optimized due to fact they share LSB)
lda SAL+0
sec
sbc #40
sta SAL+0
sta PNT+0
bcs !+
bcs @4
dec SAL+1
dec PNT+1
!:
// Decrement EAL/USER pointers by 40 (optimized due to fact they share LSB)
@4:
; Decrement EAL/USER pointers by 40 (optimized due to fact they share LSB)
lda EAL+0
sec
sbc #40
sta EAL+0
sta USER+0
bcs !+
bcs @5
dec EAL+1
dec USER+1
!:
// Next loop iteration
@5:
; Next loop iteration
dex
bne screen_grow_logical_line_loop
screen_grow_logical_line_copy_done:
// Restore SAL and EAL
; Restore SAL and EAL
jsr screen_restore_sal_eal
// Erase newly inserted line and quit
; Erase newly inserted line and quit
ldx TBLX
inx
+20 -19
View File
@@ -1,14 +1,17 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Helper routine to blank screen
//
;
; Helper routine to blank screen
;
!set NEEDED = 0
!ifdef HAS_TAPE { !set NEEDED = 1 }
!ifdef CONFIG_IEC_JIFFYDOS { !ifndef CONFIG_MEMORY_MODEL_60K { !set NEEDED = 1 } }
#if ((CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO)) || (CONFIG_IEC_JIFFYDOS && !CONFIG_MEMORY_MODEL_60K)
!if NEEDED {
screen_off:
@@ -17,16 +20,14 @@ screen_off:
and #($FF - $10)
sta VIC_SCROLY
// To be sure there are no badlines we have to wait till the next screen,
// as the bit is checked by VIC-II at the start of the frame only
!:
lda VIC_SCROLY // wait for higher part of screen
bpl !-
!:
lda VIC_SCROLY // wait for lower part of the screen
bmi !-
; To be sure there are no badlines we have to wait till the next screen,
; as the bit is checked by VIC-II at the start of the frame only
@1:
lda VIC_SCROLY ; wait for higher part of screen
bpl @1
@2:
lda VIC_SCROLY ; wait for lower part of the screen
bmi @2
rts
#endif
}
+12 -11
View File
@@ -1,14 +1,17 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Helper routine to show screen
//
;
; Helper routine to show screen
;
!set NEEDED = 0
!ifdef HAS_TAPE { !set NEEDED = 1 }
!ifdef CONFIG_IEC_JIFFYDOS { !ifndef CONFIG_MEMORY_MODEL_60K { !set NEEDED = 1 } }
#if (CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO) || (CONFIG_IEC_JIFFYDOS && !CONFIG_MEMORY_MODEL_60K)
!if NEEDED {
screen_on:
@@ -18,6 +21,4 @@ screen_on:
sta VIC_SCROLY
rts
#endif
}
+16 -16
View File
@@ -1,21 +1,21 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
screen_preserve_sal_eal:
plx_trash_a
ply_trash_a
+plx_trash_a
+ply_trash_a
// Note: While the following routine is obvious to any skilled
// in the art as the most obvious simple and efficient solution,
// 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 do not believe that the
// routine can be copyrighted due to the lack of creativity.
; Note: While the following routine is obvious to any skilled
; in the art as the most obvious simple and efficient solution,
; 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 do not believe that the
; routine can be copyrighted due to the lack of creativity.
lda SAL+0
pha
@@ -26,10 +26,10 @@ screen_preserve_sal_eal:
lda EAL+1
pha
// FALLTROUGH
; FALLTROUGH
screen_common_sal_eal:
phy_trash_a
phx_trash_a
+phy_trash_a
+phx_trash_a
rts
+13 -13
View File
@@ -1,21 +1,21 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 * #IGNORE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
screen_restore_sal_eal:
plx_trash_a
ply_trash_a
+plx_trash_a
+ply_trash_a
// Note: While the following routine is obvious to any skilled
// in the art as the most obvious simple and efficient solution,
// 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 do not believe that the
// routine can be copyrighted due to the lack of creativity.
; Note: While the following routine is obvious to any skilled
; in the art as the most obvious simple and efficient solution,
; 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 do not believe that the
; routine can be copyrighted due to the lack of creativity.
pla
sta EAL+1