§ Экран

Просто для интереса. Было интересно и увлекательно сделать на Quick Basic 4.5 такой экран.

А также скачать пример экрана SCREEN.SCR.

§ Код

SCREEN 13

DIM scr AS STRING * 6912
DIM dc(192) AS INTEGER

' Colormap
DATA 0,0,0
DATA 0,0,1
DATA 1,0,0
DATA 1,0,1
DATA 0,1,0
DATA 0,1,1
DATA 1,1,0
DATA 1,1,1

' Make palette
FOR i = 0 TO 7

  READ r, g, b

  ' 0-7
  OUT 968, i
  OUT 969, r * 48: OUT 969, g * 48: OUT 969, b * 48

  ' 8-15
  OUT 968, i + 8
  OUT 969, r * 63: OUT 969, g * 63: OUT 969, b * 63

NEXT

' Make Y-coord
FOR y = 0 TO 191

  ' Read char data
  ' 2048 | 256 |  32 | X=1
  '  7:6 | 2:0 | 5:3 | 4:0

  a = (y \ 8) AND 7
  b = y AND 7
  c = y \ 64
  dc(y) = 32 * a + 256 * b + 2048 * c

NEXT

' Read binary screen data to memory
OPEN "SCREEN.SCR" FOR BINARY AS #1: GET #1, , scr: CLOSE #1

' Render
FOR y = 0 TO 191
FOR x = 0 TO 255 STEP 8

  a = x \ 8
  b = y \ 8
  ch = ASC(MID$(scr, 1 + a + dc(y), 1))

  ' Read attr data
  attr = ASC(MID$(scr, 1 + 6144 + a + b * 32))

  fr = attr AND 7        ' Fore
  bg = (attr \ 8) AND 7  ' Back
  br = (attr AND 64) \ 8 ' Bright
  bl = attr AND 128      ' Blink

  FOR i = 0 TO 7

    IF ch AND 128 THEN cl = fr ELSE cl = bg
    PSET (32 + x + i, y), cl + br
    ch = ch * 2

  NEXT

NEXT
NEXT