Browse Source

machine/gba: rename display and make pointer receivers

Signed-off-by: deadprogram <ron@hybridgroup.com>
pull/3511/merge
deadprogram 2 years ago
committed by Ayke
parent
commit
c89a684ad2
  1. 12
      src/machine/machine_gameboyadvance.go

12
src/machine/machine_gameboyadvance.go

@ -38,27 +38,27 @@ func (p Pin) Set(value bool) {
// do nothing
}
var Display = FramebufDisplay{(*[160][240]volatile.Register16)(unsafe.Pointer(uintptr(gba.MEM_VRAM)))}
var Display = DisplayMode3{(*[160][240]volatile.Register16)(unsafe.Pointer(uintptr(gba.MEM_VRAM)))}
type FramebufDisplay struct {
type DisplayMode3 struct {
port *[160][240]volatile.Register16
}
func (d FramebufDisplay) Configure() {
func (d *DisplayMode3) Configure() {
// Use video mode 3 (in BG2, a 16bpp bitmap in VRAM) and Enable BG2
gba.DISP.DISPCNT.Set(gba.DISPCNT_BGMODE_3<<gba.DISPCNT_BGMODE_Pos |
gba.DISPCNT_SCREENDISPLAY_BG2_ENABLE<<gba.DISPCNT_SCREENDISPLAY_BG2_Pos)
}
func (d FramebufDisplay) Size() (x, y int16) {
func (d *DisplayMode3) Size() (x, y int16) {
return 240, 160
}
func (d FramebufDisplay) SetPixel(x, y int16, c color.RGBA) {
func (d *DisplayMode3) SetPixel(x, y int16, c color.RGBA) {
d.port[y][x].Set((uint16(c.R) >> 3) | ((uint16(c.G) >> 3) << 5) | ((uint16(c.B) >> 3) << 10))
}
func (d FramebufDisplay) Display() error {
func (d *DisplayMode3) Display() error {
// Nothing to do here.
return nil
}

Loading…
Cancel
Save