[Coco] Help with BASIC

Darren A mechacoco at gmail.com
Thu Nov 20 11:12:59 EST 2014


On Thu, Nov 20, 2014 at 5:40 AM, Brett Gordon wrote:

> Has anybody created a utility to flash their SDC ROM banks from a
> BASIC disk file yet?  -or-  How would one accomplish loading a flat
> file into memory from BASIC?
>
> 1. Change the flat ROM into a BIN, and use CLOAD
>       a. is it possible to squeeze 16k of binary data into a BASIC
> enviroment?
>       b. yuck - this would require people to change their ROM's to BIN's
> 2. I didn't see any BASIC statements designed to load binary data - is
> there one?
> 3. Rip data from the the lowlevel disk buffers (unlawfully touching BASIC )
>


If you want to load a raw file (no preamble) into memory you can OPEN it as
a data file and use a small ML routine to read the bytes:

10 CLEAR 100,&H3FFF
20 OPEN "I",#1,"FILE.ROM"
30 EXEC code
40 CLOSE #1

RawLd     ldx   #$4000     RAM storage address
          lda   #1         select file #1
          sta   $6F
ldByte    jsr   $A176      read 1 byte from file
          ldb   $70        test EOF flag
          bne   ldDone     branch if EOF
          sta   ,x+        store byte in RAM
          bra   ldByte     loop
ldDone    clr   $6F        restore console I/O
          rts

Darren


More information about the Coco mailing list