1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-08-12 04:25:07 +00:00

Allow GRAFIX to be unloaded and reloaded

This commit is contained in:
David Schmenk
2024-02-09 21:11:07 -08:00
parent 1fb7960a1b
commit 5d5f60c2d5
5 changed files with 37 additions and 28 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -2,6 +2,7 @@ include "inc/cmdsys.plh"
byte gfxref, gfxseg byte gfxref, gfxseg
byte params[8], cmd[16] byte params[8], cmd[16]
byte textmode[] = 16, 0, 15
export def pencolor(clr)#0 export def pencolor(clr)#0
params:4 = 2 params:4 = 2
@@ -112,6 +113,31 @@ export def drawmode(mode)#0
syscall($CB, @params) syscall($CB, @params)
end end
def gfxopen#1
//
// 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
return gfxref <> 0
end
export def setmode(mode)#0 export def setmode(mode)#0
if mode < 0 if mode < 0
// //
@@ -122,15 +148,19 @@ export def setmode(mode)#0
syscall($CC, @params) syscall($CC, @params)
gfxref = 0 gfxref = 0
// //
// Deaalocate bank 0 // Deallocate bank 0
// //
params.0 = 1 params.0 = 1
params.1 = gfxseg params.1 = gfxseg
syscall($45, @params) syscall($45, @params)
^$1907 = $00 // Unset graphics pages allocated ^$1907 = $00 // Unset graphics pages allocated
fin //
if not gfxref // Reset textmode
//
cmdsys:syswrite(cmdsys.refcons, @textmode, 3)
return return
elsif not gfxref
gfxopen
fin fin
params.0 = 3 params.0 = 3
params.1 = gfxref params.1 = gfxref
@@ -151,28 +181,7 @@ if MACHID <> $F2
return -1 return -1
fin 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
//
// Keep module in memory // Keep module in memory
// //
return modkeep return gfxopen ?? modkeep :: -1
done done

View File

@@ -5,7 +5,7 @@ SRC" FPU.4TH"
: DRAWAXIS : DRAWAXIS
3 GFXSETMODE 3 GFXSETMODE
1 GFXPENCOLOR 6 GFXPENCOLOR
0 96 139 96 GFXLINE 0 96 139 96 GFXLINE
70 0 70 191 GFXLINE 70 0 70 191 GFXLINE
; ;
@@ -19,12 +19,12 @@ FPEXT XSCALE
FPCONSTPI 69 >FPINT FP/ XSCALE FPEXT! FPCONSTPI 69 >FPINT FP/ XSCALE FPEXT!
FPEXT YSCALE FPEXT YSCALE
-95 >FPINT YSCALE FPEXT! 95 >FPINT YSCALE FPEXT!
DEFER FUNC DEFER FUNC
: PLOTFUNC : PLOTFUNC
3 GFXPENCOLOR 15 GFXPENCOLOR
140 0 DO 140 0 DO
I DUP 69 - >FPINT XSCALE FPEXT@ FP* I DUP 69 - >FPINT XSCALE FPEXT@ FP*
FUNC FUNC