IECHost: drive code upload and execution API completed and tested

I had some time this morning to write the IECHost API for direct access to the 1541 memory, i.e. the equivalent of the “M-W” and “M-E” commands. The idea was to get something like a “hello world!” program uploaded to the drive’s memory and executed. I chose to upload some code to just flash the status LED:

*=$0300

; record header following PRG load address: code size
sz	.word endcode - start

.logical $0300

; unless the code starts here, have a jump to the entry point from here
start

flash	lda $1c00
	eor #$08	; blink LED
	sta $1c00

; delay .3 seconds
	ldx #$ff
x	ldy #$ff
y	dey
	bne y
	dex
	bne x

	jmp flash
endcode

.here

The way IECHost uploads and executes the above program is by means of the following code:

directaccess_memory_write(device_number, 
	pgm_read_word(drivecode_flashing_led),	/* PRG start address */
	drivecode_flashing_led + 4,				/* Code start in PRG */
	buff,
	pgm_read_word(drivecode_flashing_led + 2),	/* Code size record in PRG */
	&st);
if (st)
	return;

directaccess_memory_execute(device_number, pgm_read_word(drivecode_flashing_led), 
	&st);

It’s all working as expected of course 🙂

This entry was posted in Retrocomputing, Technical and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s