+Vorticon Posted July 7 Share Posted July 7 I thought I'd start a new topic related to the use of the IDE card in order to keep things in one place for easy reference. How does one access the clock on the card from assembly? I'd like to do so from within the pcode system. 1 Quote Link to comment Share on other sites More sharing options...
+jedimatt42 Posted July 8 Share Posted July 8 I imagine that in p-code you are looking to avoid reading the IDE.TIME file. But that should be a hint that the DSR contains the assembly to read the hardware clock directly. Quote Link to comment Share on other sites More sharing options...
+jedimatt42 Posted July 8 Share Posted July 8 Fred shares his DSR source here https://hexbus.com/ti99geek/ under 'projects' -> 'IDE DSR' 2 Quote Link to comment Share on other sites More sharing options...
+jedimatt42 Posted July 8 Share Posted July 8 It looks like you'd start with the file: ide-p00l2-bq4847.inc Fred's code may help glue together all the technical overload that is at: http://unige.ch/medecine/nouspikel/ti99/ide2.htm#Time and date, where you have to jump all over the place and the answer ends up being, depends... which clock chip is being used? ... 1 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted July 8 Author Share Posted July 8 I don't have access to the IDE files from the psystem. I'm not even sure it sees the card at all as a block device, and still not knowing where the PCB's are in VDP and what their structure is there is little I can do to remedy that situation. I was hoping for a way to access the clock chip registers directly but it looks more complicated than I first imagined. I'll have to dig deeper. 1 Quote Link to comment Share on other sites More sharing options...
+jedimatt42 Posted July 8 Share Posted July 8 I haven't tried any of this but my read of the hardware page seems like the following process for any one clock chip: 1. Set Cru bits to enable card and clock into the memory map. 2. Depending on the clock chip, set a page register so the actual clock registers are mapped in. 3. Set a latch register so the time in the read registers are stable ( only necessary if reading multiple registers like hours, minutes and seconds, if you just want 1, then not necessary) 4. write to a register select address to specify the register you want to read 5. Read from the register read address. ( This is a bit like accessing VDP registers) 6. Repeat 4 and 5 as needed. 7. Unlatch, if you latched. 8. Clear the crubits that enabled the card. The details of which page to enable depends on the clock chip, and which registers to read as well. Maybe someone with experience can correct me? For simplicity, I'd focus on just the clock chip you have. 2 1 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted July 8 Author Share Posted July 8 Seems pretty doable. All this info is in Nouspikel's compendium? Quote Link to comment Share on other sites More sharing options...
+jedimatt42 Posted July 9 Share Posted July 9 Yep, it's all there, but spread out on the rather large IDE design page. Each clock chip has a different section on enabling it, and another on the SRAM paging, and then the actual register usage.... 1 1 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted July 14 Author Share Posted July 14 Is the IDE card activated by an SBO 0 like other cards once R12 is loaded with the corresponding CRU address? Quote Link to comment Share on other sites More sharing options...
+jedimatt42 Posted July 14 Share Posted July 14 Yes. The led and ROM are enabled with Cru bit 0. This is required by DSRLNK standards for searching through DSR lists. 1 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted July 14 Author Share Posted July 14 The new IDE card uses the BQ4847 clock chip, and the 838 RTC module uses a pin compatible chip as well. Is the chip's RAM space automatically mapped when the IDE card is turned on or is there another CRU bit I need to set? I can't seem to find any mention of the latter in Nouspikel's docs or in Fred's DSR... As things stand with just the IDE card activated, I am getting static values from my clock reads which tells me that the RTC registers addresses are not mapped. Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted July 15 Author Share Posted July 15 Here's what I have so far trying first to get the RTC time. All I get is unchanging static values. I must be missing something... ;ide card rtc low-level access routines .proc ctime,3 ;get time ;usage: ctime(intvarsec, intvarmin, intvarhr) .def pcodeon,pcodoff,procret,pmeret mov r11,procret bl @pcodoff li r12,1900h sbo 0 mov *r10+,r1 ;get pointer to hours variable mov *r10+,r2 ;get pointer to minutes variable mov *r10,r3 ;get pointer to seconds variable li r4,0800h ;latch rtc registers socb r4,@403ch clr r4 movb @4020,r4 ;get seconds swpb r4 mov r4,*r3 clr r4 movb @4024,r4 ;get minutes swpb r4 mov r4,*r2 clr r4 movb @4028,r4 ;get hours swpb r4 mov r4,*r1 li r4,0800h ;unlatch rtc registers szcb r4,@403ch sbz 0 ;inactivate ide card bl @pcodeon mov @procret,r11 b *r11 procret .word pmeret .word pcodeon li r12,1f00h ;activate pcode card sbo 0 mov @pmeret,r12 ;retrieve pme pointer b *r11 pcodoff mov r12,@pmeret ;save pme pointer li r12,1f00h ;inactivate pcode card sbz 0 b *r11 .end Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted July 15 Author Share Posted July 15 OK after some digging into Fred's DSR source it turns out that I need to do an SBO 1 to map the >4000->40FF RAM space where the RTC registers live. I also had a few typos in the listing as well. In any case it works now, but the time values are wrong because I believe the RTC registers use BCD and not HEX. Now I need to figure out how to convert from BCD to HEX in assembly. ;ide card rtc low-level access routines .proc ctime,3 ;get time ;usage: ctime(intvarsec, intvarmin, intvarhr) .def pcodeon,pcodoff,procret,pmeret mov r11,@procret bl @pcodoff li r12,1900h ;activate ide card at cru >1900 sbo 0 sbo 1 ;enable mapping of >4000 - >40ff space sbo 3 ;fixed page at >4000 - >40ff mov *r10+,r1 ;get pointer to hours variable mov *r10+,r2 ;get pointer to minutes variable mov *r10,r3 ;get pointer to seconds variable li r4,0800h ;latch rtc registers socb r4,@403ch clr r4 movb @4020h,r4 ;get seconds swpb r4 mov r4,*r3 clr r4 movb @4024h,r4 ;get minutes swpb r4 mov r4,*r2 clr r4 movb @4028h,r4 ;get hours swpb r4 mov r4,*r1 li r4,0800h ;unlatch rtc registers szcb r4,@403ch sbz 1 ;inactivate ram mapping sbz 0 ;inactivate ide card bl @pcodeon mov @procret,r11 b *r11 procret .word pmeret .word pcodeon li r12,1f00h ;activate pcode card sbo 0 mov @pmeret,r12 ;retrieve pme pointer b *r11 pcodoff mov r12,@pmeret ;save pme pointer li r12,1f00h ;inactivate pcode card sbz 0 b *r11 .end 3 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted July 15 Share Posted July 15 Thanks for the research @Vorticon. I might take a run at doing this in Forth. 3 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted July 15 Author Share Posted July 15 Here's the routine with the bcd conversion part done. I'll add the date fetching later today. ;ide card rtc low-level access routines .proc ctime,3 ;get time ;usage: ctime(intvarsec, intvarmin, intvarhr) .def pcodeon,pcodoff,procret,pmeret,bcd2hex mov r11,@procret bl @pcodoff li r12,1900h ;activate ide card at cru >1900 sbo 0 sbo 1 ;enable mapping of >4000 - >40ff space sbo 3 ;fixed page at >4000 - >40ff mov *r10+,r1 ;get pointer to hours variable mov *r10+,r2 ;get pointer to minutes variable mov *r10,r3 ;get pointer to seconds variable li r4,0800h ;latch rtc registers socb r4,@403ch clr r4 movb @4020h,r4 ;get seconds swpb r4 bl @bcd2hex ;convert to hex mov r6,*r3 clr r4 movb @4024h,r4 ;get minutes swpb r4 bl @bcd2hex ;convert to hex mov r6,*r2 clr r4 movb @4028h,r4 ;get hours swpb r4 bl @bcd2hex mov r6,*r1 li r4,0800h ;unlatch rtc registers szcb r4,@403ch sbz 1 ;inactivate ram mapping sbz 0 ;inactivate ide card bl @pcodeon mov @procret,r11 b *r11 procret .word pmeret .word pcodeon li r12,1f00h ;activate pcode card sbo 0 mov @pmeret,r12 ;retrieve pme pointer b *r11 pcodoff mov r12,@pmeret ;save pme pointer li r12,1f00h ;inactivate pcode card sbz 0 b *r11 bcd2hex mov r4,r5 ;isolate low digit andi r5,000fh mov r4,r6 ;isolate high digit andi r6,00f0h srl r6,4 mov r6,r4 ;save original value sla r6,3 ;multiply by 8 sla r4,1 ;multiply original value by 2 a r4,r6 ;high value has now been multiplied by 10 a r5,r6 ;add low and high numbers. r6 now has hex value b *r11 .end 3 Quote Link to comment Share on other sites More sharing options...
RickyDean Posted September 7 Share Posted September 7 (edited) Does anyone know or have the Idecard schematics and pcb layout in Kicad format? I have been trying to get the gerbers to Export to PCB format in Kicad but nothing shows up. Nevermind, I see that I was trying to open a empty pcb file, the good one is in the Idecard directory and I see the image. Screen Recording 2024-09-07 165403.mp4 Edited September 7 by RickyDean added content 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.