fix examples for cx16 register syntax

This commit is contained in:
Irmen de Jong 2020-12-21 23:45:26 +01:00
parent 061e1be0a4
commit d22df22f7d
14 changed files with 224 additions and 161 deletions

View File

@ -117,8 +117,8 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
when(func.name) { when(func.name) {
"memset" -> { "memset" -> {
// use the ROM function of the Cx16 // use the ROM function of the Cx16
asmgen.assignExpressionToVariable(fcall.args[0], "cx16.r0", DataType.UWORD, scope) // TODO register R0 asmgen.assignExpressionToRegister(fcall.args[0], RegisterOrPair.R0)
asmgen.assignExpressionToVariable(fcall.args[1], "cx16.r1", DataType.UWORD, scope) // TODO register R1 asmgen.assignExpressionToRegister(fcall.args[1], RegisterOrPair.R1)
asmgen.assignExpressionToRegister(fcall.args[2], RegisterOrPair.A) asmgen.assignExpressionToRegister(fcall.args[2], RegisterOrPair.A)
val sub = (fcall as FunctionCallStatement).definingSubroutine()!! val sub = (fcall as FunctionCallStatement).definingSubroutine()!!
asmgen.saveRegister(CpuRegister.X, false, sub) asmgen.saveRegister(CpuRegister.X, false, sub)
@ -136,9 +136,9 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
} }
// use the ROM function of the Cx16 // use the ROM function of the Cx16
asmgen.assignExpressionToVariable(fcall.args[0], "cx16.r0", DataType.UWORD, scope) // TODO register R0 asmgen.assignExpressionToRegister(fcall.args[0], RegisterOrPair.R0)
asmgen.assignExpressionToVariable(fcall.args[1], "cx16.r1", DataType.UWORD, scope) // TODO register R1 asmgen.assignExpressionToRegister(fcall.args[1], RegisterOrPair.R1)
asmgen.assignExpressionToVariable(fcall.args[2], "cx16.r2", DataType.UWORD, scope) // TODO register R2 asmgen.assignExpressionToRegister(fcall.args[2], RegisterOrPair.R2)
val sub = (fcall as FunctionCallStatement).definingSubroutine()!! val sub = (fcall as FunctionCallStatement).definingSubroutine()!!
asmgen.saveRegister(CpuRegister.X, false, sub) asmgen.saveRegister(CpuRegister.X, false, sub)
asmgen.out(" jsr cx16.memory_copy") asmgen.out(" jsr cx16.memory_copy")

View File

@ -1381,7 +1381,15 @@ internal class ExpressionsAsmGen(private val program: Program, private val asmge
RegisterOrPair.R12, RegisterOrPair.R12,
RegisterOrPair.R13, RegisterOrPair.R13,
RegisterOrPair.R14, RegisterOrPair.R14,
RegisterOrPair.R15 -> TODO("cx16 register onto stack") RegisterOrPair.R15 -> {
asmgen.out("""
lda cx16.${reg.registerOrPair.toString().toLowerCase()}
sta P8ESTACK_LO,x
lda cx16.${reg.registerOrPair.toString().toLowerCase()}+1
sta P8ESTACK_HI,x
dex
""")
}
} }
} }
else if(reg.statusflag!=null) { else if(reg.statusflag!=null) {

View File

@ -703,7 +703,15 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
RegisterOrPair.R12, RegisterOrPair.R12,
RegisterOrPair.R13, RegisterOrPair.R13,
RegisterOrPair.R14, RegisterOrPair.R14,
RegisterOrPair.R15 -> TODO("assign stack byte to cx16 register") RegisterOrPair.R15 -> {
asmgen.out("""
inx
lda P8ESTACK_LO,x
sta cx16.${target.register.toString().toLowerCase()}
lda #0
sta cx16.${target.register.toString().toLowerCase()}+1
""")
}
else -> throw AssemblyError("can't assign byte from stack to register pair XY") else -> throw AssemblyError("can't assign byte from stack to register pair XY")
} }
} }
@ -727,7 +735,15 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
RegisterOrPair.R12, RegisterOrPair.R12,
RegisterOrPair.R13, RegisterOrPair.R13,
RegisterOrPair.R14, RegisterOrPair.R14,
RegisterOrPair.R15 -> TODO("assign stack word to cx16 register") RegisterOrPair.R15 -> {
asmgen.out("""
inx
lda P8ESTACK_LO,x
sta cx16.${target.register.toString().toLowerCase()}
lda P8ESTACK_HI,x
sta cx16.${target.register.toString().toLowerCase()}+1
""")
}
else -> throw AssemblyError("can't assign word to single byte register") else -> throw AssemblyError("can't assign word to single byte register")
} }
} }
@ -1127,7 +1143,14 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
RegisterOrPair.R12, RegisterOrPair.R12,
RegisterOrPair.R13, RegisterOrPair.R13,
RegisterOrPair.R14, RegisterOrPair.R14,
RegisterOrPair.R15 -> TODO("cx16 register assign byte var") RegisterOrPair.R15 -> {
asmgen.out("""
lda $sourceName
sta cx16.${target.register.toString().toLowerCase()}
lda #0
sta cx16.${target.register.toString().toLowerCase()}+1
""")
}
} }
} }
TargetStorageKind.STACK -> { TargetStorageKind.STACK -> {
@ -1299,7 +1322,13 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
RegisterOrPair.R12, RegisterOrPair.R12,
RegisterOrPair.R13, RegisterOrPair.R13,
RegisterOrPair.R14, RegisterOrPair.R14,
RegisterOrPair.R15 -> TODO("cx16 register assign from register A") RegisterOrPair.R15 -> {
asmgen.out("""
sta cx16.${target.register.toString().toLowerCase()}
ldy #0
sty cx16.${target.register.toString().toLowerCase()}+1
""")
}
} }
CpuRegister.X -> when(target.register!!) { CpuRegister.X -> when(target.register!!) {
RegisterOrPair.A -> { asmgen.out(" txa") } RegisterOrPair.A -> { asmgen.out(" txa") }
@ -1324,7 +1353,13 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
RegisterOrPair.R12, RegisterOrPair.R12,
RegisterOrPair.R13, RegisterOrPair.R13,
RegisterOrPair.R14, RegisterOrPair.R14,
RegisterOrPair.R15 -> TODO("cx16 register assign from register X") RegisterOrPair.R15 -> {
asmgen.out("""
stx cx16.${target.register.toString().toLowerCase()}
lda #0
sta cx16.${target.register.toString().toLowerCase()}+1
""")
}
} }
CpuRegister.Y -> when(target.register!!) { CpuRegister.Y -> when(target.register!!) {
RegisterOrPair.A -> { asmgen.out(" tya") } RegisterOrPair.A -> { asmgen.out(" tya") }
@ -1349,7 +1384,12 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
RegisterOrPair.R12, RegisterOrPair.R12,
RegisterOrPair.R13, RegisterOrPair.R13,
RegisterOrPair.R14, RegisterOrPair.R14,
RegisterOrPair.R15 -> TODO("cx16 register assign from register Y") RegisterOrPair.R15 -> {
asmgen.out("""
sty cx16.${target.register.toString().toLowerCase()}
lda #0
sta cx16.${target.register.toString().toLowerCase()}+1
""") }
} }
} }
} }
@ -1424,7 +1464,12 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
RegisterOrPair.R12, RegisterOrPair.R12,
RegisterOrPair.R13, RegisterOrPair.R13,
RegisterOrPair.R14, RegisterOrPair.R14,
RegisterOrPair.R15 -> TODO("assign reg.pair to cx16 register") RegisterOrPair.R15 -> {
asmgen.out("""
sta cx16.${target.register.toString().toLowerCase()}
stx cx16.${target.register.toString().toLowerCase()}+1
""")
}
else -> throw AssemblyError("expected reg pair") else -> throw AssemblyError("expected reg pair")
} }
RegisterOrPair.AY -> when(target.register!!) { RegisterOrPair.AY -> when(target.register!!) {
@ -1446,7 +1491,12 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
RegisterOrPair.R12, RegisterOrPair.R12,
RegisterOrPair.R13, RegisterOrPair.R13,
RegisterOrPair.R14, RegisterOrPair.R14,
RegisterOrPair.R15 -> TODO("assign reg.pair to cx16 register") RegisterOrPair.R15 -> {
asmgen.out("""
sta cx16.${target.register.toString().toLowerCase()}
sty cx16.${target.register.toString().toLowerCase()}+1
""")
}
else -> throw AssemblyError("expected reg pair") else -> throw AssemblyError("expected reg pair")
} }
RegisterOrPair.XY -> when(target.register!!) { RegisterOrPair.XY -> when(target.register!!) {
@ -1468,7 +1518,12 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
RegisterOrPair.R12, RegisterOrPair.R12,
RegisterOrPair.R13, RegisterOrPair.R13,
RegisterOrPair.R14, RegisterOrPair.R14,
RegisterOrPair.R15 -> TODO("assign reg.pair to cx16 register") RegisterOrPair.R15 -> {
asmgen.out("""
stx cx16.${target.register.toString().toLowerCase()}
sty cx16.${target.register.toString().toLowerCase()}+1
""")
}
else -> throw AssemblyError("expected reg pair") else -> throw AssemblyError("expected reg pair")
} }
else -> throw AssemblyError("expected reg pair") else -> throw AssemblyError("expected reg pair")
@ -1587,7 +1642,14 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
RegisterOrPair.R12, RegisterOrPair.R12,
RegisterOrPair.R13, RegisterOrPair.R13,
RegisterOrPair.R14, RegisterOrPair.R14,
RegisterOrPair.R15 -> TODO("cx16 register assign constant byte") RegisterOrPair.R15 -> {
asmgen.out("""
lda #${byte.toHex()}
sta cx16.${target.register.toString().toLowerCase()}
lda #0
sta cx16.${target.register.toString().toLowerCase()}+1
""")
}
} }
TargetStorageKind.STACK -> { TargetStorageKind.STACK -> {
asmgen.out(""" asmgen.out("""
@ -1772,7 +1834,14 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
RegisterOrPair.R12, RegisterOrPair.R12,
RegisterOrPair.R13, RegisterOrPair.R13,
RegisterOrPair.R14, RegisterOrPair.R14,
RegisterOrPair.R15 -> TODO("cx16 register assign memory byte") RegisterOrPair.R15 -> {
asmgen.out("""
lda ${address.toHex()}
sta cx16.${target.register.toString().toLowerCase()}
lda #0
sta cx16.${target.register.toString().toLowerCase()}+1
""")
}
} }
TargetStorageKind.STACK -> { TargetStorageKind.STACK -> {
asmgen.out(""" asmgen.out("""
@ -1819,7 +1888,13 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
RegisterOrPair.R12, RegisterOrPair.R12,
RegisterOrPair.R13, RegisterOrPair.R13,
RegisterOrPair.R14, RegisterOrPair.R14,
RegisterOrPair.R15 -> TODO("cx16 register assign memory byte") RegisterOrPair.R15 -> {
asmgen.out("""
sta cx16.${target.register.toString().toLowerCase()}
lda #0
sta cx16.${target.register.toString().toLowerCase()}+1
""")
}
} }
} }
TargetStorageKind.STACK -> { TargetStorageKind.STACK -> {

View File

@ -2,6 +2,7 @@
TODO TODO
==== ====
- add target() function that returns 16=cx16, 64=C64
- Cx16 target: support full-screen 640x480 and 320x240 graphics? That requires our own custom graphics routines though to draw lines. - Cx16 target: support full-screen 640x480 and 320x240 graphics? That requires our own custom graphics routines though to draw lines.
- hoist all variable declarations up to the subroutine scope *before* even the constant folding takes place (to avoid undefined symbol errors when referring to a variable from another nested scope in the subroutine) - hoist all variable declarations up to the subroutine scope *before* even the constant folding takes place (to avoid undefined symbol errors when referring to a variable from another nested scope in the subroutine)
- make it possible to use cpu opcodes such as 'nop' as variable names by prefixing all asm vars with something such as '_' - make it possible to use cpu opcodes such as 'nop' as variable names by prefixing all asm vars with something such as '_'

View File

@ -5,72 +5,72 @@
main { main {
sub start() { sub start() {
ubyte A ubyte a
txt.print("ubyte shift left\n") txt.print("ubyte shift left\n")
A = shiftlb0() a = shiftlb0()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftlb1() a = shiftlb1()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftlb2() a = shiftlb2()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftlb3() a = shiftlb3()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftlb4() a = shiftlb4()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftlb5() a = shiftlb5()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftlb6() a = shiftlb6()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftlb7() a = shiftlb7()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftlb8() a = shiftlb8()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftlb9() a = shiftlb9()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
txt.print("enter to continue:\n") txt.print("enter to continue:\n")
void c64.CHRIN() void c64.CHRIN()
txt.print("ubyte shift right\n") txt.print("ubyte shift right\n")
A = shiftrb0() a = shiftrb0()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftrb1() a = shiftrb1()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftrb2() a = shiftrb2()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftrb3() a = shiftrb3()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftrb4() a = shiftrb4()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftrb5() a = shiftrb5()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftrb6() a = shiftrb6()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftrb7() a = shiftrb7()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftrb8() a = shiftrb8()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
A = shiftrb9() a = shiftrb9()
txt.print_ubbin(A, true) txt.print_ubbin(a, true)
c64.CHROUT('\n') c64.CHROUT('\n')
txt.print("enter to continue:\n") txt.print("enter to continue:\n")
void c64.CHRIN() void c64.CHRIN()

View File

@ -8,7 +8,7 @@ main {
txt.plot(0,24) txt.plot(0,24)
ubyte Y ubyte y
ubyte ub=200 ubyte ub=200
byte bb=-100 byte bb=-100
uword uw = 2000 uword uw = 2000
@ -33,9 +33,9 @@ main {
flarr[1] ++ flarr[1] ++
check_ub(ub, 201) check_ub(ub, 201)
Y=100 y=100
Y++ y++
check_ub(Y, 101) check_ub(y, 101)
check_fl(fl, 1000.99) check_fl(fl, 1000.99)
check_b(bb, -99) check_b(bb, -99)
check_uw(uw, 2001) check_uw(uw, 2001)
@ -64,9 +64,9 @@ main {
flarr[1] -- flarr[1] --
check_ub(ub, 200) check_ub(ub, 200)
Y=100 y=100
Y-- y--
check_ub(Y, 99) check_ub(y, 99)
check_fl(fl, 999.99) check_fl(fl, 999.99)
check_b(bb, -100) check_b(bb, -100)
check_uw(uw, 2000) check_uw(uw, 2000)

View File

@ -72,12 +72,6 @@ bmp_module {
height = graphics.HEIGHT-1 height = graphics.HEIGHT-1
} }
sub set_cursor(uword x, uword y) {
cx16.r0=offsetx+x
cx16.r1=offsety+y
cx16.FB_cursor_position()
}
sub decode_bitmap() { sub decode_bitmap() {
start_plot() start_plot()
uword bits_width = width * bpp uword bits_width = width * bpp
@ -87,7 +81,7 @@ bmp_module {
uword y uword y
ubyte b ubyte b
for y in height-1 downto 0 { for y in height-1 downto 0 {
set_cursor(0, y) cx16.FB_cursor_position(offsetx, offsety+y)
when bpp { when bpp {
8 -> { 8 -> {
for x in 0 to width-1 for x in 0 to width-1

View File

@ -139,12 +139,6 @@ iff_module {
height = graphics.HEIGHT-1 height = graphics.HEIGHT-1
} }
sub set_cursor(uword x, uword y) {
cx16.r0=offsetx+x
cx16.r1=offsety+y
cx16.FB_cursor_position()
}
sub decode_raw() { sub decode_raw() {
start_plot() start_plot()
ubyte interlaced = (camg & $0004) != 0 ubyte interlaced = (camg & $0004) != 0
@ -153,7 +147,7 @@ iff_module {
void diskio.f_read(scanline_data_ptr, interleave_stride) void diskio.f_read(scanline_data_ptr, interleave_stride)
if interlaced if interlaced
void diskio.f_read(scanline_data_ptr, interleave_stride) void diskio.f_read(scanline_data_ptr, interleave_stride)
set_cursor(0, y) cx16.FB_cursor_position(offsetx, offsety+y)
planar_to_chunky_scanline() planar_to_chunky_scanline()
} }
} }
@ -166,7 +160,7 @@ iff_module {
decode_rle_scanline() decode_rle_scanline()
if interlaced if interlaced
decode_rle_scanline() decode_rle_scanline()
set_cursor(0, y) cx16.FB_cursor_position(offsetx, offsety+y)
planar_to_chunky_scanline() planar_to_chunky_scanline()
} }
} }

View File

@ -40,9 +40,7 @@ koala_module {
for cy in 0 to 24*8 step 8 { for cy in 0 to 24*8 step 8 {
for cx in 0 to 39 { for cx in 0 to 39 {
for d in 0 to 7 { for d in 0 to 7 {
cx16.r0 = cx as uword * 8 cx16.FB_cursor_position(cx as uword * 8, cy as uword + d)
cx16.r1 = cy as uword + d
cx16.FB_cursor_position()
get_8_pixels() get_8_pixels()
cx16.FB_set_pixels(pixels, 8) cx16.FB_set_pixels(pixels, 8)
} }

View File

@ -83,23 +83,17 @@ bitmap {
status = (not c64.READST()) or c64.READST()==64 status = (not c64.READST()) or c64.READST()==64
} }
sub set_cursor(uword x, uword y) {
cx16.r0=offsetx+x
cx16.r1=offsety+y
cx16.FB_cursor_position()
}
sub next_scanline() { sub next_scanline() {
px = 0 px = 0
py++ py++
y_ok = py < graphics.HEIGHT-1 y_ok = py < graphics.HEIGHT-1
set_cursor(0, py) cx16.FB_cursor_position(offsetx, offsety+py)
status = (not c64.READST()) or c64.READST()==64 status = (not c64.READST()) or c64.READST()==64
} }
sub do1bpp(uword width, uword height) -> ubyte { sub do1bpp(uword width, uword height) -> ubyte {
start_plot(width, height) start_plot(width, height)
set_cursor(0, 0) cx16.FB_cursor_position(offsetx, offsety)
while py < height and status { while py < height and status {
ubyte b = c64.CHRIN() ubyte b = c64.CHRIN()
if b>>6==3 { if b>>6==3 {
@ -124,7 +118,7 @@ bitmap {
sub do4bpp(uword width, uword height) -> ubyte { sub do4bpp(uword width, uword height) -> ubyte {
start_plot(width, height) start_plot(width, height)
set_cursor(0, 0) cx16.FB_cursor_position(offsetx, offsety)
while py < height and status { while py < height and status {
ubyte b = c64.CHRIN() ubyte b = c64.CHRIN()
if b>>6==3 { if b>>6==3 {
@ -152,7 +146,7 @@ bitmap {
sub do8bpp(uword width, uword height) -> ubyte { sub do8bpp(uword width, uword height) -> ubyte {
start_plot(width, height) start_plot(width, height)
set_cursor(0, 0) cx16.FB_cursor_position(offsetx, offsety)
while py < height and status { while py < height and status {
ubyte b = c64.CHRIN() ubyte b = c64.CHRIN()
if b>>6==3 { if b>>6==3 {

View File

@ -10,8 +10,8 @@ main {
void diskio.directory(8) void diskio.directory(8)
txt.chrout('\n') txt.chrout('\n')
if diskio.lf_start_list(8, "cub", false) { if diskio.lf_start_list(8, "nier", false) {
txt.print("\nfiles starting with 'cub':\n") txt.print("\nfiles starting with 'nier':\n")
while diskio.lf_next_entry() { while diskio.lf_next_entry() {
txt.print(diskio.list_filename) txt.print(diskio.list_filename)
txt.print(" ") txt.print(" ")
@ -23,8 +23,8 @@ main {
txt.print("error\n") txt.print("error\n")
} }
if diskio.lf_start_list(8, "gfx", true) { if diskio.lf_start_list(8, "pcx", true) {
txt.print("\nfiles ending with 'gfx':\n") txt.print("\nfiles ending with 'pcx':\n")
while diskio.lf_next_entry() { while diskio.lf_next_entry() {
txt.print(diskio.list_filename) txt.print(diskio.list_filename)
txt.print(" ") txt.print(" ")

View File

@ -29,7 +29,7 @@ main {
&uword[4] muwarray = $c000 &uword[4] muwarray = $c000
&float[4] mflarray = $c000 &float[4] mflarray = $c000
ubyte A ubyte a
byte bb byte bb
ubyte ub ubyte ub
word ww word ww
@ -37,14 +37,14 @@ main {
float fl float fl
; read array ; read array
A=s1[2] a=s1[2]
ub=s1[2] ub=s1[2]
bb=barray[2] bb=barray[2]
ub=ubarray[2] ub=ubarray[2]
ww=warray[2] ww=warray[2]
uw=uwarray[2] uw=uwarray[2]
fl=flarray[2] fl=flarray[2]
A=ms1[2] a=ms1[2]
ub=ms1[2] ub=ms1[2]
bb=mbarray[2] bb=mbarray[2]
ub=mubarray[2] ub=mubarray[2]
@ -52,29 +52,29 @@ main {
uw=muwarray[2] uw=muwarray[2]
fl=mflarray[2] fl=mflarray[2]
A=s1[A] a=s1[a]
ub=s1[A] ub=s1[a]
bb=barray[A] bb=barray[a]
ub=ubarray[A] ub=ubarray[a]
ww=warray[A] ww=warray[a]
uw=uwarray[A] uw=uwarray[a]
fl=flarray[A] fl=flarray[a]
A=ms1[A] a=ms1[a]
ub=ms1[A] ub=ms1[a]
bb=mbarray[A] bb=mbarray[a]
ub=mubarray[A] ub=mubarray[a]
ww=mwarray[A] ww=mwarray[a]
uw=muwarray[A] uw=muwarray[a]
fl=mflarray[A] fl=mflarray[a]
A=s1[bb] a=s1[bb]
ub=s1[bb] ub=s1[bb]
bb=barray[bb] bb=barray[bb]
ub=ubarray[bb] ub=ubarray[bb]
ww=warray[bb] ww=warray[bb]
uw=uwarray[bb] uw=uwarray[bb]
fl=flarray[bb] fl=flarray[bb]
A=ms1[bb] a=ms1[bb]
ub=ms1[bb] ub=ms1[bb]
bb=mbarray[bb] bb=mbarray[bb]
ub=mubarray[bb] ub=mubarray[bb]
@ -82,14 +82,14 @@ main {
uw=muwarray[bb] uw=muwarray[bb]
fl=mflarray[bb] fl=mflarray[bb]
; A=s1[bb*3] ; a=s1[bb*3]
; ub=s1[bb*3] ; ub=s1[bb*3]
; bb=barray[bb*3] ; bb=barray[bb*3]
; ub=ubarray[bb*3] ; ub=ubarray[bb*3]
; ww=warray[bb*3] ; ww=warray[bb*3]
; uw=uwarray[bb*3] ; uw=uwarray[bb*3]
; fl=flarray[bb*3] ; fl=flarray[bb*3]
; A=ms1[bb*3] ; a=ms1[bb*3]
; ub=ms1[bb*3] ; ub=ms1[bb*3]
; bb=mbarray[bb*3] ; bb=mbarray[bb*3]
; ub=mubarray[bb*3] ; ub=mubarray[bb*3]
@ -100,14 +100,14 @@ main {
; write array ; write array
barray[2]++ barray[2]++
barray[2]-- barray[2]--
s1[2] = A s1[2] = a
s1[2] = ub s1[2] = ub
barray[2] = bb barray[2] = bb
ubarray[2] = ub ubarray[2] = ub
warray[2] = ww warray[2] = ww
uwarray[2] = uw uwarray[2] = uw
flarray[2] = fl flarray[2] = fl
ms1[2] = A ms1[2] = a
ms1[2] = ub ms1[2] = ub
mbarray[2]++ mbarray[2]++
mbarray[2] = bb mbarray[2] = bb
@ -117,12 +117,12 @@ main {
muwarray[2] = uw muwarray[2] = uw
mflarray[2] = fl mflarray[2] = fl
s1[A] = ub s1[a] = ub
barray[A] = bb barray[a] = bb
ubarray[A] = ub ubarray[a] = ub
warray[A] = ww warray[a] = ww
uwarray[A] = uw uwarray[a] = uw
flarray[A] = fl flarray[a] = fl
s1[bb] = ub s1[bb] = ub
barray[bb] = bb barray[bb] = bb

View File

@ -16,7 +16,7 @@ main {
ubyte ub ubyte ub
byte bb byte bb
word total word total
ubyte A ubyte a
txt.plot(0,24) txt.plot(0,24)
@ -24,8 +24,8 @@ main {
count = 0 count = 0
total = 0 total = 0
txt.print("a in string: ") txt.print("a in string: ")
for A in "hello" { for a in "hello" {
aa=A aa=a
count++ count++
total += aa total += aa
} }
@ -37,8 +37,8 @@ main {
count = 0 count = 0
total = 0 total = 0
txt.print("a in arrayliteral: ") txt.print("a in arrayliteral: ")
for A in [1,3,5,99] { for a in [1,3,5,99] {
aa=A aa=a
count++ count++
total += aa total += aa
} }
@ -50,8 +50,8 @@ main {
count = 0 count = 0
total = 0 total = 0
txt.print("a in arrayvar: ") txt.print("a in arrayvar: ")
for A in ubarr { for a in ubarr {
aa=A aa=a
count++ count++
total += aa total += aa
} }
@ -63,8 +63,8 @@ main {
count = 0 count = 0
total = 0 total = 0
txt.print("a in range step 1: ") txt.print("a in range step 1: ")
for A in 10 to 20 { for a in 10 to 20 {
aa=A aa=a
count++ count++
total += aa total += aa
} }
@ -76,8 +76,8 @@ main {
count = 0 count = 0
total = 0 total = 0
txt.print("a in range step -1: ") txt.print("a in range step -1: ")
for A in 20 downto 10 { for a in 20 downto 10 {
aa=A aa=a
count++ count++
total += aa total += aa
} }
@ -89,8 +89,8 @@ main {
count = 0 count = 0
total = 0 total = 0
txt.print("a in range step 3: ") txt.print("a in range step 3: ")
for A in 10 to 21 step 3 { for a in 10 to 21 step 3 {
aa=A aa=a
count++ count++
total += aa total += aa
} }
@ -102,8 +102,8 @@ main {
count = 0 count = 0
total = 0 total = 0
txt.print("a in rangeincl step 3: ") txt.print("a in rangeincl step 3: ")
for A in 10 to 22 step 3 { for a in 10 to 22 step 3 {
aa=A aa=a
count++ count++
total += aa total += aa
} }
@ -115,8 +115,8 @@ main {
count = 0 count = 0
total = 0 total = 0
txt.print("a in range step -3: ") txt.print("a in range step -3: ")
for A in 24 to 10 step -3 { for a in 24 to 10 step -3 {
aa=A aa=a
count++ count++
total += aa total += aa
} }
@ -128,8 +128,8 @@ main {
count = 0 count = 0
total = 0 total = 0
txt.print("a in rangeincl step -3: ") txt.print("a in rangeincl step -3: ")
for A in 24 to 9 step -3 { for a in 24 to 9 step -3 {
aa=A aa=a
count++ count++
total += aa total += aa
} }
@ -142,8 +142,8 @@ main {
total = 0 total = 0
endub1=101 endub1=101
txt.print("a in ncrange step 1: ") txt.print("a in ncrange step 1: ")
for A in 95 to endub1 step 1 { for a in 95 to endub1 step 1 {
aa=A aa=a
count++ count++
total += aa total += aa
} }
@ -156,8 +156,8 @@ main {
total = 0 total = 0
endub1=101 endub1=101
txt.print("a in ncrange step -1: ") txt.print("a in ncrange step -1: ")
for A in endub1 downto 95 { for a in endub1 downto 95 {
aa=A aa=a
count++ count++
total += aa total += aa
} }
@ -170,8 +170,8 @@ main {
total = 0 total = 0
endub1=105 endub1=105
txt.print("a in ncrange step 3: ") txt.print("a in ncrange step 3: ")
for A in 95 to endub1 step 3 { for a in 95 to endub1 step 3 {
aa=A aa=a
count++ count++
total += aa total += aa
} }
@ -184,8 +184,8 @@ main {
total = 0 total = 0
endub1=105 endub1=105
txt.print("a in ncrange step -3: ") txt.print("a in ncrange step -3: ")
for A in endub1 to 95 step -3 { for a in endub1 to 95 step -3 {
aa=A aa=a
count++ count++
total += aa total += aa
} }
@ -198,8 +198,8 @@ main {
total = 0 total = 0
endub1=107 endub1=107
txt.print("a in ncrangeinc step 3: ") txt.print("a in ncrangeinc step 3: ")
for A in 95 to endub1 step 3 { for a in 95 to endub1 step 3 {
aa=A aa=a
count++ count++
total += aa total += aa
} }
@ -212,8 +212,8 @@ main {
total = 0 total = 0
endub1=107 endub1=107
txt.print("a in ncrangeinc step -3: ") txt.print("a in ncrangeinc step -3: ")
for A in endub1 to 95 step -3 { for a in endub1 to 95 step -3 {
aa=A aa=a
count++ count++
total += aa total += aa
} }

View File

@ -100,7 +100,7 @@ trader {
txt.print("ok\n") txt.print("ok\n")
} else { } else {
txt.print("\ni/o error: ") txt.print("\ni/o error: ")
diskio.status(8) txt.print(diskio.status(8))
txt.chrout('\n') txt.chrout('\n')
return return
} }
@ -128,7 +128,7 @@ trader {
txt.print("ok\n") txt.print("ok\n")
} else { } else {
txt.print("\ni/o error: ") txt.print("\ni/o error: ")
diskio.status(8) txt.print(diskio.status(8))
txt.chrout('\n') txt.chrout('\n')
} }
} }
@ -927,7 +927,6 @@ planet {
util { util {
sub prefix_matches(uword prefixptr, uword stringptr) -> ubyte { sub prefix_matches(uword prefixptr, uword stringptr) -> ubyte {
ubyte ix=0
repeat { repeat {
ubyte pc = @(prefixptr) ubyte pc = @(prefixptr)
ubyte sc = @(stringptr) ubyte sc = @(stringptr)