1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-10 06:30:41 +00:00

Add funtion parameter/return values

This commit is contained in:
David Schmenk 2017-08-03 19:55:46 -07:00
parent d3c785e1eb
commit 77c2b768da
2 changed files with 52 additions and 37 deletions

View File

@ -63,7 +63,7 @@ end
//
// Plot pixel
//
export asm dgrPlot(buff, x, y)
export asm dgrPlot(buff, x, y)#0
; GET BUFFER ADDRESS
STX ESP
LDA ESTKL+2,X
@ -90,12 +90,13 @@ asm _dgrPlotPix
LDX ESP
INX
INX
INX
RTS
end
//
// Plot horizontal row of pixels
//
export asm dgrHLin(buff, x1, x2, y)
export asm dgrHLin(buff, x1, x2, y)#0
; GET BUFFER ADDRESS
STX ESP
LDA ESTKL+3,X
@ -130,12 +131,13 @@ asm _dgrHLinPix
INX
INX
INX
INX
RTS
end
//
// Plot horizontal row of pixels
//
export asm dgrVLin(buff, x, y1, y2)
export asm dgrVLin(buff, x, y1, y2)#0
; GET BUFFER ADDRESS
STX ESP
LDA ESTKL+3,X
@ -168,13 +170,14 @@ asm _dgrVLinPix
BEQ -
INX
INX
INX
INX
RTS
end
//
// Draw sprite
//
export asm dgrBLT(buff, x, y, width, height, src)
export asm dgrBLT(buff, x, y, width, height, src)#0
LDA ESTKL,X ; SPRITE
STA SRCL
LDA ESTKH,X
@ -254,6 +257,7 @@ asm _dgrBLTPix
INX
INX
INX
INX
RTS
end
//
@ -327,7 +331,7 @@ end
//
// Draw 8x8 tile (forced to 2x2 block address)
//
export asm dgrTile(buff, x, y, src)
export asm dgrTile(buff, x, y, src)#0
STX ESP
LDA ESTKL,X ; TILE
STA SRCL
@ -408,14 +412,15 @@ export asm dgrTile(buff, x, y, src)
++++ INX
INX
INX
INX
RTS
end
//
// Draw a string of tiles
//
export asm dgrTileStr(buff, x, y, tilestr, strlen, tilebuff)
DEX
export asm dgrTileStr(buff, x, y, tilestr, strlen, tilebuff)#0
- DEX
DEX
DEX
DEX
LDA ESTKL+9,X ; BUFF
@ -433,13 +438,13 @@ export asm dgrTileStr(buff, x, y, tilestr, strlen, tilebuff)
end
asm _dgrTileTile
JSR $5000
LDA ESTKL+5,X ; UPDATE X COORD
LDA ESTKL+4,X ; UPDATE X COORD
CLC
ADC #$08
CMP #80 ; OFF RIGHT SIDE
BPL +
STA ESTKL+5,X
DEC ESTKL+2,X ; DEC STRLEN
STA ESTKL+4,X
DEC ESTKL+1,X ; DEC STRLEN
BNE -
+ INX
INX
@ -452,7 +457,7 @@ end
//
// Draw a string of tiles
//
export asm dgrFill(buff, x, y, tile)
export asm dgrFill(buff, x, y, tile)#0
LDA ESTKL+2,X
AND #$0F
STA ESTKL+2,X
@ -468,8 +473,8 @@ export asm dgrFill(buff, x, y, tile)
SEC
SBC ESTKL+1,X
STA ESTKL+1,X
DEX
- DEX
DEX
DEX
DEX
LDA ESTKL+7,X ; BUFF
@ -487,18 +492,18 @@ export asm dgrFill(buff, x, y, tile)
end
asm _dgrFillTile
JSR $5000
LDA ESTKL+3,X ; UPDATE X COORD
CLC
ADC #$08
STA ESTKL+3,X
CMP #80 ; OFF RIGHT SIDE?
BMI -
LDA ESTKH+3,X ; RESTORE X COORD
STA ESTKL+3,X
LDA ESTKL+2,X ; UPDATE Y COORD
LDA ESTKL+2,X ; UPDATE X COORD
CLC
ADC #$08
STA ESTKL+2,X
CMP #80 ; OFF RIGHT SIDE?
BMI -
LDA ESTKH+2,X ; RESTORE X COORD
STA ESTKL+2,X
LDA ESTKL+1,X ; UPDATE Y COORD
CLC
ADC #$08
STA ESTKL+1,X
CMP #48 ; OFF BOTTOM?
BMI -
INX
@ -510,8 +515,7 @@ end
//
// Wait for VLB
//
asm vlbWait
DEX
asm vlbWait#0
- LDA $C019
BMI -
- LDA $C019
@ -521,7 +525,7 @@ end
//
// Set double lores graphics, return draw buffer
//
export def dgrMode
export def dgrMode#1
^showlores
^showfull
^showgraphics
@ -530,24 +534,24 @@ export def dgrMode
^show80 = 0
// ^mapaux = 0
^an3on
return 1
return 1
end
//
// Set text mode
//
export def txtMode
export def txtMode#0
^showtext
^showpage1
^ena80 = 0
^show40 = 0
^mapmain = 0
^an3on
return call($FC58, 0, 0, 0, 0) // home()
call($FC58, 0, 0, 0, 0) // home()
end
//
// Set display page, return other page
//
export def dgrShow(page)
export def dgrShow(page)#1
page = page & 1
^(showpage1 + page)
return page ^ 1
@ -555,13 +559,13 @@ end
//
// Set color for cear & plot routines
//
export def dgrColor(clr)
export def dgrColor(clr)#0
^$30 = clr & $0F
end
//
// Draw line
//
export def dgrLine(buff, x1, y1, x2, y2)
export def dgrLine(buff, x1, y1, x2, y2)#0
byte dx, dy, dx2, dy2, pp
word sx, sy, err, dd2
@ -646,12 +650,12 @@ end
//
// Clear the buffer
//
export def dgrClear(buff, clr)
export def dgrClear(buff, clr)#0
byte[32] clrtile
clr = evnclr[clr&$0F] | (oddclr[clr&$0F] << 8)
memset(@clrtile, clr, 32)
return dgrFill(buff, 0, 0, @clrtile)
dgrFill(buff, 0, 0, @clrtile)
end
//
// Make sure we are a 128K //e or //c

View File

@ -1,7 +1,18 @@
import dgr
word[] dgrbuff
predef drgPlot, dgrHLin, dgrVLin, dgrBLT, dgrTile, dgrTileStr, dgrFill
predef dgrMode, txtMode, dgrShow, dgrColor, dgrLine, dgrClear
predef dgrPlot(buff, x, y)#0
predef dgrHLin(buff, x1, x2, y)#0
predef dgrVLin(buff, x, y1, y2)#0
predef dgrBLT(buff, x, y, width, height, src)#0
predef dgrTile(buff, x, y, src)#0
predef dgrTileStr(buff, x, y, tilestr, strlen, tilebuff)#0
predef dgrFill(buff, x, y, tile)#0
predef dgrMode#1
predef txtMode#0
predef dgrShow(page)#1
predef dgrColor(clr)#0
predef dgrLine(buff, x1, y1, x2, y2)#0
predef dgrClear(buff, clr)#0
end
byte[] sprite1 = $80,$80,$00,$00,$00,$00,$80,$80
@ -21,10 +32,10 @@ byte[] = $0A,$05,$0A,$05,$0A,$05,$0A,$00
//
// Test routine
//
def dgrTest
def dgrTest#0
byte b, l, k
word i, j, ii, ij
b = dgrMode()
for k = 15 downto 0
dgrClear(dgrbuff[0], k)
@ -61,4 +72,4 @@ def dgrTest
end
dgrTest
done
done