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

+40 -41
View File
@@ -1,50 +1,50 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Keyboard part of the CHRIN routine, version for MEGA65 native mode
//
;
; Keyboard part of the CHRIN routine, version for MEGA65 native mode
;
m65_chrin_keyboard: // XXX connnect this function to Kernal
m65_chrin_keyboard: ; XXX connnect this function to Kernal
// Preserve .X, .Y and .Z register
; Preserve .X, .Y and .Z register
phx
phy
phz
// FALLTROUGH
; FALLTROUGH
m65_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 m65_chrin_keyboard_read
// We have input waiting at [M65__SCRINPUT]+CRSW
// When CRSW = INDX, then we return a carriage return and clear the flag
; We have input waiting at [M65__SCRINPUT]+CRSW
; When CRSW = INDX, then we return a carriage return and clear the flag
cmp INDX
bne m65_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
m65_chrin_keyboard_empty_line:
// For an empty line, just return the carriage return
; For an empty line, just return the carriage return
lda #$0D
// FALLTROUGH
; FALLTROUGH
m65_chrin_keyboard_end:
@@ -56,12 +56,12 @@ m65_chrin_keyboard_end:
m65_chrin_keyboard_not_end_of_input:
// Advance index, return the next byte
; Advance index, return the next byte
inc CRSW
tay
// FALLTROUGH
; FALLTROUGH
m65_chrin_keyboard_return_byte:
@@ -69,38 +69,38 @@ m65_chrin_keyboard_return_byte:
tya
taz
lda_lp (M65_LPNT_SCR), z
lda [M65_LPNT_SCR], z
jsr screen_check_toggle_quote
jsr screen_code_to_petscii
jmp_8 m65_chrin_keyboard_end
bra m65_chrin_keyboard_end
m65_chrin_keyboard_read:
jsr cursor_enable
// Wait for a key
; Wait for a key
lda NDX
beq m65_chrin_keyboard_repeat
lda KEYD
cmp #$0D
bne m65_chrin_keyboard_not_enter
// FALLTROUGH
; FALLTROUGH
m65_chrin_keyboard_enter:
// Disable cursor, retrieve code from keyboard buffer
; Disable cursor, retrieve code from keyboard buffer
jsr m65_cursor_disable
jsr pop_keyboard_buffer
jsr m65_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 the input, start for the viewport offset + screen memory base
; Set pointer to the input, start for the viewport offset + screen memory base
clc
lda M65_COLVIEW+0
adc M65_SCRBASE+0
@@ -108,7 +108,7 @@ m65_chrin_keyboard_enter:
lda M65_COLVIEW+1
adc M65_SCRBASE+1
sta M65__SCRINPUT+1
// Add current row offset
; Add current row offset
clc
lda M65__SCRINPUT+0
adc M65_TXTROW_OFF+0
@@ -117,54 +117,53 @@ m65_chrin_keyboard_enter:
adc M65_TXTROW_OFF+1
sta M65__SCRINPUT+1
// Retrieve first byte which is not space
; Retrieve first byte which is not space
jsr m65_helper_scrlpnt_chrin
ldy M65_COLVIEWMAX // XXX add support for windowed mode here
ldy M65_COLVIEWMAX ; XXX add support for windowed mode here
iny
// FALLTROUGH
; FALLTROUGH
m65_chrin_enter_loop:
// Skip spaces at the end of line
; Skip spaces at the end of line
dey
bmi m65_chrin_keyboard_empty_line
tya
taz
lda_lp (M65_LPNT_SCR), z
lda [M65_LPNT_SCR], z
cmp #$20
beq m65_chrin_enter_loop
iny
sty INDX
// XXX add windowed mode support here - correct INDX and M65__SCRINPUT
; XXX add windowed mode support here - correct INDX and M65__SCRINPUT
// 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
; Clear quote mode mark
dey
sty QTSW
// Return first char of line
jmp_8 m65_chrin_keyboard_return_byte // branch always
; Return first char of line
bra m65_chrin_keyboard_return_byte ; branch always
m65_chrin_keyboard_not_enter:
lda KEYD
#if CONFIG_PROGRAMMABLE_KEYS
!ifdef CONFIG_PROGRAMMABLE_KEYS {
jsr chrin_programmable_keys
bcc m65_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 m65_chrin_keyboard_repeat
+84 -84
View File
@@ -1,87 +1,87 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
//
// CHROUT routine - screen support (character output), MEGA65 native mode version
//
;
; CHROUT routine - screen support (character output), MEGA65 native mode version
;
m65_chrout_screen:
jsr m65_cursor_hide_if_visible
// Retrieve the character to output
; Retrieve the character to output
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 m65_chrout_screen_control
+beq m65_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
m65_chrout_screen_literal: // entry point for m65_chrout_screen_quote
m65_chrout_screen_literal: ; entry point for m65_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
// Preserve .Z on stack
; Preserve .Z on stack
phz
// Prepare .Z and M65_LPNT_SCR for colour memory manipulation
; Prepare .Z and M65_LPNT_SCR for colour memory manipulation
ldz M65__TXTCOL
jsr m65_helper_scrlpnt_color
// Store the new color in screen memory
; Store the new color in screen memory
lda COLOR
sta_lp (M65_LPNT_SCR),z
sta [M65_LPNT_SCR], z
// Now change M65_LPNT_SCR to point to screen memory
; Now change M65_LPNT_SCR to point to screen memory
jsr m65_helper_scrlpnt_to_screen
// 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
// Store the new character in screen memory, restore .Z
; Store the new character in screen memory, restore .Z
txa
bit RVS
bpl !+
ora #$80 // reverse the character XXX consider doing this within chrout_to_screen_code
!:
sta_lp (M65_LPNT_SCR),z
bpl @2
ora #$80 ; reverse the character XXX consider doing this within chrout_to_screen_code
@2:
sta [M65_LPNT_SCR], z
// Restore .Z
; Restore .Z
plz
// Increment screen column by 1
; Increment screen column by 1
inc M65__TXTCOL
// FALLTROUGH
; FALLTROUGH
m65_chrout_fix_column_row:
@@ -90,158 +90,158 @@ m65_chrout_fix_column_row:
bit M65_SCRWINMODE
bmi m65_chrout_fix_column_row_win
// Non-windowed mode
; Non-windowed mode
// Check for column below 0
; Check for column below 0
lda M65__TXTCOL
bpl !++
bpl @4
lda M65_COLVIEW+0
ora M65_COLVIEW+1
ora M65__TXTROW
bne !+
bne @3
lda #$00
sta M65__TXTCOL
jmp_8 !++
!:
bra @4
@3:
dec M65__TXTROW
lda m65_scrtab_txtwidth,y
sta M65__TXTCOL
dec M65__TXTCOL
!:
// Check for column above maximum
@4:
; Check for column above maximum
lda M65__TXTCOL
cmp m65_scrtab_txtwidth,y
bcc !+
bcc @5
inc M65__TXTROW
lda #$00
sta M65__TXTCOL
!:
// Check for row below 0
@5:
; Check for row below 0
lda M65__TXTROW
bpl !+
bpl @6
jsr m65_chrout_fix_scroll_down
!:
// Check for row above maximum
@6:
; Check for row above maximum
lda M65__TXTROW
cmp m65_scrtab_txtheight,y
bcc !+
bcc @7
jsr m65_chrout_fix_scroll_up
!:
jmp_8 m65_chrout_fix_txtrow_off
@7:
bra m65_chrout_fix_txtrow_off
m65_chrout_fix_column_row_win:
// Windowed mode
; Windowed mode
// XXX
// XXX provide implementation
// XXX
; XXX
; XXX provide implementation
; XXX
nop
+nop
// FALLTROUGH
; FALLTROUGH
m65_chrout_fix_txtrow_off:
jsr m65_screen_upd_txtrow_off
// FALLTROUGH
; FALLTROUGH
m65_chrout_screen_done:
jsr cursor_show_if_enabled
// XXX make sure it return success
; XXX make sure it return success
rts
// Try to fix coordinates by scrolling the screen down
; Try to fix coordinates by scrolling the screen down
m65_chrout_fix_scroll_down:
inc M65__TXTROW
// Check if we can simply adapt the viewport
; Check if we can simply adapt the viewport
lda M65_COLVIEW+0
ora M65_COLVIEW+1
beq m65_chrout_fix_scroll_down_end
// Yes, we can simply adapt the viewport
; Yes, we can simply adapt the viewport
sec
lda M65_COLVIEW+0
sbc #$50
sta M65_COLVIEW+0
sta VIC_COLPTR+0
bcs !+
bcs @8
dec M65_COLVIEW+1
dec VIC_COLPTR+1
!:
@8:
sec
lda VIC_SCRNPTR+0
sbc #$50
sta VIC_SCRNPTR+0
bcs !+
bcs @9
dec VIC_SCRNPTR+1
!:
// FALLTROUGH
@9:
; FALLTROUGH
m65_chrout_fix_scroll_down_end:
rts
// Try to fix coordinates by scrolling the screen up
; Try to fix coordinates by scrolling the screen up
m65_chrout_fix_scroll_up:
dec M65__TXTROW
// Check if we can simply adapt the viewport
; Check if we can simply adapt the viewport
lda M65_COLVIEW+1
cmp M65_COLVIEWMAX+1
bne !+
bne @10
lda M65_COLVIEW+0
cmp M65_COLVIEWMAX+0
beq m65_chrout_fix_scroll_up_scroll
!:
// Yes, we can simply adapt the viewport
@10:
; Yes, we can simply adapt the viewport
clc
lda M65_COLVIEW+0
adc #$50
sta M65_COLVIEW+0
sta VIC_COLPTR+0
bcc !+
bcc @11
inc M65_COLVIEW+1
inc VIC_COLPTR+1
!:
@11:
clc
lda VIC_SCRNPTR+0
adc #$50
sta VIC_SCRNPTR+0
bcc !+
bcc @12
inc VIC_SCRNPTR+1
!:
@12:
rts
m65_chrout_fix_scroll_up_scroll:
// Virtual screen is too small - we will lose one row
; Virtual screen is too small - we will lose one row
// Calculate size of data to copy
; Calculate size of data to copy
sec
lda M65_COLGUARD+0
@@ -251,19 +251,19 @@ m65_chrout_fix_scroll_up_scroll:
sbc #$00
sta M65_DMAJOB_SIZE_1
// Scroll up screen memory
; Scroll up screen memory
jsr m65_screen_dmasrcdst_screen
jsr m65_screen_dmasrc_add_row
jsr m65_dmagic_oper_copy
// Scroll up color memory
; Scroll up color memory
jsr m65_screen_dmasrcdst_color
jsr m65_screen_dmasrc_add_row
jsr m65_dmagic_oper_copy
// Clear the last row - color and screen memory
; Clear the last row - color and screen memory
phz
@@ -271,18 +271,18 @@ m65_chrout_fix_scroll_up_scroll:
lda COLOR
and #$0F
ldz M65_SCRCOLMAX
!:
sta_lp (M65_LPNT_SCR), z
@13:
sta [M65_LPNT_SCR], z
dez
bpl !-
bpl @13
jsr m65_helper_scrlpnt_to_screen
lda #$20
ldz M65_SCRCOLMAX
!:
sta_lp (M65_LPNT_SCR), z
@14:
sta [M65_LPNT_SCR], z
dez
bpl !-
bpl @14
plz
@@ -1,5 +1,5 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
m65_chrout_screen_control:
@@ -15,32 +15,32 @@ m65_chrout_try_jumptable_loop:
cpx #(__m65_chrout_screen_jumptable_quote_guard - m65_chrout_screen_jumptable_codes - 1)
bne m65_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 m65_chrout_screen_quote
!:
@1:
tya
// FALLTROUGH
; FALLTROUGH
m65_chrout_try_jumptable_loop_noquote:
cmp m65_chrout_screen_jumptable_codes, x
bne !+
bne @2
// Found, perform a jump to subroutine
; Found, perform a jump to subroutine
txa
asl
tax
jmp (m65_chrout_screen_jumptable, x)
!:
@2:
dex
bpl m65_chrout_try_jumptable_loop
@@ -51,7 +51,7 @@ m65_chrout_try_COLOR:
m65_chrout_try_color_loop:
cmp colour_codes,x
bne !+
bne @3
lda COLOR
and #$F0
@@ -62,35 +62,35 @@ m65_chrout_try_color_loop:
sta COLOR
jmp m65_chrout_screen_done
!:
@3:
dex
bpl m65_chrout_try_color_loop
// Unknown code, or key not requiring any handling
; Unknown code, or key not requiring any handling
jmp m65_chrout_screen_done
// XXX: implement screen routines below:
; XXX: implement screen routines below:
m65_chrout_screen_TAB:
nop
+nop
m65_chrout_screen_LINE_FEED:
nop
+nop
m65_chrout_screen_UNDERLINE_ON:
nop
+nop
m65_chrout_screen_UNDERLINE_OFF:
nop
+nop
m65_chrout_screen_FLASHING_ON:
nop
+nop
m65_chrout_screen_FLASHING_OFF:
nop
+nop
m65_chrout_screen_TAB_SET_CLR:
nop
+nop
m65_chrout_screen_ESC:
nop
+nop
m65_chrout_screen_BELL:
jmp m65_chrout_screen_done
@@ -1,62 +1,62 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
// Cursor movement
; Cursor movement
m65_chrout_screen_CRSR_RIGHT:
inc M65__TXTCOL
skip_2_bytes_trash_nvz
+skip_2_bytes_trash_nvz
// FALLTROUGH
; FALLTROUGH
m65_chrout_screen_CRSR_LEFT:
dec M65__TXTCOL
skip_2_bytes_trash_nvz
+skip_2_bytes_trash_nvz
// FALLTROUGH
; FALLTROUGH
m65_chrout_screen_CRSR_DOWN:
inc M65__TXTROW
skip_2_bytes_trash_nvz
+skip_2_bytes_trash_nvz
// FALLTROUGH
; FALLTROUGH
m65_chrout_screen_CRSR_UP:
dec M65__TXTROW
jmp_8 m65_chrout_screen_ctrl1_end
bra m65_chrout_screen_ctrl1_end
// 'RETURN' key
; 'RETURN' key
m65_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
// Move cursor to the beginning of the next line
; Move cursor to the beginning of the next line
bit M65_SCRWINMODE
bpl !+
bpl @1
lda M65_TXTWIN_X0
skip_2_bytes_trash_nvz
!:
+skip_2_bytes_trash_nvz
@1:
lda #$00
sta M65__TXTCOL
inc M65__TXTROW
// FALLTROUGH
; FALLTROUGH
m65_chrout_screen_ctrl1_end:
// Correct the column/row values
; Correct the column/row values
jmp m65_chrout_fix_column_row
@@ -1,15 +1,15 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
// 'REVERSE' mode support
; 'REVERSE' mode support
m65_chrout_screen_RVS_ON:
lda #$80
skip_2_bytes_trash_nvz
+skip_2_bytes_trash_nvz
// FALLTROUGH
; FALLTROUGH
m65_chrout_screen_RVS_OFF:
@@ -17,134 +17,138 @@ m65_chrout_screen_RVS_OFF:
sta RVS
// FALLTROUGH
; FALLTROUGH
m65_chrout_screen_ctrl2_end:
jmp m65_chrout_screen_done
// 'SHIFT ON/OFF' support
; 'SHIFT ON/OFF' support
m65_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
m65_chrout_screen_SHIFT_OFF:
lda #$80 // disable SHIFT+VENDOR combination
lda #$80 ; disable SHIFT+VENDOR combination
sta MODE
jmp_8 m65_chrout_screen_ctrl2_end
bra m65_chrout_screen_ctrl2_end
// STOP key support
; STOP key support
m65_chrout_screen_STOP:
lda #$00
sta QTSW
sta INSRT
jmp_8 m65_chrout_screen_ctrl2_end
bra m65_chrout_screen_ctrl2_end
// CLR/HOME key support
; CLR/HOME key support
m65_chrout_screen_CLR:
jsr M65_CLRWIN
jmp_8 m65_chrout_screen_ctrl2_end
bra m65_chrout_screen_ctrl2_end
m65_chrout_screen_HOME:
jsr M65_HOME
jmp_8 m65_chrout_screen_ctrl2_end
bra m65_chrout_screen_ctrl2_end
// Character set switching
; Character set switching
m65_chrout_screen_GFX:
lda VIC_CHARPTR+1
ora #%00001000
!:
; FALLTROUGH
m65_chrout_screen_GFX_cont:
sta VIC_CHARPTR+1
jmp_8 m65_chrout_screen_ctrl2_end
bra m65_chrout_screen_ctrl2_end
m65_chrout_screen_TXT:
lda VIC_CHARPTR+1
and #%11110111
jmp_8 !-
bra m65_chrout_screen_GFX_cont
// INS key
; INS key
m65_chrout_screen_INS:
// First prepare the pointer to the current row
; First prepare the pointer to the current row
jsr m65_helper_scrlpnt_color
jsr m65_helper_scrlpnt_to_screen
// Check for windowed mode
; Check for windowed mode
lda M65_SCRWINMODE
bmi_16 m65_chrout_screen_INS_winmode
+bmi m65_chrout_screen_INS_winmode
// Check if last character of the line is space
; Check if last character of the line is space
ldy M65_SCRMODE
lda m65_scrtab_txtwidth,y
dec_a
dec
taz
lda_lp (M65_LPNT_SCR), z
lda [M65_LPNT_SCR], z
cmp #$20
bne_16 m65_chrout_screen_ctrl2_end
+bne m65_chrout_screen_ctrl2_end
phz
// Last character is space - move the characters
; Last character is space - move the characters
jsr m65_chrout_screen_INS_copy
// Store space in the current character cell
; Store space in the current character cell
lda #$20
sta_lp (M65_LPNT_SCR), z
sta [M65_LPNT_SCR], z
// Move the color memory
; Move the color memory
jsr m65_helper_scrlpnt_color
plz
jsr m65_chrout_screen_INS_copy
// Store current colour in the current character cell
; Store current colour in the current character cell
lda COLOR
and #$0F
sta_lp (M65_LPNT_SCR), z
sta [M65_LPNT_SCR], z
// Increase insert mode count (which causes quote-mode like behaviour) and quit
; Increase insert mode count (which causes quote-mode like behaviour) and quit
inc INSRT
jmp_8 m65_chrout_screen_ctrl2_end
bra m65_chrout_screen_ctrl2_end
m65_chrout_screen_INS_winmode:
// Check if last character of the line within window is space
; Check if last character of the line within window is space
// XXX provide implementation
; XXX provide implementation
jmp_8 m65_chrout_screen_ctrl2_end
bra m65_chrout_screen_ctrl2_end
m65_chrout_screen_INS_copy:
dez
lda_lp (M65_LPNT_SCR), z
lda [M65_LPNT_SCR], z
inz
sta_lp (M65_LPNT_SCR), z
sta [M65_LPNT_SCR], z
dez
cpz M65__TXTCOL
bne m65_chrout_screen_INS_copy
@@ -1,23 +1,23 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
// 'DEL' key support
; 'DEL' key support
m65_chrout_screen_DEL:
// First check for window mode
; First check for window mode
lda M65_SCRWINMODE
bmi m65_chrout_screen_DEL_winmode
// Not a window mode; check if we are in the first column
; Not a window mode; check if we are in the first column
lda M65__TXTCOL
beq m65_chrout_screen_DEL_1stcol
// Not a window mode, not a first column - we can safely
// delete the character and sroll back the rest of the row
; Not a window mode, not a first column - we can safely
; delete the character and sroll back the rest of the row
phz
@@ -27,18 +27,18 @@ m65_chrout_screen_DEL:
ldz M65_SCRCOLMAX
lda COLOR
and #$0F
sta_lp (M65_LPNT_SCR), z
sta [M65_LPNT_SCR], z
jsr m65_helper_scrlpnt_to_screen
jsr m65_chrout_screen_DEL_copy
ldz M65_SCRCOLMAX
lda #$20
sta_lp (M65_LPNT_SCR), z
sta [M65_LPNT_SCR], z
plz
// End by moving cursor one position left
; End by moving cursor one position left
jmp m65_chrout_screen_CRSR_LEFT
@@ -46,33 +46,33 @@ m65_chrout_screen_DEL_copy:
ldz M65__TXTCOL
dez
!:
@1:
cpz M65_SCRCOLMAX
beq !+
beq @2
inz
lda_lp (M65_LPNT_SCR), z
lda [M65_LPNT_SCR], z
dez
sta_lp (M65_LPNT_SCR), z
sta [M65_LPNT_SCR], z
inz
jmp_8 !-
!:
bra @1
@2:
rts
m65_chrout_screen_DEL_1stcol:
// Start by moving one position left
; Start by moving one position left
jsr m65_chrout_screen_CRSR_LEFT
// If we are still in the first column - nothing to do
; If we are still in the first column - nothing to do
lda M65__TXTCOL
beq !+
beq @3
// Deleta character under cursor
; Deleta character under cursor
phz
@@ -81,22 +81,21 @@ m65_chrout_screen_DEL_1stcol:
lda COLOR
and #$0F
sta_lp (M65_LPNT_SCR), z
sta [M65_LPNT_SCR], z
jsr m65_helper_scrlpnt_to_screen
lda #$20
sta_lp (M65_LPNT_SCR), z
sta [M65_LPNT_SCR], z
plz
// End of character deletion
!:
; End of character deletion
@3:
jmp m65_chrout_screen_done
m65_chrout_screen_DEL_winmode:
// XXX provide implementation for window mode
; XXX provide implementation for window mode
jmp m65_chrout_screen_done
+16 -16
View File
@@ -1,51 +1,51 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
M65_CLRSCR:
// Clear additional attributes from the color code
; Clear additional attributes from the color code
jsr m65_screen_clear_colorattr
// Disable the window mode
; Disable the window mode
lda #$00
sta M65_SCRWINMODE
// FALLTROUGH
; FALLTROUGH
m65_clrscr_takeover:
// Clear the whole screen + colour memory
; Clear the whole screen + colour memory
// Screen size
; Screen size
lda M65_COLGUARD+0
sta M65_DMAJOB_SIZE_0
lda M65_COLGUARD+1
sta M65_DMAJOB_SIZE_1
// Fill screen memory with spaces
; Fill screen memory with spaces
jsr m65_screen_dmasrcdst_screen
lda #$20
jsr m65_dmagic_oper_fill
// Fill color memory with the current color
; Fill color memory with the current color
jsr m65_screen_dmasrcdst_color
lda COLOR
and #$0F
jsr m65_dmagic_oper_fill
// Set the viewport to the beginning of virtual screen
// XXX deduplicate with mode setting routine
; Set the viewport to the beginning of virtual screen
; XXX deduplicate with mode setting routine
lda #$00
sta M65_COLVIEW+0
sta M65_COLVIEW+1
// Set screen+color base address in VIC IV
// XXX deduplicate with mode setting routine
; Set screen+color base address in VIC IV
; XXX deduplicate with mode setting routine
sta VIC_COLPTR+0
sta VIC_COLPTR+1
@@ -57,11 +57,11 @@ m65_clrscr_takeover:
lda M65_SCRBASE+1
sta VIC_SCRNPTR+1
// Set logical row length
; Set logical row length
jsr m65_screen_set_indx
// FALLTROUGH
; FALLTROUGH
M65_HOME:
@@ -78,6 +78,6 @@ M65_HOME:
M65_HOME_winmode:
// XXX provide implementation
; XXX provide implementation
rts
+31 -31
View File
@@ -1,28 +1,28 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
// XXX deduplicate pointer manipulation, see M65_CLRSCR
// XXX consider using DMAgic for this - FILL command
; XXX deduplicate pointer manipulation, see M65_CLRSCR
; XXX consider using DMAgic for this - FILL command
M65_CLRWIN:
// Clear additional attributes from the color code
; Clear additional attributes from the color code
jsr m65_screen_clear_colorattr
// Check if windowed mode; if not, go to M65_CLRSCR
; Check if windowed mode; if not, go to M65_CLRSCR
lda M65_SCRWINMODE
bpl_16 m65_clrscr_takeover
+bpl m65_clrscr_takeover
// To clear the window, two zeropage long pointers will be used:
// - M65_LPNT_SCR for screen memory
// - M65_LPNT_KERN for colour memory (starts from $FF80000) // XXX preserve this on stack, restore afterwards
; To clear the window, two zeropage long pointers will be used:
; - M65_LPNT_SCR for screen memory
; - M65_LPNT_KERN for colour memory (starts from $FF80000) ; XXX preserve this on stack, restore afterwards
// First initialize both pointers
; First initialize both pointers
// XXX use m65_helper_scrlpnt_color and m65_helper_scrlpnt_to_screen instead
; XXX use m65_helper_scrlpnt_color and m65_helper_scrlpnt_to_screen instead
clc
lda M65_COLVIEW+0
@@ -40,67 +40,67 @@ M65_CLRWIN:
sta M65_LPNT_KERN+0
lda M65_COLVIEW+1
sta M65_LPNT_KERN+1
// XXX deduplicate part below with M65_CLRSCR
; XXX deduplicate part below with M65_CLRSCR
lda #$F8
sta M65_LPNT_KERN+2
lda #$0F
sta M65_LPNT_KERN+3
// Go trough all the rows
; Go trough all the rows
phz
ldy #$00
// FALLTROUGH
; FALLTROUGH
m65_clrwin_loop:
// Check if .Y cordinate is not below the window
; Check if .Y cordinate is not below the window
cpy M65_TXTWIN_Y0
bcc m65_clrwin_loop_next // branch if we should skip this row
bcc m65_clrwin_loop_next ; branch if we should skip this row
// Clear the row
; Clear the row
ldz M65_TXTWIN_X0
!:
@1:
lda #$20
sta_lp (M65_LPNT_SCR),z
sta [M65_LPNT_SCR],z
lda COLOR
sta_lp (M65_LPNT_KERN),z
sta [M65_LPNT_KERN],z
inz
cpz M65_TXTWIN_X1
bne !-
bne @1
// FALLTROUGH
; FALLTROUGH
m65_clrwin_loop_next:
// Increment M65_LPNT_SCR and M65_LPNT_KERN by the logical row length (always 80 = $50)
; Increment M65_LPNT_SCR and M65_LPNT_KERN by the logical row length (always 80 = $50)
clc
lda #$50
adc M65_LPNT_SCR+0
sta M65_LPNT_SCR+0
bcc !+
bcc @2
inc M65_LPNT_SCR+1
!:
@2:
clc
lda #$50
adc M65_LPNT_KERN+0
sta M65_LPNT_KERN+0
bcc !+
bcc @3
inc M65_LPNT_KERN+1
!:
// Increment row counter, check if new row is valid
@3:
; Increment row counter, check if new row is valid
iny
cpy M65_TXTWIN_Y1
bne m65_clrwin_loop
plz
// Set screen variables
; Set screen variables
// XXX implement this
; XXX implement this
rts
+23 -23
View File
@@ -1,54 +1,54 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_1 #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)
//
;
; Variables used:
; - BLNSW (cursor blink switch)
; - BLNCT (cursor blink countdown)
; - GDBLN (cursor saved character)
; - BLNON (if cursor is visible)
; - GDCOL (colour under cursor)
;
m65_cursor_disable: // XXX utilize this!
m65_cursor_disable: ; XXX utilize this!
// Disable cursor blinking
; Disable cursor blinking
lda #$80
sta BLNSW
// FALLTHROUGH
; FALLTHROUGH
m65_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_16 cursor_timer_reset
+beq cursor_timer_reset
// FALLTROUGH
; FALLTROUGH
m65_cursor_undraw:
// Preserve .Z
; Preserve .Z
phz
// Cursor undraw - color
; Cursor undraw - color
jsr m65_helper_scrlpnt_color
ldz M65__TXTCOL
lda GDCOL
sta_lp (M65_LPNT_SCR),z
sta [M65_LPNT_SCR],z
// Cursor undraw - character
; Cursor undraw - character
jsr m65_helper_scrlpnt_to_screen
lda GDBLN
sta_lp (M65_LPNT_SCR),z
sta [M65_LPNT_SCR],z
// Restore .Z and continue as with normal editor
; Restore .Z and continue as with normal editor
plz
jmp cursor_undraw_cont
+33 -33
View File
@@ -1,33 +1,33 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 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)
//
;
; Variables used:
; - BLNSW (cursor blink switch)
; - BLNCT (cursor blink countdown)
; - GDBLN (cursor saved character)
; - BLNON (if cursor is visible)
; - GDCOL (colour under cursor)
;
m65_cursor_blink:
// Preserve .Z
; Preserve .Z
phz
// Is the cursor enabled?
; Is the cursor enabled?
lda BLNSW
bne m65_cursor_blink_end
// Do we need to redraw things?
; Do we need to redraw things?
dec BLNCT
bpl m65_cursor_blink_end
// Prepare .Z for offset within row
; Prepare .Z for offset within row
ldz M65__TXTCOL
// Prepare long pointer to color memory
; Prepare long pointer to color memory
lda #$0F
sta M65_LPNT_IRQ+3
lda #$F8
@@ -38,7 +38,7 @@ m65_cursor_blink:
lda M65_COLVIEW+0
sta M65_LPNT_IRQ+0
// Add screen row to the address
; Add screen row to the address
clc
lda M65_TXTROW_OFF+0
adc M65_LPNT_IRQ+0
@@ -47,38 +47,38 @@ m65_cursor_blink:
adc M65_LPNT_IRQ+1
sta M65_LPNT_IRQ+1
// Check if cursor was visible or not, and toggle
; Check if cursor was visible or not, and toggle
lda BLNON
bne m65_cursor_blink_undraw
// FALLTROUGH
; FALLTROUGH
m65_cursor_blink_draw:
lda #1
sta BLNON
// Cursor draw - color
lda_lp (M65_LPNT_IRQ),z
; Cursor draw - color
lda [M65_LPNT_IRQ],z
sta GDCOL
lda COLOR
and #$0F // take current colour, but not extended attributes
sta_lp (M65_LPNT_IRQ),z
and #$0F ; take current colour, but not extended attributes
sta [M65_LPNT_IRQ],z
// Cursor draw - character
; Cursor draw - character
jsr m65_cursor_blink_irqpnt_to_screen
lda_lp (M65_LPNT_IRQ),z
lda [M65_LPNT_IRQ],z
sta GDBLN
eor #$80
sta_lp (M65_LPNT_IRQ),z
sta [M65_LPNT_IRQ],z
m65_cursor_blink_timer_reset:
// Rest blink counter (Mapping the 64, p39-40)
; Rest blink counter (Mapping the 64, p39-40)
lda #20
sta BLNCT
// FALLTROUGH
; FALLTROUGH
m65_cursor_blink_end:
@@ -87,17 +87,17 @@ m65_cursor_blink_end:
m65_cursor_blink_undraw:
// Cursor undraw - color
; Cursor undraw - color
lda GDCOL
sta_lp (M65_LPNT_IRQ),z
sta [M65_LPNT_IRQ],z
// Cursor undraw - character
; Cursor undraw - character
jsr m65_cursor_blink_irqpnt_to_screen
lda GDBLN
sta_lp (M65_LPNT_IRQ),z
sta [M65_LPNT_IRQ],z
// Mark cursor as not drawn
; Mark cursor as not drawn
lda #0
sta BLNON
jmp_8 m65_cursor_blink_timer_reset
bra m65_cursor_blink_timer_reset
+12 -8
View File
@@ -1,5 +1,5 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
m65_screen_clear_colorattr:
@@ -24,7 +24,7 @@ m65_screen_upd_txtrow_off:
m65_screen_dmasrcdst_screen:
// Set screen memory as start/end addresses
; Set screen memory as start/end addresses
lda M65_SCRBASE+0
sta M65_DMAJOB_SRC_0
@@ -36,7 +36,11 @@ m65_screen_dmasrcdst_screen:
sta M65_DMAJOB_SRC_2
sta M65_DMAJOB_DST_2
lda M65_SCRSEG+1
!:
; FALLTROUGH
m65_screen_dmasrcdst_screen_cont:
sta M65_DMAJOB_SRC_3
sta M65_DMAJOB_DST_3
@@ -45,7 +49,7 @@ m65_screen_dmasrcdst_screen:
m65_screen_dmasrcdst_color:
// Set color memory as start/end addresses
; Set color memory as start/end addresses
lda #$00
sta M65_DMAJOB_SRC_0
@@ -56,7 +60,7 @@ m65_screen_dmasrcdst_color:
sta M65_DMAJOB_SRC_2
sta M65_DMAJOB_DST_2
lda #$0F
jmp_8 !-
bra m65_screen_dmasrcdst_screen_cont
m65_screen_dmasrc_add_row:
@@ -65,7 +69,7 @@ m65_screen_dmasrc_add_row:
lda M65_DMAJOB_SRC_0
adc #$50
sta M65_DMAJOB_SRC_0
bcc !+
bcc @1
inc M65_DMAJOB_SRC_1
!:
@1:
rts
@@ -1,30 +1,30 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Set the INDX variable - logical row length
//
;
; Set the INDX variable - logical row length
;
m65_screen_set_indx: // leaves value in .A
m65_screen_set_indx: ; leaves value in .A
lda M65_SCRWINMODE
bmi !+
bmi @1
// Non-windowed mode
; Non-windowed mode
phx
ldx M65_SCRMODE
lda m65_scrtab_txtwidth,x
dec_a
dec
sta INDX
plx
rts
!:
// Windowed mode
@1:
; Windowed mode
sec
lda M65_TXTWIN_X1
sbc M65_TXTWIN_X0
dec_a
dec
sta INDX
rts
@@ -1,10 +1,10 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
m65_cursor_blink_irqpnt_to_screen:
// Adapt pointer to point to screen memory
; Adapt pointer to point to screen memory
lda M65_SCRSEG+1
sta M65_LPNT_IRQ+3
@@ -1,10 +1,10 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
m65_helper_scrlpnt_color:
// Setting M65_LPNT_SCR to point to colour memory (starts from $FF80000)
; Setting M65_LPNT_SCR to point to colour memory (starts from $FF80000)
lda #$0F
sta M65_LPNT_SCR+3
@@ -16,7 +16,7 @@ m65_helper_scrlpnt_color:
lda M65_COLVIEW+0
sta M65_LPNT_SCR+0
// Add screen row to the address
; Add screen row to the address
clc
lda M65_TXTROW_OFF+0
@@ -32,7 +32,7 @@ m65_helper_scrlpnt_color:
m65_helper_scrlpnt_to_screen:
// Change M65_LPNT_SCR to point to screen memory (when it points to color memory)
; Change M65_LPNT_SCR to point to screen memory (when it points to color memory)
clc
lda M65_SCRBASE+0
@@ -42,7 +42,7 @@ m65_helper_scrlpnt_to_screen:
adc M65_LPNT_SCR+1
sta M65_LPNT_SCR+1
// FALLTROUGH
; FALLTROUGH
m65_helper_scrlpnt_to_screen_hi:
@@ -57,11 +57,11 @@ m65_helper_scrlpnt_to_screen_hi:
m65_helper_scrlpnt_chrin:
// Prepare the pointer for CHRIN
; Prepare the pointer for CHRIN
lda M65__SCRINPUT+0
sta M65_LPNT_SCR+0
lda M65__SCRINPUT+1
sta M65_LPNT_SCR+1
jmp_8 m65_helper_scrlpnt_to_screen_hi
bra m65_helper_scrlpnt_to_screen_hi
+13 -14
View File
@@ -1,23 +1,22 @@
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
//
// CHROUT routine - screen support, control codes in quote mode, MEGA65 native mode version
//
;
; CHROUT routine - screen support, control codes in quote mode, MEGA65 native mode version
;
m65_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 m65_chrout_screen_literal
@@ -1,9 +1,9 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
m65_scrtab_txtheight: // height of the text screen
m65_scrtab_txtheight: ; height of the text screen
.byte 25
.byte 25
.byte 50
!byte 25
!byte 25
!byte 50
@@ -1,9 +1,9 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
m65_scrtab_txtwidth: // width of the text screen (logical width is always set to 80)
m65_scrtab_txtwidth: ; width of the text screen (logical width is always set to 80)
.byte 40
.byte 80
.byte 80
!byte 40
!byte 80
!byte 80
@@ -1,114 +1,110 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
m65_scrtab_vic_ctrlb: // parameters for VIC control register B
m65_scrtab_vic_ctrlb: ; parameters for VIC control register B
.byte %00100000 // 40x25 + extended attributes
.byte %10100000 // 80x25 + extended attributes
.byte %10101000 // 80x50 + extended attributes
!byte %00100000 ; 40x25 + extended attributes
!byte %10100000 ; 80x25 + extended attributes
!byte %10101000 ; 80x50 + extended attributes
m65_scrtab_colviewmax_lo: // maximum allowed color viewport start - low byte
m65_scrtab_colviewmax_lo: ; maximum allowed color viewport start - low byte
.byte <((MEMCONF_SCRROWS - 25) * 80)
.byte <((MEMCONF_SCRROWS - 25) * 80)
.byte <((MEMCONF_SCRROWS - 50) * 80)
!byte <((MEMCONF_SCRROWS - 25) * 80)
!byte <((MEMCONF_SCRROWS - 25) * 80)
!byte <((MEMCONF_SCRROWS - 50) * 80)
m65_scrtab_colviewmax_hi: // maximum allowed color viewport start - high byte
m65_scrtab_colviewmax_hi: ; maximum allowed color viewport start - high byte
.byte >((MEMCONF_SCRROWS - 25) * 80)
.byte >((MEMCONF_SCRROWS - 25) * 80)
.byte >((MEMCONF_SCRROWS - 50) * 80)
!byte >((MEMCONF_SCRROWS - 25) * 80)
!byte >((MEMCONF_SCRROWS - 25) * 80)
!byte >((MEMCONF_SCRROWS - 50) * 80)
m65_scrtab_scrolx: // values for VIC_SCROLX
m65_scrtab_scrolx: ; values for VIC_SCROLX
.byte $C8
.byte $CA
.byte $CA
!byte $C8
!byte $CA
!byte $CA
m65_scrtab_rowoffset_lo: // row offsets - low bytes
m65_scrtab_rowoffset_lo: ; row offsets - low bytes
.byte <(80 * 0), <(80 * 1), <(80 * 2), <(80 * 3), <(80 * 4), <(80 * 5), <(80 * 6), <(80 * 7), <(80 * 8), <(80 * 9)
.byte <(80 * 10), <(80 * 11), <(80 * 12), <(80 * 13), <(80 * 14), <(80 * 15), <(80 * 16), <(80 * 17), <(80 * 18), <(80 * 19)
.byte <(80 * 20), <(80 * 21), <(80 * 22), <(80 * 23), <(80 * 24), <(80 * 25), <(80 * 26), <(80 * 27), <(80 * 28), <(80 * 29)
.byte <(80 * 30), <(80 * 31), <(80 * 32), <(80 * 33), <(80 * 34), <(80 * 35), <(80 * 36), <(80 * 37), <(80 * 38), <(80 * 39)
.byte <(80 * 40), <(80 * 41), <(80 * 42), <(80 * 43), <(80 * 44), <(80 * 45), <(80 * 46), <(80 * 47), <(80 * 48), <(80 * 49)
!byte <(80 * 0), <(80 * 1), <(80 * 2), <(80 * 3), <(80 * 4), <(80 * 5), <(80 * 6), <(80 * 7), <(80 * 8), <(80 * 9)
!byte <(80 * 10), <(80 * 11), <(80 * 12), <(80 * 13), <(80 * 14), <(80 * 15), <(80 * 16), <(80 * 17), <(80 * 18), <(80 * 19)
!byte <(80 * 20), <(80 * 21), <(80 * 22), <(80 * 23), <(80 * 24), <(80 * 25), <(80 * 26), <(80 * 27), <(80 * 28), <(80 * 29)
!byte <(80 * 30), <(80 * 31), <(80 * 32), <(80 * 33), <(80 * 34), <(80 * 35), <(80 * 36), <(80 * 37), <(80 * 38), <(80 * 39)
!byte <(80 * 40), <(80 * 41), <(80 * 42), <(80 * 43), <(80 * 44), <(80 * 45), <(80 * 46), <(80 * 47), <(80 * 48), <(80 * 49)
m65_scrtab_rowoffset_hi: // row offsets - high bytes
m65_scrtab_rowoffset_hi: ; row offsets - high bytes
.byte >(80 * 0), >(80 * 1), >(80 * 2), >(80 * 3), >(80 * 4), >(80 * 5), >(80 * 6), >(80 * 7), >(80 * 8), >(80 * 9)
.byte >(80 * 10), >(80 * 11), >(80 * 12), >(80 * 13), >(80 * 14), >(80 * 15), >(80 * 16), >(80 * 17), >(80 * 18), >(80 * 19)
.byte >(80 * 20), >(80 * 21), >(80 * 22), >(80 * 23), >(80 * 24), >(80 * 25), >(80 * 26), >(80 * 27), >(80 * 28), >(80 * 29)
.byte >(80 * 30), >(80 * 31), >(80 * 32), >(80 * 33), >(80 * 34), >(80 * 35), >(80 * 36), >(80 * 37), >(80 * 38), >(80 * 39)
.byte >(80 * 40), >(80 * 41), >(80 * 42), >(80 * 43), >(80 * 44), >(80 * 45), >(80 * 46), >(80 * 47), >(80 * 48), >(80 * 49)
!byte >(80 * 0), >(80 * 1), >(80 * 2), >(80 * 3), >(80 * 4), >(80 * 5), >(80 * 6), >(80 * 7), >(80 * 8), >(80 * 9)
!byte >(80 * 10), >(80 * 11), >(80 * 12), >(80 * 13), >(80 * 14), >(80 * 15), >(80 * 16), >(80 * 17), >(80 * 18), >(80 * 19)
!byte >(80 * 20), >(80 * 21), >(80 * 22), >(80 * 23), >(80 * 24), >(80 * 25), >(80 * 26), >(80 * 27), >(80 * 28), >(80 * 29)
!byte >(80 * 30), >(80 * 31), >(80 * 32), >(80 * 33), >(80 * 34), >(80 * 35), >(80 * 36), >(80 * 37), >(80 * 38), >(80 * 39)
!byte >(80 * 40), >(80 * 41), >(80 * 42), >(80 * 43), >(80 * 44), >(80 * 45), >(80 * 46), >(80 * 47), >(80 * 48), >(80 * 49)
// 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.
m65_chrout_screen_jumptable_codes:
.byte KEY_CLR
.byte KEY_HOME
.byte KEY_C65_SHIFT_OFF
.byte KEY_C65_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_TAB
.byte KEY_LINE_FEED
.byte KEY_UNDERLINE_ON
.byte KEY_UNDERLINE_OFF
.byte KEY_FLASHING_ON
.byte KEY_FLASHING_OFF
.byte KEY_TAB_SET_CLR
.byte KEY_ESC
.byte KEY_BELL
!byte KEY_CLR
!byte KEY_HOME
!byte KEY_C65_SHIFT_OFF
!byte KEY_C65_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_TAB
!byte KEY_LINE_FEED
!byte KEY_UNDERLINE_ON
!byte KEY_UNDERLINE_OFF
!byte KEY_FLASHING_ON
!byte KEY_FLASHING_OFF
!byte KEY_TAB_SET_CLR
!byte KEY_ESC
!byte KEY_BELL
__m65_chrout_screen_jumptable_quote_guard:
.byte KEY_INS
.byte KEY_STOP
.byte KEY_DEL
.byte KEY_RETURN
!byte KEY_INS
!byte KEY_STOP
!byte KEY_DEL
!byte KEY_RETURN
__m65_chrout_screen_jumptable_codes_end:
.const m65_chrout_list = List().add(
m65_chrout_screen_CLR,
m65_chrout_screen_HOME,
m65_chrout_screen_SHIFT_OFF,
m65_chrout_screen_SHIFT_ON,
m65_chrout_screen_TXT,
m65_chrout_screen_GFX,
m65_chrout_screen_RVS_OFF,
m65_chrout_screen_RVS_ON,
m65_chrout_screen_CRSR_RIGHT,
m65_chrout_screen_CRSR_LEFT,
m65_chrout_screen_CRSR_DOWN,
m65_chrout_screen_CRSR_UP,
m65_chrout_screen_TAB,
m65_chrout_screen_LINE_FEED,
m65_chrout_screen_UNDERLINE_ON,
m65_chrout_screen_UNDERLINE_OFF,
m65_chrout_screen_FLASHING_ON,
m65_chrout_screen_FLASHING_OFF,
m65_chrout_screen_TAB_SET_CLR,
m65_chrout_screen_ESC,
m65_chrout_screen_BELL,
m65_chrout_screen_INS,
m65_chrout_screen_STOP,
m65_chrout_screen_DEL,
m65_chrout_screen_RETURN
)
m65_chrout_screen_jumptable:
// Note: 65C02 has the page boundary vector bug fixed!
put_jumptable(m65_chrout_list)
; Note: 65C02 has the page boundary vector bug fixed!
!word m65_chrout_screen_CLR
!word m65_chrout_screen_HOME
!word m65_chrout_screen_SHIFT_OFF
!word m65_chrout_screen_SHIFT_ON
!word m65_chrout_screen_TXT
!word m65_chrout_screen_GFX
!word m65_chrout_screen_RVS_OFF
!word m65_chrout_screen_RVS_ON
!word m65_chrout_screen_CRSR_RIGHT
!word m65_chrout_screen_CRSR_LEFT
!word m65_chrout_screen_CRSR_DOWN
!word m65_chrout_screen_CRSR_UP
!word m65_chrout_screen_TAB
!word m65_chrout_screen_LINE_FEED
!word m65_chrout_screen_UNDERLINE_ON
!word m65_chrout_screen_UNDERLINE_OFF
!word m65_chrout_screen_FLASHING_ON
!word m65_chrout_screen_FLASHING_OFF
!word m65_chrout_screen_TAB_SET_CLR
!word m65_chrout_screen_ESC
!word m65_chrout_screen_BELL
!word m65_chrout_screen_INS
!word m65_chrout_screen_STOP
!word m65_chrout_screen_DEL
!word m65_chrout_screen_RETURN
+6 -6
View File
@@ -1,10 +1,10 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Output:
// .A - current screen mode
//
;
; Output:
; .A - current screen mode
;
M65_SCRMODEGET:
+34 -34
View File
@@ -1,48 +1,48 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
//
// Input:
// - .A - desired screen mode
//
// Output:
// - Carry set = unsupported screen mode
// - Carry clear = screen mode switched correctly
//
;
; Input:
; - .A - desired screen mode
;
; Output:
; - Carry set = unsupported screen mode
; - Carry clear = screen mode switched correctly
;
M65_SCRMODESET:
cmp #$03
bcs m65_scrmodeset_rts // branch if unsupported screen mode
bcs m65_scrmodeset_rts ; branch if unsupported screen mode
// Preserve .X, move desired mode to .X, disable interrupts
; Preserve .X, move desired mode to .X, disable interrupts
phx
sei
// Perform the switch
; Perform the switch
jsr m65_scrmodeset_internal
// Re-enable interrupts, restore .X
; Re-enable interrupts, restore .X
cli
plx
// FALLTROUGH
; FALLTROUGH
m65_scrmodeset_rts:
rts
m65_scrmodeset_internal: // entry point for M65_MODE65
m65_scrmodeset_internal: ; entry point for M65_MODE65
// Store desired screen mode
; Store desired screen mode
sta M65_SCRMODE
// Set flags/variables for 40/80 columns and 25/50 rows
; Set flags/variables for 40/80 columns and 25/50 rows
tax
@@ -55,28 +55,28 @@ m65_scrmodeset_internal: // entry point for M65_MODE65
jsr viciv_hotregs_off
// Set the logical row length to 80
; Set the logical row length to 80
ldx #$50
stx VIC_CHARSTEP+0
ldx #$00
stx VIC_CHARSTEP+1
// Set the following locations:
// - M65_SCRWINMODE - for scroll-console mode
// - M65_SCRSEG, VIC_SCRNPTR+2/+3 - for screen in $0001xxxx area
; Set the following locations:
; - M65_SCRWINMODE - for scroll-console mode
; - M65_SCRSEG, VIC_SCRNPTR+2/+3 - for screen in $0001xxxx area
stx M65_SCRWINMODE // .X = 0
stx M65_SCRWINMODE ; .X = 0
stx M65_SCRSEG+1
stx VIC_SCRNPTR+3
inx
stx M65_SCRSEG+0
stx VIC_SCRNPTR+2
// Set the following locations:
// - M65_SCRBASE - for screen starting from $xxxx9000
// - VIC_SCRNPTR+0/+1 - for screen viewport start
// - M65_COLVIEW, VIC_COLPTR - for using color memory from the start
; Set the following locations:
; - M65_SCRBASE - for screen starting from $xxxx9000
; - VIC_SCRNPTR+0/+1 - for screen viewport start
; - M65_COLVIEW, VIC_COLPTR - for using color memory from the start
ldx #>MEMCONF_SCRBASE
stx M65_SCRBASE+1
@@ -91,8 +91,8 @@ m65_scrmodeset_internal: // entry point for M65_MODE65
stx VIC_COLPTR+0
stx VIC_COLPTR+1
// Set the following location:
// - VIC_CHARPTR - for character generator location
; Set the following location:
; - VIC_CHARPTR - for character generator location
lda #<MEMCONF_CHRBASE
sta VIC_CHARPTR+0
@@ -101,10 +101,10 @@ m65_scrmodeset_internal: // entry point for M65_MODE65
lda #$01
sta VIC_CHARPTR+2
// Set the following locations:
// - M65_SCRGUARD, M65_COLGUARD - guards for virtual screen end
// - M65_COLVIEWMAX - guard for viewport start
// - M65_SCRCOLMAX - maximum allowed column
; Set the following locations:
; - M65_SCRGUARD, M65_COLGUARD - guards for virtual screen end
; - M65_COLVIEWMAX - guard for viewport start
; - M65_SCRCOLMAX - maximum allowed column
ldx #<(MEMCONF_SCRBASE + 80 * MEMCONF_SCRROWS)
stx M65_SCRGUARD+0
@@ -122,7 +122,7 @@ m65_scrmodeset_internal: // entry point for M65_MODE65
lda m65_scrtab_colviewmax_hi, x
sta M65_COLVIEWMAX+1
lda m65_scrtab_txtwidth,x
dec_a
dec
sta M65_SCRCOLMAX
rts
+3 -3
View File
@@ -1,5 +1,5 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
;; #LAYOUT# M65 KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
M65_SETWIN_XY:
@@ -50,7 +50,7 @@ M65_SETWIN_Y:
jsr m65_screen_set_indx
// XXX consider calling HOME instead
; XXX consider calling HOME instead
lda M65_TXTWIN_X0
sta M65__TXTCOL