mirror of
https://github.com/mnaberez/py65.git
synced 2025-01-08 11:30:46 +00:00
Add the ability to load from URLs
This commit is contained in:
parent
3a0807ccec
commit
b5c2382364
@ -5,6 +5,8 @@
|
|||||||
- The monitor now accepts command line arguments. See
|
- The monitor now accepts command line arguments. See
|
||||||
``py65mon --help`` for usage. Contributed by Ed Spittles.
|
``py65mon --help`` for usage. Contributed by Ed Spittles.
|
||||||
|
|
||||||
|
- The monitor's load command can now fetch URLs.
|
||||||
|
|
||||||
0.10 (2011-08-27)
|
0.10 (2011-08-27)
|
||||||
|
|
||||||
- Fixed long-standing bugs in relative branch calculations in the
|
- Fixed long-standing bugs in relative branch calculations in the
|
||||||
|
@ -18,6 +18,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
import sys
|
import sys
|
||||||
|
import urllib2
|
||||||
from asyncore import compact_traceback
|
from asyncore import compact_traceback
|
||||||
from py65.devices.mpu6502 import MPU as NMOS6502
|
from py65.devices.mpu6502 import MPU as NMOS6502
|
||||||
from py65.devices.mpu65c02 import MPU as CMOS65C02
|
from py65.devices.mpu65c02 import MPU as CMOS65C02
|
||||||
@ -476,6 +477,16 @@ class Monitor(cmd.Cmd):
|
|||||||
else:
|
else:
|
||||||
start = self._mpu.pc
|
start = self._mpu.pc
|
||||||
|
|
||||||
|
if "://" in filename:
|
||||||
|
try:
|
||||||
|
f = urllib2.urlopen(filename)
|
||||||
|
bytes = f.read()
|
||||||
|
f.close()
|
||||||
|
except (urllib2.URLError, urllib2.HTTPError), why:
|
||||||
|
msg = "Cannot fetch remote file: %s" % str(why)
|
||||||
|
self._output(msg)
|
||||||
|
return
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
f = open(filename, 'rb')
|
f = open(filename, 'rb')
|
||||||
bytes = f.read()
|
bytes = f.read()
|
||||||
|
Loading…
Reference in New Issue
Block a user