Memory map

All the hardware is RAM-Mapped. Address with an * mean a word is used, not a single byte.

0x0000..0x1FFFScreen RAM
0x0000..0x1F3FScreenLinear pixel or color data
0x1F40..0x1FFFUnusedby the screen in both pages. Some programs use it as a temporary buffer.
0x2000..0x20FFMonitor RAM page
0x2000..0x2018TERMINLogical lines ends for textmode

bit0: keyboard already read

bit1: enable keyboard repeat

bit2: cursor visibility

bit3: inhibit Beep on keypress

bit4: DRAWH dont alter COLOR RAM

bit5: unused

bit6: scroll char without color

bit7: caps lock

0x201A*TABPTPointer to current line terminator (includes cursor X ?)
0x201BRANGCursor X
0x201CCOLNCursor Y
0x201DTOPTABWindow top
0x201ETOPRANWindow left
0x201FBOTTABWindow bottom
0x2020BOTRANWindow right
0x2021*SCRPTscreen pointer
0x2023*STADRwindow start address
0x2025*ENDDRWindow end address +1
0x2027BLOCZalways 0 for inits (?)
0x2029FORMESpecify color for pixel drawing, from -16 to 15. If negative, the drawing will put pixel at 0 (back) and set the backcolor of the block, else, pixel at 1 and set forecolor

Attribute Range. Define attributes and where they are applied

bit0: double height

bit1: double width

bit6: fullscreen fore

bit7: fullscreen back

0x202BCOLOURSame format as screenram, used for PUTCH.
0x202CPAGFLG1 enters page mode and disable scrolling
0x202DSCROLS255 for slow scroll, 0 for normal
0x202ECURSFL255: do not link next line to current one for cursor move
0x202FCOPCHR255: moving left or right copy current char
0x2030EFCMPTcounter for cursor blink
0x2031ITCMPTinterrupt counter
0x2032*PLOTXlast drawn point, set by all drawing routines (used as param for DRAWH)
0x2036CHDRAWchar for CHPLH and DRAWH (0 switches to graphic)
0x2037KEY id of pressed key set by GETCH
0x2038CMPTKBkeyboard repeat delay counter
0x2039reserved (?)
0x203ATEMPOfor playing music, note length multiplier
0x203Breserved (?)
0x203CDUREElength of note, for playing music
0x203DWAVEfor playing music (0..5)
0x203E*OCTAVEfor playing music (16, 8, 4, 2, 1, lower to higher)
0x2040K7DATAbyte being read/written from tape
0x2041K7LENGcounter of byte to write to tape
0x2042PROPCprinter operation (command)
0x2043PRSTAprinter status: 4 = port open, 8 = not ready, 10 = closed
0x2044*TEMPmisc. temp. reg.
0x2046*SAVESTStack pointer backup

command for DKCONT (floppy operation) Possible values :

1: init controller. carry=0 if ok

2: Read sector

4: Switch to single density

8: Write sector

10: Switch to double density

20: Seek track 0

40: Seek track DKTRK

80: Check write

0x2049DKDRVactive drive (0, 1 for drive A and 2, 3 for drive B)
0x204A*DKTRKactive track (0..39 on 5.25" drives, 0..79 on 3.5"). 16 bit reg because of QDD use.
0x204CDKSECsector number
0x204DDKNUM(?)sector interleave

error code (and controller type)

1 : write protected

2 : track error

4 : sector error

8 : data error

10 : drive not ready, motor off, no drive

20 : error checking (memory and re-reading the drive are different)

40 : controller not ready

43 : Single Density controller

44 : Double density controller

80 : disk not formatted

0x204F*DKBUFpointer to disk buffer (128 or 256 bytes)
0x2051-0x2058DKTRACKdocumented as disk drives head positions, but actually used as temporary storage for various stuff by floppy controller ROM.
0x2059SEQUCEindicates current screen handling state (for accented chars?)
0x205AUS1for "unit metaphor" sequences (?)
0x205BACCENTfor accent sequences
0x205CSS2GETfor reading accented lowercase char
0x205DSS3GETfor reading accented lowercase char
0x205E*SWIPTSoftware interrupt pointer
0x2560reserved (?)
0x2061*TIMEPTcalled on IRQ
0x2063SEMIRQ!=0 to reroute irq handler
0x2064*IRQPTcalled on IRQ
0x2066reserved (?)
0x2067*FIRQPTfast interrupt
0x206A*SIMULmonitor entry points table
0x206D*CHRPTRkeyboard decoder table pointer (getch)
0x2070*USERAFpointer to char table for 128..255
0x2073*GENPTRpointer to char table (pixels for char 32..127), each char stored bottom to top (!)
0x2076LATCLVkeyboard repeat delay
0x2077GRCODEcode for printer to enable graphic mode
0x2078DECALGAdjust lightpen
0x207FDEFDSTsimple or double density
0x2080DKFLGFF if there is a disk controller
0x2082..0x2085Serial port control registers (not in ROM)
This area is used only by the serial port software which is not ROM-resident, but loaded from tape.
0x2081..0x20CCsystem stack
0x20CD..0x20E4LPBUFFbuffer for lightpen reading
0x20FE..20FFFSTRSTcold or warm reset
0x2100..0x21FFBASIC RAM Page
0x2113*Basic start address
0x2115*Basic end address
0x2117*Basic variables end
0x2119*Basic tables end
0x2199*Loading type (run, merge, load, loadm, auto.bat, ...)
0x219BLoading type (basic or binary)
0x219C*LOADM address
0x2200..0x9FFFUser RAM(free for your program)
0x23FA..0x2404FILENAMENamelength, name, extension for writing files.
0xA000..0xA7BFFloppy ROM
0xA000ROM IDIdentifies the hardware : M = Thomson controller, D = Western Digital controller, Q = QDD, R = Nanoréseau
0xA001FATSZSize of FAT : K for 80B, T for 160B
0xA002SECSZDensity : D for DD, C for SD
0xA003CHKSMChecksum : sum of the 3 previous bytes + 0x55. Allows to detect if there is a ROM plugged in.
Floppy functionsvalid for all FDC ROMs, because the SWI table in monitor ROM is hardcoded to these values.
0xA004DKCONTSee SWI 26
0xA007DKBOOTSee SWI 28
0xA010RECFISee SWI 38
0xA016ECRSESee SWI 30
0xA022FINTRSee SWI 32
0xA025QDDCONTSame as DKCONT, but using QDD LBA sectors numbers
0xA025QDDSYSSystem functions using QDD LBA sectors
0xA7C0..0xA7C3System PIA
0xA7C0 PIA Port A

bit0: /FORME: screen ram mapping (pixel or palette data) for 0x0000..0x1FFF

bit1: RT: red value for border

bit2: VT: green value for border

bit3: BT: blue value for border

bit4: PT: 'pastel' value for border

bit5: Lightpen interrupt (input)

bit6: Cassette OUT

bit7: Cassette input. when idle, the tape drive sets this to a logic 1, and the code checks for it.

0xA7C1 PIA Port B

bit0: Buzzer

bits1..3: Keyboard column

bits4..6: Keyboard line

bit7: selected key status (in)

0xA7C2 PIA Control A
0xA7C3 PIA Control B
0xA7C6*MEA8000 techni musique ghost decoding. do not use
0xA7CBMemory extension control (not compatible with gen 1 MO5)
0xA7CBpage switch and write protect
0xA7CC..0xA7CFSound and Game PIA(not on base machine)
0xA7CE*Techni Musique MEA8000 Speech Synth extension (mirror port, do not use)
0xA7CEcommand and status port
0xA7CFdata port
0xA7D0..0XA7D7FDC(not on base macine)
0xA7D0Command/status register
0xA7D0Track register
0xA7D0Sector register
0xA7D0Data register
0xA7D8Expansion ROM control(FDC, Nanoréseau, Lego-DACTA, ...)
0xA7D8Switch ROMbanks by reading.b0..b4 : Nanoréseau computer address
0xA7E0..0xA7E3RS232 PIA(not on base machine)
0xA7E4..0xA7E7Gate Array
0xA7E4*SCRCLKLightpen position. This register is set when the lightpen detects the screen beam. It holds the value of the internal gate array counter at the time this hapenned. This allows to compute the lightpen position.
0xA7E6Line counter
  • bit 7: TL3, mirror bit of the counter above.
  • bit 6: INILN: 0 when the GA is drawing vertical borders on the left and right of the screen.
0xA7E7INITNbit 7: 0 when the GA is drawing horizontal borders above and below the screen. When both INITN and INILN are set, the GA is drawing pixels.
0xA7E8..0xA7EBSerial port expansion
0xA7E8Data read/write
0xA7E9Status register
  • bit 0 : parity error (self clearing)
  • bit 1 : framing error (self clearing)
  • bit 2 : overrun (self clearing)
  • bit 3 : receive data register full (clear by reading data reg)
  • bit 4 : transmit data register empty (clear by writing data reg)
  • bit 5 : DCD state
  • bit 6 : DSR state
  • bit 7 : IRQ flag (clear by reading status reg)
0xA7EACommand register
  • bit 0 : enable receive (data terminal ready)
  • bit 1 : receive interrupt enable
  • bit 2-3 : transmit control. 00 offline ; 01 online ; 10 online with interrupt enabled ; 11 transmit BRK
  • bit 4 : enable echo mode (transmitter must be offline)
  • bit 5-7 : --0 no parity ; 001 odd parity ; 011 even parity ; 101 parity bit always set and not checked ; 111 parity bit always reset and not checked
0xA7EBControl register
  • bit 0-3 : baudrate {16x external ; 50; 75; 109.92; 134.58; 150; 300; 600; 1200; 1800; 2400; 3600; 4800; 7200; 9600; 19200}
  • bit 4 : set to use internal BRG, clear to use external clock
  • bit 5-6 : word length {8; 7; 6; 5}
  • bit 7 : 0 = 1 stop bit, 1 = 2 stop bits; 1 stop bit if WL=8bit and parity ; 1.5 stop bit if WL=5 bits and no parity
0xA7EC..0xA7FFExtension (?)
0xA800..0XAFFFextra chip select line on expansion port. Also chip select of unused expansion ROM slot on gen2 MO5.
0xB000..0xEFFFCartridge ROMIf there is a cartridge you can't access the basic anymore.
0xC000..0xEFFFBASIC ROMContents may be different accross ROM versions!
0xCE2CPrint text pointer by X
0xD83EPrint regD value in decimal
0xE076SETNAMESet filename at 0x23FA (can be called from basic as EXEC &HE076 "ESSAI.BAS")
0xE079SETEXTSet default extension at 0x23FA. New extension pointed by U. 0xE460 holds "BASDATBIN" if you want so.
0xE088FILETYPEPut 0xFF at 0x2179 then call this to set filesavemode to ASCII.
0xE0B9PROTECCall this to enable basic file protection before saving.
0xE12BSAVEBASSave basic file using name at 0x23FA.

Save binary file using name at 0x23FA.

Input : start, end, and exec addresses on system stack.

Return address is read below "start", so you have to push it by hand then jmp to the routine.


input parameters

0x2199 = 3 for autostart (load ...,R), 2 for run"", 0 else.

0x219A = FF for MERGE, 0 else.

0x219B = 1 for binary, 0 for basic.

0x219D may be used to offset destination address.

0xE460..0xE469"BASDATBIN" string used to select default extension.
0xEA8A"MO5 Basic copyright Microsoft"startup message
0xF000..0xFFFFMonitor ROM
0xF003Reset code
0xFFFE*Reset interrupt indirection