Started by arnoldemu, 10:59, 04 April 10
0 Members and 1 Guest are viewing this topic.
Quote from: TFM/FS on 20:49, 01 March 11Well, it like the simple solution, usually it's the most efficient and therefore best. In my progs if works all fine. But we must separate two things here. a) to omit flickering b) to reduce flickering.And I can only warn to use too complex strategies, they usually make it too slow. As Kolumbus alrady sayd: To be genious means to keep it simple. And like my old dad sayd: Everybody can make it complex. I always keep this things in mind.Finally there will be one perfect strategy for every kind of resolution (x, y) and way of using split screens / overscan or just 16 K V-RAM. Edit: I implicate that sprites are erased directly before they are redrawn, anything else makes no sense. To use erase/draw scanline cycles again cost too much time IHMO.
;; Tag Plot in Assembly ORG &4000 ld a,1 call &bc0e ld b,64 ;; Number of times to loop ld de,data_xpos ;; Load Coordinate Position into DE ld hl,data_ypos ;; Load Coordinate Position into HL ld (adrxpos),de ld (adrypos),hl ;; Store address of data push hl ld hl,data_color ld (addrcolor),hl pop hl.loop ;; Begin of Loop push hl push af ld hl,(addrcolor) ld a,(hl) call do_color pop af pop hl ld de,(adrxpos) ;; Get contents of address of Data ;; into DE inc de inc de ;; Increase this by 2 data is 2 bytes in size ld (adrxpos),de ;; Put this new address into address of data ld hl,(adrypos) ;; Put address of ypos into hl inc hl inc hl ;; Increase this by 2 same as DE ld (adrypos),hl ;; Put this new address into address of data push bc call do_plot ;; Call this routine pop bc djnz loop ;; Go back if B is greater than 0 ret ;; Otherwise Exit .do_color call &bbde ld hl,(addrcolor) inc hl ld (addrcolor),hl ret .do_plot ld b,(hl) ;; Store Contents of Lower HL (YPOS Data) into B inc hl ;; Increase address of HL ld c,(hl) ;; Store Contents of Upper HL (YPOS Data) into C ld hl,ypos ;; Get Lower address of HL ld (hl),b ;; And put value of B into it inc hl ;; Increase this by 1 ld (hl),c ;; Now put value of C into it ;; What this has effecively done is move the contents ;; of ypos in particular, from one memory location to ;; another fixed location, for where the data can go ;; into the registers & then do a call to Plot Absolute ;; (&BBEA). I used to try doing this while moving the ;; address (e.g. Get contents of first xpos & ypos, ;; then move onto the second), course it maybe possible, ;; but I found this much easier. ex de,hl ;; Exchange Contents of DE & HL ld b,(hl) ;; Put Contents of HL (which was DE) into B inc hl ;; Increase HL by 1 ld c,(hl) ;; Put that into C ld hl,xpos ;; Get address of xpos ld (hl),b inc hl ld (hl),c ;; Put contents into it ;; This is really just the same as above apart from getting the ;; address of xpos, I left it with this, instead of trying to ;; Poke my own program (by replacing YPOS address with XPOS). ld de,(xpos) ;; So with all the data being at XPOS & ld hl,(ypos) ;; YPOS, I can do a call for Plot Absolute call &bbea ret ;; Data Areas .xpos defw 0 ;; Section where XPOS & YPOS goes.ypos defw 0.adrxpos defw 0 ;; This is the address of the data for XPOS.adrypos defw 0 ;; Same as Above except for YPOS .data_xpos defw 0 ;; Leave this line here defw 0,2,4,6,8,10,12,14 ;; Sample Data (XPOS) defw 0,2,4,6,8,10,12,14 defw 0,2,4,6,8,10,12,14 defw 0,2,4,6,8,10,12,14 defw 0,2,4,6,8,10,12,14 defw 0,2,4,6,8,10,12,14 defw 0,2,4,6,8,10,12,14 defw 0,2,4,6,8,10,12,14 .data_ypos defw 0 ;; Leave this line alone defw 0,0,0,0,0,0,0,0 ;; Sample Data (YPOS) defw 2,2,2,2,2,2,2,2 defw 4,4,4,4,4,4,4,4 defw 6,6,6,6,6,6,6,6 defw 8,8,8,8,8,8,8,8 defw 10,10,10,10,10,10,10,10 defw 12,12,12,12,12,12,12,12 defw 14,14,14,14,14,14,14,14 .data_color defb 1,1,0,1,0,1,1,0 defb 0,3,3,3,3,3,0,0 defb 0,0,2,2,2,0,0,0 defb 0,0,2,2,2,0,0,0 defb 0,0,2,2,2,0,0,0 defb 0,0,2,2,2,0,0,0 defb 0,0,2,2,2,0,0,0 defb 0,0,0,1,0,0,0,0 .addrcolor defw 0
Quote from: CP/M User on 12:08, 03 March 11Interesting the number of ways you can Plot onscreen!
QuotePurpose? It's clearly not ideal for Sprite Handling, though it could be made to handle large fixed images without loading in 17k Screens perhaps. Maybe possible to reduce the size of this routine/program, by reducing the reoccuring xpos & ypos values. Otherwise it's simply another routine for the dust pile!
Quote from: arnoldemu on 23:29, 05 June 11Arrgh. I did another edit. And I thought I had just quoted EDIT: Is there a way for me to revert an edit I made to my own message?
QuoteNew source:http://www.cpctech.org.uk/source/fwdbuff.asmDouble buffering using the firmware.Demonstrates the firmware functions MC SCREEN OFFSET and SCR SET POSITION.Yes, even with the firmware you can double buffer graphics to make them flicker free if you want.
Quote from: arnoldemu on 11:12, 06 June 11Double buffering using the firmware.
Quote from: arnoldemu on 11:34, 05 July 12Please can we sticky this topic?
Quote from: Gryzor on 11:37, 05 July 12 Sure, but (since I haven't followed it), what is it about? The title isn't super-explanatory...
;; Draw loop in Assembly;; CP/M UserORG &4000 ;; This routine can go almost anywhere ;; Initialiation stuff ;; ld a,1;; call &bc0e ;; SCR SET MODE, Routine will work in any mode which is set.ld a,1call &bbde ;; GRA SET PEN (PEN 1)ld de,100 ;; xpos position to start atld hl,100 ;; ypos position to start at;; Changing these values will change where and how image is to be drawn.call &bbc0 ;; GRA MOVE ABSOLUTE;; Setup size of the Loop with points to plotld b,4 ;; number of points to loop for image.loop ;; The main loopld hl,(adrypos) ;; Address contents which points to image data for ypos goes into HL ld e,(hl) ;; \ inc hl ;; - Contents of HL which is ypos data (16bit number) goes into DE ld d,(hl) ;; /ex de,hl ;; That information (ypos data) needs to go into HL register push hl ;; But I need to protect that information so I can use HL.ld hl,(adrxpos) ;; Address contents which points to image data for xpos goes into HLld e,(hl) ;; \inc hl ;; - The same process now happens for xpos data (16bit number) going into DEld d,(hl) ;; /pop hl ;; I can now restore that ypos data back into HL...push bc ;; ...though I need to protect the loop counter. call &bbf6 ;; GRA LINE ABSOLUTE, Entry: HL = y-coordinate, DE = x-coordinate ;; Exit: AF, BC, DE & HL corrupt. pop bc ;; Restore loop counter.ld hl,(adrxpos) ;; \inc hl ;; - This moves address pointer for xpos to the following address & stores it.inc hl ;; - Because 16bit data is being used, HL is incremented twice.ld (adrxpos),hl ;; /ld hl,(adrypos) ;; \inc hl ;; - And the same thing applies for the address pointer for ypos data.inc hl ;; - And again 16bit data is used.ld (adrypos),hl ;; /djnz loop ;; If loop counter hasn't being reached, ;; loop counter is decreased by 1 until B = 0. ;; The following address pointer will then be used.ld hl,data_xpos ;; \ld (adrxpos),hl ;; : ;; - Once loop is finished, the data points for xpos & ypos needs to be restored.ld hl,data_ypos ;; :ld (adrypos),hl ;; /ret ;; Returns to BASIC (if called from there). .adrxposdefw data_xpos.adryposdefw data_ypos.data_xposdefw 100,200,200,100,0 ;; Standard graphic points to draw for xpos..data_yposdefw 200,150,100,100,0 ;; Standard graphic points to draw for ypos.
_cpc_Random:: LD A,(#valor_previo) LD L,A LD A,R ADD L LD (#valor_previo),A LD L,A LD H,#0 ; value return in HL RETvalor_previo: .db #0xFF
Page created in 0.224 seconds with 25 queries.