From 343dd83cdd32831f19bd41bd78d254964c0b2573 Mon Sep 17 00:00:00 2001 From: mgcaret Date: Sat, 14 Dec 2019 14:41:23 -0800 Subject: [PATCH] Neon816: VDC access words --- platforms/Neon816/Neon816-hw.inc | 2 +- platforms/Neon816/platform-lib.s | 48 ++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/platforms/Neon816/Neon816-hw.inc b/platforms/Neon816/Neon816-hw.inc index 9dc48fc..0957fe1 100644 --- a/platforms/Neon816/Neon816-hw.inc +++ b/platforms/Neon816/Neon816-hw.inc @@ -91,7 +91,7 @@ SPI2ctrl3 = $10001F ; init = $05 ; VDC ; ***************** -VDCio = $100120 ; read: 1 byte, write: 1 or 2 bytes +VDCbase = $100120 ; base address, there are $20 registers ; ***************** ; FDC diff --git a/platforms/Neon816/platform-lib.s b/platforms/Neon816/platform-lib.s index 1315fc2..95ef8dd 100644 --- a/platforms/Neon816/platform-lib.s +++ b/platforms/Neon816/platform-lib.s @@ -209,6 +209,54 @@ dword I2C2_FETCH,"I2C2@+" .a16 eword +dword VDC_C_STORE,"VDCC!" + jsr _popay ; pop offset + phy ; save low word + jsr _popay ; pop value to write + pla ; get offset back + phx ; save SP + tax ; offset to x reg + sep #SHORT_A ; whew! that was fun! + .a8 + tya ; value to A + sta f:VDCbase,x + rep #SHORT_A + .a16 + plx ; restore SP + NEXT +eword + +dword VDC_C_FETCH,"VDCC@" + jsr _popay ; pop offet + phx ; save SP + tya + tax + sep #SHORT_A ; whew! that was fun! + .a8 + lda f:VDCbase,x + rep #SHORT_A + .a16 + plx ; restore SP + and #$00FF + tay + lda #$0000 + PUSHNEXT +eword + +dword VDC_STORE,"VDC!" + jsr _popay ; again! again! again! + phy + jsr _popay + pla + phx + tax + tya + sta f:VDCbase,x + rep #SHORT_A + .a16 + plx ; restore SP + NEXT +eword dend