mirror of
https://github.com/irmen/prog8.git
synced 2024-11-25 19:31:36 +00:00
stack tested for most example programs
This commit is contained in:
parent
125f6205f2
commit
510ca042c9
@ -12,11 +12,20 @@ graphics {
|
||||
|
||||
sub enable_bitmap_mode() {
|
||||
; enable bitmap screen, erase it and set colors to black/white.
|
||||
c64.SCROLY |= %00100000
|
||||
c64.SCROLY = %00111000
|
||||
c64.SCROLX = %00001000
|
||||
c64.VMCSB = (c64.VMCSB & %11110000) | %00001000 ; $2000-$3fff
|
||||
clear_screen(1, 0)
|
||||
}
|
||||
|
||||
sub disable_bitmap_mode() {
|
||||
; enables text mode, erase the text screen, color white
|
||||
c64.SCROLY = %00011000
|
||||
c64.SCROLX = %00001000
|
||||
c64.VMCSB = (c64.VMCSB & %11110000) | %00000100 ; $1000-$2fff
|
||||
txt.fill_screen(' ', 1)
|
||||
}
|
||||
|
||||
sub clear_screen(ubyte pixelcolor, ubyte bgcolor) {
|
||||
memset(BITMAP_ADDRESS, 320*200/8, 0)
|
||||
txt.fill_screen(pixelcolor << 4 | bgcolor, 0)
|
||||
|
@ -1,5 +1,6 @@
|
||||
%target cx16
|
||||
%import syslib
|
||||
%import textio
|
||||
|
||||
; bitmap pixel graphics module for the CommanderX16
|
||||
; wraps the graphics functions that are in ROM.
|
||||
@ -17,6 +18,13 @@ graphics {
|
||||
clear_screen(1, 0)
|
||||
}
|
||||
|
||||
sub disable_bitmap_mode() {
|
||||
; enables text mode, erase the text screen, color white
|
||||
void cx16.screen_set_mode(2)
|
||||
txt.fill_screen(' ', 1) ; TODO doesn't seem to fully clear the text screen after returning from gfx mode
|
||||
}
|
||||
|
||||
|
||||
sub clear_screen(ubyte pixelcolor, ubyte bgcolor) {
|
||||
cx16.GRAPH_set_colors(pixelcolor, pixelcolor, bgcolor)
|
||||
cx16.GRAPH_clear()
|
||||
|
@ -1,3 +1,4 @@
|
||||
%import textio
|
||||
|
||||
test_stack {
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
TODO
|
||||
====
|
||||
|
||||
- check cpu stack consistency in all examples
|
||||
- make it possible to use cpu opcodes such as 'nop' as variable names by prefixing all asm vars with something such as '_'
|
||||
- option to load the built-in library files from a directory instead of the embedded ones (for easier library development/debugging)
|
||||
- see if we can group some errors together for instance the (now single) errors about unidentified symbols
|
||||
|
@ -1,6 +1,7 @@
|
||||
%target c64
|
||||
%import syslib
|
||||
%import textio
|
||||
%import test_stack
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -23,6 +24,9 @@ main {
|
||||
ubyte upwards = true
|
||||
|
||||
repeat {
|
||||
;txt.plot(0,0)
|
||||
;test_stack.test()
|
||||
|
||||
ubyte mountain = 223 ; slope upwards
|
||||
if active_height < target_height {
|
||||
active_height++
|
||||
|
@ -1,4 +1,6 @@
|
||||
%import textio
|
||||
%import test_stack
|
||||
|
||||
%zeropage basicsafe
|
||||
|
||||
; Note: this program is compatible with C64 and CX16.
|
||||
@ -86,12 +88,16 @@ main {
|
||||
; read clock
|
||||
uword jiffies
|
||||
%asm {{
|
||||
stx P8ZP_SCRATCH_REG
|
||||
jsr c64.RDTIM
|
||||
sta jiffies
|
||||
stx jiffies+1
|
||||
ldx P8ZP_SCRATCH_REG
|
||||
}}
|
||||
txt.print("\nbenchmark: ")
|
||||
txt.print_uw(jiffies)
|
||||
txt.print(" jiffies for 1000 frames.\n")
|
||||
|
||||
; test_stack.test()
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
%import floats
|
||||
%import textio
|
||||
%import test_stack
|
||||
%zeropage basicsafe
|
||||
|
||||
; Note: this program is compatible with C64 and CX16.
|
||||
@ -41,6 +42,8 @@ main {
|
||||
txt.print(" jiffies/fr = ")
|
||||
txt.print_ub(60/timer_jiffies)
|
||||
txt.print(" fps")
|
||||
|
||||
;test_stack.test()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
%import syslib
|
||||
%import graphics
|
||||
%import test_stack
|
||||
|
||||
; Note: this program is compatible with C64 and CX16.
|
||||
|
||||
@ -37,6 +38,8 @@ main {
|
||||
anglez+=452
|
||||
|
||||
wait_a_little_bit()
|
||||
|
||||
; test_stack.test()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
%target c64
|
||||
%import syslib
|
||||
%import textio
|
||||
%import test_stack
|
||||
|
||||
spritedata $2000 {
|
||||
; this memory block contains the sprite data
|
||||
@ -95,6 +96,8 @@ main {
|
||||
txt.print(" jiffies/fr = ")
|
||||
txt.print_ub(60/c64.TIME_LO)
|
||||
txt.print(" fps")
|
||||
|
||||
; test_stack.test()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
%target c64
|
||||
%import syslib
|
||||
%import test_stack
|
||||
%import textio
|
||||
|
||||
main {
|
||||
@ -33,6 +34,8 @@ main {
|
||||
txt.print_ub(60/c64.TIME_LO)
|
||||
txt.print(" fps")
|
||||
c64.TIME_LO=0
|
||||
|
||||
; test_stack.test()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
%target cx16
|
||||
%import syslib
|
||||
%import test_stack
|
||||
%import conv
|
||||
|
||||
; TODO add all other Elite's ships, show their name, advance to next ship on keypress
|
||||
@ -41,6 +42,8 @@ main {
|
||||
anglex += 217
|
||||
angley -= 505
|
||||
anglez += 452
|
||||
|
||||
; test_stack.test()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
%import graphics
|
||||
%import test_stack
|
||||
|
||||
; Note: this program is compatible with C64 and CX16.
|
||||
|
||||
@ -6,8 +7,13 @@ main {
|
||||
|
||||
sub start() {
|
||||
graphics.enable_bitmap_mode()
|
||||
|
||||
draw_lines()
|
||||
draw_circles()
|
||||
|
||||
; graphics.disable_bitmap_mode()
|
||||
; test_stack.test()
|
||||
|
||||
repeat {
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
%import textio
|
||||
%import syslib
|
||||
%import test_stack
|
||||
%zeropage basicsafe
|
||||
|
||||
; Note: this program is compatible with C64 and CX16.
|
||||
@ -40,6 +41,8 @@ main {
|
||||
rect(10, 10, 10, 10, false)
|
||||
rect(6, 0, 16, 20, true)
|
||||
|
||||
; test_stack.test()
|
||||
|
||||
|
||||
sub rect(ubyte x1, ubyte y1, ubyte x2, ubyte y2, ubyte fill) {
|
||||
ubyte x
|
||||
|
@ -1,5 +1,6 @@
|
||||
%import graphics
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage floatsafe
|
||||
|
||||
; Draw a mandelbrot in graphics mode (the image will be 256 x 200 pixels).
|
||||
@ -44,6 +45,8 @@ main {
|
||||
}
|
||||
}
|
||||
|
||||
; test_stack.test()
|
||||
|
||||
repeat {
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage basicsafe
|
||||
|
||||
; Note: this program is compatible with C64 and CX16.
|
||||
@ -57,5 +58,7 @@ main {
|
||||
txt.print("finished in ")
|
||||
floats.print_f(duration)
|
||||
txt.print(" seconds!\n")
|
||||
|
||||
; test_stack.test()
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
%import textio
|
||||
%import conv
|
||||
%import test_stack
|
||||
%zeropage basicsafe
|
||||
|
||||
; The classic number guessing game.
|
||||
@ -59,6 +60,8 @@ main {
|
||||
txt.print("Thanks for playing, ")
|
||||
txt.print(name)
|
||||
txt.print(".\n")
|
||||
|
||||
; test_stack.test()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
%target c64
|
||||
%import syslib
|
||||
%import test_stack
|
||||
%import textio
|
||||
|
||||
; converted from plasma test program for cc65.
|
||||
@ -26,7 +27,7 @@ main {
|
||||
; ubyte v = c64.VMCSB
|
||||
c64.CIA2PRA = (block & $FC) | (lsb(SCREEN1 >> 14) ^ $03)
|
||||
|
||||
repeat {
|
||||
repeat 100 {
|
||||
doplasma(SCREEN1)
|
||||
c64.VMCSB = PAGE1
|
||||
doplasma(SCREEN2)
|
||||
@ -37,6 +38,9 @@ main {
|
||||
;c64.VMCSB = v
|
||||
;c64.CIA2PRA = block
|
||||
;txt.print("done!\n")
|
||||
;test_stack.test()
|
||||
;repeat {
|
||||
;}
|
||||
}
|
||||
|
||||
; several variables outside of doplasma to make them retain their value
|
||||
|
@ -1,4 +1,5 @@
|
||||
%import textio
|
||||
%import test_stack
|
||||
%zeropage basicsafe
|
||||
|
||||
; Note: this program is compatible with C64 and CX16.
|
||||
@ -26,6 +27,8 @@ main {
|
||||
txt.print("number of primes (expected 54): ")
|
||||
txt.print_ub(amount)
|
||||
txt.chrout('\n')
|
||||
|
||||
; test_stack.test()
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
%import textio
|
||||
%import test_stack
|
||||
%zeropage basicsafe
|
||||
|
||||
; Note: this program is compatible with C64 and CX16.
|
||||
@ -31,6 +32,7 @@ main {
|
||||
txt.print("reversed\n")
|
||||
print_arrays()
|
||||
|
||||
;test_stack.test()
|
||||
return
|
||||
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
%target c64
|
||||
%import syslib
|
||||
%import textio
|
||||
%import test_stack
|
||||
|
||||
|
||||
main {
|
||||
@ -67,6 +68,9 @@ waitkey:
|
||||
}
|
||||
|
||||
drawScore()
|
||||
|
||||
; txt.plot(0,0)
|
||||
; test_stack.test()
|
||||
}
|
||||
|
||||
ubyte key=c64.GETIN()
|
||||
|
@ -1,4 +1,5 @@
|
||||
%import textio
|
||||
%import test_stack
|
||||
%zeropage basicsafe
|
||||
|
||||
; Note: this program is compatible with C64 and CX16.
|
||||
@ -963,6 +964,9 @@ main {
|
||||
txt.print("ok\n")
|
||||
else
|
||||
txt.print("fail!!!\n")
|
||||
|
||||
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub wait_input() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
%import textio
|
||||
%import conv
|
||||
%import diskio
|
||||
%import test_stack
|
||||
%option no_sysinit
|
||||
%zeropage basicsafe
|
||||
|
||||
@ -26,6 +27,8 @@ main {
|
||||
planet.display(false)
|
||||
|
||||
repeat {
|
||||
; test_stack.test()
|
||||
|
||||
str input = "????????"
|
||||
txt.print("\nCash: ")
|
||||
util.print_10s(ship.cash)
|
||||
|
@ -1,6 +1,7 @@
|
||||
%target c64
|
||||
%import floats
|
||||
%import graphics
|
||||
%import test_stack
|
||||
%zeropage floatsafe
|
||||
|
||||
main {
|
||||
@ -18,6 +19,8 @@ main {
|
||||
turtle.rt(94)
|
||||
}
|
||||
|
||||
; test_stack.test()
|
||||
|
||||
repeat {
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user