mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-06-12 20:29:45 +00:00
uint8 params
This commit is contained in:
parent
9035db5d81
commit
5fe1dc4fdf
|
@ -162,6 +162,15 @@ func paramsGetInt(params map[string]string, name string) (int, error) {
|
||||||
return strconv.Atoi(value)
|
return strconv.Atoi(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func paramsGetUInt8(params map[string]string, name string) (uint8, error) {
|
||||||
|
value, ok := params[name]
|
||||||
|
if !ok {
|
||||||
|
return 0, fmt.Errorf("missing parameter %s", name)
|
||||||
|
}
|
||||||
|
result, err := strconv.ParseUint(value, 10, 8)
|
||||||
|
return uint8(result), err
|
||||||
|
}
|
||||||
|
|
||||||
// Returns a 1 based array of bools
|
// Returns a 1 based array of bools
|
||||||
func paramsGetDIPs(params map[string]string, name string, size int) ([]bool, error) {
|
func paramsGetDIPs(params map[string]string, name string, size int) ([]bool, error) {
|
||||||
value, ok := params[name]
|
value, ok := params[name]
|
||||||
|
|
|
@ -65,14 +65,14 @@ func newCardDan2ControllerBuilder() *cardBuilder {
|
||||||
c.slotA = &cardDan2ControllerSlot{}
|
c.slotA = &cardDan2ControllerSlot{}
|
||||||
c.slotA.card = &c
|
c.slotA.card = &c
|
||||||
c.slotA.path = params["slot1"]
|
c.slotA.path = params["slot1"]
|
||||||
num, _ := paramsGetInt(params, "slot1file")
|
num, _ := paramsGetUInt8(params, "slot1file")
|
||||||
c.slotA.fileNo = uint8(num)
|
c.slotA.fileNo = uint8(num)
|
||||||
c.slotA.initializeDrive()
|
c.slotA.initializeDrive()
|
||||||
|
|
||||||
c.slotB = &cardDan2ControllerSlot{}
|
c.slotB = &cardDan2ControllerSlot{}
|
||||||
c.slotB.card = &c
|
c.slotB.card = &c
|
||||||
c.slotB.path = params["slot2"]
|
c.slotB.path = params["slot2"]
|
||||||
num, _ = paramsGetInt(params, "slot2file")
|
num, _ = paramsGetUInt8(params, "slot2file")
|
||||||
c.slotB.fileNo = uint8(num)
|
c.slotB.fileNo = uint8(num)
|
||||||
c.slotB.initializeDrive()
|
c.slotB.initializeDrive()
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,10 @@ func newCardParallelPrinterBuilder() *cardBuilder {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
c.file = f
|
c.file = f
|
||||||
|
|
||||||
err = c.loadRomFromResource("<internal>/Apple II Parallel Printer Interface Card ROM fixed.bin")
|
err = c.loadRomFromResource("<internal>/Apple II Parallel Printer Interface Card ROM fixed.bin")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &c, nil
|
return &c, nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user