Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     call    vxWaitVsync
  2.     ld  a, $2A
  3.     call    vxSpiCmd
  4.     ld  a, $0
  5.     call    vxSpiParam
  6.     ld  a, $0
  7.     call    vxSpiParam
  8.     ld  a, $01
  9.     call    vxSpiParam
  10.     ld  a, $3F
  11.     call    vxSpiParam
  12.     call    vxWaitVsync
  13.  
  14.  
  15.  
  16.  
  17. vxWaitVsync:
  18. ; wait until the LCD finish displaying the frame
  19.     ld  hl, VX_LCD_ICR
  20.     set 2, (hl)
  21.     ld  l, VX_LCD_ISR&$FF
  22. vxWaitSyncLoop:
  23.     bit 2, (hl)
  24.     jr  z, vxWaitSyncLoop
  25.     ret
  26. vxSpiParam:
  27.  scf ; First bit is set for data
  28.  .db 030h ; jr nc,? ; skips over one byte
  29. vxSpiCmd:
  30.  or a,a ; First bit is clear for commands
  31.  ld hl,0F80818h
  32.  call vxSpiWrite
  33.  ld l,h
  34.  ld (hl),001h
  35. vxSpiWait:
  36.  ld l,00Dh
  37. vxSpiWait1:
  38.  ld a,(hl)
  39.  and a,0F0h
  40.  jr nz,vxSpiWait1
  41.  dec l
  42. vxSpiWait2:
  43.  bit 2,(hl)
  44.  jr nz,vxSpiWait2
  45.  ld l,h
  46.  ld (hl),a
  47.  ret
  48. vxSpiWrite:
  49.  ld b,3
  50. vxSpiWriteLoop:
  51.  rla
  52.  rla
  53.  rla
  54.  ld (hl),a ; send 3 bits
  55.  djnz vxSpiWriteLoop
  56.  ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement