mirror of
https://github.com/dschmenk/PLASMA.git
synced 2026-01-22 18:15:59 +00:00
make FORTH callable from PLASMA
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
include "inc/cmdsys.plh"
|
||||
include "inc/int32.plh"
|
||||
include "inc/sincos.plh"
|
||||
include "inc/lines.plh"
|
||||
|
||||
const CLIP_LEFT = 1
|
||||
const CLIP_RIGHT = 2
|
||||
const CLIP_TOP = 4
|
||||
const CLIP_BOTTOM = 8
|
||||
|
||||
var turtleX, turtleY, turtleAngle
|
||||
var turtleX, turtleY, turtleAngle, drawLine
|
||||
byte pen
|
||||
var clipLeft, clipRight, clipTop, clipBottom
|
||||
|
||||
@@ -81,7 +80,7 @@ export def clipLine(x1, y1, x2, y2)#0
|
||||
fin
|
||||
if clipCode(x1, y1) | clipCode(x2, y2); return; fin // Clipped away
|
||||
fin
|
||||
linespans(x1, y1, x2, y2)
|
||||
drawLine(x1, y1, x2, y2)#0
|
||||
end
|
||||
|
||||
export def clipRect(left, top, right, bottom)#0
|
||||
@@ -99,7 +98,8 @@ export def fillRect(left, top, right, bottom)#0
|
||||
next
|
||||
end
|
||||
|
||||
export def initTurtle(width, height)#0
|
||||
export def initTurtle(width, height, linefunc)#0
|
||||
drawLine = linefunc
|
||||
clipRect(0, 0, width - 1, height - 1)
|
||||
turtleX = width / 2
|
||||
turtleY = height / 2
|
||||
|
||||
@@ -8,7 +8,7 @@ SRC" TURTLE.4TH"
|
||||
|
||||
: SHOW
|
||||
0 HGRMODE HGRDRAWBUF DROP
|
||||
280 192 INITTURTLE
|
||||
280 192 [ LOOKUP LINESPANS ] LITERAL INITTURTLE
|
||||
3 HGRCOLOR
|
||||
;
|
||||
|
||||
@@ -26,9 +26,4 @@ SRC" TURTLE.4TH"
|
||||
10 +LOOP
|
||||
;
|
||||
|
||||
: SPIN
|
||||
SHOW
|
||||
SPIN
|
||||
;
|
||||
|
||||
SHOW SPIN
|
||||
SHOW SPIN KEY DROP -1 HGRMODE DROP
|
||||
|
||||
@@ -22,3 +22,4 @@ LOOKUP FILEIO 0 IFACE PLASMA GETPFX
|
||||
LOOKUP FILEIO 1 IFACE PLASMA SETPFX
|
||||
: PFX. HERE GETPFX DROP HERE (.") ;
|
||||
: PFX" 34 WORD SETPFX DROP ;
|
||||
: PFA 32 WORD FIND 0= ?ABORT" Not found." DUP C@ + 8 + ;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
' INITTURTLE ?ENDSRC
|
||||
" INT32" LOADMOD" "
|
||||
" SINCOS" LOADMOD" "
|
||||
" LINES" LOADMOD" "
|
||||
" TURTLE" LOADMOD" "
|
||||
LOOKUP INITTURTLE PLASMA INITTURTLE
|
||||
LOOKUP CLIPLINE PLASMA CLIPLINE
|
||||
|
||||
Reference in New Issue
Block a user