From 4718a33d5a42571b37c67cecf53aead01ebeb35b Mon Sep 17 00:00:00 2001 From: Paul Gardner-Stephen Date: Fri, 19 Apr 2019 12:32:13 +0930 Subject: [PATCH] more work on RAMTAS routine based on Compute's Mapping the 64 --- c64/kernal/,aliases.s | 15 +++++++++++++-- c64/kernal/ramtas.s | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/c64/kernal/,aliases.s b/c64/kernal/,aliases.s index ad4dc31d..c9ca6929 100644 --- a/c64/kernal/,aliases.s +++ b/c64/kernal/,aliases.s @@ -4,7 +4,6 @@ ; (https://www.c64-wiki.com/wiki/Zeropage) .alias TXTTAB $2B - .alias MEMSIZ $37 .alias IOSTATUS $90 ; Keys down clears bits. STOP=bit 7, C= bit 6, SPACE bit 4, CTRL bit 2 .alias BUCKYSTATUS $91 @@ -48,4 +47,16 @@ .alias rs232_rx_buffer_ptr $F7 .alias rs232_tx_buffer_ptr $F9 - + + ; "Compute's Mapping the 64" book + .alias MEMSTR $0281 + .alias MEMSIZ $0283 ; NOTE: Mapping the 64 erroniously has the hex as $282, while the DEC is correct + .alias text_colour $0286 ; p55 + .alias colour_under_cursor $0287 ; p56 + .alias HIBASE $0288 ; p56 (high byte of start of screen) + .alias key_buffer_size $0289 ; p57 + + ;; 0 = cursor keys, insert, delete and space repeat, but nothing else + ;; 128 = all keys repeat + ;; 64 = no keys repeat + .alias key_repeat_flags $028A ; p58 diff --git a/c64/kernal/ramtas.s b/c64/kernal/ramtas.s index 02204ba8..452907a8 100644 --- a/c64/kernal/ramtas.s +++ b/c64/kernal/ramtas.s @@ -1,7 +1,6 @@ ; Function defined on pp272-273 of C64 Programmers Reference Guide ramtas: ; C64 Programmer's Reference guide p291: - ; Clear $0000-$0101, $0200-$03ff ; PGS: $0000, $0001 are CPU IO ports, so shouldn't get written to LDY #$02 @@ -17,6 +16,11 @@ ramtas_l2: BNE ramtas_l2 ; allocate cassette buffer + ;; "Mapping the C128", p61 + lda #<$033C + STA cassette_buffer_ptr+0 + lda #>$033C + STA cassette_buffer_ptr+1 ; set screen address to $0400 ; https://www.c64-wiki.com/wiki/Screen_RAM @@ -34,5 +38,33 @@ ramtas_l2: LDA $DD00 ORA #$03 STA $DD00 + + ;; Set screen address pointer ("Compute's Mapping the 64" p238) + LDA #>$0400 + STA HIBASE + + ;; Work out RAM size and put in MEMSTR and MEMSIZ + ;; "Compute's Mapping the 64", p54 + lda #$00 + sta MEMSTR+0 + sta MEMSIZ+0 + ;; Try to modify $8000, if it fails then RAM ends at $7FFF, else $9FFF + lda $8000 + eor #$FF + tax + eor #$FF + stx $8000 + cmp $8000 + bne ramtas_32K_RAM + sta $8000 + lda #$A0 + sta MEMSIZ+1 + jmp ramtas_RAM_sized +ramtas_32K_RAM: + sta $8000 ; in case RAM is hiding beneath a ROM + lda #$80 + sta MEMSIZ+1 + ;; Fall through +ramtas_RAM_sized: rts