house cleaning

This commit is contained in:
Irmen de Jong 2024-10-10 20:46:18 +02:00
parent 78ec1e7512
commit 1a6b95b388
15 changed files with 5 additions and 394 deletions

View File

@ -757,6 +757,11 @@ internal_vload:
}}
}
; note: There is no vsave_raw() routine because the Kernal doesn't have a VSAVE routine.
; You'll have to write your own loop that reads vram data and use
; cbm.CHROUT or cx16.MCIOUT to write it to an open output file.
sub chdir(str path) {
; -- change current directory.
list_filename[0] = 'c'

View File

@ -127,7 +127,6 @@ class TestCompilerOnExamplesCx16: FunSpec({
"cxlogo",
"diskspeed",
"fileseek",
"highresbitmap",
"kefrenbars",
"keyboardhandler",
"life",
@ -170,8 +169,6 @@ class TestCompilerOnExamplesBothC64andCx16: FunSpec({
"dirlist",
"fibonacci",
"fractal-tree",
"line-circle-gfx",
"line-circle-txt",
"maze",
"mandelbrot",
"mandelbrot-gfx",
@ -179,7 +176,6 @@ class TestCompilerOnExamplesBothC64andCx16: FunSpec({
"primes",
"queens",
"screencodes",
"sincos",
"swirl",
"swirl-float",
"tehtriz",

View File

@ -1,7 +1,6 @@
%import syslib
%import textio
%import math
%import test_stack
spritedata $2000 {
@ -97,8 +96,6 @@ main {
txt.print(" jiffies/fr = ")
txt.print_ub(60/cbm.TIME_LO)
txt.print(" fps")
; test_stack.test()
}
}

View File

@ -1,5 +1,4 @@
%import syslib
%import test_stack
%import textio
%import math
@ -35,8 +34,6 @@ main {
txt.print_ub(60/cbm.TIME_LO)
txt.print(" fps")
cbm.TIME_LO=0
; test_stack.test()
}
}

View File

@ -11,7 +11,6 @@
%import syslib
%import textio
%import math
%import test_stack
main {
@ -68,9 +67,6 @@ waitkey:
}
drawScore()
; txt.plot(0,0)
; test_stack.test()
}
ubyte key

View File

@ -1,6 +1,5 @@
%import floats
%import textio
%import test_stack
%zeropage basicsafe
; Note: this program can be compiled for multiple target systems.
@ -37,8 +36,6 @@ main {
txt.print(" jiffies/fr = ")
txt.print_ub(60/jiffies)
txt.print(" fps")
;test_stack.test()
}
}

View File

@ -34,8 +34,6 @@ main {
anglex += 317
angley -= 505
anglez += 452
; test_stack.test()
}
}

View File

@ -1,85 +0,0 @@
%import monogfx
%import floats
%import textio
%import math
%zeropage dontuse
main {
sub start () {
monogfx.text_charset(3)
test_monochrome()
monogfx.textmode()
txt.print("done!\n")
}
sub test_monochrome() {
monogfx.hires()
uword yy
uword xx
word ww
yy = 20
xx = 20
monogfx.drawmode(monogfx.MODE_NORMAL)
monogfx.rect(xx, yy, 250, 80, true)
monogfx.drawmode(monogfx.MODE_STIPPLE)
monogfx.fillrect(xx+2, yy+2, 250-4, 80-4, true)
monogfx.drawmode(monogfx.MODE_NORMAL)
monogfx.fillrect(xx+20, yy+20, 200, 30, true)
monogfx.rect(xx+21, yy+21, 200-2, 30-2, false)
monogfx.text(xx+30, yy+32, false, sc:"High Res Bitmap Example")
; monogfx.drawmode(monogfx.MODE_STIPPLE)
monogfx.horizontal_line(10, 240, 620, true)
monogfx.vertical_line(320, 10, 460, true)
monogfx.text(320, 242, true, sc:"0,0")
monogfx.text(322, 10, true, sc:"Y-axis")
monogfx.text(590, 242, true, sc:"X-axis")
for ww in -10 to 10 {
xx = (ww*30) + 320 as uword
monogfx.vertical_line(xx, 239, 3, true)
}
for ww in -7 to 7 {
yy = (ww*30) + 240 as uword
monogfx.horizontal_line(319, yy, 3, true)
}
monogfx.drawmode(monogfx.MODE_NORMAL)
float y_f
for ww in -600 to 600 {
y_f = floats.sin(ww as float / 60.0)*150
monogfx.plot(ww/2 + 320 as uword, (y_f + 240) as uword, true)
}
monogfx.text(480, 100, true, sc:"sin(x)")
for ww in -300 to 300 {
y_f = floats.cos(ww as float/30.0)*60 - (ww as float)/1.7
monogfx.plot(ww + 320 as uword, (y_f + 240) as uword, true)
}
monogfx.text(80, 420, true, sc:"cos(x)+x")
sys.wait(3*60)
monogfx.circle(320, 240, 220, true)
monogfx.circle(320, 240, 210, true)
monogfx.circle(320, 240, 200, true)
monogfx.circle(320, 240, 190, true)
monogfx.drawmode(monogfx.MODE_STIPPLE)
monogfx.disc(320, 240, 140, true)
monogfx.drawmode(monogfx.MODE_NORMAL)
monogfx.disc(320, 240, 90, true)
monogfx.disc(320, 240, 40, false)
sys.wait(2*60)
monogfx.drawmode(monogfx.MODE_INVERT)
repeat 255
monogfx.line(math.rndw() % 640, math.rndw() % 480, math.rndw() % 640, math.rndw() % 480, true)
sys.wait(1*60)
}
}

View File

@ -10,7 +10,6 @@
%import syslib
%import textio
%import math
%import test_stack
%import psg
main {
@ -90,9 +89,6 @@ waitkey:
}
drawScore()
; txt.plot(0,0)
; test_stack.test()
}
ubyte key

View File

@ -1,7 +1,6 @@
%import textio
%import diskio
%zeropage basicsafe
%import test_stack
%option no_sysinit
; Note: this program can be compiled for multiple target systems.
@ -53,7 +52,5 @@ main {
} else {
txt.print("error\n")
}
; test_stack.test()
}
}

View File

@ -1,49 +0,0 @@
%import graphics
%import test_stack
%import math
; Note: this program can be compiled for multiple target systems.
main {
sub start() {
graphics.enable_bitmap_mode()
draw_lines()
draw_circles()
draw_rects()
; graphics.disable_bitmap_mode()
; test_stack.test()
repeat {
}
}
sub draw_rects() {
graphics.rect(220,10,80,10)
graphics.rect(20,180,80,10)
graphics.fillrect(220,30,80,10)
graphics.fillrect(20,160,80,10)
}
sub draw_circles() {
ubyte xx
for xx in 3 to 7 {
graphics.circle(xx*50-100, 10+xx*16, (xx+6)*4)
graphics.disc(xx*50-100, 10+xx*16, (xx+6)*2)
}
}
sub draw_lines() {
ubyte i
for i in 0 to 255 step 4 {
uword x1 = ((graphics.WIDTH-256)/2 as uword) + math.sin8u(i)
uword y1 = (graphics.HEIGHT-128)/2 + math.cos8u(i)/2
uword x2 = ((graphics.WIDTH-64)/2 as uword) + math.sin8u(i)/4
uword y2 = (graphics.HEIGHT-64)/2 + math.cos8u(i)/4
graphics.line(x1, lsb(y1), x2, lsb(y2))
}
}
}

View File

@ -1,114 +0,0 @@
%import textio
%import syslib
%zeropage basicsafe
; Note: this program can be compiled for multiple target systems.
main {
sub start() {
txt.print("rectangles\nand circle\ndrawing.\n")
ubyte r
for r in 3 to 12 step 3 {
circle(20, 12, r)
}
txt.print("enter for disc:")
void cbm.CHRIN()
txt.nl()
txt.clear_screen()
disc(20, 12, 12)
txt.print("enter for rectangles:")
void cbm.CHRIN()
txt.nl()
txt.clear_screen()
rect(4, 8, 37, 23, false)
rect(20, 12, 30, 20, true)
rect(10, 10, 10, 10, false)
rect(6, 0, 16, 20, true)
sub rect(ubyte x1, ubyte y1, ubyte x2, ubyte y2, bool fill) {
ubyte x
ubyte y
if fill {
for y in y1 to y2 {
for x in x1 to x2 {
txt.setcc(x, y, 42, x+y)
}
}
} else {
for x in x1 to x2 {
txt.setcc(x, y1, 42, 8)
txt.setcc(x, y2, 42, 8)
}
if y2>y1 {
for y in y1+1 to y2-1 {
txt.setcc(x1, y, 42, 7)
txt.setcc(x2, y, 42, 7)
}
}
}
}
sub circle(ubyte xcenter, ubyte ycenter, ubyte radius) {
; Midpoint algorithm
ubyte x = radius
ubyte y = 0
byte decisionOver2 = 1-x as byte
while x>=y {
txt.setcc(xcenter + x, ycenter + y, 81, 1)
txt.setcc(xcenter - x, ycenter + y, 81, 2)
txt.setcc(xcenter + x, ycenter - y, 81, 3)
txt.setcc(xcenter - x, ycenter - y, 81, 4)
txt.setcc(xcenter + y, ycenter + x, 81, 5)
txt.setcc(xcenter - y, ycenter + x, 81, 6)
txt.setcc(xcenter + y, ycenter - x, 81, 7)
txt.setcc(xcenter - y, ycenter - x, 81, 8)
y++
if decisionOver2>=0 {
x--
decisionOver2 -= 2*x
}
decisionOver2 += 2*y
decisionOver2++
}
}
sub disc(ubyte cx, ubyte cy, ubyte radius) {
; Midpoint algorithm, filled
; NOTE: because of the symmetry drawing, some horizontal spans will be drawn multiple times.
; because this is only a very low res (text tiles) disc, it's not worth optimizing that.
ubyte x = radius
ubyte y = 0
byte decisionOver2 = 1-x as byte
ubyte xx
while x>=y {
xx = cx-x
repeat 2*x+1 {
txt.setcc(xx, cy + y, 81, 11)
txt.setcc(xx, cy - y, 81, 12)
xx++
}
xx = cx-y
repeat 2*y+1 {
txt.setcc(xx, cy + x, 81, 13)
txt.setcc(xx, cy - x, 81, 14)
xx++
}
y++
if decisionOver2>=0 {
x--
decisionOver2 -= 2*x
}
decisionOver2 += 2*y
decisionOver2++
}
}
}
}

View File

@ -1,6 +1,5 @@
%import graphics
%import floats
%import test_stack
%zeropage floatsafe
; Draw a mandelbrot in graphics mode (the image will be 256 x 200 pixels).
@ -45,9 +44,6 @@ main {
}
}
; graphics.disable_bitmap_mode()
; test_stack.test()
repeat {
}
}

View File

@ -1,6 +1,5 @@
%import textio
%import floats
%import test_stack
%zeropage basicsafe
; Note: this program can be compiled for multiple target systems.
@ -45,7 +44,5 @@ main {
txt.print("finished in ")
floats.print(duration)
txt.print(" seconds!\n")
; test_stack.test()
}
}

View File

@ -1,113 +0,0 @@
%import graphics
%import math
%import textio
%zeropage basicsafe
; Draw sine and cosine graphs. The sine and cosine functions are table lookups
; where the tables are generated by 64tass list functions.
; This uses the graphics library which works on multiple targets (C64, CX16)
main {
const uword width = 320
const ubyte height = 200
sub start() {
graphics.enable_bitmap_mode()
sincos255()
sys.wait(60)
graphics.clear_screen(1, 0)
sincos180()
sys.wait(60)
graphics.clear_screen(1, 0)
circles()
sys.wait(60)
graphics.disable_bitmap_mode()
txt.print("done\n")
}
sub sincos255() {
graphics.line(256,0,256,height-1)
ubyte pixelyb
ubyte pixelxb
byte pixelys
; unsigned
for pixelxb in 0 to 255 {
pixelyb = math.cos8u(pixelxb) / 2
graphics.plot(pixelxb, pixelyb+20)
pixelyb = math.sin8u(pixelxb) / 2
graphics.plot(pixelxb, pixelyb+20)
}
; signed
for pixelxb in 0 to 255 {
pixelys = math.cos8(pixelxb) / 2
graphics.plot(pixelxb, pixelys as ubyte + 90)
pixelys = math.sin8(pixelxb) / 2
graphics.plot(pixelxb, pixelys as ubyte + 90)
}
}
sub sincos180() {
graphics.line(180,0,180,height-1)
ubyte pixelyb
ubyte pixelxb
byte pixelys
; signed
for pixelxb in 0 to 179 {
pixelyb = math.cosr8u(pixelxb) / 2
graphics.plot(pixelxb, pixelyb+20)
pixelyb = math.sinr8u(pixelxb) / 2
graphics.plot(pixelxb, pixelyb+20)
}
; unsigned
for pixelxb in 0 to 179 {
pixelys = math.cosr8(pixelxb) / 2
graphics.plot(pixelxb, pixelys as ubyte + 90)
pixelys = math.sinr8(pixelxb) / 2
graphics.plot(pixelxb, pixelys as ubyte + 90)
}
}
sub circles() {
ubyte pixelyb
uword pixelxw
ubyte r
; circle with "degrees" from 0 to 255
for r in 0 to 255 {
pixelxw = (math.sin8(r)/2 as word) + 80 as uword
pixelyb = (math.cos8(r)/2 as uword + height/2) as ubyte
graphics.plot(pixelxw, pixelyb)
}
for r in 0 to 255 {
pixelxw = math.sin8u(r)/2
pixelyb = math.cos8u(r)/2
graphics.plot(pixelxw + 16, pixelyb+50)
}
; circle with half-degrees from 0 to 179 (=full degrees 0..358 with steps of 2 degrees)
for r in 0 to 179 {
pixelxw = (math.sinr8(r) as word /2 + 220) as uword
pixelyb = (math.cosr8(r)/2 + height/2) as ubyte
graphics.plot(pixelxw, pixelyb)
}
for r in 0 to 179 {
pixelxw = math.sinr8u(r)/2
pixelyb = math.cosr8u(r)/2
graphics.plot(pixelxw + 156, pixelyb+50)
}
}
}