Update software to match efinix hw
This commit is contained in:
@@ -3,12 +3,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint8_t hex_set_8(uint8_t val, uint8_t idx);
|
||||
uint8_t hex_set_16(uint16_t val);
|
||||
uint8_t hex_set_24(uint32_t val);
|
||||
|
||||
void hex_enable(uint8_t mask);
|
||||
|
||||
uint8_t sw_read();
|
||||
|
||||
void led_set(uint8_t val);
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
|
||||
.importzp sp, sreg
|
||||
|
||||
.export _hex_set_8
|
||||
.export _hex_set_16
|
||||
.export _hex_set_24
|
||||
.export _hex_enable
|
||||
.export _sw_read
|
||||
.export _led_set
|
||||
|
||||
@@ -13,49 +9,6 @@
|
||||
|
||||
.code
|
||||
|
||||
; @in A: idx Stack[0]: val
|
||||
; @out A: 0 for success, 1 for failure.
|
||||
; Sets one of the 3 pairs of hex digits.
|
||||
_hex_set_8:
|
||||
phx
|
||||
cmp #$3 ; If idx >= 3 then fail
|
||||
bcc @1
|
||||
plx
|
||||
lda #$1
|
||||
rts
|
||||
@1: tax ; Move idx into x
|
||||
jsr popa ; put val into a
|
||||
sta SEVEN_SEG,x ; write to val
|
||||
lda #$0
|
||||
plx
|
||||
rts
|
||||
|
||||
; @in A/X: val
|
||||
; @out A: 0 for success, 1 for failure
|
||||
; Sets the low 2 pairs of hex digits
|
||||
_hex_set_16:
|
||||
sta SEVEN_SEG
|
||||
stx SEVEN_SEG+1
|
||||
lda #$0
|
||||
rts
|
||||
|
||||
; @in A/X/sreg: val
|
||||
; @out A: 0 for success, 1 for failure
|
||||
; Sets the 3 pairs of hex digits for a 24 bit value
|
||||
_hex_set_24:
|
||||
sta SEVEN_SEG
|
||||
stx SEVEN_SEG+1
|
||||
lda sreg
|
||||
sta SEVEN_SEG+2
|
||||
lda #$0
|
||||
rts
|
||||
|
||||
; @in A: mask
|
||||
; Set the mask for seven seg enables
|
||||
_hex_enable:
|
||||
sta SEVEN_SEG+3
|
||||
rts
|
||||
|
||||
; @out A: The Value of the switches
|
||||
; Reads the current values of the switches.
|
||||
_sw_read:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
.export _cputc
|
||||
.export gotoxy
|
||||
.export _clrscr
|
||||
.export _cgetc
|
||||
;.export _cgetc
|
||||
|
||||
.autoimport on
|
||||
|
||||
@@ -53,8 +53,8 @@ _clrscr:
|
||||
pla
|
||||
rts
|
||||
|
||||
_cgetc:
|
||||
@2: lda _lastchar
|
||||
beq @2
|
||||
stz _lastchar
|
||||
rts
|
||||
;_cgetc:
|
||||
;@2: lda _lastchar
|
||||
; beq @2
|
||||
; stz _lastchar
|
||||
; rts
|
||||
@@ -9,7 +9,6 @@
|
||||
.import _handle_irq
|
||||
|
||||
.export _irq_int, _nmi_int
|
||||
.export _irq_get_status, _irq_set_status
|
||||
|
||||
.include "io.inc65"
|
||||
|
||||
@@ -47,12 +46,3 @@ irq: PLA ; Restore accumulator contents
|
||||
|
||||
break: JMP break ; If BRK is detected, something very bad
|
||||
; has happened, so stop running
|
||||
|
||||
_irq_get_status:
|
||||
lda IRQ_STATUS
|
||||
ldx #$00
|
||||
rts
|
||||
|
||||
_irq_set_status:
|
||||
sta IRQ_STATUS
|
||||
rts
|
||||
@@ -1,18 +1,12 @@
|
||||
SEVEN_SEG = $7ff0
|
||||
|
||||
UART = $7ff4
|
||||
UART = $efe6
|
||||
UART_TXB = UART
|
||||
UART_RXB = UART
|
||||
UART_STATUS = UART + 1
|
||||
|
||||
LED = $7ff6
|
||||
LED = $efff
|
||||
SW = LED
|
||||
|
||||
MM_CTRL = $7ff7
|
||||
MM_DATA = $7fe0
|
||||
SD_ARG = $efd8
|
||||
SD_CMD = $efdc
|
||||
SD_DATA = $efdd
|
||||
|
||||
SD_ARG = $7ff8
|
||||
SD_CMD = $7ffc
|
||||
SD_DATA = $7ffd
|
||||
|
||||
IRQ_STATUS = $7fff
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef _MAPPER_H
|
||||
#define _MAPPER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void mapper_enable(uint8_t en);
|
||||
|
||||
uint8_t mapper_read(uint8_t addr);
|
||||
void mapper_write(uint8_t data, uint8_t addr);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
.include "io.inc65"
|
||||
|
||||
.importzp sp, sreg
|
||||
|
||||
.export _mapper_enable
|
||||
.export _mapper_read, _mapper_write
|
||||
|
||||
.autoimport on
|
||||
|
||||
.code
|
||||
|
||||
|
||||
; void mapper_enable(uint8_t en)
|
||||
_mapper_enable:
|
||||
sta MM_CTRL
|
||||
rts
|
||||
|
||||
_mapper_read:
|
||||
phx
|
||||
tax
|
||||
lda MM_DATA,x
|
||||
ldx #$00
|
||||
rts
|
||||
|
||||
_mapper_write:
|
||||
phx
|
||||
tax
|
||||
jsr popa
|
||||
sta MM_DATA,x
|
||||
plx
|
||||
rts
|
||||
|
||||
@@ -5,21 +5,35 @@
|
||||
|
||||
void sd_init() {
|
||||
uint32_t resp;
|
||||
uint8_t attempts, i;
|
||||
|
||||
cputs("In sd_init\n");
|
||||
|
||||
sd_card_command(0, 0);
|
||||
|
||||
cprintf("Sent Reset\n");
|
||||
|
||||
sd_card_command(0x000001aa, 8);
|
||||
sd_card_resp(&resp);
|
||||
cprintf("CMD8: %lx\n", resp);
|
||||
|
||||
sd_card_command(0, 55);
|
||||
sd_card_command(0x40180000, 41);
|
||||
sd_card_resp(&resp);
|
||||
cprintf("CMD41: %lx\n", resp);
|
||||
attempts = 0;
|
||||
do {
|
||||
if (attempts > 100) {
|
||||
cprintf("SD Timed out");
|
||||
return;
|
||||
}
|
||||
sd_card_command(0, 55);
|
||||
sd_card_resp(&resp);
|
||||
sd_card_command(0x40180000, 41);
|
||||
sd_card_resp(&resp);
|
||||
cprintf("CMD41: %lx\n", resp);
|
||||
|
||||
sd_card_command(0, 55);
|
||||
sd_card_command(0x40180000, 41);
|
||||
sd_card_resp(&resp);
|
||||
cprintf("CMD41: %lx\n", resp);
|
||||
//10ms loop?
|
||||
for (i = 0; i < 255; i++);
|
||||
|
||||
attempts++;
|
||||
} while (resp != 0);
|
||||
|
||||
sd_card_command(0, 2);
|
||||
sd_card_resp(&resp);
|
||||
|
||||
@@ -19,8 +19,8 @@ _uart_txb:
|
||||
_uart_txb_block:
|
||||
pha
|
||||
sta UART_TXB ; Write value
|
||||
@1: lda UART_STATUS ; Wait for status[0] to be 0
|
||||
bit #$01
|
||||
@1: lda UART_STATUS ; Wait for status[1] to be 0
|
||||
bit #$02
|
||||
bne @1
|
||||
pla
|
||||
rts
|
||||
|
||||
Reference in New Issue
Block a user