;***** MSUMM V1.0 Source Code
;***** Message base summary door for MAXsBBS V1.52+
;***** by Keith Bennett and Glen Martin 1996
;***** Last updated: 22-JAN-1996

;get some library offsets and constants

           include "Assempro:Includes/exec.offsets"
           include "Assempro:Includes/dos.offsets"
mode_old   equ     1005

;set up some macros for library calls

callsys:   macro   $\1                   ;macro for exec lib calls
           jsr     _LVO\1(a6)
           endm
calldos:   macro   $\1                   ;macro for dos lib calls
           move.l  doslibbase(pc),a6
           jsr     _LVO\1(a6)
           move.w  #4,a6
           move.l  (a6),a6
           endm

           bra     begin                 ;vanity embedding
           dc.b    "MSUMM V1.0 for MAXsBBS "
           dc.b    "by Keith Bennett and Glen Martin 1996."
           align

;***** START OF PROGRAM *****

begin:     nop                           ;do nothing!
           lea     InitialSP(PC),a5      ;store the current stack pointer
           move.l  sp,(a5)               ;in case we exit from a subroutine

           move.w  #4,a6                 ;get the exec library base in a6
           move.l  (a6),a6

;***** READ ANY SWITCHES

           subq.l  #1,d0                 ;did we get anything from the launch?
           beq     exit1                 ;if not then lets get out of here
           subq.l  #1,d0                 ;are there any parameters
           beq     getnoden              ;nope, then skip 
           move.l  a0,a1                 ;start of paramenters to a1
           move.b  (a1)+,d1              ;read parameter
           and.b   #$df,d1
           cmp.b   #"A",d1               ;is it "A" for all?
           bne     getnoden              ;no, skip
           lea     allflag(PC),a5        ;set the all flag
           move.b  #1,(a5)

;***** SET UP MESSAGE PORTS TO/FROM MAXS BBS

getnoden:  add.l   d0,a0                 ;point a0 to node number
           lea     msgportn1+11(PC),a5   ;load the node number into the
           move.b  (a0),(a5)             ;message control port name
           lea     msgportn2+9(PC),a5    ;and the reply port name
           move.b  (a0),(a5)

           move.l  #140,d0               ;get some ram for the message port
           move.l  #$10001,d1
           callsys allocmem
           lea     msgport(PC),a5
           move.l  d0,(a5)
           beq     exit1                 ;cant get it? then exit

           sub.l   a1,a1                 ;find out who am I
           callsys findtask
           move.l  (a5),a0

           move.l  d0,16(a0)             ;get ourself a free signal
           moveq   #-1,d0
           callsys allocsignal
           move.l  (a5),a1

           move.b  #4,8(a1)              ;set up the message port
           lea     msgportn2(PC),a5
           move.l  a5,10(a1)
           move.b  d0,15(a1)
           bmi     exit2                 ;if no free signals then exit
           move.b  #5,42(a1)
           move.l  a1,48(a1)
           move.w  #106,52(a1)
           callsys addport               ;add our message port

           callsys forbid                ;find max's control port
           lea     msgportn1(PC),a1
           callsys findport
           lea     contport(PC),a5
           move.l  d0,(a5)
           callsys  permit
           tst.l   (a5)
           beq     exit3                 ;if we cant find it then exit

;***** INITIALISE EVERYTHING

           lea     doslibname(PC),a1     ;open dos library
           sub.l   d0,d0
           callsys openlibrary
           lea     doslibbase(PC),a5
           move.l  d0,(a5)
           beq     cleanup               ;if we cant open it then exit

           move.l  bufflen(PC),d0        ;get some ram for the file buffer
           move.l  #$10000,d1
           callsys allocmem
           lea     filebuff(PC),a5
           lea     txt05(PC),a0
           move.l  d0,(a5)
           beq     endit                 ;cant get it? then error and exit

           move.l  #6200,d0              ;get some ram for the sections data
           move.l  #$10000,d1
           callsys allocmem
           lea     sectdata(PC),a5
           lea     txt05(PC),a0
           move.l  d0,(a5)
           beq     endit                 ;cant get it? then error and exit
           
           moveq   #8,d0                 ;ask max for the BBS path
           lea     textbuff(PC),a3
           bsr     getstring
           subq    #1,a2                 ;add on max's config filename
           lea     confname(PC),a0
loop02:    move.b  (a0)+,(a2)+
           bne     loop02
           bsr     openf                 ;open max's config file
           lea     txt03(PC),a0
           tst.l   d0                    ;was the open successful?
           beq     endit                 ;no, show error and exit
           move.l  d0,d1                 ;seek through max's config file to
           move.l  #144,d2               ;the message base path
           moveq   #-1,d3
           calldos seek
           move.l  filehand(PC),d1       ;read the message base path
           lea     textbuff(PC),a0
           move.l  a0,d2
           moveq   #41,d3
           calldos read
           lea     txt03(PC),a0
           tst.l   d0                    ;did it read ok?
           bmi     endit                 ;no, show error and exit

           move.l  filehand(PC),d1       ;seek through max's config file to
           move.l  #2496,d2              ;the sections data
           moveq   #-1,d3
           calldos seek
           move.l  filehand(PC),d1       ;read the sections data
           move.l  sectdata(PC),d2
           move.l  #6200,d3
           calldos read
           lea     txt03(PC),a0
           tst.l   d0                    ;did it read ok?
           bmi     endit                 ;no, show error and exit

           move.l  filehand(PC),d1       ;close max's config file
           calldos close
           lea     filehand(PC),a0       ;clear filehandle
           clr.l   (a0)

           lea     textbuff(PC),a0       ;point to end of message base path
loop03:    move.b  (a0)+,d0
           bne     loop03
           subq    #1,a0
           lea     msgname(PC),a1        ;add on message.data filename
loop04:    move.b  (a1)+,(a0)+
           bne     loop04
           bsr     openf                 ;open message.data file
           lea     txt04(PC),a0
           tst.l   d0                    ;did it open ok?
           beq     endit                 ;no, show error and exit
           move.l  d0,d1                 ;seek though the message.data file to
           move.l  #470,d2               ;the message records
           move.l  #-1,d3
           calldos seek

           lea     username(PC),a3       ;get user's username from max
           moveq   #1,d0
           bsr     getstring

           lea     accessl(PC),a3        ;get user's access level from max
           moveq   #1,d0
           bsr     getint
           
           lea     lastmsgr(PC),a3       ;get user's lastmsgr pointer
           moveq   #102,d0
           bsr     getint

           lea     txt01(PC),a0          ;print please wait message
           bsr     print

           move.l  sectdata(PC),a0       ;clear the count values
           move.w  #99,d0
clloop:    clr.l   38(a0)
           clr.l   50(a0)
           clr.w   58(a0)
           add.w   #62,a0
           dbra    d0,clloop

;***** READ DATA FROM MESSAGE BASE

mainloop:  move.l  filehand(PC),d1       ;read next block of message data
           move.l  filebuff(PC),d2
           move.l  bufflen(PC),d3
           calldos read
           lea     txt04(PC),a0
           move.l  d0,d5                 ;get number of bytes read
           bmi     endit                 ;error reading
           beq     eof                   ;end of file
           lea     txt02(PC),a0          ;print a dot
           bsr     print
           move.l  filebuff(PC),a4       ;point to start of message data

secdloop:  btst    #0,27(a4)             ;deleted message?
           bne     next                  ;yes, next message
           clr.l   d7
           move.b  28(a4),d7             ;read section number from message
           move.l  sectdata(PC),a2       ;point to section data
           mulu    #62,d7
           add.w   d7,a2
           lea     totmsg(PC),a5         ;increment total msg count
           move.l  (a5),d0
           addq    #1,d0
           move.l  d0,(a5)
           move.w  50(a2),d0             ;increment section msg count
           addq    #1,d0
           move.w  d0,50(a2)
           clr.l   d6                    ;clear new msg flag
           move.l  lastmsgr(PC),d0       ;read last msg read pointer
           cmp.l   (a4),d0               ;compare with msg number
           bhs     notnew                ;skip if not new?
           moveq   #1,d6                 ;set new msg flag
           lea     totnew(PC),a5         ;increment total new count
           move.l  (a5),d0
           addq    #1,d0
           move.l  d0,(a5)
           move.w  40(a2),d0             ;increment section new count
           addq    #1,d0
           move.w  d0,40(a2)
notnew:    lea     70(a4),a0             ;is it to user?             
           bsr     checkusrn
           tst.l   d0
           beq     notto                 ;skip if not
           lea     totto(PC),a5          ;increment total to count
           move.l  (a5),d0
           addq    #1,d0
           move.l  d0,(a5)
           move.w  52(a2),d0             ;increment section to count
           addq    #1,d0
           move.w  d0,52(a2)
           tst.l   d6                    ;check new flag
           beq     notto                 ;skip if not new
           lea     totnewto(PC),a5       ;increment total new to count
           move.l  (a5),d0
           addq    #1,d0
           move.l  d0,(a5)
           move.w  58(a2),d0             ;increment section new to count
           addq    #1,d0
           move.w  d0,58(a2)
notto:     lea     29(a4),a0             ;is it from user?
           bsr     checkusrn
           tst.l   d0
           beq     next                  ;no, next message
           lea     totfrom(PC),a5        ;increment total from count
           move.l  (a5),d0
           addq    #1,d0
           move.l  d0,(a5)
           move.w  38(a2),d0             ;increment section from count
           addq    #1,d0
           move.w  d0,38(a2)

next:      add.w   #274,a4               ;point to next record
           sub.l   #274,d5               ;end of buffer?
           bhi     secdloop              ;no, next record
           bra     mainloop              ;yes, read next block

;***** PRINT RESULTS

eof:       lea     txt07(PC),a0          ;cls
           bsr     print
           lea     txth1(PC),a0          ;print headings
           bsr     print
           lea     txt08(PC),a0           
           bsr     print
           lea     txth2(PC),a0           
           bsr     print
           lea     txth3(PC),a0           
           bsr     print
           lea     txt08(PC),a0           
           bsr     print
           lea     txth4(PC),a0           
           bsr     print
           lea     txt08(PC),a0           
           bsr     print
           lea     txth5(PC),a0           
           bsr     print
           lea     txth6(PC),a0           
           bsr     print
           lea     txt08(PC),a0           
           bsr     print
           lea     txth7(PC),a0           
           bsr     print
           lea     txt08(PC),a0           
           bsr     print

           clr.l   d7                    ;clear section no
           clr.l   d5                    ;clear max total
           move.l  sectdata(PC),a4       ;point to section data
prtloop:   move.b  61(a4),d0             ;is it a file section?
           bmi     nexts                 ;yes, next section
           move.b  (a4),d0               ;does it have a name?
           beq     nexts                 ;no, next section
           move.l  54(a4),d0             ;read max no of messages
           add.l   d0,d5                 ;add it to the max total
           lea     txthb(PC),a0          ;point to bright start of line text
           move.l  accessl(PC),d0        ;get user's access level
           cmp.l   42(a4),d0             ;do we have low access?
           blo     noacc                 ;no
           cmp.l   46(a4),d0             ;do we have high access?
           bls     display               ;yes
noacc:     lea     txthc(PC),a0          ;point to dull start of line text
           move.l  allflag(PC),d0        ;is the all flag set?
           beq     nexts                 ;no, then skip section
display:   bsr     print                 ;print start of line text
           move.l  d7,d0                 ;get section number
           moveq   #2,d6                 ;2 digits max
           bsr     dispnum               ;display number
           lea     txt09(PC),a0          ;print a space
           bsr     print
           move.l  a4,a0                 ;point to section name
           moveq   #29,d1                ;30 characters max
stnloop:   move.b  (a0)+,d0              ;read next character
           beq     spfill                ;end of text?
           dbra    d1,stnloop            ;loop until 31 charactes read
           tst.b   (a0)                  ;check if its the last character
           beq     termtext              ;yes, dont put in the "+"
           move.b  #"+",-1(a0)           ;text too long, put in a "+"
           bra     termtext              
spfill:    sub.w   #1,a0                 ;backspace to the null
spfloop:   move.b  #" ",(a0)+            ;space fill up to 31 characters
           dbra    d1,spfloop
termtext:  move.b  #0,(a0)               ;terminate text
           move.l  a4,a0                 ;and print it
           bsr     print
           lea     txtc1(PC),a0          ;change color
           bsr     print
           move.l  54(a4),d0             ;get max no of messages in section
           bsr     dispnum6              ;print it
           clr.l   d0
           move.w  50(a4),d0             ;get no of messages in section
           bsr     dispnum6              ;print it
           clr.l   d0
           move.w  52(a4),d0             ;get no of to you messages
           bsr     dispnum6              ;print it
           clr.l   d0
           move.w  38(a4),d0             ;get no of from you messages
           bsr     dispnum6              ;print it
           lea     txtc2(PC),a0          ;change color
           bsr     print
           clr.l   d0
           move.w  40(a4),d0             ;get no of new messages
           bsr     dispnum6              ;print it
           clr.l   d0
           move.w  58(a4),d0             ;get no of new to you messages
           bsr     dispnum6              ;print it
           lea     txthe(PC),a0          ;print end of line
           bsr     print

nexts:     add.w   #62,a4                ;point to next section
           addq    #1,d7                 ;increment section count
           cmp.w   #100,d7               ;done all 100 sections?
           bne     prtloop               ;no, no next one

           lea     txth8(PC),a0          ;print underline
           bsr     print
           lea     txt08(PC),a0          ;print CR
           bsr     print
           lea     txth9(PC),a0          ;print totals text
           bsr     print
           lea     txtc1(PC),a0          ;change color
           bsr     print
           move.l  d5,d0                 ;print max total
           bsr     dispnum6
           move.l  totmsg(PC),d0         ;print total messages
           bsr     dispnum6
           move.l  totto(PC),d0          ;print total to
           bsr     dispnum6
           move.l  totfrom(PC),d0        ;print total from
           bsr     dispnum6
           lea     txtc2(PC),a0          ;change color
           bsr     print
           move.l  totnew(PC),d0         ;print total new
           bsr     dispnum6
           move.l  totnewto(PC),d0       ;print total new to
           bsr     dispnum6
           lea     txthe(PC),a0          ;print end of line
           bsr     print
           lea     txth0(PC),a0          ;print underline
     
endit:     bsr     print                 ;print message
           lea     txt06(PC),a0          ;display hit any key to end
           bsr     hotkey                ;and wait for key

;***** CLEAN UP AND EXIT

cleanup:   move.l  filehand(PC),d1       ;get file handle
           beq     nof                   ;skip if file is not open
           calldos close                 ;close file
nof:       move.l  filebuff(PC),a1       ;free file buffer ram
           move.l  a1,d0
           beq     nor                   ;but only if it's allocated
           move.l  bufflen(PC),d0
           callsys freemem
nor:       move.l  sectdata(PC),a1       ;free section data ram
           move.l  a1,d0
           beq     nor2                  ;but only if it's allocated
           move.l  #6200,d0
           callsys freemem
nor2:      move.l  doslibbase(PC),a1     ;get dos lib base
           move.l  a1,d0                 ;test for zero
           beq.s   \skip                 ;is it open?
           callsys closelibrary          ;close if open
\skip:     bsr     getmsgport            ;get message port
           move.w  #20,(a2)              ;command #20 (exit door)
           move.l  contport(PC),a0       ;tell MAX's that i'm finished
           callsys putmsg
\wait:     move.l  msgport(PC),a0        ;wait for reply
           callsys waitport
           move.l  msgport(PC),a0        ;get reply
           callsys getmsg
           tst.l   d0
           beq     \wait
exit3:     move.l  msgport(PC),a1        ;remove our message port
           callsys remport
           sub.l   d0,d0                 ;free our signal
           move.l  msgport(PC),a0
           move.b  15(a0),d0
           callsys freesignal
exit2:     move.l  msgport(PC),a1        ;free message port ram
           move.l  #140,d0
           callsys freemem
exit1:     move.l  InitialSP(PC),sp      ;recover the stack pointer
           sub.l   d0,d0
           rts                           ;return
       
;***** CHECK USERNAME WITH (a0), d0=0 for no match

checkusrn: moveq   #1,d0                 ;set match flag
           lea     username(PC),a1       ;point to user's username
loopu:     move.b  (a0)+,d1              ;read character from message username
           cmp.b   #" ",d1               ;is it a space?
           beq     compskip1             ;yes, dont convert
           and.b   #$df,d1               ;convert to uppercase
compskip1: move.b  (a1)+,d2              ;read character from username
           cmp.b   #" ",d2               ;is it a space?
           beq     compskip2             ;yes, dont convert
           and.b   #$df,d2               ;convert to uppercase
compskip2: cmp.b   d1,d2                 ;are they the same?
           bne     nomatch               ;no, reset match flag and return
           or.b    d1,d2                 ;both nulls? (end of username?)
           bne     loopu                 ;no, check next character
           rts                           ;yes, return (match)
nomatch:   clr.l   d0                    ;clear match flag
           rts                           ;return from subroutine

;***** DISPLAY NUMBER d0, d6 characters

dispnum6:  moveq   #6,d6                 ;default 6 digits
dispnum:   bsr     hxtoa                 ;convert number to ascii
           clr.l   d0                    ;clear counter
           move.l  a1,a0                 ;point to start of number
countloop: addq    #1,d0                 ;increment counter
           tst.b   (a0)+                 ;check character
           bne     countloop             ;loop till null
           lea     textbuff(PC),a0       ;point to buffer
           sub.b   d0,d6
           bmi     copynum
spaceloop: move.b  #" ",(a0)+
           dbra    d6,spaceloop
copynum:   move.b  (a1)+,(a0)+
           bne     copynum
           move.b  #" ",-1(a0)
           move.b  #0,(a0)
           lea     textbuff(PC),a0

;***** PRINT (a0)

print:     bsr     getmsgport            ;get message port
           move.w  #1,(a2)+              ;command #1
           clr.w   (a2)+                 ;no data
ploop:     move.b  (a0)+,(a2)+           ;put print text into message
           bne     ploop
           bra     putwmsg               ;send the message then return

;***** DISPLAY (a0) AND HOTKEY TO d0

hotkey:    bsr     getmsgport            ;get message port
           move.w  #8,(a2)+              ;command #8
           clr.w   (a2)+                 ;no data
\loop:     move.b  (a0)+,(a2)+           ;copy print text into message
           bne     \loop
           bsr     putwmsg               ;send message to max
           move.b  (a0),d0               ;read keypress
           and.b   #$df,d0               ;convert to uppercase
           rts                           ;return from subroutine

;***** GET STRING INFO FROM MAX, d0=string type, result to (a3) 

getstring: bsr     getmsgport            ;get message port
           move.w  #14,(a2)+             ;command #14
           move.w  d0,(a2)               ;data=string type
           bsr     putwmsg               ;send request to max
           move.l  a3,a2                 ;store reply
\loop      move.b  (a0)+,(a2)+
           bne     \loop
           rts                           ;return from subroutine

;***** GET INTEGER INFO FROM MAX, d0=int type, result(.l) to (a3)

getint:    bsr     getmsgport            ;get message port
           move.w  #13,(a2)+             ;command #13
           move.w  d0,(a2)               ;data=int type
           bsr     putwmsg               ;send request to max
           sub.l   d0,d0                 ;read result
           move.w  -(a0),d0
           move.l  d0,(a3)               ;store result
           rts                           ;return from subroutine

;***** GET MESSAGE PORT

getmsgport:move.l  msgport(PC),a1        ;point to message port structure
           move.l  a1,a2
           adda.w  #34,a1                ;point a1 to message structure
           adda.w  #54,a2                ;point a2 to the message data
           clr.l   2(a2)                 ;clear the data field
           rts                           ;return

;***** SEND MESSAGE TO MAX's, WAIT FOR AND GET REPLY

putwmsg:   move.l  contport(PC),a0       ;point to message port structure
           callsys putmsg                ;send the message to MAX's
\wait:     move.l  msgport(PC),a0
           callsys waitport              ;wait for reply
           move.l  msgport(PC),a0
           callsys getmsg                ;get reply message
           tst.l   d0                    ;did we get a reply
           beq     \wait                 ;no, keep waiting
           move.l  d0,a0                 ;check for carrier loss
           adda.w  #24,a0
           tst.w   80(a0)
           bne     cleanup               ;carrier loss? if so then exit
           rts                           ;return

;***** OPEN A FILE

openf:     moveq   #4,d5                 ;number of times to attempt open
openloop:  lea     textbuff(PC),a0       ;point to file name
           move.l  a0,d1
           move.l  #mode_old,d2          ;open in read mode 
           calldos open                  ;open file
           tst.l   d0                    ;did it open?
           bne     openok                ;yes, store handle and return
           calldos ioerr                 ;no, get error code
           cmp.l   #202,d0               ;is file in use?
           bne     openerror             ;no, then it's a real error
           move.l  #64,d1                ;wait a few secs
           calldos delay
           dbra    d5,openloop           ;next attempt
openerror: clr.l   d0                    ;clear filehandle (error)
openok:    lea     filehand(PC),a0       ;store filehandle
           move.l  d0,(a0)
           rts                           ;return

;CONVERT HEX (BINARY) d0 TO ASCII (a1)

hxtoa:     tst.l   d0                    ;compliments Anthony Barrett's
           bne     skp04                 ;door starter pack
           lea     cbuf3(PC),a1 
           move.b  #'0',(a1)
           clr.b   1(a1)
           rts
skp04:     lea     cbuf3(PC),a1
           move.l  #$30303030,d1
           move.l  d1,(a1)+
           move.l  d1,(a1)+
           move.w  d1,(a1)
           suba.w  #28,a1
           move.l  d1,(a1)+
           move.l  d1,(a1)+
           move.w  #$3031,(a1)
nxbit:     btst    #0,d0
           bne     goada
retur:     lsr.l   #1,d0
           beq     endbit
           lea     cbuf2(PC),a1
           lea     cbuf1(PC),a2
           move.l  (a2)+,(a1)+
           move.l  (a2)+,(a1)+
           move.w  (a2),(a1)
           addq.l  #1,a1
           addq.l  #1,a2
           bsr     adasc
           bra     nxbit
endbit     lea     cbuf3(PC),a1
lop03:     cmp.b   #$30,(a1)+
           beq.s   lop03
           subq.l  #1,a1
           rts
goada:     lea     cbuf1+9(PC),a1
           lea     cbuf3+9(PC),a2
           bsr     adasc
           bra     retur
adasc:     moveq   #9,d1
next1:     move.b  (a1),d2
           sub.b   #$30,d2       
           add.b   d2,(a2)
check:     cmp.b   #$39,(a2)
           bhi     overf
           subq.l  #1,a2
retr2:     subq.l  #1,a1
           dbf     d1,next1
           rts
overf:     sub.b   #10,(a2)
           addq.b  #1,-(a2)
           movem.l a1/a2/d1,-(sp)
           sub.l   d1,d1
           bsr     check
           movem.l (sp)+,d1/a2/a1
           bra     retr2

;***** DATA
;file and port names

msgportn1: dc.b    "DoorControl#",0      ;message port name
msgportn2: dc.b    "DoorReply#",0        ;message port name
doslibname:dc.b    "dos.library",0       ;dos library name
msgname:   dc.b    "Message.data",0      ;message base file name

;text

txt01:     dc.b    13,13,"Please wait while I read the message base.",0
txt02:     dc.b    ".",0
txt03:     dc.b    13,"Error accessing MAXsBBS config file",13,0
txt04:     dc.b    13,"Error accessing Message base",13,0
txt05:     dc.b    13,"Error allocating RAM",13,0
txt06:     dc.b    13,13,"Hit any key to continue",0
txt07:     dc.b    $1b,"[H",$1b,"[2J",$1b,"[0m",0
txt08:     dc.b    13,0
txt09:     dc.b    " ",0
txth1:     dc.b    "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ¿",0
txth2:     dc.b    "³ ",$1b,"[1mMESSAGE AREA",$1b,"[0m                      ³ ",0
txth3:     dc.b    $1b,"[1mTOTAL FOR AREA",$1b,"[0m            ³ ",$1b,"[1mNEW MSGS",$1b,"[0m    ³",0
txth4:     dc.b    "ÃÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÅÄÄÄÄÄÄÂÄÄÄÄÄÄ´",0
txth5:     dc.b    "³ ",$1b,"[1mNO.",$1b,"[0m³ ",$1b,"[1mNAME"
           dc.b    $1b,"[0m                         ³ ",$1b,"[1mMAX",$1b,"[0m  ³ ",0
txth6:     dc.b    $1b,"[1mMSGS",$1b,"[0m ³",$1b,"[1mTO YOU",$1b,"[0m³"
           dc.b    $1b,"[1mFR YOU",$1b,"[0m³ ",$1b,"[1mMSGS",$1b,"[0m ³",$1b,"[1mTO YOU",$1b,"[0m³",0
txth7:     dc.b    "ÃÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄ´",0
txth8:     dc.b    "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´",0
txth9:     dc.b    "³ ",$1b,"[1mENTIRE MESSAGE BASE TOTALS:       ",0
txth0:     dc.b    "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ",0
txthb:     dc.b    "³ ",$1b,"[1;33m",0
txthc:     dc.b    "³ ",$1b,"[0;33m",0
txthe:     dc.b    $1b,"[0m³",13,0
txtc1:     dc.b    $1b,"[36m",0
txtc2:     dc.b    $1b,"[32m",0
           align.l

;storage

msgport:   dc.l    0                     ;message port
contport:  dc.l    0                     ;control port pointer
doslibbase:dc.l    0                     ;dosbase store
InitialSP: dc.l    0                     ;stack pointer store
filehand:  dc.l    0                     ;file handle
accessl:   dc.l    0                     ;user's access level
lastmsgr:  dc.l    0                     ;user's last message read pointer
filebuff:  dc.l    0                     ;file buffer ram pointer
sectdata:  dc.l    0                     ;sections data ram pointer
totmsg:    dc.l    0                     ;total messages
totto:     dc.l    0                     ;total to you messages
totfrom:   dc.l    0                     ;total from you messages
totnew:    dc.l    0                     ;total new messages
totnewto:  dc.l    0                     ;total new to you messages
allflag:   dc.l    0                     ;show all sections flag
username:  blk.b   44,0                  ;username
textbuff:  blk.b   128,0                 ;text buffer
cbuf1:     blk.b   10,0                  ;hex to acsii conversion ram
cbuf2:     blk.b   10,0
cbuf3:     blk.b   12,0
           align

;file buffer length

           dc.b    " File buffer length, must be a multiple of 274 (binary):"
bufflen:   dc.l    274*100               ;read 100 messages at a time
           
;hex editable text           

           dc.b    "MAXs CONFIG FILE NAME:"
confname:  dc.b    "MAXsBBS.Config",0,0,0,0,0,0,0,0,0,0,0,0,0
           
           end

