68k ASM defines: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 4: Line 4:


<pre>
<pre>
     SCB1            equ $0000          ; VRAM, Sprite tilemaps
     SCB1            equ $0000          ;VRAM, Sprite tilemaps
     FIXMAP          equ $7000          ; VRAM, Fix map
     FIXMAP          equ $7000          ;VRAM, Fix map
     SCB2            equ $8000          ; VRAM, Sprite shrink
     SCB2            equ $8000          ;VRAM, Sprite shrink
     SCB3            equ $8200          ; VRAM, Sprite Y positions and sizes
     SCB3            equ $8200          ;VRAM, Sprite Y positions and sizes
     SCB4            equ $8400          ; VRAM, Sprite X positions
     SCB4            equ $8400          ;VRAM, Sprite X positions
      
      
     BLACK          equ $8000
     BLACK          equ $8000
Line 27: Line 27:
     WHITE          equ $7FFF
     WHITE          equ $7FFF


     RAMSTART        equ $100000        ; User RAM start
     RAMSTART        equ $100000        ;User RAM start
     PALETTES        equ $400000        ; Palette RAM start
     PALETTES        equ $400000        ;Palette RAM start


     REG_P1CNT      equ $300000        ; Joystick port 1
     REG_P1CNT      equ $300000        ;Joystick port 1
     REG_DIPSW      equ $300001        ; Dipswitches/Watchdog
     REG_DIPSW      equ $300001        ;Dipswitches/Watchdog
     REG_SOUND      equ $320000        ; In/Out Z80
     REG_SOUND      equ $320000        ;In/Out Z80
     REG_STATUS_A    equ $320001
     REG_STATUS_A    equ $320001
     REG_P2CNT      equ $340000        ; Joystick port 2
     REG_P2CNT      equ $340000        ;Joystick port 2
     REG_STATUS_B    equ $380000
     REG_STATUS_B    equ $380000
     REG_POUTPUT    equ $380001        ; Joypad port outputs  
     REG_POUTPUT    equ $380001        ;Joypad port outputs  
     REG_SLOT        equ $380021        ; Slot selection
     REG_SLOT        equ $380021        ;Slot selection


     REG_DISPENABL  equ $3A0001        ; Video output ON
     REG_DISPENABL  equ $3A0001        ;Video output ON
     REG_DISPDSABL  equ $3A0011        ; Video output OFF
     REG_DISPDSABL  equ $3A0011        ;Video output OFF
     REG_SWPROM      equ $3A0013        ; Use ROM vector table
     REG_SWPROM      equ $3A0013        ;Use ROM vector table
     REG_CRDUNLOCK1  equ $3A0005        ; Allow /WE to pass through to memory card when low
     REG_CRDUNLOCK1  equ $3A0005        ;Allow /WE to pass through to memory card when low
     REG_CRDLOCK1    equ $3A0015        ; Don't allow /WE to pass through to memory card
     REG_CRDLOCK1    equ $3A0015        ;Don't allow /WE to pass through to memory card
     REG_CRDLOCK2    equ $3A0007        ; Don't allow /WE to pass through to memory card
     REG_CRDLOCK2    equ $3A0007        ;Don't allow /WE to pass through to memory card
     REG_CRDUNLOCK2  equ $3A0017        ; Allow /WE to pass through to memory card when high
     REG_CRDUNLOCK2  equ $3A0017        ;Allow /WE to pass through to memory card when high
     REG_BRDFIX      equ $3A000B        ; Use board fix tileset
     REG_BRDFIX      equ $3A000B        ;Use board fix tileset
     REG_CRTFIX      equ $3A001B        ; Use ROM fix tileset
     REG_CRTFIX      equ $3A001B        ;Use ROM fix tileset
     REG_SRAMLOCK    equ $3A000D        ; Write-protect SRAM
     REG_SRAMLOCK    equ $3A000D        ;Write-protect SRAM
     REG_SRAMUNLOCK  equ $3A001D        ; Write-unprotect SRAM
     REG_SRAMUNLOCK  equ $3A001D        ;Write-unprotect SRAM
     REG_PALBANK1    equ $3A000F        ; Use palette bank 1
     REG_PALBANK1    equ $3A000F        ;Use palette bank 1
     REG_PALBANK0    equ $3A001F        ; Use palette bank 0 (default)
     REG_PALBANK0    equ $3A001F        ;Use palette bank 0 (default)


     VRAM_ADDR      equ $3C0000
     VRAM_ADDR      equ $3C0000
Line 61: Line 61:


     ; BIOS calls
     ; BIOS calls
     BIOSF_BOOTSCR  equ $C00438        ; Show bootscreen (and other things)
     BIOSF_BOOTSCR  equ $C00438        ;Show boot screen (and other things)
     BIOSF_VBL      equ $C0044A        ; Multiple purposes
     BIOSF_VBL      equ $C0044A        ;Multiple purposes
     BIOSF_GETTIME  equ $C0045C        ; Set calendar addresses (10FDD2+), MVS only
     BIOSF_GETTIME  equ $C0045C        ;Set calendar addresses (10FDD2+), MVS only
     BIOSF_CRDACCESS equ $C00468 ; Access memory card with specified function (check CRDF)
     BIOSF_CRDACCESS equ $C00468 ;Access memory card with specified function (check CRDF)
     BIOSF_CRDREPORT equ $C0046E ; In case an error occurred ("CARD FULL" etc.), prompt user for action
     BIOSF_CRDREPORT equ $C0046E ;In case an error occurred ("CARD FULL" etc.), prompt user for action
     BIOSF_HOWTOPLAY equ $C00474        ; Show how-to-play presentation, MVS only
     BIOSF_HOWTOPLAY equ $C00474        ;Show how-to-play presentation, MVS only
     BIOSF_CLEARFIX  equ $C004C2        ; Clear fix layer
     BIOSF_CLEARFIX  equ $C004C2        ;Clear fix layer
     BIOSF_CLEARSPR  equ $C004C8        ; Clear sprites
     BIOSF_CLEARSPR  equ $C004C8        ;Clear sprites
     BIOSF_UPLOAD    equ $C00546        ; Upload data to DRAM   
     BIOSF_UPLOAD    equ $C00546        ;Upload data to DRAM   
     BIOSF_CDDACMD  equ $C0056A        ; Issue CDDA command
     BIOSF_CDDACMD  equ $C0056A        ;Issue CDDA command


     REG_CDDALEFTL   equ $FF0188         ; CD audio levels
     ;DMA related:
     REG_CDDARIGHTL equ $FF018A
    REG_DMACPYSRC   equ $FF0064         ;longword: Copy source address ?
     REG_DMAFILDEST equ $FF0064        ;longword: Fill destination address ?
    REG_DMACPYDEST  equ $FF0068        ;longword: Copy destination address ?
    REG_DMAFILVAL  equ $FF006C        ;word: Fill value (word) ?
    REG_DMASIZE    equ $FF0070        ;longword?: Size (in 16 bit words)
    REG_DMASTART    equ $FF0060        ;byte: Start transfer ($40 ?)


     ;DMA related:
     REG_UPMAPSPR    equ $FF0121        ;bytes (0 or 1)
     REG_DMACPYSRC  equ $FF0064        ;32bit: Copy source address ?
     REG_UPMAPPCM    equ $FF0123
     REG_DMAFILDEST  equ $FF0064        ;32bit: Fill destination address ?
    REG_UPMAPZ80    equ $FF0127
     REG_DMACPYDEST equ $FF0068        ;32bit: Copy destination address ?
     REG_UPMAPFIX    equ $FF0129
     REG_DMAFILVAL  equ $FF006C        ;16bit: Fill value (word) ?
     REG_UPUNMAPSPR equ $FF0141
     REG_DMASIZE    equ $FF0070        ;32bit?: Size (in 16 bit words)
     REG_UPUNMAPPCM  equ $FF0143
     REG_DMASTART    equ $FF0060        ;8bit: Start transfer ($40 ?)
     REG_UPUNMAPZ80  equ $FF0147
     REG_UPUNMAPFIX  equ $FF0149


     REG_UPSELSPR    equ $FF0121          
     REG_CDDALEFTL  equ $FF0188         ;CD audio levels
     REG_UPSELPCM    equ $FF0123
     REG_CDDARIGHTL equ $FF018A
    REG_UPSELZ80    equ $FF0127
    REG_UPSELFIX    equ $FF0129
    REG_UPUNMAPSPR  equ $FF0141
    REG_UPUNMAPPCM  equ $FF0143
    REG_UPUNMAPZ80  equ $FF0147
    REG_UPUNMAPFIX equ $FF0149


     BIOS_SYSSTAT    equ $10FD80        ; Word: ?
     BIOS_SYSSTAT    equ $10FD80        ;Word: ?


     ; Set by BIOSF_VBL
     ; Set by BIOSF_VBL
     BIOS_P1CURRENT  equ $10FD95        ; joystick 1 state
     BIOS_P1CURRENT  equ $10FD95        ;joystick 1 state
     BIOS_P1PREVIOUS equ $10FD96        ; previous joystick 1 state
     BIOS_P1PREVIOUS equ $10FD96        ;previous joystick 1 state
     BIOS_P1CHANGE  equ $10FD97        ; joystick 1 state change
     BIOS_P1CHANGE  equ $10FD97        ;joystick 1 state change
     BIOS_P1REPEAT  equ $10FD98        ; joystick 1 repeat
     BIOS_P1REPEAT  equ $10FD98        ;joystick 1 repeat
     BIOS_P2CURRENT  equ $10FD9B        ; joystick 2 state
     BIOS_P2CURRENT  equ $10FD9B        ;joystick 2 state
     BIOS_P2PREVIOUS equ $10FD9C        ; previous joystick 2 state
     BIOS_P2PREVIOUS equ $10FD9C        ;previous joystick 2 state
     BIOS_P2CHANGE  equ $10FD9D        ; joystick 2 state change
     BIOS_P2CHANGE  equ $10FD9D        ;joystick 2 state change
     BIOS_P2REPEAT  equ $10FD9E        ; joystick 2 repeat
     BIOS_P2REPEAT  equ $10FD9E        ;joystick 2 repeat
     BIOS_STATCURNT  equ $10FDAC        ; joystick 1/2 start/select
     BIOS_STATCURNT  equ $10FDAC        ;joystick 1/2 start/select
     BIOS_STATCHANGE equ $10FDAD        ; previous joystick 1/2 start/select
     BIOS_STATCHANGE equ $10FDAD        ;previous joystick 1/2 start/select


     ; Memory card related:
     ; Memory card related:
     BIOS_CRDF      equ $10FDC4 ;8bit: function to perform when calling BIOSF_CRDACCESS, see below table
     BIOS_CRDF      equ $10FDC4 ;byte: function to perform when calling BIOSF_CRDACCESS, see below table
     BIOS_CRDRESULT  equ $10FDC6 ;8bit: 00 on success, else 80+ and encodes the error, see below table
     BIOS_CRDRESULT  equ $10FDC6 ;byte: 00 on success, else 80+ and encodes the error, see below table
     BIOS_CRDPTR    equ $10FDC8        ;32bit: pointer to read from/write to
     BIOS_CRDPTR    equ $10FDC8        ;longword: pointer to read from/write to
     BIOS_CRDSIZE    equ $10FDCC        ;16bit: how much data to read/write from/to card
     BIOS_CRDSIZE    equ $10FDCC        ;word: how much data to read/write from/to card
     BIOS_CRDNGH    equ $10FDCE ;16bit: usually game NGH. Unique identifier for the game that 'owns' the save file
     BIOS_CRDNGH    equ $10FDCE ;word: usually game NGH. Unique identifier for the game that 'owns' the save file
     BIOS_CRDFILE    equ $10FDD0        ;16bit: each NGH has up to 16 save 'files' associated with
     BIOS_CRDFILE    equ $10FDD0        ;word: each NGH has up to 16 save 'files' associated with


     ; Calendar, only set by MVS (all data stored in BCD)
     ; Calendar, only set by MVS (all data stored in BCD)
Line 124: Line 124:


     ; Upload to DRAM
     ; Upload to DRAM
     BIOS_UPSRC      equ $10FEF8        ;32bit: source address
     BIOS_UPSRC      equ $10FEF8        ;longword: source address
     BIOS_UPDEST    equ $10FEF4        ;32bit: destination address (!)
     BIOS_UPDEST    equ $10FEF4        ;longword: destination address (!)
     BIOS_UPSIZE    equ $10FEFC        ;32bit: size
     BIOS_UPSIZE    equ $10FEFC        ;longword: size
     BIOS_UPZONE    equ $10FEDA        ;8bit: zone (0=PRG, 1=FIX, 2=SPR, 3=Z80, 4=PCM, 5=PAT)
     BIOS_UPZONE    equ $10FEDA        ;byte: zone (0=PRG, 1=FIX, 2=SPR, 3=Z80, 4=PCM, 5=PAT)
     BIOS_UPBANK    equ $10FEDB        ;8bit: bank
     BIOS_UPBANK    equ $10FEDB        ;byte: bank
</pre>
</pre>


[[Category:Code]]
[[Category:Code]]

Revision as of 17:33, 13 March 2011

Here are preliminary ASM defines for memory locations and constants. For detailed descriptions, see Memory mapped registers.

This can be made into a file and included in your ASM source code to use register names instead of their (meaningless) addresses in RAM.

    SCB1            equ $0000           ;VRAM, Sprite tilemaps
    FIXMAP          equ $7000           ;VRAM, Fix map
    SCB2            equ $8000           ;VRAM, Sprite shrink
    SCB3            equ $8200           ;VRAM, Sprite Y positions and sizes
    SCB4            equ $8400           ;VRAM, Sprite X positions
    
    BLACK           equ $8000
    MIDBLUE         equ $1007
    BLUE            equ $100F
    MIDGREEN        equ $2070
    GREEN           equ $20F0
    MIDCYAN         equ $3077
    CYAN            equ $30FF
    MIDRED          equ $4700
    RED             equ $4F00
    MIDMAGENTA      equ $5707
    MAGENTA         equ $5F0F
    ORANGE          equ $6F70
    MIDYELLOW       equ $6770
    YELLOW          equ $6FF0
    MIDGREY         equ $7777
    WHITE           equ $7FFF

    RAMSTART        equ $100000         ;User RAM start
    PALETTES        equ $400000         ;Palette RAM start

    REG_P1CNT       equ $300000         ;Joystick port 1
    REG_DIPSW       equ $300001         ;Dipswitches/Watchdog
    REG_SOUND       equ $320000         ;In/Out Z80
    REG_STATUS_A    equ $320001
    REG_P2CNT       equ $340000         ;Joystick port 2
    REG_STATUS_B    equ $380000
    REG_POUTPUT     equ $380001         ;Joypad port outputs 	 
    REG_SLOT        equ $380021         ;Slot selection

    REG_DISPENABL   equ $3A0001         ;Video output ON
    REG_DISPDSABL   equ $3A0011         ;Video output OFF
    REG_SWPROM      equ $3A0013         ;Use ROM vector table
    REG_CRDUNLOCK1  equ $3A0005         ;Allow /WE to pass through to memory card when low
    REG_CRDLOCK1    equ $3A0015         ;Don't allow /WE to pass through to memory card
    REG_CRDLOCK2    equ $3A0007         ;Don't allow /WE to pass through to memory card
    REG_CRDUNLOCK2  equ $3A0017         ;Allow /WE to pass through to memory card when high
    REG_BRDFIX      equ $3A000B         ;Use board fix tileset
    REG_CRTFIX      equ $3A001B         ;Use ROM fix tileset
    REG_SRAMLOCK    equ $3A000D         ;Write-protect SRAM
    REG_SRAMUNLOCK  equ $3A001D         ;Write-unprotect SRAM
    REG_PALBANK1    equ $3A000F         ;Use palette bank 1
    REG_PALBANK0    equ $3A001F         ;Use palette bank 0 (default)

    VRAM_ADDR       equ $3C0000
    VRAM_RW         equ $3C0002
    VRAM_MOD        equ $3C0004
    REG_HBLANKCNT   equ $3C0006
    REG_HBLANKPOS   equ $3C0008
    REG_IRQACK      equ $3C000C

    ; BIOS calls
    BIOSF_BOOTSCR   equ $C00438         ;Show boot screen (and other things)
    BIOSF_VBL       equ $C0044A         ;Multiple purposes
    BIOSF_GETTIME   equ $C0045C         ;Set calendar addresses (10FDD2+), MVS only
    BIOSF_CRDACCESS equ $C00468		;Access memory card with specified function (check CRDF)
    BIOSF_CRDREPORT equ $C0046E		;In case an error occurred ("CARD FULL" etc.), prompt user for action
    BIOSF_HOWTOPLAY equ $C00474         ;Show how-to-play presentation, MVS only
    BIOSF_CLEARFIX  equ $C004C2         ;Clear fix layer
    BIOSF_CLEARSPR  equ $C004C8         ;Clear sprites
    BIOSF_UPLOAD    equ $C00546         ;Upload data to DRAM   
    BIOSF_CDDACMD   equ $C0056A         ;Issue CDDA command

    ;DMA related:
    REG_DMACPYSRC   equ $FF0064         ;longword: Copy source address ?
    REG_DMAFILDEST  equ $FF0064         ;longword: Fill destination address ?
    REG_DMACPYDEST  equ $FF0068         ;longword: Copy destination address ?
    REG_DMAFILVAL   equ $FF006C         ;word: Fill value (word) ?
    REG_DMASIZE     equ $FF0070         ;longword?: Size (in 16 bit words)
    REG_DMASTART    equ $FF0060         ;byte: Start transfer ($40 ?)

    REG_UPMAPSPR    equ $FF0121         ;bytes (0 or 1)
    REG_UPMAPPCM    equ $FF0123
    REG_UPMAPZ80    equ $FF0127
    REG_UPMAPFIX    equ $FF0129
    REG_UPUNMAPSPR  equ $FF0141
    REG_UPUNMAPPCM  equ $FF0143
    REG_UPUNMAPZ80  equ $FF0147
    REG_UPUNMAPFIX  equ $FF0149

    REG_CDDALEFTL   equ $FF0188         ;CD audio levels
    REG_CDDARIGHTL  equ $FF018A

    BIOS_SYSSTAT    equ $10FD80         ;Word: ?

    ; Set by BIOSF_VBL
    BIOS_P1CURRENT  equ $10FD95         ;joystick 1 state
    BIOS_P1PREVIOUS equ $10FD96         ;previous joystick 1 state
    BIOS_P1CHANGE   equ $10FD97         ;joystick 1 state change
    BIOS_P1REPEAT   equ $10FD98         ;joystick 1 repeat
    BIOS_P2CURRENT  equ $10FD9B         ;joystick 2 state
    BIOS_P2PREVIOUS equ $10FD9C         ;previous joystick 2 state
    BIOS_P2CHANGE   equ $10FD9D         ;joystick 2 state change
    BIOS_P2REPEAT   equ $10FD9E         ;joystick 2 repeat
    BIOS_STATCURNT  equ $10FDAC         ;joystick 1/2 start/select
    BIOS_STATCHANGE equ $10FDAD         ;previous joystick 1/2 start/select

    ; Memory card related:
    BIOS_CRDF       equ $10FDC4		;byte: function to perform when calling BIOSF_CRDACCESS, see below table
    BIOS_CRDRESULT  equ $10FDC6		;byte: 00 on success, else 80+ and encodes the error, see below table
    BIOS_CRDPTR     equ $10FDC8         ;longword: pointer to read from/write to
    BIOS_CRDSIZE    equ $10FDCC         ;word: how much data to read/write from/to card
    BIOS_CRDNGH     equ $10FDCE		;word: usually game NGH. Unique identifier for the game that 'owns' the save file
    BIOS_CRDFILE    equ $10FDD0         ;word: each NGH has up to 16 save 'files' associated with

    ; Calendar, only set by MVS (all data stored in BCD)
    BIOS_YEAR       equ $10FDD2         ;last 2 digits of year
    BIOS_MONTH      equ $10FDD3
    BIOS_DAY        equ $10FDD4
    BIOS_WEEKDAY    equ $10FDD5         ;Sunday = 00, Monday = 01 ... Saturday = 06
    BIOS_HOUR       equ $10FDD6         ;24 hour time
    BIOS_MINUTE     equ $10FDD7
    BIOS_SECOND     equ $10FDD8

    ; Upload to DRAM
    BIOS_UPSRC      equ $10FEF8         ;longword: source address
    BIOS_UPDEST     equ $10FEF4         ;longword: destination address (!)
    BIOS_UPSIZE     equ $10FEFC         ;longword: size
    BIOS_UPZONE     equ $10FEDA         ;byte: zone (0=PRG, 1=FIX, 2=SPR, 3=Z80, 4=PCM, 5=PAT)
    BIOS_UPBANK     equ $10FEDB         ;byte: bank