Changeset 7cabd49 in thomson
- Timestamp:
- Mar 19, 2012, 7:51:49 AM (12 years ago)
- Branches:
- main
- Children:
- fe55aa5
- Parents:
- cc8f3af
- Location:
- code/C/HxCHost
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/C/HxCHost/Makefile
rcc8f3af r7cabd49 5 5 ifeq ($(TARGET),TO8) 6 6 CFLAGS += -DPLATFORM=8 7 endif 8 7 else 9 8 ifeq ($(TARGET),MO5) 10 9 CFLAGS += -DPLATFORM=5 10 else 11 # No target defined. Fail. 12 all: 13 echo "make TARGET=MO5 or make TARGET=TO8" 14 false 15 endif 11 16 endif 12 17 13 18 # System settings ----------------------------------------------- 14 CC=m6809-thomson-none-gcc 15 AS=m6809-thomson-none-as 19 PREFIX=m6809-thomson 20 CC=$(PREFIX)-gcc 21 AS=$(PREFIX)-as 16 22 17 23 # Generic rules ------------------------------------------------- … … 19 25 out_sap.hfe: out.sap 20 26 hxcfloppyemulator_convert out.sap -HFE 27 cp out_sap.hfe /mo5/MO5/ 28 unmount /mo5 29 rm -r /mo5 21 30 22 31 # Disk Image … … 26 35 27 36 # Linking 28 TEST.BIN: $(OBJECTS) 29 $(CC) -Os $(OBJECTS) -o TEST.BIN -Wl,--map -Wl,-Ttext,0x6100 -nostdlib -lgcc 37 TEST.BIN TEST.map: $(OBJECTS) TEST.script 38 #$(CC) -v -Os $(OBJECTS) -o TEST.BIN -Wl,--map -Wl,-m -Wl,-Ttext,0x6100 -nostdlib -lgcc 39 lwlink --decb $(OBJECTS) --output=TEST.BIN --map=TEST.map --script=TEST.script --library-path=/boot/home/config/lib/gcc/m6809-thomson/4.6.1 --library-path=/boot/home/config/m6809-thomson/lib -lgcc 30 40 31 41 #Compiling 32 42 obj/$(TARGET)/%.o: %.c obj/$(TARGET) 33 $(CC) $(CFLAGS) -c $< -o $@43 $(CC) -save-temps $(CFLAGS) -c $< -o $@ 34 44 35 45 obj/$(TARGET)/%.o: pff/%.c obj/$(TARGET) -
code/C/HxCHost/macros.h
rcc8f3af r7cabd49 4 4 #error "make TARGET=TO8 or make TARGET=MO5" 5 5 #endif 6 7 #define FCB "fcb" 6 8 7 9 /////////////////////////////////////// … … 40 42 /* MONITOR ENTRY POINTS */ 41 43 #define mon_putc(car) { \ 42 asm(" swi \t \t; MO5 monitor\n"\43 " .fcb \t2 \t; putc"\44 asm(" swi \n"\ 45 " fcb 2"\ 44 46 ::"B" ((unsigned char) (car))\ 45 47 ); \ … … 53 55 DKBUF = (unsigned int)buffer;\ 54 56 \ 55 asm(" swi \t \t; MO5 monitor\n"\56 " .fcb \t0x26 \t; DKCONT"\57 asm(" swi \n"\ 58 " fcb 0x26"\ 57 59 ); \ 58 60 } … … 68 70 DKBUF = (unsigned int)output; 69 71 70 asm(" swi \t \t; MO5 monitor\n"71 " .fcb \t0x26 \t; DKCONT"72 asm(" swi \n" 73 " fcb 0x26" 72 74 ); 73 75 -
code/C/HxCHost/main.c
rcc8f3af r7cabd49 9 9 void asm_write(); 10 10 11 #if PLATFORM == 5 12 #define DIRECTORY_BUFFER (FILINFO*)0x3000 13 #else 14 // Thomson TO8 code 15 #define DIRECTORY_BUFFER (FILINFO*)0xA000 16 #endif 11 FILINFO DIRECTORY_BUFFER[23]; 17 12 18 13 unsigned char mark[512 + 16] = "HxCFEDA"; … … 102 97 {"\x1B\x50\x0CHxC floppy emulator setup\r\n" 103 98 "UP/DOWN move - +/- change\r\n" 104 "space save - left quit\r\n "99 "space save - left quit\r\n\n" 105 100 "Step sound ", 16, 0}, 106 101 {"\r\nGUI sound ", 17, 0}, … … 112 107 }; 113 108 109 #define getcfg(off) *(char*)((int)confbuf+off) 110 #define putcfg(off, val) *(char*)((int)confbuf+off) = val 111 114 112 inline static void config() 115 113 { 116 unsigned char*confbuf[29];114 char confbuf[29]; 117 115 // If it's HXCSDFE.CFG, enter config mode 118 116 // Read the config part of the file … … 121 119 if (r != 0 || byteCount != 29) 122 120 { 123 my_puts("read error"); 121 my_puts("read error "); 122 printhex(r); 124 123 abort(); 125 124 } … … 133 132 mon_putc(selected == j ? 0x54: 0x50) // Blue 134 133 if(options[j].type) 135 printhex( *(confbuf+options[j].off));134 printhex(getcfg(options[j].off)); 136 135 else 137 my_puts( *(confbuf+options[j].off) ? "ON":"OFF");136 my_puts(getcfg(options[j].off) ? "ON":"OFF"); 138 137 mon_putc(0x1B); // Select back color 139 138 mon_putc(0x50); // Select back color … … 141 140 142 141 do { 143 asm(" SWI \t \t;\n"144 " .fcb \t0x0A\t;GETC\n");142 asm(" SWI\n" 143 " FCB 0x0A\n"); 145 144 } while(KEY == 0); 146 145 … … 170 169 } 171 170 // fall through 172 do {173 asm("SWI \t \t;\n"174 ".fcb \t0x0A\t;GETC\n");175 } while(KEY == 0);176 171 case 0x10: // LEFT 177 172 // Quit (without saving) … … 180 175 case 0x18: // DOWN 181 176 // select previous file 182 if (++selected > 7) selected = 7;177 if (++selected > 6) selected = 6; 183 178 // TODO previous page ? 184 179 break; … … 186 181 // decrease current option value 187 182 if(options[selected].type) 188 --*(c onfbuf+options[selected].off);183 --*(char*)((int)confbuf+options[selected].off); 189 184 else 190 *(confbuf+options[selected].off) = 0;185 putcfg(options[selected].off, 0); 191 186 break; 192 187 case 0x0B: // + 193 188 if(options[selected].type) 194 ++*(c onfbuf+options[selected].off);189 ++*(char*)((int)confbuf+options[selected].off); 195 190 else 196 *(confbuf+options[selected].off) = 0xFF;191 putcfg(options[selected].off, 0xFF); 197 192 break; 198 193 } … … 211 206 FATFS fs; 212 207 FRESULT r = pf_mount(&fs); 208 213 209 if (r != 0) { 214 210 my_puts("mount error "); … … 265 261 // Allow the user to select a file 266 262 do { 267 asm(" SWI \t \t;\n"268 " .fcb \t0x0A\t;GETC\n");263 asm(" SWI \n" 264 " fcb 0x0A\n"); 269 265 } while(KEY == 0); 270 266 … … 300 296 } else { 301 297 const char* cmp = HXCSDFECFG; 302 FRESULT res = pf_open(cmp);303 if (res) {304 my_puts("Can't open CFG file: ");305 printhex(res);306 exit(0);307 }308 298 if (*(long*)(fp->fname) == *(long*)(cmp) 309 299 && *(long*)(fp->fname + 4) == *(long*)(cmp+4) … … 311 301 ) 312 302 { 303 FRESULT res = pf_open(cmp); 304 if (res) { 305 my_puts("Can't open CFG file: "); 306 printhex(res); 307 exit(0); 308 } 313 309 config(); 314 310 } else { … … 316 312 // If it's an HFE file, load it in HxCSDFE.CFG, then reboot 317 313 314 // We need to open the file to get the starting cluster. 315 // This is a PFF "limitation". 316 pf_open(fp->fname); 317 long off = LD_DWORD(&fs.org_clust); 318 319 FRESULT res = pf_open(cmp); 320 if (res) { 321 my_puts("Can't open CFG file: "); 322 printhex(res); 323 exit(0); 324 } 325 pf_lseek(0x200); 326 327 int count = 12; 328 pf_write(fp->fname, count, &count); 329 count = 1; 330 pf_write(&fp->fattrib, count, &count); 331 count = 4; 332 pf_write(&off, count, &count); 333 off = LD_DWORD(&fp->fsize); 334 pf_write(&off, count, &count); 335 count = 17; 336 pf_write(fp->fname, count, &count); 337 pf_write(0,0,&count); 338 318 339 // reboot 319 exit(0); 340 asm(" SWI\n" 341 " FCB 0"); 320 342 } 321 343 } -
code/C/HxCHost/pff/diskio.c
rcc8f3af r7cabd49 96 96 97 97 DRESULT disk_writep ( 98 const BYTE* buff,/* Pointer to the data to be written, NULL:Initiate/Finalize write operation */ 98 const BYTE* buff, 99 /* Pointer to the data to be written, 100 * NULL:Initiate/Finalize write operation */ 99 101 DWORD sc /* Sector number (LBA) or Number of bytes to send */ 100 102 ) 101 103 { 102 104 static WORD ptr; 103 static char *wrbuf[256];105 static char wrbuf[256]; 104 106 // Separate buffer because we need to use map_sector, and it kills secbuf 105 107 … … 114 116 for(;ptr < 512; ++ptr) 115 117 { 116 *(wrbuf + ptr)= 0;118 wrbuf[ptr] = 0; 117 119 } 118 120 … … 126 128 for(int j = 0; j <sc;++j) 127 129 { 128 *(char*)(wrbuf+ptr) = *(char*)(ptr++ + buff); 130 wrbuf[ptr] = *(char*)(j+buff); 131 ++ptr; 129 132 } 133 mon_putc(' '); 130 134 } 131 135
Note:
See TracChangeset
for help on using the changeset viewer.