English Amiga Board Amiga Lore


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 17 March 2017, 11:22   #1
Retro1234
5150

Retro1234's Avatar
 
Join Date: Jun 2006
Location: Sycophantazia
Posts: 3,701
Blitz Basic 2 basics

This thread is for questions on the very basics.
Retro1234 is offline  
AdSense AdSense  
Old 17 March 2017, 11:23   #2
Retro1234
5150

Retro1234's Avatar
 
Join Date: Jun 2006
Location: Sycophantazia
Posts: 3,701
First questions using Inkey$ with raw key codes How?
Retro1234 is offline  
Old 17 March 2017, 11:32   #3
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 2,055
Inkey$ is used to take input from the current input stream, but it won't work in the Shell if that's what you're trying to do? Edit$ is used instead for taking a whole line. Also, from memory, Inkey$ gives you a cooked key, nor a rawkey, though I don't think that would make much of a difference.


What exactly are you trying to do?
Daedalus is offline  
Old 17 March 2017, 11:39   #4
Retro1234
5150

Retro1234's Avatar
 
Join Date: Jun 2006
Location: Sycophantazia
Posts: 3,701
So im in Blitz mode and want to control my objects from keyboard instead of joystick

A$=inkey
If a$="a"
print " a"
End if
Repeat

but instead of a$="a" I want to use the Raw keycodes
Retro1234 is offline  
Old 17 March 2017, 11:46   #5
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 2,055
Ah, ok. Well then Inkey$ probably isn't what you want then. You'll need to use the RawStatus() function and provide it with the rawkey code you're looking for. For example:

Code:
If RawStatus($45)
  Print "Escape pressed!"
End If
I think you need to turn on key reading in Blitz mode too if you haven't already done that.

Edit: Rawkey codes are laid out on a page at the back of the Blitz manual, but appear to be missing from the online manual. The codes can be found here in the first column.
Daedalus is offline  
Old 17 March 2017, 11:53   #6
Retro1234
5150

Retro1234's Avatar
 
Join Date: Jun 2006
Location: Sycophantazia
Posts: 3,701
Brilliant ill try it out
Retro1234 is offline  
Old 17 March 2017, 11:55   #7
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 2,055
Cool. Apparently you also need to have the command

Blitzkeys On

after you go into Blitz mode to enable reading of the keyboard...
Daedalus is offline  
Old 17 March 2017, 11:56   #8
Retro1234
5150

Retro1234's Avatar
 
Join Date: Jun 2006
Location: Sycophantazia
Posts: 3,701
Excellent
Retro1234 is offline  
Old 17 March 2017, 12:34   #9
Retro1234
5150

Retro1234's Avatar
 
Join Date: Jun 2006
Location: Sycophantazia
Posts: 3,701
We have a palette
0=Purple
1=Black
2=White
3=Orange

Cls 3 - an Orange Screen
Using Print Command
Change the Colour of the Text to White 2 and the border around the text to Black 1?
Retro1234 is offline  
Old 17 March 2017, 12:38   #10
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 2,055
Use the Colour command before the Print command:

Colour 2, 1

should work... You don't have to provide the second parameter, in which case the background will be whatever the background colour is on the bitmap.
Daedalus is offline  
Old 17 March 2017, 12:41   #11
Retro1234
5150

Retro1234's Avatar
 
Join Date: Jun 2006
Location: Sycophantazia
Posts: 3,701
Quote:
Originally Posted by Daedalus View Post
Use the Colour command before the Print command:

Colour 2, 1

should work... You don't have to provide the second parameter, in which case the background will be whatever the background colour is on the bitmap.
Excellent and the Colour command is only for use with the print command?

I hope this thread will be helpful for other people as well.
Retro1234 is offline  
Old 17 March 2017, 12:44   #12
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 2,055
Yep, it's only for when you're outputting text to a bitmap specifically.
Daedalus is offline  
Old 17 March 2017, 12:45   #13
Retro1234
5150

Retro1234's Avatar
 
Join Date: Jun 2006
Location: Sycophantazia
Posts: 3,701
Thanks again - now what question next
Retro1234 is offline  
Old 17 March 2017, 15:12   #14
witchmaster
Registered User

witchmaster's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 129
I have a question, what is the fastest method of using blockscroll without getting flicker? Now I use double buffering and BitMapCopy but is there a better way? This is probably a very stupid way of doing it

Last edited by witchmaster; 17 March 2017 at 15:24.
witchmaster is online now  
Old 17 March 2017, 16:31   #15
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 2,055
Hmmm, I don't really know about blockscrolling as I haven't really used it... Are you sure you're synchronising with the vertical blank though? What part of the display flickers?
Daedalus is offline  
Old 17 March 2017, 16:45   #16
witchmaster
Registered User

witchmaster's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 129
The whole screen flickers if I don't use double buffering, but the way I do double buffering now is probably very inefficient. I'm trying to figure out how to do 8way scrolling with a large tilemap, I haven't found any example how to do this. I was thinking of using blockscroll and drawing only blocks coming in. It's working in one direction now but probably very inefficient. This is my code:

Code:
; TILEMAP TEST

#bm_map_width = 22
#bm_map_height = 14

; Set default type to word
DEFTYPE .w

BitMap 0,352,224,4 ; Create bitmap1
BitMap 1,352,224,4 ; Create bitmap2
BitMap 2,192,128,4 ; Bitmap for tiles, create and set as used

LoadBitMap 2,"set.iff"
LoadPalette 0,"set.iff"

; Get shapes from the bitmap containing tiles (increase the max number of shapes in compiler options to 200)
i = 0
For y = 0 To 7
  For x = 0 To 11
    GetaShape i, x LSL 4, y LSL 4, 16, 16
    i = i + 1
  Next
Next

; Free the shapes bitmap
Free BitMap 2

; Use bitmap 0 (shown on screen)
Use BitMap 0

; Read the tile map
map_xmax = 0
map_ymax = 0
If ReadFile(0,"tilemap102x74.map")
  ReadMem 0, &map_xmax, 2 ; width in tiles
  ReadMem 0, &map_ymax, 2 ; height in tiles
  map_xmax-1 ; same as map_xmax = map_xmax - 1;
  map_ymax-1
  Dim mapa.b(map_xmax, map_ymax)
  ReadMem 0, &mapa.b(0,0), (map_xmax+1)*(map_ymax+1)
  CloseFile 0
EndIf

BLITZ ; Go into blitz mode

;Mouse On ; Turn on mouse

; Create the main slice (the bitmap width must be a multiple of 16, otherwise the graphics becomes scrambled)
; slice#, ypos, width, height, flags, bitplanes, sprites, colors, bitmap1_width, bitmap2_width
Slice 0,44,320,192,$fff8,4,8,16,352,352 

Use Palette 0

; Draw tiles to fill the whole bitmap
For y = 0 to #bm_map_height-1
  For x = 0 to #bm_map_width-1
    ; Map is exported from Tiled, there 0 means no tile, because of that the tile value is reduced by one
    Block mapa(x,y)-1, x LSL 4, y LSL 4 
  Next
Next

x_map = 1
y_map = 1
x_slice = 16
y_slice = 16
db = 0

; }

Repeat
  
  VWait
  
  Show db, x_slice, y_slice ; Show the slice
  CopyBitMap db, 1-db
  db = 1-db
  Use BitMap db
  
  If Joyx(1) = 1
  
    x_slice + 1
    
    If x_slice MOD 16 = 0
      BlockScroll 32,16,320,192,16,16
      For y = 1 to #bm_map_height-2
        Block mapa(mapposx+#bm_map_width,y)-1, 336, y LSL 4 
      Next
      mapposx + 1
      x_slice = 16
    EndIf
    
  End If
  
Until Joyb(1) > 0
witchmaster is online now  
Old 17 March 2017, 17:23   #17
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 2,055
Hmmm... You're copying the whole bitmap every frame? I don't think you would need to do that - just do the blocks that need to be redrawn on each bitmap as needed and swap it out. Copy the bitmap at the start before you enter the main loop and you should be fine. Other than that it looks ok to me, but I haven't tested it...
Daedalus is offline  
Old 17 March 2017, 17:58   #18
Retro1234
5150

Retro1234's Avatar
 
Join Date: Jun 2006
Location: Sycophantazia
Posts: 3,701
Next Question What does Blockscroll do?

Full hardware scrolling was done like this http://eab.abime.net/showthread.php?t=80646 or/and http://eab.abime.net/showthread.php?t=81634 or a large screen but this is a whole other thread

You can use DisplayBitMap to scroll the screen.

Last edited by Retro1234; 17 March 2017 at 18:10.
Retro1234 is offline  
Old 17 March 2017, 18:07   #19
witchmaster
Registered User

witchmaster's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 129
Ok thanks, so I need to handle the scrolling for both bitmaps separately somehow since they get "out of sync" every frame if scrolling.
witchmaster is online now  
Old 17 March 2017, 18:14   #20
witchmaster
Registered User

witchmaster's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 129
Quote:
Originally Posted by Retro1234 View Post
What does blockscroll do?

Full hardware scrolling was done like this http://eab.abime.net/showthread.php?t=80646 or/and http://eab.abime.net/showthread.php?t=81634 or a large screen but this is a whole other thread

You can use DisplayBitMap to scroll the screen.
BlockScroll moves or copies a part of a bitmap: http://amiga.sourceforge.net/amigade...&action=Search

I have been looking at the full hardware scrolling and have managed to do horisontal scrolling in both directions using corkscew with a 100 screen wide tilemap. First I did it with DisplayBitMap and copperlists but there seems to be a bug in DisplayBitMap, setting an x-value over 8191 ($1fff) will offset and garble the screen (so max 26 screens possible). When I switched to using slices it worked for at least 100 screens, didn't try anything bigger.

Doing 8way hardware scrolling is more complicated though.
witchmaster is online now  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
[blitz basic] How much amiga-blitz friendly is this? saimon69 Coders. Blitz Basic 104 29 November 2016 20:45
Blitz Basic (1) Retro1234 Coders. Blitz Basic 9 18 February 2016 17:54
Blitz basic 2 Help Havie Coders. Blitz Basic 30 08 September 2013 09:15
Blitz Basic 2 anyone? jobro request.Apps 12 28 November 2005 18:15
Blitz Basic 2 LaundroMat Retrogaming General Discussion 5 24 July 2001 08:10

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 22:30.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.32185 seconds with 13 queries