mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-02-10 10:30:58 +00:00
Apple /// graphics library
This commit is contained in:
parent
5c56020c2b
commit
c9a5b25194
95
src/libsrc/grafix.pla
Normal file
95
src/libsrc/grafix.pla
Normal file
@ -0,0 +1,95 @@
|
||||
include "inc/cmdsys.plh"
|
||||
|
||||
byte gfxref, gfxseg
|
||||
byte params[8], cmd[10]
|
||||
|
||||
export def pencolor(clr)#0
|
||||
params:4 = 2
|
||||
cmd.0 = 19 // Pen color
|
||||
cmd.1 = clr
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
export def line(x1, y1, x2, y2)#0
|
||||
params:4 = 10
|
||||
cmd.0 = 26 // Move pen
|
||||
cmd:1 = x1
|
||||
cmd:3 = y1
|
||||
cmd.5 = 24 // Move pen
|
||||
cmd:6 = x1
|
||||
cmd:8 = y1
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
export def rect(x1, y1, x2, y2)#0
|
||||
params:4 = 11
|
||||
cmd.0 = 2 // Set viewport
|
||||
cmd:1 = x1
|
||||
cmd:3 = x2
|
||||
cmd:5 = y1
|
||||
cmd:7 = y2
|
||||
cmd.9 = 28 // Clear viewport
|
||||
cmd.10 = 1 // Reset viewport
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
export def setmode(mode)#0
|
||||
if mode < 0
|
||||
//
|
||||
// Free driver
|
||||
//
|
||||
params.0 = 1
|
||||
params.1 = gfxref
|
||||
syscall($CC, @params)
|
||||
gfxref = 0
|
||||
//
|
||||
// Deaalocate bank 0
|
||||
//
|
||||
params.0 = 1
|
||||
params.1 = gfxseg
|
||||
syscall($45, @params)
|
||||
^$1907 = $00 // Unset graphics pages allocated
|
||||
fin
|
||||
if not gfxref
|
||||
return
|
||||
fin
|
||||
params.0 = 3
|
||||
params.1 = gfxref
|
||||
params:2 = @cmd
|
||||
params:4 = 8
|
||||
cmd.0 = 16 // Set mode
|
||||
cmd.1 = mode
|
||||
cmd.2 = 19 // Pen color
|
||||
cmd.3 = 0
|
||||
cmd.4 = 1 // Reset viewport
|
||||
cmd.5 = 28 // Clear viewport
|
||||
cmd.7 = 15 // Turn on screen
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
if MACHID <> $F2
|
||||
puts("Apple /// only.\n")
|
||||
return -1
|
||||
fin
|
||||
//
|
||||
// Allocate bank 0
|
||||
//
|
||||
params.0 = 4
|
||||
params:1 = $2000
|
||||
params:3 = $9F00
|
||||
params.5 = $10
|
||||
params.6 = $00
|
||||
syscall($40, @params)
|
||||
gfxseg = params.6
|
||||
^$1907 = $80 // Set graphics pages allocated
|
||||
//
|
||||
// Open graphics driver
|
||||
//
|
||||
params.0 = 4
|
||||
params:1 = ".GRAFIX"
|
||||
params.3 = 0
|
||||
params:4 = 0
|
||||
params.6 = 0
|
||||
syscall($C8, @params)
|
||||
gfxref = params.3
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user