This is an old revision of the document!


Table of Contents

The monitor ROM reserves 256 bytes from addresses 2000 to 20FF (on MO machines) for its own use. If you want to erase this area, you must keep interrupt disabled, and you won't be able to use SWI calls anymore.

Textmode screen

00-18: TERMIN - Logical line ends

This allows the BASIC editor to work with lines longer than 40 characters. For each of the 24 lines on screen, its actual length (which may be more than 40 chars) is stored. When you press the ENT key, the line under the cursor is scanned using this length information. When using the DEL and INS keys, this is used to know how much characters to shift.

19: STATUS - I/O bits

  • bit 0: Keyboard scan is up to date
  • bit 1: keyboard repeat is enabled
  • bit 2: Cursor is visible
  • bit 3: keyboard beep is disabled
  • bit 4: text drawing is in transparent mode
  • bit 6: smooth scrolling is active
  • bit 7: caps lock

1A: TABPT - Tabulation pointer

Points to the current line terminator (?)

1B: RANG - Cursor X position

From 0 to 39.

1C: COLN - Cursor Y position

From 0 to 24.

1D: TOPTAB - Window top position

1E: TOPRAN - Window left position

1F: BOTTAB - Window bottom position

20: BOTRAN - Window right position

21-22: SCRPT - Screen pointer

23-24: STADR - Window start address

25-26: ENDDR - Window end address

27-28: BLOCZ - Always 0

This value is always 0. This is apparently used when clearing other stuff, in order to not need an extra CPU register to store a 0.

29: FORME - Character color

Select the color used when drawing.

This can be a value from -16 to 15. If positive, the color will be set as the character color for the affected cell, and the pixel will be set to 1. If negative, the color will be set as the background color, and the pixel set to 0.

2A: ATRANG - Attribute

Defines the currently active text attributes:

  • Bit 0: double width
  • Bit 1: double height
  • Bit 6: foreground color change for whole screen
  • Bit 7: background color chnage for whole screen

2B: COLOR

Store foreground and background colors in the same format as the attribute RAM. Used by PUTCH.

2C: PAGFLG - Page mode flag

Setting this to 1 disables screen scrolling and uses page mode (printing after line 25 goes back to line 0).

2D: SCROLS - Smooth scrolling

Setting this to 255 enables smooth pixel-scrolling.

2E: CURSFL - Cursor end-of-line marker

Remembers that the cursor is on the last screen-line of a logical line. Do not link that logical line with the next one when the cursor is moved away.

2F: COPCHR - Copy character

Holds ASCII code of the character under the cursor.

Decremented by interrupts, when it reaches 0, the cursor state is changed.

31: ITCMPT - Interrupt counter

General looping interrupt counter. Incremented by 50Hz interrupt.

Graphics

32-33, 34-35: PLOTX, PLOTY - Drawing position

Set by all drawing routines to the current pen position. Used when drawing lines as the 'from' point.

36: CHDRAW - Character draw

Used as the character to use for drawing routines:

  • 0: do pixel drawing
  • Other: ASCII code of character to use

Keyboard

37: KEY

Set by GETCH to the pressed key keycode.

38: CMPTKB - Keyboard repeat delay counter

Sound

3A: TEMPO

Note length multiplier

3C: DUREE

Note length

3D: WAVE

Sound wave shape (values from 0 to 5)

3E: OCTAVE

Note octave multiplier (16, 8, 4, 2, 1, from bass to treble)

Tape drive

Note: this needs a tape drive.

40: K7DATA

Byte being read or written to tape

41: K7LENG

Byte counter for current block being written to tape

Printer

Note: this needs a printer port, which is an extension on some machines.

42: PROPC - Printer Operation Code

43: PRSTA - Printer status

  • 4: port open
  • 8: ready
  • 10: port closed

System support

44-45: TEMP - Temporary register

Used as temporary storage by various routines.

46-47: SAVEST - System stack pointer backup

S register is saved here when a routine needs to modify it.

Disk operations

These variables are only used by the floppy controller ROM, not the monitor one.

48: DKOPC - Disk Operation

Used by DKCONT system call. Possible operations:

  • 1: initialize controller
  • 2: read a sector
  • 4: switch to single density
  • 8: write a sector
  • 10: switch to double density
  • 20: seek track 0
  • 40: seek track
  • 80: verify sector.

Some of these can be combined (88 is “write and verify sector”).

49: DKDRV - Active drive

  • 0: Drive A, top side
  • 1: Drive A, bottom side
  • 2: Drive B, top side
  • 3: Drive B, bottom side
  • 4: RAM disk

4A-4B: DKTRK - Disk track

This is a 16 bit variable because of the use on QDD as the “LBA” block number.

4C: DKSEC - Disk sector number

4D: DKNUM - Sector interleaving factor

The default is 7, which lays out the sectors in this order: 0,7,14,6,13,5,12,4,11,3,10,2,9,1,8

4E: DKSTA - Disk status

Used as error bits after executing disk operations:

  • bit 0: write protection
  • bit 1: track error
  • bit 2: sector error
  • bit 3: data error
  • bit 4: drive not ready, no disk or motor off
  • bit 5: compare error (data read from disk and memory version are different)
  • bit 6: not formatted

Used as information about the type of controller aftre initialisation:

  • 43 ('C'): single density controller
  • 44 ('D'): double density controller

4F-50: DKBUF - Disk buffer

Pointer to 256 byte work buffer for the floppy controller

51-58: working area

Used for several different purposes by the floppy ROM.

Keyboard scanning, interrupts, custom character tables

59: SEQUCE - Screen rendering state

This is used as state saving for the screen display state machine. In particular, it allows rendering of multi-byte accented characters.

5A: US1

Temporary parameter storage for US escape sequences

5B: ACCENT

Temporary storage for multi-byte accented characters

5C,5D: SS2GET, SS3GET

Screen State machine temporary storage. These store the two parameters for multi-byte accent sequences.

5E-5F: SWIPT - Software interrupt table pointer

This points to the table of system calls used by the SWI handler. Modifying this value allows redirecting the handlers for your own use.

61-62: TIMEPT - Ticker routine pointer

This points to a routine to be called on every interrupt.

63: SEMIRQ

Set to a non-zero value to re-route the IRQ handler using the IRQPT below

64-65: IRQPT

Pointer to a routine to call on interrupt when SEMIRQ is set.

67-68: FIRQPT

Pointer to a routine to call on FIRQ. This is either the lightpen scan, or the barcode reader.

6A-6B: SIMUL

6D-6E: CHRPTR

Pointer to keyboard decoding table (used by GETCH)

70-71: USERAFF

Pointer to user characters for codes 128-255.

73-74: GENPTR

Pointer to characters for codes 32-127. Characters are stored bottom to top.

76: LATCLV - Keyboard repeat delay

77: GRCODE

Control char to send to printer to switch to graphic mode.

78: DECALG

Lightpen calibration offset

7F: DEFDST

Default density for current floppy controller.

80: DKFLG

Set to FF if there is a floppy controller connected.

82-85: serial port variables

These are not used for anything in the ROM, but the software provided with the RF57 serial extension uses this area.

81-CC: system stack

The stack grows downwards.

CD-E4: LPBUF

Working area for the lightpen reading code.

FE-FF: FSTRST - Fast Reset

This is set on first boot after the direct-page has been initialized. The Reset handler checks for this, and doesn't repeat all initializations (memory clearing, etc) if this is the case.

documentations/monitor/directpage.1395523862.txt.gz · Last modified: 2015/02/28 18:08 (external edit)
CC0 1.0 Universal
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0