Re: 6502 with a serial port - a minimal monitor?
Posted: Fri Jul 12, 2013 6:51 pm
Quote:
BTW, what is the memory footprint of your minimal Forth setup?
Quote:
Forth is a heck of a lot more useful than any monitor...
The 6502 Microprocessor Resource
http://forum.6502.org/
Code: Select all
Load_cmd jsr ACIA1_Input ;receive low destination
sta Startaddr
jsr ACIA1_Input ;receive high destination
sta Startaddr_H
jsr ACIA1_Input ;receive low count
sta Addrptr
jsr ACIA1_Input ;receive high count
clc
adc #1 ;dec loop requires +1
sta Addrptr_H
ldx #0
Load_cmd1 jsr ACIA1_Input ;grab a byte
sta (Startaddr,x) ;put it where it belongs
inc Startaddr ; low++
bne Load_cmd2 ;
inc Startaddr_H ; high++
Load_cmd2 dec Addrptr ;dec low count
bne Load_cmd1 ;
dec Addrptr_H ;dec hi count
bne Load_cmd1 ;and more bytes
rts
Code: Select all
Load_cmd jsr ACIA1_Input ;receive low destination
sta Startaddr
jsr ACIA1_Input ;receive high destination
sta Startaddr_H
jsr ACIA1_Input ;receive low count
sta Addrptr
jsr ACIA1_Input ;receive high count
sta Addrptr_H
ldx #0
beq Load_cmd3
Load_cmd1 dec Addrptr_H
Load_cmd2 dec Addrptr
jsr ACIA1_Input ;grab a byte
sta (Startaddr,x) ;put it where it belongs
inc Startaddr ; low++
bne Load_cmd3 ;
inc Startaddr_H ; high++
Load_cmd3 lda Addrptr
bne Load_cmd2
lda Addrptr_H
bne Load_cmd1
rts
Code: Select all
Load_cmd jsr ACIA1_Input ;receive low destination
tay
jsr ACIA1_Input ;receive high destination
sta Startaddr_H
jsr ACIA1_Input ;receive low count
eor #-1
tax
jsr ACIA1_Input ;receive high count
eor #-1 ;complement count to
sta Addrptr_H ; improve throughput
lda #0
sta Startaddr
beq Load_cmd3
Load_cmd2 jsr ACIA1_Input ;grab a byte
sta (Startaddr),y ;put it where it belongs
iny ; low++
bne Load_cmd3 ;
inc Startaddr_H ; high++
Load_cmd3 inx
bne Load_cmd2
inc Addrptr_H
bne Load_cmd2
; sty Startaddr ; only if needed elsewhere
rts