From fa79fc28dccc73316bd90da2bb87b4f2208a5fc2 Mon Sep 17 00:00:00 2001 From: frntc <48584231+frntc@users.noreply.github.com> Date: Fri, 26 Aug 2022 23:32:08 +0200 Subject: [PATCH] fixed loading of Basic programs --- Source/Firmware/C16Side/cart264b.a | 53 ++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/Source/Firmware/C16Side/cart264b.a b/Source/Firmware/C16Side/cart264b.a index 3e04b100..5d34fb99 100644 --- a/Source/Firmware/C16Side/cart264b.a +++ b/Source/Firmware/C16Side/cart264b.a @@ -7,10 +7,10 @@ ; ; cart264.a ; -; RasPiC64 - A framework for interfacing the C64 (and C16/+4) and a Raspberry Pi 3B/3B+ -; - code of a cart to download and launch a .PRG from the RPi -; - significant parts taken from http://www.cbmhardware.de/show.php?r=4&id=29 by CBMHARDWARE -; Copyright (c) 2020 Carsten Dachsbacher +; Sidekick64 - A framework for interfacing the C64 and a Raspberry Pi Zero 2 or 3A+/3B+ +; - code of a cart to download and launch a .PRG from the RPi +; - significant parts taken from http://www.cbmhardware.de/show.php?r=4&id=29 by CBMHARDWARE +; Copyright (c) 2020-22 Carsten Dachsbacher ; ; Logo created with http://patorjk.com/software/taag/ ; @@ -30,7 +30,8 @@ t_lo = $fe t_hi = $ff temp = $332 -trampoline = $333 +nofpages = $333 +trampoline = $334 *=$8000 @@ -94,9 +95,6 @@ cpy2 lda $8100,x dex bpl cpy2 - jmp trampoline - -*=$8100 ; trampoline code sei lda #$00 sta $02FE @@ -105,17 +103,14 @@ cpy2 lda $8100,x sta $0314 lda #$f2 sta $0315 - lda #$00 ; basic , kernal - sta $FDD0 ; function rom off - sta $fb - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ; "download" .PRG + ; "download" .PRG (some preparations here) lda #03 sta $fde5 ; number of 256-byte pages to copy ldx $fde5 + stx nofpages ; get loading address lda $fde5 @@ -123,6 +118,16 @@ cpy2 lda $8100,x lda $fde5 sta t_hi + jmp trampoline + +*=$8100 ; trampoline code + lda #$00 ; basic , kernal + sta $FDD0 ; function rom off + sta $fb + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ; "download" .PRG + LOOPs0 ldy #$00 LOOPs1 @@ -138,6 +143,11 @@ cpy2 lda $8100,x bne LOOPs0 ;; disable Sidekick64-transfer + lda $fde5 + sta trampoline ; high byte + lda $fde5 + sta trampoline+1 ; low byte + lda #123 sta $fde5 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -167,9 +177,26 @@ cpy2 lda $8100,x lda #8 ; last used device = 8 sta $ba + ldx #$01 ; pointer to start addr of BASIC + stx $2b + + lda trampoline+1 + sta $2d ; ... and set BASIC program end and begin/end of BASIC variable addr + sta $2f + sta $31 + + lda #$10 + sta $2c + + lda trampoline + sta $2e + sta $30 + sta $32 + lda temp sta $ff13 + jsr $8bea ; start rts