BIOS Screen Functions

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search

Screen Init


Screen Resolution

 BC0E SCR_SET_MODE      ;in: A=mode (0=160x200x16, 1=320x200x4, 2=640x200x2)
 BC11 SCR_GET_MODE      ;out: A=mode (cy=mode0, z=mode1, ie. cmp mode,1)

Screen Palette

 BC32 SCR_SET_INK       ;in: A=index, B=color1, C=color2
 BC35 SCR_GET_INK       ;in: A=index, out: B=color1, C=color2
 BC38 SCR_SET_BORDER    ;in: B=color1, C=color2
 BC3B SCR_GET_BORDER    ;out: B=color1, C=color2
 BC3E SCR_SET_FLASHING  ;in: H=count1, L=count2
 BC41 SCR_GET_FLASHING  ;out: H=count1, L=count2

VRAM Address Translation

 BC1A SCR_CHAR_POSITION ;in: H=x, L=y, out: HL=vram addr, B=bytes/char
 BC1D SCR_DOT_POSITION  ;in: DE=x, HL=y, out: HL=vram addr, C=mask, DE, B
 BC20 SCR_NEXT_BYTE     ;out: HL=HL+1 (wrapped within 800h-byte block)
 BC23 SCR_PREV_BYTE     ;out: HL=HL-1 (wrapped within 800h-byte block)
 BC26 SCR_NEXT_LINE     ;out: HL=HL+800h, or HL=HL+50h-3800h (or so)
 BC29 SCR_PREV_LINE     ;out: HL=HL-800h, or HL=HL-50h+3800h (or so)
 BC2C SCR_INK_ENCODE    ;in: A=color, out: A=color_mask
 BC2F SCR_INK_DECODE    ;in: A=color_mask, out: A=color
 BC17 SCR_CHAR_LIMITS   ;out: B=max_x(19,39,79), C=max_y(24)


 BC14 SCR_MODE_CLEAR    ;clear vram, set offset=0000h, update inks
 BC44 SCR_FILL_BOX      ;in: A=fillbyte, H=x1, L=y1, D=x2, E=y2
 BC47 SCR_FLOOD_BOX     ;in: A=fillbyte, HL=vram addr, D=xsiz, E=ysiz
 BC5F SCR_HORIZONTAL    ;in: A=pen, DE=x1, BC=x2, HL=y
 BC62 SCR_VERTICAL      ;in: A=pen, HL=y1, BC=y2, DE=x

Further Stuff

 BC4A SCR_CHAR_INVERT   ;in: H=x, L=y, B=paper, C=pen
 BC4D SCR_HARDWARE_ROLL ;in: A=paper, B=dir(0=down, FFh=up)
 BC50 SCR_SOFTWARE_ROLL ;in: A=paper, B=dir(""), H=x1, L=y1, D=x2, E=y2
 BC53 SCR_UNPACK        ;in: HL=src, DE=dest (mono 8x8 char to colored 8x8)
 BC56 SCR_REPACK        ;in: H=x, L=y, A=pen, DE=dest (colored 8x8 to mono)
 BC59 SCR_ACCESS        ;in: A=drawmode (0=Normal, 1=XOR, 2=AND, 3=OR)
 BC5C SCR_PIXELS        ;in: HL=vram addr, C=xmask, B=color
 BDE5 HOOK_SCR_READ          ;in: HL=vram addr, C=xmask, out: A=color
 BDE8 HOOK_SCR_WRITE         ;in: HL=vram addr, C=xmask, B=color
 BDEB HOOK_SCR_MODE_CLEAR    ;clear vram, etc. (same as BC14)
 BC05 SCR_SET_OFFSET    ;in: HL.bit10..0 = vram offset 0..7FFh
 BC08 SCR_SET_BASE      ;in: A.bit7-6 = vram block 0..3
 BC0B SCR_GET_LOCATION  ;out: A.bit7-6=block, HL.bit10..0=offset

Machine Pack (Screen)

 BD19 MC_WAIT_FLYBACK    ;wait until/unless PIO.Port B bit0=1 (vsync)
 BD1C MC_SET_MODE        ;in: A=video mode (0..2) (for C' and gate array)
 BD1F MC_SCREEN_OFFSET   ;in: A=base, HL=offset   (for CRTC)
 BD22 MC_CLEAR_INKS      ;in: DE=ptr to border and 1 ink (2 bytes)
 BD25 MC_SET_INKS        ;in: DE=ptr to border and 16 inks (17 bytes)

These functions are directly accessing I/O ports. WAIT_FLYBACK is eventually useful. The MODE/OFFSET apply the new setting to the hardware (but the BIOS functions like TXT_WR_CHAR aren't aware of it; so they do still draw pixels at the old offset and old color depth). The INK functions expect hardware color codes (eg. 14h or 54h for black), and, the infamous blink-feature will overwrite the new colors after soon.