'=========================================================================== ' Subject: RELATING ASSEMBLY TO BASIC Date: 06-25-98 (00:00) ' Author: Matt Gulden Code: Text ' Origin: www.thrillhaus.com/basic.html Packet: FAQS.ABC '=========================================================================== ================================================== .oOo. Relating Assembly Language to BASIC by Matt Gulden (aka Folter) - mattg@thrillhaus.com ================================================== This article is intended to make learning asm (assembly language) easier by using references to BASIC. Now, let's get to the code! <<<<< The DEF SEG and POKE statements >>>>> Specifies memory segement that POKEs will use. Syntax: DEF SEG = segment: POKE location, value Example: DEF SEG = &HA000 POKE 0, 15 Example in ASM: ; We need to point ES to the segment of memory, but can't do it directly. ; This is the equivalent of DEF SEG mov ax, A000h mov es, ax ; This sets DI to 0, which is the location in memory we want to poke to. xor di, di ; AL will hold the value mov al, 15d ; STOSB moves AL to location DI at segment ES, and increments DI once, so if you did stosb ; again, it would poke to the location 1, instead of 0. stosb Now, there's also, STOSW, which would allow you to poke an entire word to memory, and it increments DI twice. <<<<< The SCREEN statement >>>>> Calls a certain screen mode. Syntax: screen mode (where mode is a screen mode) Example: SCREEN 13 Example in ASM: ; AX will contain the mode we want to call. Interrupt 10 will call the mode specified in AX. mov ax, 0013h int 10h <<<<< The OUT statement >>>>> Outputs a byte or a word to a certain port. Syntax: OUT port, value Example: OUT 968, 255 Example in ASM: ; Set port and value mov dx, 968d mov al, 255d out dx, al ; Now that would only output a byte. If you wanted to output a word, you can do this: mov dx, 968d mov ax, 255d out dx, ax ; You can only use AX and AL with the ASM out statement. -Matt Gulden