Copying Macintosh BASIC Screen to Hercules Screen on IBM PC (33813)



The information in this article applies to:

  • Microsoft QuickBASIC 1.0
  • Microsoft BASIC Compiler
  • Microsoft BASIC Interpreter for Apple Macintosh 2.0
  • Microsoft BASIC Interpreter for Apple Macintosh 2.1
  • Microsoft BASIC Interpreter for Apple Macintosh 3.0

This article was previously published under Q33813

SUMMARY

The following information provides an example of copying the screen memory from an Macintosh Plus computer (through a serial communications line) to an IBM PC with a Hercules Graphics Adapter installed.

On the Macintosh side, this information applies to Microsoft QuickBASIC Version 1.00, Microsoft BASIC Compiler Version 1.00, and Microsoft BASIC Interpreter Versions 2.00, 2.10, and 3.00 for the Apple Macintosh.

On the IBM PC side, this information applies to Microsoft QuickBASIC Compiler Versions 4.00, 4.00b, and 4.50 for MS-DOS, Microsoft BASIC Compiler Versions 6.00 and 6.00b for MS-DOS, and Microsoft BASIC Professional Development System (PDS) Version 7.00 for MS-DOS.

MORE INFORMATION

The following information is valid only for a Macintosh Plus, and may not work on other Apple Macintosh computers. The addresses supplied are based upon customer experimentation and Microsoft does not provide support for the following code. You may modify the program as you wish.

Although both a Macintosh and a Hercules-compatible video display card use the same approach to storing an image (one pixel per bit starting with the upper-left corner of screen), there is a fundamental difference in layout of this memory.

Macintosh screen memory is contiguous, whereas Hercules memory consists of four interlaced blocks of memory. The Macintosh uses 64 decimal bytes per line; a Hercules-compatible monochrome adapter uses 90 decimal bytes (5A Hex) per line.

The following are the starting addresses for the first eight screen lines on the Macintosh Plus and on the Hercules Graphics Adapter:
   Line        Mac Plus     Hercules
   ----        --------     --------

   0           FA700        B000:0000
   1           FA740        B000:2000
   2           FA780        B000:4000
   3           FA7C0        B000:6000
   4           FA800        B000:005A
   5           FA840        B000:205A
   6           FA880        B000:405A
   7           FA8C0        B000:605A
				
The following programs copy screen memory from an Apple Macintosh to a Hercules-equipped IBM PC through a null-modem serial port connection:
   'This program runs on the Macintosh in compiled or interpreted BASIC:
   CLS
   OPEN "COM1:9600,n,8" FOR OUTPUT AS #1
   FOR row=0 to 341
     PRINT #1, row
     FOR col=0 to 63
        PRINT #1, PEEK(64*row+col+1025792)
     NEXT col
   NEXT row

   'This program, run in Microsoft QuickBASIC on the IBM PC,
   'is started first:
   DEFINT A-Z
   OPEN "com1:9600,n,8,,cs0,ds0,cd0,bin,rb4048" FOR INPUT AS #1
   ON COM(1) GOSUB ReadALine
   COM(1) ON
   SCREEN 3
   CLS
   DEF SEG = &HB000
   WHILE INKEY$ = "": WEND
   END
   ReadALine:
        INPUT #1, MacRow
        PCRow = &H2000 * (MacRow MOD 4) + &H5A * (MacRow \ 4)
        FOR Column = 0 TO 63
                 INPUT #1, RowPixelCode
                 POKE PCRow + Column, RowPixelCode
        NEXT Column
        RETURN

				

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB33813