; Copyright 2018 faddenSoft. All Rights Reserved.
; See the LICENSE.txt file for distribution terms (Apache 2.0).
;
; Sources:
;  NiftyList, by Dave Lyons
;  What's Where in the Apple, by William F. Luebbert

*SYNOPSIS Symbols from the Apple II monitor ROM

; zero page usage
MON_WNDLEFT     @ $20       ;left column of scroll window
MON_WNDWDTH     @ $21       ;width of scroll window
MON_WNDTOP      @ $22       ;top of scroll window
MON_WNDBTM      @ $23       ;bottom of scroll window
MON_CH          @ $24       ;cursor horizontal displacement
MON_CV          @ $25       ;cursor vertical displacement
MON_GBASL       @ $26       ;base address for lo-res drawing (lo)
MON_GBASH       @ $27       ;base address for lo-res drawing (hi)
MON_BASL        @ $28       ;base address for text output (lo)
MON_BASH        @ $29       ;base address for text output (hi)
;MON_BAS2L       @ $2A       ;used when scrolling text
;MON_BAS2H       @ $2B       ;used when scrolling text
MON_H2          @ $2C       ;right end of horizontal line drawn by HLINE
MON_V2          @ $2D       ;bottom of vertical line drawn by VLINE
MON_COLOR       @ $30       ;lo-res graphics color
MON_INVFLAG     @ $32       ;text mask (255=normal, 127=flash, 63=inv)
MON_PROMPT      @ $33       ;prompt character
MON_CSWL        @ $36       ;character output hook (lo)
MON_CSWH        @ $37       ;character output hook (hi)
MON_KSWL        @ $38       ;character input hook (lo)
MON_KSWH        @ $39       ;character input hook (hi)
MON_PCL         @ $3A       ;program counter save
MON_PCH         @ $3B       ;program counter save
MON_A1L         @ $3C       ;general purpose
MON_A1H         @ $3D       ;general purpose
MON_A2L         @ $3E       ;general purpose
MON_A2H         @ $3F       ;general purpose
MON_A3L         @ $40       ;general purpose
MON_A3H         @ $41       ;general purpose
MON_A4L         @ $42       ;general purpose
MON_A4H         @ $43       ;general purpose
MON_A5L         @ $44       ;general purpose
MON_A5H         @ $45       ;general purpose
MON_RNDL        @ $4E       ;low byte of KEYIN "random" value
MON_RNDH        @ $4F       ;high byte of KEYIN "random" value

; page 3 vectors
MON_BRKV        @ $03F0  2  ;address of BRK handler
MON_SOFTEVEC    @ $03F2  2  ;address of RESET handler
MON_PWREDUP     @ $03F4     ;power-up RESET checksum
MON_USRADDR     @ $03F8  3  ;jump to function that handles monitor Ctrl-Y
MON_NMIVEC      @ $03FB  3  ;jump to function that handles NMI
MON_IRQADDR     @ $03FE  2  ;address of IRQ handler

; monitor entry points
MON_PLOT        @ $F800     ;lo-res plot at X=Y-reg, Y=Acc
MON_PLOT1       @ $F80E     ;lo-res plot at X=Y-reg, Y per GBASL/H
MON_HLINE       @ $F819     ;lo-res horiz line at Y=Acc with X from $2c
MON_VLINE       @ $F828     ;lo-res vert line at X=Y-reg and Y from Acc to $2b
MON_CLRSCR      @ $F832     ;clear lo-res screen to black
MON_CLRTOP      @ $F836     ;clear top part of lo-res screen to black
MON_GBASCALC    @ $F847     ;compute gfx base addr for line in Acc
MON_NXTCOL      @ $F85F     ;change lo-res color to (color)+3
MON_SETCOL      @ $F864     ;set lo-res color to Acc
MON_SCRN        @ $F871     ;load Acc with lo-res value at Y=Acc, X=X-reg
MON_INSDS1_2    @ $F88C
MON_INSDS2      @ $F88E
MON_GET816LEN   @ $F890
MON_INSTDSP     @ $F8D0     ;monitor/mini-asm display
MON_PRNTYX      @ $F940     ;print Y-reg/X-reg as 4 hex digits
MON_PRNTAX      @ $F941     ;print Acc/X-reg as 4 hex digits
MON_PRNTX       @ $F944     ;print X-reg as 2 hex digits
MON_PRBLNK      @ $F948     ;print 3 spaces
MON_PRBL2       @ $F94A     ;print multiple spaces, count in X-reg
MON_PCADJ       @ $F953     ;monitor/mini-asm PC adjust
MON_TEXT2COPY   @ $F962
MON_OLDIRQ      @ $FA40     ;autostart ROM IRQ handler
MON_BREAK       @ $FA4C
MON_OLDBRK      @ $FA59
MON_RESET       @ $FA62
MON_PWRUP       @ $FAA6
MON_SLOOP       @ $FABA
MON_REGDSP      @ $FAD7     ;display register contents
MON_RTBL        @ $FB19
MON_PREAD       @ $FB1E     ;read paddle specifed by X-reg, return in Y-reg
MON_PREAD4      @ $FB21
MON_INIT        @ $FB2F     ;screen initialization
MON_SETTXT      @ $FB39     ;set screen to text mode
MON_SETGR       @ $FB40     ;set screen to graphics mode
MON_SETWND      @ $FB4B     ;set normal low-res graphics window
MON_SETWND2     @ $FB51
MON_TABV        @ $FB5B     ;place cursor at line (A-reg) and column (ch)
MON_APPLEII     @ $FB60     ;clear screen and put "Apple II" into first line
MON_SETPWRC     @ $FB6F
MON_VIDWAIT     @ $FB78
MON_KBDWAIT     @ $FB88
MON_VERSION     @ $FBB3
MON_ZIDBYTE2    @ $FBBF
MON_ZIDBYTE     @ $FBC0
MON_BASCALC     @ $FBC1     ;calculate text base address
MON_BELL1       @ $FBDD     ;sound bell regardless of output device
MON_BELL1_2     @ $FBE2
MON_BELL2       @ $FBE4     ;sound bell
MON_STORADV     @ $FBF0
MON_ADVANCE     @ $FBF4     ;move cursor right
MON_VIDOUT      @ $FBFD     ;output Acc as text
MON_BS          @ $FC10     ;move cursor left
MON_UP          @ $FC1A     ;move cursor up
MON_VTAB        @ $FC22     ;tab to row specified in Acc
MON_VTABZ       @ $FC24
MON_CLREOP      @ $FC42     ;clear screen from cursor to end of page
MON_HOME        @ $FC58     ;clear screen and reset text output to top-left
MON_CR          @ $FC62     ;perform a carriage return
MON_LF          @ $FC66     ;perform a line feed
MON_SCROLL      @ $FC70     ;scroll up one line
MON_CLREOL      @ $FC9C     ;clear to end of line
MON_CLREOLZ     @ $FC9E
MON_WAIT        @ $FCA8     ;delay for (26 + 27*Acc + 5*(Acc*Acc))/2 cycles
MON_NXTA4       @ $FCB4     ;increment A4, fall through into NXTA1
MON_NXTA1       @ $FCBA     ;increment A1; set carry if A1 >= A2 before inc
MON_HEADR       @ $FCC9     ;write cassette sync
MON_WRTAPE      @ $FCE5     ;casssette write
MON_RD2BIT      @ $FCFA     ;cassette read
MON_RDKEY       @ $FD0C     ;read key from input device via $38-39
MON_FD10        @ $FD10
MON_RDKEY1      @ $FD18
MON_KEYIN       @ $FD1B     ;get next key input from keyboard hardware
MON_RDCHAR      @ $FD35     ;calls RDKEY to get next char
MON_GETLNZ      @ $FD67     ;get a line of input
MON_GETLN       @ $FD6A     ;get a line of input
MON_GETLN0      @ $FD6C
MON_GETLN1      @ $FD6F
MON_CROUT1      @ $FD8B
MON_CROUT       @ $FD8E     ;print a carriage return
MON_PRA1        @ $FD92     ;print CR, then hex of A1H/A1L, then minus sign
MON_PRBYTE      @ $FDDA     ;print Acc as two-digit hex number
MON_PRHEX       @ $FDE3     ;print right nibble of Acc as single hex digit
MON_COUT        @ $FDED     ;print Acc to output device via $36-37
MON_COUT1       @ $FDF0     ;print Acc to screen
MON_COUTZ       @ $FDF6
MON_IDROUTINE   @ $FE1F
MON_MOVE        @ $FE2C     ;move bytes from A1 to A4 until A1=A2
MON_LIST        @ $FE5E     ;disassemble 20 instructions (not on GS)
MON_SETINV      @ $FE80     ;set video mode to inverse
MON_SETNORM     @ $FE84     ;set video mode to normal
MON_SETKBD      @ $FE89     ;reset char input handler to ROM
MON_INPORT      @ $FE8B
MON_SETVID      @ $FE93     ;reset char output handler to ROM
MON_OUTPORT     @ $FE95
MON_GO          @ $FEB6
MON_WRITE       @ $FECD     ;write data to cassette
MON_READ        @ $FEFD     ;read data from cassette
MON_READ2       @ $FF02     ;read data from cassette
MON_PRERR       @ $FF2D     ;print "ERR" and sound bell
MON_BELL        @ $FF3A     ;sound bell
MON_RESTORE     @ $FF3F     ;restore 6502 registers from $45-48
MON_SAVE        @ $FF4A     ;save 6502 registers to $45-49
MON_IORTS       @ $FF58     ;JSR here to find out where one is
MON_OLDRST      @ $FF59     ;RESET entry point
MON_MON         @ $FF65     ;normal entry to monitor
MON_MONZ        @ $FF69     ;reset and enter monitor
MON_MONZ2       @ $FF6C
MON_MONZ4       @ $FF70
MON_DIG         @ $FF8A
MON_GETNUM      @ $FFA7
MON_NXTCHR      @ $FFAD     ;part of GETLN input loop
MON_TOSUB       @ $FFBE
MON_ZMODE       @ $FFC7

; locations defined by the 6502
MON_6502_NMI    @ $FFFA 2   ;6502 NMI vector
MON_6502_RESET  @ $FFFC 2   ;6502 reset vector
MON_6502_IRQ    @ $FFFE 2   ;6502 IRQ vector
