mirror of https://github.com/mnaberez/py65.git
Remove blocking_getc at $f005
This commit is contained in:
parent
589aed7ea7
commit
0a6f7b90a2
|
@ -1,5 +1,10 @@
|
||||||
0.19-dev (Next Release)
|
0.19-dev (Next Release)
|
||||||
|
|
||||||
|
- Blocking character input at $F005 has been removed. The I/O area
|
||||||
|
was designed to be compatible with Michal Kowalski's simulator,
|
||||||
|
and it uses this address for another purpose. Examples that depended
|
||||||
|
on $F005 have been changed to use $F004.
|
||||||
|
|
||||||
0.18 (2014-01-30)
|
0.18 (2014-01-30)
|
||||||
|
|
||||||
- Fixed a bug in RTS where popping $FFFF off the stack would cause
|
- Fixed a bug in RTS where popping $FFFF off the stack would cause
|
||||||
|
|
|
@ -15,15 +15,15 @@ START = $FFFFFe00
|
||||||
|
|
||||||
; I/O is memory-mapped in py65:
|
; I/O is memory-mapped in py65:
|
||||||
PUTC = $f001
|
PUTC = $f001
|
||||||
GETC = $f005 ; blocking input
|
GETC = $f004
|
||||||
|
|
||||||
; Note that Hex format for 65Org16 uses ';' not ':' as the start of record mark
|
; Note that Hex format for 65Org16 uses ';' not ':' as the start of record mark
|
||||||
; also note that some fields are now composed of 16-bit elements:
|
; also note that some fields are now composed of 16-bit elements:
|
||||||
; previously:
|
; previously:
|
||||||
; length offset type data checksum
|
; length offset type data checksum
|
||||||
; :/08/E008/00/08090A0B0C0D0E0F/xx
|
; :/08/E008/00/08090A0B0C0D0E0F/xx
|
||||||
; now
|
; now
|
||||||
; ;/10/E008/00/00080009000A000B000C000D000E000F/xx
|
; ;/10/E008/00/00080009000A000B000C000D000E000F/xx
|
||||||
|
|
||||||
; Zero-page storage
|
; Zero-page storage
|
||||||
DPL = $00 ; data pointer (two bytes) used by PUTSTRI
|
DPL = $00 ; data pointer (two bytes) used by PUTSTRI
|
||||||
|
@ -85,8 +85,8 @@ HDLP1 jsr GET4HX ; Get the first/next/last data word
|
||||||
bne HDDLF1 ; If failed, report it
|
bne HDDLF1 ; If failed, report it
|
||||||
; Another successful record has been processed
|
; Another successful record has been processed
|
||||||
lda #'#' ; Character indicating record OK = '#'
|
lda #'#' ; Character indicating record OK = '#'
|
||||||
sta PUTC ; write it out but don't wait for output
|
sta PUTC ; write it out but don't wait for output
|
||||||
jmp HDWRECS ; get next record
|
jmp HDWRECS ; get next record
|
||||||
HDDLF1 lda #'F' ; Character indicating record failure = 'F'
|
HDDLF1 lda #'F' ; Character indicating record failure = 'F'
|
||||||
sta DLFAIL ; download failed if non-zero
|
sta DLFAIL ; download failed if non-zero
|
||||||
sta PUTC ; write it to transmit buffer register
|
sta PUTC ; write it to transmit buffer register
|
||||||
|
@ -100,13 +100,13 @@ HDER1 cmp #1 ; Check for end-of-record type
|
||||||
lda RECTYPE ; Get it
|
lda RECTYPE ; Get it
|
||||||
sta DLFAIL ; non-zero --> download has failed
|
sta DLFAIL ; non-zero --> download has failed
|
||||||
jsr PUTHEX ; print it
|
jsr PUTHEX ; print it
|
||||||
lda #13 ; but we'll let it finish so as not to
|
lda #13 ; but we'll let it finish so as not to
|
||||||
jsr PUTSER ; falsely start a new d/l from existing
|
jsr PUTSER ; falsely start a new d/l from existing
|
||||||
lda #10 ; file that may still be coming in for
|
lda #10 ; file that may still be coming in for
|
||||||
jsr PUTSER ; quite some time yet.
|
jsr PUTSER ; quite some time yet.
|
||||||
jmp HDWRECS
|
jmp HDWRECS
|
||||||
; We've reached the end-of-record record
|
; We've reached the end-of-record record
|
||||||
HDER2 jsr GETHEX ; get the checksum
|
HDER2 jsr GETHEX ; get the checksum
|
||||||
lda CHKSUM ; Add previous checksum accumulator value
|
lda CHKSUM ; Add previous checksum accumulator value
|
||||||
beq HDER3 ; checksum = 0 means we're OK!
|
beq HDER3 ; checksum = 0 means we're OK!
|
||||||
jsr PUTSTRI ; Warn user of bad checksum
|
jsr PUTSTRI ; Warn user of bad checksum
|
||||||
|
@ -139,6 +139,7 @@ HDEROK jsr PUTSTRI
|
||||||
|
|
||||||
; For py65, the input routine will block until a character arrives
|
; For py65, the input routine will block until a character arrives
|
||||||
GETSER lda GETC
|
GETSER lda GETC
|
||||||
|
beq GETSER
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; get four ascii chars, adding both octets into the checksum
|
; get four ascii chars, adding both octets into the checksum
|
||||||
|
@ -194,7 +195,7 @@ PUTHEX pha ;
|
||||||
jsr PRNIBL
|
jsr PRNIBL
|
||||||
pla
|
pla
|
||||||
PRNIBL and #$0F ; strip off the low nibble
|
PRNIBL and #$0F ; strip off the low nibble
|
||||||
cmp #$0A
|
cmp #$0A
|
||||||
bcc NOTHEX ; if it's 0-9, add '0' else also add 7
|
bcc NOTHEX ; if it's 0-9, add '0' else also add 7
|
||||||
adc #6 ; Add 7 (6+carry=1), result will be carry clear
|
adc #6 ; Add 7 (6+carry=1), result will be carry clear
|
||||||
NOTHEX adc #'0' ; If carry clear, we're 0-9
|
NOTHEX adc #'0' ; If carry clear, we're 0-9
|
||||||
|
@ -204,8 +205,8 @@ PUTSER sta PUTC
|
||||||
|
|
||||||
;Put the string following in-line until a NULL out to the console
|
;Put the string following in-line until a NULL out to the console
|
||||||
PUTSTRI pla ; Get the low part of "return" address (data start address)
|
PUTSTRI pla ; Get the low part of "return" address (data start address)
|
||||||
sta DPL
|
sta DPL
|
||||||
pla
|
pla
|
||||||
sta DPH ; Get the high part of "return" address
|
sta DPH ; Get the high part of "return" address
|
||||||
; (data start address)
|
; (data start address)
|
||||||
; Note: actually we're pointing one short
|
; Note: actually we're pointing one short
|
||||||
|
@ -215,10 +216,10 @@ PSINB ldy #1
|
||||||
bne PSICHO ; if not, we're pointing to next character
|
bne PSICHO ; if not, we're pointing to next character
|
||||||
inc DPH ; account for page crossing
|
inc DPH ; account for page crossing
|
||||||
PSICHO ora #0 ; Set flags according to contents of Accumulator
|
PSICHO ora #0 ; Set flags according to contents of Accumulator
|
||||||
beq PSIX1 ; don't print the final NULL
|
beq PSIX1 ; don't print the final NULL
|
||||||
jsr PUTSER ; write it out
|
jsr PUTSER ; write it out
|
||||||
jmp PSINB ; back around
|
jmp PSINB ; back around
|
||||||
PSIX1 inc DPL ;
|
PSIX1 inc DPL ;
|
||||||
bne PSIX2 ;
|
bne PSIX2 ;
|
||||||
inc DPH ; account for page crossing
|
inc DPH ; account for page crossing
|
||||||
PSIX2 jmp (DPL) ; return to byte following final NULL
|
PSIX2 jmp (DPL) ; return to byte following final NULL
|
||||||
|
@ -227,7 +228,7 @@ PSIX2 jmp (DPL) ; return to byte following final NULL
|
||||||
GOIRQ
|
GOIRQ
|
||||||
GONMI RTI
|
GONMI RTI
|
||||||
|
|
||||||
; vectors
|
; vectors
|
||||||
.ORG $FFFFFFFA
|
.ORG $FFFFFFFA
|
||||||
NMIENT .word GONMI
|
NMIENT .word GONMI
|
||||||
RSTENT .word START
|
RSTENT .word START
|
||||||
|
|
|
@ -8,21 +8,22 @@
|
||||||
; SWAPCASE.HEX
|
; SWAPCASE.HEX
|
||||||
; where the first line should not be input to the hexloader
|
; where the first line should not be input to the hexloader
|
||||||
|
|
||||||
.hexfile
|
.hexfile
|
||||||
|
|
||||||
.cpu T_32_M16
|
.cpu T_32_M16
|
||||||
.assume BIT32=1032, BIT32R=3210
|
.assume BIT32=1032, BIT32R=3210
|
||||||
.include "i6502.a"
|
.include "i6502.a"
|
||||||
|
|
||||||
; I/O is memory-mapped in py65:
|
; I/O is memory-mapped in py65:
|
||||||
PUTC = $f001
|
PUTC = $f001
|
||||||
GETC = $f005 ; blocking input
|
GETC = $f004
|
||||||
|
|
||||||
; the py65 hexload boot ROM will only load to $0200
|
; the py65 hexload boot ROM will only load to $0200
|
||||||
.ORG $200
|
.ORG $200
|
||||||
|
|
||||||
another
|
another
|
||||||
lda GETC
|
lda GETC
|
||||||
eor #$20 ; swap upper and lower case as a demo
|
beq another
|
||||||
sta PUTC
|
eor #$20 ; swap upper and lower case as a demo
|
||||||
jmp another
|
sta PUTC
|
||||||
|
jmp another
|
||||||
|
|
|
@ -209,13 +209,9 @@ class Monitor(cmd.Cmd):
|
||||||
byte = 0
|
byte = 0
|
||||||
return byte
|
return byte
|
||||||
|
|
||||||
def blocking_getc(address):
|
|
||||||
return ord(console.getch(self.stdin))
|
|
||||||
|
|
||||||
m = ObservableMemory(addrWidth=self.addrWidth)
|
m = ObservableMemory(addrWidth=self.addrWidth)
|
||||||
m.subscribe_to_write([0xF001], putc)
|
m.subscribe_to_write([0xF001], putc)
|
||||||
m.subscribe_to_read([0xF004], getc)
|
m.subscribe_to_read([0xF004], getc)
|
||||||
m.subscribe_to_read([0xF005], blocking_getc)
|
|
||||||
|
|
||||||
self._mpu.memory = m
|
self._mpu.memory = m
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue