Couple of small fixes
This commit is contained in:
parent
193066d8c3
commit
a56fba1fef
1
build.sh
1
build.sh
|
@ -1,2 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
mkdir -p .build && zasm -i src/fib.z80 -o .build/fib.bin
|
mkdir -p .build && zasm -i src/fib.z80 -o .build/fib.bin
|
||||||
|
ls -al .build/fib.bin
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
_ram_start equ 0x1600
|
_ram_start equ 0x1300
|
||||||
|
|
||||||
#target rom
|
#target rom
|
||||||
|
|
||||||
#code _HOME, 0x1500 ; Non-banked part of memory
|
#code _HOME, 0x1200 ; Non-banked part of memory
|
||||||
|
|
||||||
#data _DATA, _ram_start ; Uninitialized variables
|
#data _DATA, _ram_start ; Uninitialized variables
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@ init:
|
||||||
loop:
|
loop:
|
||||||
add a, b
|
add a, b
|
||||||
|
|
||||||
|
ld (hl), a
|
||||||
|
inc hl
|
||||||
out 0x80, a
|
out 0x80, a
|
||||||
|
|
||||||
ld c, a
|
ld c, a
|
||||||
|
|
25
upload.py
Normal file → Executable file
25
upload.py
Normal file → Executable file
|
@ -1,6 +1,8 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
import serial
|
import serial
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
def progressbar(it, prefix="", size=60, file=sys.stdout):
|
def progressbar(it, prefix="", size=60, file=sys.stdout):
|
||||||
count = len(it)
|
count = len(it)
|
||||||
|
@ -17,24 +19,21 @@ def progressbar(it, prefix="", size=60, file=sys.stdout):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) == 2:
|
if len(sys.argv) == 2:
|
||||||
ser = serial.Serial("COM3", timeout=1, write_timeout=1)
|
# ser = serial.Serial("COM3", timeout=1, write_timeout=1)
|
||||||
|
ser = serial.Serial("/dev/ttyUSB0", timeout=1, write_timeout=1, baudrate=115200)
|
||||||
if ser.is_open:
|
if ser.is_open:
|
||||||
# Clear out any existing input
|
|
||||||
ser.write(b'\n')
|
|
||||||
ser.readline()
|
|
||||||
|
|
||||||
# Send the upload command
|
|
||||||
ser.write(b'#u\n')
|
|
||||||
print(ser.readline())
|
|
||||||
|
|
||||||
path = sys.argv[1]
|
path = sys.argv[1]
|
||||||
size = os.path.getsize(path)
|
size = os.path.getsize(path)
|
||||||
ser.write([size & 0xFF])
|
|
||||||
ser.write([(size >> 8) & 0xFF])
|
|
||||||
i = 0
|
|
||||||
with open(path, "rb") as f:
|
with open(path, "rb") as f:
|
||||||
for i in progressbar(range(size), "Upload: ", 40):
|
for i in progressbar(range(size), "Upload: ", 40):
|
||||||
ser.write(f.read(1))
|
byte = f.read(1)
|
||||||
|
ser.write(byte)
|
||||||
|
|
||||||
|
if byte == b'#':
|
||||||
|
ser.write(b'#\n')
|
||||||
|
|
||||||
|
time.sleep(0.002)
|
||||||
|
|
||||||
print(ser.readline())
|
print(ser.readline())
|
||||||
ser.close()
|
ser.close()
|
||||||
|
|
Reference in New Issue
Block a user