uint8 params

This commit is contained in:
Iván Izaguirre 2024-02-13 12:18:29 +01:00
parent 9035db5d81
commit 5fe1dc4fdf
3 changed files with 11 additions and 4 deletions

View File

@ -162,6 +162,15 @@ func paramsGetInt(params map[string]string, name string) (int, error) {
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
func paramsGetDIPs(params map[string]string, name string, size int) ([]bool, error) {
value, ok := params[name]

View File

@ -65,14 +65,14 @@ func newCardDan2ControllerBuilder() *cardBuilder {
c.slotA = &cardDan2ControllerSlot{}
c.slotA.card = &c
c.slotA.path = params["slot1"]
num, _ := paramsGetInt(params, "slot1file")
num, _ := paramsGetUInt8(params, "slot1file")
c.slotA.fileNo = uint8(num)
c.slotA.initializeDrive()
c.slotB = &cardDan2ControllerSlot{}
c.slotB.card = &c
c.slotB.path = params["slot2"]
num, _ = paramsGetInt(params, "slot2file")
num, _ = paramsGetUInt8(params, "slot2file")
c.slotB.fileNo = uint8(num)
c.slotB.initializeDrive()

View File

@ -36,12 +36,10 @@ func newCardParallelPrinterBuilder() *cardBuilder {
return nil, err
}
c.file = f
err = c.loadRomFromResource("<internal>/Apple II Parallel Printer Interface Card ROM fixed.bin")
if err != nil {
return nil, err
}
return &c, nil
},
}