more work towards Mega65 screen support

This commit is contained in:
FeralChild64 committed 2020-08-08 20:39:55 +02:00
1 parent 83cdf37c0d
commit 52e2060026
11 files changed
+221 -24

No files matched your search

+3 -1
View File
@@ -26,8 +26,10 @@
## other
* Gábor Lénárt - for his work on [XEMU Mega65 emulator](https://github.com/lgblgblgb/xemu)
* Gábor Lénárt - for [his work](https://github.com/lgblgblgb/xemu) on XEMU Mega65 emulator
* Hernán Di Pietro - for [his work](https://github.com/hernandp/xemu) on XEMU Mega65 emulator
* Mads Nielsen - for the [Kick Assembler](http://www.theweb.dk/KickAssembler/Main.html#frontpage)
* Simon Jameson - for his Kick Assembler [pseudocommands](https://github.com/smnjameson/M65_KickAsm_PseudoCommands) for Mega65 CPU support
<br />
+79
View File
@@ -268,6 +268,85 @@
}
// Others, taken from https://github.com/smnjameson/M65_KickAsm_PseudoCommands
.const z = -999 // allows (base page),z addressing mode
.const sy = -998 // allows (base page, s),y addressing mode
.const AT_IZEROPAGEZ = 13 // adds a pseudo addressing mode
.const AT_INDIRECTX = -5 // adds a pseudo addressing mode
.function GetAdressingModeType(arg) {
.if(arg == AT_NONE) .return "AT_NONE"
.if(arg == AT_IMMEDIATE) .return "AT_IMMEDIATE"
.if(arg == AT_INDIRECT) .return "AT_INDIRECT"
.if(arg == AT_INDIRECTX) .return "AT_INDIRECTX"
.if(arg == AT_ABSOLUTE) .return "AT_ABSOLUTE"
.if(arg == AT_ABSOLUTEX) .return "AT_ABSOLUTEX"
.if(arg == AT_ABSOLUTEY) .return "AT_ABSOLUTEY"
.if(arg == AT_IZEROPAGEX) .return "AT_IZEROPAGEX"
.if(arg == AT_IZEROPAGEY) .return "AT_IZEROPAGEY"
.if(arg == AT_IZEROPAGEZ) .return "AT_IZEROPAGEZ"
.return arg
}
.pseudocommand cpz arg {
.var value = arg.getValue()
.var type = arg.getType()
.if(type == AT_IMMEDIATE) {
.byte $C2, value
} else .if(type == AT_ABSOLUTE) {
.if(value <= $FF ) {
.byte $D4, value
} else {
.byte $DC, <value, >value
}
} else {
.error "Invalid adressingmode. 'cpz' doesn't support "+GetAdressingModeType(type)+" mode"
}
}
.pseudocommand lda arg {
.var value = arg.getValue()
.var type = arg.getType()
.if(type != AT_IZEROPAGEZ) .error "':lda' only accepts AT_IZEROPAGEZ"
.if(value > $FF ) .error "':lda ($nn),z' requires zeropage address"
.byte $B2, value
}
.pseudocommand ldz arg
{
.var value = arg.getValue()
.var type = arg.getType()
.if(type == AT_IMMEDIATE) {
.byte $A3, value
} else .if(type == AT_ABSOLUTE) {
.byte $AB, <value, >value
} else .if(type == AT_ABSOLUTEX) {
.byte $BB, <value, >value
} else {
.error "Invalid adressingmode. 'ldz' doesn't support "+GetAdressingModeType(type)+" mode"
}
}
.pseudocommand sta arg {
.var value = arg.getValue()
.var type = arg.getType()
.if(type != AT_IZEROPAGEZ) .error "':sta' only accepts AT_IZEROPAGEZ"
.if(value > $FF ) .error "':sta ($nn),z' requires zeropage address"
.byte $92, value
}
// Flat memory access support
.pseudocommand sta_lp arg {
.var value = arg.getValue()
.var type = arg.getType()
.if(type != AT_IZEROPAGEZ) .error "'sta_lp' only accepts AT_IZEROPAGEZ"
.if(value > $FF ) .error "'sta_lp' requires zeropage address"
nop
.byte $92, value
}
#endif
+10 -6
View File
@@ -10,7 +10,7 @@
// Page 0 - reused LDTB1
//
// $D9 -- UNUSED --
.label M65_TMP__K1 = $D9 // $D9 -- UNUSED -- temporary value for various Kernal routines
.label M65_LPNT_BAS1 = $DA // $DA-$DD 4-byte pointer for temporary usage within BASIC
.label M65_LPNT_BAS2 = $DE // $DE-$E1 4-byte pointer for temporary usage within BASIC
.label M65_LPNT_SCR = $E2 // $E2-$E5 4-byte pointer for temporary usage within BASIC and screen editor
@@ -18,7 +18,7 @@
.label M65_MAGICSTR = $E7 // $E7-$E9 if equals 'M65' it means we are in native mode
.label M65_LPNT_IRQ = $EA // $EA-$ED 4-byte pointer for temporary usage within interrupts
.label M65_LPNT_KERN = $EE // $EE-$F1 4-byte pointer for temporary usage by KERNAL
// $F2 -- UNUSED --
.label M65_TMP__K2 = $F2 // $F2 -- UNUSED -- temporary value for various Kernal routines
//
// Pages 4-7 - reused screen memory
@@ -30,9 +30,13 @@
// $580-$5FF - reserved for KERNAL
.label M65_SCRMODE = $580 // 0 = 40x25, 1 = 80x25, 2 = 80x50, (-- NOT IMPLEMENTED -- add $80 for graphics modes)
.label M65_SCRTXTBASE = $581 // $581-$584 base address of the screen memory for text modes
.label M65_SCRGFXBASE = $585 // $585-$588 -- NOT IMPLEMENTED -- base address of the screen memory for graphics modes
// $589-$5FF -- UNUSED --
.label M65_SCRTXTBASE = $580 // $580-$583 base address of the screen memory for text modes
.label M65_SCRGFXBASE = $584 // $584-$587 -- NOT IMPLEMENTED -- base address of the screen memory for graphics modes
.label M65_SCRMODE = $588 // 0 = 40x25, 1 = 80x25, 2 = 80x50, (-- NOT IMPLEMENTED -- add $80 for graphics modes)
.label M65_TXTWIN_X0 = $589 // text window - top-left X coordinate, starting from 0
.label M65_TXTWIN_Y0 = $58A // text window - top-left Y coordinate, starting from 0
.label M65_TXTWIN_X1 = $58B // text window - bottom-right X coordinate + 1
.label M65_TXTWIN_Y1 = $58C // text window - bottom-right Y coordinate + 1
// $58D-$5FF -- UNUSED --
.label M65_RS232_INBUF = $600 // $600-$6FF -- reserved for RS-232 input buffer --
.label M65_RS232_OUTBUF = $700 // $700-$7FF -- reserved for RS-232 output buffer --
+2
View File
@@ -7,6 +7,8 @@
cmd_rem:
// XXX do we need these PHA's?
pha
pha
jmp execute_statements_end_of_line
@@ -23,6 +23,8 @@
.label VK1__M65_MODE65 = $4000 + 2 * 9
.label VK1__M65_SCRMODEGET = $4000 + 2 * 10
.label VK1__M65_SCRMODESET = $4000 + 2 * 11
.label VK1__M65_CLRSCR = $4000 + 2 * 12
.label VK1__M65_CLRWIN = $4000 + 2 * 13
#else
@@ -61,6 +63,8 @@
.word M65_MODE64
.word M65_MODE65
.word M65_SCRMODEGET
.word M65_SCRMODESET
.word M65_SCRMODESET
.word M65_CLRSCR
.word M65_CLRWIN
#endif
+20 -3
View File
@@ -9,22 +9,39 @@ M65_MODE64:
jsr map_KERNAL_1
jsr_ind VK1__M65_MODE64
jmp map_NORMAL
bra m65_api_end
M65_MODE65:
jsr map_KERNAL_1
jsr_ind VK1__M65_MODE65
jmp map_NORMAL
bra m65_api_end
M65_SCRMODEGET:
jsr map_KERNAL_1
jsr_ind VK1__M65_SCRMODEGET
jmp map_NORMAL
bra m65_api_end
M65_SCRMODESET:
jsr map_KERNAL_1
jsr_ind VK1__M65_SCRMODESET
bra m65_api_end
M65_CLRSCR:
jsr map_KERNAL_1
jsr_ind VK1__M65_CLRSCR
bra m65_api_end
M65_CLRWIN:
jsr map_KERNAL_1
jsr_ind VK1__M65_CLRWIN
// FALLTROUGH
m65_api_end:
jmp map_NORMAL
@@ -12,4 +12,3 @@ m65_chrout_screen:
jsr_ind VK1__m65_chrout_screen
jsr map_NORMAL
jmp chrout_done_success
@@ -25,3 +25,9 @@ M65_JFAST:
M65_JSELDEV:
jsr SELDEV
M65_JCLRSCR:
jsr M65_CLRSCR
M65_JCLRWIN:
jsr M65_CLRWIN
-9
View File
@@ -1,9 +0,0 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
M65_CLRSCR:
// XXX impplement this
rts
@@ -0,0 +1,83 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
M65_CLRSCR:
// Set the text window to whole screen area
lda #$00
sta M65_TXTWIN_X0
sta M65_TXTWIN_Y0
ldx M65_SCRMODE
lda m65_scrtab_txtwidth, X
sta M65_TXTWIN_X1
lda m65_scrtab_txtheight, X
sta M65_TXTWIN_Y1
// FALLTROUGH
M65_CLRWIN:
// To clear the window, two zeropage long pointers will be used:
// - M65_LPNT_SCR for screen memory
// - M65_LPNT_KERN for colour memory (starts from $FF80000)
// First initialize both pointers
ldx #$03
!:
lda M65_SCRTXTBASE,x
sta M65_LPNT_SCR,x
lda #$00
sta M65_LPNT_KERN,x
dex
bpl !-
lda #$0F
sta M65_LPNT_KERN+2
lda #$F8
sta M65_LPNT_KERN+1
// Go trough all the rows
phz
ldy #$00
// FALLTROUGH
m65_clrwin_loop:
// Check if .Y cordinate is not below the window
cpy M65_TXTWIN_Y0
bcc m65_clrwin_loop_next // branch if we should skip this row
// Clear the row
ldz M65_TXTWIN_X0
!:
lda #$20
sta_lp (M65_LPNT_SCR),z
lda #$00
sta_lp (M65_LPNT_KERN),z
inz
cpz M65_TXTWIN_X1
bne !-
// FALLTROUGH
m65_clrwin_loop_next:
iny
// XXX
plz
// XXX implement this
rts
+13 -3
View File
@@ -2,10 +2,20 @@
// #LAYOUT# * * #IGNORE
// Table of parameters for VIC control register B
m65_scrtab_vic_ctrlb:
m65_scrtab_vic_ctrlb: // parameters for VIC control register B
.byte %00100000 // 40x25 + extended attributes
.byte %10100000 // 80x25 + extended attributes
.byte %10100100 // 80x50 + extended attributes
m65_scrtab_txtwidth: // width of the text screen
.byte 40
.byte 80
.byte 80
m65_scrtab_txtheight: // height of the text screen
.byte 25
.byte 25
.byte 50