# HG changeset patch # User Matti Hamalainen # Date 1531394693 -10800 # Node ID c210b2e2cb47dd822d67cff3635907faf9b14ba2 # Parent 68e8d86c9eefa6c3c5d6fd1b8625cbdaf077932d Rename some methods. diff -r 68e8d86c9eef -r c210b2e2cb47 exporters.pde --- a/exporters.pde Mon Jul 09 19:34:36 2018 +0300 +++ b/exporters.pde Thu Jul 12 14:24:53 2018 +0300 @@ -56,7 +56,7 @@ return str; } - void label(String blabel) + void addLabel(String blabel) { eol(); m_src += blabel +":"; @@ -64,7 +64,7 @@ m_bytes = 0; } - void comment(String bstr) + void addComment(String bstr) { indent(); m_src += "; "+ bstr; @@ -82,7 +82,7 @@ eol(); } - void byteDef() + void addByteDef() { m_src += m_byteDef +" "; } @@ -97,7 +97,7 @@ m_src += getIndent(); } - void line(String str) + void addLine(String str) { m_src += str; eol(); @@ -120,7 +120,7 @@ { eol(); indent(); - byteDef(); + addByteDef(); m_bytes = 0; } else @@ -518,16 +518,16 @@ bool mpExportMachinePRG(MPWriteCtx ctx) { // any common text headers - ctx.comment("machine=" + str(machine) + " (" + g_name + ")"); + ctx.addComment("machine=" + str(machine) + " (" + g_name + ")"); if (machine == C64) { //C64 HIRES ctx.loadTemplate("c64show.prg"); ctx.setOffs(0x0227); - ctx.label("_bitmap"); + ctx.addLabel("_bitmap"); mpExportBitmapData(ctx, 40, 25); - ctx.comment("The following two first values are border and background"); + ctx.addComment("The following two first values are border and background"); ctx.writeByteAt(0x2167, g_map[0]); //=border ctx.writeByteAt(0x2168, g_map[1]); //=background mutta ei tarvita @@ -548,7 +548,7 @@ mpExportBitmapData(ctx, 40, 25); // first color information - ctx.comment("The following two first values are border and background"); + ctx.addComment("The following two first values are border and background"); ctx.writeByteAt(0x2179, g_map[0]); ctx.writeByteAt(0x217a, g_map[1]); @@ -557,7 +557,7 @@ // second color information ctx.setOffs(0x2563); - ctx.comment("The following goes to $D800 onwards"); + ctx.addComment("The following goes to $D800 onwards"); mpExportColorData(ctx, 40, 25, 65536 + 2000, 2); //c64 multicolor @@ -572,43 +572,43 @@ if (machine == PLUS4M) { //PLUS4 MULTICOLOR ctx.loadTemplate("showpfourm.prg"); - ctx.line(".global _bitmap"); - ctx.line(".global _color1"); - ctx.line(".global _color2"); - ctx.line(".global _border"); - ctx.line(".global _back1"); - ctx.line(".global _back2"); + ctx.addLine(".global _bitmap"); + ctx.addLine(".global _color1"); + ctx.addLine(".global _color2"); + ctx.addLine(".global _border"); + ctx.addLine(".global _back1"); + ctx.addLine(".global _back2"); - ctx.label("_bitmap"); + ctx.addLabel("_bitmap"); ctx.setOffs(0x013e); mpExportBitmapData(ctx, 40, 25); val1 = getpluscolor(int(g_map[0])); val2 = getplusluminance(int(g_map[0])); val3 = val2 * 16 + val1; - ctx.label("_border"); + ctx.addLabel("_border"); ctx.setOffs(0x207e); ctx.writeByte(val3); val1 = getpluscolor(int(g_map[1])); val2 = getplusluminance(int(g_map[1])); val3 = val2 * 16 + val1; - ctx.label("_back1"); + ctx.addLabel("_back1"); ctx.setOffs(0x207f); ctx.writeByte(val3); val1 = getpluscolor(int(g_map[2])); val2 = getplusluminance(int(g_map[2])); val3 = val2 * 16 + val1; - ctx.label("_back2"); + ctx.addLabel("_back2"); ctx.setOffs(0x2080); ctx.writeByte(val3); - ctx.label("_color1"); + ctx.addLabel("_color1"); ctx.setOffs(0x2081); mpExportColorData(ctx, 40, 25, 65536, 6); - ctx.label("_color2"); + ctx.addLabel("_color2"); ctx.setOffs(0x2469); mpExportColorData(ctx, 40, 25, 65536, 7); @@ -624,10 +624,10 @@ if (machine == PLUS4) { // Plus 4 hires ctx.loadTemplate("showpfour.prg"); - ctx.line(".global _bitmap"); - ctx.line(".global _color"); - ctx.line(".global _lumi"); - ctx.line(".global _border"); + ctx.addLine(".global _bitmap"); + ctx.addLine(".global _color"); + ctx.addLine(".global _lumi"); + ctx.addLine(".global _border"); ctx.setOffs(0x0137); mpExportBitmapData(ctx, 40, 25); @@ -653,17 +653,17 @@ else if (machine == MSX) { // MSX ctx.loadTemplate("msxshow.com"); - ctx.line(".globl _bitmap,_nimi2"); - ctx.line(".area _CODE"); + ctx.addLine(".globl _bitmap,_nimi2"); + ctx.addLine(".area _CODE"); ctx.setOffs(0x00f9); - ctx.label("_bitmap"); + ctx.addLabel("_bitmap"); mpExportBitmapData(ctx, 32, 24); //ctx.writeByte(g_map[1]); //backg - //ctx.comment("The first following value is background"); - ctx.label("_nimi2"); + //ctx.addComment("The first following value is background"); + ctx.addLabel("_nimi2"); ctx.setOffs(0x18f9); mpExportColorData(ctx, 32, 24, 65536, 3); //there's an exception for msx-style @@ -677,9 +677,9 @@ //would need some cleaning up - // ctx.line(".area _DATA\n"; - // ctx.line(".globl _taustakuva\n\n"; - // ctx.label("_taustakuva"); + // ctx.addLine(".area _DATA\n"; + // ctx.addLine(".globl _taustakuva\n\n"; + // ctx.addLabel("_taustakuva"); ctx.loadTemplate("specshow.tap"); int checksum = 0xc9; @@ -690,7 +690,7 @@ //TAP requires fiddling with the checksum //println("Checksum:"+hex(checksum,2)); ctx.setOffs(0x0223); - ctx.byteDef(); + ctx.addByteDef(); ctx.writeByte(g_map[0]); checksum = checksum ^ int(g_map[0]); @@ -717,7 +717,7 @@ } } - ctx.comment("attributes"); + ctx.addComment("attributes"); for (int y = 0; y < 24; y++) { for (int x = 0; x < 32; x++) @@ -754,13 +754,13 @@ ctx.loadTemplate("cpc-mode0.bin"); ctx.setOffs(69); //bitmap offset - ctx.label("_bitmap"); + ctx.addLabel("_bitmap"); mpExportBitmapData_CPC(ctx, 160, 200); //fixed # of palette entries, just trying to be generic ctx.setOffs(16453); ctx.setBPL(g_maxcolors - 1); - ctx.label("_palette"); + ctx.addLabel("_palette"); for (int i = 0; i < g_maxcolors; i++) { val1 = int(g_g[i] / (256 / g_palsteps)); @@ -775,7 +775,7 @@ val2 = int(g_r[valu] / (256 / g_palsteps)); val3 = int(g_b[valu] / (256 / g_palsteps)); - ctx.label("_border"); + ctx.addLabel("_border"); ctx.setOffs(16469); ctx.writeByte(val1 * 9 + val2 * 3 + val3); @@ -798,7 +798,7 @@ int pix1b0, pix1b1, pix1b2, pix1b3; ctx.setBPL(xwid / 2); - ctx.byteDef(); + ctx.addByteDef(); for (y2 = 0; y2 < 8; y2++) { @@ -833,7 +833,7 @@ ctx.writeByte(val2); } - ctx.byteDef(); + ctx.addByteDef(); for (int j = 0; j <= 47; j++) ctx.writeByte(0); ctx.eol(); @@ -849,7 +849,7 @@ ywid = yy * 8; ctx.setBPL(64); - ctx.byteDef(); + ctx.addByteDef(); for (int y = 0; y < yy; y++) for (int x = 0; x < xx; x++) { @@ -938,7 +938,7 @@ for (int yc = 0; yc < height; yc++) { - ctx.byteDef(); + ctx.addByteDef(); for (int xc = 0; xc < width; xc++) for (int yline = 0; yline <= myrpsi; yline++) {