#garfield Logs

Apr 17 2021

#garfield Calendar

12:58 AM aandrew: can I use threadlocker with smooth metal pins? like for locking a 3mm pin in a 3mm PLA hole?
01:05 AM rue_mohr: its funny, I'v never had threadlock really lock for me
01:05 AM rue_mohr: I think your supposed to heat it
03:46 AM rue_mohr: it quite seems like the idea on the z80 was to set IX or IY to a page you wanted to use for scratch registers
03:48 AM rue_mohr: its kinda frustrating that moving static values into memory locations is so laborious
03:49 AM rue_mohr: it would actually be handy to have IO mapped memory
03:52 AM rue_mohr: er, hmm
03:52 AM rue_mohr: well there is something to it
03:59 AM Tom_L: morning
04:00 AM rue_mohr: not down yet
04:02 AM rue_mohr: so, the monitor has a mechanism for entering code
04:02 AM rue_mohr: but, because I'm now using an assembler, I dont know the addreses of the system functions
04:06 AM Tom_L: you mean the int21 ones?
04:06 AM Tom_L: no those were dos function calls
04:06 AM rue_mohr: heh kinda
04:06 AM rue_mohr: like print char and get char
12:04 PM aandrew: rue_shop3: you don't have a ROM jump table printout? :-)
12:23 PM rue_shop1: I'm working on the best way to do it
12:23 PM rue_shop1: my thought was that you load A or B with the system function number you want and call a thing that works it out, but
12:23 PM rue_shop1: I'm starting to wonder
12:23 PM rue_shop1: a static table of jumps might work fine
12:24 PM rue_shop1: I'd like something in ram that can have the targer changed out, hmmm
12:24 PM rue_shop1: ponder this
12:27 PM rue_shop1: the z80 instructoins dont lend well to doing a table lookup and jump
12:27 PM rue_shop1: unless your using self modifying code
12:28 PM rue_shop1: the ix and iy registers are interesting
12:28 PM rue_shop1: I could use one for a page of scratch registers and another for a table of function addresses
03:56 PM aandrew: rue_shop3: I strongly recommend a jump table in a fixed location of memory, literally a table (say at 0xc000) that is nothing but JMP 0xc135; JMP 0xc525; JMP 0xc710; JMP 0xc100 etc etc
03:57 PM aandrew: that way the different functions have a fixed address (i.e. 0xc000 is always putc, 0xc004 is always getc, 0xc008 is always puts, etc. but you can update your ROM code without having to change your program
04:36 PM rue_mohr: I'd like to be able to override them
04:36 PM rue_mohr: aka, redefine putc
04:36 PM rue_mohr: I'm kinda digging this interrupt feedback idea
04:37 PM rue_mohr: all I have to do is an IY+0xFF write of nn, and function nn is automatically triggered by the interrupt system
04:38 PM rue_mohr: I dont even have to commit IY for it
04:38 PM rue_mohr: I have a sketch here to have IY point to a list of scratch space anyhow
04:39 PM rue_mohr: if I want other real interrupts, I can use NMI, which will always execute 0x0066
04:40 PM rue_mohr: I can have the system init code copy a function table from rom to ram
04:40 PM rue_mohr: IX is available for whatever
04:41 PM rue_mohr: its more space efficient than the 3 byte jump tables
04:41 PM rue_mohr: it executes with only 1 instruction
04:41 PM rue_mohr: I'm not sure if it stacks properly
04:48 PM rue_mohr: tricky, an interrupt always disables interrupts (fair enough) and I'd want to make sure at the end of each system routine I re-enable them
04:49 PM polprog: thats interesting, so a write to a memory location triggers an interrupt?
04:49 PM rue_mohr: that said, I almost want to re-enable them right away
04:49 PM rue_mohr: yea
04:49 PM rue_mohr: and the value you write causes the interrupt system to do a lookup in a vector table for the handler!
04:49 PM rue_mohr: its called "mode 2"
04:50 PM rue_mohr: when an interrupt happens, it does a special cycle to read an 8 bit value off the bus (no address, special control line condition)
04:50 PM rue_mohr: it takes that 8 bit value and makes it the LSB, with the "I" register as the MSB
04:51 PM rue_mohr: it uses that as the address to load a 16 bit address to jump to
04:51 PM rue_mohr: using that you can have 128 handlers
04:52 PM rue_mohr: otherwise trying to do an indirect jump is a mess that takes about 10 instructions and messes up two 16 bit registers
06:03 PM polprog: clever
06:03 PM polprog: ive never programmed z80
06:03 PM polprog: i still havent started that 6502s i have
06:06 PM rue_mohr: it would be nice to do some 6502 with you
06:06 PM rue_mohr: you dont need ram ya know
06:06 PM rue_mohr: want to flash an led?
06:06 PM rue_mohr: wait, didn't you do that?
06:06 PM rue_mohr: er that was 8051
06:06 PM rue_mohr: ?
06:40 PM polprog: yeah, that was 8051
06:41 PM polprog: i need to finish all that crap and have a free saturday to do 6502 with you
06:42 PM rue_mohr: HEH
06:42 PM rue_mohr: we never line up
06:42 PM rue_mohr: tho i'd love to
06:42 PM polprog: yeah :D
06:43 PM rue_mohr: ; SET UP IX WITH FUNCTION ADDRESS FROM THE LOOKUP TABLE
06:43 PM rue_mohr: PUSH HL
06:43 PM rue_mohr:
06:43 PM rue_mohr: SLA L ; 2 L = L*2
06:43 PM rue_mohr: LD H, #VECT_H ; 2 | 0x2E00 (TABLE BASE IS 2E00)
06:43 PM rue_mohr: PUSH HL ; 3 LD IX, BC
06:43 PM rue_mohr: POP IX ; 4
06:43 PM rue_mohr:
06:43 PM rue_mohr: LD L, (IX+0x00) ; LD HL, (IX)
06:43 PM rue_mohr: LD H, (IX+0x01)
06:43 PM rue_mohr: PUSH HL ; LD IX, HL
06:43 PM rue_mohr: POP IX
06:43 PM rue_mohr:
06:43 PM rue_mohr: POP HL
06:43 PM rue_mohr: JP (IX) ; AND GO!
06:43 PM rue_mohr: i THINK i AHVE IT
06:44 PM rue_mohr: I'll do the hardware thing later
06:44 PM rue_mohr: it'll look like
06:44 PM rue_mohr: LD (IY+0xFF), L ; THIS WILL REQUIRE HARDWARE THAT I'LL BUILD LATER
06:44 PM rue_mohr: RET
06:44 PM rue_mohr: and do the same thing
06:45 PM polprog: :)
06:48 PM rue_mohr: not sure how to deal with the disable interrupt thing
06:49 PM rue_mohr: SO
06:49 PM rue_mohr: trying it gets trickey, I dont have a table yet
06:50 PM rue_mohr: so I need to build one in rom, and then on boot copy it to ram
07:26 PM rue_mohr: IT WORKS!
07:46 PM polprog: :o
07:46 PM polprog: ive gotta hit the bed
07:46 PM polprog: have fun :)
07:46 PM polprog: ill dust the 6502 off tomorrow :)
08:53 PM rue_mohr: I need to work out scrolling on the screen
08:53 PM rue_mohr: and I need to improve the keyboard decoder
08:53 PM rue_mohr: er, reciever fuction
08:54 PM rue_mohr: it should, but isn't being nice about going from 2 keys down to 1 key down and detecting the last one down as a restroke
09:22 PM Tom_L: and what happens if you pound the kbd?
09:39 PM rue_mohr: not much
09:40 PM rue_mohr: but if I hold down A, then B, then release A, it SHOULD register that B just "went down"
09:40 PM rue_mohr: and its not
09:40 PM rue_mohr: not sure where my error is
09:42 PM rue_mohr: so I suppose If I'm putting a uart on the z80 I'd better give it a hardware handshake line
09:42 PM rue_mohr: it wont be able to keep up with much
09:43 PM Tom_L: sounds that way
09:44 PM rue_mohr: I think I'm gonna see if I can trim a 8250 or a 16550 down to a 20 pin module
09:44 PM rue_mohr: I'd like to be able to upload software
09:44 PM rue_mohr: the old interface was parallel printer emulation
09:45 PM rue_mohr: but it doesn't look like the 8250 can automatically controll the handshake line
10:12 PM rue_mohr: awkward, the 8250 and 16550 cannot automatically control the DTR line
10:12 PM rue_mohr: so if my system cant respond fast enough, I cant stop the data
10:13 PM rue_mohr: this is why I like parallel interfaces, the lack of non-existant standards means the implementation can work for the application
10:13 PM rue_mohr: rmm, hey wait
10:13 PM rue_mohr: the dma pins
10:14 PM rue_mohr: ok
10:15 PM rue_mohr: the 8250 doesn't have them
10:16 PM rue_mohr: "RXRDY, Mode 0: When in the 16450 Mode (FCR0e0) or in
10:16 PM rue_mohr: the FIFO Mode (FCR0e1, FCR3e0) and there is at least 1
10:16 PM rue_mohr: character in the RCVR FIFO or RCVR holding register, the
10:16 PM rue_mohr: RXRDY pin (29) will be low active. Once it is activated the
10:16 PM rue_mohr: RXRDY pin will go inactive when there are no more characters
10:16 PM rue_mohr: in the FIFO or holding register."
10:16 PM rue_mohr: I can use that as a DTR pin
10:17 PM rue_mohr: ok, so a 16450 or 16550
10:17 PM rue_mohr: I think I have some 16550s
10:17 PM rue_mohr: but I have another odd one too
10:20 PM rue_shop1: SCN2681
10:22 PM rue_shop1: "Output 0: General purpose output or Channel A request to send (RTSAN, active-Low). Can
10:22 PM rue_shop1: be deactivated automatically on receive or transmit."
10:24 PM rue_shop1: oh this is looking much better
10:27 PM rue_shop1: it might not be able to do 115k
10:28 PM Tom_L: ever tried a USB C to headphone adapter?
10:28 PM rue_shop1: not C no
10:28 PM Tom_L: the S21 doesn't have a headphone jack anymore
10:28 PM rue_shop1: the normal usb ones I'v used work great
10:28 PM Tom_L: i need it for card swipe payments
10:29 PM rue_shop1: ... they use headphone audio for the data !?
10:29 PM Tom_itx: https://store.google.com/au/product/usb_c_headphone_adapter?hl=en-GB
10:29 PM rue_shop1: yup it can do 115k
10:29 PM rue_shop1: its quite an alien chip
10:29 PM Tom_itx: they suggested something like that
10:30 PM rue_shop1: headphone audio adaters are pretty generic
10:30 PM Tom_itx: You can purchase a Samsung USB Type-C to 3.5mm Headphone Jack Adapter from our retail partners such as JB Hi-Fi
10:30 PM rue_shop1: I think everyone is doing a good job
10:30 PM Tom_itx: https://www.jbhifi.com.au/products/samsung-usb-c-to-3-5mm-adapter
10:30 PM Tom_itx: k
10:31 PM Tom_itx: i'll grab one and a spare
11:22 PM rue_mohr: just for context, what was I working on before the z80 laptop came back up?