funkheld Posted September 21, 2018 Author Share Posted September 21, 2018 hello, good day. shifts in fastbasic, how does that work? Thank you. greeting Quote Link to comment Share on other sites More sharing options...
dmsc Posted September 21, 2018 Share Posted September 21, 2018 Hi! hello, good day. shifts in fastbasic, how does that work? Shift left is easy, simply multiply by 2. The optimizer recognizes the sequence " X * 2 " and converts it to "ShiftLeft X". Shift right is not easy, as integer division only works if the number is positive. What do you need to do? Perhaps it can be written in a form that does not need shifts. 1 Quote Link to comment Share on other sites More sharing options...
funkheld Posted September 22, 2018 Author Share Posted September 22, 2018 (edited) can you do anything with usr and asm? greeting Edited September 22, 2018 by funkheld Quote Link to comment Share on other sites More sharing options...
dmsc Posted September 22, 2018 Share Posted September 22, 2018 Hi! can you do anything with usr and asm? greeting Oh, yes, you can implement anything with USR ' Create shift left routines. ' Define a Machine Language routine: ' PLA/LSR/TAX/PLA/ROR/RTS data lsr_asm() byte = $68,$4a,$aa,$68,$6a,$60 ' PLA/TAX/PLA/TXA/LDX #0 /RTS data lsr8_asm() byte =$68,$aa,$68,$8a,$a2,$00,$60 ' Calls the routine with different values for i=0 to 2000 step 100 ? i, usr(adr(lsr_asm),i), usr(adr(lsr8_asm),i) next i 2 Quote Link to comment Share on other sites More sharing options...
funkheld Posted September 23, 2018 Author Share Posted September 23, 2018 (edited) Thanks for help. I also wanted to do an LSL: ' PLA/CLC/ROL/TAX/PLA/ROL/RTS data lsl_asm() byte = $68,$18,$2a,$aa,$68,$2a,$60 I do not get an integer as a result. why not? this is ok: ' PLA/LSR/TAX/PLA/ROR/RTSdata lsr_asm() byte = $68,$4a,$aa,$68,$6a,$60 greeting ' PLA/LSR/TAX/PLA/ROR/RTS data lsr_asm() byte = $68,$4a,$aa,$68,$6a,$60 ' PLA/CLC/ROL/TAX/PLA/ROL/RTS data lsl_asm() byte = $68,$18,$2a,$aa,$68,$2a,$60 z=0 i=8197 print i for y=0 to 12 z=usr(adr(lsr_asm),i) print z i=z next y ? "-----------------------" for y=0 to 12 z=usr(adr(lsl_asm),i) print z i=z next y repeat until key() greeting Edited September 23, 2018 by funkheld Quote Link to comment Share on other sites More sharing options...
dmsc Posted September 23, 2018 Share Posted September 23, 2018 Hi! Thanks for help. I also wanted to do an LSL: ' PLA/CLC/ROL/TAX/PLA/ROL/RTS data lsl_asm() byte = $68,$18,$2a,$aa,$68,$2a,$60 I do not get an integer as a result. why not? As I said before, in FastBasic it is faster to simply use "I*2", that will be optimized to la left shift. As to why your ASM routine does not work, it is because in assembler, to do a left shift, you need to shift the LOW part first, then the HIGH part (it is the same as multiplying or adding in decimal, you start with the rightmost digit). A proper ASM routine would be: ; Get 16 bit value from the stack to AX pla tax pla ; Shift left, first "A", then "X" (storing A into Y temporarily) asl tay txa rol tax tya ; Returns rts You can see the way FastBasic does it in the source: https://github.com/dmsc/fastbasic/blob/master/src/interp/ushl.asm#L35 But I repeat: a left-shift is exactly the same as multiplying by 2. 1 Quote Link to comment Share on other sites More sharing options...
funkheld Posted September 23, 2018 Author Share Posted September 23, 2018 (edited) Hello, I'm curious. I'm interested in how it works in asm Thank you. greeting Edited September 23, 2018 by funkheld Quote Link to comment Share on other sites More sharing options...
funkheld Posted September 23, 2018 Author Share Posted September 23, 2018 (edited) good evening. have now installed the lsr and lsl in a proc. a wonderful thing you did with fastbasic. Thank you. .global LSL .global LSR .proc LSL pla tax pla asl tay txa rol tax tya rts .endproc .proc LSR pla lsr tax pla ror rts .endproc a = 2 for z=0 to 7 a = usr(@lsl, a) ? a next z ? "-------------------" a = 1024 for z=0 to 7 a= usr(@lsr, a) ? a next z repeat until key() end Edited September 23, 2018 by funkheld Quote Link to comment Share on other sites More sharing options...
funkheld Posted September 24, 2018 Author Share Posted September 24, 2018 An ASM for a PROC to integrate. How can I implement that please? I can not do it. Thank you. Greeting .global SCREEN .proc SCREEN screen = $2100 ldy #textlen-1 loop lda text,y sta screen,y dey bpl loop rts text .sbyte "Hallo, ES GEHT..." textlen = * - text .endproc Quote Link to comment Share on other sites More sharing options...
funkheld Posted September 24, 2018 Author Share Posted September 24, 2018 How can I transfer a starting address to fb.bat or fb-int.bat in fastbasic please? --start-addr 0x2000 greeting. Quote Link to comment Share on other sites More sharing options...
vitoco Posted September 24, 2018 Share Posted September 24, 2018 How can I transfer a starting address to fb.bat or fb-int.bat in fastbasic please? --start-addr 0x2000 greeting. I guess it should be: fb.bat -S:0x2000 mygame.bas BTW, $2000 (0x2000) is the default as the FastBasic Cross Compiler usage manual sais. Quote Link to comment Share on other sites More sharing options...
dmsc Posted September 24, 2018 Share Posted September 24, 2018 Hi! I guess it should be: fb.bat -S:0x2000 mygame.bas BTW, $2000 (0x2000) is the default as the FastBasic Cross Compiler usage manual sais. Yes, but only in the development versions (the one I posted before), I'm waiting to release v3.6 after I accumulate more fixes. Quote Link to comment Share on other sites More sharing options...
funkheld Posted September 24, 2018 Author Share Posted September 24, 2018 (edited) I also use other start addresses: $ 3200 ... $ 3000 etc ... thanks for the help. fb.bat -S:0x2000 mygame.bas... this is very good. ------------------------------- Yes, but only in the development versions (the one I posted before), ------------------------------- can you please put her in here? thanks. greeting Edited September 24, 2018 by funkheld Quote Link to comment Share on other sites More sharing options...
dmsc Posted September 25, 2018 Share Posted September 25, 2018 Hi! I also use other start addresses: $ 3200 ... $ 3000 etc ... thanks for the help. fb.bat -S:0x2000 mygame.bas... this is very good. ------------------------------- Yes, but only in the development versions (the one I posted before), ------------------------------- can you please put her in here? thanks. greeting I posted it here: http://atariage.com/forums/topic/283102-how-can-you-use-fastbasic-a-hex-print-hex-54000/?p=4116728 Quote Link to comment Share on other sites More sharing options...
funkheld Posted September 26, 2018 Author Share Posted September 26, 2018 this not function: fb.bat -S:0x2000 mygame.bas fastbasic-v3.5-13-g6ef7472-win32.zip greeting Quote Link to comment Share on other sites More sharing options...
funkheld Posted October 2, 2018 Author Share Posted October 2, 2018 Hi good afternoon. which is madpas the smallest Madpas-system without any lib to use it to work with and what minimum instruction set does it have? greeting Quote Link to comment Share on other sites More sharing options...
funkheld Posted October 2, 2018 Author Share Posted October 2, 2018 (edited) Hi good afternoon. what is missing here please, that I can start this miniprogram? it is not compiled. I would like to practice with individual sharing. Thank you. greeting procedure InitGraph(mode: byte); var window: byte; begin GraphResult := 0; window := mode and $10; ScreenMode := mode; mode := mode and $0f; ScreenHeight := 192; case mode of 0,3: begin ScreenWidth := 40; ScreenHeight := 24 end; 5: begin ScreenWidth := 80; ScreenHeight := 48 end; 6..7: begin ScreenWidth := 160; ScreenHeight := 96 end; 8: ScreenWidth := 320; 9..11: ScreenWidth := 80; 15: ScreenWidth := 160 else GraphResult := 128; end; asm { txa:pha mva #$2c @putchar.vbxe ldy mode ldx #$60 ; 6*16 lda window ; %00010000 with text window eor #$10 ora #2 ; read .nowarn @graphics pla:tax }; end; procedure MoveTo(x, y: smallint); assembler; //---------------------------------------------------------------------------------------------- // Move cursor to absolute position //---------------------------------------------------------------------------------------------- asm { lda y+1 bpl _0 lda #0 sta y sta y+1 _0 lda x+1 bpl _1 lda #0 sta x sta x+1 _1 cpw y main.system.ScreenHeight bcc _2 sbw main.system.ScreenHeight #1 y _2 cpw x main.system.ScreenWidth bcc _3 sbw main.system.ScreenWidth #1 x _3 mwa x CurrentX mwa y CurrentY }; end; procedure LineTo(x, y: smallint); assembler; (* @description: Draw a line starting from current position to a given point *) asm { lda y+1 bpl _0 lda #0 sta y sta y+1 _0 lda x+1 bpl _1 lda #0 sta x sta x+1 _1 cpw y main.system.ScreenHeight bcc _2 sbw main.system.ScreenHeight #1 y _2 cpw x main.system.ScreenWidth bcc _3 sbw main.system.ScreenWidth #1 x _3 txa:pha mwa CurrentX colcrs mva CurrentY rowcrs lda #@IDput jsr @COMMAND lda x sta colcrs sta CurrentX lda x+1 sta colcrs+1 sta CurrentX+1 mva y rowcrs sta CurrentY lda y+1 sta CurrentY+1 lda #@IDdraw jsr @COMMAND pla:tax }; end; begin InitGraph(; MoveTo(10,10); LineTo(100,100); repeat until keypressed; end. Edited October 2, 2018 by funkheld Quote Link to comment Share on other sites More sharing options...
funkheld Posted October 2, 2018 Author Share Posted October 2, 2018 Hi good afternoon. how can you please a picture from screen 23 read? this is to screen 23 write : uses crt, graph; var f : file; s : string[15]; buf: ^byte; begin InitGraph(23); s := 'D:MULBI.BIN'; assign(f, s); reset(f, 1); buf:=pointer(dpeek(88)); blockread(f, buf, 3840); buf:=pointer(712); blockread(f, buf, 1); buf:=pointer(708); blockread(f, buf, 3); close(f); repeat until keypressed; end. Quote Link to comment Share on other sites More sharing options...
tebe Posted October 3, 2018 Share Posted October 3, 2018 buf: array [0..0] of byte; Quote Link to comment Share on other sites More sharing options...
funkheld Posted October 3, 2018 Author Share Posted October 3, 2018 hello, good day. I have a demo from a dli. that gives an error. where is the error please? Thank you. greeting uses crt, graph; var dlist : word; procedure DLI_routine; begin asm { stx @sp lda #<dli ; Set up our display list interrupt vector sta $200 lda #>dli sta $201 lda #$c0 ; Enable DLI + Vertical blank routines sta nmien }; gotoxy(8, 16); writeln('Some more text...'); asm { loop jmp loop ; Wait forever dli pha ; Save registers lda #0 ; New text color ldx #36 ; New background color stx WSYNC ; Wait sta COLPF1 ; Store color stx COLPF2 ; Store color pla ; Restore registers rti ; Done ldx @sp }; end; begin InitGraph(0); CursorOff; dlist := DPeek($230); Poke(dlist+16, 130); gotoxy(6, 5); writeln('Display list interrupt example'); DLI_routine; gotoxy(8, 20); writeln('Is this text shown?'); repeat until keypressed; end. Quote Link to comment Share on other sites More sharing options...
funkheld Posted October 3, 2018 Author Share Posted October 3, 2018 (edited) Habe eine Demo gefunden. gruss Edited October 3, 2018 by funkheld Quote Link to comment Share on other sites More sharing options...
vitoco Posted October 3, 2018 Share Posted October 3, 2018 Hey, you must save all the used registers at the beginning of the DLI, not only the accumulator. So, the sequence should be PHA, TXA and PHA in this case because you don't use Y register. At the end, the reverse to restore them: PLA, TAX and PLA. Quote Link to comment Share on other sites More sharing options...
funkheld Posted October 3, 2018 Author Share Posted October 3, 2018 thanks. this not function. greeting. Quote Link to comment Share on other sites More sharing options...
shanti77 Posted October 3, 2018 Share Posted October 3, 2018 Where you declared @sp? Quote Link to comment Share on other sites More sharing options...
tebe Posted October 3, 2018 Share Posted October 3, 2018 ldx #0 @sp equ *-1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.