z80:System Flags

From Learn @ Cemetech
Jump to navigationJump to search

The system flags are a special place in memory pointed to by the IY index register, which points to flags. They contain vital information that can be stored in 1 bit, so they have been compressed into 1 bit to save space. If you ever need to restore the IY register back before quiting, do this:

   ld IY,flags

To do something to the flags (set, reset, or bit), do this:

   set trigDeg,(IY+trigFlags)                  ;trigDeg is now 1
   res trigDeg,(IY+trigFlags)                  ;trigDeg is now 0
   bit trigDeg,(IY+trigFlags)                  ;Tests trigDeg

Assembly Flags

If you look at the bottom of the flags table, you'll notice that there are 3 bytes for assembly flags. These are flags that are not used by the OS, and can be used by assembly programmers for their own purposes.

   #define shoot asm_Flag1_0
   # define weaponFlags asm_Flag1

System Flags Breakdown

Here's a breakdown of the system flags:

Flag Name IY Offset Equate Description Comments
trigDeg trigFlags 0 = radian angle mode
1 = degree angle mode
plotLoc plotFlags 0 = write to display and buffer
1 = write to display only
plotDisp plotFlags 0 = graph screen not in display
1 = graph in display
grfFuncM grfModeFlags 0 = not function graph mode Please note that the grfMode functions must have only 1 set and the rest reset; otherwise, the calculator will crash.
1 = function graph mode
grfPolarM grfModeFlags 0 = not polar graph mode Please note that the grfMode functions must have only 1 set and the rest reset.
1 = polar graph mode
grfParamM grfModeFlags 0 = not parametric graph mode Please note that the grfMode functions must have only 1 set and the rest reset.
1 = parametric graph mode
grfRecurM graphFlags 0 = not sequence graph mode Please note that the grfMode functions must have only 1 set and the rest reset.
1 = sequence graph mode
graphDraw grfDBFlags 0 = graph is up to date
1 = graph needs to be updated
grfDot grfDBFlags 0 = graph connected draw mode
1 = graph dot draw mode
grfSimul grfDBFlags 0 = Draw functions one at a time
1 = Draw all functions simultaneously
grfGrid grfDBFlags 0 = graph mode grid off
1 = graph mode grid on
grfPolar grfDBFlags 0 = Rectangular coordinates
1 = Polar coordinates
grfNoCoord grfDBFlags 0 = graph coordinates off
1 = graph coordinates on
grfNoAxis grfDBFlags 0 = graph draw axis
1 = graph no axis
grfLabel grfDBFlags 0 = graph labels off
1 = graph labels on
textEraseBelow textFlags 0 = Don't erase line below Only on small text
1 = erase line below
textInverse textFlags 0 = Regular text Affects both small and large text
1 = write in reverse video
onInterrupt onFlags 0 = No on-key interrupt The on-key is interrupt driven but doesn't stop execution. Flag is set by the interrupt handler when the on-key is pressed.
1 = On-key interrupt encountered
statsValid statFlags 0 = Stat results invalid
1 = Stat results valid
fmtExponent cell-content 0 = Normal Mode Either fmtExponent, fmtEng, or neither is set.
1 = scientific display mode
fmtEng fmtFlags 0 = Normal Mode Either fmtExponent, fmtEng, or neither is set.
1 = engineering display mode
fmtReal fmtFlags 0 = Not real math mode Either fmtReal, fmtRect,or fmtPolar must be set
1 = real math mode
fmtRect fmtFlags 0 = Not rect complex math mode Either fmtReal, fmtRect,or fmtPolar must be set
1 = rect complex math mode
fmtPolar fmtFlags 0 = not polar complex math mode Either fmtReal, fmtRect,or fmtPolar must be set
1 = polar complex math mode
curAble curFlags 0 = Cursor flash disabled
1 = Cursor flash enabled
curOn curFlags 0 = Invisible cursor
1 = cursor is showing
curLock curFlags 0 = Cursor not locked
1 = Cursor is locked off
appTextSave appFlags 0 = Don't write to textShadow Places a copy of the character written to the display into the textShadow buffer.
1 = Save characters written in textShadow
appAutoScroll appFlags 0 = Don't auto scroll Scrolls text if on last line of large text
1 = auto-scroll text on last line
indicRun indicFlags 0 = run indicator off
1 = run indicator on
comFailed getSendFlg 0 = com did not fail
1 = com failed
apdRunning apdFlags 0 = APD off
1 = APD on
indicOnly indicFlags 0 = Run indicator not only priority Sets the interrupt handler to update the run indicator, but not to process APD, blink the cursor, or scan for keys. It is useful when executing I/O link port operations for speed.
1 = only update run indicator
shift2nd shiftFlags 0 = second key not pressed
1 = second key pressed
shiftAlpha shiftFlags 0 = Normal mode
1 = Alpha mode
shifLwrAlpha shiftFlags 0 = not lowercase mode Alpha mode also active if set
1 = lower case mode
shiftALock shiftFlags 0 = Not Alpha lock Alpha mode also set
1 = Alpha lock
grfSplit sGrFlags 0 = Normal graph mode Either grfSplit, vertSplit, or neither must be set
1 = horizontal graph split mode
vertSplit sGrFlags 0 = Normal graph mode Either grfSplit, vertSplit, or neither must be set
1 = vertical graph split mode
textWrite sGrFlags 0 = small font writes to display
1 = small font writes to buffer
fullScrnDraw apiFlag4 0 = Can't use column 95 or row 0
1 = allows draws to use column 95 and row 0
bufferOnly plotFlag3 0 = Draw to display and buffer
1 = draw to graph buffer only
fracDrawLFont fontFlags 0 = small font with UserPutMap Affects small text routines
1 = draw large font in UserPutMap
customFont fontFlags 0 = Standard OS fonts
1 = draw custom characters
lwrCaseActive appLwrCaseFlag 0 = Lowercase disabled for GetKey
1 = enable lower case in GetKey loop
asm_Flag1_0 asm_Flag1 Your choice Not used by the OS.
asm_Flag1_1 asm_Flag1 Your choice Not used by the OS.
asm_Flag1_2 asm_Flag1 Your choice Not used by the OS.
asm_Flag1_3 asm_Flag1 Your choice Not used by the OS.
asm_Flag1_4 asm_Flag1 Your choice Not used by the OS.
asm_Flag1_5 asm_Flag1 Your choice Not used by the OS.
asm_Flag1_6 asm_Flag1 Your choice Not used by the OS.
asm_Flag1_7 asm_Flag1 Your choice Not used by the OS.
asm_Flag2_0 asm_Flag2 Your choice Not used by the OS.
asm_Flag2_1 asm_Flag2 Your choice Not used by the OS.
asm_Flag2_2 asm_Flag2 Your choice Not used by the OS.
asm_Flag2_3 asm_Flag2 Your choice Not used by the OS.
asm_Flag2_4 asm_Flag2 Your choice Not used by the OS.
asm_Flag2_5 asm_Flag2 Your choice Not used by the OS.
asm_Flag2_6 asm_Flag2 Your choice Not used by the OS.
asm_Flag2_7 asm_Flag2 Your choice Not used by the OS.
asm_Flag3_0 asm_Flag3 Your choice Not used by the OS.
asm_Flag3_1 asm_Flag3 Your choice Not used by the OS.
asm_Flag3_2 asm_Flag3 Your choice Not used by the OS.
asm_Flag3_3 asm_Flag3 Your choice Not used by the OS.
asm_Flag3_4 asm_Flag3 Your choice Not used by the OS.
asm_Flag3_5 asm_Flag3 Your choice Not used by the OS.
asm_Flag3_6 asm_Flag3 Your choice Not used by the OS.

|