mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-10-31 20:09:02 +00:00
Imaginary Fujinet Clock device with prodos datetime format
This commit is contained in:
parent
192166435b
commit
e7ba568149
@ -30,7 +30,10 @@ Portable emulator of an Apple II+ or //e. Written in Go.
|
|||||||
- Videx Videoterm 80 column card with the Videx Soft Video Switch (Apple ][+ only)
|
- Videx Videoterm 80 column card with the Videx Soft Video Switch (Apple ][+ only)
|
||||||
- SwyftCard (Apple //e only)
|
- SwyftCard (Apple //e only)
|
||||||
- Useful cards not emulating a real card
|
- Useful cards not emulating a real card
|
||||||
- Bootable SmartPort / ProDOS card
|
- Bootable SmartPort / ProDOS card with the following smartport devices:
|
||||||
|
- Block device (hard disks)
|
||||||
|
- Fujinet network device (supports only http(s) with GET and JSON)
|
||||||
|
- Fujinet clock (not in Fujinet upstream)
|
||||||
- VidHd, limited to the ROM signature and SHR as used by Total Replay, only for //e models with 128Kb
|
- VidHd, limited to the ROM signature and SHR as used by Total Replay, only for //e models with 128Kb
|
||||||
- FASTChip, limited to what Total Replay needs to set and clear fast mode
|
- FASTChip, limited to what Total Replay needs to set and clear fast mode
|
||||||
- Mouse Card, emulates the entry points, not the softswitches.
|
- Mouse Card, emulates the entry points, not the softswitches.
|
||||||
|
@ -132,7 +132,12 @@ func (c *CardSmartPort) exec(call *smartPortCall) uint8 {
|
|||||||
if unit == 0 {
|
if unit == 0 {
|
||||||
unit = 1 // For unit 0(host) use the first device
|
unit = 1 // For unit 0(host) use the first device
|
||||||
}
|
}
|
||||||
result = c.devices[unit-1].exec(call)
|
|
||||||
|
if unit > len(c.devices) {
|
||||||
|
result = smartPortErrorNoDevice
|
||||||
|
} else {
|
||||||
|
result = c.devices[unit-1].exec(call)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.trace {
|
if c.trace {
|
||||||
@ -149,7 +154,7 @@ func (c *CardSmartPort) hostStatus(call *smartPortCall) uint8 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// See http://www.1000bit.it/support/manuali/apple/technotes/smpt/tn.smpt.2.html
|
// See http://www.1000bit.it/support/manuali/apple/technotes/smpt/tn.smpt.2.html
|
||||||
c.a.mmu.Poke(dest+0, 0x01) // One device
|
c.a.mmu.Poke(dest+0, uint8(len(c.devices)))
|
||||||
c.a.mmu.Poke(dest+1, 0xff) // No interrupt
|
c.a.mmu.Poke(dest+1, 0xff) // No interrupt
|
||||||
c.a.mmu.Poke(dest+2, 0x00)
|
c.a.mmu.Poke(dest+2, 0x00)
|
||||||
c.a.mmu.Poke(dest+3, 0x00) // Unknown manufacturer
|
c.a.mmu.Poke(dest+3, 0x00) // Unknown manufacturer
|
||||||
|
@ -68,13 +68,13 @@ func (d *SmartPortFujinetClock) status(code uint8, dest uint16) uint8 {
|
|||||||
smartPortStatusCodeTypeRead & smartPortStatusCodeTypeOnline,
|
smartPortStatusCodeTypeRead & smartPortStatusCodeTypeOnline,
|
||||||
0, 0, 0, // Block size is 0
|
0, 0, 0, // Block size is 0
|
||||||
8, 'F', 'N', '_', 'C', 'L', 'O', 'C', 'K', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
|
8, 'F', 'N', '_', 'C', 'L', 'O', 'C', 'K', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
|
||||||
0x0f, // Type clock. See http://www.1000bit.it/support/manuali/apple/technotes/smpt/tn.smpt.4.html
|
0x13, // Type fujinet clock.
|
||||||
0x00, // Subtype
|
0x00, // Subtype
|
||||||
0x00, 0x01, // Firmware version
|
0x00, 0x01, // Firmware version
|
||||||
})
|
})
|
||||||
|
|
||||||
case 'T':
|
case 'T':
|
||||||
// Get time
|
// Get time and send it in easy to use format
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
d.host.a.mmu.pokeRange(dest, []uint8{
|
d.host.a.mmu.pokeRange(dest, []uint8{
|
||||||
uint8(now.Year() / 100),
|
uint8(now.Year() / 100),
|
||||||
@ -85,6 +85,23 @@ func (d *SmartPortFujinetClock) status(code uint8, dest uint16) uint8 {
|
|||||||
uint8(now.Minute()),
|
uint8(now.Minute()),
|
||||||
uint8(now.Second()),
|
uint8(now.Second()),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
case 'P':
|
||||||
|
// Get time and send it in ProDOS format
|
||||||
|
// See 6.1 in https://prodos8.com/docs/techref/adding-routines-to-prodos/
|
||||||
|
now := time.Now()
|
||||||
|
|
||||||
|
datelo := uint8(now.Day()) + uint8(now.Month())<<5
|
||||||
|
datehi := uint8(now.Year()%100)<<1 + uint8(now.Month())>>3
|
||||||
|
timelo := uint8(now.Minute())
|
||||||
|
timehi := uint8(now.Hour())
|
||||||
|
|
||||||
|
d.host.a.mmu.pokeRange(dest, []uint8{
|
||||||
|
datelo,
|
||||||
|
datehi,
|
||||||
|
timelo,
|
||||||
|
timehi,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return smartPortNoError // The return code is always success
|
return smartPortNoError // The return code is always success
|
||||||
|
@ -141,7 +141,7 @@ func (t *traceProDOS) dumpMLIReturn() {
|
|||||||
minute := t.a.mmu.Peek(0xbf92)
|
minute := t.a.mmu.Peek(0xbf92)
|
||||||
hour := t.a.mmu.Peek(0xbf93)
|
hour := t.a.mmu.Peek(0xbf93)
|
||||||
fmt.Printf("%04v-%02v-%02v %02v:%02v\n",
|
fmt.Printf("%04v-%02v-%02v %02v:%02v\n",
|
||||||
date>>9+1900, (date>>5)&0x1f, date&0x1f, // Review Y2K
|
date>>9+1900, (date>>5)&0x0f, date&0x1f, // Review Y2K
|
||||||
hour, minute)
|
hour, minute)
|
||||||
case 0xc5: // Online
|
case 0xc5: // Online
|
||||||
dataAddress := t.paramWord(2)
|
dataAddress := t.paramWord(2)
|
||||||
|
Loading…
Reference in New Issue
Block a user