Mercurial > hg > Members > kono > nitros9-code
view lib/net.as @ 2981:9550602c9a0b
sierra/objs_lsl/mnln.asm: Use division quotient, not remainder
It calls a routine twice to make a division (L125C) but doesn't check
the right register for the result. The result is returned in reg U and
the remainder in reg D but the procedure expect the result to be returned
in reg D. The divison routine seems to be correct because it is properly
used elsewhere in the code.
Patch by Guillaume Major and Robert Gault.
author | Guillaume Major <guillaume.major@gmail.com> |
---|---|
date | Sat, 12 Apr 2014 15:30:03 +0200 |
parents | 3b7b5021f8bc |
children |
line wrap: on
line source
******************************************************************** * net - network routines * * $Id$ * * Edt/Rev YYYY/MM/DD Modified by * Comment * ------------------------------------------------------------------ * 1 2010/01/08 Boisy G. Pitre * Started. section bss nbufferl equ 128 nbuffer rmb nbufferl endsect section code space fcb C$SPAC devnam fcs "/N" getopts leax nbuffer,u ldb #SS.Opt os9 I$GetStt rts setopts leax nbuffer,u ldb #SS.Opt os9 I$SetStt rts * Set Echo On * * Entry: A = path to network device * Exit: * Success: CC carry clear * Failure: CC carry set, B = error code SetEchoOn: pshs a,x bsr getopts bcs rawex ldb #1 stb PD.EKO-PD.OPT,x bsr setopts puls a,x,pc * Set Echo Off * * Entry: A = path to network device * Exit: * Success: CC carry clear * Failure: CC carry set, B = error code SetEchoOff: pshs a,x bsr getopts bcs rawex clr PD.EKO-PD.OPT,x bsr setopts puls a,x,pc * Set Auto Linefeed On * * Entry: A = path to network device * Exit: * Success: CC carry clear * Failure: CC carry set, B = error code SetAutoLFOn: pshs a,x bsr getopts bcs rawex ldb #1 stb PD.ALF-PD.OPT,x bsr setopts puls a,x,pc * Set Auto Linefeed Off * * Entry: A = path to network device * Exit: * Success: CC carry clear * Failure: CC carry set, B = error code SetAutoLFOff: pshs a,x bsr getopts bcs rawex clr PD.ALF-PD.OPT,x bsr setopts puls a,x,pc * Put the path passed in A in raw mode * * Entry: A = path to network device * * Exit: * Success: CC carry clear * Failure: CC carry set, B = error code RawPath: pshs a,x bsr getopts bcs rawex leax PD.UPC-PD.OPT,x ldb #PD.QUT-PD.UPC rawloop clr ,x+ decb bpl rawloop bsr setopts rawex puls a,x,pc * Attempts to open and setup a path to the TCP server * * Exit: * Success: A = path to network device, CC carry clear * Failure: B = error code, CC carry set TCPOpen: pshs x,y lda #UPDAT. leax devnam,pcr os9 I$Open bcs openerr bsr SetEchoOff bsr SetAutoLFOff openerr puls x,y,pc * Informs the server that we are killing a session * * Entry: A = path to network device * Y = pointer to token string (nul terminated) * * Exit: * Success: CC carry clear * Failure: CC carry set, B = error code TCPKill: pshs a,x,y leax tcpkill,pcr ldy #tcpkilll os9 I$Write lbcs connectex bra writeport * Informs the server that we are joining a session * * Entry: A = path to network device * Y = pointer to token string (nul terminated) * * Exit: * Success: CC carry clear * Failure: CC carry set, B = error code TCPJoin: pshs a,x,y leax tcpjoin,pcr ldy #tcpjoinl os9 I$Write lbcs connectex bra writeport * Attempts to connect to a TCP/IP host via the server * * Entry: A = path to network device * X = pointer to host name string (nul terminated) * Y = pointer to port string (nul terminated) * * Exit: * Success: CC carry clear * Failure: CC carry set, B = error code TCPConnectToHost: pshs a,x,y leax tcpconnect,pcr ldy #tcpconnectl os9 I$Write bcs connectex ldx 1,s lbsr STRLEN tfr d,y lda ,s os9 I$Write * write space leax space,pcr ldy #1 os9 I$Write * write port (we worry about response later) writeport ldx 3,s get original Y on stack pshs a lbsr STRLEN tfr d,y puls a os9 I$Write leax acr,pcr ldy #1 os9 I$WritLn * read response from server * Entry: A = path readresponse leax nbuffer,u ldy #nbufferl os9 I$ReadLn bcs connectex lda ,x cmpa #'F bne connectex * failure case: read number and return it with carry set leax 5,x skip over "FAIL " lbsr DEC_BIN error will fit in B coma set carry connectex puls a,x,y,pc acr fcb C$CR * Requests to listen on a port * * Entry: A = path to network device * X = pointer to parameter string (nul terminated) * * Exit: * Success: CC carry clear * Failure: CC carry set, B = error code TCPListen: pshs a,x,y leax tcplisten,pcr ldy #tcplistenl os9 I$Write bcs connectex ldx 1,s lbsr STRLEN tfr d,y lda ,s os9 I$Write leax acr,pcr ldy #1 os9 I$WritLn bra readresponse * Disconnects the TCP/IP host via the server * * Entry: A = path to network device * * Exit: * Success: CC carry clear * Failure: B = error code, CC carry set TCPDisconnect: os9 I$Close rts tcpconnect fcc 'tcp connect ' tcpconnectl equ *-tcpconnect tcplisten fcc 'tcp listen ' tcplistenl equ *-tcplisten tcpjoin fcc 'tcp join ' tcpjoinl equ *-tcpjoin tcpkill fcc 'tcp kill ' tcpkilll equ *-tcpkill endsect