From b498d4010b9793a6a28f5aa998b1bc84a28b85fb Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 8 Jan 2020 18:36:46 +0100 Subject: [PATCH] initial LNMX calculation routine --- STATUS.md | 57 ++++++++++--------- c64/aliases/,aliases_ram_lowmem.s | 2 +- c64/kernal/screen/chrout_screen.s | 5 +- c64/kernal/screen/screen_calculate_lnmx.s | 36 ++++++++++++ ...een_fix_pntr.s => screen_calculate_pntr.s} | 8 +-- 5 files changed, 73 insertions(+), 35 deletions(-) create mode 100644 c64/kernal/screen/screen_calculate_lnmx.s rename c64/kernal/screen/{screen_fix_pntr.s => screen_calculate_pntr.s} (65%) diff --git a/STATUS.md b/STATUS.md index 8ad2dd17..15adec12 100644 --- a/STATUS.md +++ b/STATUS.md @@ -48,28 +48,29 @@ The following ROM features are currently missing: ## Keyboard -| Driver | Status | Remarks | -| :-----------: | :------: | :------------------------------------------------: | -| C64 | DONE | | -| C128 | DONE | | -| Mega65 | NOT DONE | code should be complete, but is not tested yet | +| Driver | Status | Remarks | +| :----------------: | :------: | :------------------------------------------------: | +| C64 | DONE | | +| C128 | DONE | | +| Mega65 | NOT DONE | code should be complete, but is not tested yet | ## Screen -| Driver | Status | Remarks | -| :-----------: | :------: | :------------------------------------------------: | -| VIC-II | PARTIAL | 80 chars in logical line support is very buggy | -| VDC 80 col. | NOT DONE | | +| Driver | Status | Remarks | +| :----------------: | :------: | :------------------------------------------------: | +| VIC-II | PARTIAL | rework in progress | +| 80 columns, VDC | NOT DONE | | +| 80 columns, Mega65 | NOT DONE | | ## Tape port (LOAD only!) * Tapuino * Datasette -| Driver | Status | Remarks | -| :-----------: | :------: | :------------------------------------------------: | -| normal | PARTIAL | no error correction, no tape speed calibratrion | -| turbo | PARTIAL | up to 250 blocks, no tape speed calibratrion yet | +| Driver | Status | Remarks | +| :----------------: | :------: | :------------------------------------------------: | +| normal | PARTIAL | no tape speed calibratrion, no error correction | +| turbo (250 blocks) | PARTIAL | no tape speed calibratrion | ## IEC bus @@ -78,13 +79,13 @@ The following ROM features are currently missing: * most disk drives and printers * some hard drives -| Driver | Status | Remarks | -| :-----------: | :------: | :------------------------------------------------: | -| standard | DONE | | -| JiffyDOS | DONE | | -| DolphinDOS | DONE | | -| CIA burst mod | NOT DONE | | -| Mega65 burst | NOT DONE | pure software implementation should be feasible | +| Driver | Status | Remarks | +| :----------------: | :------: | :------------------------------------------------: | +| standard | DONE | | +| JiffyDOS | DONE | | +| DolphinDOS | DONE | | +| CIA burst mod | NOT DONE | | +| Mega65 burst | NOT DONE | | ## IEEE-488 bus @@ -92,20 +93,20 @@ The following ROM features are currently missing: * PET era disk drives and printers * various scientific equipment -| Driver | Status | Remarks | -| :-----------: | :------: | :------------------------------------------------: | -| CBM cartridge | NOT DONE | | +| Driver | Status | Remarks | +| :----------------: | :------: | :------------------------------------------------: | +| CBM cartridge | NOT DONE | | ## RS-232 * modems (telephone, WiFi) * parallel port printers -| Driver | Status | Remarks | -| :-----------: | :------: | :------------------------------------------------: | -| UP2400 | NOT DONE | | -| UP9600 | NOT DONE | work started, not functional yet | -| ACIA 6551 | NOT DONE | | +| Driver | Status | Remarks | +| :----------------: | :------: | :------------------------------------------------: | +| UP2400 | NOT DONE | | +| UP9600 | NOT DONE | work started, not functional yet | +| ACIA 6551 | NOT DONE | | # API status diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index 5d5af9ba..1f0c37a7 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -155,7 +155,7 @@ .label PNT = $D1 // $D1-$D2 pointer to the current screen line .label PNTR = $D3 // current screen X position (logical column), 0-79 .label QTSW = $D4 // quote mode flag - .label LNMX = $D5 // logical line length, [!] our usage probably differs in details + .label LNMX = $D5 // logical line length, 39 or 79 .label TBLX = $D6 // current screen Y position (row), 0-24 .label SCHAR = $D7 // ASCII value of the last printed character .label INSRT = $D8 // insert mode flag/counter diff --git a/c64/kernal/screen/chrout_screen.s b/c64/kernal/screen/chrout_screen.s index 15323dd9..ae97035f 100644 --- a/c64/kernal/screen/chrout_screen.s +++ b/c64/kernal/screen/chrout_screen.s @@ -120,11 +120,12 @@ chrout_screen_literal: chrout_screen_calc_lptr_done: jsr screen_calculate_PNT_USER - jsr screen_fix_PNTR + jsr screen_calculate_PNTR + jsr screen_calculate_LNMX // FALLTROUGH -chrout_screen_done: +chrout_screen_done: // YYY review all the jumps here // YYY should we update character under cursor here? or in cursor_show_if_enabled? diff --git a/c64/kernal/screen/screen_calculate_lnmx.s b/c64/kernal/screen/screen_calculate_lnmx.s new file mode 100644 index 00000000..3f1669a7 --- /dev/null +++ b/c64/kernal/screen/screen_calculate_lnmx.s @@ -0,0 +1,36 @@ + +// +// Sets LNMX to 39 or 79 +// + + +// YYY value is improper shortly after linee growth! + + +screen_calculate_LNMX: // YYY review all the code, mayybe some optimizations are possible using this value + + ldy TBLX + lda LDTBL, y + 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 + + iny + lda LDTBL, y + bpl screen_calculate_lnmx_79 // line is continued + + // FALLTROUGH + +screen_calculate_lnmx_39: + + lda #39 + skip_2_bytes_trash_nvz + + // FALLTROUGH + +screen_calculate_lnmx_79: + + lda #79 + sta LNMX + rts diff --git a/c64/kernal/screen/screen_fix_pntr.s b/c64/kernal/screen/screen_calculate_pntr.s similarity index 65% rename from c64/kernal/screen/screen_fix_pntr.s rename to c64/kernal/screen/screen_calculate_pntr.s index 7d256caa..4fa2ea32 100644 --- a/c64/kernal/screen/screen_fix_pntr.s +++ b/c64/kernal/screen/screen_calculate_pntr.s @@ -4,18 +4,18 @@ // -screen_fix_PNTR: +screen_calculate_PNTR: ldy TBLX lda LDTBL, y php jsr screen_get_clipped_PNTR plp - bmi screen_fix_PNTR_0_39 + bmi screen_calculate_PNTR_0_39 // FALLTROUGH -screen_fix_PNTR_40_79: +screen_calculate_PNTR_40_79: tya clc @@ -24,7 +24,7 @@ screen_fix_PNTR_40_79: // FALLTROUGH -screen_fix_PNTR_0_39: +screen_calculate_PNTR_0_39: sty PNTR rts