Advertisement
Guest User

Untitled

a guest
Dec 27th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub simplegraphics
  2.  
  3.     'Simple graphics renderer. As with keycheck, this is only useful for the "simple" 6502 machine. The graphics are memory mapped.
  4.     Dim As integer  memcount = -1, sf
  5.     If monitor = 0 Then sf = (screeny/256) Else sf = 8
  6.     Dim As fb.image Ptr simplebuff
  7.     simplebuff = ImageCreate(32*sf,32*sf,RGB(0,0,0))
  8.     For dy As Integer = 1 To 32
  9.         For dx As Integer = 1 To 32
  10.             memcount+=1
  11.             If memcount + &h200 > 1535 Then
  12.                 Exit for
  13.             EndIf
  14.             For z As Integer = sf To 1 Step -1
  15.                 ' Draw a line z number of times to make a giant pixel. This is how we are scaling
  16.                 Line simplebuff, (dx*sf-sf,dy*sf-z)-(dx*sf,dy*sf-z), clr(cpu.memory(&h200 + memcount) )
  17.             Next
  18.         Next
  19.     next
  20.     Line simplebuff, (0, 0)-(32*sf-1, 32*sf-1), RGB(255,255,255), b ' draw the box around the graphic area
  21.     If monitor = 1 Then Put (screenx-(32*sf)-25,screeny-(32*sf)-25), simplebuff, _ 'long line break
  22.     PSet Else Put ((screenx/2)-((sf*32)/2),0),simplebuff,PSet ' put the image buffer to screen
  23.     ImageDestroy(simplebuff) ' Get rid of the buffer, or else memory leaks!
  24. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement