Skip to content

Commit

Permalink
-r option to override default bar row
Browse files Browse the repository at this point in the history
  • Loading branch information
datajerk committed Apr 23, 2017
1 parent 62fc5ab commit 3731f93
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 46 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Windows/MinGW:

```
usage: c2d [-vh?]
c2d [-bum] [-t filename] [-s start address override] input[.mon],[load_address] output.dsk
c2d [-bum] [-r row] [-t filename] [-s start address override] input[.mon],[load_address] output.dsk
-h|? this help
-m jump to monitor after booting
Expand All @@ -60,6 +60,7 @@ usage: c2d [-vh?]
The splash screen will display while the binary is loading
-u do not patch screen holes
-b animated loading bar (experimental)
-r override row default of 19 with 'row'
-v print version number and exit
Input without a .mon extension is assumed to be a binary with a 4 byte header.
Expand Down
18 changes: 4 additions & 14 deletions asm/bar.s
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ rwts = $B7B5 ; rwts jsr
stage1 = $800
stage2 = $300 ; $300 looks open
invsp = $20 ; inverse space for draw
;;;run time
trkcnt = $00 ; track counter
segcnt = $01 ; loop var
buffer = $02 ; MSB of RWTS buffer
Expand Down Expand Up @@ -114,9 +113,9 @@ secloop:
bne nodraw ; if bar,x = barcnt draw bar
lda barptr ; get position
;clc
;adc #5 ; intend
;adc #5 ; indent
sta ch
lda #19 ; row 19
lda row ; row 19
jsr movecur
lda #invsp
jsr cout
Expand Down Expand Up @@ -152,16 +151,7 @@ loadpage:
.org *+1
nextjump:
.org *+2
row:
.org *+1
bar:
.org *+40
;;; used for debug
;trkcnt:
; .org *+1
;segcnt:
; .org *+1
;buffer:
; .org *+1
;secnum:
; .org *+1
;trknum:
; .org *+1
Binary file modified bin/c2d
Binary file not shown.
Binary file modified bin/c2d.exe
Binary file not shown.
Binary file modified bin/page2text.exe
Binary file not shown.
Binary file modified bin/text2page.exe
Binary file not shown.
16 changes: 11 additions & 5 deletions c2d.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
c2d, Code to Disk, Version 0.54
c2d, Code to Disk, Version 0.55
(c) 2012,2017 All Rights Reserved, Egan Ford ([email protected])
Expand Down Expand Up @@ -43,7 +43,7 @@ Based on work by:
#include "c2d.h"
#include "holes.h"

#define VERSION "Version 0.54"
#define VERSION "Version 0.55"
#define INFILE argv[argc-2]
#define OUTFILE argv[argc-1]
#define BINARY 0
Expand All @@ -57,13 +57,13 @@ int main(int argc, char **argv)
{
FILE *ifp, *ofp;
int c, i, j, k, start = 0, loadaddress, inputtype, warm = 0, filesize = 0, unpatch = 0;
int loaderstart, loader = 0, loadersize = 0, loaderbasesize = 0, textpagesize = 0, bar = 0;
int loaderstart, loader = 0, loadersize = 0, loaderbasesize = 0, textpagesize = 0, bar = 0, row = 19;
struct stat st;
char *filetypes[] = { "BINARY", "MONITOR" };
char *ext, filename[256], load_address[10], *textpage = NULL;

opterr = 1;
while ((c = getopt(argc, argv, "t:vmh?s:ub")) != -1)
while ((c = getopt(argc, argv, "r:t:vmh?s:ub")) != -1)
switch (c) {
case 't': // load a splash page while loading binary
loader = 1;
Expand All @@ -80,6 +80,9 @@ int main(int argc, char **argv)
warm = 0;
start = (int) strtol(optarg, (char **) NULL, 16); // todo: input check
break;
case 'r': // bar row
row = (int) strtol(optarg, (char **) NULL, 10); // todo: input check
break;
case 'u':
unpatch = 1;
break;
Expand Down Expand Up @@ -273,8 +276,11 @@ int main(int argc, char **argv)
int bar_length = 40;
int i;

// bar row
blank.track[1].sector[4].byte[loadersize + 5] = row;

for(i = 1; i <= bar_length; i++)
blank.track[1].sector[4].byte[loadersize + 4 + i] = i * num_sectors / bar_length;
blank.track[1].sector[4].byte[loadersize + 5 + i] = i * num_sectors / bar_length;
}

loaderstart = 0x400;
Expand Down
41 changes: 16 additions & 25 deletions c2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ typedef struct d {

const char *usagetext="\n\
usage: c2d [-vh?]\n\
c2d [-bum] [-t filename] [-s start address override] input[.mon],[load_address] output.dsk\n\
c2d [-bum] [-r row] [-t filename] [-s start address override] input[.mon],[load_address] output.dsk\n\
\n\
-h|? this help\n\
-m jump to monitor after booting\n\
Expand All @@ -22,6 +22,7 @@ usage: c2d [-vh?]\n\
The splash screen will display while the binary is loading\n\
-u do not patch screen holes\n\
-b animated loading bar (experimental)\n\
-r override row default of 19 with 'row'\n\
-v print version number and exit\n\
\n\
Input without a .mon extension is assumed to be a binary with a 4 byte header.\n\
Expand Down Expand Up @@ -9193,7 +9194,6 @@ rwts = $B7B5 ; rwts jsr
stage1 = $800
stage2 = $300 ; $300 looks open
invsp = $20 ; inverse space for draw
;;;run time
trkcnt = $00 ; track counter
segcnt = $01 ; loop var
buffer = $02 ; MSB of RWTS buffer
Expand Down Expand Up @@ -9283,9 +9283,9 @@ barptr = $06 ; bar pointer
bne nodraw ; if bar,x = barcnt draw bar
lda barptr ; get position
;clc
;adc #5 ; intend
;adc #5 ; indent
sta ch
lda #19 ; row 19
lda row ; row 19
jsr movecur
lda #invsp
jsr cout
Expand Down Expand Up @@ -9321,39 +9321,30 @@ barptr = $06 ; bar pointer
.org *+1
nextjump:
.org *+2
row:
.org *+1
bar:
.org *+40
;;; used for debug
;trkcnt:
; .org *+1
;segcnt:
; .org *+1
;buffer:
; .org *+1
;secnum:
; .org *+1
;trknum:
; .org *+1
*/
unsigned char barcode[] = {
0xA9,0x00,0x85,0x05,0x85,0x06,0xA9,0x01,
0xA0,0x0C,0x99,0xE8,0xB7,0xA9,0x00,0xA0,
0x08,0x99,0xE8,0xB7,0xA9,0x02,0x85,0x04,
0xA2,0x00,0xBD,0x28,0x08,0x9D,0x00,0x03,
0xE8,0xE0,0xD0,0xD0,0xF5,0x4C,0x00,0x03,
0xAD,0x72,0x03,0x85,0x02,0xAE,0x70,0x03,
0xAD,0x73,0x03,0x85,0x02,0xAE,0x71,0x03,
0xCA,0xCA,0x86,0x00,0xA5,0x04,0xA0,0x04,
0x99,0xE8,0xB7,0xA5,0x00,0xD0,0x05,0xAD,
0x71,0x03,0x10,0x02,0xA9,0x0F,0x85,0x03,
0x72,0x03,0x10,0x02,0xA9,0x0F,0x85,0x03,
0xA5,0x03,0xA0,0x05,0x99,0xE8,0xB7,0xA5,
0x02,0x18,0x65,0x03,0xA0,0x09,0x99,0xE8,
0xB7,0xA0,0xE8,0xA9,0xB7,0x20,0xB5,0xB7,
0xB0,0x33,0xA9,0x00,0x85,0x48,0xE6,0x05,
0xA6,0x06,0xBD,0x75,0x03,0xC5,0x05,0xD0,
0x10,0xA5,0x06,0x85,0x24,0xA9,0x13,0x20,
0x5B,0xFB,0xA9,0x20,0x20,0xED,0xFD,0xE6,
0x06,0xC6,0x03,0x10,0xC3,0xA5,0x02,0x18,
0x69,0x10,0x85,0x02,0xE6,0x04,0xC6,0x00,
0x10,0xA2,0x6C,0x73,0x03,0x4C,0x69,0xFF

0xB0,0x34,0xA9,0x00,0x85,0x48,0xE6,0x05,
0xA6,0x06,0xBD,0x77,0x03,0xC5,0x05,0xD0,
0x11,0xA5,0x06,0x85,0x24,0xAD,0x76,0x03,
0x20,0x5B,0xFB,0xA9,0x20,0x20,0xED,0xFD,
0xE6,0x06,0xC6,0x03,0x10,0xC2,0xA5,0x02,
0x18,0x69,0x10,0x85,0x02,0xE6,0x04,0xC6,
0x00,0x10,0xA1,0x6C,0x74,0x03,0x4C,0x69,
0xFF
};
3 changes: 2 additions & 1 deletion c2d.h.0
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ typedef struct d {

const char *usagetext="\n\
usage: c2d [-vh?]\n\
c2d [-bum] [-t filename] [-s start address override] input[.mon],[load_address] output.dsk\n\
c2d [-bum] [-r row] [-t filename] [-s start address override] input[.mon],[load_address] output.dsk\n\
\n\
-h|? this help\n\
-m jump to monitor after booting\n\
Expand All @@ -22,6 +22,7 @@ usage: c2d [-vh?]\n\
The splash screen will display while the binary is loading\n\
-u do not patch screen holes\n\
-b animated loading bar (experimental)\n\
-r override row default of 19 with 'row'\n\
-v print version number and exit\n\
\n\
Input without a .mon extension is assumed to be a binary with a 4 byte header.\n\
Expand Down

0 comments on commit 3731f93

Please sign in to comment.