;m100.def -- asm80/zmac constants for m100
;$Id: m100.def,v 1.70 2018/06/02 01:03:57 goosey Exp goosey $
;from M100 Techref starting at page 79
;typed in by
;Willard Goosey
;goosey@sdc.org
;7/1/2011
;7/4/2011 fix typo in PRINTR EXTREV
;         added SETCUR SNDCOM
;         thanks to Valdis Grinbergs
;         reorganized by function rather than source 
;         of info
;7/5/2011 Bob Pigford notes that INBUF is null 
;         terminated
;         Bob Pigford and Ken Pettit noted that POSIT 
;         sets the cursor location, not get cursor 
;         location
;
;7/6/2011 Web100 mirror at http://www.ordersomewherechaos.com/rosso/fetish/m102/web100/index.html
;         Club 100 at http://www.club100.org/
;                     ftp://ftp.whtech.com/club100
;7/8/2011 added routines from hterm source git:bitchin100.com/pub-git/hterm.git/
;         added routines from club100/ref/sandr.asm
;7/9/2011 added LINNUM, BASEXPR from Ken Pettit
;7/14/2011 added TEXT
;8/1/2011 TEXT is a reservered word in zmac, changed 
;         to TXT
;8/10/2014 added routine from DATE.ADD
;4/5/2017 Mike Nugent corrects BRKCHK, add CTLCHK and SCANSP
;5/6/2017 Ken Pettit add PWRRES
;6/12/2017 fixed KILASC
;7/2/2017 added LNKFIL
;8/13/2017 how to call SNDCOM
;10/19/2017 added MAKFIL

;sources include:
; club100/ref/map.100
; club100/ref/rcmap*.100
; club100/ref/hooks.100
; club100/ref/sandr.asm
; club100/doc/m100/m100TechReference.pdf
; club100/doc/m102/m102TechReference.pdf
; club100/doc/?/rom_funcs-600.pdf
; web100 "An Assembly Language tutorial for the Model 100"
; web100 "Model 100 Hackers Guide"
; web100 "hints and tricks"
; web100 "Model 100 ROM Calls"
; bitchin100.com/pub-git/hterm.git/m100_unpublished_lib.asm
; club100/?/p100-*.pdf
; cis/Lib-08-TECH-PROGRAMMING/DATE.100
;Terry Kepner, Pico Magazine
;				/DATE.ADD
; Jon Diercks 
; Virtual T source, Ken Pettit
;Mike Nugent
;bitchin100.com/??? NEC 8201 Tech Ref
;Ken Pettit's ROM disassembly from his 
;personal library @club100


;;;LCD routines

LCD equ 4b44h
;display a character at current cursor position
;Entry conditions:   A = char to display
;Exit conditions: none

LCDSTR equ 5a58h
;print a null-terminated string to LCD
;Entry Conditions: HL=address of string
;Exit Conditions: none?
;;from "An Assembly language Tutorial for the Model 100"
;;Mike Berro, 1984

NUMPRT equ 39D4h
;print integer to LCD
;Entry Conditions: HL=int to print
;Exit  Conditions: all registers destroyed
;M100rom_unpublished_lib.asm


PLOT equ 744ch
;turns on pixel at specified location
;Entry conditions:D = x (0-239)
;                 E = y (0-63)
;Exit conditions: none

UNPLOT equ 744dh
;turn off pixel at specified location
;Entry Conditions:D = x (0-239)
;                 E = y (0-63)
;Exit conditions: none

POSIT equ 427ch
;set current cursor location
;Entry Conditions: H=column number (1-40)
;                  L=row number (1-8)
;Exit Conditions: None
;The techref is WRONG, this SETS the cursor location
;thanks to Ken Pettit and Bob Pigford
;from Oppedahl's "Inside the Model 100", page 228

ESCA equ 4270h
;send escape code sequence to lcd
;Entry Conditions: A = escape code
;Exit  Conditions: none

;;;lcd terminal emulator calls
;these (eventually) get called when escape codes are 
;sent to the lcd
;or you can call them directly
;no entry or exit conditions on these

CRLF equ 4222h
;print a ^M^J
HOME equ 422dh
;no escape-code equivelant
CLS equ 4231h
;no escape-code
SETSYS equ 4235h
;escape T
;lock line 8
RSTSYS equ 423ah
;escape U
;unlock line 8
LOCK equ 423fh
;escape Y
;lock screen (no scrolling)
UNLOCK equ 4244h
;escape W
;unlock screen (allow scrolling)
CURSON equ 4249h
;escape P
;turn on text cursor
CUROFF equ 424eh
;escape Q
;turn text cursor off
DELLIN equ 4253h
;escape M
;del current text line
INSLIN equ 4258h
;escape I
;insert line at cursor pos
ERAEOL equ 425dh
;escape K
;erase from cursor to end of line
ENTREV equ 4269h
;escape p
;enter reverse-video mode
EXTREV equ 426eh
;escape q
;turn off reverse-video
;;;

;the Bar Cursor is the file cursor in MENU
BARPOS equ 59c9h
;position cursor on one of 24 bar positions
;Entry Conditions: HL=position 0-23
;Exit Conditions: none
;from sandr.asm

BARCUR equ 59e5h
;toggle bar cursor to opposite state
;Entry Conditions: HL=position 0-23
;Exit Conditions: none
;from sandr.asm

DTLINE equ 5a18h
;Print day/date/time as it appears on MENU screen
;at current cursor location
;updated time before printing it
;Entry Conditions: None
;Exit Conditions: all registers destroyed?
;from cis/Lib08-TECH-PROGRAMMING/DATE.ADD

TDDPT equ 5a15h
;print time on top line of screen, no cls
;Entry Conditions: none
;Exit  Conditions: all registers destroyed
;from m100rom_unpublished_lib.asm

PFRE equ 7each
;print number of bytes of free memory
;Entry Conditions: none
;Exit  Conditions: none

;;;LCD variables
CSRY equ 0f639h
;cursor row
CSRX equ 0f63ah
;cursor col
BEGLCD equ 0FE00h
;start of LCD screen image 320 bytes
ENDLCD equ 0FF40h
;end of LCD screen image
ALTLCD equ 0FCC0h
;start of alternate screen image 320 bytes
ALTLCDE equ 0FDFFh
;end of alternate LCD screen image
;;;
;;;

;;;Keyboard functions

KYREAD equ  7242h
;scan keyboard and return with a keypress or without one
;Entry Conditions: None
;Exit  Conditions: A = char, if any
;                  Carry: Set (character in code below)
;                  Carry: clear = normal character
;key pressed   regA
;F1             0
;F2             1
;F3             2
;F4             3
;F5             4
;F6             5
;F7             6
;F8             7
;LABEL          8
;PRINT          9
;shift-PRINT   0Ah
;PASTE         0Bh
;

CHGET equ  12cbh
;poll keyboard until key pressed
;Entry Conditions: None
;Exit  Conditions: A = character code
;                  Zero set: special key
;                  Zero clear: regular key
;F1-F8 return preprogrammed strings

KEYWTU equ 5d64h
;wait for key to be pressed, convert it to uppercase
;Entry Conditions: None
;Exit  Conditions: A=uppercase key pressed
;function keys return preprogrammed strings
;m100rom_unpublished_lib.asm


CHSNS equ  13dbh
;check keyboard queue for characters
;Entry Conditions: None
;Exit  Conditions: Z flag Set if queue empty
;                  Z flag clear if keys pending

KEYX equ  7270h
;check keyboard queue for characters or break
;Entry Conditions:None
;Exit  Conditions: Z flag Set if queue empty
;                  Z flag clear if keys pending
;                  Carry set if BREAK pressed
;                  Carry clear on all other keys
;		   A destroyed

CTLCHK equ  7283h
;check for ^C or ^S only
;Entry Conditions:None
;Exit  Conditions: Z clear on ^C or ^S
;		   Z set on no char or reg char
;		   A destroyed

BRKCHK equ 729fh
;check to see if SHIFT-BREAK pressed
;Entry Conditions: None
;Exit  Conditions: Zero and Carry set on BREAK pressed
;		   A destroyed

SCANSP equ 72B1h
;scan keyboard column of BREAK,CAPS,NUM,CODE,GRAPH,CONTROL,
;SHIFT key. Reset bits in A corresponding to the key pressed
;Entry Conditions: None
;Exit  Conditions: A=(BREAK,CAPS...)

INLIN equ  4644h
;Read line from keyboard
;Entry Conditions:None
;Exit  Conditions: Line starts at F685

INBUF equ 0f685h
;INPUT buffer
;253 bytes long (map,100)
;null terminated -- Bob Pigford & MikeS, from The Hidden 
;Powers (p. 55)

;;;FUNCTION Key routines

FCTER equ 80h
;terminate entry in function table entry, either by 
;itself or ORed with the last byte of entry
;an example function key table
;  fctab defm 'files' ;f1
;        defb 0dh
;        defb 80h
;        defm 'load'   ;f2
;        defb 80h
;         defb 80h      ; no function for f3
;......
;        defm 'menu',8dh ; f8

STFNK equ  5a7ch
;set function key table
;Entry Conditions: HL = address of table (see above)
;Exit  Conditions: None

CLRFLK  equ  5a79h
;clear function key table
;Entry Conditions: None
;Exit  Conditions: None

DSPFNK  equ 42a8h
;display function keys
;Entry Conditions: none
;Exit  Conditions: none

STDSPF equ  42a5h
;set and display function keys
;Entry Conditions: HL = address of function key labels 
;                  (see above)
;Exit  Conditions: none

ERAFNK equ  428ah
;erase function key display
;Entry Conditions: None
;Exit  Conditions: None

FNKSB  equ  5a9eh
;display function key table if enabled
;Entry Conditions: None
;Exit  Conditions: None

CSFKEY equ 5b46h
;cold start function key table address
;2 bytes
;"Model 100 ROM Calls", web100

BASFKY equ 0f80ah
;BASIC's function key table
;"Model 100 ROM Calls", web100

BK2SK equ 6c9ch
;install BASIC fucntion key table
;Entry Conditions: none
;Exit Conditions: none
;from p100-8812

FKCTRL equ 0f650h
;1 byte
;holds 0 or 80h
;if 0, F-keys return string from system table
;if 80, F-keys skip first 4 bytes and return what's left

LBENBL equ 0faadh
;1 byte
;set to FFh to enable the label line
;from p100-8812

;;;printer routines

PRINTR  equ  6d3fh
;send a character to the printer
;Entry Conditions: A = char to be printed
;Exit  Conditions: Carry Set if BREAK sent
;                  Carry clear on success

PNOTAB  equ  1470h
;print character without expanding tabs
;Entry Conditions:A = char to print
;Exit  Conditions: Unknown 

PRTTAB  equ  4b55h
;print character expanding tab to spaces
;Entry Conditions: A = character to print
;Exit  Conditions: unknown

PRTLCD equ  1e5eh
;dump lcd to printer
;Entry Conditions: None
;Exit  Conditions: None

;;;MODEM and RS-232 functions

DISC  equ  52bbh
;disconnect phone line
;Entry Conditions: None
;Exit  Conditions: None

CONN  equ  52d0h
;connect phone line
;Entry Conditions: None
;Exit  Conditions: None
 
DIAL  equ  532dh
;dial specified phone number
;Entry Conditions: HL = address of phone number
;Exit  Conditions: None

RCVX  equ  6d6dh
;check RS232 queue for characters
;Entry Conditions: None
;Exit  Conditions: A = number of characters in queue
;                  Z flag set if no data
;                  Z flag clear if data present

RV232C  equ   6d7eh
;gets a character from rs232 queue
;Entry Conditions: None
;Exit  Conditions: A = character recieved
;                  Z flag set if OK
;                  Z flag clear on error
;                  Carry set if BREAK
;                  Carry clear otherwise

SENDCQ  equ  6e0bh
; send XON (^Q) to serial port
;Entry Conditions: None
;Exit  Conditions: None

SENDCS  equ  6e1eh
;send XOFF (^S) to serial port
;Entry Conditions: None
;Exit  Conditions: None

SD232C  equ  6e32h
;send character to serial port (with xon/xoff)
;Entry Conditions: A = character to send
;Exit  Conditions: BC preserved

SNDCOM  equ  6e3ah
;send a character to RS232-C or modem (without
;XON/XOFF flow control)
;This is a jump into the middle of SD232C
;and when run with this entry, does a POP
;before returning without doing a PUSH first.
;Entry conditions: C = character to be sent
;	dummy value on stack to protect return address
;Exit conditions:  unknown
;sample: do_sndcom
;	[...]
;	push b
;	jmp SNDCOM
;;;from rom_funcs-600.pdf

CARDET  equ  6eefh
;detect carrier on modem only
;Entry Conditions: None
;Exit  Conditions: A = 0 if carrier
;                  Z flag set if carrier
;                  Z flag clear otherwise

BAUDST  equ  6e75h
;set baud rate on rs232c
;Entry Conditions: H = baud rate (1-9,M)
;Exit  Conditions: None

INZCOM  equ  6ea6h
;initialize rs232 and modem
;Entry Conditions:H = baud rate (1-9,M)
;                 L = UART config code see below
;                 Carry set if RS232
;                 Carry clear if modem
;Exit  Conditions: None

;bits description
; 0    number of stop bits 0=1, 1=2
; 1    parity setting      0=odd 1=even
; 2    parity disable      0=enable 1=disable
;3-4   word length         01=6 10=7 11=8
;this byte is ANDed with 1Fh to ignore bits 5-7 

COMSTR equ 0F65BH
;current STAT settings, 5 bytes not null terminated

SETSER  equ  17e6h
;set serial params, activate rs232 or modem
;Entry Conditions:  HL=address of STAT string terminated 
;                   by 0   (88N1D,0)
;                   Carry set for rs232
;                   Carry clear for modem
;Exit  Conditions: None

CLSCOM  equ  6ecbh
;deactivate rs232/modem
;Entry Conditions: None 
;Exit  Conditions: None

;;;;Cassette functions

DATAR equ  702ah
;read character from cassette no checksum
;Entry Conditions: None
;Exit  Conditions: D= char read

CTON  equ  14a8h
;turn on motor
;Entry Conditions: none
;Exit  Conditions: none

CTOFF  equ  14aah
;turn off motor
;Entry Conditions: none
;Exit  Conditions: none

CASIN  equ  14b0h
;read a character and update checksum
;Entry Conditions: C = current checksum
;Exit  Conditions: A = character
;                  C = new checksum

CSOUT  equ  14c1h
;write char to cassette and update checksum
;Entry Conditions: A = character to send
;                  C = current checksum
;Exit  Conditions: C = new checksum

SYNCW  equ  6f46h
;write cassette header and sync byte
;Entry Conditions: none
;Exit  Conditions: none

SYNCR  equ  6f85h
;read cassette header and sync byte
;Entry Conditions: none
;Exit  Conditions: none

DATAW  equ  6f5bh
;write a char to cassette no checksum
;Entry Conditions: A = character to write
;Exit  Conditions: none

FINDFREQ equ 6FDBH   
;Find the frequency of the cassette port.  This routine
;measures the duration from the start to the stop of half of
;the wave presented on the cassette port.  The result is the
;number of 29 t-state cycles required to find the end of the
;wave.  The byte at FF8EH determines if the count will trigger
;on a high or low pulse.  For example, a 1200 hz signal, which
;would take 416 ms to go through half of the wave, would cause
;this routine to exit with a value aound 35.  If the sound
;option is turned on (see FF44H), this routine will click the
;beeper on each call.  Note:  Although this routine analyses
;the cassette port in 29 T-state intervals, the actual routine
;requires much more time to execute.
;Entry Conditions: TRIGFLAG (FF8E) set
;		SOUNDFLAG (FF44) set
;Exit  Conditions:
;                C - Number of 29 T-state cycles
;                A - Destroyed
;           C flag - Set if the routine was canceled by a shift break

CRECIN equ 2413H 
;Load a record from cassette and put it in the buffer pointed to
;by HL.
;Entry Conditions:
;      HL - Points to start of receiving buffer
;      DE - Number of bytes to load.
;Exit  Conditions:
;      All registers destroyed
;from Mike Nugent


;;; RAM file routines

DIRECTORY equ 0f962h
DIRTBL	equ 0f962h
;DIRTBL is NEC name
;RAM file directory

;dir entry is 11 bytes long
;byte 0     directory flag 
;              FF=end of directory
;byte 1-2   address of file
;byte 3-10  filename 8 bytes

;directory flag byte
;bit 7 (msb)   1 if valid entry
;bit 6         1=ascii (DO)
;bit 5         1=machine language (CO)
;bit 4         1=ROM file
;bit 3	       1=invisible file
;bit 2	       reserved
;bit 1	       reserved
;bit 0	       internal use only

ENDDIR equ 0FFh 
;this value in byte 1 means no further entries

FILNAM equ 0FC93h
;standard filename variable 8 bytes

FDIR equ 0f9bah
USRDIR equ 0f9bah
;2 bytes
;points to first file in directory
;USRDIR is the NEC name
;p100-8709

PRSNAM equ 4c0bh
;parse a filename "file.do" into FILNAM
;Entry Conditions: HL->file name
;                  E=length of file name
;Exit  Conditions: filename into FILNAM (fc93)
;from p100-8812

MAKTXT  equ  220fh
;create a text file
;Entry Conditions: filename must be in FILNAM, extention 
;                  not required
;Exit  Conditions: HL=top of new file
;                  DE=address of directory entry
;                  Carry set if file exists
;                  Carry clear if new file

CHKDC equ  5aa9h
;search for 4.2 filename
;Entry Conditions: DE=address of null-terminated 
;                  filename to find
;Exit  Conditions: HL=address of directory entry
;                  Z flag = 0 if file found
;                  Z flag = 1 if file not found

FNDFIL equ 20afh
;search directory for file named at FC93h
;Entry Conditions: FC93h+ contains filename
;Exit Conditions: if Z clear the HL->directory
;                    Z set, no file found
;from p100-8812

CHKFN equ 5aabh
;search for a full-size filename
;this is a workaround for the fact that chkdc can only 
;find 4 letter names like note.do and adrs.do
;Entry Conditions: A=0ah
;                  DE=address of null-terminated 
;                  filename
;Exit Conditions:  HL=address of directory entry
;                  Z flag=0 if file found
;                  Z flag=1 if file not found
;; from "Model 100 hints and ticks"
;; web100

MKPNAM equ 59ADh
;convert dir entry style filename 'FILE  DO' to 
;'FILE.DO'
;Entry Conditions: DE -> directory name
;                  HL -> output buffer
;Exit Conditions: none
;from sandr.asm

DIROK equ 2146h
LNKFIL equ 2146h
;fix directory pointers after file growth/shrink
;LNKFIL is the NEC name.
;Entry Conditions: none
;Exit Conditions: none

GTXTTB  equ  5ae3h
;gets top address of file
;Entry Conditions: HL=address of directory entry
;Exit  Conditions: HL=address of top of file

KILASC  equ  1fbfh
;delete a text file
;Entry Conditions: DE=address of top of file
;                  HL=address of directory entry
;Exit  Conditions: None

INSCHR equ  6b61h
;insert a character in a file
;Entry Conditions: A = character to insert
;                  HL=address to insert character
;Exit  Conditions: HL=HL+1
;                  Carry set if out of memory

MAKHOL equ  6b6dh
;insert a number of spaces
;Entry Conditions: BC=number of spaces
;                   HL=address to insert at
;Exit  Conditions: HL & BC are preserved
;                  Carry set if out of memory

MASDEL equ  6b9fh
;delete a number of characters
;Entry Conditions: BC=number of characters to delete
;                  HL=address to delete from 
;Exit  Conditions: HL & BC are preserved

NXTDIR equ 20d5h
;retrieve the next directory entry of an active file
;Entry Conditions: HL should point to directory entry 
;   before the starting point.  search routine begins 
;   by pointing to the next entry
;Exit  Conditions: Z set = no more entries
;                   Z clear, HL -> dir. entry of an 
;                            active file
;from sandr.asm


FREDIR  equ 20ech
;locate an empty directory slot
;Entry Conditions: none
;Exit  Conditions: HL -> free slot
;	drops to BASIC with an FL error if no free slots
;from sandr.asm

MAKFIL equ 2239H
;Insert entry into directory.
;         Entry:
;               HL - Points to empty directory slot
;               DE - Contains address of file in RAM
;                A - Attribute (80h=.BA, C0h=.DO, A0h=.CO, etc.)
;         Note: Routine gets filename from FC93H, where it must be stored
;               padded with spaces, no delimiter.
;         Exit: DE - Unchanged
;from Mike Nugent


;;;Other functions

POPALL equ 14edh 
;pop all registers and return
;Entry Conditions: registers were pushed in 
;      H,D,B,PSW order
;Exit Conditions: none
;from p100-8812

INITIO  equ  6cd6h
;cold start
;Entry Conditions: None
;Exit  Conditions: None

IOINIT  equ  6ce0h
;warm start
;Entry Conditions: None
;Exit  Conditions: None

BOOT equ 7d33h
;reboot.  rst 0 jumps here
;Entry Conditions: none
;Exit  Conditions: none
;from m100rom_unpublished_lib.asm

MENU equ  5797h
;go to main menu
;Entry Conditions: None
;Exit  Conditions: None

PWRRES equ 143Fh
;POWER OFF, RESUME
;Shuts the machine off. Program continues
;when its turned back on.
;Entry Conditions: None
;Exit Conditions: None

MUSIC equ  72c5h
;generates a tone
;Entry Conditions: DE=frequency
;                  B=duration
;Exit  Conditions: None

BEEP equ 4229h
;BASIC BEEP
;Entry Conditions: none
;Exit  Conditions: A=7
;from m100rom_unpublished_lib.asm

TIME equ  190fh
;read system clock
;Entry Conditions: HL=address of 8-byte buffer
;Exit  Conditions: buffer holds current time (hh:mm:ss) 

DATE equ  192fh
;read system clock
;Entry Conditions: HL=address of 8-byte buffer
;Exit  Conditions: buffer holds current date (mm/dd/yy)

DAY equ  1962h
;read system clock
;Entry Conditions: HL=address of 3-byte buffer
;Exit  Conditions: buffer holds day


BLKMV equ 3469h
;move B bytes from (DE) to M with increment
;Entry Conditions: DE -> start of block to move
;                  HL -> destination block
;                  B = bytes to move
;Exit  Conditions: HL=DE=HL+B+1
;                  A, B destroyed
;from m100rom_unpublished_lib.asm

LINNUM equ 08ech
;convert ascii string to BASIC line number
;ascii-to-integer, except that there's a range of
;invalid BASIC line numbers that this won't return
;Entry conditions: HL -> string to convert to int
;Exit  Conditions: DE=integer
;from Ken Pettit

BASEXPR equ 1297h
;BASIC expression parser
;for simple integer-digit conversion only.
;Will dump you into BASIC with a ?SN ERROR on error...
;use carefully
;Entry Conditions: HL -> string to parse
;Exit  Conditions: DE=result of expression
;Ken Pettit

UPCAS equ 0fe9h
;convert a character to uppercase
;Entry Conditions: A=char to convert
;Exit  Conditions: A holds uppercase character
;from m100rom_unpublished_lib.asm

PRGADD equ 344ah
;return starting address of file
;Entry Conditions: HL->dir entry
;Exit  Conditions: DE=address
;p100-8709

RSTDOG equ 1bb1h
;reset power-off watchdog
;Entry Conditions: none
;Exit  Conditions: none
;from John R. Hogerhuis

;;;the ROM apps
;clobbers non-file ram on entry
;exit to MENU
TXT equ 5deeh
;p100-8401
;TEXT is a reserved word in zmac
BASIC equ 6c49h
TELCOM equ 5146h
ADDRSS equ 5b68h
SCHEDL equ 5b6fh
;p100-8403
;
SABASE equ 5b74h
;common database code for addrss/schedl
;entry conditions: A=0 "Adrs" prompt
;                  A!=0 "Schd" prompt
;                  DE -> 8 byte null terminated filename
;                    -or-
;                  DE=FDD9h
;                  FDD9 = full size null terminated 
;                         filename

ADSCFILE equ 0FFD9h
;null-terminated filename buffer for addrss/schedl
;p100-8403     

TXTENT equ 05f71h
;entry into init of TEXT
;p100-8812

FILOFF equ 0f6e7h
;2 bytes
;offset from the beginning of the file being edited by 
;TEXT, so TEXT knows where to display
;p100-8812


;;;I/O ports
;I had no idea I/O ports were so screwy on the m100!
;70h-7fh free
;80h-8fh optional i/o controller
;90h-9fh optional answering modem

;A0h-AFh bit 0: on/off for relay for signal selection
;               of telephone unit
;        bit 1: generate ENABLE signal for modem
;b0h-bfh 8155 PIO
;c0h-cfh enable data i/o on uart
;d0h-dfh enable config on uart
;e0h-efh enable signal for STROM, REMOTE
;        also parallel port strobe and read keyboard
;f0h-ffh enable signal for LCD

PHONEPORT equ 0a0h


;b0=b8=command/status
;b1=b9=port A
;b2=ba=port B
;b3=bb=port C
;b4=bc=timer register low byte
;b5=bd=timer register high byte

PIOCMD equ 0b0h
PIOA equ 0b1h
PIOB equ 0b2h
PIOC equ 0b3h
PIOTL equ 0b4h
PIOTH equ 0b5h

UARTDAT equ 0C0h
UARTCFG equ 0D0h

KEYPORT equ 0E0h
LCDPORT equ 0F0h
 

;;;interesting variables and constants

STKTOP equ 0fb9dh
;2 bytes
;holds the beginning address of the stack
;p100-8812

PTIMER equ 0f657h
;1 byte
;Number of 6-second intervals before the m100 
;shuts itself off.
;0=disable power-off timer
;;from Ron Wiesen

POWERFLAG equ 0f932h
;1 byte
;0=do not shut off m100
;from John R. Hogerhuis

PASTEPTR equ 0f88ch
SCRDIR   equ 0f88ch
;2 byte value
;points to paste buffer file
;paste buffer is null-terminated
;SCRDIR is the NEC name
;; from web100 "Model 100 hints and ticks"

SHPRTPTR equ 0f88ah
;2 byte pointer
;points to null-teriminated string returned by 
;   shft-print key 
;"llist\n" by default
;; from web100 "Model 100 hints and ticks"

BRKDIS equ 0f650h
;1 byte
;store 80h here to disable the top row of keys (Fx, 
;print, arrows)
;store 0h here to enable top row of keys
;; from web100 "Model 100 hints and ticks"

MAXRAM equ 0f5efh
;top of user ram, above this are system vars that 
;shouldn't be frobbed casually....62959 decimal
;;from "An Assembly language Tutorial for the Model 100"
;;Mike Berro, 1984

HIMEM equ 0f5f4h
;2 bytes -- bottom of protected memory for binaries
;from p100-8709

FREBAS equ 0f99ah
NULDIR equ 0f99ah
;2 bytes
;points to start of free BASIC memory
;NULDIR is the NEC name
;(contents of Hidden file Suzuki)
;from p100-8709

MAXFILE equ 0fc82h
;1 byte
;number of file buffers reserved
;p100-8709 pp59

NEXTTXT equ 0f9a5h
;2 bytes
;address of next text file

DOSTART equ 0fbaeh
ASCTAB equ 0fbaeh
;2 bytes
;start of DO files
;ASCTAB is the NEC name

COSTART equ 0fbb0h
BINTAB equ  0fbb0h
;2 bytes
;start of CO files
;BINTAB is NEC's name

VARSTART equ 0fbb2h
VARTAB equ 0fbb2h
;2 bytes
;start of BASIC variable space
;VARTAB is the NEC name

ARRSTART equ 0fbb4h
ARYTAB equ 0fbb4h
;2 bytes
;start of BASIC arrays
;ARYTAB is the NEC name

FRESTART equ 0fbb6h
STREND equ 0fbb6h
;2 bytes
;start of free memory
;STREND is the NEC name

FILEEND equ 0f88ch
;2 bytes
;end of file storage

SYSRAM equ 0fac0h
;2 bytes
;lowest ram used by system


HOOK equ 0fadah
;RST7 hook table address
;you can call the Nth function in the table by:
;rst7
;db 2n
;and RST7 will call HOOK+2n
;;;from Model 100 Hackers Guide
;;;Andy Diller, via Bob Andersen

SOUNDFLAG equ 0ff44h
;cassette input echoed out speaker
;1 byte
;0=on

TRIGFLAG equ 0FF8Eh
;High or low cassette level trigger flag for FINDFREQ
;1 byte

;;;;end m100.h


