OT: Altair emulator code & C pointers

From: Cini, Richard <RCini_at_congressfinancial.com>
Date: Mon Jun 12 09:55:43 2000

Hi:

        I'm not particularly good at C, so I'm trying to learn more as I add
tape image support to Claus Guiloi's Altair Emulator.

        Anyway, I have a "C pointers" question regarding copying the tape
bits to the emulator memory. Here's some pseudo code...

//delcared in i8080.c MEMSIZE is virtual memory size in bytes
uchar Mem [MEMSIZE];

BOOL ReadTape (PSTR pstrFileName)
PSTR pstrBuffer ; //buffer for fread command

// make sure the file exists
//allocate memory to fit tape image length and load file
//determine file type (BIN or HEX)

//if BIN, make sure that the image fits into the emulator memory size
if (iLength > MEMSIZE){
        OkMessage (hWnd, "Program too big to fit in memory!", szTitleName) ;
        return FALSE;
}

// for binary, so get load address from user and copy to memory array
addr=MsgBox("Enter load address"); //obviously wrong. but it's only pseudo
code

// make sure that (load address + file size) <=65535

// copy binary image to the emulator memory
for (i = 0; i <= iLength; i++)
        Mem[i+addr] = (uchar) *pstrBuffer+i;
        return 0;

 This is the important code. The Altair's memory is represented by an array
of type uchar and pstrBuffer is the file buffer used int he fread command.
My question is whether I'm doing the assignment right?

        Thanks again for the help.

Rich
Received on Mon Jun 12 2000 - 09:55:43 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:33:01 BST