Friday, September 19, 2014

CP/M 68: linking an C and asm file together

I've googled for this stuff for some time, but finished with reading docs. May be that will be usefull for someone else (notibly me when I will look for that once again)
dtzputs.s , implements dtzputs via calling BDOS fn 2

        text
        globl   _dtzputs
_dtzputs:
        move.l  4(sp),a1        *taking argument from stack
dtzputsl:
        move.b  (a1)+,d1        *take next char; should if be ANDed with 0x00FF ? A1 expected to be w
        cmpi.b  #0,d1
        beq     dtzputse
        move.l  a1,-(sp)        *storing string pointer to stack
        move.w  #2,d0           * calling BDOS '2'
        trap    #2
        move.l  (sp)+,a1
        bra     dtzputsl
dtzputse:
        rts

Assemble it with AS68 -L -U -S 0: dtzputs.s , get dtzputs.o
test.c ,calls dtzputs

main()
{
 dtzputs("Fuck a duck");
}

Compile it with C TEST like that:
9C>c test

9C>CP68 -I 0: TEST.C TEST.I

9C>C068 TEST.I TEST.1 TEST.2 TEST.3 -F

9C>ERA TEST.I

9C>C168 TEST.1 TEST.2 TEST.S

9C>ERA TEST.1

9C>ERA TEST.2

9C>AS68 -L -U -S 0: TEST.S

9C>ERA TEST.S

9C>
And link it

9C>clink test dtzputs

9C>LO68 -R -U_NOFLOAT -O TEST.68K 0:S.O TEST.O DTZPUTS.O .O .O .O .O .O .O .O 0:CLIB

9C>test
Fuck a duck

Quack! Quack! Quack!
The next thing to understand is how to get rid of S.O and CLIB, but it is not for today.

Friday, September 5, 2014

Some more news on SGSBCSD

Looks like I have the code working with SDHC. I'll test in in a few days and release 0.00.04/2491.
So my future plans to port it to m68k code and update 68kavr project. UPD: 2491 version of Searle Grant SBC SD interface released. It works!

Wednesday, September 3, 2014

Huge SGSBCSD update - 2490

A lot of bug fixes for my SD interface for Searle Grant's SBC. A loot! If anyone have it installed - update it now

Friday, August 29, 2014

In a few days I plan to release a significant SGSBCSD [SD interface for Z80] code upgrade. At least a lot of bugfixes.
If anyone cares. Or otherwise, I do not care.

Friday, June 27, 2014

QooltermII at version 0.00.02 - first time update scince 1999!

Well
QoolTermII is [partitial] vt52 terminal emulator for Robotron PC 1715 now gets an updated version - 0.00.02. I bet it is the rarest updated software ever!
Now works with IOByte as well (saying, as bad) as with direct SIO.
Get it here

Tuesday, May 20, 2014

68kavr - considered competed

So that happened.
I consider 68kavr project competed.
That means that it loads OS from SD card
Today I've published my SD card image with the source of BIOS/LDRBIOS, as usuially, here , I'll check two last chapters and copy them there (to be able to discuss them and just they not to be lost one day) in few days.

Saturday, May 3, 2014

Advanced band selection for OpenWRT/luci/Huawei modems

I have a wonderful OpenWRT on a nice TPLink 842 router, and I want to add band selection for LTE and selective UMTS - 900 and 2100 Mhz.
I have E3276 (not in NCM mode!) and several 3G (E1552,E1762) modems. I had to add the folowing:
/lib/netifd/proto/3g.sh:
                       elif echo "$cardinfo" | grep -q "Sierra Wireless"; then
                                SIERRA=1
                       elif echo "$cardinfo" | grep -q "MF823"; then
                                CODE="6" 
                                case "$service" in
                                        umts_only) CODE="5";;
                                        umts900_only) CODE="5";;
                                        umts2100_only) CODE="5";;
                                        gprs_only) CODE="4";;
                                        gprs900_only) CODE="4";;
                                        gprs1800_only) CODE="4";;
                                        lte_only) CODE="7";;
                                        lte_b7_only) CODE="7";;
                                        lte_b20_only) CODE="7";;

                                esac
                                export MODE="AT+ZPREFMODE=${CODE}"
                        elif echo "$cardinfo" | grep -qi "E327"; then
# E327 means both E3276 and E3272 at least; correct for your's 4G model
# 00000100 is EGSM900, 00000200 is primary GSM900
                                BAND="3FFFFFFF"
                                LTEBAND="7FFFFFFFFFFFFFFF"
                                case "$service" in
                                        umts_only) CODE="02";;
                                        umts900_only) CODE="02"
                                            BAND="0002000000000000";;
                                        umts2100_only) CODE="02"
                                            BAND="00400000";;
                                        gprs_only) CODE="01";;
                                        gprs900_only) CODE="01"
                                            BAND="00000100";;
                                        gprs1800_only) CODE="01"
                                            BAND="00000080";;
                                        lte_only) CODE="03";;
                                        lte_b7_only) CODE="03"
                                            LTEBAND="40";;
                                        lte_b20_only) CODE="03"
                                            LTEBAND="80000";;
                                        *) CODE="00";;
                                esac
                                export MODE="AT^SYSCFGEX=\"${CODE}\",${BAND},1,4,${LTEBAND},\"\",\"\""
                        elif echo "$cardinfo" | grep -qi huawei; then
                                BAND="3FFFFFFF"
                                case "$service" in
                                        lte_only) CODE="14,2";;
                                        lte_b7_only) CODE="14,2";;
                                        lte_b20_only) CODE="14,2";;
                                        umts_only) CODE="14,2";;
                                        umts900_only) CODE="14,2"
                                            BAND="0002000000000000";;
                                        umts2100_only) CODE="14,2"
                                            BAND="00400000";;
                                        gprs_only) CODE="13,1";;
                                        gprs900_only) CODE="13,1"
                                            BAND="00000100";;
                                        gprs1800_only) CODE="13,1"
                                            BAND="00000080";;
                                        *) CODE="2,2";;
                                esac
                                export MODE="AT^SYSCFG=${CODE},${BAND},2,4"
                        fi

and in /usr/lib/lua/luci/model/cbi/admin_network/proto_3g.lua
service = section:taboption("general", Value, "service", translate("Service Type"))
service:value("", translate("-- Please choose --"))
service:value("umts", "UMTS/GPRS")
service:value("umts_only", translate("UMTS only"))
service:value("umts900_only", translate("UMTS 900 only"))
service:value("umts2100_only", translate("UMTS 2100 only"))
service:value("gprs_only", translate("GPRS only"))
service:value("gprs900_only", translate("GPRS 900 only"))
service:value("gprs1800_only", translate("GPRS 1800 only"))
service:value("lte_only", translate("LTE only"))
service:value("lte_b7_only", translate("LTE Band 7 only"))
service:value("lte_b20_only", translate("LTE Band 20 only"))
service:value("evdo", "CDMA/EV-DO")

To see how gcom sets the mode, add in /etc/gcom/setmode.gcom:
:start
 print "Trying to set mode ",$env("MODE")," (at /etc/gcom)\n"

And you can monitor by logread -f and see something like that:

Sat May  3 16:06:53 2014 daemon.notice netifd: Interface '3g' is setting up now
Sat May  3 16:06:55 2014 daemon.notice netifd: 3g (10250): Trying to set mode AT^SYSCFGEX="03",3FFFFFFF,1,4,7FFFFFFFFFFFFFFF,"","" (at /etc/gcom)
Sat May  3 16:06:57 2014 daemon.notice pppd[10273]: pppd 2.4.5 started by root, uid 0
Sat May  3 16:06:58 2014 local2.info chat[10275]: abort on (BUSY)

UPD 20140627:
  • Also works with E3272 [Megafon-100?] (change grep -qi "E3276"; to grep -qi "E327"; to support both modems)
  • Has a bug in 4G/LTE band selection. Instead of 1st ($CODE) , the 5th (7FFFFFFFFFFFFFFF) parameter should be changed. If I ever test this on real hardware, I'll update the post.
UPD 20150502: Fixed 4G band selection. UPD 20150801: Some code for ZTE 823D added, it must be in AT-command mode and it cannot select bands, just switches from GSM to UMTS and LTE. That's the only ZTE modem I own for now, so I cannot say if any other model will do the same stuff, check it.