home *** CD-ROM | disk | FTP | other *** search
- ; *******************************************************************
- ; * Amstrad CPC emulator v1.02 - Amiga version *
- ; * © 1991/92/95 Bernd Schmidt *
- ; * *
- ; * Registers: A2: pointer to memory map *
- ; * A3: pointer to opcode table *
- ; * A4: pointer to 64K system RAM *
- ; * A5: sPCA pointer to simulated pc's base address *
- ; * A6: Flag table *
- ; * A1: return adress *
- ; * D0: A'A D1: F'F D2: BC'BC D3: DE'DE D4: HL'HL *
- ; * D7: PC *
- ; * *
- ; *******************************************************************
-
- INCLUDE "cpe.inc"
-
- XDEF rambase,amsdos,basic,sysstat,scrbase,stack,ix,iy,xh,yh,xl,yl
- XDEF DoScr,regop1,regop2,regop3,inp,outp,service,memmap
- XDEF inthandler,intena,ffly,codecheck,RedrawArea
- XDEF amscode,ro7code,bascode
- XDEF dosbase,fhandle,DiskBuf
- XDEF DCSeekCurr,idfield,IDTPtr,CurrTrack,trackoffs
- XDEF KeyMatrix,cleanup,crux
-
- XREF simz80,sz80l,calcpca,daasp
- XREF wword,wbyte,gword,gbyte
-
- XREF initcode
-
- SECTION emulator,CODE
-
- start: move.l a7,SPSave
- clr.w fileopen
- clr.l cpcwin
- clr.l cpcscr
- clr.w dbflag
-
- move.l 4,a6 ; open libraries
- lea dosname,a1
- clr.l d0
- jsr _OpenLibrary(a6)
- move.l d0,dosbase
-
- lea intname,a1
- clr.l d0
- jsr _OpenLibrary(a6)
- move.l d0,intbase
-
- lea gfxname,a1
- clr.l d0
- jsr _OpenLibrary(a6)
- move.l d0,gfxbase
-
- jsr OpenDBugWin
-
- jsr OpenScrMode1
- clr.l fhandle
- move.l dosbase,a6 ; load lower rom
- move.l #lrname,d1
- move.l #1005,d2
- jsr _Open(a6)
- tst.l d0
- bne lropen
- move.l #lrname2,d1
- move.l #1005,d2
- jsr _Open(a6)
- tst.l d0
- beq cleanup
- lropen move.l d0,fhandle
- move.l d0,d1
- move.l #16384,d3
- move.l #amsdos,d2
- jsr _Read(a6)
- move.l fhandle,d1
- jsr _Close(a6)
-
- clr.l fhandle
- move.l #urname,d1 ; load upper (basic) rom
- move.l #1005,d2
- jsr _Open(a6)
- tst.l d0
- bne uropen
- move.l #urname2,d1
- move.l #1005,d2
- jsr _Open(a6)
- tst.l d0
- beq cleanup
- uropen move.l d0,fhandle
- move.l d0,d1
- move.l #16384,d3
- move.l #basic,d2
- jsr _Read(a6)
- move.l fhandle,d1
- jsr _Close(a6)
-
- clr.l fhandle
- move.l #frname,d1 ; load floppy rom
- move.l #1005,d2
- jsr _Open(a6)
- tst.l d0
- bne fropen
- move.l #frname2,d1
- move.l #1005,d2
- jsr _Open(a6)
- tst.l d0
- beq cleanup
- fropen move.l d0,fhandle
- move.l d0,d1
- move.l #16384,d3
- move.l #rom7,d2
- jsr _Read(a6)
- move.l fhandle,d1
- jsr _Close(a6)
-
- clr.l fhandle
- move.l #draname,d1 ; open disk emulation file
- move.l #1005,d2
- jsr _Open(a6)
- tst.l d0
- beq cleanup
- move.l d0,fhandle
- move.w #1,fileopen
-
- bsr InitCRTC
- bsr InitScroff
- bsr reset
- jsr initcode
-
- jmp simz80
-
- InitScroff
- movem.l d0-d7,-(sp)
- lea Scroff,a0
- move.w #7,d7
- move.w #0,d0 ; line offset
- cmp.b #0,CRTCregs+1
- beq ISC_AllNull
- ISC_Loop1
- move.w d0,d1
- move.w #24,d6
- move.w #2047,d4
- ISC_Loop2
- moveq #0,d5
- move.b CRTCregs+1,d5
- add.w d5,d5
- sub.w d5,d4
- subq.w #1,d5
- move.w d1,d2
- ISC_Loop3
- move.w d2,(a0)+
- addq.w #1,d2
- dbf d5,ISC_Loop3
- add.w #640,d1
- dbf d6,ISC_Loop2
- ISC_Loop4
- move.w #16000,(a0)+ ; invisible bytes
- dbf d4,ISC_Loop4
- add.w #80,d0
- dbf d7,ISC_Loop1
- movem.l (sp)+,d0-d7
- rts
- ISC_AllNull:
- move.w #16000,(a0)+
- addq.w #1,d0
- cmp.w #16384,d0
- bne ISC_AllNull
- movem.l (sp)+,d0-d7
- rts
-
- cleanup move.l SPSave,a7
- tst.w fileopen
- beq cu_dontclose
- move.l fhandle,d1
- move.l dosbase,a6
- jsr _Close(a6)
- cu_dontclose
- jsr CloseWin
- jsr CloseDBugWin
- ; move.l dosbase,a6
- ; move.l #cxname,d1
- ; move.l #1006,d2
- ; jsr _Open(a6)
- ; move.l d0,fhandle
- ; move.l d0,d1
- ; move.l #65535,d3
- ; move.l #rambase,d2
- ; jsr _Write(a6)
- ; move.l fhandle,d1
- ; jsr _Close(a6)
- rts
-
- reset move.b #9,sysstat
- jsr RethinkMemMap
- clr.l d7
- jsr calcpca
- clr.l d5
- clr.l d6
- move.w #400,intspeed
- move.w intspeed,intcount
- clr.w ffly
- clr.w intena
- move.w #6,ffcount
- clr.w intreq
- clr.w ColMode
- clr.w Qual
- clr.w dcstat
- move.l #idfield,IDTPtr
- move.b #19,CurrTrack
- movem.l d0-d7/a0-a6,-(sp)
- jsr DCSeekCurr
- movem.l (sp)+,d0-d7/a0-a6
- rts
-
- InitCRTC:
- lea CRTCregs,a0
- move.b #40,1(a0)
- move.b #25,6(a0)
- move.b #8,9(a0)
- move.w #$3000,12(a0)
- move.b #1,crtcscrwidth
- rts
-
- inthandler:
- tst.w ReDrawCount
- beq ihd_countdown
- subq.w #1,ReDrawCount
- bne ihd_countdown
- jsr RedrawScreen
- ihd_countdown
- subq.w #1,intcount
- bcs ihd_IRQ
- ihd_checkei
- cmp.w #2,intena
- bne ihd_testIRQ
- move.w #1,intena
- ihd_end cmp.w #2,dbflag
- beq debug
- rts
- ihd_IRQ move.w intspeed,intcount
- addq.w #1,intreq
- jsr UpdateKeyMatrix
- move.w Qual,d6
- and.w #$7FFF,d6
- cmp.w #$30,d6
- beq cleanup
- cmp.w #$28,d6
- bne ihd_nodebug
- tst.w dbflag
- bne ihd_nodebug
- move.w #2,dbflag
- ihd_nodebug
- cmp.w #$19,d6
- bne ihd_noreset
- bsr reset
- ihd_noreset
- moveq.l #0,d6
- subq.w #1,ffcount
- bcc ihd_noff
- moveq.l #1,d6
- move.w #6,ffcount
- ihd_noff
- move.w d6,ffly
- cmp.w #1,intena
- bne ihd_checkei
- ihd_DoInt
- clr.w intreq
- ; move.w #$888,$DFF180
- subq.w #2,stack
- addq.l #4,daasp
- move.w stack,d5
- move.w sPC,d6
- jsr wword
- move.w #$38,sPC
- jsr calcpca
- rts
- ihd_testIRQ
- tst.w intreq
- beq ihd_end
- cmp.w #1,intena
- bne ihd_end
- bra ihd_DoInt
-
- debug: clr.w Qual
- move.w #1,dbflag
- movem.l a1-a6,dbadrsave
- movem.l d0-d7,dbregsave
- dbinploop:
- move.l dbhandle,d1
- beq dbend
- move.l dosbase,a6
- jsr dbprintregs
- jsr dbprintins
- move.l dbhandle,d1
- move.l #inpline,d2
- move.l #255,d3
- jsr _Read(a6)
- move.w inpline,d0
- cmp.w #'i1',d0
- beq dbinter1
- cmp.w #'i2',d0
- beq dbinter2
- cmp.w #'i3',d0
- beq dbinter3
- move.b inpline,d0
- cmp.b #'c',d0
- beq dbcolmode
- cmp.b #'x',d0
- beq dbend
- cmp.b #'m',d0
- beq dbmoni
- cmp.b #'z',d0
- beq dbzip
- cmp.b #'f',d0
- beq dbfwd
- cmp.b #'t',d0
- bne dbwaaaas
- movem.l a1-a6,-(sp)
- movem.l dbadrsave,a1-a6
- movem.l dbregsave,d0-d7
- lea dbreturn,a1
- jmp sz80l
- dbreturn:
- movem.l d0-d7,dbregsave
- movem.l a1-a6,dbadrsave
- movem.l (sp)+,a1-a6
- bra dbinploop
-
- dbend: movem.l dbadrsave,a1-a6
- movem.l dbregsave,d0-d7
- clr.w dbflag
- dbret: lea sz80l,a1
- rts
-
- dbinter1:
- move.w #400,intspeed
- bra dbinploop
-
- dbinter2:
- move.w #1000,intspeed
- bra dbinploop
-
- dbinter3:
- move.w #5000,intspeed
- bra dbinploop
-
- dbcolmode:
- eor.w #$FFFF,ColMode
- jsr SetColors
- bra dbinploop
-
- dbmoni: lea inpline+1,a0
- bsr gethex
- lea memmap,a3
- move.w d0,dbmonad
- moveq #15,d7
- dbmonoutloop:
- move.l d7,-(sp)
- lea dbmonistr+3,a2
- lea hexnums,a1
- move.l d0,-(sp)
- moveq #3,d7
- bsr copyhex
- move.l (sp)+,d0
- moveq #15,d6
- dbmoninloop:
- lea dbmonistr,a2
- moveq #15,d5
- sub.w d6,d5
- add.w d5,a2
- add.w d5,d5
- add.w d5,a2
- add.w #6,a2
- move.w d0,d5
- and.w #$C000,d5
- rol.w #4,d5
- move.l 0(a3,d5.w),a0
- movem.l d0/d6,-(sp)
- move.b 0(a0,d0.w),d0
- moveq #1,d7
- bsr copyhex
- move.b #32,(a2)
- movem.l (sp)+,d0/d6
- addq.w #1,d0
- dbf d6,dbmoninloop
- move.l dbhandle,d1
- move.l #dbmonistr,d2
- moveq #53,d3
- move.b #10,dbmonistr+52
- move.l d0,-(sp)
- jsr _Write(a6)
- move.l (sp)+,d0
- move.l (sp)+,d7
- dbf d7,dbmonoutloop
- move.w d0,dbmonad
- bra dbinploop
-
- dbzip: move.w dbregsave+30,d5 ; ZIP through a CALL or DJNZ
- move.w d5,d0
- move.w d5,d6
- rol.w #4,d6
- and.w #$C,d6
- lea memmap,a3
- move.l 0(a3,d6.w),a3
- moveq #0,d6
- move.b 0(a3,d5.w),d6
- cmp.b #$CD,d6
- beq dbzip_3byt
- cmp.b #$C3,d6
- beq dbzip_3byt
- move.b d6,d5
- and.b #7,d6
- and.b #$C0,d5
-
- cmp.b #$C0,d5
- bne dbzip_nocall
- cmp.b #4,d6
- beq dbzip_3byt
- cmp.b #2,d6
- beq dbzip_3byt
- dbzip_nocall:
- tst.b d6
- bne dbzip_nojr
- tst.b d5
- beq dbzip_2byt
- dbzip_nojr
- addq.w #1,d0
- bra dbfwdcont
- dbzip_3byt
- addq.w #3,d0
- bra dbfwdcont
- dbzip_2byt
- addq.w #2,d0
- bra dbfwdcont
-
- dbfwd: lea inpline+1,a0
- bsr gethex
- dbfwdcont:
- move.w d0,dbwaitad
- movem.l a1-a6,-(sp)
- movem.l dbadrsave,a1-a6
- movem.l dbregsave,d0-d7
- lea dbfwdret,a1
- dbfwdloop:
- jmp sz80l
- dbfwdret:
- move.w Qual,d6
- cmp.b #$28,d6
- beq dbfwdend
- cmp.w dbwaitad,d7
- bne dbfwdloop
- dbfwdend:
- movem.l d0-d7,dbregsave
- movem.l a1-a6,dbadrsave
- movem.l (sp)+,a1-a6
- bra dbinploop
-
- dbwaaaas:
- move.l #SyntaxError,d2
- move.l dbhandle,d1
- move.l #SynErrEnd-SyntaxError,d3
- jsr _Write(a6)
- bra dbinploop
-
- dbprintins:
- lea dbinsstr,a0
- lea hexnums,a1
- lea 3(a0),a2
- moveq #3,d7
- move.w dbregsave+30,d0 ; PC
- bsr copyhex
-
- move.w dbregsave+30,d5
- move.w d5,d6
- rol.w #4,d6
- and.w #$C,d6
- lea memmap,a3
- move.l 0(a3,d6.w),a3
- add.w d5,a3
- moveq.l #3,d4
- moveq.l #6,d3
- move.b (a3),d6
- move.w d6,-(sp)
- lea dbinsbytes,a4
- dbins_pbytes
- lea 0(a0,d3.w),a2
- move.b (a3)+,d0
- move.b d0,(a4)+
- moveq #1,d7
- bsr copyhex
- addq.w #2,d3
- dbf d4,dbins_pbytes
- move.w (sp)+,d6
- lea 14(a0),a2
- cmp.b #$CB,d6
- beq dbins_preCB
- cmp.b #$ED,d6
- beq dbins_preED
- cmp.b #$40,d6
- bcs dbins_lower40
- cmp.b #$C0,d6
- bcc dbins_upper40
- cmp.b #$80,d6
- bcs dbins_lds
- bsr dbins_pt80BF
- bra dbins_nxt
- dbins_lds
- bsr dbins_pt407F
- bra dbins_nxt
- dbins_lower40
- bsr dbins_pt003F
- bra dbins_nxt
- dbins_upper40
- bsr dbins_ptC0FF
- bra dbins_nxt
- dbins_preCB:
- bsr dbins_CBxx
- bra dbins_nxt
- dbins_preED:
- bsr dbins_EDxx
- bra dbins_nxt
- dbins_nxt:
- move.l dbhandle,d1
- move.l #dbinsstr,d2
- move.l d2,a0
- moveq #0,d3
- dbins_count
- addq.w #1,d3
- move.b (a0)+,d0
- bne dbins_count
- lea dbinsbytes+1,a4
- move.l a0,a2
- dbins_findnn
- subq.w #1,a2
- dbins_testnn
- move.b (a2),d0
- cmp.b #32,d0
- beq dbins_nnend
- cmp.b #'n',d0
- bne dbins_findnn
- move.b (a4)+,d0
- moveq #1,d7
- bsr copyhex
- bra dbins_testnn
- dbins_nnend
- move.b #0,(a0)
- move.b #10,-1(a0)
- jsr _Write(a6)
- rts
-
- dbins_EDxx:
- move.l dbinsbytes,d0
- lsl.l #8,d0
- move.l d0,dbinsbytes
- move.b dbinsbytes,d6
- move.b d6,d5
- cmp.w #$40,d6
- bcs dbED_illg
- cmp.b #$BC,d6
- bcc dbED_illg
- sub.w #$40,d6 ; lowest ED command $40
- lea EDTab,a3
- add.w d6,d6
- add.w d6,d6
- and.w #$1ff,d6
- move.l 0(a3,d6.w),a3
- bsr CopyA3A2
- rts
- dbED_illg
- move.w #$4C,d6 ; illegal code
- bra dbins_EDxx
-
- dbins_CBxx:
- move.l dbinsbytes,d0
- lsl.l #8,d0
- move.l d0,dbinsbytes
- move.b dbinsbytes,d6
- move.b d6,d5
- cmp.b #$40,d6
- bcc dbCB_BRS
- lea CBRLTab,a3
- and.w #$38,d5
- lsr.w #1,d5
- move.l 0(a3,d5.w),a3
- bsr CopyA3A2
- subq.w #1,a2
- lea opertab,a3
- and.w #7,d6
- add.w d6,d6
- add.w d6,d6
- move.l 0(a3,d6.w),a3
- bsr CopyA3A2
- rts
- dbCB_BRS
- and.w #$C0,d5
- sub.w #$40,d5
- lsr.w #4,d5
- lea BRSTab,a3
- move.l 0(a3,d5.w),a3
- bsr CopyA3A2
- move.b #',',(a2)
- move.w d6,d5
- and.w #$38,d5
- lsr.w #3,d5
- add.b #'0',d5
- move.b d5,-1(a2)
- addq.w #1,a2
- lea opertab,a3
- and.w #7,d6
- add.w d6,d6
- add.w d6,d6
- move.l 0(a3,d6.w),a3
- bsr CopyA3A2
-
- dbins_pt003F:
- lea instab1,a3
- add.w d6,d6
- add.w d6,d6
- and.w #$3FF,d6
- move.l 0(a3,d6.w),a3
- bsr CopyA3A2
- rts
-
- dbins_pt407F:
- move.b #'L',(a2)+
- move.b #'D',(a2)+
- move.b #32,(a2)+
- move.b #32,(a2)+
- lea opertab,a3
- move.w d6,d5
- and.w #$38,d5
- lsr.w #1,d5
- move.l 0(a3,d5.w),a3
- bsr CopyA3A2
- move.b #',',-1(a2)
- lea opertab,a3
- and.w #7,d6
- add.w d6,d6
- add.w d6,d6
- move.l 0(a3,d6.w),a3
- bsr CopyA3A2
- rts
-
- dbins_pt80BF:
- move.w d6,d5
- and.w #$38,d5
- lea aritab,a3
- lsr.w #1,d5
- move.l 0(a3,d5.w),a3
- bsr CopyA3A2
- subq.w #1,a2
- lea opertab,a3
- and.w #7,d6
- add.w d6,d6
- add.w d6,d6
- move.l 0(a3,d6.w),a3
- bsr CopyA3A2
- rts
-
- dbins_ptC0FF:
- lea instab1,a3
- add.w d6,d6
- add.w d6,d6
- and.w #$FF,d6
- add.w #$100,d6
- move.l 0(a3,d6.w),a3
- bsr CopyA3A2
- rts
-
- CopyA3A2:
- move.b (a3)+,d0
- move.b d0,(a2)+
- tst.b d0
- bne CopyA3A2
- rts
-
- dbprintregs:
- lea dbregstr,a0
- lea hexnums,a1
- move.l a0,d2
- lea 3(a0),a2
- moveq #1,d7
- move.b dbregsave+3,d0 ; A
- bsr copyhex
- lea 8(a0),a2
- moveq #1,d7
- move.b dbregsave+7,d0 ; F
- bsr copyhex
- lea 16(a0),a2
- moveq #3,d7
- move.w dbregsave+10,d0 ; BC
- bsr copyhex
- lea 24(a0),a2
- moveq #3,d7
- move.w dbregsave+14,d0 ; DE
- bsr copyhex
- lea 32(a0),a2
- moveq #3,d7
- move.w dbregsave+18,d0 ; HL
- bsr copyhex
- lea 40(a0),a2
- moveq #3,d7
- move.w ix,d0 ; IX
- bsr copyhex
- lea 48(a0),a2
- moveq #3,d7
- move.w iy,d0 ; IY
- bsr copyhex
- lea 56(a0),a2
- moveq #3,d7
- move.w stack,d0 ; SP
- bsr copyhex
- lea 64(a0),a2
- moveq #1,d7
- move.w dbregsave+18,d5 ; (HL)
- move.w d5,d6
- rol.w #4,d6
- and.w #$C,d6
- lea memmap,a3
- move.l 0(a3,d6.w),a3
- add.w d5,a3
- move.b (a3),d0
- bsr copyhex
-
- lea 74(a0),a2
- moveq #3,d7
- move.w stack,d5 ; (SP)
- move.w d5,d6
- rol.w #4,d6
- and.w #$C,d6
- lea memmap,a3
- move.l 0(a3,d6.w),a3
- add.w d5,a3
- move.b 1(a3),d0
- lsl.w #8,d0
- move.b (a3),d0
- bsr copyhex
- move.l #dbregstrend-dbregstr,d3
- jsr _Write(a6)
- rts
-
- copyhex move.b d0,d6
- and.w #$F,d6
- move.b 0(a1,d6.w),(a2)
- subq.w #1,a2
- lsr.w #4,d0
- dbf d7,copyhex
- rts
-
- gethex: moveq #0,d0
- ghx_loop1
- move.b (a0)+,d6
- cmp.b #32,d6
- beq ghx_loop1
- cmp.b #0,d6
- beq ghx_end
- cmp.b #10,d6
- beq ghx_end
- subq.w #1,a0
- ghx_loop2
- move.b (a0)+,d6
- cmp.b #32,d6
- beq ghx_end
- cmp.b #0,d6
- beq ghx_end
- cmp.b #10,d6
- beq ghx_end
- move.w d6,d5
- cmp.b #65,d5
- bcc ghx_alph
- sub.w #'0',d6
- lsl.w #4,d0
- add.b d6,d0
- bra ghx_loop2
- ghx_alph
- bclr #5,d6
- sub.w #'A'-10,d6
- lsl.w #4,d0
- add.b d6,d0
- bra ghx_loop2
- ghx_end rts
-
- RedrawArea: ; redraw a defined part of screen
- movem.l a1-a6/d0-d7,-(sp) ; D5: CPC start addr; D6: -endaddr
- moveq.l #0,d0
- move.w d5,d0
- move.w d6,d1
- sub.w d5,d1
- bra RDS_contd
-
- RedrawScreen:
- movem.l a1-a6/d0-d7,-(sp)
- moveq.l #0,d0
- move.w scrbase,d0
- move.w #$3FFF,d1
- RDS_contd:
- lea Scroff,a0 ; A0 = OffTab
- move.l cpcplns,a1 ; A1 = Planes
- lea rambase,a2
- add.w d0,a2 ; A2 = CPCScreenPtr
- moveq.l #0,d3 ; D3 = CPCScreenOffset
- move.w d0,d3
- and.w #$3fff,d3
- move.w scroff,d4 ; D4 = ScrOff
-
- move.b sysstat,d2 ; calculate screen mode routine address
- and.w #3,d2
- add.w d2,d2
- add.w d2,d2
- lea RDSModeTab,a4
- move.l 0(a4,d2.w),a4
- move.w #$7ff,d0
- move.w #$3800,d2
- RDS_Loop
- move.w d3,d5
- sub.w d4,d5
- and.w d0,d5
- move.w d3,d6
- and.w d2,d6
- or.w d6,d5
- add.w d5,d5
- move.w 0(a0,d5.w),d5 ; D5 = PlaneOffset
- moveq #0,d6
- move.b (a2)+,d6
- jsr (a4)
- addq.w #1,d3
- dbra d1,RDS_Loop
- RDS_End:
- movem.l (sp)+,a1-a6/d0-d7
- rts
-
- RDS0 movem.w d1/d3,-(sp)
- add.w d6,d6
- lea m0cols,a5
- move.w 0(a5,d6.w),d7
- move.w d5,d6
- lsr.w #1,d5
- move.w #$F,d3
- and.w #1,d6
- bne RDS0_RightNibble
- rol.w #4,d7
- move.w #$F0,d3
- RDS0_RightNibble:
- move.l (a1),a5
- move.b 0(a5,d5.w),d6
- or.w d3,d6
- eor.w d3,d6
- move.w d7,d1
- and.w d3,d1
- or.w d1,d6
- move.b d6,0(a5,d5.w)
- ror.w #4,d7
- move.l 4(a1),a5
- move.b 0(a5,d5.w),d6
- or.w d3,d6
- eor.w d3,d6
- move.w d7,d1
- and.w d3,d1
- or.w d1,d6
- move.b d6,0(a5,d5.w)
- ror.w #4,d7
- move.l 8(a1),a5
- move.b 0(a5,d5.w),d6
- or.w d3,d6
- eor.w d3,d6
- move.w d7,d1
- and.w d3,d1
- or.w d1,d6
- move.b d6,0(a5,d5.w)
- ror.w #4,d7
- move.l 12(a1),a5
- move.b 0(a5,d5.w),d6
- or.w d3,d6
- eor.w d3,d6
- move.w d7,d1
- and.w d3,d1
- or.w d1,d6
- move.b d6,0(a5,d5.w)
- RDS0_End:
- movem.w (sp)+,d1/d3
- rts
-
- RDS2 move.l (a1),a5 ; mode 2 is nice and simple :-)
- move.b d6,0(a5,d5.w)
- rts
-
- RDS1 add.w d6,d6
- lea m1cols,a5
- move.w 0(a5,d6.w),d7
- move.l (a1),a5
- move.b d7,0(a5,d5.w)
- lsr.w #8,d7
- move.l 4(a1),a5
- move.b d7,0(a5,d5.w)
- rts
-
- RDSModeTab dc.l RDS0,RDS1,RDS2,RDS0
-
- DoScr move.b sysstat,d6 ; update display after Z80
- and.w #3,d6 ; wrote data into video ram
- add.w d6,d6
- add.w d6,d6
- lea ModeTab,a0
- move.l 0(a0,d6.w),a0
- jmp (a0)
-
- DoMode2 bsr getscad
- move.l (a0),a0
- move.b d6,0(a0,d5.w)
- rts
-
- DoMode1 bsr getscad
- and.w #$FF,d6
- add.w d6,d6
- lea m1cols,a4
- move.w 0(a4,d6.w),d6
- move.l (a0),a4
- move.b d6,0(a4,d5.w)
- lsr.w #8,d6
- move.l 4(a0),a4
- move.b d6,0(a4,d5.w)
- lea rambase,a4
- rts
-
- DoMode0 movem.l d0-d3/a1,-(sp)
- move.b 0(a4,d5.w),d0 ; get byte from cpc's video ram
- lea Scroff,a0
- move.w d5,d6
- and.w #$3800,d6
- sub.w scroff,d5
- and.w #$7FF,d5
- add.w d6,d5
- add.w d5,d5
- move.w 0(a0,d5.w),d5
- move.w d5,d1
- lea m0cols,a1
- and.w #$FF,d0
- add.w d0,d0
- move.w 0(a1,d0.w),d0 ; D0 = Farbcodes; 4 nibbles
- lsr.w #1,d5 ; divide by 2
- move.w #$F,d3
- and.w #1,d1
- bne DM0_RightNibble
- rol.w #4,d0 ; one up
- move.w #$F0,d3
- DM0_RightNibble
- move.l cpcplns,a0
- move.l (a0)+,a1 ; 4 planes
- move.b 0(a1,d5.w),d2
- or.w d3,d2
- eor.w d3,d2
- move.w d0,d1
- and.w d3,d1
- or.w d1,d2
- move.b d2,0(a1,d5.w)
- ror.w #4,d0
- move.l (a0)+,a1
- move.b 0(a1,d5.w),d2
- or.w d3,d2
- eor.w d3,d2
- move.w d0,d1
- and.w d3,d1
- or.w d1,d2
- move.b d2,0(a1,d5.w)
- ror.w #4,d0
- move.l (a0)+,a1
- move.b 0(a1,d5.w),d2
- or.w d3,d2
- eor.w d3,d2
- move.w d0,d1
- and.w d3,d1
- or.w d1,d2
- move.b d2,0(a1,d5.w)
- ror.w #4,d0
- move.l (a0)+,a1
- move.b 0(a1,d5.w),d2
- or.w d3,d2
- eor.w d3,d2
- move.w d0,d1
- and.w d3,d1
- or.w d1,d2
- move.b d2,0(a1,d5.w)
- lea sz80l,a1
- movem.l (sp)+,d0-d3/a1
- rts
-
- getscad move.b 0(a4,d5.w),d6 ; get byte from cpc's video ram
- lea Scroff,a0
- move.w d6,-(sp)
- move.w d5,d6
- and.w #$3800,d6
- sub.w scroff,d5
- and.w #$7FF,d5
- add.w d6,d5
- add.w d5,d5
- move.w 0(a0,d5.w),d5
- move.l cpcplns,a0
- move.w (sp)+,d6
- rts
-
- service clr.w intcount ; interrupt before next instruction
- rts
-
- outp cmp.b #$7F,d5
- beq outga
- cmp.b #$F4,d5
- beq out8255a
- cmp.b #$F5,d5
- beq out8255b
- cmp.b #$F6,d5
- beq out8255c
- cmp.b #$F7,d5
- beq out8255control
- cmp.b #$BC,d5
- beq outCRTCreg
- cmp.b #$BD,d5
- beq outCRTCwr
- cmp.b #$DF,d5
- beq outROMnum
- cmp.b #$FB,d5
- beq outFB
- cmp.b #$FA,d5
- beq outFA
- rts
-
- ; about the floppy code...
- ; Can't say I knew what I was doing. I only had a ROM 7 listing I had
- ; printed out myself and from that I tried to guess how the FDC works.
- ; This is somewhat better in the PC version, but not much.
- ; Unfortunately, the two versions use different disk files.
-
- outFA: moveq #0,d5
- move.b sBC,d5
- lea dcFAxx,a0
- move.b d6,0(a0,d5.w)
- rts
-
- outFB: moveq #0,d5
- cmp.b #$7E,sBC
- beq outFB7E
- cmp.b #$7F,sBC
- beq outFB7F
- lea dcFBxx,a0
- outFBend
- rts
-
- outFB7E:
- rts
-
- outFB7F:
- move.b dcstat,d5
- tst.b d5
- beq oFB7F_newcmd
- subq.b #1,d5
- beq oFB7F_parms
- move.b dcbytecnt,d5
- subq.b #1,d5
- bcs outFB7F_cmdfinish
- move.b d5,dcbytecnt
- move.l dcdpt,a0
- move.b d6,(a0)+
- move.l a0,dcdpt
- outFB7F_end
- rts
- outFB7F_cmdfinish
- clr.b dcstat
- rts
- oFB7F_parms:
- move.l dccppt,a0
- move.b d6,(a0)+
- move.l a0,dccppt
- move.b dcbytecnt,d5
- subq.b #1,d5
- move.b d5,dcbytecnt
- tst.b d5
- bne outFB7F_end
- oFB7F_stage2
- move.l dccommand,a0
- move.b 2(a0),dcbytecnt
- move.l 4(a0),a0
- move.b #2,dcstat
- tst.b dcbytecnt
- bne oFB7F_2ok
- clr.b dcstat
- oFB7F_2ok
- clr.w dcextdata
- jmp (a0)
- oFB7F_newcmd:
- lea dccommands,a0
- oFB7Fnc_loop
- tst.l (a0)
- beq outFB7F_end
- cmp.b (a0),d6
- beq oFB7Fnc_found
- add.w #8,a0
- bra oFB7Fnc_loop
- oFB7Fnc_found
- move.l a0,dccommand
- move.b 1(a0),dcbytecnt
- move.l #dccmdparms,dccppt
- move.l #dcdata,dcdpt
- move.b #1,dcstat
- tst.b dcbytecnt
- beq oFB7F_stage2
- rts
-
- outROMnum:
- move.w romnum,d5
- cmp.b d5,d6
- beq outROM_old
- move.b d6,d5
- move.w d5,romnum
- bsr RethinkMemMap
- outROM_old:
- rts
-
- outCRTCreg:
- move.b d6,CRTCregnum
- rts
-
- outCRTCwr:
- moveq.l #0,d5
- move.b CRTCregnum,d5
- lea CRTCregs,a0
- move.b d6,0(a0,d5.w)
- cmp.w #1,d5
- beq CRTC_NewWidth
- cmp.w #12,d5
- bcs CRTC_nonewparms
- cmp.w #14,d5
- bcc CRTC_nonewparms
- move.w 12(a0),d5
- add.w d5,d5
- move.w d5,d6
- add.w d6,d6
- and.w #$7FE,d5
- and.w #$C000,d6
- cmp.w scrbase,d6
- bne CRTC_newparms
- cmp.w scroff,d5
- beq CRTC_nonewparms
- CRTC_newparms
- move.w d6,scrbase
- move.w d5,scroff
- move.w #20,ReDrawCount
- CRTC_nonewparms
- rts
-
- CRTC_NewWidth
- cmp.b crtcscrwidth,d6
- beq CRTC_nonewparms
- move.w #20,ReDrawCount
- move.b d6,crtcscrwidth
- jmp InitScroff
-
- out8255a:
- move.b d6,port8255a
- rts
-
- out8255b:
- move.b d6,port8255b
- rts
-
- out8255c:
- move.b d6,port8255c
- lsr.w #6,d6
- and.w #3,d6
- beq inactivepsg
- cmp.w #3,d6
- beq latchpsg
- cmp.w #2,d6
- beq writepsg
- rts
-
- out8255control:
- move.b d6,control8255
- rts
-
- ; sorry, no sound on the Amiga :-(
-
- inactivepsg:
- rts
-
- writepsg:
- moveq.l #0,d5
- move.b psgregnum,d5
- lea psgregs,a0
- move.b port8255a,0(a0,d5.w)
- rts
-
- latchpsg:
- move.b port8255a,d6
- and.b #15,d6
- move.b d6,psgregnum
- rts
-
- outga move.w d6,d5
- lsr.w #6,d5
- and.w #$3,d5
- lea rgsgarr,a0
- and.b #$3F,d6
- move.b d6,0(a0,d5.w)
- cmp.w #2,d5
- bne 1$
- bsr RethinkMemMap
- bsr RethinkMode
- 1$ cmp.w #1,d5
- beq ga_setcol
- rts
-
- ga_setcol
- movem.l d0/d1/d2/d3/a1/a6,-(sp)
- move.l cpcvp,a0
- moveq.l #0,d0
- move.b rgsgarr,d0
- cmp.b #16,d0
- beq ga_sc_end
- and.w #15,d0
- move.w d0,d1
- add.w d1,d1
- add.w d1,d1
- move.b rgsgarr+1,d6
- and.w #$1f,d6
- cmp.w #20,d6
- bne ga_sc_nobreak
- cmp.w #0,d1
- bne ga_sc_nobreak
- nop
- ga_sc_nobreak:
- add.w d6,d6
- add.w d6,d6
- lea CMap,a6
- lea ColorTab,a1
- move.l 0(a1,d6.w),0(a6,d1.w)
- tst.w ColMode
- beq ga_sc_norm
- lea ColorTabA,a1
- moveq #0,d6
- move.b rgsgarr,d6
- add.w d6,d6
- add.w d6,d6
- ga_sc_norm
- move.b 1(a1,d6.w),d1
- move.b 2(a1,d6.w),d2
- move.b 3(a1,d6.w),d3
- move.l gfxbase,a6
- jsr -288(a6) ; SetRGB4
- ga_sc_end
- movem.l (sp)+,d0/d1/d2/d3/a1/a6
- rts
-
- SetColors
- movem.l d0-d3/a4-a6,-(sp)
- lea CMap,a4
- tst.w ColMode
- beq SCL_Norm
- lea CMapSpecial,a4
- SCL_Norm
- move.l gfxbase,a6
- moveq #0,d0
- moveq #15,d6
- SCL_Loop
- move.w (a4)+,d1
- move.b (a4)+,d2
- move.b (a4)+,d3
- move.l cpcvp,a0
- move.w d0,-(sp)
- jsr -288(a6)
- move.w (sp)+,d0
- addq.w #1,d0
- dbf d6,SCL_Loop
- movem.l (sp)+,d0-d3/a4-a6
- rts
-
- inp cmp.b #$F4,d5
- beq inpioA
- cmp.b #$F5,d5
- beq inpioB
- cmp.b #$F6,d5
- beq inpioC
- cmp.b #$FB,d5
- beq inpFB
- move.b $DFF014,d6
- move.b $DFF006,d5
- eor.b d5,d6
- rts
-
- inpFB: cmp.b #$7F,sBC
- beq inpFB7F
- cmp.b #$7E,sBC
- beq inpFB7E
- inpFBxx move.w #$FF,d6
- rts
-
- inpFB7E move.w #$80,d6
- cmp.b #2,dcstat
- bne inpFB7Eend
- or.w #$40,d6
- tst.w dcextdata
- beq inpFB7Enoext
- or.w #$20,d6
- bra inpFB7Eend
- inpFB7Enoext
- tst.b dcbytecnt
- beq inpFB7Ffinish
- or.w #$10,d6
- inpFB7Eend
- rts
-
- inpFB7F move.b dcstat,d5
- cmp.b #1,d5
- beq oFB7F_parms
- cmp.b #2,d5
- bne inpFB7Fend
- move.w dcextdata,d5
- beq inpFB7F_normdata
- subq.w #1,d5
- move.w d5,dcextdata
- move.l dcedp,a0
- move.b (a0)+,d6
- move.l a0,dcedp
- bra inpFB7Fend
- inpFB7F_normdata
- move.b dcbytecnt,d5
- subq.b #1,d5
- bcs inpFB7Ffinish
- move.b d5,dcbytecnt
- move.l dcdpt,a0
- move.b (a0)+,d6
- move.l a0,dcdpt
- inpFB7Fend
- rts
-
- inpFB7Ffinish
- clr.b dcstat
- rts
-
- inpioA:
- move.b port8255c,d6
- lsr.w #6,d6
- and.w #3,d6
- cmp.w #1,d6
- beq readpsg
- move.b port8255a,d6
- rts
-
- readpsg:
- move.b psgregnum,d6
- cmp.b #14,d6
- beq readpsgext
- rts
-
- readpsgext:
- move.b #$FF,d6
- move.b port8255c,d5
- and.w #$F,d5
- lea KeyMatrix,a0
- move.b 0(a0,d5.w),d6
- rts
-
- inpioB: move.w #$1E,d6 ; company: AMSTRAD, freq: 50HZ
- or.w ffly,d6
- rts ; Printer not busy
-
- inpioC: move.b port8255c,d6
- rts
-
- RethinkMode:
- move.b sysstat,d6
- and.w #$3,d6
- cmp.w videomode,d6
- beq RTM_End
- movem.l d0-d3/a0-a6,-(sp)
- jsr CloseWin
- move.w d6,videomode
- cmp.b #1,d6
- beq RTM_1
- cmp.b #2,d6
- beq RTM_2
- bsr OpenScrMode0
- bra RTM_cont
- RTM_2 bsr OpenScrMode2
- bra RTM_cont
- RTM_1 bsr OpenScrMode1
- RTM_cont
- movem.l (sp)+,d0-d3/a0-a6
- move.w #20,ReDrawCount
- RTM_End rts
-
- OpenScrMode1:
- move.w #1,videomode
- move.l intbase,a6 ; open screen
- lea nscreen,a0
- move.w #640,4(a0)
- move.w #2,8(a0) ; 2 planes
- move.w #$8000,12(a0)
- jsr _OpenScreen(a6)
- tst.l d0
- beq cleanup
- move.l d0,cpcscr
- move.l d0,nwindow+30
- move.l d0,a0
- lea 44(a0),a0
- move.l a0,cpcvp
- lea nwindow,a0 ; open window
- move.w #640,4(a0)
- jsr _OpenWindow(a6)
- tst.l d0
- beq cleanup
- move.l d0,cpcwin
- move.l d0,a0
- move.l 86(a0),cpcup
- move.l 50(a0),cpcrp
- move.l 50(a0),a0
- move.l 4(a0),a0
- lea 8(a0),a0
- move.l a0,cpcplns
- bsr SetColors
- rts
-
- OpenScrMode2:
- move.w #2,videomode
- move.l intbase,a6 ; open screen
- lea nscreen,a0
- move.w #640,4(a0)
- move.w #1,8(a0)
- move.w #$8000,12(a0)
- jsr _OpenScreen(a6)
- tst.l d0
- beq cleanup
- move.l d0,nwindow+30
- move.l d0,cpcscr
- move.l d0,a0
- lea 44(a0),a0
- move.l a0,cpcvp
- lea nwindow,a0 ; open window
- move.w #640,4(a0)
- jsr _OpenWindow(a6)
- tst.l d0
- beq cleanup
- move.l d0,cpcwin
- move.l d0,a0
- move.l 86(a0),cpcup
- move.l 50(a0),cpcrp
- move.l 50(a0),a0
- move.l 4(a0),a0
- lea 8(a0),a0
- move.l a0,cpcplns
- bsr SetColors
- rts
-
- OpenScrMode0:
- move.w #0,videomode
- move.l intbase,a6 ; open screen
- lea nscreen,a0
- move.w #320,4(a0)
- move.w #4,8(a0) ; 4 planes
- move.w #0,12(a0)
- jsr _OpenScreen(a6)
- tst.l d0
- beq cleanup
- move.l d0,cpcscr
- move.l d0,a0
- move.l d0,nwindow+30
- lea 44(a0),a0
- move.l a0,cpcvp
- lea nwindow,a0 ; open window
- move.w #320,4(a0)
- jsr _OpenWindow(a6)
- tst.l d0
- beq cleanup
- move.l d0,cpcwin
- move.l d0,a0
- move.l 86(a0),cpcup
- move.l 50(a0),cpcrp
- move.l 50(a0),a0
- move.l 4(a0),a0
- lea 8(a0),a0
- move.l a0,cpcplns
- bsr SetColors
- rts
-
- CloseWin:
- move.l intbase,a6
- move.l cpcwin,d0
- beq CLOSE_NoWin
- jsr ClearWindowPort
- move.l cpcwin,a0 ; close all
- jsr _CloseWindow(a6)
- clr.l cpcwin
- CLOSE_NoWin
- move.l cpcscr,d0
- beq CLOSE_Ret
- move.l d0,a0
- jsr _CloseScreen(a6)
- clr.l cpcscr
- CLOSE_Ret
- rts
-
- RethinkMemMap:
- move.b sysstat,d6
- lea memmap,a0
- btst #2,d6
- beq RMM_LRomEnable
- move.l #rambase,(a0)
- move.l #0,codemap
- bra RMM_TestUpper
- RMM_LRomEnable
- move.l #amsdos,(a0)
- move.l #amscode,codemap
- RMM_TestUpper
- btst #3,d6
- beq RMM_URomEnable
- move.l #rambase,12(a0)
- move.l #0,codemap+12
- rts
- RMM_URomEnable
- cmp.w #7,romnum
- beq RMM_SetFloppy
- move.l #basic+$4000,12(a0)
- move.l #bascode-$30000,codemap+12
- rts
- RMM_SetFloppy
- move.l #rom7+$4000,12(a0)
- move.l #ro7code-$30000,codemap+12
- rts
-
- UpdateKeyMatrix:
- movem.l d0/d1/a1/a4-a6,-(sp)
- move.l 4,a6
- lea KeyMatrix,a5
- lea KeyCodeTab,a4
- UKM_Loop:
- move.l cpcup,a0
- jsr _GetMsg(a6)
- tst.l d0
- beq UKM_End
- move.l d0,a1
- move.l 20(a1),d0
- cmp.w #$400,d0
- bne UKM_Reply
- move.w 24(a1),d0
- move.w 26(a1),Qual
- move.w d0,d1
- and.w #$7F,d0
- and.w #$80,d1
- beq UKM_Pressed
- move.b 0(a4,d0.w),d0
- move.b d0,d1
- lsr.w #4,d1
- and.w #$F,d0
- and.w #$F,d1
- move.b 0(a5,d1.w),d6
- bset d0,d6
- move.b d6,0(a5,d1.w)
- bra UKM_Reply
- UKM_Pressed:
- move.b 0(a4,d0.w),d0
- move.b d0,d1
- lsr.w #4,d1
- and.w #$F,d0
- and.w #$F,d1
- move.b 0(a5,d1.w),d6
- bclr d0,d6
- move.b d6,0(a5,d1.w)
- UKM_Reply:
- jsr _ReplyMsg(a6)
- bra UKM_Loop
- UKM_End:
- movem.l (sp)+,d0/d1/a1/a4-a6
- rts
-
- GetWindowMsg: ; returns Msgpt in d6 or NULL
- movem.l d0/d1/a0/a1/a6,-(sp)
- move.l 4,a6
- move.l cpcup,a0
- jsr _GetMsg(a6)
- move.l d0,d6
- beq GWM_End
- move.l d0,a0
- move.l 20(a0),Class
- move.w 24(a0),Code
- move.w 26(a0),Qual
- move.l a0,a1
- jsr _ReplyMsg(a6)
- GWM_End:
- movem.l (sp)+,d0/d1/a0/a1/a6
- rts
-
- ClearWindowPort:
- movem.l d0/d1/a0/a1/a6,-(sp)
- move.l 4,a6
- CWP_Loop:
- move.l cpcup,a0
- jsr _GetMsg(a6)
- tst.l d0
- beq CWP_End
- move.l d0,a1
- jsr _ReplyMsg(a6)
- bra CWP_Loop
- CWP_End:
- movem.l (sp)+,d0/d1/a0/a1/a6
- rts
-
- OpenDBugWin:
- movem.l d0/d1/a0/a1/a6,-(sp)
- move.l #newdbstr,d1
- move.l #1006,d2
- move.l dosbase,a6
- jsr _Open(a6)
- move.l d0,dbhandle
- movem.l (sp)+,d0/d1/a0/a1/a6
- rts
-
- CloseDBugWin:
- movem.l d0/d1/a0/a1/a6,-(sp)
- move.l dosbase,a6
- move.l dbhandle,d1
- beq CDBW_Xit
- jsr _Close(a6)
- clr.l dbhandle
- CDBW_Xit
- movem.l (sp)+,d0/d1/a0/a1/a6
- rts
-
- ; This one traps certain addresses in CPC space and replaces Z80 code
- ; with native Amiga code. This was done mainly for floppy stuff, which
- ; is no longer needed now. This is DISABLED! The patches only works for
- ; the 664 ROM!
-
- codecheck:
- move.w d7,d5
- rol.w #4,d5
- and.w #$C,d5
- lea codemap,a0
- move.l 0(a0,d5.w),d5
- beq cck_ret
- move.l d5,a0
- moveq #0,d5
- move.w d7,d5
- add.l d5,d5
- add.l d5,d5
- move.l 0(a0,d5.l),d5
- beq cck_ret
- move.l d5,a0
- jsr (a0)
- moveq #0,d5
- cck_ret
- rts
-
- ; more floppy stuff... everything a bit awkward
-
- DCNop: rts
-
- DCGetTrack:
- cmp.w #1,dcflagntr
- bne DCGT_oldtr
- move.b CurrTrack,dcdata+1
- move.b #32,dcdata
- subq.w #1,dcflagntr
- rts
- DCGT_oldtr
- tst.w dcflagntr
- beq DCGT_clear
- move.w #$8080,dcdata
- rts
- DCGT_clear
- clr.w dcdata
- subq.w #1,dcflagntr
- rts
-
- DCSeek0:
- clr.b CurrTrack
- bra DCSeekctd
-
- DCReadSec:
- move.l d7,-(sp)
- bsr DCGetID
- move.b dccmdparms+3,d5
- move.b #$40,dcdata
- move.b #$80,dcdata+1
- moveq.l #0,d7
- DCRS_ReadLoop
- movem.l d0-d7/a0-a6,-(sp)
- lea idfield,a0
- move.l trackoffs,d0
- add.l #66,d0
- move.b d5,dcdata+5
- DCRS_Loop1
- cmp.b #$FF,(a0)
- beq DCRS_Erreur
- cmp.b (a0)+,d5
- beq DCRS_found
- add.l #512,d0
- bra DCRS_Loop1
- DCRS_found
- move.l fhandle,d1
- move.l d0,d2
- moveq.l #-1,d3
- move.l dosbase,a6
- jsr _Seek(a6)
- move.l fhandle,d1
- move.l #DiskBuf,d2
- add.l d7,d2
- move.l #512,d3
- jsr _Read(a6)
- movem.l (sp)+,d0-d7/a0-a6
- add.l #512,d7
- move.b dccmdparms+5,d6
- cmp.b d6,d5
- beq DCRS_AllRead
- addq.b #1,d5
- bra DCRS_ReadLoop
- DCRS_AllRead
- move.w d7,dcextdata
- move.l #DiskBuf,dcedp
- move.l (sp)+,d7
- rts
- DCRS_Erreur:
- movem.l (sp)+,d0-d7/a0-a6
- move.b #4,dcdata+1 ; DC Fehlerkennung
- bra DCRS_AllRead
-
- DCSeek: move.b dccmdparms+1,CurrTrack
- DCSeekctd:
- movem.l d0-d7/a1-a6,-(sp)
- jsr DCSeekCurr
- movem.l (sp)+,d0-d7/a1-a6
- rts
-
- DCGetID:
- lea dcdata,a0
- moveq #0,d5
- move.b CurrTrack,d5
- move.l d5,(a0)+
- move.b #2,2(a0)
- move.l a1,-(sp)
-
- move.l IDTPtr,a1
- move.b (a1)+,d5
- cmp.b #$FF,d5
- bne DCGI_Wback
- lea idfield,a1
- move.b (a1)+,d5
- DCGI_Wback
- move.l a1,IDTPtr
- move.w d5,(a0)
- cmp.w #$65,d5
- bne DCGI_SizeOK
- move.b #3,2(a0)
- DCGI_SizeOK
- move.l (sp)+,a1
- rts
-
- DCSeekCurr:
- move.w #1,dcflagntr
- moveq #0,d5
- move.b CurrTrack,d5
- add.w d5,d5 ; x2
- move.l d5,d6
- lsl.l #5,d6 ; x64
- add.l d6,d5 ; x66
- lsl.l #4,d6 ; x1024
- add.l d6,d5
- add.l d6,d6
- add.l d6,d6 ; x4096
- add.l d6,d5 ; x5186
- move.l d5,d2
- move.l d5,trackoffs
- moveq #-1,d3
- move.l fhandle,d1
- move.l dosbase,a6
- jsr _Seek(a6)
- move.l fhandle,d1
- move.l #idfield,d2
- move.l d2,IDTPtr
- move.l #66,d3
- jsr _Read(a6)
- rts
-
- SECTION data,DATA
- dosname dc.b 'dos.library',0
- EVEN
- intname dc.b 'intuition.library',0
- EVEN
- gfxname dc.b 'graphics.library',0
- EVEN
- lrname dc.b 'Lrom',0
- EVEN
- lrname2 dc.b 'CPE:LRom',0
- EVEN
- urname dc.b 'Urom',0
- EVEN
- urname2 dc.b 'CPE:URom',0
- EVEN
- frname dc.b 'rom7',0
- EVEN
- frname2 dc.b 'CPE:Rom7',0
- EVEN
- draname dc.b 'drivea.dat',0
- EVEN
- newdbstr dc.b 'CON:0/1/640/255/CPE Z80 debugger',0
- EVEN
- dbregstr dc.b 'A xx F xx BC xxxx DE xxxx HL xxxx IX xxxx IY xxxx SP xxxx (HL) xx (SP) xxxx',10,0
- dbregstrend
- EVEN
- dbinsstr dc.b 'xxxx xxxxxxxx LD (IX+4),nnnn',10,0,0,0,0,0
- EVEN
- hexnums dc.b '0123456789ABCDEF'
- EVEN
- SyntaxError dc.b 'You typed garbage. No offense meant.',10,0
- SynErrEnd:
- EVEN
- ins0 dc.b "NOP",0
- ins1 dc.b "LD BC,nnnn",0
- ins2 dc.b "LD (BC),A",0
- ins3 dc.b "INC BC",0
- ins4 dc.b "INC B",0
- ins5 dc.b "DEC B",0
- ins6 dc.b "LD B,nn",0
- ins7 dc.b "RLCA",0
- ins8 dc.b "EX AF,AF'",0
- ins9 dc.b "ADD HL,BC",0
- insa dc.b "LD A,(BC)",0
- insb dc.b "DEC BC",0
- insc dc.b "INC C",0
- insd dc.b "DEC C",0
- inse dc.b "LD C,nn",0
- insf dc.b "RRCA",0
- ins10 dc.b "DJNZ nn",0
- ins11 dc.b "LD DE,nnnn",0
- ins12 dc.b "LD (DE),A",0
- ins13 dc.b "INC DE",0
- ins14 dc.b "INC D",0
- ins15 dc.b "DEC D",0
- ins16 dc.b "LD D,nn",0
- ins17 dc.b "RLA",0
- ins18 dc.b "JR nn",0
- ins19 dc.b "ADD HL,DE",0
- ins1a dc.b "LD A,(DE)",0
- ins1b dc.b "DEC DE",0
- ins1c dc.b "INC E",0
- ins1d dc.b "DEC E",0
- ins1e dc.b "LD E,nn",0
- ins1f dc.b "RRA",0
- ins20 dc.b "JR NZ,nn",0
- ins21 dc.b "LD HL,nnnn",0
- ins22 dc.b "LD (nnnn),HL",0
- ins23 dc.b "INC HL",0
- ins24 dc.b "INC H",0
- ins25 dc.b "DEC H",0
- ins26 dc.b "LD H,nn",0
- ins27 dc.b "DAA",0
- ins28 dc.b "JR Z,nn",0
- ins29 dc.b "ADD HL,HL",0
- ins2a dc.b "LD HL,(nnnn)",0
- ins2b dc.b "DEC HL",0
- ins2c dc.b "INC L",0
- ins2d dc.b "DEC L",0
- ins2e dc.b "LD L,nn",0
- ins2f dc.b "CPL",0
- ins30 dc.b "JR NC,nn",0
- ins31 dc.b "LD SP,nnnn",0
- ins32 dc.b "LD (nnnn),A",0
- ins33 dc.b "INC SP",0
- ins34 dc.b "INC (HL)",0
- ins35 dc.b "DEC (HL)",0
- ins36 dc.b "LD (HL),nn",0
- ins37 dc.b "SCF",0
- ins38 dc.b "JR C,nn",0
- ins39 dc.b "ADD HL,SP",0
- ins3a dc.b "LD A,(nnnn)",0
- ins3b dc.b "DEC SP",0
- ins3c dc.b "INC A",0
- ins3d dc.b "DEC A",0
- ins3e dc.b "LD A,nn",0
- ins3f dc.b "CCF",0
-
- insc0 dc.b "RET NZ",0
- insc1 dc.b "POP BC",0
- insc2 dc.b "JP NZ,nnnn",0
- insc3 dc.b "JP nnnn",0
- insc4 dc.b "CALL NZ,nnnn",0
- insc5 dc.b "PUSH BC",0
- insc6 dc.b "ADD A,nn",0
- insc7 dc.b "RST &00",0
- insc8 dc.b "RET Z",0
- insc9 dc.b "RET",0
- insca dc.b "JP Z,nnnn",0
- inscb dc.b "Crux Me Do!",0
- inscc dc.b "CALL Z,nnnn",0
- inscd dc.b "CALL nnnn",0
- insce dc.b "ADC A,nn",0
- inscf dc.b "RST &08",0
- insd0 dc.b "RET NC",0
- insd1 dc.b "POP DE",0
- insd2 dc.b "JP NC,nnnn",0
- insd3 dc.b "OUT (nn),A",0
- insd4 dc.b "CALL NC,nnnn",0
- insd5 dc.b "PUSH DE",0
- insd6 dc.b "SUB nn",0
- insd7 dc.b "RST &10",0
- insd8 dc.b "RET C",0
- insd9 dc.b "EXX",0
- insda dc.b "JP C,nnnn",0
- insdb dc.b "IN A,(nn)",0
- insdc dc.b "CALL C,nnnn",0
- insdd dc.b "preDD",0
- insde dc.b "SBC A,nn",0
- insdf dc.b "RST &18",0
- inse0 dc.b "RET PO",0
- inse1 dc.b "POP HL",0
- inse2 dc.b "JP PO,nnnn",0
- inse3 dc.b "EX (SP),HL",0
- inse4 dc.b "CALL PO,nnnn",0
- inse5 dc.b "PUSH HL",0
- inse6 dc.b "AND nn",0
- inse7 dc.b "RST &20",0
- inse8 dc.b "RET PE",0
- inse9 dc.b "JP (HL)",0
- insea dc.b "JP PE,nnnn",0
- inseb dc.b "EX DE,HL",0
- insec dc.b "CALL PE,nnnn",0
- insed dc.b 0
- insee dc.b "XOR nn",0
- insef dc.b "RST &28",0
- insf0 dc.b "RET P",0
- insf1 dc.b "POP AF",0
- insf2 dc.b "JP P,nnnn",0
- insf3 dc.b "DI",0
- insf4 dc.b "CALL P,nnnn",0
- insf5 dc.b "PUSH AF",0
- insf6 dc.b "OR nn",0
- insf7 dc.b "RST &30",0
- insf8 dc.b "RET M",0
- insf9 dc.b "LD SP,HL",0
- insfa dc.b "JP M,nnnn",0
- insfb dc.b "EI",0
- insfc dc.b "CALL M,nnnn",0
- insfd dc.b "preFD",0
- insfe dc.b "CP nn",0
- insff dc.b "RST &38",0
-
- oper0 dc.b "B",0
- oper1 dc.b "C",0
- oper2 dc.b "D",0
- oper3 dc.b "E",0
- oper4 dc.b "H",0
- oper5 dc.b "L",0
- oper6 dc.b "(HL)",0
- oper7 dc.b "A",0
-
- ari0 dc.b 'ADD A,',0
- ari1 dc.b 'ADC A,',0
- ari2 dc.b 'SUB ',0
- ari3 dc.b 'SBC A,',0
- ari4 dc.b 'AND ',0
- ari5 dc.b 'XOR ',0
- ari6 dc.b 'OR ',0
- ari7 dc.b 'CP ',0
-
- CBRL0 dc.b 'RLC ',0
- CBRL1 dc.b 'RRC ',0
- CBRL2 dc.b 'RL ',0
- CBRL3 dc.b 'RR ',0
- CBRL4 dc.b 'SLA ',0
- CBRL5 dc.b 'SRA ',0
- CBRL6 dc.b 'ILLGCB ',0
- CBRL7 dc.b 'SRL ',0
-
- BRS0 dc.b 'BIT ',0
- BRS1 dc.b 'RES ',0
- BRS2 dc.b 'SET ',0
-
- EDil dc.b 'ILLGED ',0
- ED40 dc.b 'IN B,(C)',0
- ED41 dc.b 'OUT (C),B',0
- ED42 dc.b 'SBC HL,BC',0
- ED43 dc.b 'LD (nnnn),BC',0
- ED44 dc.b 'NEG',0
- ED45 dc.b 'RETN',0
- ED46 dc.b 'IM 0',0
- ED47 dc.b 'LD I,A',0
- ED48 dc.b 'IN C,(C)',0
- ED49 dc.b 'OUT (C),C',0
- ED4a dc.b 'ADC HL,BC',0
- ED4b dc.b 'LD BC,(nnnn)',0
- ED4d dc.b 'RETI',0
- ED4f dc.b 'LD R,A',0
- ED50 dc.b 'IN D,(C)',0
- ED51 dc.b 'OUT (C),D',0
- ED52 dc.b 'SBC HL,DE',0
- ED53 dc.b 'LD (nnnn),DE',0
- ED56 dc.b 'IM 1',0
- ED57 dc.b 'LD A,I',0
- ED58 dc.b 'IN E,(C)',0
- ED59 dc.b 'OUT (C),E',0
- ED5a dc.b 'ADC HL,DE',0
- ED5b dc.b 'LD DE,(nnnn)',0
- ED5e dc.b 'IM 2',0
- ED5f dc.b 'LD A,R',0
- ED60 dc.b 'IN H,(C)',0
- ED61 dc.b 'OUT (C),H',0
- ED62 dc.b 'SBC HL,HL',0
- ED63 dc.b 'LD (nnnn),HL',0
- ED67 dc.b 'RRD',0
- ED68 dc.b 'IN L,(C)',0
- ED69 dc.b 'OUT (C),L',0
- ED6a dc.b 'ADC HL,HL',0
- ED6b dc.b 'LD HL,(nnnn)',0
- ED6f dc.b 'RLD',0
- ED72 dc.b 'SBC HL,SP',0
- ED73 dc.b 'LD (nnnn),SP',0
- ED78 dc.b 'IN A,(C)',0
- ED79 dc.b 'OUT (C),A',0
- ED7a dc.b 'ADC HL,SP',0
- ED7b dc.b 'LD SP,(nnnn)',0
- EDa0 dc.b 'LDI',0
- EDa1 dc.b 'CPI',0
- EDa2 dc.b 'INI',0
- EDa3 dc.b 'OUTI',0
- EDa8 dc.b 'LDD',0
- EDa9 dc.b 'CPD',0
- EDaa dc.b 'IND',0
- EDab dc.b 'OUTD',0
- EDb0 dc.b 'LDIR',0
- EDb1 dc.b 'CPIR',0
- EDb2 dc.b 'INIR',0
- EDb3 dc.b 'OTIR',0
- EDb8 dc.b 'LDDR',0
- EDb9 dc.b 'CPDR',0
- EDba dc.b 'INDR',0
- EDbb dc.b 'OTDR',0
- EVEN
- instab1 dc.l ins0,ins1,ins2,ins3,ins4,ins5,ins6,ins7
- dc.l ins8,ins9,insa,insb,insc,insd,inse,insf
- dc.l ins10,ins11,ins12,ins13,ins14,ins15,ins16,ins17
- dc.l ins18,ins19,ins1a,ins1b,ins1c,ins1d,ins1e,ins1f
- dc.l ins20,ins21,ins22,ins23,ins24,ins25,ins26,ins27
- dc.l ins28,ins29,ins2a,ins2b,ins2c,ins2d,ins2e,ins2f
- dc.l ins30,ins31,ins32,ins33,ins34,ins35,ins36,ins37
- dc.l ins38,ins39,ins3a,ins3b,ins3c,ins3d,ins3e,ins3f
- dc.l insc0,insc1,insc2,insc3,insc4,insc5,insc6,insc7
- dc.l insc8,insc9,insca,inscb,inscc,inscd,insce,inscf
- dc.l insd0,insd1,insd2,insd3,insd4,insd5,insd6,insd7
- dc.l insd8,insd9,insda,insdb,insdc,insdd,insde,insdf
- dc.l inse0,inse1,inse2,inse3,inse4,inse5,inse6,inse7
- dc.l inse8,inse9,insea,inseb,insec,insed,insee,insef
- dc.l insf0,insf1,insf2,insf3,insf4,insf5,insf6,insf7
- dc.l insf8,insf9,insfa,insfb,insfc,insfd,insfe,insff
-
- opertab dc.l oper0,oper1,oper2,oper3,oper4,oper5,oper6,oper7
- aritab dc.l ari0,ari1,ari2,ari3,ari4,ari5,ari6,ari7
- CBRLTab dc.l CBRL0,CBRL1,CBRL2,CBRL3,CBRL4,CBRL5,CBRL6,CBRL7
- BRSTab dc.l BRS0,BRS1,BRS2
- EDTab dc.l ED40,ED41,ED42,ED43,ED44,ED45,ED46,ED47
- dc.l ED48,ED49,ED4a,ED4b,EDil,ED4d,EDil,ED4f
- dc.l ED50,ED51,ED52,ED53,EDil,EDil,ED56,ED57
- dc.l ED58,ED59,ED5a,ED5b,EDil,EDil,ED5e,ED5f
- dc.l ED60,ED61,ED62,ED63,EDil,EDil,EDil,ED67
- dc.l ED68,ED69,ED6a,ED6b,EDil,EDil,EDil,ED6f
- dc.l EDil,EDil,ED72,ED73,EDil,EDil,EDil,EDil
- dc.l ED78,ED79,ED7a,ED7b,EDil,EDil,EDil,EDil
- dc.l EDil,EDil,EDil,EDil,EDil,EDil,EDil,EDil
- dc.l EDil,EDil,EDil,EDil,EDil,EDil,EDil,EDil
- dc.l EDil,EDil,EDil,EDil,EDil,EDil,EDil,EDil
- dc.l EDil,EDil,EDil,EDil,EDil,EDil,EDil,EDil
- dc.l EDa0,EDa1,EDa2,EDa3,EDil,EDil,EDil,EDil
- dc.l EDa8,EDa9,EDaa,EDab,EDil,EDil,EDil,EDil
- dc.l EDb0,EDb1,EDb2,EDb3,EDil,EDil,EDil,EDil
- dc.l EDb8,EDb9,EDba,EDbb,EDil,EDil,EDil,EDil
-
- nscreen dc.w 0,0,640,256,2
- dc.b 1,0
- dc.w $8000,$F
- dc.l 0,0,0,0
- nwindow dc.w 0,0,640,256
- dc.b -1,-1
- dc.l $400,$1900 ; RAWKEY / Borderless|Activate
- dc.l 0,0,0,0,0
- dc.w 0,0,0,0
- dc.w $F
-
- scrbase dc.w $C000
- scroff dc.w 0
-
- ModeTab dc.l DoMode0,DoMode1,DoMode2,DoMode0
-
- m1cols:
- dc.b $00,$00,$03,$00,$0C,$00,$0F,$00,$30,$00,$33,$00,$3C,$00,$3F,$00
- dc.b $C0,$00,$C3,$00,$CC,$00,$CF,$00,$F0,$00,$F3,$00,$FC,$00,$FF,$00
- dc.b $00,$03,$03,$03,$0C,$03,$0F,$03,$30,$03,$33,$03,$3C,$03,$3F,$03
- dc.b $C0,$03,$C3,$03,$CC,$03,$CF,$03,$F0,$03,$F3,$03,$FC,$03,$FF,$03
- dc.b $00,$0C,$03,$0C,$0C,$0C,$0F,$0C,$30,$0C,$33,$0C,$3C,$0C,$3F,$0C
- dc.b $C0,$0C,$C3,$0C,$CC,$0C,$CF,$0C,$F0,$0C,$F3,$0C,$FC,$0C,$FF,$0C
- dc.b $00,$0F,$03,$0F,$0C,$0F,$0F,$0F,$30,$0F,$33,$0F,$3C,$0F,$3F,$0F
- dc.b $C0,$0F,$C3,$0F,$CC,$0F,$CF,$0F,$F0,$0F,$F3,$0F,$FC,$0F,$FF,$0F
- dc.b $00,$30,$03,$30,$0C,$30,$0F,$30,$30,$30,$33,$30,$3C,$30,$3F,$30
- dc.b $C0,$30,$C3,$30,$CC,$30,$CF,$30,$F0,$30,$F3,$30,$FC,$30,$FF,$30
- dc.b $00,$33,$03,$33,$0C,$33,$0F,$33,$30,$33,$33,$33,$3C,$33,$3F,$33
- dc.b $C0,$33,$C3,$33,$CC,$33,$CF,$33,$F0,$33,$F3,$33,$FC,$33,$FF,$33
- dc.b $00,$3C,$03,$3C,$0C,$3C,$0F,$3C,$30,$3C,$33,$3C,$3C,$3C,$3F,$3C
- dc.b $C0,$3C,$C3,$3C,$CC,$3C,$CF,$3C,$F0,$3C,$F3,$3C,$FC,$3C,$FF,$3C
- dc.b $00,$3F,$03,$3F,$0C,$3F,$0F,$3F,$30,$3F,$33,$3F,$3C,$3F,$3F,$3F
- dc.b $C0,$3F,$C3,$3F,$CC,$3F,$CF,$3F,$F0,$3F,$F3,$3F,$FC,$3F,$FF,$3F
- dc.b $00,$C0,$03,$C0,$0C,$C0,$0F,$C0,$30,$C0,$33,$C0,$3C,$C0,$3F,$C0
- dc.b $C0,$C0,$C3,$C0,$CC,$C0,$CF,$C0,$F0,$C0,$F3,$C0,$FC,$C0,$FF,$C0
- dc.b $00,$C3,$03,$C3,$0C,$C3,$0F,$C3,$30,$C3,$33,$C3,$3C,$C3,$3F,$C3
- dc.b $C0,$C3,$C3,$C3,$CC,$C3,$CF,$C3,$F0,$C3,$F3,$C3,$FC,$C3,$FF,$C3
- dc.b $00,$CC,$03,$CC,$0C,$CC,$0F,$CC,$30,$CC,$33,$CC,$3C,$CC,$3F,$CC
- dc.b $C0,$CC,$C3,$CC,$CC,$CC,$CF,$CC,$F0,$CC,$F3,$CC,$FC,$CC,$FF,$CC
- dc.b $00,$CF,$03,$CF,$0C,$CF,$0F,$CF,$30,$CF,$33,$CF,$3C,$CF,$3F,$CF
- dc.b $C0,$CF,$C3,$CF,$CC,$CF,$CF,$CF,$F0,$CF,$F3,$CF,$FC,$CF,$FF,$CF
- dc.b $00,$F0,$03,$F0,$0C,$F0,$0F,$F0,$30,$F0,$33,$F0,$3C,$F0,$3F,$F0
- dc.b $C0,$F0,$C3,$F0,$CC,$F0,$CF,$F0,$F0,$F0,$F3,$F0,$FC,$F0,$FF,$F0
- dc.b $00,$F3,$03,$F3,$0C,$F3,$0F,$F3,$30,$F3,$33,$F3,$3C,$F3,$3F,$F3
- dc.b $C0,$F3,$C3,$F3,$CC,$F3,$CF,$F3,$F0,$F3,$F3,$F3,$FC,$F3,$FF,$F3
- dc.b $00,$FC,$03,$FC,$0C,$FC,$0F,$FC,$30,$FC,$33,$FC,$3C,$FC,$3F,$FC
- dc.b $C0,$FC,$C3,$FC,$CC,$FC,$CF,$FC,$F0,$FC,$F3,$FC,$FC,$FC,$FF,$FC
- dc.b $00,$FF,$03,$FF,$0C,$FF,$0F,$FF,$30,$FF,$33,$FF,$3C,$FF,$3F,$FF
- dc.b $C0,$FF,$C3,$FF,$CC,$FF,$CF,$FF,$F0,$FF,$F3,$FF,$FC,$FF,$FF,$FF
- EVEN
- m0cols:
- dc.w $0000,$3000,$C000,$F000,$0030,$3030,$C030,$F030
- dc.w $00C0,$30C0,$C0C0,$F0C0,$00F0,$30F0,$C0F0,$F0F0
- dc.w $0300,$3300,$C300,$F300,$0330,$3330,$C330,$F330
- dc.w $03C0,$33C0,$C3C0,$F3C0,$03F0,$33F0,$C3F0,$F3F0
- dc.w $0C00,$3C00,$CC00,$FC00,$0C30,$3C30,$CC30,$FC30
- dc.w $0CC0,$3CC0,$CCC0,$FCC0,$0CF0,$3CF0,$CCF0,$FCF0
- dc.w $0F00,$3F00,$CF00,$FF00,$0F30,$3F30,$CF30,$FF30
- dc.w $0FC0,$3FC0,$CFC0,$FFC0,$0FF0,$3FF0,$CFF0,$FFF0
- dc.w $0003,$3003,$C003,$F003,$0033,$3033,$C033,$F033
- dc.w $00C3,$30C3,$C0C3,$F0C3,$00F3,$30F3,$C0F3,$F0F3
- dc.w $0303,$3303,$C303,$F303,$0333,$3333,$C333,$F333
- dc.w $03C3,$33C3,$C3C3,$F3C3,$03F3,$33F3,$C3F3,$F3F3
- dc.w $0C03,$3C03,$CC03,$FC03,$0C33,$3C33,$CC33,$FC33
- dc.w $0CC3,$3CC3,$CCC3,$FCC3,$0CF3,$3CF3,$CCF3,$FCF3
- dc.w $0F03,$3F03,$CF03,$FF03,$0F33,$3F33,$CF33,$FF33
- dc.w $0FC3,$3FC3,$CFC3,$FFC3,$0FF3,$3FF3,$CFF3,$FFF3
- dc.w $000C,$300C,$C00C,$F00C,$003C,$303C,$C03C,$F03C
- dc.w $00CC,$30CC,$C0CC,$F0CC,$00FC,$30FC,$C0FC,$F0FC
- dc.w $030C,$330C,$C30C,$F30C,$033C,$333C,$C33C,$F33C
- dc.w $03CC,$33CC,$C3CC,$F3CC,$03FC,$33FC,$C3FC,$F3FC
- dc.w $0C0C,$3C0C,$CC0C,$FC0C,$0C3C,$3C3C,$CC3C,$FC3C
- dc.w $0CCC,$3CCC,$CCCC,$FCCC,$0CFC,$3CFC,$CCFC,$FCFC
- dc.w $0F0C,$3F0C,$CF0C,$FF0C,$0F3C,$3F3C,$CF3C,$FF3C
- dc.w $0FCC,$3FCC,$CFCC,$FFCC,$0FFC,$3FFC,$CFFC,$FFFC
- dc.w $000F,$300F,$C00F,$F00F,$003F,$303F,$C03F,$F03F
- dc.w $00CF,$30CF,$C0CF,$F0CF,$00FF,$30FF,$C0FF,$F0FF
- dc.w $030F,$330F,$C30F,$F30F,$033F,$333F,$C33F,$F33F
- dc.w $03CF,$33CF,$C3CF,$F3CF,$03FF,$33FF,$C3FF,$F3FF
- dc.w $0C0F,$3C0F,$CC0F,$FC0F,$0C3F,$3C3F,$CC3F,$FC3F
- dc.w $0CCF,$3CCF,$CCCF,$FCCF,$0CFF,$3CFF,$CCFF,$FCFF
- dc.w $0F0F,$3F0F,$CF0F,$FF0F,$0F3F,$3F3F,$CF3F,$FF3F
- dc.w $0FCF,$3FCF,$CFCF,$FFCF,$0FFF,$3FFF,$CFFF,$FFFF
- EVEN
- memmap dc.l amsdos,rambase,rambase,rambase
- codemap dc.l amscode,0,0,0
-
- CMapSpecial:
- ColorTabA dc.l $00000000,$00000007,$0000000F,$00070000
- dc.l $00070007,$0007000f,$000f0000,$000f0007
- dc.l $000f000f,$00000700,$00000707,$0000070f
- dc.l $00070700,$00070707,$0007070f,$000f0700
- dc.l $000f0707,$000F070f,$00000f00,$00000f07
- dc.l $00000f0f,$00070f00,$00070f07,$00070F0F
- dc.l $000f0f00,$000F0F07,$000F0F0F,$00000000
- dc.l 0,0,0,0,0,0,0,0
-
- ColorTab dc.l $00070707,$000fffff,$00000F07,$000f0f07
- dc.l $00000007,$000f0007,$00000707,$000f0707 ;4
- dc.l $000fffff,$000fffff,$000f0f00,$000f0f0f
- dc.l $000f0000,$000f000f,$000f0700,$000f070f ;12
- dc.l $000fffff,$000fffff,$00000f00,$00000f0f
- dc.l $00000000,$0000000f,$00000700,$0000070f ;20
- dc.l $00070007,$00070F07,$00070f00,$00070f0f
- dc.l $00070000,$0007000f,$00070700,$0007070f
-
- KeyMatrix:
- dc.b $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
- dc.b $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
- EVEN
- KeyCodeTab: ; F0 = not on cpc keyboard
- ; ` 1 2 3 4 5 6 7 8 9 0 ß \
- dc.b $F0,$80,$81,$71,$70,$61,$60,$51,$50,$41,$40,$36,$30,$26,$F0,$F0
- ; Q W E R T Z U I O P Ü + JDN
- dc.b $83,$73,$72,$62,$63,$87,$52,$43,$42,$33,$32,$21,$f0,$f0,$91,$f0
- ; A S D F G H J K L Ö Ä ^ JLF JRT
- dc.b $85,$74,$75,$65,$64,$54,$55,$45,$44,$35,$34,$23,$f0,$92,$94,$93
- ; < Y X C V B N M , . - JUP
- dc.b $F0,$53,$77,$76,$67,$66,$56,$46,$47,$37,$31,$f0,$f0,$f0,$90,$f0
- ; SPC BS TAB ENT RET ESC DEL xxx xxx xxx xxx xxx UP DN RT LF
- dc.b $57,$97,$84,$06,$22,$82,$20,$F0,$F0,$F0,$F0,$F0,$00,$02,$01,$10
- ; F1 F2 ... HELP
- dc.b $15,$16,$05,$24,$14,$04,$12,$13,$03,$17,$F0,$F0,$F0,$F0,$F0,$11
- ; LSH RSH CAP CTL LAL RAL LAM RAM
- dc.b $25,$25,$86,$27,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0
-
- EVEN
- FCMD MACRO
- dc.b \1,\2,\3,0
- dc.l \4
- ENDM
-
- dccommands FCMD 8,0,2,DCGetTrack
- FCMD 7,1,0,DCSeek0
- FCMD 3,2,0,DCNop
- FCMD 15,2,0,DCSeek
- FCMD $4A,1,7,DCGetID
- FCMD $46,8,7,DCReadSec
- FCMD $66,8,7,DCReadSec
- dc.l 0
-
- SECTION bss,BSS
-
- dosbase ds.l 1 ; some system vars
- gfxbase ds.l 1
- intbase ds.l 1
- cpcscr ds.l 1
- cpcwin ds.l 1
- cpcvp ds.l 1
- cpcrp ds.l 1
- cpcup ds.l 1
- cpcplns ds.l 1
- fhandle ds.l 1
- dbhandle ds.l 1
- Class ds.l 1
- Code ds.w 1
- Qual ds.w 1
- SPSave ds.l 1
-
- regop1 ds.b 1
- regop2 ds.b 1
- regop3 ds.b 1
- regopd ds.b 1
-
- SECTION ram,BSS
- ds.b 32768 ; cpc's memory in two halves 8000-FFFF;0000-7FFF
- rambase ds.b 32768 ; 16-bit addressable.
- SECTION amsdos,BSS
- amsdos ds.b 16384
- SECTION basic,BSS
- basic ds.b 16384
- SECTION from,BSS
- rom7 ds.b 16384
-
- SECTION amscode,BSS
- amscode ds.l 16384
- SECTION bascode,BSS
- bascode ds.l 16384
- SECTION r7code,BSS
- ro7code ds.l 16384
-
- stack ds.w 1 ; the remaining Z80 registers not emulated in
- ; 68000 registers
- ix
- xh dc.b 0
- xl dc.b 0
-
- iy
- yh dc.b 0
- yl dc.b 0
- ; CPC-Ports
-
- CRTCregnum ds.w 1 ; BCxx
- CRTCregs ds.w 9 ; BDxx/BFxx 18 regs of video controller
- rgsgarr ds.w 1 ; 7Fxx 4 regs of gate array
- sysstat ds.w 1 ; 7Fxx this and the last line MUST be adjacent
- romnum ds.w 1 ; this is the DFxx port
- videomode ds.w 1
- crtcscrwidth ds.w 1
-
- port8255a ds.b 1 ; F4
- port8255b ds.b 1 ; F5
- port8255c ds.b 1 ; F6
- control8255 ds.b 1 ; F7
-
- psgregnum ds.w 1
- psgregs ds.w 16
-
- dcFBxx ds.w 128
- dcFAxx ds.w 128
- dcdataempty ds.w 1
- dccommand ds.l 1
- dcstat ds.w 1
- dcbytecnt ds.w 1
- dccmdparms ds.w 10
- dcdata ds.w 20
- dcextdata ds.w 1
- dcedp ds.l 1
- dcdpt ds.l 1
- dccppt ds.l 1
- dcflagntr ds.w 1
-
- intcount ds.w 1
- intena ds.w 1
- intreq ds.w 1
- ffly ds.w 1
- ffcount ds.w 1
-
- fileopen ds.w 1
- idfield ds.w 33
- trackoffs ds.l 1
- IDTPtr ds.l 1
- CurrTrack ds.w 1
- DiskBuf ds.w 2400
-
- ReDrawCount ds.w 1
-
- CMap ds.w 32
-
- dbregsave ds.l 8
- dbadrsave ds.l 8
- dbinsbytes ds.l 2
- inpline ds.l 128
- dbmonistr ds.l 20 ; 80 bytes
- dbflag ds.w 1
- dbwaitad ds.w 1
- dbmonad ds.w 1
-
- intspeed dc.w 400
-
- ColMode ds.w 1
- crux ds.b $20000
- SECTION ScreenOffsets,BSS
- Scroff ds.w $4000
- END
-