BIOS Graphics Functions

From CPCWiki - THE Amstrad CPC encyclopedia!
Revision as of 12:40, 19 December 2010 by MacDeath (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Graphics Init


Graphics Normal Drawing Functions

 BBC0 GRA_MOVE_ABSOLUTE ;in: de=x, hl=y  ;\set current coordinate
 BBC3 GRA_MOVE_RELATIVE ;in: de=x, hl=y  ;/
 BBEA GRA_PLOT_ABSOLUTE ;in: de=x, hl=y  ;\draw pixel at specified coordinate
 BBED GRA_PLOT_RELATIVE ;in: de=x, hl=y  ;/
 BBF6 GRA_LINE_ABSOLUTE ;in: de=x, hl=y  ;\draw line from current coordinate
 BBF9 GRA_LINE_RELATIVE ;in: de=x, hl=y  ;/to specified target coordinate
 BBF0 GRA_TEST_ABSOLUTE ;in: de=x, hl=y, out: A=color (0..15) of pixel
 BBF3 GRA_TEST_RELATIVE ;in: de=x, hl=y, out: A=color (0..15) of pixel
 BBC6 GRA_ASK_CURSOR    ;out: de=x, hl=y ;-get current coordinate
 BBFC GRA_WR_CHAR       ;in: A=char      ;-draw char at current coordinate

Graphics Pen/Paper

 BBDE GRA_SET_PEN       ;in: A=color (0..15) for PLOT/LINE/WR_CHAR
 BBE1 GRA_GET_PEN       ;out: A=color (0..15)
 BBE4 GRA_SET_PAPER     ;in: A=color (0..15) for CLEAR_WINDOW/WR_CHAR
 BBE7 GRA_GET_PAPER     ;out: A=color (0..15

Graphics Origin

 BBC9 GRA_SET_ORIGIN     ;in: de=x, hl=y (also does MOVE 0,0)
 BBCC GRA_GET_ORIGIN     ;out: de=x, hl=y

Normally, coordinate 0,0 is the lower-left of the screen. By changing the origin it can be moved, for example, to the middle of the screen.

Graphics Window

 BBCF GRA_SET_WIN_WIDTH  ;in: de=x1/left, hl=x2/right
 BBD2 GRA_SET_WIN_HEIGHT ;in: de=y1/top, hl=y2/bottom
 BBD5 GRA_GET_WIN_WIDTH  ;out: de=x1/left, hl=x2/right
 BBD8 GRA_GET_WIN_HEIGHT ;out: de=y1/top, hl=y2/bottom
 BBDB GRA_CLEAR_WINDOW   ;fill window by PAPER (also does MOVE 0,0)

Drawing operations are clipped to the window region. The x1/x2 values are rounded to byte-boundaries in VRAM.

Graphics Hooks

 BBBD GRA_RESET_HOOKS   ;out: [BDDC+00h..0Ah]=Default jump opcodes/addresses
 BDDC HOOK_GRA_PLOT     ;in: de=x, hl=y               ;\JP NNNNh opcodes,
 BDDF HOOK_GRA_TEST     ;in: de=x, hl=y, out: A=color ; with NNNNh in LO ROM
 BDE2 HOOK_GRA_LINE     ;in: de=x, hl=y               ;/(which must be on)

New Graphics Functions (664 and up only)

 BD46 GRA_SET_BACK_664       ;A=background mode (FFh=transparent)
 BD49 GRA_SET_FIRST_664      ;in: A=flag (00h,FFh;1st pix of LINE)
 BD4C GRA_SET_LINE_MASK_664  ;in: A=mask
 BD4F GRA_FROM_USER_664      ;in: de=x, hl=y, out: de,hl=real x,y
 BD52 GRA_FILL_664           ;in: A=color,hl=buf,de=bufsize, out:cy=0=err