mirror of
https://github.com/dschmenk/PLASMA.git
synced 2024-08-21 06:29:07 +00:00
Apple 3 graphics demo
This commit is contained in:
parent
c9a5b25194
commit
f266f1c035
14
src/inc/grafix.plh
Normal file
14
src/inc/grafix.plh
Normal file
@ -0,0 +1,14 @@
|
||||
import grafix
|
||||
predef pencolor(clr)#0
|
||||
predef fillcolor(clr)#0
|
||||
predef fillscreen()#0
|
||||
predef penmove(x, y)#0
|
||||
predef plot(x, y)#0
|
||||
predef line(x1, y1, x2, y2)#0
|
||||
predef lineto(x, y)#0
|
||||
predef rect(x1, y1, x2, y2)#0
|
||||
predef fillrect(x1, y1, x2, y2)#0
|
||||
predef bitblt(blk, pitch, x, y, width, height)#0
|
||||
predef drawmode(mode)#0
|
||||
predef setmode(mode)#0
|
||||
end
|
@ -1,7 +1,7 @@
|
||||
include "inc/cmdsys.plh"
|
||||
|
||||
byte gfxref, gfxseg
|
||||
byte params[8], cmd[10]
|
||||
byte params[8], cmd[16]
|
||||
|
||||
export def pencolor(clr)#0
|
||||
params:4 = 2
|
||||
@ -10,26 +10,105 @@ export def pencolor(clr)#0
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
export def fillcolor(clr)#0
|
||||
params:4 = 2
|
||||
cmd.0 = 20 // Fill color
|
||||
cmd.1 = clr
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
export def fillscreen()#0
|
||||
params:4 = 1
|
||||
cmd.9 = 28 // Clear viewport
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
export def penmove(x, y)#0
|
||||
params:4 = 5
|
||||
cmd.0 = 26 // Move pen
|
||||
cmd:1 = x
|
||||
cmd:3 = y
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
export def plot(x, y)#0
|
||||
params:4 = 5
|
||||
cmd.0 = 25 // Plot
|
||||
cmd:1 = x
|
||||
cmd:3 = y
|
||||
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
|
||||
cmd.5 = 24 // Line
|
||||
cmd:6 = x2
|
||||
cmd:8 = y2
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
export def lineto(x, y)#0
|
||||
params:4 = 5
|
||||
cmd.0 = 24 // Line
|
||||
cmd:1 = x
|
||||
cmd:3 = y
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
export def rect(x1, y1, x2, y2)#0
|
||||
params:4 = 10
|
||||
cmd.0 = 26 // Move pen
|
||||
cmd:1 = x1
|
||||
cmd:3 = y1
|
||||
cmd.5 = 24 // Line
|
||||
cmd:6 = x2
|
||||
cmd:8 = y1
|
||||
syscall($CB, @params)
|
||||
params:4 = 15
|
||||
cmd.0 = 24 // Line
|
||||
cmd:1 = x2
|
||||
cmd:3 = y2
|
||||
cmd.5 = 24 // Line
|
||||
cmd:6 = x1
|
||||
cmd:8 = y2
|
||||
cmd.10 = 24 // Line
|
||||
cmd:11 = x1
|
||||
cmd:13 = y1
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
export def fillrect(x1, y1, x2, y2)#0
|
||||
params:4 = 11
|
||||
cmd.0 = 2 // Set viewport
|
||||
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
|
||||
cmd.10 = 1 // Reset viewport
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
export def bitblt(bits, pitch, x, y, width, height)#0
|
||||
params:4 = 14
|
||||
cmd.0 = 4 // Draw block
|
||||
cmd:1 = bits
|
||||
cmd.3 = ^$FFED & $8F
|
||||
cmd:4 = pitch
|
||||
cmd:6 = x
|
||||
cmd:8 = y
|
||||
cmd:10 = width
|
||||
cmd:12 = height
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
export def drawmode(mode)#0
|
||||
params:4 = 2
|
||||
cmd.0 = 21 // Transfer mode
|
||||
cmd.1 = mode
|
||||
syscall($CB, @params)
|
||||
end
|
||||
|
||||
|
@ -38,6 +38,7 @@ HTTPD = HTTPD\#FE1000
|
||||
DGR = DGR\#FE1000
|
||||
TONE = TONE\#FE1000
|
||||
GRAFIX = GRAFIX\#FE1000
|
||||
GFXDEMO = GFXDEMO\#FE1000
|
||||
PORTIO = PORTIO\#FE1000
|
||||
ROGUE = ROGUE\#FE1000
|
||||
ROGUEMAP= ROGUEMAP\#FE1000
|
||||
@ -74,7 +75,7 @@ TXTTYPE = .TXT
|
||||
#SYSTYPE = \#FF2000
|
||||
#TXTTYPE = \#040000
|
||||
|
||||
all: $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVM802) $(PLVM03) $(CMD) $(PLASMAPLASM) $(CODEOPT) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(SOS) $(ROD) $(SIEVE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(TONE) $(GRAFIX) $(DGR) $(DGRTEST) $(FILEIO) $(CONIO) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ)
|
||||
all: $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVM802) $(PLVM03) $(CMD) $(PLASMAPLASM) $(CODEOPT) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(SOS) $(ROD) $(SIEVE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(TONE) $(GRAFIX) $(GFXDEMO) $(DGR) $(DGRTEST) $(FILEIO) $(CONIO) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ)
|
||||
|
||||
clean:
|
||||
-rm *FE1000 *FF2000 $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVM03)
|
||||
@ -250,6 +251,10 @@ $(GRAFIX): libsrc/grafix.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < libsrc/grafix.pla > libsrc/grafix.a
|
||||
acme --setpc 4094 -o $(GRAFIX) libsrc/grafix.a
|
||||
|
||||
$(GFXDEMO): samplesrc/gfxdemo.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/gfxdemo.pla > samplesrc/gfxdemo.a
|
||||
acme --setpc 4094 -o $(GFXDEMO) samplesrc/gfxdemo.a
|
||||
|
||||
$(FATCAT): samplesrc/fatcat.pla $(PLVM02) $(PLASM)
|
||||
./$(PLASM) -AMOW < samplesrc/fatcat.pla > samplesrc/fatcat.a
|
||||
acme --setpc 4094 -o $(FATCAT) samplesrc/fatcat.a
|
||||
|
BIN
src/samplesrc/APPLE3.PIX#060000
Normal file
BIN
src/samplesrc/APPLE3.PIX#060000
Normal file
Binary file not shown.
41
src/samplesrc/gfxdemo.pla
Normal file
41
src/samplesrc/gfxdemo.pla
Normal file
@ -0,0 +1,41 @@
|
||||
include "inc/cmdsys.plh"
|
||||
include "inc/args.plh"
|
||||
include "inc/fileio.plh"
|
||||
include "inc/grafix.plh"
|
||||
|
||||
var arg
|
||||
byte ref
|
||||
|
||||
def showimage#0
|
||||
var row, x
|
||||
byte scanline[140]
|
||||
|
||||
for row = 0 to 191
|
||||
//
|
||||
// Read one scanline at a time, scale it, and draw it
|
||||
//
|
||||
fileio:read(ref, @scanline, 140)
|
||||
for x = 139 downto 0
|
||||
//scanline[x] = scanline[x] >> 4
|
||||
pencolor(scanline[x] >> 4)
|
||||
plot(x, row)
|
||||
next
|
||||
next
|
||||
end
|
||||
|
||||
arg = argNext(argFirst)
|
||||
if ^arg
|
||||
ref = fileio:open(arg)
|
||||
if ref
|
||||
setmode(3) // 140 x 192 full color (or greyscale)
|
||||
showimage
|
||||
fileio:close(ref)
|
||||
getc
|
||||
setmode(-1)
|
||||
else
|
||||
puts("Unable to open "); puts(arg); putln
|
||||
fin
|
||||
else
|
||||
puts("Usage: gfxdemo <imagefile>\n")
|
||||
fin
|
||||
done
|
Loading…
Reference in New Issue
Block a user