P*      
* jamaicaMON -- An ML monitor for the SuperCPU
*
* Many thanks to Jim Butterfield for the original
* SuperMON code.
*
* This program is public domain.
*
* Stephen L. Judd
* 1/97
*
* v2.0 10/98
*

* Some SuperCPU opcodes

bra      mac
         dfb $80
         dfb ]1-*-1
         <<<
brl      mac
         dfb $82
         da ]1-*-2
         <<<
per      mac
         dfb $62
         DA ]1-*-2        ;relative address
         <<<
rep      mac
         dfb $c2
         dfb ]1
         <<<
sep      mac
         dfb $e2
         dfb ]1
         <<<
sta1     mac              ;STA bank 1 address
         dfb $8f
         da ]1
         dfb $01
         <<<
add16    mac              ;add #16-bits
         dfb 69
         da ]1
         <<<

xce      mac
         dfb $fb
         <<<
phb      mac
         dfb $8b
         <<<
phd      mac
         dfb $0b
         <<<
phk      mac
         dfb $4b
         <<<
phx      mac
         dfb $da
         <<<
phy      mac
         dfb $5a
         <<<
pld      mac
         dfb $2b
         <<<
plx      mac
         dfb $fa
         <<<
ply      mac
         dfb $7a
         <<<
plb      mac
         dfb $ab
         <<<
tcd      mac
         dfb $5b
         <<<
tsc      mac
         dfb $3b
         <<<
tcs      mac
         dfb $1b
         <<<
txy      mac
         dfb $9b
         <<<
xba      mac
         dfb $eb
         <<<

*-------------------------------

DEST     = $8F00

         ORG $0801

         DA LINK
         DA 3172          ;Line number
         DFB $9E          ;SYS
         TXT '2063:'
         DFB $A2          ;NEW
         DFB 00
LINK     DA 0

         LDY #00
         LDA #<INSTR
         STA $FC
         LDA #>INSTR
         STA $FD
:PR      LDA ($FC),Y
         BEQ :OUT
         JSR $FFD2
         INY
         BNE :PR
         INC $FD
         BNE :PR
:OUT     

         LDA #<DEST
         STA $FB
         LDA #>DEST
         STA $FC
         LDA #<CODE
         STA $FD
         LDA #>CODE
         STA $FE
         LDA #>ENDCODE
         SEC
         SBC #>CODE
         TAX
         LDY #00
:LOOP    LDA ($FD),Y
         STA ($FB),Y
         INY
         BNE :LOOP
         INC $FC
         INC $FE
         DEX
         BPL :LOOP

PKMEM    
         LDX #00
         LDA #<NEMTEXT
         STA $FB
         LDA #>NEMTEXT
         STA $FC
:LOOP    LDY #00
         STY $FD
         STY $FE
         LDY #2
         JSR PACK
         DEY
         JSR PACK
         DEY
         JSR PACK
         LDA $FD
         STA NEM1,X
         LDA $FE
         STA NEM2,X

         LDA $FB
         CLC
         ADC #3
         STA $FB
         BCC :CONT
         INC $FC
:CONT    INX
         CPX #92
         BCC :LOOP

         LDA #>DEST-1
         STA $34          ;end of basic
         STA $38
         LDA #<DEST-1
         STA $33
         STA $37
         JMP DEST

         TXT 'yoo-hoo!'

PACK     LDA ($FB),Y      ;Only low 5 bits are retained,
         LSR              ;i.e. converted to screen char
         ROR $FD          ;automatically
         ROR $FE
         LSR
         ROR $FD
         ROR $FE
         LSR
         ROR $FD
         ROR $FE
         LSR
         ROR $FD
         ROR $FE
         LSR
         ROR $FD
         ROR $FE
         RTS

NEMTEXT  TXT 'adcandaslbccbcsbeqbitbmibnebplbrabrk'
         TXT 'brlbvcbvsclccldcliclvcmpcopcpxcpydec'
         TXT 'dexdeyeorincinxinyjmljmpjsljsrldaldx'
         TXT 'ldylsrmvnmvpnoporapeapeiperphaphbphd'
         TXT 'phkphpphxphyplaplbpldplpplxplyreprol'
         TXT 'rorrtirtlrtssbcsecsedseisepstastpstx'
         TXT 'stystztaxtaytcdtcstdctrbtsbtsctsxtxa'
         TXT 'txstxytyatyxwaiwdmxbaxce'

*               0123456789012345678901234567890123456789
INSTR    DFB 13,5
         TXT '* jamaicamon v2.0 10/98 sjudd@nwu.edu *',0d,0d
         TXT '- wdc: jml/jsl for jmp (long)/jsr long',0d
         TXT '- relocate (and w) format is',0d
         TXT '    n begincode beginvars endvars dest',0d
         TXT '- use !m !x !! during assembly',0d
         TXT '   ...and i hope you like jammon 2...',0d
         TXT ':/;/^ alter mem/regs/alt regs',0d
         TXT 'r display regs     e disp. extra regs',0d
         TXT 'm display mem      i disp. mem+text',0d
         TXT 'b set breakpoint   g go',0d
         TXT 'z zingle ztep      x exit to basic',0d
         TXT '  (zet brk and go)',0d
         TXT 'l load             s save',0d
         TXT 'a assemble         d disassemble',0d
         TXT '_ backwards diss.  \ toggle rep/sep',0d
         TXT 'p diss. range      , re-diss',0d
         TXT 'f fill             h hunt',0d
         TXT 'n relocate         t transfer',0d
         TXT 'w where am i?      ? list commands',0d
         DFB 00

CODE     
         ORG DEST
         PUT 'jamaica.s'
NEM1     
NEM2     = NEM1+92
         ORG
ENDCODE  
