Add some basic fat32 code

This commit is contained in:
Byron Lathi
2023-12-03 23:27:45 -08:00
parent 184c58b962
commit 5c74d161d4
11 changed files with 326 additions and 7 deletions

View File

@@ -10,4 +10,21 @@ SPI_BAUD = $efd8
SPI_INPUT = $efd9
SPI_OUTPUT = $efda
SPI_CTRL = $efdb
SPI_STATUS = SPI_CTRL
SPI_STATUS = SPI_CTRL
MULTIPLIER_BASE = $eff0
MULTIPLIER_AL = MULTIPLIER_BASE + 0
MULTIPLIER_AH = MULTIPLIER_BASE + 1
MULTIPLIER_BL = MULTIPLIER_BASE + 2
MULTIPLIER_BH = MULTIPLIER_BASE + 3
MULTIPLIER_OLL = MULTIPLIER_BASE + 4
MULTIPLIER_OLH = MULTIPLIER_BASE + 5
MULTIPLIER_OHL = MULTIPLIER_BASE + 6
MULTIPLIER_OHH = MULTIPLIER_BASE + 7
GOLDEN_OUTPUT_0 = $03
GOLDEN_OUTPUT_1 = $0a
GOLDEN_OUTPUT_2 = $08
GOLDEN_OUTPUT_3 = $00

View File

@@ -0,0 +1,12 @@
#ifndef _MULTIPLER_H
#define _MULTIPLER_H
#include <stdint.h>
/* Multiply 2 integers into 1 long */
uint32_t lmulii(uint16_t a, uint16_t b);
/* Multiply 2 integers into 1 integer, discarding upper bits. */
uint16_t imulii(uint16_t a, uint16_t b);
#endif

View File

@@ -0,0 +1,36 @@
.include "io.inc65"
.MACPACK generic
.import popax
.importzp sreg
.export _lmulii, _imulii
.code
.proc _lmulii
sta MULTIPLIER_BL
stx MULTIPLIER_BH
jsr popax
sta MULTIPLIER_AL
stx MULTIPLIER_AH
lda MULTIPLIER_OHL
sta sreg
lda MULTIPLIER_OHH
sta sreg+1
lda MULTIPLIER_OLL
ldx MULTIPLIER_OLH
rts
.endproc
.proc _imulii
sta MULTIPLIER_BL
stx MULTIPLIER_BH
jsr popax
sta MULTIPLIER_AL
stx MULTIPLIER_AH
lda MULTIPLIER_OLL
ldx MULTIPLIER_OLH
rts
.endproc