Browse Source

tools: use BASIC's new while loop

Also, increase STDIO_BUFSIZE to 0x40 so that those while loops work.
pull/85/head
Virgil Dupras 4 years ago
parent
commit
5b155a5c15
15 changed files with 27 additions and 41 deletions
  1. +1
    -1
      kernel/stdio.asm
  2. +1
    -1
      recipes/rc2014/eeprom/glue.asm
  3. +1
    -1
      recipes/rc2014/glue.asm
  4. +1
    -1
      recipes/rc2014/ps2/glue.asm
  5. +1
    -1
      recipes/rc2014/sdcard/glue.asm
  6. +3
    -3
      recipes/rc2014/zasm/glue.asm
  7. +1
    -1
      recipes/rc2014/zasm/user.h
  8. +1
    -1
      recipes/sms/glue.asm
  9. +1
    -1
      recipes/sms/kbd/glue.asm
  10. +1
    -1
      recipes/sms/romasm/glue.asm
  11. +1
    -1
      recipes/ti84/glue.asm
  12. +6
    -5
      tools/blkdump.c
  13. +0
    -1
      tools/emul/shell/glue.asm
  14. +4
    -8
      tools/memdump.c
  15. +4
    -14
      tools/upload.c

+ 1
- 1
kernel/stdio.asm View File

@@ -27,7 +27,7 @@
; *** Consts ***
; Size of the readline buffer. If a typed line reaches this size, the line is
; flushed immediately (same as pressing return).
.equ STDIO_BUFSIZE 0x20
.equ STDIO_BUFSIZE 0x40

; *** Variables ***
; Line buffer. We read types chars into this buffer until return is pressed


+ 1
- 1
recipes/rc2014/eeprom/glue.asm View File

@@ -40,7 +40,7 @@ jp aciaInt
; *** BASIC ***

; RAM space used in different routines for short term processing.
.equ SCRATCHPAD_SIZE 0x20
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE
.equ SCRATCHPAD AT28W_RAMEND
.inc "lib/util.asm"
.inc "lib/ari.asm"


+ 1
- 1
recipes/rc2014/glue.asm View File

@@ -25,7 +25,7 @@ jp aciaInt
; *** BASIC ***

; RAM space used in different routines for short term processing.
.equ SCRATCHPAD_SIZE 0x20
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE
.equ SCRATCHPAD STDIO_RAMEND
.inc "lib/util.asm"
.inc "lib/ari.asm"


+ 1
- 1
recipes/rc2014/ps2/glue.asm View File

@@ -24,7 +24,7 @@ jp init
; *** BASIC ***

; RAM space used in different routines for short term processing.
.equ SCRATCHPAD_SIZE 0x20
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE
.equ SCRATCHPAD STDIO_RAMEND
.inc "lib/util.asm"
.inc "lib/ari.asm"


+ 1
- 1
recipes/rc2014/sdcard/glue.asm View File

@@ -48,7 +48,7 @@ jp aciaInt
; *** BASIC ***

; RAM space used in different routines for short term processing.
.equ SCRATCHPAD_SIZE 0x20
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE
.equ SCRATCHPAD FS_RAMEND
.inc "lib/util.asm"
.inc "lib/ari.asm"


+ 3
- 3
recipes/rc2014/zasm/glue.asm View File

@@ -1,10 +1,10 @@
; classic RC2014 setup (8K ROM + 32K RAM) and a stock Serial I/O module
; The RAM module is selected on A15, so it has the range 0x8000-0xffff
.equ RAMSTART 0x8000
; Kernel RAMEND last check: 0x98f3
; Kernel RAMEND last check: 0x9933
; We allocate at least 0x100 bytes for the stack, which is why we have this
; threshold.
.equ RAMEND 0x9a00
.equ RAMEND 0x9b00
.equ USER_CODE RAMEND ; in sync with user.h
.equ ACIA_CTL 0x80 ; Control and status. RS off.
.equ ACIA_IO 0x81 ; Transmit. RS on.
@@ -67,7 +67,7 @@ jp aciaInt
; *** BASIC ***

; RAM space used in different routines for short term processing.
.equ SCRATCHPAD_SIZE 0x20
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE
.equ SCRATCHPAD FS_RAMEND
.inc "lib/util.asm"
.inc "lib/ari.asm"


+ 1
- 1
recipes/rc2014/zasm/user.h View File

@@ -1,4 +1,4 @@
.org 0x9a00
.org 0x9b00

; *** JUMP TABLE ***
.equ strncmp 0x03


+ 1
- 1
recipes/sms/glue.asm View File

@@ -27,7 +27,7 @@
; *** BASIC ***

; RAM space used in different routines for short term processing.
.equ SCRATCHPAD_SIZE 0x20
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE
.equ SCRATCHPAD STDIO_RAMEND
.inc "lib/util.asm"
.inc "lib/ari.asm"


+ 1
- 1
recipes/sms/kbd/glue.asm View File

@@ -29,7 +29,7 @@
; *** BASIC ***

; RAM space used in different routines for short term processing.
.equ SCRATCHPAD_SIZE 0x20
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE
.equ SCRATCHPAD STDIO_RAMEND
.inc "lib/util.asm"
.inc "lib/ari.asm"


+ 1
- 1
recipes/sms/romasm/glue.asm View File

@@ -77,7 +77,7 @@
; *** BASIC ***

; RAM space used in different routines for short term processing.
.equ SCRATCHPAD_SIZE 0x20
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE
.equ SCRATCHPAD FS_RAMEND
.inc "lib/util.asm"
.inc "lib/ari.asm"


+ 1
- 1
recipes/ti84/glue.asm View File

@@ -40,7 +40,7 @@
; *** BASIC ***

; RAM space used in different routines for short term processing.
.equ SCRATCHPAD_SIZE 0x20
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE
.equ SCRATCHPAD STDIO_RAMEND
.inc "lib/util.asm"
.inc "lib/ari.asm"


+ 6
- 5
tools/blkdump.c View File

@@ -21,17 +21,18 @@ int main(int argc, char **argv)
}

int fd = open(argv[1], O_RDWR|O_NOCTTY);
char s[3];
char s[0x30];
sendcmdp(fd, "i=0");
sprintf(s, "while i<0x%04x getb:puth a:i=i+1", bytecount);
sendcmd(fd, s);

for (int i=0; i<bytecount; i++) {
sendcmd(fd, "getb");
read(fd, s, 2); // read prompt
sendcmd(fd, "puth a");
read(fd, s, 2); // read hex pair
s[2] = 0; // null terminate
unsigned char c = strtol(s, NULL, 16);
putchar(c);
read(fd, s, 2); // read prompt
}
read(fd, s, 2); // read prompt
return 0;
}


+ 0
- 1
tools/emul/shell/glue.asm View File

@@ -61,7 +61,6 @@
.equ STDIO_RAMSTART BLOCKDEV_RAMEND
.equ STDIO_GETC emulGetC
.equ STDIO_PUTC emulPutC
.equ STDIO_BUFSIZE 0x40 ; override
.inc "stdio.asm"

.equ FS_RAMSTART STDIO_RAMEND


+ 4
- 8
tools/memdump.c View File

@@ -28,22 +28,18 @@ int main(int argc, char **argv)
}

int fd = open(argv[1], O_RDWR|O_NOCTTY);
char s[0x20];
char s[0x30];
sprintf(s, "m=0x%04x", memptr);
sendcmdp(fd, s);
sprintf(s, "while m<0x%04x peek m:puth a:m=m+1", memptr+bytecount);
sendcmd(fd, s);
read(fd, s, 2); // read prompt

for (int i=0; i<bytecount; i++) {
sendcmd(fd, "peek m");
read(fd, s, 2); // read prompt
sendcmd(fd, "puth a");
read(fd, s, 2); // read hex pair
s[2] = 0; // null terminate
unsigned char c = strtol(s, NULL, 16);
putchar(c);
read(fd, s, 2); // read prompt
sendcmd(fd, "m=m+1");
read(fd, s, 2); // read prompt
}
read(fd, s, 2); // read prompt
return 0;
}

+ 4
- 14
tools/upload.c View File

@@ -5,10 +5,8 @@

#include "common.h"

/* Push specified file to specified device **running the BASIC shell** and verify
/* Push specified file to specified device running the BASIC shell and verify
* that the sent contents is correct.
*
* Note: running this will clear the current BASIC listing on the other side.
*/

int main(int argc, char **argv)
@@ -38,20 +36,12 @@ int main(int argc, char **argv)
}
rewind(fp);
int fd = open(argv[1], O_RDWR|O_NOCTTY);
char s[0x20];
char s[0x40];
sprintf(s, "m=0x%04x", memptr);
sendcmdp(fd, s);
sprintf(s, "while m<0x%04x getc:puth a:poke m a:m=m+1", memptr+bytecount);
sendcmd(fd, s);

// Send program
sendcmdp(fd, "clear");
sendcmdp(fd, "1 getc");
sendcmdp(fd, "2 puth a");
sendcmdp(fd, "3 poke m a");
sendcmdp(fd, "4 m=m+1");
sprintf(s, "5 if m<0x%04x goto 1", memptr+bytecount);
sendcmdp(fd, s);

sendcmd(fd, "run");
int returncode = 0;
while (fread(s, 1, 1, fp)) {
putchar('.');


Loading…
Cancel
Save