Re: First thought on an interface (to use Paleolithic DROM)
Posted: Tue Jun 24, 2025 5:25 pm
BruceRMcF wrote:
So now there's an Alpha V8.
“Mesolithic,” eh? When will you be publishing the Fred Flintstone version?
The 6502 Microprocessor Resource
http://forum.6502.org/
Code: Select all
; +34
; for each LED digit (right to left)...
lda leds,y
sta led_addr,y ; display bit pattern
ldx keys
bpl loop_key
; Not a key
; if the state is unpressed, nothing to do
bit mflags
bvc loop_99
; if the state is pressed, increment the count
; test for hitting relcnt_n (release count "N")
inc mflags
lda #relcnt_n
trb mflags
beq loop_99 ; not at release count yet
lda #press_reset ; $7F = %01111111
trb mflags
bra loop_99 ; reset pressed state
; resets count as well Code: Select all
loop_key:
lda #pressbit ; bit 6, $40 = %01000000
tsb mflags ; use BOTH "test bit" & "set bit"
beq loop_1stkey ; if reset before, 1st key
lda #countfield ; otherwise reset release count
trb mflags ; %0011111111 to leave pressed state alone
bra loop_99
loop_1stkey:
; do stuff to sort out the key value
; a hex key if below smallest command code
; above, set up to be KEY_GO
cpx #KEY_GO
bmi loop_hex ; enter hex value
beq exec ; jump punched in code
cpx #KEY_BS ; test 2nd largest command code
beq loop_bspace ; decrement memptr
bpl function ; perform function
; using low nybble showing
; +12
; remaining special key is return
; accept current byte value, increment memptr
inc memptr
bne getdata
inc memptr+1
getdata: ; used by functions that change memptr
lda (memptr)
sta data
bra loop_90
loop_hex: ; +12
; else shuffle key value into (memptr)
; In this version, d7=/Press
; d7 clear if hex key
lda (memptr)
asl a
asl a
asl a
asl a
stx temp
ora temp
sta (memptr)
loop_90: ; +0
; This has been removed
; ; wait for key to be released
; ; this will cause display glitch, but...
; lda keys
; bmi loop_90
loop_99: ; +5
dey
bpl loop_digit
bra loop_main Code: Select all
; then update LED and get key
; +10
ff99 : b9fa00 lda leds,y
ff9c : 990098 sta led_addr,y ; display bit pattern
ff9f : ad0090 lda keypad
; d7=NOR(row1,row2,row3,row4,row5)
ffa2 : 302b bmi loop_99 ; no key pressed
Code: Select all
; then update LED and get key
; +10
ff99 : b9fa00 lda leds,y
ff9c : 990098 sta led_addr,y ; display bit pattern
ff9f : ad0090 lda keypad
; d7=NOR(row1,row2,row3,row4,row5)
ffa2 : 302b bmi loop_99 ; no key pressed
Code: Select all
org $fe70
break: ; +23
sta rega
stx regx
sty regy
tsx
pla
sta regflags
pla
sta memptr
pla`
sta memptr+1
txs
lda #$80
tsb mflags ; use BREAK "+" functions
bra wmstart Code: Select all
; "F+" showapp function starts here
showapp:
start: ; +12
; Set base address, this is also "showapp"
lda #addr0hi
sta memptr+1
stz memptr ; start at page aligned addr0
wmstart:
lda (memptr)
sta data
... Code: Select all
showregs: ; +8
stz memptr+1
lda #rega
sta memptr
bra getdata Code: Select all
brkrtn: ; +13
lda #$80
trb mflags ; turn off BRK mode
beq loop_90 ; wasn't BRK mode
lda rega
ldx regx
ldy regy
rti Code: Select all
; Mesolithic VBIOS to be loaded on Paleolithic DROM
keys equ $7000 ; for Symon equ $9000 ; for Meso
led_addr equ $7080 ; for Symon equ $9800 ; for Meso
RUN equ $10
RETURN equ $11
bss
org 0
leds ds 8 ; led will display patterns stored here
mem_ptr ds 2 ; where are we writing?
temp ds 1 ; temporary store to combine keypad hex
code
org $c000
db 0 ; keep symon happy
org $ff80
;LED_PATTERNS db 0b00111111 ;0 ; for Meso
; db 0b00000110 ;1
; db 0b01011011 ;2
; db 0b01001111 ;3
; db 0b01100110 ;4
; db 0b01101101 ;5
; db 0b01111101 ;6
; db 0b00000111 ;7
; db 0b01111111 ;8
; db 0b01101111 ;9
; db 0b01110111 ;A ; changed to capital
; db 0b00111100 ;b
; db 0b00111001 ;C ; changed to capital
; db 0b01011110 ;d
; db 0b01111001 ;E ; changed to capital
; db 0b01110001 ;F ; changed to capital
; changed for Symon to show more simply in the memory view
LED_PATTERNS db '0123456789abcdef'
start:
lda #2
sta mem_ptr+1
stz mem_ptr ; start address $200
loop_0:
ldy #5 ; we have eight leds but we only need to drive six
; (saves code space)
loop:
; for each character...
lda leds,y
sta led_addr,y ; display bit pattern
lda keys
bmi loop_91 ; bit 7 clear if key pressed so we can directly
; read a valid key value
; if key value = return
cmp #RETURN
bne loop_2
; increment memory address pointer
inc mem_ptr
bne loop_90
inc mem_ptr+1
bra loop_90
; endif
loop_2:
; if key value = go
cmp #RUN
bne loop_3
; execute the program
jmp $200
; endif
loop_3:
; else shuffle key value into (mem_ptr)
sta temp
lda (mem_ptr)
asl a
asl a
asl a
asl a
ora temp
sta (mem_ptr)
loop_90:
; wait for key to be released
; this will cause display glitch, but...
lda keys
bpl loop_90
loop_91:
; put mem_ptr and (mem_ptr) into leds
; [x][x][x][x][x][x][ ][ ]
; (also provides a short delay for the LED multiplex)
ldx #0
lda mem_ptr+1
jsr to_leds
lda mem_ptr
jsr to_leds
lda (mem_ptr)
jsr to_leds
loop_92: ;optional delay between LED cycles
; stretches the illumination time for each LED to approx
; half a millisecond
; if used, ldx after loop_91 can be deleted
; inx
; bne loop_92
; update the display count
dey
bpl loop
bra loop_0
to_leds:
; unpack byte into two adjacent LED patterns
; x has character position
phy
pha
and #$0f ; low nibble
tay
lda LED_PATTERNS,y ; index into the patterns
sta leds+1,x ; and output into the LED array
pla
lsr a
lsr a
lsr a
lsr a ; high nibble
tay
lda LED_PATTERNS,y
sta leds,x ; this byte goes on the left
inx
inx
ply
rts
org $fffc
dw start
dw start